config

package
v0.48.16 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 5 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

View Source
const (
	ConfigDirName     = ".infer"
	ConfigFileName    = "config.yaml"
	GitignoreFileName = ".gitignore"
	LogsDirName       = "logs"

	DefaultConfigPath = ConfigDirName + "/" + ConfigFileName
	DefaultLogsPath   = ConfigDirName + "/" + LogsDirName
)

Variables

This section is empty.

Functions

func ResolveEnvironmentVariables added in v0.31.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" mapstructure:"model"`
	SystemPrompt    string                `yaml:"system_prompt" mapstructure:"system_prompt"`
	SystemReminders SystemRemindersConfig `yaml:"system_reminders" mapstructure:"system_reminders"`
	VerboseTools    bool                  `yaml:"verbose_tools" mapstructure:"verbose_tools"`
	MaxTurns        int                   `yaml:"max_turns" mapstructure:"max_turns"`
	MaxTokens       int                   `yaml:"max_tokens" mapstructure:"max_tokens"`
	Optimization    OptimizationConfig    `yaml:"optimization" mapstructure:"optimization"`
}

AgentConfig contains agent command-specific settings

type BashToolConfig added in v0.14.1

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

BashToolConfig contains bash-specific tool settings

type ChatConfig added in v0.8.0

type ChatConfig struct {
	Theme string `yaml:"theme" mapstructure:"theme"`
}

ChatConfig contains chat interface settings

type ClientConfig added in v0.36.0

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

ClientConfig contains HTTP client settings

type CompactConfig added in v0.2.0

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

CompactConfig contains settings for compact command

type Config

type Config struct {
	Gateway      GatewayConfig      `yaml:"gateway" mapstructure:"gateway"`
	Client       ClientConfig       `yaml:"client" mapstructure:"client"`
	Logging      LoggingConfig      `yaml:"logging" mapstructure:"logging"`
	Tools        ToolsConfig        `yaml:"tools" mapstructure:"tools"`
	Compact      CompactConfig      `yaml:"compact" mapstructure:"compact"`
	Agent        AgentConfig        `yaml:"agent" mapstructure:"agent"`
	Git          GitConfig          `yaml:"git" mapstructure:"git"`
	Storage      StorageConfig      `yaml:"storage" mapstructure:"storage"`
	Conversation ConversationConfig `yaml:"conversation" mapstructure:"conversation"`
	Chat         ChatConfig         `yaml:"chat" mapstructure:"chat"`
}

Config represents the CLI configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration

func (*Config) GetAPIKey added in v0.27.0

func (c *Config) GetAPIKey() string

func (*Config) GetAgentConfig added in v0.48.0

func (c *Config) GetAgentConfig() *AgentConfig

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) GetProtectedPaths added in v0.45.3

func (c *Config) GetProtectedPaths() []string

func (*Config) GetSandboxDirectories added in v0.45.3

func (c *Config) GetSandboxDirectories() []string

func (*Config) GetSystemPrompt added in v0.27.0

func (c *Config) GetSystemPrompt() string

func (*Config) GetTheme added in v0.47.0

func (c *Config) GetTheme() 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) ShouldSkipA2AToolOnClient added in v0.48.0

func (c *Config) ShouldSkipA2AToolOnClient() bool

func (*Config) ShouldSkipMCPToolOnClient added in v0.48.0

func (c *Config) ShouldSkipMCPToolOnClient() bool

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 ConversationConfig added in v0.46.0

type ConversationConfig struct {
	TitleGeneration ConversationTitleConfig `yaml:"title_generation" mapstructure:"title_generation"`
}

ConversationConfig contains conversation-specific settings

type ConversationTitleConfig added in v0.46.0

type ConversationTitleConfig struct {
	Enabled      bool   `yaml:"enabled" mapstructure:"enabled"`
	Model        string `yaml:"model" mapstructure:"model"`
	SystemPrompt string `yaml:"system_prompt" mapstructure:"system_prompt"`
	BatchSize    int    `yaml:"batch_size" mapstructure:"batch_size"`
	Interval     int    `yaml:"interval" mapstructure:"interval"`
}

ConversationTitleConfig contains settings for AI-generated conversation titles

type DeleteToolConfig added in v0.18.0

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

DeleteToolConfig contains delete-specific tool settings

type EditToolConfig added in v0.21.0

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

EditToolConfig contains edit-specific tool settings

type FetchCacheConfig added in v0.11.0

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

FetchCacheConfig contains cache settings for fetch operations

type FetchSafetyConfig added in v0.11.0

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

FetchSafetyConfig contains safety settings for fetch operations

type GatewayConfig

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

GatewayConfig contains gateway connection settings

type GitCommitMessageConfig added in v0.42.0

type GitCommitMessageConfig struct {
	Model        string `yaml:"model" mapstructure:"model"`
	SystemPrompt string `yaml:"system_prompt" mapstructure:"system_prompt"`
}

GitCommitMessageConfig contains settings for AI-generated commit messages

type GitConfig added in v0.42.0

type GitConfig struct {
	CommitMessage GitCommitMessageConfig `yaml:"commit_message" mapstructure:"commit_message"`
}

GitConfig contains git shortcut-specific settings

type GithubSafetyConfig added in v0.31.0

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

GithubSafetyConfig contains safety settings for GitHub fetch operations

type GithubToolConfig added in v0.31.0

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

GithubToolConfig contains GitHub fetch-specific tool settings

type GrepToolConfig added in v0.19.0

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

GrepToolConfig contains grep-specific tool settings

type LoggingConfig added in v0.29.4

type LoggingConfig struct {
	Debug bool   `yaml:"debug" mapstructure:"debug"`
	Dir   string `yaml:"dir" mapstructure:"dir"`
}

LoggingConfig contains logging settings

type MiddlewaresConfig added in v0.48.0

type MiddlewaresConfig struct {
	A2A bool `yaml:"a2a" mapstructure:"a2a"`
	MCP bool `yaml:"mcp" mapstructure:"mcp"`
}

MiddlewaresConfig contains middleware-specific settings

type OptimizationConfig added in v0.30.0

type OptimizationConfig struct {
	Enabled     bool   `yaml:"enabled" mapstructure:"enabled"`
	Model       string `yaml:"model" mapstructure:"model"`
	MinMessages int    `yaml:"min_messages" mapstructure:"min_messages"`
	BufferSize  int    `yaml:"buffer_size" mapstructure:"buffer_size"`
}

OptimizationConfig contains token optimization settings

type PostgresStorageConfig added in v0.45.0

type PostgresStorageConfig struct {
	Host     string `yaml:"host" mapstructure:"host"`
	Port     int    `yaml:"port" mapstructure:"port"`
	Database string `yaml:"database" mapstructure:"database"`
	Username string `yaml:"username" mapstructure:"username"`
	Password string `yaml:"password" mapstructure:"password"`
	SSLMode  string `yaml:"ssl_mode" mapstructure:"ssl_mode"`
}

PostgresStorageConfig contains Postgres-specific configuration

type ReadToolConfig added in v0.14.1

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

ReadToolConfig contains read-specific tool settings

type RedisStorageConfig added in v0.45.0

type RedisStorageConfig struct {
	Host     string `yaml:"host" mapstructure:"host"`
	Port     int    `yaml:"port" mapstructure:"port"`
	Password string `yaml:"password" mapstructure:"password"`
	DB       int    `yaml:"db" mapstructure:"db"`
}

RedisStorageConfig contains Redis-specific configuration

type RetryConfig added in v0.36.0

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

RetryConfig contains retry logic settings

type SQLiteStorageConfig added in v0.45.0

type SQLiteStorageConfig struct {
	Path string `yaml:"path" mapstructure:"path"`
}

SQLiteStorageConfig contains SQLite-specific configuration

type SafetyConfig added in v0.3.0

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

SafetyConfig contains safety approval settings

type SandboxConfig added in v0.29.0

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

SandboxConfig contains sandbox directory settings

type StorageConfig added in v0.45.0

type StorageConfig struct {
	Enabled  bool                  `yaml:"enabled" mapstructure:"enabled"`
	Type     StorageType           `yaml:"type" mapstructure:"type"`
	SQLite   SQLiteStorageConfig   `yaml:"sqlite,omitempty" mapstructure:"sqlite,omitempty"`
	Postgres PostgresStorageConfig `yaml:"postgres,omitempty" mapstructure:"postgres,omitempty"`
	Redis    RedisStorageConfig    `yaml:"redis,omitempty" mapstructure:"redis,omitempty"`
}

StorageConfig contains storage backend configuration

type StorageType added in v0.45.0

type StorageType string

StorageType represents the type of storage backend

const (
	StorageTypeMemory   StorageType = "memory"
	StorageTypeSQLite   StorageType = "sqlite"
	StorageTypePostgres StorageType = "postgres"
	StorageTypeRedis    StorageType = "redis"
)

type SystemRemindersConfig added in v0.35.0

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

SystemRemindersConfig contains settings for dynamic system reminders

type TodoWriteToolConfig added in v0.20.0

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

TodoWriteToolConfig contains TodoWrite-specific tool settings

type ToolWhitelistConfig

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

ToolWhitelistConfig contains whitelisted commands and patterns

type ToolsConfig

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

ToolsConfig contains tool execution settings

type TreeToolConfig added in v0.16.0

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

TreeToolConfig contains tree-specific tool settings

type WebFetchToolConfig added in v0.24.1

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

WebFetchToolConfig contains fetch-specific tool settings

type WebSearchToolConfig added in v0.14.1

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

WebSearchToolConfig contains web search-specific tool settings

type WriteToolConfig added in v0.17.0

type WriteToolConfig struct {
	Enabled         bool  `yaml:"enabled" mapstructure:"enabled"`
	RequireApproval *bool `yaml:"require_approval,omitempty" mapstructure:"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