storage

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 12 Imported by: 1 module, 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

func AddCustomAlias

func AddCustomAlias(db *DBStore, from, to string) error

AddCustomAlias adds or updates a single model alias.

func ApplyThinkingBudget

func ApplyThinkingBudget(reasoningEffort *string, maxTokens *int)

ApplyThinkingBudget modifies a request's reasoning tokens or effort based on policy.

func GetAllFallbackChains

func GetAllFallbackChains() map[string][]string

func InitFallbackChains

func InitFallbackChains(db *DBStore)

func InitModelAliases

func InitModelAliases(db *DBStore)

InitModelAliases loads custom aliases from SQLite key_value table.

func InitThinkingBudget

func InitThinkingBudget(db *DBStore)

InitThinkingBudget hydrates thinking budget from SQLite on startup.

func IsIPAllowed

func IsIPAllowed(ipStr string) bool

func RegisterFallbackChain

func RegisterFallbackChain(db *DBStore, model string, chain []string) error

func RemoveCustomAlias

func RemoveCustomAlias(db *DBStore, from string) error

RemoveCustomAlias deletes a single custom alias.

func RemoveFallbackChain

func RemoveFallbackChain(db *DBStore, model string) (bool, error)

func ResolveFallbackChain

func ResolveFallbackChain(model string) []string

ResolveFallbackModel checks if a model has a fallback chain configured.

func ResolveModelAlias

func ResolveModelAlias(model string) string

ResolveModelAlias transforms a model ID according to custom, then built-in aliases.

func SetCacheConfig

func SetCacheConfig(db *DBStore, cfg CacheConfig) error

func SetChaosConfig

func SetChaosConfig(cfg ChaosConfig)

SetChaosConfig updates chaos configuration.

func SetCustomAliases

func SetCustomAliases(db *DBStore, aliases map[string]string) error

SetCustomAliases replaces user custom aliases and saves to SQLite.

func SetIPFilterConfig

func SetIPFilterConfig(db *DBStore, cfg IPFilterConfig) error

func SetSystemPromptConfig

func SetSystemPromptConfig(db *DBStore, cfg SystemPromptConfig) error

func SetThinkingBudgetConfig

func SetThinkingBudgetConfig(db *DBStore, cfg ThinkingBudgetConfig) error

SetThinkingBudgetConfig updates in-memory and database thinking budget config.

Types

type A2ATask

type A2ATask struct {
	ID        string `json:"id"`
	Skill     string `json:"skill"`
	State     string `json:"state"` // submitted, working, completed, failed, cancelled
	Input     string `json:"input"`
	Result    string `json:"result,omitempty"`
	Error     string `json:"error,omitempty"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

A2ATask represents an Agent-to-Agent task execution unit.

type AuditLogRecord

type AuditLogRecord struct {
	ID           string    `json:"id"`
	Action       string    `json:"action"`
	Actor        string    `json:"actor"`
	Target       string    `json:"target,omitempty"`
	ResourceType string    `json:"resourceType,omitempty"`
	Status       string    `json:"status"`
	Details      string    `json:"details,omitempty"`
	IPAddress    string    `json:"ipAddress,omitempty"`
	Timestamp    time.Time `json:"timestamp"`
}

AuditLogRecord matches OmniRoute's administrative compliance action record.

type BackupMeta

type BackupMeta struct {
	Filename  string `json:"filename"`
	SizeBytes int64  `json:"sizeBytes"`
	CreatedAt string `json:"createdAt"`
}

BackupMeta describes an available snapshot.

func ListBackups

func ListBackups() ([]BackupMeta, error)

ListBackups scans ~/.goroute/backups for existing snapshots.

type BatchRecord

type BatchRecord struct {
	ID                string     `json:"id"`
	Endpoint          string     `json:"endpoint"`
	Status            string     `json:"status"` // "validating", "in_progress", "completed", "failed", "cancelled"
	InputFileID       string     `json:"inputFileId"`
	OutputFileID      string     `json:"outputFileId,omitempty"`
	ErrorFileID       string     `json:"errorFileId,omitempty"`
	TotalRequests     int        `json:"totalRequests"`
	CompletedRequests int        `json:"completedRequests"`
	FailedRequests    int        `json:"failedRequests"`
	CreatedAt         time.Time  `json:"createdAt"`
	CompletedAt       *time.Time `json:"completedAt,omitempty"`
}

BatchRecord matches OpenAI / OmniRoute batch jobs.

type BudgetCheckResult

type BudgetCheckResult struct {
	Allowed      bool    `json:"allowed"`
	Exceeded     bool    `json:"exceeded"`
	Warning      bool    `json:"warning"`
	PercentUsed  float64 `json:"percentUsed"`
	RemainingUSD float64 `json:"remainingUsd"`
}

BudgetCheckResult describes the quota status for a key.

type BudgetSummary

type BudgetSummary struct {
	APIKeyID          string            `json:"apiKeyId"`
	DailyLimitUSD     float64           `json:"dailyLimitUsd"`
	WeeklyLimitUSD    float64           `json:"weeklyLimitUsd"`
	MonthlyLimitUSD   float64           `json:"monthlyLimitUsd"`
	WarningThreshold  float64           `json:"warningThreshold"`
	ResetInterval     string            `json:"resetInterval"`
	ResetTime         string            `json:"resetTime"`
	BudgetResetAt     int64             `json:"budgetResetAt"`
	LastBudgetResetAt int64             `json:"lastBudgetResetAt"`
	TotalCostToday    float64           `json:"totalCostToday"`
	TotalCostMonth    float64           `json:"totalCostMonth"`
	TotalCostPeriod   float64           `json:"totalCostPeriod"`
	ActiveLimitUSD    float64           `json:"activeLimitUsd"`
	NextResetAt       string            `json:"nextResetAt"`
	PeriodStartAt     string            `json:"periodStartAt"`
	BudgetCheck       BudgetCheckResult `json:"budgetCheck"`
}

BudgetSummary is the comprehensive cost and budget status.

type CacheConfig

type CacheConfig struct {
	SemanticCacheEnabled   bool    `json:"semanticCacheEnabled"`
	SemanticCacheTTL       int     `json:"semanticCacheTTL"`
	SemanticCacheThreshold float64 `json:"semanticCacheThreshold"`
	PromptCacheEnabled     bool    `json:"promptCacheEnabled"`
	PromptCacheStrategy    string  `json:"promptCacheStrategy"` // "auto", "system-only", "manual"
	IdempotencyWindowMs    int     `json:"idempotencyWindowMs"`
}

CacheConfig matches OmniRoute's semantic cache & prompt cache settings.

func GetCacheConfig

func GetCacheConfig() CacheConfig

type CallLog

type CallLog struct {
	ID           string    `json:"id"`
	Timestamp    time.Time `json:"timestamp"`
	Model        string    `json:"model"`
	Provider     string    `json:"provider"`
	AccountID    string    `json:"account_id"`
	InputTokens  int       `json:"input_tokens"`
	OutputTokens int       `json:"output_tokens"`
	CostUSD      float64   `json:"cost_usd"`
	LatencyMs    int64     `json:"latency_ms"`
	StatusCode   int       `json:"status_code"`
	ErrorMessage string    `json:"error_message,omitempty"`
}

CallLog represents a persistent historical proxy query record.

type CallLogFilter

type CallLogFilter struct {
	Status       string `json:"status,omitempty"`
	Model        string `json:"model,omitempty"`
	Provider     string `json:"provider,omitempty"`
	Account      string `json:"account,omitempty"`
	Search       string `json:"search,omitempty"`
	ExcludeTests bool   `json:"exclude_tests,omitempty"`
	Limit        int    `json:"limit,omitempty"`
	Offset       int    `json:"offset,omitempty"`
}

CallLogFilter defines server-side search and pagination criteria for call logs.

type CallLogFilterOptions

type CallLogFilterOptions struct {
	Providers      []string        `json:"providers"`
	Models         []string        `json:"models"`
	Accounts       []string        `json:"accounts"`
	ConfiguredKeys []ConfiguredKey `json:"configuredKeys"`
}

CallLogFilterOptions represents available filter choices for frontend dropdowns.

type CapabilityStore

type CapabilityStore struct {
	// contains filtered or unexported fields
}

CapabilityStore manages model overrides persisted in SQLite.

func GetCapabilityStore

func GetCapabilityStore() *CapabilityStore

GetCapabilityStore returns the singleton capability store.

func (*CapabilityStore) DeleteOverride

func (s *CapabilityStore) DeleteOverride(provider, modelID, key string) error

DeleteOverride removes an override.

func (*CapabilityStore) ListOverrides

func (s *CapabilityStore) ListOverrides() ([]ModelCapabilityOverride, error)

ListOverrides returns all capability overrides.

func (*CapabilityStore) SetOverride

func (s *CapabilityStore) SetOverride(provider, modelID, key string, val any) error

SetOverride inserts or updates a model capability override.

type ChaosConfig

type ChaosConfig struct {
	Enabled          bool     `json:"enabled"`
	FailureRate      float64  `json:"failureRate"` // 0.0 to 1.0
	MinDelayMs       int      `json:"minDelayMs"`
	MaxDelayMs       int      `json:"maxDelayMs"`
	ErrorStatusCodes []int    `json:"errorStatusCodes"`
	Mode             string   `json:"mode"` // "parallel" | "collaborative"
	SystemPrompt     string   `json:"systemPrompt,omitempty"`
	Providers        []string `json:"providers,omitempty"`
}

ChaosConfig holds settings for resilience and chaos fault injection testing.

func GetChaosConfig

func GetChaosConfig() ChaosConfig

GetChaosConfig returns current chaos test configuration.

type CliToolState

type CliToolState struct {
	ToolID           string `json:"tool_id"`
	LastConfiguredAt int64  `json:"last_configured_at"`
	ConfigPath       string `json:"config_path"`
	Endpoint         string `json:"endpoint"`
}

CliToolState records configuration state for a developer CLI tool.

type ConductorStore

type ConductorStore struct {
	// contains filtered or unexported fields
}

ConductorStore handles conductor tasks, fleet nodes, and skills.

func GetConductorStore

func GetConductorStore() *ConductorStore

func (*ConductorStore) CreateSkill

func (s *ConductorStore) CreateSkill(name, description, mode, source string, tags []string) (SkillRecord, error)

func (*ConductorStore) CreateTask

func (s *ConductorStore) CreateTask(repoURL, prompt, baseRef, cli, model string) (ConductorTask, error)

func (*ConductorStore) ListSkills

func (s *ConductorStore) ListSkills() ([]SkillRecord, error)

func (*ConductorStore) ListTasks

func (s *ConductorStore) ListTasks(limit int) ([]ConductorTask, error)

type ConductorTask

type ConductorTask struct {
	ID        string    `json:"id"`
	RepoURL   string    `json:"repoUrl"`
	Prompt    string    `json:"prompt"`
	BaseRef   string    `json:"baseRef,omitempty"`
	Status    string    `json:"status"` // "queued", "running", "completed", "failed"
	Model     string    `json:"model,omitempty"`
	CLI       string    `json:"cli,omitempty"` // "opencode", "claude", "aider", "codex"
	CreatedAt time.Time `json:"createdAt"`
}

ConductorTask represents an autonomous coding agent orchestration job.

type ConfiguredKey

type ConfiguredKey struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type DBStore

type DBStore struct {
	// contains filtered or unexported fields
}

DBStore wraps SQLite database operations for GoRoute.

func GetDB

func GetDB() *DBStore

GetDB returns the initialized global DB store.

func InitDB

func InitDB(dbPath string) (*DBStore, error)

InitDB initializes SQLite storage in ~/.goroute/goroute.db

func (*DBStore) Close

func (s *DBStore) Close() error

Close closes the database connection.

func (*DBStore) DeleteCliToolState

func (s *DBStore) DeleteCliToolState(toolID string) error

DeleteCliToolState removes the configured state entry for a tool.

func (*DBStore) ExportDatabase

func (s *DBStore) ExportDatabase(w io.Writer) error

ExportDatabase writes a copy of the SQLite database to the given writer.

func (*DBStore) GetA2ATask

func (s *DBStore) GetA2ATask(id string) (*A2ATask, error)

GetA2ATask retrieves a single A2A task by ID.

func (*DBStore) GetA2ATaskStats

func (s *DBStore) GetA2ATaskStats() (map[string]int, error)

GetA2ATaskStats returns the count of tasks grouped by state.

func (*DBStore) GetAllBudgetSummaries

func (s *DBStore) GetAllBudgetSummaries() (map[string]BudgetSummary, error)

GetAllBudgetSummaries returns summaries for all configured domain budgets.

func (*DBStore) GetAllCliToolLastConfigured

func (s *DBStore) GetAllCliToolLastConfigured() (map[string]int64, error)

GetAllCliToolLastConfigured returns a map of toolID -> lastConfiguredAt Unix timestamp (ms or sec).

func (*DBStore) GetCliToolState

func (s *DBStore) GetCliToolState(toolID string) (*CliToolState, error)

GetCliToolState retrieves the persisted state for a specific tool.

func (*DBStore) GetContinuationState

func (s *DBStore) GetContinuationState(responseID, apiKeyID string) (*ResponsesContinuationState, error)

GetContinuationState retrieves continuation state scoped by apiKeyID.

func (*DBStore) GetCostSummary

func (s *DBStore) GetCostSummary(apiKeyID string) (BudgetSummary, error)

GetCostSummary computes current spend and compares against configured limits.

func (*DBStore) GetFilterOptions

func (s *DBStore) GetFilterOptions() (CallLogFilterOptions, error)

GetFilterOptions aggregates all distinct providers, models, and accounts seen in call_logs.

func (*DBStore) ListA2ATasks

func (s *DBStore) ListA2ATasks(state, skill string, limit, offset int) ([]A2ATask, int, error)

ListA2ATasks returns matching tasks with pagination and total count.

func (*DBStore) PruneContinuations

func (s *DBStore) PruneContinuations(maxAgeHours int) (int64, error)

PruneContinuations removes expired continuation records.

func (*DBStore) PurgeCallLogs

func (s *DBStore) PurgeCallLogs(cutoff time.Time) (PurgeResult, error)

PurgeCallLogs deletes call logs older than cutoff (or all logs if cutoff is zero).

func (*DBStore) QueryFilteredLogs

func (s *DBStore) QueryFilteredLogs(f CallLogFilter) ([]CallLog, error)

QueryFilteredLogs executes a SQL query on call_logs matching the exact OmniRoute filter semantics.

func (*DBStore) QueryRecentLogs

func (s *DBStore) QueryRecentLogs(limit, offset int) ([]CallLog, error)

QueryRecentLogs retrieves recent call logs with pagination.

func (*DBStore) RecordCall

func (s *DBStore) RecordCall(log CallLog) error

RecordCall logs an LLM request execution to SQLite.

func (*DBStore) RecordDomainCost

func (s *DBStore) RecordDomainCost(apiKeyID string, costUSD float64, model, provider string) error

RecordDomainCost records spend for an API key.

func (*DBStore) SaveCliToolState

func (s *DBStore) SaveCliToolState(toolID string, lastConfiguredAt int64, configPath, endpoint string) error

SaveCliToolState persists or updates the CLI tool's last configured timestamp and metadata.

func (*DBStore) SaveContinuationState

func (s *DBStore) SaveContinuationState(responseID, apiKeyID, callID, model, provider string, input, output interface{}) error

SaveContinuationState persists state for Responses API previous_response_id virtualization.

func (*DBStore) SetBudget

func (s *DBStore) SetBudget(b DomainBudget) error

SetBudget persists or updates budget limits for a key.

func (*DBStore) UpsertA2ATask

func (s *DBStore) UpsertA2ATask(task *A2ATask) error

UpsertA2ATask persists or updates an A2A task in SQLite.

type DiscoveryRecord

type DiscoveryRecord struct {
	ID           int        `json:"id"`
	ProviderID   string     `json:"providerId"`
	Method       string     `json:"method"` // "free_tier", "web_cookie", "public_api", "trial"
	Endpoint     string     `json:"endpoint,omitempty"`
	AuthType     string     `json:"authType"` // "none", "cookie", "api_key", "oauth"
	Models       []string   `json:"models"`
	RateLimit    string     `json:"rateLimit,omitempty"`
	Feasibility  int        `json:"feasibility"` // 0-100
	RiskLevel    string     `json:"riskLevel"`   // "none", "low", "medium", "high"
	Status       string     `json:"status"`      // "pending", "testing", "verified", "rejected"
	Notes        string     `json:"notes,omitempty"`
	DiscoveredAt time.Time  `json:"discoveredAt"`
	VerifiedAt   *time.Time `json:"verifiedAt,omitempty"`
}

DiscoveryRecord captures findings from automatic provider model discovery.

type DiscoveryStore

type DiscoveryStore struct {
	// contains filtered or unexported fields
}

DiscoveryStore manages discovery_results table in SQLite.

func GetDiscoveryStore

func GetDiscoveryStore() *DiscoveryStore

func (*DiscoveryStore) ListResults

func (s *DiscoveryStore) ListResults(providerID string) ([]DiscoveryRecord, error)

func (*DiscoveryStore) RecordDiscovery

func (s *DiscoveryStore) RecordDiscovery(rec DiscoveryRecord) (DiscoveryRecord, error)

type DomainBudget

type DomainBudget struct {
	APIKeyID          string  `json:"apiKeyId"`
	DailyLimitUSD     float64 `json:"dailyLimitUsd"`
	WeeklyLimitUSD    float64 `json:"weeklyLimitUsd"`
	MonthlyLimitUSD   float64 `json:"monthlyLimitUsd"`
	WarningThreshold  float64 `json:"warningThreshold"`
	ResetInterval     string  `json:"resetInterval"`
	ResetTime         string  `json:"resetTime"`
	BudgetResetAt     int64   `json:"budgetResetAt"`
	LastBudgetResetAt int64   `json:"lastBudgetResetAt"`
}

DomainBudget stores spend constraints for a specific API key or domain.

type EnterpriseStore

type EnterpriseStore struct {
	// contains filtered or unexported fields
}

EnterpriseStore handles batches, audit logs, and circuit breaker metrics.

func GetEnterpriseStore

func GetEnterpriseStore() *EnterpriseStore

func (*EnterpriseStore) CreateBatch

func (s *EnterpriseStore) CreateBatch(endpoint, inputFileID string, totalRequests int) (BatchRecord, error)

CreateBatch inserts a new batch execution job.

func (*EnterpriseStore) ListBatches

func (s *EnterpriseStore) ListBatches(limit int) ([]BatchRecord, error)

ListBatches returns registered batch jobs.

func (*EnterpriseStore) QueryAuditLogs

func (s *EnterpriseStore) QueryAuditLogs(limit, offset int) ([]AuditLogRecord, int, error)

QueryAuditLogs retrieves audit logs with limit/offset.

func (*EnterpriseStore) RecordAudit

func (s *EnterpriseStore) RecordAudit(rec AuditLogRecord) error

RecordAudit logs an administrative event into compliance audit_logs.

type EvalCaseRecord

type EvalCaseRecord struct {
	ID        string    `json:"id"`
	SuiteID   string    `json:"suiteId"`
	Name      string    `json:"name"`
	Model     string    `json:"model,omitempty"`
	Input     string    `json:"input"`    // prompt or json messages
	Strategy  string    `json:"strategy"` // "contains", "exact", "regex"
	Expected  string    `json:"expected"`
	CreatedAt time.Time `json:"createdAt"`
}

EvalCaseRecord represents a single test prompt and expected response predicate.

type EvalCorpusStore

type EvalCorpusStore struct {
	// contains filtered or unexported fields
}

EvalCorpusStore manages evals and local corpus in SQLite.

func GetEvalCorpusStore

func GetEvalCorpusStore() *EvalCorpusStore

func (*EvalCorpusStore) CreateSuite

func (s *EvalCorpusStore) CreateSuite(name, description string) (EvalSuiteRecord, error)

func (*EvalCorpusStore) GetLocalCorpusConfig

func (s *EvalCorpusStore) GetLocalCorpusConfig() LocalCorpusConfig

GetLocalCorpusConfig reads the configured local corpus settings.

func (*EvalCorpusStore) ListRuns

func (s *EvalCorpusStore) ListRuns(limit int) ([]EvalRunRecord, error)

func (*EvalCorpusStore) ListSuites

func (s *EvalCorpusStore) ListSuites() ([]EvalSuiteRecord, error)

func (*EvalCorpusStore) RecordRun

func (s *EvalCorpusStore) RecordRun(run EvalRunRecord) error

func (*EvalCorpusStore) SetLocalCorpusRoot

func (s *EvalCorpusStore) SetLocalCorpusRoot(path string) error

SetLocalCorpusRoot stores the corpus directory path in SQLite.

type EvalRunRecord

type EvalRunRecord struct {
	ID         string    `json:"id"`
	SuiteID    string    `json:"suiteId"`
	Target     string    `json:"target"`
	Total      int       `json:"total"`
	Passed     int       `json:"passed"`
	Failed     int       `json:"failed"`
	PassRate   float64   `json:"passRate"`
	DurationMs int64     `json:"durationMs"`
	CreatedAt  time.Time `json:"createdAt"`
}

EvalRunRecord captures results of a run against a model or combo target.

type EvalSuiteRecord

type EvalSuiteRecord struct {
	ID          string           `json:"id"`
	Name        string           `json:"name"`
	Description string           `json:"description,omitempty"`
	CaseCount   int              `json:"caseCount"`
	Cases       []EvalCaseRecord `json:"cases,omitempty"`
	CreatedAt   time.Time        `json:"createdAt"`
	UpdatedAt   time.Time        `json:"updatedAt"`
}

EvalSuiteRecord represents an evaluation suite.

type FallbackChainMap

type FallbackChainMap struct {
	Chains map[string][]string `json:"chains"`
}

FallbackChainMap stores model -> []targetModel failover sequences.

type FleetAgent

type FleetAgent struct {
	ID       string    `json:"id"`
	Name     string    `json:"name"`
	CLI      string    `json:"cli"`
	Status   string    `json:"status"` // "idle", "busy", "offline"
	TaskID   string    `json:"taskId,omitempty"`
	LastSeen time.Time `json:"lastSeen"`
}

FleetAgent represents an active worker node in the Conductor fleet.

type FreeModelBudget

type FreeModelBudget struct {
	Provider      string `json:"provider"`
	ModelID       string `json:"modelId"`
	DisplayName   string `json:"displayName"`
	MonthlyTokens int64  `json:"monthlyTokens"`
	CreditTokens  int64  `json:"creditTokens"`
	FreeType      string `json:"freeType"` // "monthly" | "credit" | "unlimited"
	PoolKey       string `json:"poolKey"`
	ToS           string `json:"tos"`
}

FreeModelBudget describes a provider model offering a free quota tier.

func DefaultFreeModels

func DefaultFreeModels() []FreeModelBudget

DefaultFreeModels returns curated list of free models across providers.

type IPFilterConfig

type IPFilterConfig struct {
	Enabled   bool     `json:"enabled"`
	Mode      string   `json:"mode"` // "blacklist" or "whitelist"
	Blacklist []string `json:"blacklist"`
	Whitelist []string `json:"whitelist"`
}

IPFilterConfig holds blacklist, whitelist, and IP enforcement mode.

func GetIPFilterConfig

func GetIPFilterConfig() IPFilterConfig

type LocalCorpusConfig

type LocalCorpusConfig struct {
	Configured bool   `json:"configured"`
	RootPath   string `json:"rootPath"`
	Status     string `json:"status"` // "ready", "indexing", "idle"
}

LocalCorpusConfig holds the configured root path for RAG index ingestion.

type ModelAliasMap

type ModelAliasMap struct {
	BuiltIn map[string]string `json:"builtIn"`
	Custom  map[string]string `json:"custom"`
	All     map[string]string `json:"all"`
}

ModelAliasMap holds built-in and user-configured model alias translations.

func GetModelAliasesSnapshot

func GetModelAliasesSnapshot() ModelAliasMap

GetModelAliasesSnapshot returns complete maps for GET /api/settings/model-aliases.

type ModelCapabilityOverride

type ModelCapabilityOverride struct {
	Provider    string `json:"provider"`
	ModelID     string `json:"modelId"`
	Target      string `json:"target"`
	Key         string `json:"key"`   // "context_length", "max_input_tokens", "max_output_tokens", "reasoning_efforts"
	Value       any    `json:"value"` // number or []string
	RefreshedAt string `json:"refreshedAt"`
}

ModelCapabilityOverride represents an operator's per-model runtime override.

type ModelPricing

type ModelPricing struct {
	Input  float64 `json:"input"`
	Output float64 `json:"output"`
	Cached float64 `json:"cached,omitempty"`
}

ModelPricing represents token rates per million tokens.

type PricingStore

type PricingStore struct {
	// contains filtered or unexported fields
}

PricingStore manages default and custom token pricing per provider and model.

func GetPricingStore

func GetPricingStore() *PricingStore

func (*PricingStore) GetPricing

func (s *PricingStore) GetPricing() map[string]map[string]ModelPricing

func (*PricingStore) UpdatePricing

func (s *PricingStore) UpdatePricing(overrides map[string]map[string]ModelPricing) error

type ProxyAssignment

type ProxyAssignment struct {
	ID        int64     `json:"id"`
	ProxyID   string    `json:"proxyId"`
	Scope     string    `json:"scope"` // "global", "provider", "connection"
	ScopeID   string    `json:"scopeId,omitempty"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

ProxyAssignment represents a route mapping (global, per-provider, or per-connection).

type ProxyRecord

type ProxyRecord struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Type      string    `json:"type"` // "http", "https", "socks5"
	Host      string    `json:"host"`
	Port      int       `json:"port"`
	Username  string    `json:"username,omitempty"`
	Password  string    `json:"password,omitempty"`
	Region    string    `json:"region,omitempty"`
	Notes     string    `json:"notes,omitempty"`
	Status    string    `json:"status"` // "active", "inactive", "error"
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

ProxyRecord represents a proxy registration in proxy_registry.

type ProxyStore

type ProxyStore struct {
	// contains filtered or unexported fields
}

ProxyStore manages proxy registrations and route assignments in SQLite.

func GetProxyStore

func GetProxyStore() *ProxyStore

GetProxyStore returns the singleton proxy store.

func (*ProxyStore) CreateProxy

func (s *ProxyStore) CreateProxy(p ProxyRecord) error

CreateProxy adds a new proxy into the registry.

func (*ProxyStore) DeleteProxy

func (s *ProxyStore) DeleteProxy(id string) error

DeleteProxy removes a proxy from the registry and any assignments referencing it.

func (*ProxyStore) ListProxies

func (s *ProxyStore) ListProxies() ([]ProxyRecord, error)

ListProxies returns all registered proxies.

type PurgeResult

type PurgeResult struct {
	Deleted          int64 `json:"deleted"`
	DeletedArtifacts int64 `json:"deletedArtifacts"`
	Errors           int   `json:"errors"`
}

PurgeResult holds metrics from a purge operation.

type QuotaGroup

type QuotaGroup struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"createdAt"`
}

QuotaGroup defines a pooled quota allocation group.

type QuotaGroupStore

type QuotaGroupStore struct {
	// contains filtered or unexported fields
}

QuotaGroupStore manages quota_groups table in SQLite.

func GetQuotaGroupStore

func GetQuotaGroupStore() *QuotaGroupStore

func (*QuotaGroupStore) CreateGroup

func (s *QuotaGroupStore) CreateGroup(name string) (QuotaGroup, error)

func (*QuotaGroupStore) ListGroups

func (s *QuotaGroupStore) ListGroups() ([]QuotaGroup, error)

type QuotaPool

type QuotaPool struct {
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	GroupID      string    `json:"groupId,omitempty"`
	ConnectionID string    `json:"connectionId,omitempty"`
	Strategy     string    `json:"strategy"` // "weight", "cap", "fair_share"
	MaxTokens    int64     `json:"maxTokens,omitempty"`
	CreatedAt    time.Time `json:"createdAt"`
}

QuotaPool defines a shared quota allocation pool.

type QuotaPoolStore

type QuotaPoolStore struct {
	// contains filtered or unexported fields
}

QuotaPoolStore manages the quota_pools table in SQLite.

func GetQuotaPoolStore

func GetQuotaPoolStore() *QuotaPoolStore

func (*QuotaPoolStore) CreatePool

func (s *QuotaPoolStore) CreatePool(name, groupID, connectionID, strategy string, maxTokens int64) (QuotaPool, error)

func (*QuotaPoolStore) ListPools

func (s *QuotaPoolStore) ListPools() ([]QuotaPool, error)

type RadarCatalogEntry

type RadarCatalogEntry struct {
	ID          string    `json:"id"`
	Provider    string    `json:"provider"`
	Model       string    `json:"model"`
	Status      string    `json:"status"` // "online", "degraded", "offline"
	LatencyP50  int       `json:"latencyP50"`
	LatencyP99  int       `json:"latencyP99"`
	SuccessRate float64   `json:"successRate"`
	FreeTier    bool      `json:"freeTier"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

RadarCatalogEntry matches an active provider model availability intelligence entry.

type RadarStatusSummary

type RadarStatusSummary struct {
	Enabled     bool       `json:"enabled"`
	Available   bool       `json:"available"`
	Version     string     `json:"version"`
	Tier        string     `json:"tier"` // "community", "pro", "enterprise"
	TotalModels int        `json:"totalModels"`
	FetchedAt   *time.Time `json:"fetchedAt,omitempty"`
}

RadarStatusSummary reports local radar synchronization status.

type RadarStore

type RadarStore struct {
	// contains filtered or unexported fields
}

RadarStore handles market intelligence, uptime radar, and dynamic catalog syncing.

func GetRadarStore

func GetRadarStore() *RadarStore

func (*RadarStore) GetStatus

func (s *RadarStore) GetStatus() RadarStatusSummary

func (*RadarStore) ListEntries

func (s *RadarStore) ListEntries() ([]RadarCatalogEntry, error)

func (*RadarStore) SyncRadarCatalog

func (s *RadarStore) SyncRadarCatalog() (int, error)

type ResponsesContinuationState

type ResponsesContinuationState struct {
	ResponseID string      `json:"response_id"`
	APIKeyID   string      `json:"api_key_id"`
	Model      string      `json:"model"`
	Provider   string      `json:"provider"`
	Input      interface{} `json:"input"`
	Output     interface{} `json:"output"`
	CreatedAt  time.Time   `json:"created_at"`
}

ResponsesContinuationState contains reconstructed input/output items.

type SettingsStore

type SettingsStore struct {
	// contains filtered or unexported fields
}

SettingsStore manages persistent settings in SQLite key_value table.

func GetSettingsStore

func GetSettingsStore() *SettingsStore

GetSettingsStore returns the singleton settings store.

func (*SettingsStore) LoadSettings

func (s *SettingsStore) LoadSettings() (SystemSettings, error)

LoadSettings reads merged settings (defaults + SQLite overrides).

func (*SettingsStore) UpdateKey

func (s *SettingsStore) UpdateKey(key string, val any) error

UpdateKey writes a specific setting key into key_value table.

type SkillRecord

type SkillRecord struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Mode        string    `json:"mode"` // "on", "off", "auto"
	Tags        []string  `json:"tags"`
	Source      string    `json:"source"` // "local", "skillsmp", "skillssh"
	Enabled     bool      `json:"enabled"`
	CreatedAt   time.Time `json:"createdAt"`
}

SkillRecord represents an agent tool skill in the skills registry.

type SystemPromptConfig

type SystemPromptConfig struct {
	Enabled      bool   `json:"enabled"`
	PrefixPrompt string `json:"prefixPrompt"`
	SuffixPrompt string `json:"suffixPrompt"`
}

SystemPromptConfig holds prefix, suffix, and master toggle for prompt injection.

func GetSystemPromptConfig

func GetSystemPromptConfig() SystemPromptConfig

type SystemSettings

type SystemSettings struct {
	CloudEnabled                        bool              `json:"cloudEnabled"`
	TailscaleEnabled                    bool              `json:"tailscaleEnabled"`
	TailscaleURL                        string            `json:"tailscaleUrl"`
	StickyRoundRobinLimit               int               `json:"stickyRoundRobinLimit"`
	DisableSessionStickiness            bool              `json:"disableSessionStickiness"`
	ConnectionAwareExpansion            bool              `json:"connectionAwareExpansion"`
	PromptCacheAffinityEnabled          bool              `json:"promptCacheAffinityEnabled"`
	ComboStrategy                       string            `json:"comboStrategy"`
	ComboStickyRoundRobinLimit          *int              `json:"comboStickyRoundRobinLimit,omitempty"`
	ProviderStrategies                  map[string]string `json:"providerStrategies"`
	RequestRetry                        int               `json:"requestRetry"`
	MaxRetryIntervalSec                 int               `json:"maxRetryIntervalSec"`
	RequireLogin                        bool              `json:"requireLogin"`
	CredentialRedactionEnabled          bool              `json:"credentialRedactionEnabled"`
	PiiRedactionEnabled                 bool              `json:"piiRedactionEnabled"`
	AutoRefreshProviderQuota            bool              `json:"autoRefreshProviderQuota"`
	AutoRefreshProviderQuotaInterval    int               `json:"autoRefreshProviderQuotaInterval"`
	ComboConfigMode                     string            `json:"comboConfigMode"`
	ResponsesPreviousResponseIDMode     string            `json:"responsesPreviousResponseIdMode"`
	DebugMode                           bool              `json:"debugMode"`
	ProxyEnabled                        bool              `json:"proxyEnabled"`
	CustomSystemPromptEnabled           bool              `json:"customSystemPromptEnabled"`
	CustomSystemPrompt                  string            `json:"customSystemPrompt"`
	PreferClaudeCodeForUnprefixedClaude bool              `json:"preferClaudeCodeForUnprefixedClaudeModels"`
	ClaudeClassifierCompat              string            `json:"claudeClassifierCompat"`
	SessionAffinityTTLMs                int               `json:"sessionAffinityTtlMs"`
	LocalOnlyManageScopeBypassEnabled   bool              `json:"localOnlyManageScopeBypassEnabled"`
	HiddenSidebarItems                  []string          `json:"hiddenSidebarItems"`
}

SystemSettings matches OmniRoute's complete key_value runtime settings map.

func DefaultSettings

func DefaultSettings() SystemSettings

DefaultSettings returns full default values conforming to OmniRoute core defaults.

type ThinkingBudgetConfig

type ThinkingBudgetConfig struct {
	Mode         string `json:"mode"`         // "passthrough", "auto", "custom", "adaptive"
	CustomBudget int    `json:"customBudget"` // token limit when mode is "custom"
	EffortLevel  string `json:"effortLevel"`  // "none", "low", "medium", "high", "max"
}

ThinkingBudgetConfig defines global reasoning/thinking token budget policy.

func GetThinkingBudgetConfig

func GetThinkingBudgetConfig() ThinkingBudgetConfig

GetThinkingBudgetConfig returns active thinking budget configuration.

type TokenHealthSummary

type TokenHealthSummary struct {
	Total       int        `json:"total"`
	Healthy     int        `json:"healthy"`
	Errored     int        `json:"errored"`
	Warning     int        `json:"warning"`
	LastCheckAt *time.Time `json:"lastCheckAt,omitempty"`
	Status      string     `json:"status"` // "healthy", "warning", "error", "unknown"
}

TokenHealthSummary reports aggregate OAuth token statuses.

type WebhookStore

type WebhookStore struct {
	// contains filtered or unexported fields
}

WebhookStore manages webhooks table in SQLite.

func GetWebhookStore

func GetWebhookStore() *WebhookStore

func (*WebhookStore) CreateWebhook

func (s *WebhookStore) CreateWebhook(url, secret, description, kind string, events []string) (WebhookSubscription, error)

func (*WebhookStore) DeleteWebhook

func (s *WebhookStore) DeleteWebhook(id string) error

func (*WebhookStore) ListWebhooks

func (s *WebhookStore) ListWebhooks() ([]WebhookSubscription, error)

type WebhookSubscription

type WebhookSubscription struct {
	ID              string     `json:"id"`
	URL             string     `json:"url"`
	Events          []string   `json:"events"`
	Secret          string     `json:"secret,omitempty"`
	Enabled         bool       `json:"enabled"`
	Description     string     `json:"description,omitempty"`
	Kind            string     `json:"kind"` // "slack", "telegram", "discord", "custom"
	LastTriggeredAt *time.Time `json:"lastTriggeredAt,omitempty"`
	LastStatus      *int       `json:"lastStatus,omitempty"`
	FailureCount    int        `json:"failureCount"`
	CreatedAt       time.Time  `json:"createdAt"`
}

WebhookSubscription defines an automated outbound notification target.

Jump to

Keyboard shortcuts

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