Documentation
¶
Index ¶
- func ConvertProviders(in []ProviderConfig) []ai.ProviderConfig
- func MountLocalRoutes(r chi.Router)
- func Start(ctx context.Context) (int, error)
- func StartAPI(ctx context.Context, cfg ServerConfig) error
- func StartAPIWithExtensions(ctx context.Context, cfg ServerConfig, ...) error
- type AlertsConfig
- type ChannelsConfig
- type DiscordChannelConfig
- type ProviderConfig
- type ServerConfig
- type SignalChannelConfig
- type SlackChannelConfig
- type TelegramChannelConfig
- type ToolsConfig
- type WhatsAppChannelConfig
- type WorkspaceConfig
- type WorkspaceEntry
- type WorkspaceKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertProviders ¶
func ConvertProviders(in []ProviderConfig) []ai.ProviderConfig
ConvertProviders converts server YAML ProviderConfigs into ai.ProviderConfig entries suitable for registration with ai.Global.InjectConfigs.
func MountLocalRoutes ¶
MountLocalRoutes mounts the single-user local routes (session/channel streaming WebSockets, the LSP proxy, and inline completion) onto r. These are the loopback, no-auth routes shared by stdio (desktop/VSCode) mode and web mode. Callers add their own middleware, command bridge, and static UI.
func Start ¶
Start binds an HTTP server on a random free loopback port and returns the port. Used by stdio (desktop/VSCode) mode — loopback only, no auth. The server shuts down cleanly when ctx is cancelled.
func StartAPI ¶
func StartAPI(ctx context.Context, cfg ServerConfig) error
StartAPI binds the full REST + WebSocket API server on the configured address. Used by --serve mode. Blocks until ctx is cancelled.
func StartAPIWithExtensions ¶
func StartAPIWithExtensions(ctx context.Context, cfg ServerConfig, extRoutes func(r chi.Router, cfg ServerConfig)) error
StartAPIWithExtensions is identical to StartAPI but calls extRoutes(router, cfg) after all community routes are mounted, allowing callers (e.g. the pro binary) to add additional routes to the same server and port.
Types ¶
type AlertsConfig ¶
type AlertsConfig struct {
Webhook string `yaml:"webhook"`
}
AlertsConfig holds alert delivery settings.
type ChannelsConfig ¶
type ChannelsConfig struct {
Telegram TelegramChannelConfig `yaml:"telegram"`
Discord DiscordChannelConfig `yaml:"discord"`
Slack SlackChannelConfig `yaml:"slack"`
WhatsApp WhatsAppChannelConfig `yaml:"whatsapp"`
Signal SignalChannelConfig `yaml:"signal"`
}
ChannelsConfig holds settings for each inbound chat-platform gateway.
type DiscordChannelConfig ¶
type DiscordChannelConfig struct {
// Token is the bot token (include "Bot " prefix, e.g. "Bot MTI3...").
Token string `yaml:"token"`
WorkspaceID string `yaml:"workspace_id"`
AgentID string `yaml:"agent_id"`
Provider string `yaml:"provider"`
Model string `yaml:"model"`
ShellAutoAllow bool `yaml:"shell_auto_allow"`
// MentionOnly: when true, ignore guild-channel messages unless the bot is @mentioned.
MentionOnly bool `yaml:"mention_only"`
}
DiscordChannelConfig configures the Discord bot gateway.
type ProviderConfig ¶
type ProviderConfig struct {
ID string `yaml:"id"`
Type string `yaml:"type"`
Name string `yaml:"name"`
APIKey string `yaml:"api_key"`
Endpoint string `yaml:"endpoint"`
DefaultModel string `yaml:"default_model"`
Models []string `yaml:"models"`
// Enabled controls whether this provider is active. Uses a pointer so we
// can distinguish "not set" (nil, defaults to true) from "explicitly false".
// When omitted from YAML, the provider is enabled by default.
Enabled *bool `yaml:"enabled"`
}
ProviderConfig maps to an AI provider entry in the config file.
type ServerConfig ¶
type ServerConfig struct {
Port int `yaml:"port"`
Host string `yaml:"host"`
APIKeys []string `yaml:"api_keys"`
AllowedRoots []string `yaml:"allowed_roots"`
AllowRootFS bool `yaml:"allow_root_fs"`
Workspaces []WorkspaceConfig `yaml:"workspaces"`
Providers []ProviderConfig `yaml:"providers"`
Tools ToolsConfig `yaml:"tools"`
Alerts AlertsConfig `yaml:"alerts"`
Channels ChannelsConfig `yaml:"channels"`
// DefaultProvider pins which provider all channels use when no provider is
// specified in the individual channel config. Must match a provider ID in
// the providers list or ~/.tollecode/config.json.
DefaultProvider string `yaml:"default_provider"`
// DefaultModel overrides the provider's own default model for channel sessions.
DefaultModel string `yaml:"default_model"`
}
ServerConfig holds the full configuration for the API server mode.
func DefaultServerConfig ¶
func DefaultServerConfig() ServerConfig
DefaultServerConfig returns safe defaults.
func LoadConfig ¶
func LoadConfig(path string) (ServerConfig, error)
LoadConfig reads tollecode.yaml from the given path, expanding ${ENV_VAR} references in string values. Falls back to DefaultServerConfig on error.
func (ServerConfig) Addr ¶
func (c ServerConfig) Addr() string
Addr returns the TCP address to bind (e.g. "0.0.0.0:47821").
type SignalChannelConfig ¶
type SignalChannelConfig struct {
// PhoneNumber is the Signal account number registered with signal-cli.
PhoneNumber string `yaml:"phone_number"`
// CLIPath is the path to the signal-cli binary (default: "signal-cli").
CLIPath string `yaml:"cli_path"`
WorkspaceID string `yaml:"workspace_id"`
AgentID string `yaml:"agent_id"`
Provider string `yaml:"provider"`
Model string `yaml:"model"`
ShellAutoAllow bool `yaml:"shell_auto_allow"`
}
SignalChannelConfig configures the signal-cli gateway.
type SlackChannelConfig ¶
type SlackChannelConfig struct {
// BotToken is the xoxb-… OAuth token for posting messages.
BotToken string `yaml:"bot_token"`
// SigningSecret is used to verify X-Slack-Signature on incoming events.
SigningSecret string `yaml:"signing_secret"`
WorkspaceID string `yaml:"workspace_id"`
AgentID string `yaml:"agent_id"`
Provider string `yaml:"provider"`
Model string `yaml:"model"`
ShellAutoAllow bool `yaml:"shell_auto_allow"`
}
SlackChannelConfig configures the Slack Events API gateway.
type TelegramChannelConfig ¶
type TelegramChannelConfig struct {
Token string `yaml:"token"`
WorkspaceID string `yaml:"workspace_id"`
AgentID string `yaml:"agent_id"`
// Provider and Model pin a specific provider/model for this channel.
// Overrides the server-level default_provider / default_model.
Provider string `yaml:"provider"`
Model string `yaml:"model"`
ShellAutoAllow bool `yaml:"shell_auto_allow"`
// MentionOnly: when true, respond only when the bot is @mentioned in group chats.
MentionOnly bool `yaml:"mention_only"`
}
TelegramChannelConfig configures the Telegram bot gateway.
type ToolsConfig ¶
type ToolsConfig struct {
ShellAllowed bool `yaml:"shell_allowed"`
BrowserAllowed bool `yaml:"browser_allowed"`
}
ToolsConfig controls which tool categories are enabled server-wide.
type WhatsAppChannelConfig ¶
type WhatsAppChannelConfig struct {
// PhoneNumberID is the Meta phone number ID for the bot number.
PhoneNumberID string `yaml:"phone_number_id"`
// AccessToken is the Meta Cloud API bearer token used to send messages.
AccessToken string `yaml:"access_token"`
// AppSecret is the Meta App Secret used to verify X-Hub-Signature-256.
AppSecret string `yaml:"app_secret"`
// VerifyToken is the secret string used during webhook GET verification.
VerifyToken string `yaml:"verify_token"`
WorkspaceID string `yaml:"workspace_id"`
AgentID string `yaml:"agent_id"`
Provider string `yaml:"provider"`
Model string `yaml:"model"`
ShellAutoAllow bool `yaml:"shell_auto_allow"`
}
WhatsAppChannelConfig configures the Meta Cloud API gateway.
type WorkspaceConfig ¶
type WorkspaceConfig struct {
ID string `yaml:"id"`
Path string `yaml:"path"`
Name string `yaml:"name"`
}
WorkspaceConfig registers a named workspace path.
type WorkspaceEntry ¶
type WorkspaceEntry struct {
ID string `json:"id"`
Kind WorkspaceKind `json:"kind"`
Path string `json:"path,omitempty"` // local: directory path; remote: unused
Name string `json:"name"`
URL string `json:"url,omitempty"` // remote: server URL
APIKey string `json:"apiKey,omitempty"` // remote: server API key (stored for convenience)
CreatedAt string `json:"createdAt"`
}
WorkspaceEntry is a registered workspace. Kind is "local" or "remote". Local workspaces have a Path on this machine; remote workspaces have a URL pointing to an external server.
type WorkspaceKind ¶
type WorkspaceKind string
WorkspaceKind distinguishes local workspaces (directories on this machine) from remote workspaces (connections to external servers).
const ( WorkspaceLocal WorkspaceKind = "local" WorkspaceRemote WorkspaceKind = "remote" )
Source Files
¶
- api_state.go
- config.go
- cron_scheduler.go
- exports.go
- handlers_agents.go
- handlers_alerts.go
- handlers_autocomplete.go
- handlers_explain.go
- handlers_fs.go
- handlers_human_teams.go
- handlers_providers.go
- handlers_schedules.go
- handlers_sessions_api.go
- handlers_skills.go
- handlers_todos.go
- handlers_tools.go
- handlers_users.go
- handlers_workspaces.go
- middleware_auth.go
- middleware_user.go
- server.go
- todo_runner.go
- ws_channel.go
- ws_session.go