Documentation
¶
Overview ¶
Package config provides configuration management for agentcomms.
Package config provides configuration management for agentcomms.
Index ¶
- Constants
- type AgentConfig
- type ChannelMapping
- type ChatConfig
- type Config
- type DiscordConfig
- type LoggingConfig
- type NgrokConfig
- type PhoneConfig
- type STTConfig
- type ServerConfig
- type TTSConfig
- type TelegramConfig
- type UnifiedConfig
- func (c *UnifiedConfig) FindAgentByChannel(channelID string) (string, bool)
- func (c *UnifiedConfig) GetAgent(id string) (*AgentConfig, bool)
- func (c *UnifiedConfig) HasChatProviders() bool
- func (c *UnifiedConfig) Save(path string) error
- func (c *UnifiedConfig) ToLegacyConfig() *Config
- func (c *UnifiedConfig) Validate() error
- func (c *UnifiedConfig) VoiceEnabled() bool
- type VoiceConfig
- type WhatsAppConfig
Constants ¶
const ( ProviderElevenLabs = "elevenlabs" ProviderDeepgram = "deepgram" ProviderOpenAI = "openai" )
Provider constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentConfig ¶ added in v0.3.0
type AgentConfig struct {
// ID is the unique agent identifier.
ID string `json:"id"`
// Type is the agent type (tmux, process).
Type string `json:"type"`
// TmuxSession is the tmux session name (for type=tmux).
TmuxSession string `json:"tmux_session,omitempty"`
// TmuxPane is the tmux pane identifier (for type=tmux).
TmuxPane string `json:"tmux_pane,omitempty"`
}
AgentConfig defines an agent and its tmux target.
type ChannelMapping ¶ added in v0.3.0
type ChannelMapping struct {
// ChannelID is the full channel identifier (provider:chatid).
ChannelID string `json:"channel_id"`
// AgentID is the target agent ID.
AgentID string `json:"agent_id"`
}
ChannelMapping maps a chat channel to an agent.
type ChatConfig ¶ added in v0.3.0
type ChatConfig struct {
// Discord configuration (optional).
Discord *DiscordConfig `json:"discord,omitempty"`
// Telegram configuration (optional).
Telegram *TelegramConfig `json:"telegram,omitempty"`
// WhatsApp configuration (optional).
WhatsApp *WhatsAppConfig `json:"whatsapp,omitempty"`
// Channels maps chat channels to agents.
Channels []ChannelMapping `json:"channels,omitempty"`
}
ChatConfig holds chat provider configuration.
type Config ¶
type Config struct {
// Server settings
Port int
// Phone provider settings (Twilio)
PhoneProvider string // "twilio" or "telnyx"
PhoneAccountSID string
PhoneAuthToken string
PhoneNumber string // E.164 format, e.g., +15551234567
UserPhoneNumber string // E.164 format
// Voice provider selection
TTSProvider string // "elevenlabs", "deepgram", or "openai"
STTProvider string // "elevenlabs", "deepgram", or "openai"
// ElevenLabs settings
ElevenLabsAPIKey string
// Deepgram settings
DeepgramAPIKey string
// OpenAI settings
OpenAIAPIKey string
// TTS settings (provider-agnostic)
TTSVoice string // Voice ID (provider-specific)
TTSModel string // Model ID (provider-specific)
// STT settings (provider-agnostic)
STTModel string // Model ID (provider-specific)
STTLanguage string // BCP-47 language code (e.g., "en-US")
STTSilenceDurationMS int // milliseconds of silence to detect end of speech
// ngrok settings
NgrokAuthToken string
NgrokDomain string // optional custom domain
// Timeouts
TranscriptTimeoutMS int
// Chat provider settings
WhatsAppEnabled bool
WhatsAppDBPath string
DiscordEnabled bool
DiscordToken string
DiscordGuildID string
TelegramEnabled bool
TelegramToken string
}
Config holds all configuration for the agentcomms server.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with sensible defaults.
func LoadFromEnv ¶
LoadFromEnv loads configuration from environment variables. Supports both AGENTCOMMS_ and legacy AGENTCALL_ prefixes with AGENTCOMMS_ taking precedence.
func (*Config) ChatEnabled ¶
ChatEnabled returns true if any chat provider is enabled.
func (*Config) NeedsDeepgram ¶
NeedsDeepgram returns true if any provider uses Deepgram.
func (*Config) NeedsElevenLabs ¶
NeedsElevenLabs returns true if any provider uses ElevenLabs.
func (*Config) NeedsOpenAI ¶
NeedsOpenAI returns true if any provider uses OpenAI.
func (*Config) VoiceEnabled ¶
VoiceEnabled returns true if voice calling is configured.
type DiscordConfig ¶ added in v0.3.0
type DiscordConfig struct {
// Enabled controls whether Discord is active.
Enabled bool `json:"enabled,omitempty"`
// Token is the Discord bot token.
Token string `json:"token"`
// GuildID is the Discord guild (server) ID for filtering.
GuildID string `json:"guild_id,omitempty"`
}
DiscordConfig holds Discord-specific configuration.
type LoggingConfig ¶ added in v0.3.0
type LoggingConfig struct {
// Level is the log level (debug, info, warn, error).
Level string `json:"level,omitempty"`
}
LoggingConfig holds logging settings.
type NgrokConfig ¶ added in v0.3.0
type NgrokConfig struct {
// AuthToken is the ngrok auth token.
AuthToken string `json:"auth_token"`
// Domain is an optional custom ngrok domain.
Domain string `json:"domain,omitempty"`
}
NgrokConfig holds ngrok tunnel settings.
type PhoneConfig ¶ added in v0.3.0
type PhoneConfig struct {
// Provider is the phone provider ("twilio" or "telnyx").
Provider string `json:"provider,omitempty"`
// AccountSID is the Twilio account SID.
AccountSID string `json:"account_sid"`
// AuthToken is the Twilio auth token.
AuthToken string `json:"auth_token"`
// Number is the Twilio phone number (E.164 format).
Number string `json:"number"`
// UserNumber is the recipient phone number (E.164 format).
UserNumber string `json:"user_number"`
}
PhoneConfig holds phone provider settings.
type STTConfig ¶ added in v0.3.0
type STTConfig struct {
// Provider is the STT provider ("elevenlabs", "deepgram", "openai").
Provider string `json:"provider,omitempty"`
// APIKey is the provider API key.
APIKey string `json:"api_key"`
// Model is the model ID (provider-specific).
Model string `json:"model,omitempty"`
// Language is the BCP-47 language code (e.g., "en-US").
Language string `json:"language,omitempty"`
// SilenceDurationMS is milliseconds of silence to detect end of speech.
SilenceDurationMS int `json:"silence_duration_ms,omitempty"`
}
STTConfig holds speech-to-text settings.
type ServerConfig ¶ added in v0.3.0
type ServerConfig struct {
// Port is the server port (default: 3333).
Port int `json:"port,omitempty"`
// DataDir overrides the default data directory (~/.agentcomms).
DataDir string `json:"data_dir,omitempty"`
}
ServerConfig holds server settings.
type TTSConfig ¶ added in v0.3.0
type TTSConfig struct {
// Provider is the TTS provider ("elevenlabs", "deepgram", "openai").
Provider string `json:"provider,omitempty"`
// APIKey is the provider API key.
APIKey string `json:"api_key"`
// Voice is the voice ID (provider-specific).
Voice string `json:"voice,omitempty"`
// Model is the model ID (provider-specific).
Model string `json:"model,omitempty"`
}
TTSConfig holds text-to-speech settings.
type TelegramConfig ¶ added in v0.3.0
type TelegramConfig struct {
// Enabled controls whether Telegram is active.
Enabled bool `json:"enabled,omitempty"`
// Token is the Telegram bot token.
Token string `json:"token"`
}
TelegramConfig holds Telegram-specific configuration.
type UnifiedConfig ¶ added in v0.3.0
type UnifiedConfig struct {
// Version is the config schema version (for future migrations).
Version string `json:"version,omitempty"`
// Server settings.
Server ServerConfig `json:"server,omitempty"`
// Agents defines the available AI agents.
Agents []AgentConfig `json:"agents,omitempty"`
// Voice settings for phone calls via Twilio.
Voice *VoiceConfig `json:"voice,omitempty"`
// Chat settings for Discord, Telegram, WhatsApp.
Chat *ChatConfig `json:"chat,omitempty"`
// Logging settings.
Logging LoggingConfig `json:"logging,omitempty"`
}
UnifiedConfig is the single JSON configuration file for agentcomms. It combines MCP server and daemon configuration into one file.
func DefaultUnifiedConfig ¶ added in v0.3.0
func DefaultUnifiedConfig() *UnifiedConfig
DefaultUnifiedConfig returns a UnifiedConfig with sensible defaults.
func LoadUnifiedConfig ¶ added in v0.3.0
func LoadUnifiedConfig(path string) (*UnifiedConfig, error)
LoadUnifiedConfig loads configuration from a JSON file. It expands environment variables in string values using ${VAR} syntax.
func LoadUnifiedConfigFromDir ¶ added in v0.3.0
func LoadUnifiedConfigFromDir(dir string) (*UnifiedConfig, error)
LoadUnifiedConfigFromDir loads config.json from a directory.
func (*UnifiedConfig) FindAgentByChannel ¶ added in v0.3.0
func (c *UnifiedConfig) FindAgentByChannel(channelID string) (string, bool)
FindAgentByChannel returns the agent ID for a chat channel.
func (*UnifiedConfig) GetAgent ¶ added in v0.3.0
func (c *UnifiedConfig) GetAgent(id string) (*AgentConfig, bool)
GetAgent returns the agent config by ID.
func (*UnifiedConfig) HasChatProviders ¶ added in v0.3.0
func (c *UnifiedConfig) HasChatProviders() bool
HasChatProviders returns true if any chat provider is configured.
func (*UnifiedConfig) Save ¶ added in v0.3.0
func (c *UnifiedConfig) Save(path string) error
Save writes the configuration to a JSON file.
func (*UnifiedConfig) ToLegacyConfig ¶ added in v0.3.0
func (c *UnifiedConfig) ToLegacyConfig() *Config
ToLegacyConfig converts UnifiedConfig to the legacy Config for backward compatibility.
func (*UnifiedConfig) Validate ¶ added in v0.3.0
func (c *UnifiedConfig) Validate() error
Validate checks the configuration for errors.
func (*UnifiedConfig) VoiceEnabled ¶ added in v0.3.0
func (c *UnifiedConfig) VoiceEnabled() bool
VoiceEnabled returns true if voice calling is configured.
type VoiceConfig ¶ added in v0.3.0
type VoiceConfig struct {
// Phone provider settings (Twilio).
Phone PhoneConfig `json:"phone"`
// TTS (text-to-speech) settings.
TTS TTSConfig `json:"tts"`
// STT (speech-to-text) settings.
STT STTConfig `json:"stt"`
// Ngrok settings for webhook tunneling.
Ngrok NgrokConfig `json:"ngrok"`
// TranscriptTimeoutMS is the transcript timeout in milliseconds.
TranscriptTimeoutMS int `json:"transcript_timeout_ms,omitempty"`
}
VoiceConfig holds voice calling configuration.
type WhatsAppConfig ¶ added in v0.3.0
type WhatsAppConfig struct {
// Enabled controls whether WhatsApp is active.
Enabled bool `json:"enabled,omitempty"`
// DBPath is the SQLite database path for session storage.
DBPath string `json:"db_path"`
}
WhatsAppConfig holds WhatsApp-specific configuration.