lmcli

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

func DataDir

func DataDir() string

func Fatal

func Fatal(format string, args ...any)

func InitErrorLog

func InitErrorLog()

InitErrorLog opens (or creates) the error log file. Safe to call multiple times — subsequent calls are no-ops.

func LogError

func LogError(err error, operation string)

LogError appends a timestamped JSON entry to the error log. If the log file is not initialized, it attempts to initialize it.

func Warn

func Warn(format string, args ...any)

Types

type AgentConfig

type AgentConfig struct {
	Name         string   `yaml:"name"`
	Code         bool     `yaml:"code"`
	SystemPrompt string   `yaml:"systemPrompt"`
	Tools        []string `yaml:"tools"`
}

type ChromaConfig

type ChromaConfig struct {
	Style     *string `yaml:"style" default:"onedark"`
	Formatter *string `yaml:"formatter" default:"terminal16m"`
}

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"`
	Sandbox       *sandbox.SandboxConfig `yaml:"sandbox"`
	TUI           *TUIConfig             `yaml:"tui"`
}

func NewConfig

func NewConfig(configFile string) (*Config, error)

func (*Config) HideHelpHint

func (c *Config) HideHelpHint() bool

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
}

func NewContext

func NewContext() (*Context, error)

func (*Context) DefaultReasoningEffort

func (c *Context) DefaultReasoningEffort() api.ReasoningEffort

func (*Context) DefaultSystemPrompt

func (c *Context) DefaultSystemPrompt() string

func (*Context) GetAgent

func (c *Context) GetAgent(name string) *api.Agent

func (*Context) GetAgents

func (c *Context) GetAgents() (agents []string)

func (*Context) GetAllModels

func (c *Context) GetAllModels() (models []string)

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

func (c *Context) GetCodeAgentName() string

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.

func (*Context) GetDefaultModel

func (c *Context) GetDefaultModel() (*api.Model, error)

func (*Context) LookupModel

func (c *Context) LookupModel(model string, providerName string) (*api.Model, error)

LookupModel resolves a model string (optionally with @provider suffix) to a runtime Model. The providerName parameter takes precedence over any @ suffix in the model string.

type ConversationsConfig

type ConversationsConfig struct {
	TitleGenerationModel  *string `yaml:"titleGenerationModel,omitempty"`
	TitleGenerationPrompt *string `yaml:"titleGenerationPrompt,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"`
	SystemPrompt     string   `yaml:"systemPrompt,omitempty"`
	SystemPromptFile string   `yaml:"systemPromptFile,omitempty"`
	Agent            string   `yaml:"agent,omitempty"`
	CodeAgent        string   `yaml:"codeAgent,omitempty"`
}

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 TUIConfig

type TUIConfig struct {
	HideHelpHint bool `yaml:"hideHelpHint"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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