config

package
v0.15.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MCPTransportStdio          = "stdio"
	MCPTransportStreamableHTTP = "streamable_http"
	MCPTransportSSE            = "sse"
	MCPTransportWebSocket      = "websocket"
)
View Source
const (
	MCPAuthModeNone   = "none"
	MCPAuthModeBearer = "bearer"
	MCPAuthModeOAuth  = "oauth"
)
View Source
const DefaultConfigFilename = "config/standalone.yaml"

Variables

This section is empty.

Functions

func ConfigToMap added in v0.14.0

func ConfigToMap(cfg Config) map[string]any

ConfigToMap converts a Config to a flat map keyed by YAML keys.

func DefaultWorkspaceDir added in v0.15.2

func DefaultWorkspaceDir() string

DefaultWorkspaceDir returns the default workspace directory (~/.tars/workspace).

func FixedConfigPath added in v0.15.2

func FixedConfigPath() string

FixedConfigPath returns the fixed config file path (~/.tars/config/config.yaml). This path is not user-overridable; all commands use it.

func LoadRaw added in v0.14.0

func LoadRaw(path string) ([]byte, error)

LoadRaw reads the raw content of the config file at the given path.

func MCPServerEnabled added in v0.11.0

func MCPServerEnabled(server MCPServer) bool

func MCPServerIsRemote added in v0.11.0

func MCPServerIsRemote(server MCPServer) bool

func PatchYAML added in v0.14.0

func PatchYAML(path string, updates map[string]any) error

PatchYAML reads the YAML file at path, merges the given key-value updates, and writes the result back. Unknown keys are ignored.

func ResolveConfigPath

func ResolveConfigPath(raw string) string

func SaveRaw added in v0.14.0

func SaveRaw(path string, content []byte) error

SaveRaw writes raw content to the config file at the given path. It validates that the content is valid YAML before writing.

func TarsHomeDir added in v0.15.2

func TarsHomeDir() string

TarsHomeDir returns the base directory for TARS data (~/.tars).

Types

type APIConfig added in v0.6.0

type APIConfig struct {
	APIAuthMode               string
	DashboardAuthMode         string
	APIAuthToken              string
	APIUserToken              string
	APIAdminToken             string
	APIAllowInsecureLocalAuth bool
	APIMaxInflightChat        int
	APIMaxInflightAgentRuns   int
}

type AssistantConfig added in v0.6.0

type AssistantConfig struct {
	AssistantEnabled    bool
	AssistantHotkey     string
	AssistantWhisperBin string
	AssistantFFmpegBin  string
	AssistantTTSBin     string
}

type AutomationConfig added in v0.6.0

type AutomationConfig struct {
	AgentMaxIterations   int
	HeartbeatInterval    string
	HeartbeatActiveHours string
	HeartbeatTimezone    string
	CronRunHistoryLimit  int
	NotifyCommand        string
	NotifyWhenNoClients  bool
	ScheduleTimezone     string
}

type BrowserConfig added in v0.6.0

type BrowserConfig struct {
	BrowserRuntimeEnabled         bool
	BrowserDefaultProfile         string
	BrowserManagedHeadless        bool
	BrowserManagedExecutablePath  string
	BrowserManagedUserDataDir     string
	BrowserSiteFlowsDir           string
	BrowserAutoLoginSiteAllowlist []string
}

type ChannelConfig added in v0.6.0

type ChannelConfig struct {
	ChannelsLocalEnabled           bool
	ChannelsWebhookEnabled         bool
	ChannelsTelegramEnabled        bool
	ChannelsTelegramDMPolicy       string
	ChannelsTelegramPollingEnabled bool
	TelegramBotToken               string
}

type Config

Config holds top-level runtime settings grouped by concern.

func Default

func Default() Config

Default returns safe baseline settings for local standalone execution.

func Load

func Load(path string) (Config, error)

Load resolves runtime settings with the following precedence: defaults < YAML file < environment variables.

type ExtensionConfig added in v0.6.0

type ExtensionConfig struct {
	SkillsEnabled          bool
	SkillsWatch            bool
	SkillsWatchDebounceMS  int
	SkillsExtraDirs        []string
	SkillsBundledDir       string
	PluginsEnabled         bool
	PluginsWatch           bool
	PluginsWatchDebounceMS int
	PluginsExtraDirs       []string
	PluginsBundledDir      string
	PluginsAllowMCPServers bool
	MCPServers             []MCPServer
	MCPCommandAllowlist    []string
}

type FieldMeta added in v0.14.0

type FieldMeta struct {
	Key         string   `json:"key"`
	Section     string   `json:"section"`
	Type        string   `json:"type"` // "string", "int", "float", "bool", "json"
	Label       string   `json:"label"`
	Description string   `json:"description"`
	Sensitive   bool     `json:"sensitive,omitempty"`
	Options     []string `json:"options,omitempty"`
}

FieldMeta describes a single configuration field for UI rendering.

func Schema added in v0.14.0

func Schema() []FieldMeta

Schema returns metadata for all configuration fields, grouped for UI display.

type GatewayAgent

type GatewayAgent struct {
	Name           string            `json:"name"`
	Description    string            `json:"description,omitempty"`
	Command        string            `json:"command"`
	Args           []string          `json:"args,omitempty"`
	Env            map[string]string `json:"env,omitempty"`
	WorkingDir     string            `json:"working_dir,omitempty"`
	TimeoutSeconds int               `json:"timeout_seconds,omitempty"`
	Enabled        bool              `json:"enabled,omitempty"`
}

type GatewayConfig added in v0.6.0

type GatewayConfig struct {
	GatewayEnabled                       bool
	GatewayDefaultAgent                  string
	GatewayAgents                        []GatewayAgent
	GatewayAgentsWatch                   bool
	GatewayAgentsWatchDebounceMS         int
	GatewayPersistenceEnabled            bool
	GatewayRunsPersistenceEnabled        bool
	GatewayChannelsPersistenceEnabled    bool
	GatewayRunsMaxRecords                int
	GatewayChannelsMaxMessagesPerChannel int
	GatewaySubagentsMaxThreads           int
	GatewaySubagentsMaxDepth             int
	GatewayPersistenceDir                string
	GatewayRestoreOnStartup              bool
	GatewayReportSummaryEnabled          bool
	GatewayArchiveEnabled                bool
	GatewayArchiveDir                    string
	GatewayArchiveRetentionDays          int
	GatewayArchiveMaxFileBytes           int
}

type LLMConfig added in v0.6.0

type LLMConfig struct {
	LLMProvider        string
	LLMAuthMode        string
	LLMOAuthProvider   string
	LLMBaseURL         string
	LLMAPIKey          string
	LLMModel           string
	LLMReasoningEffort string
	LLMThinkingBudget  int
	LLMServiceTier     string
}

type MCPServer

type MCPServer struct {
	Name          string            `json:"name"`
	Command       string            `json:"command,omitempty"`
	Args          []string          `json:"args,omitempty"`
	Env           map[string]string `json:"env,omitempty"`
	Transport     string            `json:"transport,omitempty"`
	URL           string            `json:"url,omitempty"`
	Headers       map[string]string `json:"headers,omitempty"`
	AuthMode      string            `json:"auth_mode,omitempty"`
	AuthTokenEnv  string            `json:"auth_token_env,omitempty"`
	OAuthProvider string            `json:"oauth_provider,omitempty"`
	Source        string            `json:"source,omitempty"`
}

func NormalizeMCPServer added in v0.11.0

func NormalizeMCPServer(server MCPServer) MCPServer

type MemoryConfig added in v0.6.0

type MemoryConfig struct {
	MemorySemanticEnabled bool
	MemoryEmbedProvider   string
	MemoryEmbedBaseURL    string
	MemoryEmbedAPIKey     string
	MemoryEmbedModel      string
	MemoryEmbedDimensions int
}

type RuntimeConfig added in v0.6.0

type RuntimeConfig struct {
	Mode                 string
	WorkspaceDir         string
	SessionDefaultID     string
	SessionTelegramScope string
	LogLevel             string
	LogFile              string
	LogRotateMaxSizeMB   int
	LogRotateMaxDays     int
	LogRotateMaxBackups  int
}

type ToolConfig added in v0.6.0

type ToolConfig struct {
	ToolsWebSearchEnabled             bool
	ToolsWebFetchEnabled              bool
	ToolsDefaultSet                   string
	ToolsAllowHighRiskUser            bool
	ToolsWebSearchAPIKey              string
	ToolsWebSearchProvider            string
	ToolsWebSearchPerplexityAPIKey    string
	ToolsWebSearchPerplexityModel     string
	ToolsWebSearchPerplexityBaseURL   string
	ToolsWebSearchCacheTTLSeconds     int
	ToolsWebFetchPrivateHostAllowlist []string
	ToolsWebFetchAllowPrivateHosts    bool
	ToolsApplyPatchEnabled            bool
	ToolsMessageEnabled               bool
	ToolsBrowserEnabled               bool
	ToolsNodesEnabled                 bool
	ToolsGatewayEnabled               bool
}

type UsageConfig added in v0.6.0

type UsageConfig struct {
	UsageLimitDailyUSD   float64
	UsageLimitWeeklyUSD  float64
	UsageLimitMonthlyUSD float64
	UsageLimitMode       string
	UsagePriceOverrides  map[string]UsagePrice
}

type UsagePrice

type UsagePrice struct {
	InputPer1MUSD      float64 `json:"input_per_1m_usd"`
	OutputPer1MUSD     float64 `json:"output_per_1m_usd"`
	CacheReadPer1MUSD  float64 `json:"cache_read_per_1m_usd,omitempty"`
	CacheWritePer1MUSD float64 `json:"cache_write_per_1m_usd,omitempty"`
}

type VaultConfig added in v0.6.0

type VaultConfig struct {
	VaultEnabled             bool
	VaultAddr                string
	VaultAuthMode            string
	VaultToken               string
	VaultNamespace           string
	VaultTimeoutMS           int
	VaultKVMount             string
	VaultKVVersion           int
	VaultAppRoleMount        string
	VaultAppRoleRoleID       string
	VaultAppRoleSecretID     string
	VaultSecretPathAllowlist []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL