config

package
v0.109.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentsFileName    = "agents.yaml"
	DefaultAgentsPath = ConfigDirName + "/" + AgentsFileName
)
View Source
const (
	ChannelsFileName    = "channels.yaml"
	DefaultChannelsPath = ConfigDirName + "/" + ChannelsFileName
)
View Source
const (
	ComputerUseFileName    = "computer_use.yaml"
	DefaultComputerUsePath = ConfigDirName + "/" + ComputerUseFileName
)
View Source
const (
	ConfigDirName     = ".infer"
	ConfigFileName    = "config.yaml"
	GitignoreFileName = ".gitignore"
	LogsDirName       = "logs"

	DefaultConfigPath = ConfigDirName + "/" + ConfigFileName
	DefaultLogsPath   = ConfigDirName + "/" + LogsDirName
)
View Source
const (
	HeartbeatFileName    = "heartbeat.yaml"
	DefaultHeartbeatPath = ConfigDirName + "/" + HeartbeatFileName
)
View Source
const (
	KeybindingsFileName    = "keybindings.yaml"
	DefaultKeybindingsPath = ConfigDirName + "/" + KeybindingsFileName
)
View Source
const (
	MCPFileName    = "mcp.yaml"
	DefaultMCPPath = ConfigDirName + "/" + MCPFileName
)
View Source
const (
	PromptsFileName    = "prompts.yaml"
	DefaultPromptsPath = ConfigDirName + "/" + PromptsFileName
)
View Source
const DefaultContextWindow = 8192

DefaultContextWindow is the fallback context window size when no pattern matches.

Variables

View Source
var ContextMatchers = []ModelMatcher{
	{Patterns: []string{"claude-opus-4-7"}, ContextWindow: 1000000},
	{Patterns: []string{"claude-opus-4", "claude-sonnet-4", "claude-haiku-4"}, ContextWindow: 200000},
	{Patterns: []string{"claude"}, ContextWindow: 200000},
	{Patterns: []string{"gemini-3"}, ContextWindow: 1048576},
	{Patterns: []string{"gemini-2", "gemini-1.5"}, ContextWindow: 1000000},
	{Patterns: []string{"gemini-pro", "gemini-flash"}, ContextWindow: 1000000},
	{Patterns: []string{"gemini"}, ContextWindow: 32768},
	{Patterns: []string{"deep-research"}, ContextWindow: 1048576},
	{Patterns: []string{"gemma-3-1b", "gemma3:1b", "gemma-3n", "gemma3n"}, ContextWindow: 32768},
	{Patterns: []string{"gemma-3", "gemma3", "gemma-4", "gemma4"}, ContextWindow: 131072},
	{Patterns: []string{"gpt-oss"}, ContextWindow: 131072},
	{Patterns: []string{"deepseek-v4"}, ContextWindow: 1000000},
	{Patterns: []string{"deepseek-v3"}, ContextWindow: 131072},
	{Patterns: []string{"deepseek"}, ContextWindow: 131072},
	{Patterns: []string{"qwen3", "qwen-3"}, ContextWindow: 262144},
	{Patterns: []string{"qwen2.5", "qwen-2.5"}, ContextWindow: 131072},
	{Patterns: []string{"qwen"}, ContextWindow: 128000},
	{Patterns: []string{"ministral-3"}, ContextWindow: 256000},
	{Patterns: []string{"ministral"}, ContextWindow: 131072},
	{Patterns: []string{"mistral-large"}, ContextWindow: 131072},
	{Patterns: []string{"devstral"}, ContextWindow: 131072},
	{Patterns: []string{"mistral", "mixtral"}, ContextWindow: 32768},
	{Patterns: []string{"minimax-m2"}, ContextWindow: 204800},
	{Patterns: []string{"glm-4", "glm-5"}, ContextWindow: 200000},
	{Patterns: []string{"nemotron-3"}, ContextWindow: 262144},
	{Patterns: []string{"kimi-k2", "kimi-latest"}, ContextWindow: 262144},
	{Patterns: []string{"moonshot-v1-128k"}, ContextWindow: 131072},
	{Patterns: []string{"moonshot-v1-32k"}, ContextWindow: 32768},
	{Patterns: []string{"moonshot-v1-8k", "moonshot-v1-auto"}, ContextWindow: 8192},
}

ContextMatchers defines all model patterns in priority order. More specific patterns must come before less specific ones because matching uses strings.Contains (e.g. "gemma-3-1b" must precede "gemma-3", and "gemini-3" must precede "gemini-2"/"gemini").

Coverage tracks the model IDs the gateway actually returns from /v1/models; model families that aren't served are intentionally omitted to keep the list small and the View output truthful.

View Source
var DefaultModelPricing = map[string]ModelPricing{}/* 119 elements not displayed */

DefaultModelPricing contains hardcoded pricing for common models. Prices are based on publicly available pricing as of December 2024. Users can override these in their config files.

Functions

func ActionID added in v0.77.0

func ActionID(namespace KeyNamespace, action string) string

ActionID constructs a namespaced action ID from namespace and action name Format: "namespace_action" (e.g., "global_quit", "chat_enter_key_handler")

func DetectGithubOwner added in v0.66.0

func DetectGithubOwner() string

DetectGithubOwner attempts to detect the GitHub owner from the git remote URL Returns empty string if not a git repository or not a GitHub remote

func FindAvailablePort added in v0.80.0

func FindAvailablePort(basePort int) int

FindAvailablePort finds the next available port starting from basePort It checks up to 100 ports after the base port Binds to all interfaces (0.0.0.0) to match Docker's behavior Thread-safe: uses global port registry to prevent race conditions

func GetAgentURLs added in v0.104.1

func GetAgentURLs(path string) ([]string, error)

GetAgentURLs returns URLs of all configured agents.

func GetDefaultKeybindings added in v0.77.0

func GetDefaultKeybindings() map[string]KeyBindingEntry

GetDefaultKeybindings returns the default keybinding configuration Users can override these in their config file, and any missing entries will fall back to these defaults

func IsKnownAgent added in v0.67.0

func IsKnownAgent(name string) bool

IsKnownAgent returns true if the agent name has default configuration

func ListKnownAgents added in v0.67.0

func ListKnownAgents() []string

ListKnownAgents returns a list of all known agent names

func ParseModel added in v0.54.0

func ParseModel(model string) (provider, modelName string)

ParseModel parses a model string in the format "provider/model" and returns the provider and model separately. If the format is invalid, returns empty strings.

func ReleasePort added in v0.94.0

func ReleasePort(port int)

ReleasePort releases a previously allocated port Should be called when containers are stopped

func ResolveConfigDir added in v0.104.1

func ResolveConfigDir() string

ResolveConfigDir searches the standard project then userspace locations for an existing config.yaml and returns its directory. Falls back to the default project directory name when nothing is found on disk.

func ResolveEnvironmentVariables added in v0.31.0

func ResolveEnvironmentVariables(value string) string

ResolveEnvironmentVariables resolves environment variable references in the format %VAR_NAME%

func SaveAgents added in v0.104.1

func SaveAgents(path string, cfg *AgentsConfig) error

SaveAgents writes the agents configuration to disk, creating any missing parent directories.

func SaveChannels added in v0.104.1

func SaveChannels(path string, cfg *ChannelsConfig) error

SaveChannels writes the channels configuration to disk, creating any missing parent directories. The file holds bot tokens / access tokens, so callers should ensure it is also listed in tools.sandbox.protected_paths.

func SaveComputerUse added in v0.104.1

func SaveComputerUse(path string, cfg *ComputerUseConfig) error

SaveComputerUse writes the computer_use configuration to disk, creating any missing parent directories.

func SaveHeartbeat added in v0.108.0

func SaveHeartbeat(path string, cfg *HeartbeatConfig) error

SaveHeartbeat writes the heartbeat configuration to disk, creating any missing parent directories.

func SaveKeybindings added in v0.104.1

func SaveKeybindings(path string, cfg *KeybindingsConfig) error

SaveKeybindings writes the keybindings configuration to disk, creating any missing parent directories.

func SaveMCP added in v0.104.1

func SaveMCP(path string, cfg *MCPConfig) error

SaveMCP writes the MCP configuration to disk, creating any missing parent directories.

func SavePrompts added in v0.104.1

func SavePrompts(path string, cfg *PromptsConfig) error

SavePrompts writes the prompts configuration to disk, creating any missing parent directories.

Types

type A2AAgentInfo added in v0.49.0

type A2AAgentInfo struct {
	Name        string            `yaml:"name" mapstructure:"name"`
	URL         string            `yaml:"url" mapstructure:"url"`
	APIKey      string            `yaml:"api_key" mapstructure:"api_key"`
	Description string            `yaml:"description,omitempty" mapstructure:"description,omitempty"`
	Timeout     int               `yaml:"timeout" mapstructure:"timeout"`
	Enabled     bool              `yaml:"enabled" mapstructure:"enabled"`
	Metadata    map[string]string `yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

A2AAgentInfo contains information about an A2A agent connection

type A2ACacheConfig added in v0.49.0

type A2ACacheConfig struct {
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`
	TTL     int  `yaml:"ttl" mapstructure:"ttl"`
}

A2ACacheConfig contains settings for A2A agent card caching

type A2AConfig added in v0.49.0

type A2AConfig struct {
	Enabled bool           `yaml:"enabled" mapstructure:"enabled"`
	Agents  []string       `yaml:"agents,omitempty" mapstructure:"agents"`
	Cache   A2ACacheConfig `yaml:"cache" mapstructure:"cache"`
	Task    A2ATaskConfig  `yaml:"task" mapstructure:"task"`
	Tools   A2AToolsConfig `yaml:"tools" mapstructure:"tools"`
}

A2AConfig contains A2A agent configuration

type A2ATaskConfig added in v0.49.0

type A2ATaskConfig struct {
	StatusPollSeconds       int     `yaml:"status_poll_seconds" mapstructure:"status_poll_seconds"`
	PollingStrategy         string  `yaml:"polling_strategy" mapstructure:"polling_strategy"`
	InitialPollIntervalSec  int     `yaml:"initial_poll_interval_sec" mapstructure:"initial_poll_interval_sec"`
	MaxPollIntervalSec      int     `yaml:"max_poll_interval_sec" mapstructure:"max_poll_interval_sec"`
	BackoffMultiplier       float64 `yaml:"backoff_multiplier" mapstructure:"backoff_multiplier"`
	BackgroundMonitoring    bool    `yaml:"background_monitoring" mapstructure:"background_monitoring"`
	CompletedTaskRetention  int     `yaml:"completed_task_retention" mapstructure:"completed_task_retention"`
	AgentModeMaxWaitSeconds int     `yaml:"agent_mode_max_wait_seconds" mapstructure:"agent_mode_max_wait_seconds"`
}

A2ATaskConfig contains configuration for A2A task processing

type A2AToolsConfig added in v0.51.0

type A2AToolsConfig struct {
	QueryAgent QueryAgentToolConfig `yaml:"query_agent" mapstructure:"query_agent"`
	QueryTask  QueryTaskToolConfig  `yaml:"query_task" mapstructure:"query_task"`
	SubmitTask SubmitTaskToolConfig `yaml:"submit_task" mapstructure:"submit_task"`
}

A2AToolsConfig contains A2A-specific tool configurations

type ActivateAppToolConfig added in v0.96.0

type ActivateAppToolConfig struct {
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`
}

ActivateAppToolConfig contains activate app-specific tool settings

type AgentConfig added in v0.36.0

type AgentConfig struct {
	Model                    string             `yaml:"model" mapstructure:"model"`
	SystemPromptWithDefaults bool               `yaml:"system_prompt_with_defaults" mapstructure:"system_prompt_with_defaults"`
	Context                  AgentContextConfig `yaml:"context" mapstructure:"context"`
	Skills                   AgentSkillsConfig  `yaml:"skills" mapstructure:"skills"`
	VerboseTools             bool               `yaml:"verbose_tools" mapstructure:"verbose_tools"`
	MaxTurns                 int                `yaml:"max_turns" mapstructure:"max_turns"`
	MaxTokens                int                `yaml:"max_tokens" mapstructure:"max_tokens"`
	MaxConcurrentTools       int                `yaml:"max_concurrent_tools" mapstructure:"max_concurrent_tools"`
}

AgentConfig contains agent command-specific settings. All system prompts, custom instructions, and system reminder settings live in prompts.yaml and are read from cfg.Prompts.Agent.* at runtime.

type AgentContextConfig added in v0.99.0

type AgentContextConfig struct {
	GitContextEnabled      bool `yaml:"git_context_enabled" mapstructure:"git_context_enabled"`
	WorkingDirEnabled      bool `yaml:"working_dir_enabled" mapstructure:"working_dir_enabled"`
	GitContextRefreshTurns int  `yaml:"git_context_refresh_turns" mapstructure:"git_context_refresh_turns"`
}

AgentContextConfig contains settings for agent context enrichment

type AgentDefaults added in v0.67.0

type AgentDefaults struct {
	URL          string
	ArtifactsURL string
	OCI          string
	Run          bool
	Model        string
	Environment  map[string]string
}

AgentDefaults contains default configuration for a known agent type

func GetAgentDefaults added in v0.67.0

func GetAgentDefaults(name string) *AgentDefaults

GetAgentDefaults returns the default configuration for a known agent with dynamically assigned available ports to avoid collisions. Returns nil if the agent is not known.

type AgentEntry added in v0.54.0

type AgentEntry struct {
	Name         string            `yaml:"name" mapstructure:"name"`
	URL          string            `yaml:"url" mapstructure:"url"`
	ArtifactsURL string            `yaml:"artifacts_url,omitempty" mapstructure:"artifacts_url,omitempty"`
	OCI          string            `yaml:"oci,omitempty" mapstructure:"oci,omitempty"`
	Run          bool              `yaml:"run" mapstructure:"run"`
	Model        string            `yaml:"model,omitempty" mapstructure:"model,omitempty"`
	Environment  map[string]string `yaml:"environment,omitempty" mapstructure:"environment,omitempty"`
	Enabled      bool              `yaml:"enabled" mapstructure:"enabled"`
}

AgentEntry represents a single A2A agent configuration

func (*AgentEntry) GetEnvironmentWithModel added in v0.54.0

func (a *AgentEntry) GetEnvironmentWithModel() map[string]string

GetEnvironmentWithModel returns the environment variables with model-related variables added if a model is specified.

type AgentSkillsConfig added in v0.109.0

type AgentSkillsConfig struct {
	Enabled        bool     `yaml:"enabled" mapstructure:"enabled"`
	DisabledSkills []string `yaml:"disabled_skills,omitempty" mapstructure:"disabled_skills"`
}

AgentSkillsConfig controls Agent Skills loading. Skills follow the SKILL.md / YAML-frontmatter contract shared by the official spec, so existing skill folders drop into .infer/skills/ unchanged. Disabled by default — when off, no scan runs and nothing is injected into the system prompt.

type AgentsConfig added in v0.54.0

type AgentsConfig struct {
	Agents []AgentEntry `yaml:"agents" mapstructure:"agents"`
	// contains filtered or unexported fields
}

AgentsConfig represents the agents.yaml configuration file

func DefaultAgentsConfig added in v0.54.0

func DefaultAgentsConfig() *AgentsConfig

DefaultAgentsConfig returns a default agents configuration

func LoadAgents added in v0.104.1

func LoadAgents(path string) (*AgentsConfig, error)

LoadAgents reads agents.yaml from disk. When the file is missing it returns the in-code defaults so callers can treat absence as "use defaults" without special-casing.

func (*AgentsConfig) CreateEntry added in v0.104.1

func (c *AgentsConfig) CreateEntry(entry AgentEntry) error

CreateEntry implements CollectionConfig.

func (*AgentsConfig) DeleteEntry added in v0.104.1

func (c *AgentsConfig) DeleteEntry(name string) error

DeleteEntry implements CollectionConfig.

func (*AgentsConfig) ListEntries added in v0.104.1

func (c *AgentsConfig) ListEntries() []AgentEntry

ListEntries implements CollectionConfig.

func (*AgentsConfig) ReadEntry added in v0.104.1

func (c *AgentsConfig) ReadEntry(name string) (*AgentEntry, error)

ReadEntry implements CollectionConfig.

func (*AgentsConfig) UpdateEntry added in v0.104.1

func (c *AgentsConfig) UpdateEntry(entry AgentEntry) error

UpdateEntry implements CollectionConfig.

type BackgroundShellsConfig added in v0.81.0

type BackgroundShellsConfig struct {
	Enabled           bool `yaml:"enabled" mapstructure:"enabled"`
	MaxConcurrent     int  `yaml:"max_concurrent" mapstructure:"max_concurrent"`
	MaxOutputBufferMB int  `yaml:"max_output_buffer_mb" mapstructure:"max_output_buffer_mb"`
	RetentionMinutes  int  `yaml:"retention_minutes" mapstructure:"retention_minutes"`
}

BackgroundShellsConfig contains background shell execution settings

type BashToolConfig added in v0.14.1

type BashToolConfig struct {
	Enabled          bool                   `yaml:"enabled" mapstructure:"enabled"`
	Timeout          int                    `yaml:"timeout" mapstructure:"timeout"`
	Whitelist        ToolWhitelistConfig    `yaml:"whitelist" mapstructure:"whitelist"`
	RequireApproval  *bool                  `yaml:"require_approval,omitempty" mapstructure:"require_approval,omitempty"`
	BackgroundShells BackgroundShellsConfig `yaml:"background_shells" mapstructure:"background_shells"`
}

BashToolConfig contains bash-specific tool settings

type ChannelsConfig added in v0.101.0

type ChannelsConfig struct {
	Enabled         bool                  `yaml:"enabled" mapstructure:"enabled"`
	MaxWorkers      int                   `yaml:"max_workers" mapstructure:"max_workers"`
	ImageRetention  int                   `yaml:"image_retention" mapstructure:"image_retention"`
	RequireApproval bool                  `yaml:"require_approval" mapstructure:"require_approval"`
	Telegram        TelegramChannelConfig `yaml:"telegram" mapstructure:"telegram"`
	WhatsApp        WhatsAppChannelConfig `yaml:"whatsapp" mapstructure:"whatsapp"`
}

ChannelsConfig contains configuration for external messaging channels

func DefaultChannelsConfig added in v0.104.1

func DefaultChannelsConfig() *ChannelsConfig

DefaultChannelsConfig returns the in-code default channels configuration used when no channels.yaml file exists. `infer init` seeds the file from this and the runtime falls back to it when the file is absent.

func LoadChannels added in v0.104.1

func LoadChannels(path string) (*ChannelsConfig, error)

LoadChannels reads channels.yaml from disk. When the file is missing it returns the in-code defaults so callers can treat absence as "use defaults" without special-casing. The file body is run through os.ExpandEnv so `${BOT_TOKEN}`-style references resolve from the environment.

type ChatConfig added in v0.8.0

type ChatConfig struct {
	Theme       string            `yaml:"theme" mapstructure:"theme"`
	Keybindings KeybindingsConfig `yaml:"-" mapstructure:"-"`
	StatusBar   StatusBarConfig   `yaml:"status_bar" mapstructure:"status_bar"`
}

ChatConfig contains chat interface settings

type ClaudeCodeConfig added in v0.100.0

type ClaudeCodeConfig struct {
	Enabled         bool   `yaml:"enabled" mapstructure:"enabled"`
	CLIPath         string `yaml:"cli_path" mapstructure:"cli_path"`
	Timeout         int    `yaml:"timeout" mapstructure:"timeout"`
	MaxOutputTokens int    `yaml:"max_output_tokens" mapstructure:"max_output_tokens"`
	ThinkingBudget  int    `yaml:"thinking_budget" mapstructure:"thinking_budget"`
	MaxTurns        int    `yaml:"max_turns" mapstructure:"max_turns"`
}

ClaudeCodeConfig contains Claude Code CLI integration 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 ClipboardImageOptimizeConfig added in v0.89.0

type ClipboardImageOptimizeConfig struct {
	Enabled     bool `yaml:"enabled" mapstructure:"enabled"`
	MaxWidth    int  `yaml:"max_width" mapstructure:"max_width"`
	MaxHeight   int  `yaml:"max_height" mapstructure:"max_height"`
	Quality     int  `yaml:"quality" mapstructure:"quality"`
	ConvertJPEG bool `yaml:"convert_jpeg" mapstructure:"convert_jpeg"`
}

ClipboardImageOptimizeConfig contains clipboard image optimization settings

type CollectionConfig added in v0.104.1

type CollectionConfig[E any] interface {
	CreateEntry(entry E) error
	ReadEntry(name string) (*E, error)
	UpdateEntry(entry E) error
	DeleteEntry(name string) error
	ListEntries() []E
}

CollectionConfig is implemented by file-backed configs whose payload is a named, mutable collection of entries. MCPConfig (collection of MCPServerEntry) and AgentsConfig (collection of AgentEntry) implement it.

Methods mutate the file on disk; the in-memory receiver stays in sync. Implementations must remember the file path they were loaded from so each call can persist back to the same location.

type CompactConfig added in v0.2.0

type CompactConfig struct {
	Enabled               bool `yaml:"enabled" mapstructure:"enabled"`
	AutoAt                int  `yaml:"auto_at" mapstructure:"auto_at"`
	KeepFirstMessages     int  `yaml:"keep_first_messages" mapstructure:"keep_first_messages"`
	RolloverOnIdleMinutes int  `yaml:"rollover_on_idle_minutes" mapstructure:"rollover_on_idle_minutes"`
	SummaryMaxTokens      int  `yaml:"summary_max_tokens" mapstructure:"summary_max_tokens"`
}

CompactConfig contains conversation compaction settings

type ComputerUseConfig added in v0.96.0

type ComputerUseConfig struct {
	Enabled        bool                   `yaml:"enabled" mapstructure:"enabled"`
	FloatingWindow FloatingWindowConfig   `yaml:"floating_window" mapstructure:"floating_window"`
	Screenshot     ScreenshotToolConfig   `yaml:"screenshot" mapstructure:"screenshot"`
	RateLimit      RateLimitConfig        `yaml:"rate_limit" mapstructure:"rate_limit"`
	Tools          ComputerUseToolsConfig `yaml:"tools" mapstructure:"tools"`
}

ComputerUseConfig contains computer use tool settings

func DefaultComputerUseConfig added in v0.104.1

func DefaultComputerUseConfig() *ComputerUseConfig

DefaultComputerUseConfig returns the in-code default computer_use configuration used when no computer_use.yaml file exists. `infer init` seeds the file from this and the runtime falls back to it when the file is absent.

func LoadComputerUse added in v0.104.1

func LoadComputerUse(path string) (*ComputerUseConfig, error)

LoadComputerUse reads computer_use.yaml from disk. When the file is missing it returns the in-code defaults so callers can treat absence as "use defaults" without special-casing. The file body is run through os.ExpandEnv so `${VAR}`-style references resolve from the environment.

type ComputerUseToolsConfig added in v0.97.0

type ComputerUseToolsConfig struct {
	MouseMove     MouseMoveToolConfig     `yaml:"mouse_move" mapstructure:"mouse_move"`
	MouseClick    MouseClickToolConfig    `yaml:"mouse_click" mapstructure:"mouse_click"`
	MouseScroll   MouseScrollToolConfig   `yaml:"mouse_scroll" mapstructure:"mouse_scroll"`
	KeyboardType  KeyboardTypeToolConfig  `yaml:"keyboard_type" mapstructure:"keyboard_type"`
	GetFocusedApp GetFocusedAppToolConfig `yaml:"get_focused_app" mapstructure:"get_focused_app"`
	ActivateApp   ActivateAppToolConfig   `yaml:"activate_app" mapstructure:"activate_app"`
}

ComputerUseToolsConfig contains individual computer use tool settings

type Config

type Config struct {
	ContainerRuntime ContainerRuntimeConfig `yaml:"container_runtime" mapstructure:"container_runtime"`
	Gateway          GatewayConfig          `yaml:"gateway" mapstructure:"gateway"`
	ClaudeCode       ClaudeCodeConfig       `yaml:"claude_code" mapstructure:"claude_code"`
	Client           ClientConfig           `yaml:"client" mapstructure:"client"`
	Logging          LoggingConfig          `yaml:"logging" mapstructure:"logging"`
	Tools            ToolsConfig            `yaml:"tools" mapstructure:"tools"`
	Image            ImageConfig            `yaml:"image" mapstructure:"image"`
	Export           ExportConfig           `yaml:"export" mapstructure:"export"`
	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"`
	A2A              A2AConfig              `yaml:"a2a" mapstructure:"a2a"`
	MCP              MCPConfig              `yaml:"mcp" mapstructure:"mcp"`
	Pricing          PricingConfig          `yaml:"pricing" mapstructure:"pricing"`
	Compact          CompactConfig          `yaml:"compact" mapstructure:"compact"`
	Web              WebConfig              `yaml:"web" mapstructure:"web"`
	ComputerUse      ComputerUseConfig      `yaml:"-" mapstructure:"-"`
	Channels         ChannelsConfig         `yaml:"-" mapstructure:"-"`
	Heartbeat        HeartbeatConfig        `yaml:"-" mapstructure:"-"`
	Prompts          PromptsConfig          `yaml:"-" mapstructure:"-"`
	// contains filtered or unexported fields
}

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) GetConfigDir added in v0.90.0

func (c *Config) GetConfigDir() string

GetConfigDir returns the configuration directory path

func (*Config) GetDefaultModel added in v0.27.0

func (c *Config) GetDefaultModel() string

func (*Config) GetExcludeModels added in v0.57.1

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

func (*Config) GetGatewayURL added in v0.27.0

func (c *Config) GetGatewayURL() string

func (*Config) GetIncludeModels added in v0.57.1

func (c *Config) GetIncludeModels() []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) 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) IsA2AToolsEnabled added in v0.51.0

func (c *Config) IsA2AToolsEnabled() bool

IsA2AToolsEnabled checks if A2A tools should be enabled A2A tools are enabled when a2a.enabled is true, regardless of tools.enabled

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

func (*Config) IsBashCommandWhitelisted added in v0.56.0

func (c *Config) IsBashCommandWhitelisted(command string) bool

IsBashCommandWhitelisted checks if a specific bash command is whitelisted

func (*Config) IsClaudeCodeMode added in v0.100.0

func (c *Config) IsClaudeCodeMode() bool

IsClaudeCodeMode checks if Claude Code CLI mode is enabled When enabled, the CLI will use Claude Max/Pro subscription instead of gateway

func (*Config) SetConfigDir added in v0.90.0

func (c *Config) SetConfigDir(dir string)

SetConfigDir sets the configuration directory path

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 ContainerRuntimeConfig added in v0.82.0

type ContainerRuntimeConfig struct {
	Type string `yaml:"type" mapstructure:"type"` // "docker", "podman", or "" for auto-detect
}

ContainerRuntimeConfig contains container runtime settings

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"`
	BatchSize int    `yaml:"batch_size" mapstructure:"batch_size"`
	Interval  int    `yaml:"interval" mapstructure:"interval"`
}

ConversationTitleConfig contains settings for AI-generated conversation titles. The system prompt lives in prompts.yaml under conversation.title_generation.system_prompt.

type CustomPricing added in v0.86.0

type CustomPricing struct {
	InputPricePerMToken  float64 `yaml:"input_price_per_mtoken" mapstructure:"input_price_per_mtoken"`
	OutputPricePerMToken float64 `yaml:"output_price_per_mtoken" mapstructure:"output_price_per_mtoken"`
}

CustomPricing allows users to override default pricing for specific models.

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 ExportConfig added in v0.63.0

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

ExportConfig contains settings for export command

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 FloatingWindowConfig added in v0.96.0

type FloatingWindowConfig struct {
	Enabled        bool   `yaml:"enabled" mapstructure:"enabled"`
	RespawnOnClose bool   `yaml:"respawn_on_close" mapstructure:"respawn_on_close"`
	Position       string `yaml:"position" mapstructure:"position"`
	AlwaysOnTop    bool   `yaml:"always_on_top" mapstructure:"always_on_top"`
}

FloatingWindowConfig contains floating progress window settings

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"`
	OCI              string   `yaml:"oci,omitempty" mapstructure:"oci,omitempty"`
	Run              bool     `yaml:"run" mapstructure:"run"`
	StandaloneBinary bool     `yaml:"standalone_binary" mapstructure:"standalone_binary"`
	Debug            bool     `yaml:"debug,omitempty" mapstructure:"debug,omitempty"`
	IncludeModels    []string `yaml:"include_models,omitempty" mapstructure:"include_models,omitempty"`
	ExcludeModels    []string `yaml:"exclude_models,omitempty" mapstructure:"exclude_models,omitempty"`
	VisionEnabled    bool     `yaml:"vision_enabled" mapstructure:"vision_enabled"`
}

GatewayConfig contains gateway connection settings

type GetFocusedAppToolConfig added in v0.96.0

type GetFocusedAppToolConfig struct {
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`
}

GetFocusedAppToolConfig contains get focused app-specific tool settings

type GitCommitMessageConfig added in v0.42.0

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

GitCommitMessageConfig contains settings for AI-generated commit messages. The system prompt lives in prompts.yaml under git.commit_message.system_prompt.

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 HeartbeatConfig added in v0.108.0

type HeartbeatConfig struct {
	Enabled      bool   `yaml:"enabled" mapstructure:"enabled"`
	Interval     string `yaml:"interval" mapstructure:"interval"`
	InitialDelay string `yaml:"initial_delay" mapstructure:"initial_delay"`
	Model        string `yaml:"model" mapstructure:"model"`
	Prompt       string `yaml:"prompt" mapstructure:"prompt"`
}

HeartbeatConfig configures the periodic "wake-up" tick that spawns `infer agent` with a tailored system prompt so the agent can check for pending work without waiting for user input. Disabled by default.

The companion system prompt lives at PromptsConfig.Agent.SystemPromptHeartbeat in prompts.yaml — keeping runtime knobs (interval, model) here separate from prompt text.

func DefaultHeartbeatConfig added in v0.108.0

func DefaultHeartbeatConfig() *HeartbeatConfig

DefaultHeartbeatConfig returns the in-code default heartbeat configuration used when no heartbeat.yaml file exists. `infer init` seeds the file from this and the runtime falls back to it when the file is absent.

func LoadHeartbeat added in v0.108.0

func LoadHeartbeat(path string) (*HeartbeatConfig, error)

LoadHeartbeat reads heartbeat.yaml from disk. When the file is missing it returns the in-code defaults so callers can treat absence as "use defaults" without special-casing. The file body is run through os.ExpandEnv so `${VAR}`-style references resolve from the environment.

type ImageConfig added in v0.72.0

type ImageConfig struct {
	MaxSize           int64                        `yaml:"max_size" mapstructure:"max_size"`
	Timeout           int                          `yaml:"timeout" mapstructure:"timeout"`
	ClipboardOptimize ClipboardImageOptimizeConfig `yaml:"clipboard_optimize" mapstructure:"clipboard_optimize"`
}

ImageConfig contains image service settings

type JsonlStorageConfig added in v0.92.6

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

JsonlStorageConfig contains JSONL-specific configuration

type KeyBindingEntry added in v0.77.0

type KeyBindingEntry struct {
	Keys        []string `yaml:"keys" mapstructure:"keys"`
	Description string   `yaml:"description,omitempty" mapstructure:"description,omitempty"`
	Category    string   `yaml:"category,omitempty" mapstructure:"category,omitempty"`
	Enabled     *bool    `yaml:"enabled,omitempty" mapstructure:"enabled,omitempty"`
}

KeyBindingEntry defines a complete keybinding with its properties

type KeyNamespace added in v0.77.0

type KeyNamespace string

KeyNamespace represents the namespace for key binding actions

const (
	NamespaceGlobal       KeyNamespace = "global"
	NamespaceChat         KeyNamespace = "chat"
	NamespaceClipboard    KeyNamespace = "clipboard"
	NamespaceDisplay      KeyNamespace = "display"
	NamespaceHelp         KeyNamespace = "help"
	NamespaceMode         KeyNamespace = "mode"
	NamespaceNavigation   KeyNamespace = "navigation"
	NamespacePlanApproval KeyNamespace = "plan_approval"
	NamespaceSelection    KeyNamespace = "selection"
	NamespaceTextEditing  KeyNamespace = "text_editing"
	NamespaceTools        KeyNamespace = "tools"
)

Namespace constants for organizing key binding actions

type KeybindingsConfig added in v0.77.0

type KeybindingsConfig struct {
	Enabled  bool                       `yaml:"enabled" mapstructure:"enabled"`
	Bindings map[string]KeyBindingEntry `yaml:"bindings,omitempty" mapstructure:"bindings,omitempty"`
}

KeybindingsConfig contains settings for customizing keybindings

func DefaultKeybindingsConfig added in v0.104.1

func DefaultKeybindingsConfig() *KeybindingsConfig

DefaultKeybindingsConfig returns the default keybindings config used when no file exists. Callers (init, reset) use it to seed a fresh file.

func LoadKeybindings added in v0.104.1

func LoadKeybindings(path string) (*KeybindingsConfig, error)

LoadKeybindings reads keybindings.yaml from disk. When the file is missing it returns the in-code defaults so callers can treat absence as "use defaults" without special-casing. The file body is run through os.ExpandEnv — any literal `${…}` token in a customised binding must be escaped as `$$…`.

type KeyboardTypeToolConfig added in v0.96.0

type KeyboardTypeToolConfig struct {
	Enabled       bool `yaml:"enabled" mapstructure:"enabled"`
	MaxTextLength int  `yaml:"max_text_length" mapstructure:"max_text_length"`
	TypingDelayMs int  `yaml:"typing_delay_ms" mapstructure:"typing_delay_ms"`
}

KeyboardTypeToolConfig contains keyboard type-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"`
	Stdout bool   `yaml:"stdout" mapstructure:"stdout"`
}

LoggingConfig contains logging settings

type MCPConfig added in v0.79.0

type MCPConfig struct {
	Enabled               bool             `yaml:"enabled" mapstructure:"enabled"`
	ConnectionTimeout     int              `yaml:"connection_timeout,omitempty" mapstructure:"connection_timeout,omitempty"`
	DiscoveryTimeout      int              `yaml:"discovery_timeout,omitempty" mapstructure:"discovery_timeout,omitempty"`
	LivenessProbeEnabled  bool             `yaml:"liveness_probe_enabled,omitempty" mapstructure:"liveness_probe_enabled,omitempty"`
	LivenessProbeInterval int              `yaml:"liveness_probe_interval,omitempty" mapstructure:"liveness_probe_interval,omitempty"`
	MaxRetries            int              `yaml:"max_retries,omitempty" mapstructure:"max_retries,omitempty"`
	Servers               []MCPServerEntry `yaml:"servers" mapstructure:"servers"`
	// contains filtered or unexported fields
}

MCPConfig represents the mcp.yaml configuration file

func DefaultMCPConfig added in v0.79.0

func DefaultMCPConfig() *MCPConfig

DefaultMCPConfig returns a default MCP configuration

func LoadMCP added in v0.104.1

func LoadMCP(path string) (*MCPConfig, error)

LoadMCP reads mcp.yaml from disk. When the file is missing it returns the in-code defaults so callers can treat absence as "use defaults" without special-casing.

func MergeMCP added in v0.104.1

func MergeMCP(base *MCPConfig, optional *MCPConfig) *MCPConfig

MergeMCP merges an optional mcp.yaml config on top of a base config. Optional values take precedence; servers from both are combined and optional entries override base entries with the same name.

func (*MCPConfig) CreateEntry added in v0.104.1

func (c *MCPConfig) CreateEntry(entry MCPServerEntry) error

CreateEntry implements CollectionConfig.

func (*MCPConfig) DeleteEntry added in v0.104.1

func (c *MCPConfig) DeleteEntry(name string) error

DeleteEntry implements CollectionConfig.

func (*MCPConfig) ListEntries added in v0.104.1

func (c *MCPConfig) ListEntries() []MCPServerEntry

ListEntries implements CollectionConfig.

func (*MCPConfig) ReadEntry added in v0.104.1

func (c *MCPConfig) ReadEntry(name string) (*MCPServerEntry, error)

ReadEntry implements CollectionConfig.

func (*MCPConfig) UpdateEntry added in v0.104.1

func (c *MCPConfig) UpdateEntry(entry MCPServerEntry) error

UpdateEntry implements CollectionConfig.

type MCPServerEntry added in v0.79.0

type MCPServerEntry struct {
	Name           string            `yaml:"name" mapstructure:"name"`
	Enabled        bool              `yaml:"enabled" mapstructure:"enabled"`
	Timeout        int               `yaml:"timeout,omitempty" mapstructure:"timeout,omitempty"`
	Description    string            `yaml:"description,omitempty" mapstructure:"description,omitempty"`
	IncludeTools   []string          `yaml:"include_tools,omitempty" mapstructure:"include_tools,omitempty"`
	ExcludeTools   []string          `yaml:"exclude_tools,omitempty" mapstructure:"exclude_tools,omitempty"`
	Run            bool              `yaml:"run" mapstructure:"run"`
	Host           string            `yaml:"host,omitempty" mapstructure:"host,omitempty"`
	Scheme         string            `yaml:"scheme,omitempty" mapstructure:"scheme,omitempty"`
	Port           int               `yaml:"port,omitempty" mapstructure:"port,omitempty"`
	Ports          []string          `yaml:"ports,omitempty" mapstructure:"ports,omitempty"`
	Path           string            `yaml:"path,omitempty" mapstructure:"path,omitempty"`
	OCI            string            `yaml:"oci,omitempty" mapstructure:"oci,omitempty"`
	Entrypoint     []string          `yaml:"entrypoint,omitempty" mapstructure:"entrypoint,omitempty"`
	Command        []string          `yaml:"command,omitempty" mapstructure:"command,omitempty"`
	Args           []string          `yaml:"args,omitempty" mapstructure:"args,omitempty"`
	Env            map[string]string `yaml:"env,omitempty" mapstructure:"env,omitempty"`
	Volumes        []string          `yaml:"volumes,omitempty" mapstructure:"volumes,omitempty"`
	StartupTimeout int               `yaml:"startup_timeout,omitempty" mapstructure:"startup_timeout,omitempty"`
	HealthCmd      string            `yaml:"health_cmd,omitempty" mapstructure:"health_cmd,omitempty"`
}

MCPServerEntry represents a single MCP server configuration

func (*MCPServerEntry) GetPrimaryPort added in v0.80.0

func (e *MCPServerEntry) GetPrimaryPort() int

GetPrimaryPort returns the primary (first) host port Priority: port field > ports array > 0

func (*MCPServerEntry) GetStartupTimeout added in v0.80.0

func (e *MCPServerEntry) GetStartupTimeout() int

GetStartupTimeout returns the effective startup timeout for this server

func (*MCPServerEntry) GetTimeout added in v0.79.0

func (e *MCPServerEntry) GetTimeout(globalTimeout int) int

GetTimeout returns the effective timeout for this server

func (*MCPServerEntry) GetURL added in v0.80.0

func (e *MCPServerEntry) GetURL() string

GetURL returns the full URL for the server Builds from host, scheme, ports, and path

func (*MCPServerEntry) ShouldIncludeTool added in v0.79.0

func (e *MCPServerEntry) ShouldIncludeTool(toolName string) bool

ShouldIncludeTool determines if a tool should be included based on include/exclude lists

type ModelMatcher added in v0.98.0

type ModelMatcher struct {
	Patterns      []string
	ContextWindow int
}

ModelMatcher defines a pattern match for context window estimation.

type ModelPricing added in v0.86.0

type ModelPricing struct {
	Provider             string
	Model                string
	InputPricePerMToken  float64
	OutputPricePerMToken float64
	Currency             string
}

ModelPricing represents pricing information for a specific model. Prices are per million tokens to align with common pricing conventions.

type MouseClickToolConfig added in v0.96.0

type MouseClickToolConfig struct {
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`
}

MouseClickToolConfig contains mouse click-specific tool settings

type MouseMoveToolConfig added in v0.96.0

type MouseMoveToolConfig struct {
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`
}

MouseMoveToolConfig contains mouse move-specific tool settings

type MouseScrollToolConfig added in v0.96.0

type MouseScrollToolConfig struct {
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`
}

MouseScrollToolConfig contains mouse scroll-specific tool 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 PricingConfig added in v0.86.0

type PricingConfig struct {
	Enabled      bool                     `yaml:"enabled" mapstructure:"enabled"`
	Currency     string                   `yaml:"currency" mapstructure:"currency"`
	CustomPrices map[string]CustomPricing `yaml:"custom_prices" mapstructure:"custom_prices"`
}

PricingConfig holds configuration for model pricing and cost tracking.

func GetDefaultPricingConfig added in v0.86.0

func GetDefaultPricingConfig() PricingConfig

GetDefaultPricingConfig returns the default pricing configuration.

type PromptsAgentConfig added in v0.104.1

type PromptsAgentConfig struct {
	SystemPrompt          string                      `yaml:"system_prompt" mapstructure:"system_prompt"`
	SystemPromptPlan      string                      `yaml:"system_prompt_plan" mapstructure:"system_prompt_plan"`
	SystemPromptRemote    string                      `yaml:"system_prompt_remote" mapstructure:"system_prompt_remote"`
	SystemPromptHeartbeat string                      `yaml:"system_prompt_heartbeat" mapstructure:"system_prompt_heartbeat"`
	CustomInstructions    string                      `yaml:"custom_instructions" mapstructure:"custom_instructions"`
	SystemReminders       PromptsAgentRemindersConfig `yaml:"system_reminders" mapstructure:"system_reminders"`
}

type PromptsAgentRemindersConfig added in v0.104.1

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

type PromptsConfig added in v0.104.1

type PromptsConfig struct {
	Agent        PromptsAgentConfig        `yaml:"agent" mapstructure:"agent"`
	Git          PromptsGitConfig          `yaml:"git" mapstructure:"git"`
	Conversation PromptsConversationConfig `yaml:"conversation" mapstructure:"conversation"`
	Init         PromptsInitConfig         `yaml:"init" mapstructure:"init"`
	Tools        PromptsToolsConfig        `yaml:"tools" mapstructure:"tools"`
}

PromptsConfig holds every customisable LLM prompt the CLI ships with. It mirrors the nested key structure those prompts had when they lived under .infer/config.yaml so users can move existing values verbatim.

func DefaultPromptsConfig added in v0.104.1

func DefaultPromptsConfig() *PromptsConfig

DefaultPromptsConfig returns the in-code default prompts. This is the single source of truth — `infer init` seeds prompts.yaml from this and the runtime overlay falls back to it when fields are missing.

func LoadPrompts added in v0.104.1

func LoadPrompts(path string) (*PromptsConfig, error)

LoadPrompts reads prompts.yaml from disk. When the file is missing it returns the in-code defaults so callers can treat absence as "use defaults" without special-casing. The file body is run through os.ExpandEnv — any literal `${…}` token in a customised prompt must be escaped as `$$…`.

Any field left empty in a partial prompts.yaml is backfilled from DefaultPromptsConfig() so callers always get a fully populated config. CustomInstructions is intentionally excluded from backfill — empty is a meaningful user choice there.

type PromptsConversationConfig added in v0.104.1

type PromptsConversationConfig struct {
	TitleGeneration PromptsConversationTitleConfig `yaml:"title_generation" mapstructure:"title_generation"`
}

type PromptsConversationTitleConfig added in v0.104.1

type PromptsConversationTitleConfig struct {
	SystemPrompt string `yaml:"system_prompt" mapstructure:"system_prompt"`
}

type PromptsGitCommitMessageConfig added in v0.104.1

type PromptsGitCommitMessageConfig struct {
	SystemPrompt string `yaml:"system_prompt" mapstructure:"system_prompt"`
}

type PromptsGitConfig added in v0.104.1

type PromptsGitConfig struct {
	CommitMessage PromptsGitCommitMessageConfig `yaml:"commit_message" mapstructure:"commit_message"`
}

type PromptsInitConfig added in v0.104.1

type PromptsInitConfig struct {
	Prompt string `yaml:"prompt" mapstructure:"prompt"`
}

type PromptsToolDescription added in v0.104.1

type PromptsToolDescription struct {
	Description string `yaml:"description" mapstructure:"description"`
}

PromptsToolDescription holds a single tool's LLM-visible description. It is wrapped in a struct (rather than being a bare string) so future fields — e.g. per-parameter description overrides — can be added without breaking existing prompts.yaml files.

type PromptsToolsConfig added in v0.104.1

type PromptsToolsConfig struct {
	Bash                PromptsToolDescription `yaml:"Bash" mapstructure:"Bash"`
	BashOutput          PromptsToolDescription `yaml:"BashOutput" mapstructure:"BashOutput"`
	KillShell           PromptsToolDescription `yaml:"KillShell" mapstructure:"KillShell"`
	ListShells          PromptsToolDescription `yaml:"ListShells" mapstructure:"ListShells"`
	Read                PromptsToolDescription `yaml:"Read" mapstructure:"Read"`
	Write               PromptsToolDescription `yaml:"Write" mapstructure:"Write"`
	Edit                PromptsToolDescription `yaml:"Edit" mapstructure:"Edit"`
	MultiEdit           PromptsToolDescription `yaml:"MultiEdit" mapstructure:"MultiEdit"`
	Delete              PromptsToolDescription `yaml:"Delete" mapstructure:"Delete"`
	Grep                PromptsToolDescription `yaml:"Grep" mapstructure:"Grep"`
	Tree                PromptsToolDescription `yaml:"Tree" mapstructure:"Tree"`
	TodoWrite           PromptsToolDescription `yaml:"TodoWrite" mapstructure:"TodoWrite"`
	RequestPlanApproval PromptsToolDescription `yaml:"RequestPlanApproval" mapstructure:"RequestPlanApproval"`
	WebFetch            PromptsToolDescription `yaml:"WebFetch" mapstructure:"WebFetch"`
	WebSearch           PromptsToolDescription `yaml:"WebSearch" mapstructure:"WebSearch"`
	Github              PromptsToolDescription `yaml:"Github" mapstructure:"Github"`
	Schedule            PromptsToolDescription `yaml:"Schedule" mapstructure:"Schedule"`
	A2AQueryAgent       PromptsToolDescription `yaml:"A2A_QueryAgent" mapstructure:"A2A_QueryAgent"`
	A2AQueryTask        PromptsToolDescription `yaml:"A2A_QueryTask" mapstructure:"A2A_QueryTask"`
	A2ASubmitTask       PromptsToolDescription `yaml:"A2A_SubmitTask" mapstructure:"A2A_SubmitTask"`
	MouseMove           PromptsToolDescription `yaml:"MouseMove" mapstructure:"MouseMove"`
	MouseClick          PromptsToolDescription `yaml:"MouseClick" mapstructure:"MouseClick"`
	MouseScroll         PromptsToolDescription `yaml:"MouseScroll" mapstructure:"MouseScroll"`
	KeyboardType        PromptsToolDescription `yaml:"KeyboardType" mapstructure:"KeyboardType"`
	GetFocusedApp       PromptsToolDescription `yaml:"GetFocusedApp" mapstructure:"GetFocusedApp"`
	ActivateApp         PromptsToolDescription `yaml:"ActivateApp" mapstructure:"ActivateApp"`
	GetLatestScreenshot PromptsToolDescription `yaml:"GetLatestScreenshot" mapstructure:"GetLatestScreenshot"`
}

PromptsToolsConfig groups every tool whose description is exposed to the LLM. MCP tools are intentionally excluded — their descriptions come from the MCP server at runtime and overriding them here would drift from whatever the server reports. Tools that ship with the binary but only register conditionally (e.g. background-shell tools, computer-use tools) still get a default so the override slot exists regardless of whether the tool is enabled in this run.

type QueryAgentToolConfig added in v0.51.0

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

QueryAgentToolConfig contains Query-specific tool settings

type QueryTaskToolConfig added in v0.51.0

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

QueryTaskToolConfig contains QueryTask-specific tool settings

type RateLimitConfig added in v0.96.0

type RateLimitConfig struct {
	Enabled             bool `yaml:"enabled" mapstructure:"enabled"`
	MaxActionsPerMinute int  `yaml:"max_actions_per_minute" mapstructure:"max_actions_per_minute"`
	WindowSeconds       int  `yaml:"window_seconds" mapstructure:"window_seconds"`
}

RateLimitConfig contains rate limiting settings

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 SSHServerConfig added in v0.95.0

type SSHServerConfig struct {
	Name        string   `yaml:"name" mapstructure:"name"`
	ID          string   `yaml:"id" mapstructure:"id"`
	RemoteHost  string   `yaml:"remote_host" mapstructure:"remote_host"`
	RemotePort  int      `yaml:"remote_port" mapstructure:"remote_port"`
	RemoteUser  string   `yaml:"remote_user" mapstructure:"remote_user"`
	CommandPath string   `yaml:"command_path" mapstructure:"command_path"`
	CommandArgs []string `yaml:"command_args" mapstructure:"command_args"`
	AutoInstall *bool    `yaml:"auto_install,omitempty" mapstructure:"auto_install"`
	InstallPath string   `yaml:"install_path" mapstructure:"install_path"`
	Description string   `yaml:"description" mapstructure:"description"`
	Tags        []string `yaml:"tags" mapstructure:"tags"`
}

SSHServerConfig contains configuration for a single remote SSH server

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 ScheduleToolConfig added in v0.104.0

type ScheduleToolConfig struct {
	Enabled         bool   `yaml:"enabled" mapstructure:"enabled"`
	RequireApproval *bool  `yaml:"require_approval,omitempty" mapstructure:"require_approval,omitempty"`
	StorageDir      string `yaml:"storage_dir,omitempty" mapstructure:"storage_dir,omitempty"`
	MaxJobs         int    `yaml:"max_jobs,omitempty" mapstructure:"max_jobs,omitempty"`
}

ScheduleToolConfig contains schedule-specific tool settings. When enabled, the tool lets the LLM create recurring jobs that fire on a cron schedule and deliver their output through a configured channel (e.g. Telegram). Jobs are persisted as YAML files under StorageDir and hot-reloaded by the channels-manager daemon.

type ScreenshotToolConfig added in v0.96.0

type ScreenshotToolConfig struct {
	Enabled          bool   `yaml:"enabled" mapstructure:"enabled"`
	MaxWidth         int    `yaml:"max_width" mapstructure:"max_width"`
	MaxHeight        int    `yaml:"max_height" mapstructure:"max_height"`
	TargetWidth      int    `yaml:"target_width" mapstructure:"target_width"`
	TargetHeight     int    `yaml:"target_height" mapstructure:"target_height"`
	Format           string `yaml:"format" mapstructure:"format"`
	Quality          int    `yaml:"quality" mapstructure:"quality"`
	StreamingEnabled bool   `yaml:"streaming_enabled" mapstructure:"streaming_enabled"`
	CaptureInterval  int    `yaml:"capture_interval" mapstructure:"capture_interval"`
	BufferSize       int    `yaml:"buffer_size" mapstructure:"buffer_size"`
	TempDir          string `yaml:"temp_dir" mapstructure:"temp_dir"`
	LogCaptures      bool   `yaml:"log_captures" mapstructure:"log_captures"`
	ShowOverlay      bool   `yaml:"show_overlay" mapstructure:"show_overlay"`
}

ScreenshotToolConfig contains screenshot-specific tool settings

type StatusBarConfig added in v0.83.0

type StatusBarConfig struct {
	Enabled    bool                `yaml:"enabled" mapstructure:"enabled"`
	Indicators StatusBarIndicators `yaml:"indicators" mapstructure:"indicators"`
}

StatusBarConfig contains settings for the chat status bar The status bar displays model information and system status indicators

func GetDefaultStatusBarConfig added in v0.83.0

func GetDefaultStatusBarConfig() StatusBarConfig

GetDefaultStatusBarConfig returns the default status bar configuration All indicators are enabled by default except MaxOutput to maintain current behavior

type StatusBarIndicators added in v0.83.0

type StatusBarIndicators struct {
	Model            bool `yaml:"model" mapstructure:"model"`
	Theme            bool `yaml:"theme" mapstructure:"theme"`
	MaxOutput        bool `yaml:"max_output" mapstructure:"max_output"`
	A2AAgents        bool `yaml:"a2a_agents" mapstructure:"a2a_agents"`
	Tools            bool `yaml:"tools" mapstructure:"tools"`
	BackgroundShells bool `yaml:"background_shells" mapstructure:"background_shells"`
	A2ATasks         bool `yaml:"a2a_tasks" mapstructure:"a2a_tasks"`
	MCP              bool `yaml:"mcp" mapstructure:"mcp"`
	ContextUsage     bool `yaml:"context_usage" mapstructure:"context_usage"`
	SessionTokens    bool `yaml:"session_tokens" mapstructure:"session_tokens"`
	Cost             bool `yaml:"cost" mapstructure:"cost"`
	GitBranch        bool `yaml:"git_branch" mapstructure:"git_branch"`
}

StatusBarIndicators contains individual enable/disable toggles for each indicator All indicators are enabled by default to maintain current behavior

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"`
	Jsonl    JsonlStorageConfig    `yaml:"jsonl,omitempty" mapstructure:"jsonl,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"
	StorageTypeJsonl    StorageType = "jsonl"
)

type SubmitTaskToolConfig added in v0.51.0

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

SubmitTaskToolConfig contains SubmitTask-specific tool settings

type TelegramChannelConfig added in v0.101.0

type TelegramChannelConfig struct {
	Enabled      bool     `yaml:"enabled" mapstructure:"enabled"`
	BotToken     string   `yaml:"bot_token" mapstructure:"bot_token"`
	AllowedUsers []string `yaml:"allowed_users" mapstructure:"allowed_users"`
	PollTimeout  int      `yaml:"poll_timeout" mapstructure:"poll_timeout"`
}

TelegramChannelConfig contains Telegram bot settings

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"`
	Schedule  ScheduleToolConfig  `yaml:"schedule" mapstructure:"schedule"`

	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 WebConfig added in v0.94.0

type WebConfig struct {
	Enabled               bool              `yaml:"enabled" mapstructure:"enabled"`
	Port                  int               `yaml:"port" mapstructure:"port"`
	Host                  string            `yaml:"host" mapstructure:"host"`
	SessionInactivityMins int               `yaml:"session_inactivity_mins" mapstructure:"session_inactivity_mins"`
	SSH                   WebSSHConfig      `yaml:"ssh" mapstructure:"ssh"`
	Servers               []SSHServerConfig `yaml:"servers" mapstructure:"servers"`
}

WebConfig contains web terminal 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 WebSSHConfig added in v0.95.0

type WebSSHConfig struct {
	Enabled        bool   `yaml:"enabled" mapstructure:"enabled"`
	UseSSHConfig   bool   `yaml:"use_ssh_config" mapstructure:"use_ssh_config"`
	KnownHostsPath string `yaml:"known_hosts_path" mapstructure:"known_hosts_path"`
	AutoInstall    bool   `yaml:"auto_install" mapstructure:"auto_install"`
	InstallVersion string `yaml:"install_version" mapstructure:"install_version"`
	InstallDir     string `yaml:"install_dir" mapstructure:"install_dir"`
}

WebSSHConfig contains SSH connection settings for remote servers

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 WhatsAppChannelConfig added in v0.101.0

type WhatsAppChannelConfig struct {
	Enabled       bool     `yaml:"enabled" mapstructure:"enabled"`
	PhoneNumberID string   `yaml:"phone_number_id" mapstructure:"phone_number_id"`
	AccessToken   string   `yaml:"access_token" mapstructure:"access_token"`
	VerifyToken   string   `yaml:"verify_token" mapstructure:"verify_token"`
	WebhookPort   int      `yaml:"webhook_port" mapstructure:"webhook_port"`
	AllowedUsers  []string `yaml:"allowed_users" mapstructure:"allowed_users"`
}

WhatsAppChannelConfig contains WhatsApp Business API 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

Directories

Path Synopsis
Package utils provides generic file-IO helpers shared by every sub-config in package config.
Package utils provides generic file-IO helpers shared by every sub-config in package config.

Jump to

Keyboard shortcuts

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