Documentation
¶
Index ¶
- Constants
- func ApplyAction(cfg *Config, action, key, value string) error
- func Dir() (string, error)
- func DisplayValue(action, key, value string) string
- func ParseBool(s string) (bool, error)
- func Path() (string, error)
- func RedactSecret(secret string) string
- func Save(cfg *Config) error
- func ValidToolCallingMode(mode string) bool
- type Config
- type HistoryConfig
- type ProviderConfig
- type ProviderDetail
- type SafetyConfig
Constants ¶
const ( ProviderOpenAI = "openai" ProviderOpenRouter = "openrouter" ProviderLocal = "local" DebugNone = "none" DebugScreen = "screen" DebugFile = "file" // ToolCalling modes control whether the AI can use read-only tools. ToolCallingNever = "never" // Tools disabled entirely ToolCallingAlwaysPrompt = "always_prompt" // Prompt the user before every tool call ToolCallingDangerousPrompt = "dangerous_prompt" // Only prompt when a tool hits a safety rule ToolCallingAlwaysAllow = "always_allow" // Execute all tools without prompting )
Provider name constants.
Variables ¶
This section is empty.
Functions ¶
func ApplyAction ¶
ApplyAction applies an LLM-initiated config change and saves the result. The action/key/value correspond to the structured response from the LLM (e.g. action="set_model", key="model", value="gpt-4o").
This is the single source of truth for config mutations triggered by the LLM, used by both the single-shot CLI path and the interactive REPL.
func DisplayValue ¶ added in v0.1.4
DisplayValue masks sensitive config values before printing them to the user.
func ParseBool ¶
ParseBool parses a string as a boolean, accepting "true" or "false" (case-insensitive, trimmed). Any other value returns an error.
This is stricter than strconv.ParseBool — it rejects "1", "0", "yes", "no", etc. — because config values come from LLM responses and user input where only "true"/"false" are documented as valid.
func RedactSecret ¶ added in v0.1.4
RedactSecret masks a secret for display purposes. Returns an empty string if the input is empty, preserving the unset state.
func ValidToolCallingMode ¶ added in v0.1.4
ValidToolCallingMode returns true if the given mode is a valid tool_calling value.
Types ¶
type Config ¶
type Config struct {
Provider ProviderConfig `toml:"provider"`
Safety SafetyConfig `toml:"safety"`
History HistoryConfig `toml:"history"`
Debug string `toml:"debug"` // "none", "screen", or "file"
DebugLogPayloads bool `toml:"debug_log_payloads"` // Only used for debug=file
}
func DefaultConfig ¶
func DefaultConfig() *Config
func RedactedCopy ¶ added in v0.1.4
RedactedCopy returns a copy of cfg with provider API keys masked for display.
type HistoryConfig ¶ added in v0.1.4
type HistoryConfig struct {
IncludeLLMOutput bool `toml:"include_llm_output"`
IncludeDebug bool `toml:"include_debug"`
AskOnError bool `toml:"ask_on_error"`
AutoCheckOnError bool `toml:"auto_check_on_error"`
RetryMaxAttempts int `toml:"retry_max_attempts"`
RetryContextDepth int `toml:"retry_context_depth"`
}
type ProviderConfig ¶
type ProviderConfig struct {
Default string `toml:"default"`
Model string `toml:"model"`
OpenAI ProviderDetail `toml:"openai"`
OpenRouter ProviderDetail `toml:"openrouter"`
Local ProviderDetail `toml:"local"`
}
type ProviderDetail ¶
type SafetyConfig ¶
type SafetyConfig struct {
AlwaysConfirm bool `toml:"always_confirm"`
ToolCalling string `toml:"tool_calling"`
MinCertainty int `toml:"min_certainty"`
AllowlistPrefixes []string `toml:"allowlist_prefixes"`
WhitelistPrefixes []string `toml:"whitelist_prefixes,omitempty"` // Deprecated: use allowlist_prefixes
}