Documentation
¶
Index ¶
- Constants
- func BuildSystemPrompt(basePrompt, workingDir string, toolNames []string, gitStatus string, ...) string
- func ConfigDir() string
- func ConfigPath() string
- func ExpandEnv(s string) string
- func ExpandEnvRecursive(m map[string]interface{}) map[string]interface{}
- func HomeDir() string
- type Config
- func (c *Config) ActiveEndpointConfig() *EndpointConfig
- func (c *Config) EndpointNames(vendor string) []string
- func (c *Config) ExpandAllowedDirs(baseDir string) []string
- func (c *Config) RemoveMCPServer(name string) bool
- func (c *Config) ResolveActiveEndpoint() (*ResolvedEndpoint, error)
- func (c *Config) ResolveEndpoint(vendor, endpoint string) (*ResolvedEndpoint, error)
- func (c *Config) Save() error
- func (c *Config) SaveLanguagePreference(lang string) error
- func (c *Config) SetActiveSelection(vendor, endpoint, model string) error
- func (c *Config) SetEndpointAPIKey(vendor, endpoint, apiKey string, vendorScoped bool) error
- func (c *Config) SetEndpointModels(vendor, endpoint string, models []string) error
- func (c *Config) UpsertMCPServer(server MCPServerConfig) (replaced bool)
- func (c *Config) Validate() error
- func (c *Config) VendorNames() []string
- type EndpointConfig
- type MCPServerConfig
- type PluginCommandConfig
- type PluginConfigEntry
- type ResolvedEndpoint
- type SubAgentConfig
- type ToolPermission
- type VendorConfig
Constants ¶
const DefaultSystemPrompt = `` /* 1386-byte string literal not displayed */
DefaultSystemPrompt is the built-in system prompt used when no custom system_prompt is set.
Variables ¶
This section is empty.
Functions ¶
func BuildSystemPrompt ¶
func BuildSystemPrompt(basePrompt, workingDir string, toolNames []string, gitStatus string, customCmds []string) string
BuildSystemPrompt enhances the base system prompt with runtime context.
func ExpandEnv ¶
ExpandEnv replaces ${VAR} patterns in a string with environment variable values. If the variable is not set, the pattern is left unchanged.
func ExpandEnvRecursive ¶
ExpandEnvRecursive expands ${VAR} in all string values of a map recursively.
Types ¶
type Config ¶
type Config struct {
Vendor string `yaml:"vendor"`
Endpoint string `yaml:"endpoint"`
Model string `yaml:"model"`
Language string `yaml:"language"`
SystemPrompt string `yaml:"system_prompt"`
Vendors map[string]VendorConfig `yaml:"vendors"`
AllowedDirs []string `yaml:"allowed_dirs"`
MaxIterations int `yaml:"max_iterations"`
ToolPerms map[string]ToolPermission `yaml:"tool_permissions"`
Plugins []PluginConfigEntry `yaml:"plugins"`
MCPServers []MCPServerConfig `yaml:"mcp_servers"`
Hooks hooks.HookConfig `yaml:"hooks"`
DefaultMode string `yaml:"default_mode"`
SubAgents SubAgentConfig `yaml:"subagents"`
FilePath string `yaml:"-"`
FirstRun bool `yaml:"-"`
}
Config is the top-level configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a config with sensible defaults.
func (*Config) ActiveEndpointConfig ¶
func (c *Config) ActiveEndpointConfig() *EndpointConfig
ActiveEndpointConfig returns a copy of the active endpoint config.
func (*Config) EndpointNames ¶
EndpointNames returns configured endpoints for the given vendor in a stable order.
func (*Config) ExpandAllowedDirs ¶
ExpandAllowedDirs resolves allowed_dirs entries relative to baseDir.
func (*Config) RemoveMCPServer ¶
func (*Config) ResolveActiveEndpoint ¶
func (c *Config) ResolveActiveEndpoint() (*ResolvedEndpoint, error)
ResolveActiveEndpoint resolves the selected vendor + endpoint into runtime settings.
func (*Config) ResolveEndpoint ¶ added in v1.0.12
func (c *Config) ResolveEndpoint(vendor, endpoint string) (*ResolvedEndpoint, error)
ResolveEndpoint resolves the given vendor + endpoint into runtime settings.
func (*Config) SaveLanguagePreference ¶
func (*Config) SetActiveSelection ¶
SetActiveSelection updates the current vendor, endpoint, and model.
func (*Config) SetEndpointAPIKey ¶
SetEndpointAPIKey updates the active endpoint or vendor-level API key.
func (*Config) SetEndpointModels ¶ added in v1.0.12
SetEndpointModels replaces the known models for a configured endpoint while preserving active selections.
func (*Config) UpsertMCPServer ¶
func (c *Config) UpsertMCPServer(server MCPServerConfig) (replaced bool)
func (*Config) Validate ¶
Validate checks for invalid core configuration values that should fail fast.
func (*Config) VendorNames ¶
VendorNames returns configured vendors in a stable order.
type EndpointConfig ¶
type EndpointConfig struct {
DisplayName string `yaml:"display_name"`
Protocol string `yaml:"protocol"`
BaseURL string `yaml:"base_url"`
APIKey string `yaml:"api_key,omitempty"`
ContextWindow int `yaml:"context_window,omitempty"`
MaxTokens int `yaml:"max_tokens"`
DefaultModel string `yaml:"default_model,omitempty"`
SelectedModel string `yaml:"selected_model,omitempty"`
Models []string `yaml:"models,omitempty"`
Tags []string `yaml:"tags,omitempty"`
}
EndpointConfig describes a concrete vendor endpoint that maps to one protocol.
type MCPServerConfig ¶
type MCPServerConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type,omitempty"`
Command string `yaml:"command,omitempty"`
Args []string `yaml:"args,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
URL string `yaml:"url,omitempty"`
Headers map[string]string `yaml:"headers,omitempty"`
Source string `yaml:"-"`
OriginPath string `yaml:"-"`
Migrated bool `yaml:"-"`
}
MCPServerConfig defines an MCP server to connect to.
type PluginCommandConfig ¶
type PluginCommandConfig struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Execute string `yaml:"execute"`
Args []string `yaml:"args"`
}
PluginCommandConfig describes a single command tool within a plugin.
type PluginConfigEntry ¶
type PluginConfigEntry struct {
Name string `yaml:"name"`
Path string `yaml:"path"`
Type string `yaml:"type"`
Commands []PluginCommandConfig `yaml:"commands"`
Extra map[string]interface{} `yaml:",inline"`
}
PluginConfigEntry describes a single plugin from the config file.
type ResolvedEndpoint ¶
type ResolvedEndpoint struct {
VendorID string
VendorName string
EndpointID string
EndpointName string
Protocol string
BaseURL string
APIKey string
Model string
ContextWindow int
MaxTokens int
Models []string
Tags []string
}
ResolvedEndpoint is the runtime selection after config inheritance is applied.
type SubAgentConfig ¶
type SubAgentConfig struct {
MaxConcurrent int `yaml:"max_concurrent"`
Timeout time.Duration `yaml:"timeout"`
ShowOutput bool `yaml:"show_output"`
}
SubAgentConfig holds sub-agent configuration.
type ToolPermission ¶
type ToolPermission string
ToolPermission defines per-tool permission level in config.
const ( ToolPermAsk ToolPermission = "ask" ToolPermAllow ToolPermission = "allow" ToolPermDeny ToolPermission = "deny" )
type VendorConfig ¶
type VendorConfig struct {
DisplayName string `yaml:"display_name"`
APIKey string `yaml:"api_key,omitempty"`
Endpoints map[string]EndpointConfig `yaml:"endpoints"`
}
VendorConfig holds a real supplier plus its available endpoints.