Documentation
¶
Index ¶
- Constants
- func DeepCopyJSON[T any](src T) (T, error)
- func IsToolPolicyAutoRunEverywhere(policy string) bool
- func IsToolPolicyAutoRunInDM(policy string) bool
- type Config
- func MigrateSeparateServicesFromBots(cfg Config) (Config, bool, error)
- func MigrateServicesToBots(cfg Config, loadLegacyConfig func() (LegacyServiceConfig, error)) (Config, bool, error)
- func RunAllLegacyMigrations(cfg Config, loadLegacyConfig func() (LegacyServiceConfig, error)) (Config, bool, error)
- type Container
- func (c *Container) AllowNativeWebSearchInChannels() bool
- func (c *Container) AllowUnsafeLinks() bool
- func (c *Container) Config() *Config
- func (c *Container) EmbeddingSearchConfig() embeddings.EmbeddingSearchConfig
- func (c *Container) EnableChannelMentionToolCalling() bool
- func (c *Container) EnableTokenUsageLogToFile() bool
- func (c *Container) EnableTokenUsageLogToPlugin() bool
- func (c *Container) EnableTokenUsageLogging() bool
- func (c *Container) GetBots() []llm.BotConfig
- func (c *Container) GetDefaultBotName() string
- func (c *Container) GetServiceByID(id string) (llm.ServiceConfig, bool)
- func (c *Container) GetTranscriptGenerator() string
- func (c *Container) MCP() MCPConfig
- func (c *Container) RegisterUpdateListener(listener UpdateListener)
- func (c *Container) StorePersistedConfigWithoutNotify(newConfig *Config) error
- func (c *Container) Update(newConfig *Config)
- type LegacyServiceConfig
- type MCPConfig
- type MCPEmbeddedServerConfig
- type MCPServerConfig
- type MCPToolConfig
- type PluginServerConfig
- type UpdateListener
- type WebSearchBraveConfig
- type WebSearchConfig
- type WebSearchGoogleConfig
Constants ¶
const ( MCPToolPolicyAsk = "ask" MCPToolPolicyAutoRunInDM = "auto_run_in_dm" MCPToolPolicyAutoRunEverywhere = "auto_run_everywhere" )
Variables ¶
This section is empty.
Functions ¶
func DeepCopyJSON ¶
DeepCopyJSON creates a deep copy of JSON-serializable structs
func IsToolPolicyAutoRunEverywhere ¶
IsToolPolicyAutoRunEverywhere returns true only for policies that auto-execute without approval regardless of conversation context (DM or channel).
func IsToolPolicyAutoRunInDM ¶
IsToolPolicyAutoRunInDM returns true when the policy auto-executes in a DM without user approval. Both auto_run_in_dm (DM-only) and auto_run_everywhere satisfy this; the difference is whether the tool also auto-runs in channels.
Types ¶
type Config ¶
type Config struct {
Services []llm.ServiceConfig `json:"services"`
Bots []llm.BotConfig `json:"bots"`
DefaultBotName string `json:"defaultBotName"`
TranscriptGenerator string `json:"transcriptBackend"`
EnableTokenUsageLogging bool `json:"enableTokenUsageLogging"`
EnableCallSummary bool `json:"enableCallSummary"`
EnableTokenUsageLogToPlugin *bool `json:"enableTokenUsageLogToPlugin,omitempty"`
EnableTokenUsageLogToFile *bool `json:"enableTokenUsageLogToFile,omitempty"`
AllowedUpstreamHostnames string `json:"allowedUpstreamHostnames"`
AllowUnsafeLinks bool `json:"allowUnsafeLinks"`
EnableChannelMentionToolCalling bool `json:"enableChannelMentionToolCalling"`
AllowNativeWebSearchInChannels bool `json:"allowNativeWebSearchInChannels"`
EmbeddingSearchConfig embeddings.EmbeddingSearchConfig `json:"embeddingSearchConfig"`
MCP MCPConfig `json:"mcp"`
WebSearch WebSearchConfig `json:"webSearch"`
TelemetryOutput string `json:"telemetryOutput"`
OpenTelemetryEndpoint string `json:"openTelemetryEndpoint"`
}
func MigrateSeparateServicesFromBots ¶
MigrateSeparateServicesFromBots extracts embedded service configs from bots into standalone service entries, deduplicating identical services. Returns the updated config, whether any changes were made, and any error.
func MigrateServicesToBots ¶
func MigrateServicesToBots(cfg Config, loadLegacyConfig func() (LegacyServiceConfig, error)) (Config, bool, error)
MigrateServicesToBots migrates legacy service configs (from old config.json format) to the new bots+services model. Returns the updated config, whether any changes were made, and any error.
loadLegacyConfig is a function that loads the legacy JSON configuration (e.g., from config.json via the plugin API). It is only called if migration appears necessary.
func RunAllLegacyMigrations ¶
func RunAllLegacyMigrations(cfg Config, loadLegacyConfig func() (LegacyServiceConfig, error)) (Config, bool, error)
RunAllLegacyMigrations runs all legacy config migrations in order. Returns the final config, whether any changes were made, and any error.
loadLegacyConfig is passed through to MigrateServicesToBots; it is only called if that specific migration is needed.
func (*Config) GetServiceByID ¶
func (c *Config) GetServiceByID(id string) (llm.ServiceConfig, bool)
GetServiceByID returns the service configuration for the given ID
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func (*Container) AllowNativeWebSearchInChannels ¶
func (*Container) AllowUnsafeLinks ¶
func (*Container) Config ¶
Config retruns the whole configuration readonly. Avoid using this method, prefer using config though interfaces.
func (*Container) EmbeddingSearchConfig ¶
func (c *Container) EmbeddingSearchConfig() embeddings.EmbeddingSearchConfig
func (*Container) EnableChannelMentionToolCalling ¶
func (*Container) EnableTokenUsageLogToFile ¶
func (*Container) EnableTokenUsageLogToPlugin ¶
func (*Container) EnableTokenUsageLogging ¶
func (*Container) GetDefaultBotName ¶
func (*Container) GetServiceByID ¶
func (c *Container) GetServiceByID(id string) (llm.ServiceConfig, bool)
GetServiceByID returns the service configuration for the given ID
func (*Container) GetTranscriptGenerator ¶
func (*Container) RegisterUpdateListener ¶
func (c *Container) RegisterUpdateListener(listener UpdateListener)
func (*Container) StorePersistedConfigWithoutNotify ¶
StorePersistedConfigWithoutNotify updates in-memory configuration from a value read back from persistent storage without notifying update listeners. Use when the current call stack may already be servicing a listener (for example after SaveConfig during legacy migration) to avoid re-entrant listener invocation and deadlocks.
type LegacyServiceConfig ¶
type LegacyServiceConfig struct {
Config struct {
Services []struct {
Name string `json:"name"`
ServiceName string `json:"serviceName"`
DefaultModel string `json:"defaultModel"`
OrgID string `json:"orgId"`
URL string `json:"url"`
APIKey string `json:"apiKey"`
TokenLimit int `json:"tokenLimit"`
} `json:"services"`
} `json:"config"`
}
LegacyServiceConfig represents the old config.json format with the legacy service fields. This is used during the one-time migration from config.json to the database.
type MCPConfig ¶
type MCPConfig struct {
Enabled bool `json:"enabled"`
EnablePluginServer bool `json:"enablePluginServer"`
Servers []MCPServerConfig `json:"servers"`
PluginServers []PluginServerConfig `json:"plugin_servers,omitempty"`
EmbeddedServer MCPEmbeddedServerConfig `json:"embeddedServer"`
IdleTimeoutMinutes int `json:"idleTimeoutMinutes"`
}
MCPConfig contains the configuration for the MCP servers
type MCPEmbeddedServerConfig ¶
type MCPEmbeddedServerConfig struct {
Enabled bool `json:"enabled"`
ToolConfigs []MCPToolConfig `json:"tool_configs,omitempty"`
}
MCPEmbeddedServerConfig contains configuration for the embedded MCP server
type MCPServerConfig ¶
type MCPServerConfig struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
BaseURL string `json:"baseURL"`
Headers map[string]string `json:"headers,omitempty"`
ClientID string `json:"clientID,omitempty"`
ClientSecret string `json:"clientSecret,omitempty"`
ToolConfigs []MCPToolConfig `json:"tool_configs,omitempty"`
}
MCPServerConfig contains the configuration for a single MCP server
func (*MCPServerConfig) GetToolPolicy ¶
func (s *MCPServerConfig) GetToolPolicy(toolName string) (string, bool)
GetToolPolicy returns the policy and enabled state for a tool. If the receiver is nil or the tool name is empty, it returns ("ask", false). If no matching config entry exists, it returns ("ask", true) — unconfigured tools default to enabled with ask policy. Invalid or empty policies are normalized to "ask". When duplicate entries exist the last matching entry wins.
func (*MCPServerConfig) IsToolAutoRunInDM ¶
func (s *MCPServerConfig) IsToolAutoRunInDM(toolName string) bool
IsToolAutoRunInDM returns true when the tool is enabled and configured to auto-run in a DM (either the DM-only or everywhere policy).
type MCPToolConfig ¶
type MCPToolConfig struct {
Name string `json:"name"`
Policy string `json:"policy"` // "auto_run_in_dm" | "auto_run_everywhere" | "ask"
Enabled bool `json:"enabled"`
RetrievalDescriptionOverride string `json:"retrieval_description_override,omitempty"`
}
MCPToolConfig represents per-tool configuration for an MCP server.
type PluginServerConfig ¶
type PluginServerConfig struct {
PluginID string `json:"plugin_id"`
Name string `json:"name"`
Path string `json:"path"`
Enabled bool `json:"enabled"`
ExposeExternal bool `json:"expose_external"`
ToolConfigs []MCPToolConfig `json:"tool_configs,omitempty"`
}
PluginServerConfig describes an MCP server registered by another plugin.
type UpdateListener ¶
type UpdateListener func()
type WebSearchBraveConfig ¶
type WebSearchConfig ¶
type WebSearchConfig struct {
Enabled bool `json:"enabled"`
Provider string `json:"provider"`
Google WebSearchGoogleConfig `json:"google"`
Brave WebSearchBraveConfig `json:"brave"`
DomainDenylist []string `json:"domainDenylist"`
}