runtimecontrol

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 7 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

Overview

Package runtimecontrol defines database-backed runtime control contracts.

Index

Constants

View Source
const (
	DefaultCredentialWeight = int64(1)
	MaxCredentialWeight     = int64(1_000_000)
	DefaultLiveMaxSessions  = 32
	MaxLiveMaxSessions      = 1024
	MaxIdentityLength       = 256
	MaxProviderLength       = 64
	MaxICEServers           = 32
	MaxICEURLsPerServer     = 16
)

Variables

View Source
var ErrRevisionConflict = errors.New("runtime control settings revision conflict")

ErrRevisionConflict reports an expected-revision mismatch without mutation.

Functions

This section is empty.

Types

type CloakingSettings

type CloakingSettings struct {
	DisableClaudeModelList bool `json:"disable_claude_model_list"`
	DisableCodex           bool `json:"disable_codex"`
}

CloakingSettings controls provider compatibility identity behavior.

type CodexLiveSettings

type CodexLiveSettings struct {
	Enabled                 bool        `json:"enabled"`
	MaxSessions             int         `json:"max_sessions"`
	DisablePrivateRemoteIPs bool        `json:"disable_private_remote_ips"`
	PublicIP                string      `json:"public_ip,omitempty"`
	UDPPortMin              int         `json:"udp_port_min"`
	UDPPortMax              int         `json:"udp_port_max"`
	ICEServers              []ICEServer `json:"ice_servers"`
}

CodexLiveSettings controls the Codex Live media relay.

func (CodexLiveSettings) Validate

func (s CodexLiveSettings) Validate() error

Validate verifies Codex Live relay bounds without activating the relay.

type CredentialRoutingSettings

type CredentialRoutingSettings struct {
	Strategy RoutingStrategy    `json:"strategy"`
	Weights  []CredentialWeight `json:"weights"`
}

CredentialRoutingSettings configures credential scheduling and weight overrides.

type CredentialWeight

type CredentialWeight struct {
	AuthID   string `json:"auth_id"`
	Provider string `json:"provider"`
	Weight   int64  `json:"weight"`
}

CredentialWeight overrides the default weight for one durable credential identity.

type HomeSettings

type HomeSettings struct {
	Enabled                 bool `json:"enabled"`
	DisableClusterDiscovery bool `json:"disable_cluster_discovery"`
}

HomeSettings controls local participation in a Home cluster.

type ICEServer

type ICEServer struct {
	URLs     []string `json:"urls"`
	Username string   `json:"username,omitempty"`
}

ICEServer configures one STUN or TURN server used by Codex Live. Credential material is intentionally excluded from this foundation contract.

type RoutingStrategy

type RoutingStrategy string

RoutingStrategy selects the credential scheduling policy.

const (
	RoutingRoundRobin         RoutingStrategy = "round-robin"
	RoutingWeightedRoundRobin RoutingStrategy = "weighted-round-robin"
	RoutingFillFirst          RoutingStrategy = "fill-first"
)

type Settings

type Settings struct {
	Revision                   int64                     `json:"revision"`
	CredentialRouting          CredentialRoutingSettings `json:"credential_routing"`
	Cloaking                   CloakingSettings          `json:"cloaking"`
	CodexLive                  CodexLiveSettings         `json:"codex_live"`
	Home                       HomeSettings              `json:"home"`
	CooldownPersistenceEnabled bool                      `json:"cooldown_persistence_enabled"`
}

Settings contains all database-authoritative runtime controls.

func DefaultSettings

func DefaultSettings() Settings

DefaultSettings returns disabled, backward-compatible runtime controls.

func (Settings) Clone

func (s Settings) Clone() Settings

Clone returns a deep copy safe for independent mutation.

func (Settings) Normalize

func (s Settings) Normalize() (Settings, error)

Normalize canonicalizes settings and validates the resulting value.

func (Settings) Validate

func (s Settings) Validate() error

Validate verifies settings before persistence or activation.

func (Settings) WithDefaults

func (s Settings) WithDefaults() Settings

WithDefaults fills omitted values without enabling a feature.

type SettingsStore

type SettingsStore interface {
	LoadRuntimeSettings(context.Context) (Settings, error)
	SaveRuntimeSettings(context.Context, int64, Settings) (Settings, error)
}

SettingsStore persists runtime controls with optimistic revision checks.

Jump to

Keyboard shortcuts

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