Documentation
¶
Index ¶
- func ConfigDir() string
- func DataDir() string
- func Fatal(format string, args ...any)
- func InitErrorLog()
- func LogError(err error, operation string)
- func Warn(format string, args ...any)
- type AgentConfig
- type ChromaConfig
- type Config
- type Context
- func (c *Context) Close()
- func (c *Context) DefaultReasoningEffort() api.ReasoningEffort
- func (c *Context) GetAgent(name string) *api.Agent
- func (c *Context) GetAgents() (agents []string)
- func (c *Context) GetAllModels() (models []string)
- func (c *Context) GetCodeAgentName() string
- func (c *Context) GetDefaultModel() (*api.Model, error)
- func (c *Context) LookupModel(model string, providerName string) (*api.Model, error)
- type ConversationsConfig
- type DefaultsConfig
- type GenerationConfig
- type ModelConfig
- type ProviderConfig
- type TUIConfig
- type ToolConfig
- type ToolEnvVar
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitErrorLog ¶
func InitErrorLog()
InitErrorLog opens (or creates) the error log file. Safe to call multiple times — subsequent calls are no-ops.
Types ¶
type AgentConfig ¶
type ChromaConfig ¶
type Config ¶
type Config struct {
Defaults *DefaultsConfig `yaml:"defaults"`
Conversations *ConversationsConfig `yaml:"conversations"`
Chroma *ChromaConfig `yaml:"chroma"`
Agents []*AgentConfig `yaml:"agents"`
Providers []*ProviderConfig `yaml:"providers"`
Tools []*ToolConfig `yaml:"tools"`
MCPServers []mcp.ServerConfig `yaml:"mcpServers"`
Sandbox *sandbox.SandboxConfig `yaml:"sandbox"`
TUI *TUIConfig `yaml:"tui"`
}
func LoadProjectConfig ¶ added in v0.7.0
LoadProjectConfig loads a project-level .lmcli.yaml from the current working directory. Returns nil, nil if the file does not exist.
func (*Config) HideHelpHint ¶
func (*Config) MergeProject ¶ added in v0.7.0
MergeProject merges project-level configuration into the main config. Agents, tools, and MCP servers from the project config must have names that do not conflict with existing ones. Sandbox config uses field-level merging: scalar fields override, slice fields append.
type Context ¶
type Context struct {
// global app configuration - read-only after startup
Config Config
Providers []api.Provider
Agents []api.Agent
Conversations conversation.Repo
Chroma render.ChromaHighlighter
MCPClients map[string]*mcp.Client
}
func NewContext ¶
func (*Context) Close ¶ added in v0.8.0
func (c *Context) Close()
Close shuts down all MCP client connections. Should be called when the application exits to cleanly terminate server processes (especially stdio).
func (*Context) DefaultReasoningEffort ¶
func (c *Context) DefaultReasoningEffort() api.ReasoningEffort
func (*Context) GetAllModels ¶
GetAllModels returns a string slice of *all* models: - All models are returned with the @provider suffix - Models with a unique name before the @provider are added without the suffix
func (*Context) GetCodeAgentName ¶
GetCodeAgentName returns the default code agent name from config, or the first agent marked as Code. Returns empty string if no code agent is configured.
type ConversationsConfig ¶
type ConversationsConfig struct {
TitleGeneration *GenerationConfig `yaml:"titleGeneration,omitempty"`
}
type DefaultsConfig ¶
type DefaultsConfig struct {
Model *string `yaml:"model" default:""`
MaxTokens *int `yaml:"maxTokens" default:"32768"`
Temperature *float32 `yaml:"temperature" default:"0.8"`
Effort *string `yaml:"effort" default:"medium"`
Agent string `yaml:"agent,omitempty"`
CodeAgent *string `yaml:"codeAgent,omitempty" default:"code"`
Permission *string `yaml:"permission" default:"none"`
}
type GenerationConfig ¶ added in v0.7.0
type GenerationConfig struct {
Model *string `yaml:"model,omitempty"`
MaxTokens *int `yaml:"maxTokens,omitempty"`
Effort *string `yaml:"effort,omitempty"`
Agent string `yaml:"agent,omitempty"`
}
GenerationConfig holds generation parameters that can be specified for specific tasks like title generation.
type ModelConfig ¶
type ModelConfig struct {
Name string `yaml:"name"`
MaxTokens *int `yaml:"maxTokens,omitempty"`
Temperature *float32 `yaml:"temperature,omitempty"`
}
ModelConfig represents a single model in a provider's configuration. It supports both shorthand (string) and expanded (map) YAML forms:
func (*ModelConfig) UnmarshalYAML ¶
func (m *ModelConfig) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements custom YAML unmarshaling for ModelEntry, supporting both string shorthand and full map forms.
type ProviderConfig ¶
type ProviderConfig struct {
Name string `yaml:"name,omitempty"`
Display string `yaml:"display,omitempty"`
Kind string `yaml:"kind"`
Style string `yaml:"style,omitempty"`
BaseURL string `yaml:"baseUrl,omitempty"`
APIKey string `yaml:"apiKey,omitempty"`
Headers map[string]string `yaml:"headers,omitempty"`
Models []ModelConfig `yaml:"models"`
}
type ToolConfig ¶ added in v0.7.0
type ToolConfig struct {
Name string `yaml:"name"`
Description string `yaml:"description,omitempty"`
Path string `yaml:"path,omitempty"`
Permission string `yaml:"permission,omitempty"` // read, write, exec
Environment []ToolEnvVar `yaml:"environment,omitempty"`
Parameters []api.ToolParameter `yaml:"parameters,omitempty"`
Config map[string]any `yaml:"config,omitempty"`
}