config

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveEnvironmentVariables added in v0.32.0

func ResolveEnvironmentVariables(value string) string

ResolveEnvironmentVariables resolves environment variable references in the format %VAR_NAME%

Types

type AgentConfig added in v0.36.0

type AgentConfig struct {
	Model           string                `yaml:"model"`
	SystemPrompt    string                `yaml:"system_prompt"`
	SystemReminders SystemRemindersConfig `yaml:"system_reminders"`
	VerboseTools    bool                  `yaml:"verbose_tools"`
	MaxTurns        int                   `yaml:"max_turns"`
	MaxTokens       int                   `yaml:"max_tokens"`
	Optimization    OptimizationConfig    `yaml:"optimization"`
}

AgentConfig contains agent command-specific settings

type BashToolConfig added in v0.14.1

type BashToolConfig struct {
	Enabled         bool                `yaml:"enabled"`
	Whitelist       ToolWhitelistConfig `yaml:"whitelist"`
	RequireApproval *bool               `yaml:"require_approval,omitempty"`
}

BashToolConfig contains bash-specific tool settings

type ChatConfig added in v0.8.0

type ChatConfig struct {
}

ChatConfig contains chat-related settings

type ClientConfig added in v0.36.0

type ClientConfig struct {
	Timeout int         `yaml:"timeout"`
	Retry   RetryConfig `yaml:"retry"`
}

ClientConfig contains HTTP client settings

type CompactConfig added in v0.2.0

type CompactConfig struct {
	OutputDir    string `yaml:"output_dir"`
	SummaryModel string `yaml:"summary_model"`
}

CompactConfig contains settings for compact command

type Config

type Config struct {
	Gateway GatewayConfig `yaml:"gateway"`
	Client  ClientConfig  `yaml:"client"`
	Logging LoggingConfig `yaml:"logging"`
	Tools   ToolsConfig   `yaml:"tools"`
	Compact CompactConfig `yaml:"compact"`
	Chat    ChatConfig    `yaml:"chat"`
	Agent   AgentConfig   `yaml:"agent"`
}

Config represents the CLI configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

LoadConfig loads configuration from file

func (*Config) GetAPIKey added in v0.27.0

func (c *Config) GetAPIKey() string

func (*Config) GetDefaultModel added in v0.27.0

func (c *Config) GetDefaultModel() string

func (*Config) GetGatewayURL added in v0.27.0

func (c *Config) GetGatewayURL() string

func (*Config) GetOutputDirectory added in v0.27.0

func (c *Config) GetOutputDirectory() string

func (*Config) GetSystemPrompt added in v0.27.0

func (c *Config) GetSystemPrompt() string

func (*Config) GetTimeout added in v0.27.0

func (c *Config) GetTimeout() int

func (*Config) IsApprovalRequired added in v0.14.1

func (c *Config) IsApprovalRequired(toolName string) bool

IsApprovalRequired checks if approval is required for a specific tool It returns true if tool-specific approval is set to true, or if global approval is true and tool-specific is not set to false ConfigService interface implementation

func (*Config) IsDebugMode added in v0.27.0

func (c *Config) IsDebugMode() bool

Additional ConfigService methods

func (*Config) SaveConfig

func (c *Config) SaveConfig(configPath string) error

SaveConfig saves configuration to file

func (*Config) ValidatePathInSandbox added in v0.29.0

func (c *Config) ValidatePathInSandbox(path string) error

ValidatePathInSandbox checks if a path is within the configured sandbox directories

type DeleteToolConfig added in v0.18.2

type DeleteToolConfig struct {
	Enabled         bool  `yaml:"enabled"`
	RequireApproval *bool `yaml:"require_approval,omitempty"`
}

DeleteToolConfig contains delete-specific tool settings

type EditToolConfig added in v0.21.0

type EditToolConfig struct {
	Enabled         bool  `yaml:"enabled"`
	RequireApproval *bool `yaml:"require_approval,omitempty"`
}

EditToolConfig contains edit-specific tool settings

type FetchCacheConfig added in v0.11.1

type FetchCacheConfig struct {
	Enabled bool  `yaml:"enabled"`
	TTL     int   `yaml:"ttl"`
	MaxSize int64 `yaml:"max_size"`
}

FetchCacheConfig contains cache settings for fetch operations

type FetchSafetyConfig added in v0.11.1

type FetchSafetyConfig struct {
	MaxSize       int64 `yaml:"max_size"`
	Timeout       int   `yaml:"timeout"`
	AllowRedirect bool  `yaml:"allow_redirect"`
}

FetchSafetyConfig contains safety settings for fetch operations

type GatewayConfig

type GatewayConfig struct {
	URL     string `yaml:"url"`
	APIKey  string `yaml:"api_key"`
	Timeout int    `yaml:"timeout"`
}

GatewayConfig contains gateway connection settings

type GithubSafetyConfig added in v0.32.0

type GithubSafetyConfig struct {
	MaxSize int64 `yaml:"max_size"`
	Timeout int   `yaml:"timeout"`
}

GithubSafetyConfig contains safety settings for GitHub fetch operations

type GithubToolConfig added in v0.32.0

type GithubToolConfig struct {
	Enabled         bool               `yaml:"enabled"`
	Token           string             `yaml:"token"`
	BaseURL         string             `yaml:"base_url"`
	Owner           string             `yaml:"owner"`
	Repo            string             `yaml:"repo,omitempty"`
	Safety          GithubSafetyConfig `yaml:"safety"`
	RequireApproval *bool              `yaml:"require_approval,omitempty"`
}

GithubToolConfig contains GitHub fetch-specific tool settings

type GrepToolConfig added in v0.19.0

type GrepToolConfig struct {
	Enabled         bool   `yaml:"enabled"`
	Backend         string `yaml:"backend"`
	RequireApproval *bool  `yaml:"require_approval,omitempty"`
}

GrepToolConfig contains grep-specific tool settings

type LoggingConfig added in v0.29.4

type LoggingConfig struct {
	Debug bool `yaml:"debug"`
}

LoggingConfig contains logging settings

type OptimizationConfig added in v0.32.0

type OptimizationConfig struct {
	Enabled                    bool `yaml:"enabled"`
	MaxHistory                 int  `yaml:"max_history"`
	CompactThreshold           int  `yaml:"compact_threshold"`
	TruncateLargeOutputs       bool `yaml:"truncate_large_outputs"`
	SkipRedundantConfirmations bool `yaml:"skip_redundant_confirmations"`
}

OptimizationConfig contains token optimization settings

type ReadToolConfig added in v0.14.1

type ReadToolConfig struct {
	Enabled         bool  `yaml:"enabled"`
	RequireApproval *bool `yaml:"require_approval,omitempty"`
}

ReadToolConfig contains read-specific tool settings

type RetryConfig added in v0.36.0

type RetryConfig struct {
	Enabled              bool  `yaml:"enabled"`
	MaxAttempts          int   `yaml:"max_attempts"`
	InitialBackoffSec    int   `yaml:"initial_backoff_sec"`
	MaxBackoffSec        int   `yaml:"max_backoff_sec"`
	BackoffMultiplier    int   `yaml:"backoff_multiplier"`
	RetryableStatusCodes []int `yaml:"retryable_status_codes"`
}

RetryConfig contains retry logic settings

type SafetyConfig added in v0.3.0

type SafetyConfig struct {
	RequireApproval bool `yaml:"require_approval"`
}

SafetyConfig contains safety approval settings

type SandboxConfig added in v0.29.0

type SandboxConfig struct {
	Directories    []string `yaml:"directories"`
	ProtectedPaths []string `yaml:"protected_paths"`
}

SandboxConfig contains sandbox directory settings

type SystemRemindersConfig added in v0.36.0

type SystemRemindersConfig struct {
	Enabled      bool   `yaml:"enabled"`
	Interval     int    `yaml:"interval"`
	ReminderText string `yaml:"reminder_text"`
}

SystemRemindersConfig contains settings for dynamic system reminders

type TodoWriteToolConfig added in v0.20.0

type TodoWriteToolConfig struct {
	Enabled         bool  `yaml:"enabled"`
	RequireApproval *bool `yaml:"require_approval,omitempty"`
}

TodoWriteToolConfig contains TodoWrite-specific tool settings

type ToolWhitelistConfig

type ToolWhitelistConfig struct {
	Commands []string `yaml:"commands"`
	Patterns []string `yaml:"patterns"`
}

ToolWhitelistConfig contains whitelisted commands and patterns

type ToolsConfig

type ToolsConfig struct {
	Enabled   bool                `yaml:"enabled"`
	Sandbox   SandboxConfig       `yaml:"sandbox"`
	Bash      BashToolConfig      `yaml:"bash"`
	Read      ReadToolConfig      `yaml:"read"`
	Write     WriteToolConfig     `yaml:"write"`
	Edit      EditToolConfig      `yaml:"edit"`
	Delete    DeleteToolConfig    `yaml:"delete"`
	Grep      GrepToolConfig      `yaml:"grep"`
	Tree      TreeToolConfig      `yaml:"tree"`
	WebFetch  WebFetchToolConfig  `yaml:"web_fetch"`
	WebSearch WebSearchToolConfig `yaml:"web_search"`
	Github    GithubToolConfig    `yaml:"github"`
	TodoWrite TodoWriteToolConfig `yaml:"todo_write"`
	Safety    SafetyConfig        `yaml:"safety"`
}

ToolsConfig contains tool execution settings

type TreeToolConfig added in v0.16.0

type TreeToolConfig struct {
	Enabled         bool  `yaml:"enabled"`
	RequireApproval *bool `yaml:"require_approval,omitempty"`
}

TreeToolConfig contains tree-specific tool settings

type WebFetchToolConfig added in v0.24.1

type WebFetchToolConfig struct {
	Enabled            bool              `yaml:"enabled"`
	WhitelistedDomains []string          `yaml:"whitelisted_domains"`
	Safety             FetchSafetyConfig `yaml:"safety"`
	Cache              FetchCacheConfig  `yaml:"cache"`
	RequireApproval    *bool             `yaml:"require_approval,omitempty"`
}

WebFetchToolConfig contains fetch-specific tool settings

type WebSearchToolConfig added in v0.14.1

type WebSearchToolConfig struct {
	Enabled         bool     `yaml:"enabled"`
	DefaultEngine   string   `yaml:"default_engine"`
	MaxResults      int      `yaml:"max_results"`
	Engines         []string `yaml:"engines"`
	Timeout         int      `yaml:"timeout"`
	RequireApproval *bool    `yaml:"require_approval,omitempty"`
}

WebSearchToolConfig contains web search-specific tool settings

type WriteToolConfig added in v0.17.0

type WriteToolConfig struct {
	Enabled         bool  `yaml:"enabled"`
	RequireApproval *bool `yaml:"require_approval,omitempty"`
}

WriteToolConfig contains write-specific tool settings

Jump to

Keyboard shortcuts

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