diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-05-13 04:02:20 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-05-13 04:02:20 +0000 |
| commit | 68399a598924775a3ec22a39c2336ae497fb07f3 (patch) | |
| tree | 29ade8224eb51eca47a1d9d03bb4d0d3653a72aa /internal/config/config.go | |
| parent | f01231cc45f41ce2dc37072e77428e467ef3fc15 (diff) | |
| parent | d970c0730ff0dc7d714d3261197d8ba52b5d21f4 (diff) | |
Merges 12 commits from github/main (formerly master) that were developed
independently. Key additions:
- LocalRunner: OpenAI-compatible local LLM execution (Ollama, LM Studio)
- Real GeminiRunner with full sandbox parity to ClaudeRunner
- llm.Client for enriching CI failures and elaboration via local model
- retry.ParseRetryAfter moved to shared package
- tokens_in/tokens_out columns in executions table
Conflict resolutions:
- Kept local main's VAPID/push, stories, projects, agent events schema
- Merged both sets of Config fields (local + LocalModel from github/main)
- Unified activePerAgent accounting (decActiveAgent helper)
- Removed duplicate helpers from claude.go (now in helpers.go)
- Fixed double-decrement bug in handleRunResult vs decActiveAgent
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/config/config.go')
| -rw-r--r-- | internal/config/config.go | 68 |
1 files changed, 49 insertions, 19 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 71258c1..25187cf 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -16,28 +16,58 @@ type Project struct { Dir string `toml:"dir"` } +// LocalModel configures an OpenAI-compatible local LLM endpoint used for +// internal helpers (classifier, elaboration, future summarization) and as +// the backend for the "local" runner. If Endpoint is empty, the LocalRunner +// is not registered and the classifier falls back to the Gemini CLI. +// +// PreferForElaborate gates whether the API server's elaboration handler +// uses this client. It defaults to true when Endpoint is set; users with a +// slow or low-quality local model can disable it. +type LocalModel struct { + Endpoint string `toml:"endpoint"` // e.g. "http://localhost:11434/v1" + Model string `toml:"model"` // e.g. "llama3.1:8b" + TimeoutSeconds int `toml:"timeout_seconds"` // default 60 + DefaultTemperature float64 `toml:"default_temperature"` // default 0.2 + APIKey string `toml:"api_key"` // optional bearer token + PreferForElaborate *bool `toml:"prefer_for_elaborate"` // pointer so default-true survives parse +} + +// UseForElaborate returns true when elaboration should try this local model +// before falling back to Claude/Gemini. Default is true when Endpoint is set. +func (m LocalModel) UseForElaborate() bool { + if m.Endpoint == "" { + return false + } + if m.PreferForElaborate == nil { + return true + } + return *m.PreferForElaborate +} + type Config struct { - DataDir string `toml:"data_dir"` - DBPath string `toml:"-"` - LogDir string `toml:"-"` - DropsDir string `toml:"-"` - SSHAuthSock string `toml:"ssh_auth_sock"` - ClaudeBinaryPath string `toml:"claude_binary_path"` - GeminiBinaryPath string `toml:"gemini_binary_path"` - ClaudeImage string `toml:"claude_image"` - GeminiImage string `toml:"gemini_image"` + DataDir string `toml:"data_dir"` + DBPath string `toml:"-"` + LogDir string `toml:"-"` + DropsDir string `toml:"-"` + SSHAuthSock string `toml:"ssh_auth_sock"` + ClaudeBinaryPath string `toml:"claude_binary_path"` + GeminiBinaryPath string `toml:"gemini_binary_path"` + ClaudeImage string `toml:"claude_image"` + GeminiImage string `toml:"gemini_image"` MaxConcurrent int `toml:"max_concurrent"` ShutdownTimeout time.Duration `toml:"shutdown_timeout"` - DefaultTimeout string `toml:"default_timeout"` - ServerAddr string `toml:"server_addr"` - WebhookURL string `toml:"webhook_url"` - WorkspaceRoot string `toml:"workspace_root"` - WebhookSecret string `toml:"webhook_secret"` - Projects []Project `toml:"projects"` - VAPIDPublicKey string `toml:"vapid_public_key"` - VAPIDPrivateKey string `toml:"vapid_private_key"` - VAPIDEmail string `toml:"vapid_email"` - ClaudeConfigDir string `toml:"claude_config_dir"` + DefaultTimeout string `toml:"default_timeout"` + ServerAddr string `toml:"server_addr"` + WebhookURL string `toml:"webhook_url"` + WorkspaceRoot string `toml:"workspace_root"` + WebhookSecret string `toml:"webhook_secret"` + Projects []Project `toml:"projects"` + VAPIDPublicKey string `toml:"vapid_public_key"` + VAPIDPrivateKey string `toml:"vapid_private_key"` + VAPIDEmail string `toml:"vapid_email"` + ClaudeConfigDir string `toml:"claude_config_dir"` + LocalModel LocalModel `toml:"local_model"` } func Default() (*Config, error) { |
