Documentation
¶
Index ¶
- Variables
- func DetectIP() string
- func ExpandWithBuiltins(raw string, builtins map[string]string) string
- func GetOutboundIP() (net.IP, error)
- func HostBuiltins() map[string]string
- func InitConfig(configDir string, interval int64, plugins, loglevel string) error
- type AIConfig
- type Alerting
- type ConfigType
- type ConsoleConfig
- type DiagnoseConfig
- type Duration
- type FlashdutyConfig
- type Global
- type HTTPConfig
- type InternalConfig
- type LogConfig
- type MCPConfig
- type MCPServerConfig
- type ModelConfig
- type NotifyConfig
- type PagerDutyConfig
- type ServerConfig
- type Size
- type WebAPIConfig
Constants ¶
This section is empty.
Variables ¶
var Version = "0.9.0"
Functions ¶
func DetectIP ¶ added in v0.10.0
func DetectIP() string
DetectIP returns the preferred outbound IPv4 address. It first tries gateway-based detection via GetOutboundIP, then falls back to scanning network interfaces.
func ExpandWithBuiltins ¶ added in v0.10.0
ExpandWithBuiltins expands ${VAR} references in raw, checking builtins first and falling back to environment variables.
func HostBuiltins ¶ added in v0.10.0
HostBuiltins computes host-level built-in variables once. Callers should compute this early and pass it to expandWithBuiltins.
Types ¶
type AIConfig ¶ added in v0.10.0
type AIConfig struct {
Enabled bool `toml:"enabled"`
ModelPriority []string `toml:"model_priority"`
Models map[string]ModelConfig `toml:"models"`
MaxRounds int `toml:"max_rounds"`
RequestTimeout Duration `toml:"request_timeout"`
MaxRetries int `toml:"max_retries"`
RetryBackoff Duration `toml:"retry_backoff"`
MaxConcurrentDiagnoses int `toml:"max_concurrent_diagnoses"`
QueueFullPolicy string `toml:"queue_full_policy"`
DailyTokenLimit int `toml:"daily_token_limit"`
ToolTimeout Duration `toml:"tool_timeout"`
AggregateWindow Duration `toml:"aggregate_window"`
DiagnoseRetention Duration `toml:"diagnose_retention"`
DiagnoseMaxCount int `toml:"diagnose_max_count"`
Language string `toml:"language"`
MCP MCPConfig `toml:"mcp"`
}
AIConfig holds the full AI subsystem configuration. ModelPriority defines the failover order; Models maps profile names to ModelConfig.
func (*AIConfig) PrimaryModel ¶ added in v0.10.0
func (c *AIConfig) PrimaryModel() ModelConfig
PrimaryModel returns the first model in the priority list. Panics if ModelPriority is empty or references a missing model — Validate should always be called before this.
func (*AIConfig) PrimaryModelName ¶ added in v0.10.0
PrimaryModelName returns the name of the first model in the priority list.
type Alerting ¶
type Alerting struct {
Disabled bool `toml:"disabled"`
// like prometheus `for`
ForDuration Duration `toml:"for_duration"`
// repeat interval
RepeatInterval Duration `toml:"repeat_interval"`
// maximum number of notifications
RepeatNumber int `toml:"repeat_number"`
// set to true to suppress recovery notifications
DisableRecoveryNotification bool `toml:"disable_recovery_notification"`
}
type ConfigType ¶
type ConfigType struct {
ConfigDir string `toml:"-"`
StateDir string `toml:"-"`
Plugins string `toml:"-"`
Loglevel string `toml:"-"`
Global Global `toml:"global"`
LogConfig LogConfig `toml:"log"`
Notify NotifyConfig `toml:"notify"`
AI AIConfig `toml:"ai"`
Server ServerConfig `toml:"server"`
}
var Config *ConfigType
type ConsoleConfig ¶ added in v0.10.0
type ConsoleConfig struct {
Enabled bool `toml:"enabled"`
}
type DiagnoseConfig ¶ added in v0.10.0
type Duration ¶
Duration is a time.Duration
func (*Duration) HumanString ¶
func (*Duration) UnmarshalTOML ¶
UnmarshalTOML parses the duration from the TOML config file
func (*Duration) UnmarshalText ¶
type FlashdutyConfig ¶ added in v0.10.0
type HTTPConfig ¶
type HTTPConfig struct {
Interface string `toml:"interface"`
Method string `toml:"method"`
Timeout Duration `toml:"timeout"`
FollowRedirects *bool `toml:"follow_redirects"`
BasicAuthUser string `toml:"basic_auth_user"`
BasicAuthPass string `toml:"basic_auth_pass"`
Headers []string `toml:"headers"`
Payload string `toml:"payload"`
HTTPProxy string `toml:"http_proxy"`
tls.ClientConfig
}
func (*HTTPConfig) GetMethod ¶
func (hc *HTTPConfig) GetMethod() string
func (*HTTPConfig) GetProxy ¶
func (hc *HTTPConfig) GetProxy() (proxyFunc, error)
func (*HTTPConfig) GetTimeout ¶
func (hc *HTTPConfig) GetTimeout() Duration
type InternalConfig ¶
type InternalConfig struct {
// append labels to every event
Labels map[string]string `toml:"labels"`
// gather interval
Interval Duration `toml:"interval"`
// alerting rule
Alerting Alerting `toml:"alerting"`
// AI diagnose config
Diagnose DiagnoseConfig `toml:"diagnose"`
}
func (*InternalConfig) GetAlerting ¶
func (ic *InternalConfig) GetAlerting() Alerting
func (*InternalConfig) GetDiagnoseConfig ¶ added in v0.10.0
func (ic *InternalConfig) GetDiagnoseConfig() DiagnoseConfig
func (*InternalConfig) GetInterval ¶
func (ic *InternalConfig) GetInterval() Duration
func (*InternalConfig) GetLabels ¶
func (ic *InternalConfig) GetLabels() map[string]string
type MCPConfig ¶ added in v0.10.0
type MCPConfig struct {
Enabled bool `toml:"enabled"`
DefaultIdentity string `toml:"default_identity"`
Servers []MCPServerConfig `toml:"servers"`
}
MCPConfig holds configuration for MCP (Model Context Protocol) server connections.
type MCPServerConfig ¶ added in v0.10.0
type MCPServerConfig struct {
Name string `toml:"name"`
Command string `toml:"command"`
Args []string `toml:"args"`
Env map[string]string `toml:"env"`
Identity string `toml:"identity"`
ToolsAllow []string `toml:"tools_allow"`
}
MCPServerConfig defines one MCP server connection.
func (*MCPServerConfig) IsToolAllowed ¶ added in v0.10.0
func (s *MCPServerConfig) IsToolAllowed(toolName string) bool
IsToolAllowed checks whether a tool name passes the whitelist filter. If ToolsAllow is empty, all tools are allowed.
func (*MCPServerConfig) ResolvedIdentity ¶ added in v0.10.0
func (s *MCPServerConfig) ResolvedIdentity(defaultIdentity string, builtins map[string]string) string
ResolvedIdentity returns the identity string for this server, falling back to defaultIdentity, then auto-detected host info. Variables ${HOSTNAME}, ${SHORT_HOSTNAME}, ${IP}, and ${ENV_VAR} are expanded. builtins should be obtained from HostBuiltins().
type ModelConfig ¶ added in v0.10.0
type ModelConfig struct {
// Provider selects the backend: "" or "openai" for OpenAI-compatible,
// "bedrock" for AWS Bedrock Converse API with SigV4 auth.
Provider string `toml:"provider"`
BaseURL string `toml:"base_url"`
APIKey string `toml:"api_key"`
Model string `toml:"model"`
MaxTokens int `toml:"max_tokens"`
ContextWindow int `toml:"context_window"`
InputPrice float64 `toml:"input_price"`
OutputPrice float64 `toml:"output_price"`
ExtraBody map[string]interface{} `toml:"extra_body"`
}
ModelConfig defines connection and model-specific parameters for one AI model.
func (ModelConfig) ExtraStr ¶ added in v0.11.0
func (m ModelConfig) ExtraStr(key string) string
ExtraStr returns a string value from ExtraBody, or empty if missing.
type NotifyConfig ¶ added in v0.10.0
type NotifyConfig struct {
Console *ConsoleConfig `toml:"console"`
Flashduty *FlashdutyConfig `toml:"flashduty"`
PagerDuty *PagerDutyConfig `toml:"pagerduty"`
WebAPI *WebAPIConfig `toml:"webapi"`
}
type PagerDutyConfig ¶ added in v0.10.0
type ServerConfig ¶ added in v0.11.0
type ServerConfig struct {
Enabled bool `toml:"enabled"`
URL string `toml:"url"`
TenantToken string `toml:"tenant_token"`
CAFile string `toml:"ca_file"`
TLSSkipVerify bool `toml:"tls_skip_verify"`
}
ServerConfig defines the optional catpaw-server connection. When Enabled is false (default), the Agent runs in pure local mode.
type Size ¶
type Size int64
Size represents a byte size with human-readable TOML parsing. Supports: "50MB", "1GB", "512KB", "1024" (bytes), etc. Case-insensitive units: B, KB, MB, GB, TB.