config

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DefaultProvider   string           `yaml:"default_provider"`
	DefaultModel      string           `yaml:"default_model"`
	Theme             string           `yaml:"theme"`
	InstructionCompat []string         `yaml:"instruction_compat"`
	Permissions       PermissionConfig `yaml:"permissions"`
	Daemon            DaemonConfig     `yaml:"daemon"`
	ModelRouting      ModelRouting     `yaml:"model_routing"`
	Context           ContextConfig    `yaml:"context"`
	Trust             TrustConfig      `yaml:"trust"`
}

func DefaultConfig

func DefaultConfig() *Config

func Load

func Load() (*Config, error)

func (*Config) Save

func (c *Config) Save() error

type ContextConfig

type ContextConfig struct {
	// CompressionThreshold is the fraction of the model's context limit at which
	// auto-compression triggers (default 0.9).
	CompressionThreshold float64 `yaml:"compression_threshold"`
	// PreserveMessages is how many recent messages to keep verbatim after compression
	// (default 10).
	PreserveMessages int `yaml:"preserve_messages"`
	// CompressionModel overrides the model used for summarisation. Empty means
	// auto-select the cheapest available model.
	CompressionModel string `yaml:"compression_model"`
	// ModelLimits maps model names to their context window size in tokens.
	// Used by the chat handler to determine when to trigger compression.
	// Falls back to 200000 for unknown models.
	ModelLimits map[string]int `yaml:"model_limits"`
}

ContextConfig controls automatic context-window compression behaviour.

type DaemonConfig

type DaemonConfig struct {
	AutoStart   bool   `yaml:"auto_start"`
	IdleTimeout string `yaml:"idle_timeout"`
}

type ModelRouting

type ModelRouting struct {
	// SimpleTaskModel is used for lightweight steps (set, log, validate, etc.).
	SimpleTaskModel string `yaml:"simple_task_model"`
	// ComplexTaskModel is used for heavy steps (http_call, db_query, code execution, etc.).
	ComplexTaskModel string `yaml:"complex_task_model"`
	// ReviewModel is used for code review / plan review tasks.
	ReviewModel string `yaml:"review_model"`
}

ModelRouting controls which model handles which class of task.

type PermissionConfig

type PermissionConfig struct {
	AutoAllow []string `yaml:"auto_allow"`
	AlwaysAsk []string `yaml:"always_ask"`
}

type TrustConfig

type TrustConfig struct {
	Mode         string              `yaml:"mode"`
	Rules        []TrustRuleConfig   `yaml:"rules"`
	ProviderArgs map[string][]string `yaml:"provider_args"`
}

TrustConfig is the trust section of ~/.ratchet/config.yaml.

func (*TrustConfig) ProviderArgsFor

func (tc *TrustConfig) ProviderArgsFor(providerName string) []string

ProviderArgsFor returns CLI args for the given provider name.

func (*TrustConfig) ToTrustRules

func (tc *TrustConfig) ToTrustRules() []policy.TrustRule

ToTrustRules converts the config rules into policy.TrustRule values.

type TrustRuleConfig

type TrustRuleConfig struct {
	Pattern string `yaml:"pattern"`
	Action  string `yaml:"action"`
}

TrustRuleConfig is a single trust rule in the ratchet config format.

Jump to

Keyboard shortcuts

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