config

package
v0.0.340 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReasoningDisplayAuto      = "auto"
	ReasoningDisplayOff       = "off"
	ReasoningDisplayStatus    = "status"
	ReasoningDisplayCollapsed = "collapsed"
	ReasoningDisplayExpanded  = "expanded"
	ReasoningDisplayRaw       = "raw"

	ReasoningSourceSummaryOnly           = "summary_only"
	ReasoningSourceSummaryOrProviderSafe = "summary_or_provider_safe"
	ReasoningSourceAll                   = "all"

	ReasoningStatusNone    = "none"
	ReasoningStatusGeneric = "generic"
	ReasoningStatusTitle   = "title"
	ReasoningStatusSummary = "summary"

	ReasoningHistoryNone           = "none"
	ReasoningHistoryCollapsed      = "collapsed"
	ReasoningHistoryExpanded       = "expanded"
	ReasoningHistoryTranscriptOnly = "transcript_only"

	ReasoningExportNever     = "never"
	ReasoningExportAsk       = "ask"
	ReasoningExportSummaries = "summaries"
	ReasoningExportRaw       = "raw"

	ReasoningInherit = "inherit"
)

Reasoning display policy values.

View Source
const (
	DefaultConfigProvider = "anthropic"

	DefaultAskMaxTurns     = 50
	DefaultChatMaxTurns    = 200
	DefaultExecSuggestions = 3

	DefaultAssistantInstructions = "You are a helpful assistant. Today's date is {{date}}."
	DefaultChatTerminalTitle     = "smart"
	DefaultEditContextLines      = 3
	DefaultEditDiffFormat        = "auto"

	DefaultImageProvider         = "gemini"
	DefaultImageOutputDir        = "~/Pictures/term-llm"
	DefaultImageGeminiModel      = "gemini-2.5-flash-image"
	DefaultImageOpenAIModel      = "gpt-image-2"
	DefaultImageChatGPTModel     = "gpt-5.4-mini"
	DefaultImageXAIModel         = "grok-2-image-1212"
	DefaultImageVeniceModel      = "nano-banana-pro"
	DefaultImageVeniceResolution = "2K"
	DefaultImageFluxModel        = "flux-2-pro"
	DefaultImageFluxEditModel    = "flux-kontext-pro"
	DefaultImageOpenRouterModel  = "google/gemini-2.5-flash-image"
	DefaultImageDebugDelay       = 0.0

	DefaultAudioProvider         = "venice"
	DefaultAudioOutputDir        = "~/Music/term-llm"
	DefaultAudioVeniceModel      = "tts-kokoro"
	DefaultAudioVeniceVoice      = "af_sky"
	DefaultAudioVeniceFormat     = "mp3"
	DefaultAudioVeniceSpeed      = 1.0
	DefaultAudioGeminiModel      = "gemini-3.1-flash-tts-preview"
	DefaultAudioGeminiVoice      = "Kore"
	DefaultAudioGeminiFormat     = "wav"
	DefaultAudioElevenLabsModel  = "eleven_multilingual_v2"
	DefaultAudioElevenLabsVoice  = "JBFqnCBsd6RMkjVDRZzb"
	DefaultAudioElevenLabsFormat = "mp3_44100_128"

	DefaultMusicProvider         = "venice"
	DefaultMusicOutputDir        = "~/Music/term-llm"
	DefaultMusicVeniceModel      = "elevenlabs-sound-effects-v2"
	DefaultMusicVeniceFormat     = "mp3"
	DefaultMusicElevenLabsModel  = "music_v1"
	DefaultMusicElevenLabsFormat = "mp3_44100_128"
	DefaultMusicPollInterval     = "2s"
	DefaultMusicPollTimeout      = "10m"

	DefaultTranscriptionProvider        = "openai"
	DefaultTranscriptionOpenAIModel     = "whisper-1"
	DefaultTranscriptionMistralModel    = "voxtral-mini-latest"
	DefaultTranscriptionVeniceModel     = "nvidia/parakeet-tdt-0.6b-v3"
	DefaultTranscriptionElevenLabsModel = "scribe_v2"

	DefaultEmbedOpenAIModel   = "text-embedding-3-small"
	DefaultEmbedGeminiModel   = "gemini-embedding-001"
	DefaultEmbedJinaModel     = "jina-embeddings-v3"
	DefaultEmbedVoyageModel   = "voyage-3.5"
	DefaultEmbedOllamaModel   = "nomic-embed-text"
	DefaultOllamaBaseURL      = "http://127.0.0.1:11434"
	DefaultEmbedOllamaBaseURL = DefaultOllamaBaseURL

	DefaultSearchProvider      = "exa_mcp"
	DefaultSearchFetchProvider = "jina"
	DefaultSearchExaMCPURL     = "https://mcp.exa.ai/mcp"

	DefaultReasoningMaxSummaryChars = 12000
	DefaultReasoningMaxRawChars     = 20000
	DefaultReasoningHiddenLabel     = "Thinking..."

	DefaultToolsShellAutoRunEnv    = "TERM_LLM_ALLOW_AUTORUN"
	DefaultToolsShellNonTTYEnv     = "TERM_LLM_ALLOW_NON_TTY"
	DefaultToolsMaxToolOutputChars = 20000

	DefaultSessionsEnabled          = true
	DefaultSessionsMaxAgeDays       = 0
	DefaultSessionsMaxCount         = 0
	DefaultSessionsStripImageBase64 = false

	DefaultFileTrackingMaxFileBytes    = 2 * 1024 * 1024
	DefaultFileTrackingMaxSessionBytes = 100 * 1024 * 1024
	DefaultFileTrackingMaxTotalBytes   = int64(1024 * 1024 * 1024)

	DefaultSkillsMetadataBudgetTokens = 8000
	DefaultSkillsMaxVisibleSkills     = 50

	DefaultServeBasePath        = "/ui"
	DefaultServeResponseTimeout = "30m"

	DefaultAutoCompact = true
)

Variables

View Source
var KnownAgentPreferenceKeys = map[string]bool{
	"provider":             true,
	"model":                true,
	"tools_enabled":        true,
	"tools_disabled":       true,
	"shell_allow":          true,
	"shell_auto_run":       true,
	"spawn_max_parallel":   true,
	"spawn_max_depth":      true,
	"spawn_timeout":        true,
	"spawn_allowed_agents": true,
	"max_turns":            true,
	"search":               true,
}

KnownAgentPreferenceKeys contains valid keys for agent preference configurations

View Source
var KnownKeys = buildKnownKeys()

KnownKeys contains all valid non-dynamic configuration key paths.

View Source
var KnownProviderKeys = buildKnownProviderKeys()

KnownProviderKeys contains valid keys for provider configurations.

Functions

func ClearAgentPreferences added in v0.0.42

func ClearAgentPreferences(agentName string) error

ClearAgentPreferences removes all preferences for a specific agent.

func DefaultForKey added in v0.0.320

func DefaultForKey(path string) (any, bool)

DefaultForKey returns the canonical default for a non-provider config key.

func DefaultProviderFastModel added in v0.0.320

func DefaultProviderFastModel(name string) string

DefaultProviderFastModel returns the canonical lightweight model for a built-in provider.

func DefaultProviderFastModels added in v0.0.320

func DefaultProviderFastModels() map[string]string

DefaultProviderFastModels returns the default fast-model map keyed by provider type/name.

func DefaultProviderModel added in v0.0.320

func DefaultProviderModel(name string) string

DefaultProviderModel returns the canonical default chat model for a built-in provider.

func DefaultProviderNames added in v0.0.320

func DefaultProviderNames() []string

DefaultProviderNames returns provider names whose defaults should be shown in generated config output.

func DefaultProviderValue added in v0.0.320

func DefaultProviderValue(name, field string) (any, bool)

DefaultProviderValue returns a canonical default field for a built-in provider name or provider type.

func DescribeCredentialSource added in v0.0.82

func DescribeCredentialSource(name string, cfg *ProviderConfig) (string, bool)

DescribeCredentialSource returns a human-readable description of which credential source will be used for the given provider. This is used by `config show` to help users understand where their credentials are coming from. Returns a short label (e.g., "ANTHROPIC_API_KEY env") and whether any credential was found.

func DisplayModelForProviderModel added in v0.0.312

func DisplayModelForProviderModel(cfg *Config, providerName, modelName string) string

DisplayModelForProviderModel returns the user-facing name for a configured model. When a models[] object defines an alias, the alias takes display precedence even if callers track the upstream model id internally. Configured reasoning-effort suffixes are preserved (for example upstream/model-high -> friendly-high).

func Exists

func Exists() bool

Exists returns true if a config file exists

func FlushModelHistoryAsync added in v0.0.163

func FlushModelHistoryAsync()

FlushModelHistoryAsync waits for queued async history writes to complete. Intended for tests and orderly shutdown paths.

func GetBuiltInProviderNames added in v0.0.29

func GetBuiltInProviderNames() []string

GetBuiltInProviderNames returns a list of all built-in provider type names.

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns the XDG config directory for term-llm. Uses $XDG_CONFIG_HOME if set, otherwise ~/.config

func GetConfigPath

func GetConfigPath() (string, error)

GetConfigPath returns the path where the config file should be located

func GetDebugLogsDir added in v0.0.34

func GetDebugLogsDir() string

GetDebugLogsDir returns the XDG data directory for term-llm debug logs. Uses $XDG_DATA_HOME if set, otherwise ~/.local/share

func GetDefaults added in v0.0.38

func GetDefaults() map[string]any

GetDefaults returns a map of all default configuration values.

func GetDiagnosticsDir added in v0.0.11

func GetDiagnosticsDir() string

GetDiagnosticsDir returns the XDG data directory for term-llm diagnostics. Uses $XDG_DATA_HOME if set, otherwise ~/.local/share

func IsKnownKey added in v0.0.38

func IsKnownKey(keyPath string) bool

IsKnownKey checks if a key path is a known configuration key For provider keys (providers.*), validates the sub-keys For agent preference keys (agents.preferences.*), validates the sub-keys

func KnownKeyPaths added in v0.0.320

func KnownKeyPaths() []string

KnownKeyPaths returns all statically known config key paths in sorted order.

func ModelHistoryOrder added in v0.0.161

func ModelHistoryOrder(entries []ModelHistoryEntry) []string

ModelHistoryOrder returns model IDs ordered by most-recently-used. The returned slice contains only the "provider:model" strings.

func NeedsSetup

func NeedsSetup() bool

NeedsSetup returns true if config file doesn't exist

func NormalizeVeniceAPIKey added in v0.0.131

func NormalizeVeniceAPIKey(apiKey string) string

NormalizeVeniceAPIKey trims whitespace and strips an accidental "Bearer " prefix from a Venice API key. Shared across llm, image, and video packages.

func ParseProviderModel added in v0.0.42

func ParseProviderModel(s string) (provider, model string)

ParseProviderModel splits "provider:model" into separate parts. Returns (provider, model). Model will be empty if not specified. This is a simple version that doesn't validate against configured providers.

func RecordModelUse added in v0.0.161

func RecordModelUse(providerModel string) error

RecordModelUse adds or bumps a "provider:model" entry to the front of the history list, deduplicating and capping at maxModelHistoryEntries.

func RecordModelUseAsync added in v0.0.163

func RecordModelUseAsync(providerModel string)

RecordModelUseAsync queues a best-effort background MRU update. Updates are serialized through a single worker to preserve ordering.

func ResolveValue added in v0.0.15

func ResolveValue(value string) (string, error)

ResolveValue handles magic URL schemes in config values: - op://vault/item/field -> 1Password secret (via `op read`) - srv://record/path -> DNS SRV lookup + path (always HTTPS) - file://path -> file contents (trimmed) - file://path#key or file://path#nested.path -> JSON field from file contents - $(...) -> shell command output - ${VAR} or $VAR -> environment variable - literal string -> returned as-is

func Save

func Save(cfg *Config) error

Save writes the config to disk

func SchemaDefaultKeys added in v0.0.320

func SchemaDefaultKeys() []string

SchemaDefaultKeys returns the default-bearing config keys in sorted order.

func SetAgentPreference added in v0.0.42

func SetAgentPreference(agentName, key, value string) ([]string, error)

SetAgentPreference sets a preference for a specific agent. Uses viper to merge with existing config. Supports "provider:model" format for the provider key (e.g., "chatgpt:gpt-5.2-codex"). Returns a list of keys that were set (may be multiple for provider:model format).

func SetServeTelegramConfig added in v0.0.83

func SetServeTelegramConfig(c TelegramServeConfig) error

SetServeTelegramConfig saves Telegram bot configuration using viper. Merges with existing config rather than overwriting.

func SetServeWebPushConfig added in v0.0.114

func SetServeWebPushConfig(c WebPushConfig) error

SetServeWebPushConfig saves Web Push VAPID configuration using viper.

func VisionViaForProviderModel added in v0.0.312

func VisionViaForProviderModel(cfg *Config, providerName, modelName string) string

VisionViaForProviderModel returns the configured vision routing target for a model. A per-model models[].vision_via value overrides providers.<name>.vision_via. The value is a provider:model string understood by llm.ParseProviderModel.

func WriteFileAtomically added in v0.0.263

func WriteFileAtomically(path string, data []byte, defaultPerm os.FileMode) error

WriteFileAtomically replaces path with data using a temp-file + fsync + rename sequence. If path already exists, its mode is preserved; otherwise defaultPerm is used. A final-path symlink is followed so dotfile-managed config symlinks keep pointing at the original target instead of being replaced by a regular file.

Types

type AgentPreference added in v0.0.42

type AgentPreference struct {
	// Model preferences
	Provider string `mapstructure:"provider,omitempty" yaml:"provider,omitempty"`
	Model    string `mapstructure:"model,omitempty" yaml:"model,omitempty"`

	// Tool configuration
	ToolsEnabled  []string `mapstructure:"tools_enabled,omitempty" yaml:"tools_enabled,omitempty"`
	ToolsDisabled []string `mapstructure:"tools_disabled,omitempty" yaml:"tools_disabled,omitempty"`

	// Shell settings
	ShellAllow   []string `mapstructure:"shell_allow,omitempty" yaml:"shell_allow,omitempty"`
	ShellAutoRun *bool    `mapstructure:"shell_auto_run,omitempty" yaml:"shell_auto_run,omitempty"`

	// Spawn settings
	SpawnMaxParallel   *int     `mapstructure:"spawn_max_parallel,omitempty" yaml:"spawn_max_parallel,omitempty"`
	SpawnMaxDepth      *int     `mapstructure:"spawn_max_depth,omitempty" yaml:"spawn_max_depth,omitempty"`
	SpawnTimeout       *int     `mapstructure:"spawn_timeout,omitempty" yaml:"spawn_timeout,omitempty"`
	SpawnAllowedAgents []string `mapstructure:"spawn_allowed_agents,omitempty" yaml:"spawn_allowed_agents,omitempty"`

	// Behavior
	MaxTurns *int  `mapstructure:"max_turns,omitempty" yaml:"max_turns,omitempty"`
	Search   *bool `mapstructure:"search,omitempty" yaml:"search,omitempty"`
}

AgentPreference allows overriding agent settings via config.yaml. All fields are optional - only set fields override the agent's defaults.

func GetAgentPreference added in v0.0.42

func GetAgentPreference(agentName string) (AgentPreference, bool)

GetAgentPreference returns the preferences for a specific agent.

type AgentsConfig added in v0.0.33

type AgentsConfig struct {
	UseBuiltin  bool                       `mapstructure:"use_builtin"`  // Enable built-in agents (default true)
	SearchPaths []string                   `mapstructure:"search_paths"` // Additional directories to search for agents
	Preferences map[string]AgentPreference `mapstructure:"preferences"`  // Per-agent preference overrides
}

AgentsConfig configures the agent system

type AgentsMdConfig added in v0.0.37

type AgentsMdConfig struct {
	Enabled bool `mapstructure:"enabled"` // Load AGENTS.md into system prompt
}

AgentsMdConfig configures optional AGENTS.md loading

type ApprovalConfig added in v0.0.317

type ApprovalConfig struct {
	// DefaultMode controls approval mode for surfaces without an explicit
	// per-surface override. Valid values: prompt, auto. Empty means unset.
	// yolo is intentionally not accepted as a config default.
	DefaultMode string `mapstructure:"default_mode" yaml:"default_mode,omitempty"`
}

ApprovalConfig configures default approval behavior.

type AskConfig

type AskConfig struct {
	Provider     string `mapstructure:"provider"`                                     // Override provider for ask only
	Model        string `mapstructure:"model"`                                        // Override model for ask only
	Instructions string `mapstructure:"instructions"`                                 // Custom system prompt for ask
	MaxTurns     int    `mapstructure:"max_turns"`                                    // Max agentic turns (default 20)
	ApprovalMode string `mapstructure:"approval_mode" yaml:"approval_mode,omitempty"` // Optional approval mode: prompt or auto
}

type AudioConfig added in v0.0.202

type AudioConfig struct {
	Provider   string                `mapstructure:"provider"`   // default audio provider: venice, gemini, or elevenlabs
	OutputDir  string                `mapstructure:"output_dir"` // default save directory
	Venice     AudioVeniceConfig     `mapstructure:"venice"`
	Gemini     AudioGeminiConfig     `mapstructure:"gemini"`
	ElevenLabs AudioElevenLabsConfig `mapstructure:"elevenlabs"`
}

AudioConfig configures speech/audio generation settings.

type AudioElevenLabsConfig added in v0.0.202

type AudioElevenLabsConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"`
	Voice  string `mapstructure:"voice"`
	Format string `mapstructure:"format"`
}

AudioElevenLabsConfig configures ElevenLabs text-to-speech generation.

type AudioGeminiConfig added in v0.0.202

type AudioGeminiConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"`
	Voice  string `mapstructure:"voice"`
	Format string `mapstructure:"format"`
}

AudioGeminiConfig configures Gemini text-to-speech generation.

type AudioVeniceConfig added in v0.0.202

type AudioVeniceConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"`
	Voice  string `mapstructure:"voice"`
	Format string `mapstructure:"format"`
}

AudioVeniceConfig configures Venice AI text-to-speech generation.

type ChatConfig added in v0.0.29

type ChatConfig struct {
	Provider            string `mapstructure:"provider"`                                     // Override provider for chat only
	Model               string `mapstructure:"model"`                                        // Override model for chat only
	Instructions        string `mapstructure:"instructions"`                                 // Custom system prompt for chat
	MaxTurns            int    `mapstructure:"max_turns"`                                    // Max agentic turns (default 200)
	TerminalTitle       string `mapstructure:"terminal_title"`                               // smart, basic, or off (default smart)
	TerminalTitleFormat string `mapstructure:"terminal_title_format"`                        // Optional custom terminal title template
	TerminalProgress    bool   `mapstructure:"terminal_progress"`                            // Enable terminal progress indicators (default false)
	ApprovalMode        string `mapstructure:"approval_mode" yaml:"approval_mode,omitempty"` // Optional approval mode: prompt or auto
}

type Config

type Config struct {
	DefaultProvider string                    `mapstructure:"default_provider"`
	Providers       map[string]ProviderConfig `mapstructure:"providers"`
	Diagnostics     DiagnosticsConfig         `mapstructure:"diagnostics"`
	DebugLogs       DebugLogsConfig           `mapstructure:"debug_logs"`
	Sessions        SessionsConfig            `mapstructure:"sessions"`
	Approval        ApprovalConfig            `mapstructure:"approval"`
	Guardian        GuardianConfig            `mapstructure:"guardian"`
	Exec            ExecConfig                `mapstructure:"exec"`
	Ask             AskConfig                 `mapstructure:"ask"`
	Chat            ChatConfig                `mapstructure:"chat"`
	Edit            EditConfig                `mapstructure:"edit"`
	Loop            LoopConfig                `mapstructure:"loop"`
	Image           ImageConfig               `mapstructure:"image"`
	Audio           AudioConfig               `mapstructure:"audio"`
	Music           MusicConfig               `mapstructure:"music"`
	Transcription   TranscriptionConfig       `mapstructure:"transcription"`
	Embed           EmbedConfig               `mapstructure:"embed"`
	Search          SearchConfig              `mapstructure:"search"`
	Reasoning       ReasoningConfig           `mapstructure:"reasoning"`
	Theme           ThemeConfig               `mapstructure:"theme"`
	Tools           ToolsConfig               `mapstructure:"tools"`
	Agents          AgentsConfig              `mapstructure:"agents"`
	Skills          SkillsConfig              `mapstructure:"skills"`
	AgentsMd        AgentsMdConfig            `mapstructure:"agents_md"`
	AutoCompact     bool                      `mapstructure:"auto_compact"`
	Serve           ServeConfig               `mapstructure:"serve"`
	FileTracking    FileTrackingConfig        `mapstructure:"file_tracking"`
}

func Load

func Load() (*Config, error)

func (*Config) ApplyOverrides added in v0.0.6

func (c *Config) ApplyOverrides(provider, model string)

ApplyOverrides applies provider and model overrides to the config. If provider is non-empty, it overrides the global provider. If model is non-empty, it overrides the model for the active provider.

func (*Config) GetActiveProviderConfig added in v0.0.15

func (c *Config) GetActiveProviderConfig() *ProviderConfig

GetActiveProviderConfig returns the config for the default provider. Returns nil if the default provider is not configured.

func (*Config) GetProviderConfig added in v0.0.15

func (c *Config) GetProviderConfig(name string) *ProviderConfig

GetProviderConfig returns the config for the specified provider name. Returns nil if the provider is not configured.

func (*Config) GetResolvedProviderConfig added in v0.0.218

func (c *Config) GetResolvedProviderConfig(name string) (*ProviderConfig, error)

GetResolvedProviderConfig returns the config for the specified provider name after resolving any deferred credential discovery needed for that provider. Returns nil if the provider is not configured.

func (*Config) ResolveProviderCredentials added in v0.0.218

func (c *Config) ResolveProviderCredentials(name string) error

ResolveProviderCredentials resolves and caches credentials for the named provider. Missing providers are ignored.

func (*Config) ResolveReasoning added in v0.0.258

func (c *Config) ResolveReasoning(surface string) ReasoningConfig

ResolveReasoning returns a fully-populated reasoning display policy for a surface ("chat", "ask", "serve", or "jobs"), applying optional per-surface overrides and the TERM_LLM_SHOW_RAW_REASONING debug override.

func (*Config) ValidateApprovalModes added in v0.0.339

func (c *Config) ValidateApprovalModes() error

ValidateApprovalModes rejects persistent modes that would bypass approval or silently fall back because of a typo. Empty values are intentionally valid and mean "inherit".

type DebugLogsConfig added in v0.0.34

type DebugLogsConfig struct {
	Enabled bool   `mapstructure:"enabled"` // Enable debug logging
	Dir     string `mapstructure:"dir"`     // Override default directory (defaults to ~/.local/share/term-llm/debug/)
}

DebugLogsConfig configures debug logging of LLM requests and responses

type DefaultField added in v0.0.320

type DefaultField struct {
	Path  string
	Value any
}

DefaultField stores an ordered provider default.

type DiagnosticsConfig added in v0.0.11

type DiagnosticsConfig struct {
	Enabled bool   `mapstructure:"enabled"` // Enable diagnostic data collection
	Dir     string `mapstructure:"dir"`     // Override default directory
}

DiagnosticsConfig configures diagnostic data collection

type EditConfig added in v0.0.5

type EditConfig struct {
	Provider        string `mapstructure:"provider"`                                     // Override provider for edit
	Model           string `mapstructure:"model"`                                        // Override model for edit
	Instructions    string `mapstructure:"instructions"`                                 // Custom instructions for edits
	ShowLineNumbers bool   `mapstructure:"show_line_numbers"`                            // Show line numbers in diff
	ContextLines    int    `mapstructure:"context_lines"`                                // Lines of context in diff
	Editor          string `mapstructure:"editor"`                                       // Override $EDITOR
	DiffFormat      string `mapstructure:"diff_format"`                                  // "auto", "udiff", or "replace" (default: auto)
	ApprovalMode    string `mapstructure:"approval_mode" yaml:"approval_mode,omitempty"` // Optional approval mode: prompt or auto
}

type EmbedConfig added in v0.0.83

type EmbedConfig struct {
	Provider string            `mapstructure:"provider"` // default embedding provider: gemini, openai, jina, voyage, ollama
	OpenAI   EmbedOpenAIConfig `mapstructure:"openai"`
	Gemini   EmbedGeminiConfig `mapstructure:"gemini"`
	Jina     EmbedJinaConfig   `mapstructure:"jina"`
	Voyage   EmbedVoyageConfig `mapstructure:"voyage"`
	Ollama   EmbedOllamaConfig `mapstructure:"ollama"`
}

EmbedConfig configures text embedding generation

type EmbedGeminiConfig added in v0.0.83

type EmbedGeminiConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"` // gemini-embedding-001 (default)
}

EmbedGeminiConfig configures Gemini embedding generation

type EmbedJinaConfig added in v0.0.83

type EmbedJinaConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"` // jina-embeddings-v3 (default), jina-embeddings-v4
}

EmbedJinaConfig configures Jina AI embedding generation

type EmbedOllamaConfig added in v0.0.83

type EmbedOllamaConfig struct {
	BaseURL string `mapstructure:"base_url"` // default: http://127.0.0.1:11434
	Model   string `mapstructure:"model"`    // nomic-embed-text (default)
}

EmbedOllamaConfig configures Ollama embedding generation

type EmbedOpenAIConfig added in v0.0.83

type EmbedOpenAIConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"` // text-embedding-3-small (default), text-embedding-3-large
}

EmbedOpenAIConfig configures OpenAI embedding generation

type EmbedVoyageConfig added in v0.0.83

type EmbedVoyageConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"` // voyage-3.5 (default), voyage-3-large, voyage-code-3
}

EmbedVoyageConfig configures Voyage AI embedding generation

type ExecConfig

type ExecConfig struct {
	Provider     string `mapstructure:"provider"`                                     // Override provider for exec
	Model        string `mapstructure:"model"`                                        // Override model for exec
	Suggestions  int    `mapstructure:"suggestions"`                                  // Number of command suggestions (default 3)
	Instructions string `mapstructure:"instructions"`                                 // Custom context for suggestions
	ApprovalMode string `mapstructure:"approval_mode" yaml:"approval_mode,omitempty"` // Optional approval mode: prompt or auto
}

type FileTrackingConfig added in v0.0.286

type FileTrackingConfig struct {
	Enabled         bool   `mapstructure:"enabled"`           // Opt-in: record before/after content of files agents modify
	MaxFileBytes    int    `mapstructure:"max_file_bytes"`    // Per-file content cap; larger files recorded metadata-only (default 2 MiB)
	MaxSessionBytes int    `mapstructure:"max_session_bytes"` // Retained-content budget per session (default 100 MiB)
	MaxTotalBytes   int64  `mapstructure:"max_total_bytes"`   // Whole-database size cap; oldest sessions' history pruned on startup (default 1 GiB)
	Path            string `mapstructure:"path"`              // Optional SQLite DB path override
}

FileTrackingConfig configures recording of file changes made by agent tools

type FileUploadConfig added in v0.0.257

type FileUploadConfig struct {
	NativeMimeTypes    []string `mapstructure:"native_mime_types" yaml:"native_mime_types,omitempty"`
	MaxNativeBytes     int64    `mapstructure:"max_native_bytes" yaml:"max_native_bytes,omitempty"`
	TextEmbedMimeTypes []string `mapstructure:"text_embed_mime_types" yaml:"text_embed_mime_types,omitempty"`
	MaxTextEmbedBytes  int64    `mapstructure:"max_text_embed_bytes" yaml:"max_text_embed_bytes,omitempty"`
}

FileUploadConfig controls how user-uploaded files are forwarded to a provider. Native MIME types may be sent as provider-native file/document parts when the provider implementation supports them. Text-embed MIME types may be converted to ordinary prompt text as a portable fallback.

type GuardianConfig added in v0.0.317

type GuardianConfig struct {
	Provider       string `mapstructure:"provider" yaml:"provider,omitempty"`
	Model          string `mapstructure:"model" yaml:"model,omitempty"`
	PolicyPath     string `mapstructure:"policy_path" yaml:"policy_path,omitempty"`
	TimeoutSeconds int    `mapstructure:"timeout_seconds" yaml:"timeout_seconds,omitempty"`
}

GuardianConfig configures auto approval policy review.

type ImageChatGPTConfig added in v0.0.176

type ImageChatGPTConfig struct {
	Model string `mapstructure:"model"` // e.g., gpt-5.4-mini (default) or gpt-5.4
}

ImageChatGPTConfig configures ChatGPT image generation via the chatgpt.com backend's built-in image_generation tool (OAuth, no API key required).

type ImageConfig added in v0.0.3

type ImageConfig struct {
	Provider   string                `mapstructure:"provider"`   // default image provider: gemini, openai, chatgpt, xai, venice, flux, openrouter, debug
	OutputDir  string                `mapstructure:"output_dir"` // default save directory
	Gemini     ImageGeminiConfig     `mapstructure:"gemini"`
	OpenAI     ImageOpenAIConfig     `mapstructure:"openai"`
	ChatGPT    ImageChatGPTConfig    `mapstructure:"chatgpt"`
	XAI        ImageXAIConfig        `mapstructure:"xai"`
	Venice     ImageVeniceConfig     `mapstructure:"venice"`
	Flux       ImageFluxConfig       `mapstructure:"flux"`
	OpenRouter ImageOpenRouterConfig `mapstructure:"openrouter"`
	Debug      ImageDebugConfig      `mapstructure:"debug"`
}

ImageConfig configures image generation settings

type ImageDebugConfig added in v0.0.39

type ImageDebugConfig struct {
	Delay float64 `mapstructure:"delay"` // delay in seconds before returning (e.g., 1.5)
}

ImageDebugConfig configures the debug image provider (local random images)

type ImageFluxConfig added in v0.0.3

type ImageFluxConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"` // flux-2-pro for generation, flux-kontext-pro for editing
}

ImageFluxConfig configures Flux (Black Forest Labs) image generation

type ImageGeminiConfig added in v0.0.3

type ImageGeminiConfig struct {
	APIKey    string `mapstructure:"api_key"`
	Model     string `mapstructure:"model"`
	ImageSize string `mapstructure:"image_size"` // Default image size: 1K, 2K, 4K
}

ImageGeminiConfig configures Gemini image generation

type ImageOpenAIConfig added in v0.0.3

type ImageOpenAIConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"`
}

ImageOpenAIConfig configures OpenAI image generation

type ImageOpenRouterConfig added in v0.0.24

type ImageOpenRouterConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"` // e.g., google/gemini-2.5-flash-image
}

ImageOpenRouterConfig configures OpenRouter image generation

type ImageVeniceConfig added in v0.0.98

type ImageVeniceConfig struct {
	APIKey     string `mapstructure:"api_key"`
	Model      string `mapstructure:"model"`
	EditModel  string `mapstructure:"edit_model"`
	Resolution string `mapstructure:"resolution"`
}

ImageVeniceConfig configures Venice AI image generation

type ImageXAIConfig added in v0.0.31

type ImageXAIConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"` // grok-2-image or grok-2-image-1212
}

ImageXAIConfig configures xAI (Grok) image generation

type KeySpec added in v0.0.320

type KeySpec struct {
	Path          string
	Default       any
	HasDefault    bool
	Description   string
	Sensitive     bool
	ShowInConfig  bool
	ResetTemplate bool
	Placeholder   any
}

KeySpec describes a user-visible configuration key. New user-visible mapstructure fields should be added here so defaults, validation, completions, config show, and reset templates do not drift apart.

func ConfigKeySpecs added in v0.0.320

func ConfigKeySpecs() []KeySpec

ConfigKeySpecs returns the ordered canonical key schema.

type LoopConfig added in v0.0.339

type LoopConfig struct {
	ApprovalMode string `mapstructure:"approval_mode" yaml:"approval_mode,omitempty"`
}

type ModelHistoryEntry added in v0.0.161

type ModelHistoryEntry struct {
	Model  string    `json:"model"`
	UsedAt time.Time `json:"used_at"`
}

ModelHistoryEntry records a single model usage event.

func LoadModelHistory added in v0.0.161

func LoadModelHistory() ([]ModelHistoryEntry, error)

LoadModelHistory reads the model history file. Returns nil (no error) when the file doesn't exist yet.

type MusicConfig added in v0.0.203

type MusicConfig struct {
	Provider   string                `mapstructure:"provider"`   // default music provider: venice or elevenlabs
	OutputDir  string                `mapstructure:"output_dir"` // default save directory
	Venice     MusicVeniceConfig     `mapstructure:"venice"`
	ElevenLabs MusicElevenLabsConfig `mapstructure:"elevenlabs"`
}

MusicConfig configures music and sound-effect generation settings.

type MusicElevenLabsConfig added in v0.0.203

type MusicElevenLabsConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"`
	Format string `mapstructure:"format"`
}

MusicElevenLabsConfig configures ElevenLabs music generation.

type MusicVeniceConfig added in v0.0.203

type MusicVeniceConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"`
	Format string `mapstructure:"format"`
}

MusicVeniceConfig configures Venice music/audio generation.

type ProviderConfig added in v0.0.15

type ProviderConfig struct {
	// Type of provider - inferred from key name for built-ins, required for custom
	Type ProviderType `mapstructure:"type"`

	// Common fields
	APIKey       string                `mapstructure:"api_key"`
	Model        string                `mapstructure:"model"`
	FastModel    string                `mapstructure:"fast_model"`    // Lightweight model for control-plane tasks
	FastProvider string                `mapstructure:"fast_provider"` // Optional provider key override for FastModel
	ServiceTier  string                `mapstructure:"service_tier"`  // Optional model service tier (e.g. "fast"/"priority" for ChatGPT)
	Models       []string              `mapstructure:"models"`        // Available model names/aliases for autocomplete
	ModelConfigs []ProviderModelConfig `mapstructure:"-"`             // Metadata for object entries in models
	Reasoning    string                `mapstructure:"reasoning"`     // "auto"/empty, "enabled", or "disabled" for suffix-based reasoning efforts
	Credentials  string                `mapstructure:"credentials"`   // "api_key", "codex", "gemini-cli"
	Env          map[string]string     `mapstructure:"env"`           // Extra subprocess env vars for providers that shell out (e.g. claude-bin)
	EnableHooks  bool                  `mapstructure:"enable_hooks"`  // Opt in to Claude Code hooks for claude-bin (disabled by default)
	UseWebSocket bool                  `mapstructure:"use_websocket"` // Enable Responses-over-WebSocket for providers that support it
	Responses    ResponsesConfig       `mapstructure:"responses"`     // Advanced Responses API execution controls
	FileUpload   *FileUploadConfig     `mapstructure:"file_upload"`   // Optional upload/native-file support overrides
	VisionVia    string                `mapstructure:"vision_via"`    // Optional provider:model route for indirect image understanding

	// Search behavior - nil means auto (use native if available)
	UseNativeSearch *bool `mapstructure:"use_native_search"`

	// Model token limits (for custom/self-hosted models not in hardcoded tables)
	ContextWindow   int `mapstructure:"context_window"`
	MaxOutputTokens int `mapstructure:"max_output_tokens"`

	// OpenAI-compatible specific
	BaseURL           string `mapstructure:"base_url"`            // Base URL - /chat/completions is appended
	URL               string `mapstructure:"url"`                 // Full URL - used as-is without appending endpoint
	NoStreamOptions   bool   `mapstructure:"no_stream_options"`   // Don't send stream_options (for servers that reject it)
	VLLMThinkingParam string `mapstructure:"vllm_thinking_param"` // vLLM chat_template_kwargs key: "enable_thinking" (Qwen) or "thinking" (DeepSeek)
	ParseReasoning    *bool  `mapstructure:"parse_reasoning"`     // Send parse_reasoning for OpenAI-compatible reasoning parsers
	IncludeReasoning  *bool  `mapstructure:"include_reasoning"`   // Send include_reasoning when parse_reasoning is enabled
	ThinkingParam     string `mapstructure:"thinking_param"`      // chat_template_kwargs key to set true when reasoning effort is requested

	// OpenRouter specific
	AppURL   string `mapstructure:"app_url"`
	AppTitle string `mapstructure:"app_title"`

	// AWS Bedrock specific
	Region       string            `mapstructure:"region"`            // AWS region (defaults to AWS_REGION env var)
	Profile      string            `mapstructure:"profile"`           // AWS profile from ~/.aws/credentials
	AccessKey    string            `mapstructure:"access_key_id"`     // Explicit AWS access key ID
	SecretKey    string            `mapstructure:"secret_access_key"` // Explicit AWS secret access key
	SessionToken string            `mapstructure:"session_token"`     // Optional AWS session token (temporary creds)
	ModelMap     map[string]string `mapstructure:"model_map"`         // Friendly name -> Bedrock model ID/ARN

	// Ollama-native sampling options (type: ollama only)
	Think           *bool    `mapstructure:"think"`            // Enable extended thinking / reasoning
	TopK            *int     `mapstructure:"top_k"`            // Top-K sampling
	MinP            *float64 `mapstructure:"min_p"`            // Min-P sampling
	PresencePenalty *float64 `mapstructure:"presence_penalty"` // Presence penalty
	NumCtx          *int     `mapstructure:"num_ctx"`          // Context window size in tokens
	NumPredict      *int     `mapstructure:"num_predict"`      // Max tokens to generate (-1 = unlimited)

	// Runtime fields (populated after credential resolution)
	ResolvedAPIKey string                              `mapstructure:"-"`
	AccountID      string                              `mapstructure:"-"`
	OAuthCreds     *credentials.GeminiOAuthCredentials `mapstructure:"-"`
	ResolvedURL    string                              `mapstructure:"-"` // Resolved URL (after srv:// lookup)
	// contains filtered or unexported fields
}

ProviderConfig is a unified configuration for any provider

func (*ProviderConfig) ResolveForInference added in v0.0.15

func (cfg *ProviderConfig) ResolveForInference() error

ResolveForInference performs lazy resolution of expensive config values (op://, file://, srv://, $()). Call this before creating a provider for inference.

type ProviderFieldSpec added in v0.0.320

type ProviderFieldSpec struct {
	Path        string
	Description string
	Sensitive   bool
	Placeholder any
}

ProviderFieldSpec describes a field valid under providers.<name>.

func ProviderKeySpecs added in v0.0.320

func ProviderKeySpecs() []ProviderFieldSpec

ProviderKeySpecs returns valid provider field specs in display order.

type ProviderModelConfig added in v0.0.295

type ProviderModelConfig struct {
	ID               string   `mapstructure:"id" yaml:"id,omitempty"`
	Alias            string   `mapstructure:"alias" yaml:"alias,omitempty"`
	ContextWindow    int      `mapstructure:"context_window" yaml:"context_window,omitempty"`
	MaxOutputTokens  int      `mapstructure:"max_output_tokens" yaml:"max_output_tokens,omitempty"`
	ParseReasoning   *bool    `mapstructure:"parse_reasoning" yaml:"parse_reasoning,omitempty"`
	IncludeReasoning *bool    `mapstructure:"include_reasoning" yaml:"include_reasoning,omitempty"`
	ThinkingParam    string   `mapstructure:"thinking_param" yaml:"thinking_param,omitempty"`
	ReasoningEfforts []string `mapstructure:"reasoning_efforts" yaml:"reasoning_efforts,omitempty"`
	VisionVia        string   `mapstructure:"vision_via" yaml:"vision_via,omitempty"`
}

ProviderModelConfig describes a configured model entry. A model can be a simple string in YAML (stored in ProviderConfig.Models) or an object with metadata here. Alias is the friendly name exposed in pickers/completions; ID is the upstream model string sent to the provider.

func ModelConfigForProviderModel added in v0.0.312

func ModelConfigForProviderModel(cfg *Config, providerName, modelName string) (ProviderModelConfig, bool)

ModelConfigForProviderModel returns the configured metadata entry for a model, matching either its upstream id, alias/display name, or configured reasoning-effort variants.

func (ProviderModelConfig) DisplayName added in v0.0.295

func (m ProviderModelConfig) DisplayName() string

type ProviderSpec added in v0.0.320

type ProviderSpec struct {
	Name          string
	Type          ProviderType
	ConfigDefault bool
	ShowInConfig  bool
	ResetTemplate bool
	Defaults      []DefaultField
}

ProviderSpec describes a built-in provider's canonical runtime/config defaults. ConfigDefault controls whether the defaults are registered with Viper and written to generated config templates; runtime-only provider specs are still used by direct constructors and fast-model helpers.

func DefaultProviderSpecs added in v0.0.320

func DefaultProviderSpecs() []ProviderSpec

DefaultProviderSpecs returns canonical built-in provider defaults.

type ProviderType added in v0.0.15

type ProviderType string

ProviderType defines the supported provider implementations

const (
	ProviderTypeAnthropic    ProviderType = "anthropic"
	ProviderTypeOpenAI       ProviderType = "openai"
	ProviderTypeChatGPT      ProviderType = "chatgpt"
	ProviderTypeCopilot      ProviderType = "copilot"
	ProviderTypeGemini       ProviderType = "gemini"
	ProviderTypeGeminiCLI    ProviderType = "gemini-cli"
	ProviderTypeOpenRouter   ProviderType = "openrouter"
	ProviderTypeZen          ProviderType = "zen"
	ProviderTypeClaudeBin    ProviderType = "claude-bin"
	ProviderTypeGrokBin      ProviderType = "grok-bin"
	ProviderTypeOpenAICompat ProviderType = "openai_compatible"
	ProviderTypeVLLM         ProviderType = "vllm"
	ProviderTypeXAI          ProviderType = "xai"
	ProviderTypeVenice       ProviderType = "venice"
	ProviderTypeNearAI       ProviderType = "nearai"
	ProviderTypeSambaNova    ProviderType = "sambanova"
	ProviderTypeBedrock      ProviderType = "bedrock"
	ProviderTypeOllama       ProviderType = "ollama"
)

func InferProviderType added in v0.0.15

func InferProviderType(name string, explicit ProviderType) ProviderType

InferProviderType returns the provider type for a given provider name Explicit type takes precedence, then built-in names, then defaults to openai_compatible

type ReasoningConfig added in v0.0.258

type ReasoningConfig struct {
	Display          string                 `mapstructure:"display" yaml:"display,omitempty"`
	Source           string                 `mapstructure:"source" yaml:"source,omitempty"`
	Status           string                 `mapstructure:"status" yaml:"status,omitempty"`
	History          string                 `mapstructure:"history" yaml:"history,omitempty"`
	Export           string                 `mapstructure:"export" yaml:"export,omitempty"`
	Raw              bool                   `mapstructure:"raw" yaml:"raw,omitempty"`
	MaxSummaryChars  int                    `mapstructure:"max_summary_chars" yaml:"max_summary_chars,omitempty"`
	MaxRawChars      int                    `mapstructure:"max_raw_chars" yaml:"max_raw_chars,omitempty"`
	ExtractTitles    bool                   `mapstructure:"extract_titles" yaml:"extract_titles,omitempty"`
	HiddenLabel      string                 `mapstructure:"hidden_label" yaml:"hidden_label,omitempty"`
	PersistSummaries bool                   `mapstructure:"persist_summaries" yaml:"persist_summaries,omitempty"`
	Chat             ReasoningSurfaceConfig `mapstructure:"chat" yaml:"chat,omitempty"`
	Ask              ReasoningSurfaceConfig `mapstructure:"ask" yaml:"ask,omitempty"`
	Serve            ReasoningSurfaceConfig `mapstructure:"serve" yaml:"serve,omitempty"`
	Jobs             ReasoningSurfaceConfig `mapstructure:"jobs" yaml:"jobs,omitempty"`

	// Presence markers let programmatic configs explicitly set false for boolean
	// options while still allowing partial configs to inherit defaults. Viper
	// populates these from InConfig; direct callers can set them when they need a
	// false override.
	RawSet              bool `mapstructure:"-" yaml:"-"`
	ExtractTitlesSet    bool `mapstructure:"-" yaml:"-"`
	PersistSummariesSet bool `mapstructure:"-" yaml:"-"`
}

ReasoningConfig controls display/export of provider reasoning summaries and raw thinking. It is intentionally separate from provider reasoning effort.

func DefaultReasoningConfig added in v0.0.258

func DefaultReasoningConfig() ReasoningConfig

DefaultReasoningConfig returns the safe, useful default reasoning display policy.

type ReasoningSurfaceConfig added in v0.0.258

type ReasoningSurfaceConfig struct {
	Display string `mapstructure:"display" yaml:"display,omitempty"`
	Status  string `mapstructure:"status" yaml:"status,omitempty"`
	History string `mapstructure:"history" yaml:"history,omitempty"`
	Export  string `mapstructure:"export" yaml:"export,omitempty"`
	Raw     *bool  `mapstructure:"raw" yaml:"raw,omitempty"`
}

ReasoningSurfaceConfig holds optional per-surface overrides for reasoning UI.

type ResponsesConfig added in v0.0.321

type ResponsesConfig struct {
	ReasoningMode           string                           `mapstructure:"reasoning_mode" yaml:"reasoning_mode,omitempty"`
	ReasoningContext        string                           `mapstructure:"reasoning_context" yaml:"reasoning_context,omitempty"`
	MultiAgent              ResponsesMultiAgentConfig        `mapstructure:"multi_agent" yaml:"multi_agent,omitempty"`
	ProgrammaticToolCalling ResponsesProgrammaticToolsConfig `mapstructure:"programmatic_tool_calling" yaml:"programmatic_tool_calling,omitempty"`
	PromptCache             ResponsesPromptCacheConfig       `mapstructure:"prompt_cache" yaml:"prompt_cache,omitempty"`
}

ResponsesConfig controls advanced OpenAI Responses API execution features. It is separate from ReasoningConfig, which only governs display/export.

type ResponsesMultiAgentConfig added in v0.0.321

type ResponsesMultiAgentConfig struct {
	Enabled                bool `mapstructure:"enabled" yaml:"enabled,omitempty"`
	MaxConcurrentSubagents int  `mapstructure:"max_concurrent_subagents" yaml:"max_concurrent_subagents,omitempty"`
}

type ResponsesProgrammaticToolsConfig added in v0.0.321

type ResponsesProgrammaticToolsConfig struct {
	Enabled bool     `mapstructure:"enabled" yaml:"enabled,omitempty"`
	Tools   []string `mapstructure:"tools" yaml:"tools,omitempty"`
}

type ResponsesPromptCacheConfig added in v0.0.321

type ResponsesPromptCacheConfig struct {
	Mode string `mapstructure:"mode" yaml:"mode,omitempty"`
	TTL  string `mapstructure:"ttl" yaml:"ttl,omitempty"`
}

type SearchBraveConfig added in v0.0.22

type SearchBraveConfig struct {
	APIKey string `mapstructure:"api_key"`
}

SearchBraveConfig configures Brave search

type SearchConfig added in v0.0.22

type SearchConfig struct {
	Provider      string                 `mapstructure:"provider"`       // exa_mcp (default), exa, perplexity, tavily, brave, google, duckduckgo
	FetchProvider string                 `mapstructure:"fetch_provider"` // jina (default), exa_mcp, none
	ForceExternal bool                   `mapstructure:"force_external"` // force external search for all providers
	Exa           SearchExaConfig        `mapstructure:"exa"`
	ExaMCP        SearchExaMCPConfig     `mapstructure:"exa_mcp"`
	Perplexity    SearchPerplexityConfig `mapstructure:"perplexity"`
	Tavily        SearchTavilyConfig     `mapstructure:"tavily"`
	Brave         SearchBraveConfig      `mapstructure:"brave"`
	Google        SearchGoogleConfig     `mapstructure:"google"`
}

SearchConfig configures web search providers

type SearchExaConfig added in v0.0.22

type SearchExaConfig struct {
	APIKey string `mapstructure:"api_key"`
}

SearchExaConfig configures Exa search

type SearchExaMCPConfig added in v0.0.247

type SearchExaMCPConfig struct {
	URL    string `mapstructure:"url"`
	APIKey string `mapstructure:"api_key"`
}

SearchExaMCPConfig configures Exa MCP search/fetch

type SearchGoogleConfig added in v0.0.22

type SearchGoogleConfig struct {
	APIKey string `mapstructure:"api_key"`
	CX     string `mapstructure:"cx"` // Custom Search Engine ID
}

SearchGoogleConfig configures Google Custom Search

type SearchPerplexityConfig added in v0.0.117

type SearchPerplexityConfig struct {
	APIKey string `mapstructure:"api_key"`
}

SearchPerplexityConfig configures Perplexity search

type SearchTavilyConfig added in v0.0.117

type SearchTavilyConfig struct {
	APIKey string `mapstructure:"api_key"`
}

SearchTavilyConfig configures Tavily search

type ServeConfig added in v0.0.83

type ServeConfig struct {
	Platforms              []string            `mapstructure:"platforms" yaml:"platforms,omitempty"`
	ApprovalMode           string              `mapstructure:"approval_mode" yaml:"approval_mode,omitempty"`
	BasePath               string              `mapstructure:"base_path" yaml:"base_path,omitempty"`
	Title                  string              `mapstructure:"title" yaml:"title,omitempty"`
	DisableLocationSharing bool                `mapstructure:"disable_location_sharing" yaml:"disable_location_sharing,omitempty"`
	FilesDir               string              `mapstructure:"files_dir" yaml:"files_dir,omitempty"`
	WidgetsDir             string              `mapstructure:"widgets_dir" yaml:"widgets_dir,omitempty"`
	ResponseTimeout        string              `mapstructure:"response_timeout" yaml:"response_timeout,omitempty"` // Go duration string, e.g. "30m" or "1h"
	Telegram               TelegramServeConfig `mapstructure:"telegram" yaml:"telegram,omitempty"`
	WebPush                WebPushConfig       `mapstructure:"web_push" yaml:"web_push,omitempty"`
	MCP                    ServeMCPConfig      `mapstructure:"mcp" yaml:"mcp,omitempty"`
}

ServeConfig holds configuration for the serve command platforms.

type ServeMCPConfig added in v0.0.339

type ServeMCPConfig struct {
	ApprovalMode string `mapstructure:"approval_mode" yaml:"approval_mode,omitempty"`
}

ServeMCPConfig configures the standalone term-llm serve mcp surface.

type SessionsConfig added in v0.0.39

type SessionsConfig struct {
	Enabled          bool   `mapstructure:"enabled"`            // Master switch - set to false to disable all session storage
	MaxAgeDays       int    `mapstructure:"max_age_days"`       // Auto-delete sessions older than N days (0=never)
	MaxCount         int    `mapstructure:"max_count"`          // Keep at most N sessions, delete oldest (0=unlimited)
	Path             string `mapstructure:"path"`               // Optional SQLite DB path override (supports :memory:)
	StripImageBase64 bool   `mapstructure:"strip_image_base64"` // Store path/metadata only for images with ImagePath (smaller DB, less portable)
}

SessionsConfig configures session storage

type SkillsConfig added in v0.0.37

type SkillsConfig struct {
	Enabled              bool `mapstructure:"enabled"`                // Enable the skills system
	AutoInvoke           bool `mapstructure:"auto_invoke"`            // Allow model-driven activation
	MetadataBudgetTokens int  `mapstructure:"metadata_budget_tokens"` // Max tokens for skill metadata
	MaxVisibleSkills     int  `mapstructure:"max_visible_skills"`     // Max skills shown in system prompt

	IncludeProjectSkills  bool `mapstructure:"include_project_skills"`  // Discover from project-local paths
	IncludeEcosystemPaths bool `mapstructure:"include_ecosystem_paths"` // Include ~/.agents/skills, ~/.codex/skills, ~/.claude/skills, ~/.gemini/skills, etc.

	AlwaysEnabled []string `mapstructure:"always_enabled"` // Always include in metadata
	NeverAuto     []string `mapstructure:"never_auto"`     // Must be explicit activation
}

SkillsConfig configures the Agent Skills system

type TelegramServeConfig added in v0.0.83

type TelegramServeConfig struct {
	Token            string   `mapstructure:"token" yaml:"token,omitempty"`
	AllowedUserIDs   []int64  `mapstructure:"allowed_user_ids" yaml:"allowed_user_ids,omitempty"`
	AllowedUsernames []string `mapstructure:"allowed_usernames" yaml:"allowed_usernames,omitempty"`
	IdleTimeout      int      `mapstructure:"idle_timeout" yaml:"idle_timeout,omitempty"`           // minutes
	InterruptTimeout int      `mapstructure:"interrupt_timeout" yaml:"interrupt_timeout,omitempty"` // seconds, 0 = default (3)
}

TelegramServeConfig holds configuration for the Telegram bot platform.

type ThemeConfig

type ThemeConfig struct {
	Primary          string `mapstructure:"primary"`           // main accent (commands, highlights)
	Secondary        string `mapstructure:"secondary"`         // secondary accent (headers, borders)
	Success          string `mapstructure:"success"`           // success states
	Error            string `mapstructure:"error"`             // error states
	Warning          string `mapstructure:"warning"`           // warnings
	Muted            string `mapstructure:"muted"`             // dimmed text
	Text             string `mapstructure:"text"`              // primary text
	Spinner          string `mapstructure:"spinner"`           // loading spinner
	ReasoningSummary string `mapstructure:"reasoning_summary"` // reasoning summary body
	ReasoningHeader  string `mapstructure:"reasoning_header"`  // reasoning header lines
	ReasoningRaw     string `mapstructure:"reasoning_raw"`     // raw reasoning body
}

ThemeConfig allows customization of UI colors Colors can be ANSI color numbers (0-255) or hex codes (#RRGGBB)

type ToolsConfig added in v0.0.25

type ToolsConfig struct {
	Enabled            []string `mapstructure:"enabled"`               // Enabled tool names (CLI names)
	ReadDirs           []string `mapstructure:"read_dirs"`             // Directories for read operations
	WriteDirs          []string `mapstructure:"write_dirs"`            // Directories for write operations
	ShellAllow         []string `mapstructure:"shell_allow"`           // Shell command patterns
	ShellAutoRun       bool     `mapstructure:"shell_auto_run"`        // Auto-approve matching shell
	ShellAutoRunEnv    string   `mapstructure:"shell_auto_run_env"`    // Env var required for auto-run
	ShellNonTTYEnv     string   `mapstructure:"shell_non_tty_env"`     // Env var for non-TTY execution
	ImageProvider      string   `mapstructure:"image_provider"`        // Override for image provider
	MaxToolOutputChars int      `mapstructure:"max_tool_output_chars"` // Global max chars per tool output (default 20000)
}

ToolsConfig configures the local tool system

type TranscriptionConfig added in v0.0.97

type TranscriptionConfig struct {
	Provider   string                        `mapstructure:"provider"`   // named provider from providers map; default "openai"
	Model      string                        `mapstructure:"model"`      // optional model override
	SaveDir    string                        `mapstructure:"save_dir"`   // if set, persist each uploaded audio file here
	Timestamps bool                          `mapstructure:"timestamps"` // Request timestamp metadata where supported
	Venice     TranscriptionVeniceConfig     `mapstructure:"venice"`
	ElevenLabs TranscriptionElevenLabsConfig `mapstructure:"elevenlabs"`
}

TranscriptionConfig configures audio transcription settings.

type TranscriptionElevenLabsConfig added in v0.0.203

type TranscriptionElevenLabsConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"`
}

TranscriptionElevenLabsConfig configures ElevenLabs speech-to-text.

type TranscriptionVeniceConfig added in v0.0.203

type TranscriptionVeniceConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"`
}

TranscriptionVeniceConfig configures Venice speech-to-text.

type WebPushConfig added in v0.0.114

type WebPushConfig struct {
	VAPIDPublicKey  string `mapstructure:"vapid_public_key" yaml:"vapid_public_key,omitempty"`
	VAPIDPrivateKey string `mapstructure:"vapid_private_key" yaml:"vapid_private_key,omitempty"`
	Subject         string `mapstructure:"subject" yaml:"subject,omitempty"` // mailto: or URL
}

WebPushConfig holds VAPID keys for Web Push notifications.

Jump to

Keyboard shortcuts

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