Documentation
¶
Overview ¶
Package config manages application configuration from various sources.
Index ¶
- Constants
- func ConfigFileFormat() string
- func DeleteLSP(language string) error
- func DeleteMCPServer(name string) error
- func DetectPreferredProjectContextPath(workDir string) (string, bool)
- func IsPrioritizedProjectContextPath(path string) bool
- func LoadGitHubToken() (string, error)
- func MarkProjectInitialized() error
- func OverrideAgentModel(agentName AgentName, modelID models.ModelID) error
- func Reload() error
- func ResolveConfigFilePath() (string, error)
- func ResolveProjectInitializationContextPath(workDir string) string
- func ShouldShowInitDialog() (bool, error)
- func UpdateAgentModel(agentName AgentName, modelID models.ModelID) error
- func UpdateAutoCompact(enabled bool) error
- func UpdateDebug(enabled bool) error
- func UpdateLSP(language string, lsp LSPConfig) error
- func UpdateMCPServer(name string, server MCPServer) error
- func UpdateMesnada(mesnadaCfg MesnadaConfig) error
- func UpdateProvider(name models.ModelProvider, apiKey string, baseURL string, disabled bool) error
- func UpdateRemembrances(remembrancesCfg RemembrancesConfig) error
- func UpdateShell(path string, args []string) error
- func UpdateSkillsEnabled(enabled bool) error
- func UpdateTheme(themeName string) error
- func Validate() error
- func WorkingDirectory() string
- type APIServerConfig
- type Agent
- type AgentName
- type Config
- type Data
- type InternalToolsConfig
- type LSPConfig
- type LuaConfig
- type MCPGatewayConfig
- type MCPServer
- type MCPType
- type MesnadaACPConfig
- type MesnadaACPServerConfig
- type MesnadaConfig
- type MesnadaOrchestratorConfig
- type MesnadaServerConfig
- type MesnadaTUIConfig
- type ProjectInitFlag
- type Provider
- type RemembrancesConfig
- type ShellConfig
- type SkillsConfig
- type TUIConfig
Constants ¶
const (
// InitFlagFilename is the name of the file that indicates whether the project has been initialized
InitFlagFilename = "init"
)
const (
MaxTokensFallbackDefault = 4096
)
Application constants
Variables ¶
This section is empty.
Functions ¶
func ConfigFileFormat ¶ added in v0.2.0
func ConfigFileFormat() string
ConfigFileFormat returns the format ("json" or "toml") of the active config file.
func DeleteMCPServer ¶
func DetectPreferredProjectContextPath ¶ added in v0.9.0
DetectPreferredProjectContextPath returns the highest-priority project context file that already exists in the working directory.
func IsPrioritizedProjectContextPath ¶ added in v0.9.0
IsPrioritizedProjectContextPath reports whether the path belongs to the exclusive project context file family where only one file should be used.
func LoadGitHubToken ¶
LoadGitHubToken loads a GitHub OAuth token from the saved Copilot login, environment variables, or compatible external tooling.
func MarkProjectInitialized ¶
func MarkProjectInitialized() error
MarkProjectInitialized marks the current project as initialized
func OverrideAgentModel ¶ added in v0.9.0
OverrideAgentModel updates the selected agent model only for the current process. The change is kept in memory and is not persisted to the config file.
func Reload ¶ added in v0.2.0
func Reload() error
Reload re-reads the config file and updates the global config. It resets the global config and reloads from disk.
func ResolveConfigFilePath ¶ added in v0.2.0
ResolveConfigFilePath finds the active config file path.
func ResolveProjectInitializationContextPath ¶ added in v0.9.0
ResolveProjectInitializationContextPath returns the preferred existing project context file, or the default file to create if none exists yet.
func ShouldShowInitDialog ¶
ShouldShowInitDialog checks if the initialization dialog should be shown for the current directory
func UpdateAutoCompact ¶
func UpdateDebug ¶
func UpdateMCPServer ¶
func UpdateMesnada ¶
func UpdateMesnada(mesnadaCfg MesnadaConfig) error
func UpdateProvider ¶
func UpdateRemembrances ¶ added in v0.7.0
func UpdateRemembrances(remembrancesCfg RemembrancesConfig) error
UpdateRemembrances updates remembrances configuration and persists it to the config file.
func UpdateShell ¶
func UpdateSkillsEnabled ¶
func UpdateTheme ¶
UpdateTheme updates the theme in the configuration and writes it to the config file.
func Validate ¶
func Validate() error
Validate checks if the configuration is valid and applies defaults where needed.
func WorkingDirectory ¶
func WorkingDirectory() string
WorkingDirectory returns the current working directory from the configuration.
Types ¶
type APIServerConfig ¶ added in v0.7.0
type APIServerConfig struct {
Enabled bool `json:"enabled,omitempty"`
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
RequireAuth bool `json:"requireAuth,omitempty"`
}
APIServerConfig holds configuration for the HTTP API server (WebUI backend).
type Agent ¶
type Agent struct {
Model models.ModelID `json:"model"`
MaxTokens int64 `json:"maxTokens"`
ReasoningEffort string `json:"reasoningEffort"` // For openai models low,medium,heigh
AutoCompact bool `json:"autoCompact,omitempty"` // enable auto-compaction when context fills up
AutoCompactThreshold float64 `json:"autoCompactThreshold,omitempty"` // 0.0-1.0, default 0.85
}
Agent defines configuration for different LLM models and their token limits.
type Config ¶
type Config struct {
Data Data `json:"data"`
WorkingDir string `json:"wd,omitempty"`
MCPServers map[string]MCPServer `json:"mcpServers,omitempty"`
Providers map[models.ModelProvider]Provider `json:"providers,omitempty"`
LSP map[string]LSPConfig `json:"lsp,omitempty"`
Agents map[AgentName]Agent `json:"agents,omitempty"`
Debug bool `json:"debug,omitempty"`
LogFile string `json:"logFile,omitempty"`
DebugLSP bool `json:"debugLSP,omitempty"`
ContextPaths []string `json:"contextPaths,omitempty"`
Skills SkillsConfig `json:"skills,omitempty"`
TUI TUIConfig `json:"tui"`
Mesnada MesnadaConfig `json:"mesnada,omitempty"`
Shell ShellConfig `json:"shell,omitempty"`
AutoCompact bool `json:"autoCompact,omitempty"`
Remembrances RemembrancesConfig `json:"remembrances,omitempty"`
Server APIServerConfig `json:"server,omitempty"`
Lua LuaConfig `json:"lua,omitempty"`
MCPGateway MCPGatewayConfig `json:"mcpGateway,omitempty"`
InternalTools InternalToolsConfig `json:"internalTools,omitempty"`
}
Config is the main configuration structure for the application.
func Get ¶
func Get() *Config
Get returns the current configuration. It's safe to call this function multiple times.
type Data ¶
type Data struct {
Directory string `json:"directory,omitempty"`
}
Data defines storage configuration.
type InternalToolsConfig ¶ added in v0.20.0
type InternalToolsConfig struct {
// Fetch tool
FetchEnabled bool `json:"fetchEnabled,omitempty"`
FetchMaxSizeMB int `json:"fetchMaxSizeMB,omitempty"`
// Google Custom Search
GoogleSearchEnabled bool `json:"googleSearchEnabled,omitempty"`
GoogleAPIKey string `json:"googleApiKey,omitempty"`
GoogleSearchEngineID string `json:"googleSearchEngineId,omitempty"`
// Brave Search
BraveSearchEnabled bool `json:"braveSearchEnabled,omitempty"`
BraveAPIKey string `json:"braveApiKey,omitempty"`
// Perplexity AI Search
PerplexitySearchEnabled bool `json:"perplexitySearchEnabled,omitempty"`
PerplexityAPIKey string `json:"perplexityApiKey,omitempty"`
// Context7 library docs (no API key required)
Context7Enabled bool `json:"context7Enabled,omitempty"`
}
InternalToolsConfig defines configuration for Pando's built-in tool integrations.
type LSPConfig ¶
type LSPConfig struct {
Disabled bool `json:"enabled"`
Command string `json:"command"`
Args []string `json:"args"`
Options any `json:"options"`
}
LSPConfig defines configuration for Language Server Protocol integration.
type LuaConfig ¶ added in v0.8.0
type LuaConfig struct {
Enabled bool `json:"enabled,omitempty" toml:"Enabled"`
ScriptPath string `json:"script_path,omitempty" toml:"ScriptPath"`
Timeout string `json:"timeout,omitempty" toml:"Timeout"` // e.g. "5s"
StrictMode bool `json:"strict_mode,omitempty" toml:"StrictMode"`
HotReload bool `json:"hot_reload,omitempty" toml:"HotReload"`
LogFilteredData bool `json:"log_filtered_data,omitempty" toml:"LogFilteredData"`
}
LuaConfig defines configuration for the Lua scripting engine.
type MCPGatewayConfig ¶ added in v0.8.0
type MCPGatewayConfig struct {
Enabled bool `json:"enabled,omitempty" toml:"Enabled"`
FavoriteThreshold int `json:"favorite_threshold,omitempty" toml:"FavoriteThreshold"`
MaxFavorites int `json:"max_favorites,omitempty" toml:"MaxFavorites"`
FavoriteWindowDays int `json:"favorite_window_days,omitempty" toml:"FavoriteWindowDays"`
DecayDays int `json:"decay_days,omitempty" toml:"DecayDays"`
}
MCPGatewayConfig defines configuration for the MCP gateway subsystem.
type MCPServer ¶
type MCPServer struct {
Command string `json:"command"`
Env []string `json:"env"`
Args []string `json:"args"`
Type MCPType `json:"type"`
URL string `json:"url"`
Headers map[string]string `json:"headers"`
}
MCPServer defines the configuration for a Model Control Protocol server.
type MesnadaACPConfig ¶
type MesnadaACPConfig struct {
Enabled bool `json:"enabled,omitempty"`
DefaultAgent string `json:"defaultAgent,omitempty"`
AutoPermission bool `json:"autoPermission,omitempty"`
Server MesnadaACPServerConfig `json:"server,omitempty"`
}
MesnadaACPConfig holds ACP agent configuration
type MesnadaACPServerConfig ¶ added in v0.7.0
type MesnadaACPServerConfig struct {
Enabled bool `json:"enabled,omitempty"`
Transports []string `json:"transports,omitempty"` // ["stdio", "http"]
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
MaxSessions int `json:"maxSessions,omitempty"`
SessionTimeout string `json:"sessionTimeout,omitempty"`
RequireAuth bool `json:"requireAuth,omitempty"`
}
MesnadaACPServerConfig holds configuration for the ACP server.
type MesnadaConfig ¶
type MesnadaConfig struct {
Enabled bool `json:"enabled,omitempty"`
Server MesnadaServerConfig `json:"server,omitempty"`
Orchestrator MesnadaOrchestratorConfig `json:"orchestrator,omitempty"`
ACP MesnadaACPConfig `json:"acp,omitempty"`
TUI MesnadaTUIConfig `json:"tui,omitempty"`
}
MesnadaConfig holds all mesnada integration configuration
type MesnadaOrchestratorConfig ¶
type MesnadaOrchestratorConfig struct {
StorePath string `json:"storePath,omitempty"`
LogDir string `json:"logDir,omitempty"`
MaxParallel int `json:"maxParallel,omitempty"`
DefaultEngine string `json:"defaultEngine,omitempty"`
DefaultModel string `json:"defaultModel,omitempty"`
DefaultMCPConfig string `json:"defaultMcpConfig,omitempty"`
PersonaPath string `json:"personaPath,omitempty"`
}
MesnadaOrchestratorConfig holds orchestrator settings
type MesnadaServerConfig ¶
type MesnadaServerConfig struct {
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
}
MesnadaServerConfig holds mesnada HTTP server configuration
type MesnadaTUIConfig ¶
type MesnadaTUIConfig struct {
Enabled bool `json:"enabled,omitempty"`
WebUI bool `json:"webui,omitempty"`
}
MesnadaTUIConfig holds mesnada TUI settings
type ProjectInitFlag ¶
type ProjectInitFlag struct {
Initialized bool `json:"initialized"`
}
ProjectInitFlag represents the initialization status for a project directory
type Provider ¶
type Provider struct {
APIKey string `json:"apiKey"`
BaseURL string `json:"baseURL,omitempty"`
Disabled bool `json:"disabled"`
// UseOAuth enables OAuth mode for the anthropic provider (claude.ai OAuth instead of API key).
UseOAuth bool `json:"useOAuth,omitempty"`
}
Provider defines configuration for an LLM provider.
type RemembrancesConfig ¶ added in v0.7.0
type RemembrancesConfig struct {
Enabled bool `json:"enabled" toml:"Enabled"`
DocumentEmbeddingProvider string `json:"document_embedding_provider" toml:"DocumentEmbeddingProvider"`
DocumentEmbeddingModel string `json:"document_embedding_model" toml:"DocumentEmbeddingModel"`
CodeEmbeddingProvider string `json:"code_embedding_provider" toml:"CodeEmbeddingProvider"`
CodeEmbeddingModel string `json:"code_embedding_model" toml:"CodeEmbeddingModel"`
UseSameModel bool `json:"use_same_model" toml:"UseSameModel"`
ChunkSize int `json:"chunk_size" toml:"ChunkSize"`
ChunkOverlap int `json:"chunk_overlap" toml:"ChunkOverlap"`
}
RemembrancesConfig defines configuration for the remembrances system.
type ShellConfig ¶
type ShellConfig struct {
Path string `json:"path,omitempty"`
Args []string `json:"args,omitempty"`
}
ShellConfig defines the configuration for the shell used by the bash tool.
type SkillsConfig ¶
type SkillsConfig struct {
Enabled bool `json:"enabled,omitempty"`
Paths []string `json:"paths,omitempty"`
}
SkillsConfig defines configuration for skill discovery and prompt injection.