config

package
v0.267.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package config manages application configuration from various sources.

Index

Constants

View Source
const DefaultConfigTemplate = `` /* 9423-byte string literal not displayed */

DefaultConfigTemplate is the annotated .pando.toml written when no local config exists. It is kept here (rather than in cmd/) so both the CLI init command and the TUI first-run flow can share it without import cycles. API keys and provider-specific model selections are intentionally left blank.

View Source
const DefaultPersonaTemplate = `` /* 627-byte string literal not displayed */

DefaultPersonaTemplate is the starter persona written to personas/default.md during project initialisation. It is exported here so both cmd/init.go and the headless InitializeProjectAt function can share a single source of truth without creating import cycles.

View Source
const (
	// InitFlagFilename is the name of the file that indicates whether the project has been initialized
	InitFlagFilename = "init"
)
View Source
const (
	MaxTokensFallbackDefault = 4096
)

Application constants

Variables

View Source
var Bus = newEventBus()

Bus is the global singleton event bus for configuration changes.

Functions

func AddProviderAccount added in v0.252.0

func AddProviderAccount(account ProviderAccount) error

AddProviderAccount adds a new provider account and persists the change.

func ConfigFileFormat added in v0.2.0

func ConfigFileFormat() string

ConfigFileFormat returns the format ("json" or "toml") of the active config file.

func DeleteLSP

func DeleteLSP(language string) error

func DeleteMCPServer

func DeleteMCPServer(name string) error

func DeleteProviderAccount added in v0.252.0

func DeleteProviderAccount(id string) error

DeleteProviderAccount removes the provider account with the given ID.

func DetectPreferredProjectContextPath added in v0.9.0

func DetectPreferredProjectContextPath(workDir string) (string, bool)

DetectPreferredProjectContextPath returns the highest-priority project context file that already exists in the working directory.

func GenerateLocalConfigFile added in v0.236.1

func GenerateLocalConfigFile(template string) error

GenerateLocalConfigFile writes the annotated default .pando.toml template into the current working directory. It returns an error if the file already exists to prevent accidental overwrites.

func HasConfigFileAt added in v0.240.0

func HasConfigFileAt(dir string) bool

HasConfigFileAt returns true if a .pando.toml or .pando.json file exists in the given directory. It does NOT search parent directories or profiles.

func HasLocalConfigFile added in v0.236.1

func HasLocalConfigFile() bool

HasLocalConfigFile returns true if a .pando.toml or .pando.json file exists in the current working directory. It does NOT check profile/home locations.

func HasPandoDirectory added in v0.236.1

func HasPandoDirectory() bool

HasPandoDirectory returns true if the .pando directory already exists in the current working directory (meaning the project was previously initialised but the config file may have been deleted or never generated locally).

func HasPandoDirectoryAt added in v0.240.0

func HasPandoDirectoryAt(dir string) bool

HasPandoDirectoryAt returns true if the .pando/ subdirectory exists in dir.

func InitializeProjectAt added in v0.240.0

func InitializeProjectAt(dir string) error

InitializeProjectAt creates the full Pando directory structure and writes the default configuration at the given path. It is the path-aware equivalent of the "pando init --target project" command, suitable for use by the ProjectManager when a new project directory has no existing configuration.

Created layout:

<dir>/.pando.toml
<dir>/.pando/data/
<dir>/.pando/data/init          (init flag)
<dir>/.pando/mesnada/logs/
<dir>/.pando/mesnada/personas/
<dir>/.pando/mesnada/personas/default.md
<dir>/agents/skills/

Returns an error if any step fails. It is idempotent: existing files/dirs are not overwritten (same behaviour as "pando init" without --force).

func IsPrioritizedProjectContextPath added in v0.9.0

func IsPrioritizedProjectContextPath(path string) bool

IsPrioritizedProjectContextPath reports whether the path belongs to the exclusive project context file family where only one file should be used.

func LoadGitHubToken

func LoadGitHubToken() (string, error)

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

func OverrideAgentModel(agentName AgentName, modelID models.ModelID) error

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 ParseCronExpression added in v0.244.0

func ParseCronExpression(s string) error

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

func ResolveConfigFilePath() (string, error)

ResolveConfigFilePath finds the active config file path. A local config file (in the working directory) takes priority over the global one because mergeLocalConfig applies it after ReadInConfig, overriding any overlapping keys. Writes must go to the highest-priority file so that changes are not silently reverted on the next reload.

func ResolveProjectInitializationContextPath added in v0.9.0

func ResolveProjectInitializationContextPath(workDir string) string

ResolveProjectInitializationContextPath returns the preferred existing project context file, or the default file to create if none exists yet.

func SetProviderAccountDisabled added in v0.252.0

func SetProviderAccountDisabled(id string, disabled bool) error

SetProviderAccountDisabled enables or disables the provider account with the given ID.

func ShouldGenerateLocalConfig added in v0.236.1

func ShouldGenerateLocalConfig() bool

ShouldGenerateLocalConfig returns true when pando is running in a directory that has no local .pando.toml/.pando.json but does have (or should have) one. The rules are:

  • If a local config already exists → false (nothing to do).
  • Otherwise → true (we should offer/auto-generate one).

func ShouldShowInitDialog

func ShouldShowInitDialog() (bool, error)

ShouldShowInitDialog checks if the initialization dialog should be shown for the current directory

func UpdateAgent added in v0.30.0

func UpdateAgent(agentName AgentName, agent Agent) error

func UpdateAgentModel

func UpdateAgentModel(agentName AgentName, modelID models.ModelID) error

func UpdateAutoCompact

func UpdateAutoCompact(enabled bool) error

func UpdateBash added in v0.30.0

func UpdateBash(bash BashConfig) error

func UpdateContainer added in v0.260.0

func UpdateContainer(containerCfg ContainerConfig) error

func UpdateCronJobs added in v0.244.0

func UpdateCronJobs(cronJobs CronJobsConfig) error

func UpdateDebug

func UpdateDebug(enabled bool) error

func UpdateEvaluator added in v0.30.0

func UpdateEvaluator(eval EvaluatorConfig) error

func UpdateGeneral added in v0.30.0

func UpdateGeneral(workingDir, logFile string, debugLSP bool, contextPaths []string, dataDir string) error

func UpdateInternalTools added in v0.21.1

func UpdateInternalTools(internalToolsCfg InternalToolsConfig) error

UpdateInternalTools updates internal tools configuration and persists it to the config file.

func UpdateLLMCache added in v0.254.0

func UpdateLLMCache(enabled bool) error

UpdateLLMCache updates the LLM cache enabled flag and persists it to the config file.

func UpdateLSP

func UpdateLSP(language string, lsp LSPConfig) error

func UpdateLua added in v0.30.0

func UpdateLua(lua LuaConfig) error

func UpdateMCPGateway added in v0.30.0

func UpdateMCPGateway(gw MCPGatewayConfig) error

func UpdateMCPServer

func UpdateMCPServer(name string, server MCPServer) error

func UpdateMCPServerConfig added in v0.260.0

func UpdateMCPServerConfig(mcpSrv MCPServerConfig) error

UpdateMCPServerConfig updates the MCPServer configuration block and persists it to the config file.

func UpdateMesnada

func UpdateMesnada(mesnadaCfg MesnadaConfig) error

func UpdateOpenLit added in v0.200.0

func UpdateOpenLit(openLitCfg OpenLitConfig) error

UpdateOpenLit updates OpenLit configuration and persists it to the config file.

func UpdatePermissions added in v0.160.0

func UpdatePermissions(perms PermissionsConfig) error

func UpdatePersonaAutoSelect added in v0.41.0

func UpdatePersonaAutoSelect(pasCfg PersonaAutoSelectConfig) error

UpdatePersonaAutoSelect updates persona auto-select configuration and persists it.

func UpdateProvider

func UpdateProvider(name models.ModelProvider, apiKey string, baseURL string, disabled bool) error

func UpdateProviderAccount added in v0.252.0

func UpdateProviderAccount(id string, updated ProviderAccount) error

UpdateProviderAccount updates an existing provider account by ID. If the APIKey in updated is empty, the existing key is preserved.

func UpdateProviderOAuth added in v0.30.0

func UpdateProviderOAuth(name models.ModelProvider, useOAuth bool) error

UpdateProviderOAuth updates only the UseOAuth flag for the specified provider and persists the change.

func UpdateRemembrances added in v0.7.0

func UpdateRemembrances(remembrancesCfg RemembrancesConfig) error

UpdateRemembrances updates remembrances configuration and persists it to the config file.

func UpdateServer added in v0.30.0

func UpdateServer(server APIServerConfig) error

func UpdateShell

func UpdateShell(path string, args []string) error

func UpdateSkillsCatalog added in v0.32.1

func UpdateSkillsCatalog(sc SkillsCatalogConfig) error

UpdateSkillsCatalog updates skills catalog configuration and persists it to the config file.

func UpdateSkillsEnabled

func UpdateSkillsEnabled(enabled bool) error

func UpdateSnapshots added in v0.30.0

func UpdateSnapshots(snap SnapshotsConfig) error

func UpdateTheme

func UpdateTheme(themeName string) error

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 ValidateCronJobsConfig added in v0.244.0

func ValidateCronJobsConfig(cronJobs CronJobsConfig) error

func WatchConfigFile added in v0.70.0

func WatchConfigFile(ctx context.Context, path string)

WatchConfigFile monitors path for changes and triggers a config reload when the file is written. A 200 ms debounce prevents double-events caused by editors that write files in two steps (truncate + write).

The goroutine shuts down cleanly when ctx is cancelled.

func WorkingDirectory

func WorkingDirectory() string

WorkingDirectory returns the current working directory from the configuration.

Types

type ACPConfig added in v0.100.0

type ACPConfig struct {
	// Enabled controls whether the ACP server mode is available. Default: true.
	Enabled bool `toml:"enabled" json:"enabled,omitempty"`
	// MaxSessions limits the number of concurrent ACP sessions. Default: 10.
	MaxSessions int `toml:"max_sessions" json:"max_sessions,omitempty"`
	// IdleTimeout is the duration before an idle session is cleaned up. Default: "30m".
	IdleTimeout string `toml:"idle_timeout" json:"idle_timeout,omitempty"`
	// LogLevel controls logging verbosity for the ACP server. Default: "info".
	LogLevel string `toml:"log_level" json:"log_level,omitempty"`
	// AutoPermission enables automatic approval of tool permission requests.
	// Set to true for CI/batch environments. Default: false.
	AutoPermission bool `toml:"auto_permission" json:"auto_permission,omitempty"`
}

ACPConfig defines the configuration for the ACP (Agent Client Protocol) stdio server. This controls how Pando behaves when launched as a subprocess by editors like VS Code, Zed, or JetBrains.

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,high
	ThinkingMode          ThinkingMode   `json:"thinkingMode,omitempty"`          // For anthropic models: disabled,low,medium,high
	AutoCompact           bool           `json:"autoCompact,omitempty"`           // enable auto-compaction when context fills up
	AutoCompactThreshold  float64        `json:"autoCompactThreshold,omitempty"`  // 0.0-1.0, default 0.85
	ContextWindowOverride int64          `json:"contextWindowOverride,omitempty"` // override model's reported context window (tokens); 0 = use model default
}

Agent defines configuration for different LLM models and their token limits.

type AgentName

type AgentName string
const (
	AgentCoder           AgentName = "coder"
	AgentSummarizer      AgentName = "summarizer"
	AgentTask            AgentName = "task"
	AgentTitle           AgentName = "title"
	AgentCLIAssist       AgentName = "cli-assist"
	AgentPersonaSelector AgentName = "persona-selector"
)

type BashConfig added in v0.30.0

type BashConfig struct {
	// BannedCommands is the list of commands that the bash tool will refuse to execute.
	// If empty, the default built-in list is used.
	BannedCommands []string `json:"bannedCommands,omitempty"`
	// AllowedCommands, when non-empty, removes specific commands from the default banned list.
	AllowedCommands []string `json:"allowedCommands,omitempty"`
}

BashConfig defines configuration for the bash tool, including command restrictions.

type CLIAssistConfig added in v0.32.1

type CLIAssistConfig struct {
	Model   models.ModelID `toml:"Model"`
	Timeout int            `toml:"Timeout"` // seconds, default 30
}

CLIAssistConfig defines configuration for the CLI assist mode.

type Config

type Config struct {
	Data       Data                 `json:"data"`
	WorkingDir string               `json:"wd,omitempty"`
	MCPServers map[string]MCPServer `json:"mcpServers,omitempty"`
	// ProviderAccounts is the new multi-account provider configuration.
	// It supersedes the Providers map. On load, if empty and Providers is non-empty,
	// the old map is automatically migrated to this list.
	ProviderAccounts []ProviderAccount `json:"providerAccounts,omitempty" toml:"providerAccounts,omitempty"`
	// Providers is the legacy single-account provider map. Kept for backward compatibility.
	// New code should use ProviderAccounts instead.
	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"`
	SkillsCatalog     SkillsCatalogConfig               `json:"skillsCatalog,omitempty"`
	TUI               TUIConfig                         `json:"tui"`
	Permissions       PermissionsConfig                 `json:"permissions,omitempty"`
	Mesnada           MesnadaConfig                     `json:"mesnada,omitempty"`
	Shell             ShellConfig                       `json:"shell,omitempty"`
	Bash              BashConfig                        `json:"bash,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"`
	Snapshots         SnapshotsConfig                   `json:"snapshots,omitempty"`
	Evaluator         EvaluatorConfig                   `json:"evaluator,omitempty" toml:"evaluator"`
	CLIAssist         CLIAssistConfig                   `json:"cliAssist,omitempty" toml:"cliAssist"`
	PersonaAutoSelect PersonaAutoSelectConfig           `json:"personaAutoSelect,omitempty"`
	ACP               ACPConfig                         `json:"acp,omitempty" toml:"acp"`
	OpenLit           OpenLitConfig                     `json:"openlit,omitempty" toml:"OpenLit"`
	Projects          ProjectsConfig                    `json:"projects,omitempty" toml:"Projects"`
	CronJobs          CronJobsConfig                    `json:"cronJobs,omitempty" toml:"CronJobs"`
	LLMCache          LLMCacheConfig                    `json:"llmCache,omitempty" toml:"LLMCache"`
	Container         ContainerConfig                   `json:"container,omitempty" toml:"Container"`
	MCPServer         MCPServerConfig                   `json:"mcpServer,omitempty" toml:"MCPServer"`
}

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.

func Load

func Load(workingDir string, debug bool, logFile ...string) (*Config, error)

Load initializes the configuration from environment variables and config files. If debug is true, debug mode is enabled and log level is set to debug. If logFile is provided, all logs are written to the specified file. It returns an error if configuration loading fails.

type ConfigChangeEvent added in v0.70.0

type ConfigChangeEvent struct {
	// Section describes which part of the config changed (empty = full reload).
	Section string `json:"section"`
	// Timestamp is when the change occurred.
	Timestamp time.Time `json:"timestamp"`
	// Source identifies the origin of the change: "tui", "webui", or "file".
	Source string `json:"source"`
}

ConfigChangeEvent represents a configuration change notification.

type ContainerConfig added in v0.260.0

type ContainerConfig struct {
	// Runtime selects the execution backend: host|docker|podman|embedded|auto.
	// Default "host" keeps existing behaviour unchanged.
	Runtime          string   `toml:"runtime" json:"runtime"`
	Image            string   `toml:"image" json:"image"`
	PullPolicy       string   `toml:"pull_policy" json:"pull_policy"` // always|never|if-not-present
	Socket           string   `toml:"socket" json:"socket"`           // override docker/podman socket path
	WorkDir          string   `toml:"work_dir" json:"work_dir"`       // working directory inside container
	Network          string   `toml:"network" json:"network"`         // default: "none"
	ReadOnly         bool     `toml:"read_only" json:"read_only"`     // mount root fs read-only
	User             string   `toml:"user" json:"user"`               // non-root user inside container
	CPULimit         string   `toml:"cpu_limit" json:"cpu_limit"`
	MemLimit         string   `toml:"mem_limit" json:"mem_limit"`
	PidsLimit        int64    `toml:"pids_limit" json:"pids_limit"`
	NoNewPrivileges  bool     `toml:"no_new_privileges" json:"no_new_privileges"`
	AllowEnv         []string `toml:"allow_env" json:"allow_env"`
	AllowMounts      []string `toml:"allow_mounts" json:"allow_mounts"`
	ExtraEnv         []string `toml:"extra_env" json:"extra_env"`
	ExtraMounts      []string `toml:"extra_mounts" json:"extra_mounts"`
	EmbeddedCacheDir string   `toml:"embedded_cache_dir" json:"embedded_cache_dir"`
	EmbeddedGCKeepN  int      `toml:"embedded_gc_keep_n" json:"embedded_gc_keep_n"`
}

ContainerConfig controls container runtime isolation for tool execution. When Runtime is empty or "host" behaviour is identical to the pre-container default.

func NormalizeContainerConfig added in v0.260.0

func NormalizeContainerConfig(containerCfg ContainerConfig) (ContainerConfig, error)

type CronJob added in v0.244.0

type CronJob struct {
	Name     string   `json:"name,omitempty" toml:"Name"`
	Schedule string   `json:"schedule,omitempty" toml:"Schedule"`
	Prompt   string   `json:"prompt,omitempty" toml:"Prompt"`
	Enabled  bool     `json:"enabled,omitempty" toml:"Enabled"`
	Engine   string   `json:"engine,omitempty" toml:"Engine"`
	Model    string   `json:"model,omitempty" toml:"Model"`
	WorkDir  string   `json:"workDir,omitempty" toml:"WorkDir"`
	Tags     []string `json:"tags,omitempty" toml:"Tags"`
	Timeout  string   `json:"timeout,omitempty" toml:"Timeout"`
}

CronJob defines a scheduled prompt execution.

type CronJobsConfig added in v0.244.0

type CronJobsConfig struct {
	Enabled bool      `json:"enabled,omitempty" toml:"Enabled"`
	Jobs    []CronJob `json:"jobs,omitempty" toml:"Jobs"`
}

CronJobsConfig controls scheduled Mesnada runs.

type Data

type Data struct {
	Directory string `json:"directory,omitempty"`
}

Data defines storage configuration.

type EvaluatorConfig added in v0.26.2

type EvaluatorConfig struct {
	// Enabled activates the evaluation loop. Default: false (opt-in).
	Enabled bool `toml:"enabled"`
	// Model is the cheap/fast model used for LLM-as-Judge evaluation.
	Model models.ModelID `toml:"model"`
	// Provider specifies which LLM provider to use for the judge model.
	Provider string `toml:"provider"`
	// AlphaWeight is the importance of task success in reward. Default: 0.8.
	// Reward formula: R = AlphaWeight * S_success + BetaWeight * S_tokens
	AlphaWeight float64 `toml:"alphaWeight"`
	// BetaWeight is the importance of token efficiency in reward. Default: 0.2.
	BetaWeight float64 `toml:"betaWeight"`
	// ExplorationC is the UCB1 exploration factor. Default: 1.41 (sqrt(2)).
	ExplorationC float64 `toml:"explorationC"`
	// MinSessionsForUCB is the min evaluated sessions before UCB activates. Default: 5.
	MinSessionsForUCB int `toml:"minSessionsForUCB"`
	// CorrectionsPatterns are regex patterns that indicate user corrections.
	CorrectionsPatterns []string `toml:"correctionsPatterns"`
	// MaxTokensBaseline is the rolling window size for token efficiency. Default: 50.
	MaxTokensBaseline int `toml:"maxTokensBaseline"`
	// MaxSkills is the max active skills in the library. Default: 100.
	MaxSkills int `toml:"maxSkills"`
	// JudgePromptTemplate is optional path to a custom judge prompt template.
	JudgePromptTemplate string `toml:"judgePromptTemplate"`
	// Async runs evaluation in background after session end. Default: true.
	Async bool `toml:"async"`
}

EvaluatorConfig controls the self-improvement evaluation loop.

func EvaluatorWithDefaults added in v0.240.1

func EvaluatorWithDefaults(eval EvaluatorConfig) EvaluatorConfig

EvaluatorWithDefaults returns a copy of eval with zero/empty values replaced by the recommended defaults. This ensures the TUI and Web-UI always display sensible values even when the user has not explicitly configured the evaluator.

type EventBus added in v0.70.0

type EventBus struct {
	// contains filtered or unexported fields
}

EventBus is a simple fan-out publisher for ConfigChangeEvent. Subscribers register a channel; the bus delivers events to all of them.

func (*EventBus) Publish added in v0.70.0

func (b *EventBus) Publish(event ConfigChangeEvent)

Publish sends event to every registered subscriber. Subscribers that cannot receive (full channel) are skipped to avoid blocking.

func (*EventBus) Subscribe added in v0.70.0

func (b *EventBus) Subscribe(ch chan ConfigChangeEvent)

Subscribe registers ch to receive future ConfigChangeEvents. The caller owns the channel and is responsible for draining it.

func (*EventBus) Unsubscribe added in v0.70.0

func (b *EventBus) Unsubscribe(ch chan ConfigChangeEvent)

Unsubscribe removes ch from the bus. No more events will be sent to it.

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"`

	// Exa AI Search
	ExaSearchEnabled bool   `json:"exaSearchEnabled,omitempty"`
	ExaAPIKey        string `json:"exaApiKey,omitempty"`

	// Context7 library docs (no API key required)
	Context7Enabled bool `json:"context7Enabled,omitempty"`

	// Browser automation (chromedp)
	BrowserEnabled     bool   `json:"browserEnabled,omitempty" toml:"BrowserEnabled"`
	BrowserHeadless    bool   `json:"browserHeadless,omitempty" toml:"BrowserHeadless"`
	BrowserTimeout     int    `json:"browserTimeout,omitempty" toml:"BrowserTimeout"`
	BrowserUserDataDir string `json:"browserUserDataDir,omitempty" toml:"BrowserUserDataDir"`
	BrowserMaxSessions int    `json:"browserMaxSessions,omitempty" toml:"BrowserMaxSessions"`
}

InternalToolsConfig defines configuration for Pando's built-in tool integrations.

type LLMCacheConfig added in v0.254.0

type LLMCacheConfig struct {
	Enabled bool `json:"enabled" toml:"Enabled"`
}

LLMCacheConfig controls whether LLM prompt caching is enabled. Currently has real effect only on Anthropic (removes CacheControl headers). OpenAI and Gemini use server-side automatic caching that cannot be disabled via API.

type LSPConfig

type LSPConfig struct {
	Disabled bool     `json:"disabled"`
	Command  string   `json:"command"`
	Args     []string `json:"args"`
	Options  any      `json:"options"`
	// Languages is a list of file extensions (e.g. ".go", ".ts") or language IDs
	// this server handles. Used to filter which LSP clients are queried for a
	// given file. If empty, the server is queried for all files.
	Languages []string `json:"languages,omitempty"`
}

LSPConfig defines configuration for Language Server Protocol integration.

type LSPPreset added in v0.41.0

type LSPPreset struct {
	// Name is the identifier used as map key in Config.LSP.
	Name        string
	Description string
	Config      LSPConfig
}

LSPPreset defines a well-known LSP server configuration template.

func LSPPresetByName added in v0.41.0

func LSPPresetByName(name string) (LSPPreset, bool)

LSPPresetByName returns the preset with the given name, or false if not found.

func LSPPresets added in v0.41.0

func LSPPresets() []LSPPreset

LSPPresets returns the list of built-in LSP server presets. These represent the most commonly used language servers; users can override command/args by editing their project config.

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 MCPServerConfig added in v0.260.0

type MCPServerConfig struct {
	// Enabled can be checked by other subsystems to know MCP server mode is active.
	Enabled bool `json:"enabled,omitempty" toml:"Enabled"`
	// HttpPort is the port for the HTTP/streamable transport. Default: 9777.
	HttpPort int `json:"httpPort,omitempty" toml:"HttpPort"`
	// HttpHost is the interface to bind the HTTP transport. Default: "localhost".
	HttpHost string `json:"httpHost,omitempty" toml:"HttpHost"`
	// StdioEnabled enables the stdio transport. Default: true.
	StdioEnabled bool `json:"stdioEnabled,omitempty" toml:"StdioEnabled"`
	// HttpEnabled enables the HTTP/streamable transport. Default: true.
	HttpEnabled bool `json:"httpEnabled,omitempty" toml:"HttpEnabled"`

	// FileTools exposes file-system tools (view/read, glob, grep, ls) and optionally
	// write-side tools (write, edit, patch) to MCP clients.
	FileTools MCPServerFileToolsConfig `json:"fileTools,omitempty" toml:"FileTools"`
	// SystemExecution exposes the bash/shell execution tool to MCP clients.
	SystemExecution MCPServerSystemConfig `json:"systemExecution,omitempty" toml:"SystemExecution"`
	// GatewayExpose re-exports every tool discovered by the MCPGateway so that
	// external agents can reach all connected MCP servers through this Pando instance.
	GatewayExpose MCPServerGatewayExposeConfig `json:"gatewayExpose,omitempty" toml:"GatewayExpose"`
	// SelfImprovement exposes the evaluator/self-improvement agent as MCP tools
	// so external orchestrators can query UCB stats, skills, and trigger evaluation.
	SelfImprovement MCPServerSelfImprovementConfig `json:"selfImprovement,omitempty" toml:"SelfImprovement"`
}

MCPServerConfig controls which tool groups are exposed when Pando runs as an MCP server. Each tool group can be independently enabled or disabled. The settings here serve as defaults that can be overridden by CLI flags when running `pando mcp-server`.

type MCPServerFileToolsConfig added in v0.260.0

type MCPServerFileToolsConfig struct {
	// Enabled exposes read-only file tools: view, glob, grep, ls. Default: false.
	Enabled bool `json:"enabled,omitempty" toml:"Enabled"`
	// AllowWrite also exposes write-side tools: write, edit, patch. Default: false.
	// Requires Enabled = true.
	AllowWrite bool `json:"allowWrite,omitempty" toml:"AllowWrite"`
}

MCPServerFileToolsConfig controls file-system tool exposure in MCP server mode.

type MCPServerGatewayExposeConfig added in v0.260.0

type MCPServerGatewayExposeConfig struct {
	// Enabled re-exports every tool discovered by MCPGateway through this MCP server.
	// Requires MCPGateway.Enabled = true in the main config. Default: false.
	Enabled bool `json:"enabled,omitempty" toml:"Enabled"`
}

MCPServerGatewayExposeConfig controls re-export of MCPGateway tools.

type MCPServerSelfImprovementConfig added in v0.260.0

type MCPServerSelfImprovementConfig struct {
	// Enabled exposes evaluator tools: get stats, list skills, trigger evaluation.
	// Requires Evaluator.Enabled = true in the main config. Default: false.
	Enabled bool `json:"enabled,omitempty" toml:"Enabled"`
}

MCPServerSelfImprovementConfig controls self-improvement tool exposure.

type MCPServerSystemConfig added in v0.260.0

type MCPServerSystemConfig struct {
	// Enabled exposes the bash execution tool. Default: false.
	Enabled bool `json:"enabled,omitempty" toml:"Enabled"`
	// AllowedCommands is an optional allowlist of shell commands (first token).
	// When non-empty only commands whose first token matches an entry are executed.
	// An empty slice means all commands are permitted.
	AllowedCommands []string `json:"allowedCommands,omitempty" toml:"AllowedCommands"`
}

MCPServerSystemConfig controls shell/bash tool exposure in MCP server mode.

type MCPType

type MCPType string

MCPType defines the type of MCP (Model Control Protocol) server.

const (
	MCPStdio          MCPType = "stdio"
	MCPSse            MCPType = "sse"
	MCPStreamableHTTP MCPType = "streamable-http"
)

Supported MCP types

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 OpenLitConfig added in v0.200.0

type OpenLitConfig struct {
	Enabled       bool              `json:"enabled" toml:"Enabled"`
	Endpoint      string            `json:"endpoint" toml:"Endpoint"`       // e.g. "http://localhost:4318"
	ServiceName   string            `json:"serviceName" toml:"ServiceName"` // e.g. "pando"
	Insecure      bool              `json:"insecure" toml:"Insecure"`
	CustomHeaders map[string]string `json:"customHeaders,omitempty" toml:"CustomHeaders"`
}

OpenLitConfig holds configuration for OpenLit LLM observability via OTLP

type PermissionsConfig added in v0.160.0

type PermissionsConfig struct {
	AutoApproveTools bool `json:"autoApproveTools,omitempty"`
}

PermissionsConfig defines runtime permission behavior for local interactive sessions.

type PersonaAutoSelectConfig added in v0.41.0

type PersonaAutoSelectConfig struct {
	// Enabled activates automatic persona selection. Default: false.
	Enabled bool `json:"enabled,omitempty"`
	// PersonaPath is the directory containing persona .md files.
	// When empty, falls back to mesnada.orchestrator.personaPath.
	PersonaPath string `json:"personaPath,omitempty"`
}

PersonaAutoSelectConfig configures automatic persona selection for the main session. When enabled, a lite model analyses each user prompt and prepends the most relevant persona's content before the message is sent to the main conversation model.

type ProjectInitFlag

type ProjectInitFlag struct {
	Initialized bool `json:"initialized"`
}

ProjectInitFlag represents the initialization status for a project directory

type ProjectsConfig added in v0.240.0

type ProjectsConfig struct {
	// Enabled activates the Projects feature. Default: true.
	Enabled bool `json:"enabled,omitempty" toml:"Enabled"`
	// AutoRestore re-activates the last active project on startup. Default: false.
	AutoRestore bool `json:"autoRestore,omitempty" toml:"AutoRestore"`
	// MaxProjects limits how many projects can be registered. 0 means no limit. Default: 20.
	MaxProjects int `json:"maxProjects,omitempty" toml:"MaxProjects"`
}

ProjectsConfig controls the multi-project management feature.

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 ProviderAccount added in v0.252.0

type ProviderAccount struct {
	ID           string               `json:"id" toml:"id"`
	DisplayName  string               `json:"displayName,omitempty" toml:"displayName,omitempty"`
	Type         models.ModelProvider `json:"type" toml:"type"`
	APIKey       string               `json:"apiKey,omitempty" toml:"apiKey,omitempty"`
	BaseURL      string               `json:"baseUrl,omitempty" toml:"baseUrl,omitempty"`
	ExtraHeaders map[string]string    `json:"extraHeaders,omitempty" toml:"extraHeaders,omitempty"`
	Disabled     bool                 `json:"disabled,omitempty" toml:"disabled,omitempty"`
	UseOAuth     bool                 `json:"useOAuth,omitempty" toml:"useOAuth,omitempty"`
}

ProviderAccount defines a named provider configuration (account). It allows multiple accounts of the same provider type (e.g., two Anthropic API keys). The ID field is a unique slug used to identify the account (e.g., "anthropic-work").

func AccountsForProviderType added in v0.252.0

func AccountsForProviderType(providerType models.ModelProvider) []ProviderAccount

AccountsForProviderType returns all non-disabled accounts of the given provider type.

func GetProviderAccount added in v0.252.0

func GetProviderAccount(id string) (*ProviderAccount, bool)

GetProviderAccount returns the provider account with the given ID.

func GetProviderAccounts added in v0.252.0

func GetProviderAccounts() []ProviderAccount

GetProviderAccounts returns all configured provider accounts.

func ResolveProviderAccountByID added in v0.252.0

func ResolveProviderAccountByID(id string) (*ProviderAccount, error)

ResolveProviderAccountByID returns the ProviderAccount with the given ID. Returns an error if the config is not loaded or no account with that ID exists.

func ResolveProviderAccountForType added in v0.252.0

func ResolveProviderAccountForType(providerType models.ModelProvider) (*ProviderAccount, error)

ResolveProviderAccountForType returns the first non-disabled ProviderAccount of the given provider type. It checks ProviderAccounts (new format) first so that locally configured accounts take precedence over profile-level legacy providers. Falls back to the legacy Providers map for backward compatibility.

type RemembrancesConfig added in v0.7.0

type RemembrancesConfig struct {
	Enabled                   bool   `json:"enabled" toml:"Enabled"`
	KBPath                    string `json:"kb_path" toml:"KBPath"`
	KBWatch                   bool   `json:"kb_watch" toml:"KBWatch"`
	KBAutoImport              bool   `json:"kb_auto_import" toml:"KBAutoImport"`
	AutoIndexSessions         bool   `json:"auto_index_sessions" toml:"AutoIndexSessions"`
	DocumentEmbeddingProvider string `json:"document_embedding_provider" toml:"DocumentEmbeddingProvider"`
	DocumentEmbeddingModel    string `json:"document_embedding_model" toml:"DocumentEmbeddingModel"`
	// DocumentEmbeddingBaseURL and DocumentEmbeddingAPIKey are used when DocumentEmbeddingProvider is "openai-compatible".
	DocumentEmbeddingBaseURL string `json:"document_embedding_base_url" toml:"DocumentEmbeddingBaseURL"`
	DocumentEmbeddingAPIKey  string `json:"document_embedding_api_key" toml:"DocumentEmbeddingAPIKey"`
	CodeEmbeddingProvider    string `json:"code_embedding_provider" toml:"CodeEmbeddingProvider"`
	CodeEmbeddingModel       string `json:"code_embedding_model" toml:"CodeEmbeddingModel"`
	// CodeEmbeddingBaseURL and CodeEmbeddingAPIKey are used when CodeEmbeddingProvider is "openai-compatible".
	CodeEmbeddingBaseURL string `json:"code_embedding_base_url" toml:"CodeEmbeddingBaseURL"`
	CodeEmbeddingAPIKey  string `json:"code_embedding_api_key" toml:"CodeEmbeddingAPIKey"`
	UseSameModel         bool   `json:"use_same_model" toml:"UseSameModel"`
	ChunkSize            int    `json:"chunk_size" toml:"ChunkSize"`
	ChunkOverlap         int    `json:"chunk_overlap" toml:"ChunkOverlap"`
	IndexWorkers         int    `json:"index_workers" toml:"IndexWorkers"`

	// ContextEnrichment enables pre-prompt KB, events and code search to inject relevant context.
	ContextEnrichmentEnabled        bool   `json:"context_enrichment_enabled" toml:"ContextEnrichmentEnabled"`
	ContextEnrichmentKBResults      int    `json:"context_enrichment_kb_results" toml:"ContextEnrichmentKBResults"`
	ContextEnrichmentCodeResults    int    `json:"context_enrichment_code_results" toml:"ContextEnrichmentCodeResults"`
	ContextEnrichmentCodeProject    string `json:"context_enrichment_code_project" toml:"ContextEnrichmentCodeProject"`
	ContextEnrichmentEventsResults  int    `json:"context_enrichment_events_results" toml:"ContextEnrichmentEventsResults"`
	ContextEnrichmentEventsSubject  string `json:"context_enrichment_events_subject" toml:"ContextEnrichmentEventsSubject"`
	ContextEnrichmentEventsLastDays int    `json:"context_enrichment_events_last_days" toml:"ContextEnrichmentEventsLastDays"`
	// ContextEnrichmentMinScore is the minimum relevance score (0–1) for a result to be included.
	// Results below this threshold are discarded; entire sections are dropped if all results fail.
	ContextEnrichmentMinScore float64 `json:"context_enrichment_min_score" toml:"ContextEnrichmentMinScore"`
}

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 SkillsCatalogConfig added in v0.32.1

type SkillsCatalogConfig struct {
	Enabled      bool   `json:"enabled" yaml:"enabled"`
	BaseURL      string `json:"baseUrl" yaml:"baseUrl"`
	AutoUpdate   bool   `json:"autoUpdate" yaml:"autoUpdate"`
	DefaultScope string `json:"defaultScope" yaml:"defaultScope"` // "global" | "project"
}

SkillsCatalogConfig holds configuration for the skills.sh catalog integration.

type SkillsConfig

type SkillsConfig struct {
	Enabled bool     `json:"enabled,omitempty"`
	Paths   []string `json:"paths,omitempty"`
}

SkillsConfig defines configuration for skill discovery and prompt injection.

type SnapshotsConfig added in v0.26.2

type SnapshotsConfig struct {
	Enabled         bool     `json:"enabled,omitempty"`
	MaxSnapshots    int      `json:"maxSnapshots,omitempty"`
	MaxFileSize     string   `json:"maxFileSize,omitempty"`     // e.g. "10MB"
	ExcludePatterns []string `json:"excludePatterns,omitempty"` // e.g. ["*.log", "node_modules/"]
	AutoCleanupDays int      `json:"autoCleanupDays,omitempty"`
}

SnapshotsConfig defines configuration for the session snapshot system.

func (*SnapshotsConfig) ParseMaxFileSize added in v0.26.2

func (c *SnapshotsConfig) ParseMaxFileSize() int64

ParseMaxFileSize parses the MaxFileSize string to bytes. Supports suffixes: KB, MB, GB (case-insensitive). Default is 10MB.

type TUIConfig

type TUIConfig struct {
	Theme string `json:"theme,omitempty"`
}

TUIConfig defines the configuration for the Terminal User Interface.

type ThinkingMode added in v0.200.0

type ThinkingMode string

ThinkingMode controls extended thinking for Anthropic models that support it.

const (
	ThinkingDisabled ThinkingMode = "disabled"
	ThinkingLow      ThinkingMode = "low"
	ThinkingMedium   ThinkingMode = "medium"
	ThinkingHigh     ThinkingMode = "high"
)

Jump to

Keyboard shortcuts

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