config

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProfileNotFound = &ProfileError{"profile not found"}
	ErrProfileExists   = &ProfileError{"profile already exists"}
)

Errors

Functions

This section is empty.

Types

type Config

type Config struct {
	// Cortex core settings
	Cortex CortexConfig `json:"cortex"`

	// Plugin settings
	Plugin PluginConfig `json:"plugin"`

	// Execution settings
	Execution ExecutionConfig `json:"execution"`

	// Memory settings
	Memory MemoryConfig `json:"memory"`

	// Logging settings
	Log LogConfig `json:"log"`

	// Server settings
	Server ServerConfig `json:"server"`
}

Config represents the application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

type ConfigManager

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

ConfigManager manages application configuration

func NewConfigManager

func NewConfigManager(configDir string) (*ConfigManager, error)

NewConfigManager creates a new configuration manager

func (*ConfigManager) ExportJSON

func (cm *ConfigManager) ExportJSON() ([]byte, error)

ExportJSON exports the configuration as JSON

func (*ConfigManager) Get

func (cm *ConfigManager) Get() *Config

Get returns the current configuration

func (*ConfigManager) GetCortex

func (cm *ConfigManager) GetCortex() CortexConfig

GetCortex returns Cortex (cognitive engine) configuration

func (*ConfigManager) GetExecution

func (cm *ConfigManager) GetExecution() ExecutionConfig

GetExecution returns execution configuration

func (*ConfigManager) GetLog

func (cm *ConfigManager) GetLog() LogConfig

GetLog returns log configuration

func (*ConfigManager) GetMemory

func (cm *ConfigManager) GetMemory() MemoryConfig

GetMemory returns memory configuration

func (*ConfigManager) GetPlugin

func (cm *ConfigManager) GetPlugin() PluginConfig

GetPlugin returns plugin configuration

func (*ConfigManager) GetServer

func (cm *ConfigManager) GetServer() ServerConfig

GetServer returns server configuration

func (*ConfigManager) Load

func (cm *ConfigManager) Load() error

Load loads configuration from file

func (*ConfigManager) Reload

func (cm *ConfigManager) Reload() error

Reload reloads configuration from file

func (*ConfigManager) Save

func (cm *ConfigManager) Save() error

Save saves configuration to file

func (*ConfigManager) Unwatch

func (cm *ConfigManager) Unwatch(ch chan *Config)

Unwatch stops watching for config updates

func (*ConfigManager) Update

func (cm *ConfigManager) Update(updates map[string]interface{}) error

Update updates configuration with a partial config

func (*ConfigManager) Validate

func (cm *ConfigManager) Validate() error

Validate validates the configuration

func (*ConfigManager) Watch

func (cm *ConfigManager) Watch() chan *Config

Watch returns a channel that receives config updates

type CortexConfig

type CortexConfig struct {
	// Memory settings
	MemoryLimit int `json:"memory_limit_mb"` // Memory limit in MB

	// Trigger settings
	NudgeInterval time.Duration `json:"nudge_interval"` // Interval between nudges
	NudgeEnabled  bool          `json:"nudge_enabled"`  // Enable/disable nudges

	// Review settings
	ReviewInterval time.Duration `json:"review_interval"` // Background review interval
	ReviewEnabled  bool          `json:"review_enabled"`  // Enable/disable reviews

	// FTS settings
	EnableFTS bool `json:"enable_fts"` // Enable full-text search
	FTSCache  bool `json:"fts_cache"`  // Enable FTS caching

	// Perception settings
	PerceptionConfidenceThreshold float64 `json:"perception_confidence_threshold"`
	PerceptionMaxHistory          int     `json:"perception_max_history"`

	// Cognition settings
	PlanningMaxSteps int           `json:"planning_max_steps"`
	PlanningTimeout  time.Duration `json:"planning_timeout"`

	// Skills settings
	AutoSkillCreation bool `json:"auto_skill_creation"`
	MinPatternFreq    int  `json:"min_pattern_frequency"`
}

CortexConfig contains Cortex agent configuration

type ExecutionConfig

type ExecutionConfig struct {
	// Iteration limits
	MaxIterations int `json:"max_iterations"` // Maximum iterations per task
	MaxDepth      int `json:"max_depth"`      // Maximum recursion depth

	// Checkpoint settings
	CheckpointsEnabled bool          `json:"checkpoints_enabled"`
	CheckpointFreq     int           `json:"checkpoint_frequency"` // Create checkpoint every N iterations
	CheckpointDir      string        `json:"checkpoint_dir"`
	CheckpointTTL      time.Duration `json:"checkpoint_ttl"` // How long to keep checkpoints

	// Recovery settings
	AutoResume          bool `json:"auto_resume"` // Auto-resume from checkpoint on failure
	MaxRecoveryAttempts int  `json:"max_recovery_attempts"`

	// Validation settings
	ValidationLevel string `json:"validation_level"` // "strict", "normal", "relaxed"
	FailOnWarning   bool   `json:"fail_on_warning"`

	// Timeout settings
	DefaultTimeout   time.Duration `json:"default_timeout"`
	LongRunningLimit time.Duration `json:"long_running_limit"`
}

ExecutionConfig contains execution layer configuration

type LogConfig

type LogConfig struct {
	// Output settings
	Level  string `json:"level"`  // debug, info, warn, error
	Format string `json:"format"` // text, json

	// File settings
	FileEnabled bool   `json:"file_enabled"`
	FilePath    string `json:"file_path"`
	MaxSizeMB   int    `json:"max_size_mb"`
	MaxBackups  int    `json:"max_backups"`
	MaxAgeDays  int    `json:"max_age_days"`

	// Output
	StdoutEnabled bool `json:"stdout_enabled"`
	StderrEnabled bool `json:"stderr_enabled"`
}

LogConfig contains logging configuration

type MemoryConfig

type MemoryConfig struct {
	// Storage settings
	StorageDir string `json:"storage_dir"` // Base storage directory
	MaxSizeMB  int64  `json:"max_size_mb"` // Maximum memory store size

	// FTS settings
	FTSEnabled     bool `json:"fts_enabled"`
	FTSMaxResults  int  `json:"fts_max_results"`
	FTSBoostRecent bool `json:"fts_boost_recent"` // Boost recent results

	// Importance decay
	EnableDecay bool    `json:"enable_decay"`
	DecayRate   float64 `json:"decay_rate"` // Daily decay rate (0-1)

	// Deduplication
	EnableDedup bool `json:"enable_dedup"` // Enable content deduplication

	// Cleanup settings
	CleanupEnabled   bool          `json:"cleanup_enabled"`
	CleanupInterval  time.Duration `json:"cleanup_interval"`
	CleanupOlderThan time.Duration `json:"cleanup_older_than"`
}

MemoryConfig contains memory system configuration

type PluginConfig

type PluginConfig struct {
	// Plugin loading
	AutoInstall bool     `json:"auto_install"` // Auto-install missing plugins
	AutoUpdate  bool     `json:"auto_update"`  // Auto-update plugins
	AllowedDirs []string `json:"allowed_dirs"` // Allowed plugin directories

	// Security
	SandboxEnabled bool          `json:"sandbox_enabled"` // Enable plugin sandboxing
	SandboxTimeout time.Duration `json:"sandbox_timeout"` // Sandbox timeout

	// Cache
	CacheEnabled bool   `json:"cache_enabled"` // Enable plugin cache
	CacheDir     string `json:"cache_dir"`     // Cache directory
}

PluginConfig contains plugin system configuration

type Profile

type Profile struct {
	Name    string `json:"name"`
	HomeDir string `json:"home_dir"`
	Active  bool   `json:"active"`
}

Profile represents a named configuration profile

type ProfileError

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

func (*ProfileError) Error

func (e *ProfileError) Error() string

type ProfileManager

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

ProfileManager manages multiple isolated configuration profiles

func NewProfileManager

func NewProfileManager(baseDir string) (*ProfileManager, error)

NewProfileManager creates a new profile manager

func (*ProfileManager) CloneProfile

func (pm *ProfileManager) CloneProfile(source, target string) (*Profile, error)

CloneProfile clones an existing profile to a new name

func (*ProfileManager) Create

func (pm *ProfileManager) Create(name string) (*Profile, error)

Create creates a new profile with the given name

func (*ProfileManager) Current

func (pm *ProfileManager) Current() *Profile

Current returns the currently active profile

func (*ProfileManager) Delete

func (pm *ProfileManager) Delete(name string) error

Delete deletes a profile by name

func (*ProfileManager) Get

func (pm *ProfileManager) Get(name string) (*Profile, error)

Get returns a profile by name

func (*ProfileManager) GetHomeDir

func (pm *ProfileManager) GetHomeDir(name string) string

GetHomeDir returns the home directory for a profile

func (*ProfileManager) List

func (pm *ProfileManager) List() []*Profile

List returns all profiles

func (*ProfileManager) Switch

func (pm *ProfileManager) Switch(name string) error

Switch switches to a different profile

type ProfileManagerConfig

type ProfileManagerConfig struct {
	BaseDir string `json:"base_dir"` // Base directory for profiles
	Current string `json:"current"`  // Current active profile name
}

ProfileManagerConfig holds configuration for the profile manager

type ServerConfig

type ServerConfig struct {
	Host string `json:"host"`
	Port int    `json:"port"`

	// TLS settings
	TLSEnabled bool   `json:"tls_enabled"`
	TLSCert    string `json:"tls_cert"`
	TLSKey     string `json:"tls_key"`

	// Timeouts
	ReadTimeout  time.Duration `json:"read_timeout"`
	WriteTimeout time.Duration `json:"write_timeout"`
	IdleTimeout  time.Duration `json:"idle_timeout"`

	// Limits
	MaxRequestSize    int64         `json:"max_request_size"`
	MaxHeaderBytes    int           `json:"max_header_bytes"`
	ReadHeaderTimeout time.Duration `json:"read_header_timeout"`
}

ServerConfig contains HTTP server configuration

Jump to

Keyboard shortcuts

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