summaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go33
-rw-r--r--internal/config/config_test.go12
2 files changed, 31 insertions, 14 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 640e933..de087d6 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -25,12 +25,12 @@ type Project struct {
// 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
+ 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
@@ -56,20 +56,31 @@ type RunnersConfig struct {
Gemini *bool `toml:"gemini"`
Local *bool `toml:"local"`
Container *bool `toml:"container"`
+ // Anthropic gates the native provider.Provider-backed NativeRunner
+ // registered under agent type "anthropic" (internal/provider/anthropic).
+ // It is distinct from Claude, which gates the Docker/CLI-subprocess
+ // ContainerRunner for agent type "claude" — the two are separate
+ // execution paths (and separate budget buckets) even though both bill
+ // the same Anthropic account. Also requires [providers.anthropic].api_key
+ // to be set; Anthropic = true with no configured key has no effect.
+ Anthropic *bool `toml:"anthropic"`
}
func (r RunnersConfig) ClaudeEnabled() bool { return r.Claude == nil || *r.Claude }
func (r RunnersConfig) GeminiEnabled() bool { return r.Gemini == nil || *r.Gemini }
func (r RunnersConfig) LocalEnabled() bool { return r.Local == nil || *r.Local }
func (r RunnersConfig) ContainerEnabled() bool { return r.Container == nil || *r.Container }
+func (r RunnersConfig) AnthropicEnabled() bool { return r.Anthropic == nil || *r.Anthropic }
// ProviderConfig configures a native (or OpenAI-compatible) LLM provider
// backend for the multi-provider harness — see docs/api-keys-setup.md. Phase
-// 1 only adds this type so config has somewhere for it to land; it is not yet
-// read by runner construction (no native provider adapters exist yet besides
-// the openaicompat one LocalModel already configures). Keyed by provider name
-// in the [providers.<name>] TOML table, e.g. [providers.groq],
-// [providers.anthropic].
+// 1 added this type so config had somewhere for it to land, without being
+// read by runner construction. Phase 2 is the first consumer:
+// [providers.anthropic] (APIKey + optional Endpoint/DefaultModel/
+// TimeoutSeconds) wires internal/provider/anthropic.New into a NativeRunner
+// registered under agent type "anthropic" — see internal/cli/serve.go and
+// internal/cli/run.go. Keyed by provider name in the [providers.<name>] TOML
+// table, e.g. [providers.groq], [providers.anthropic].
type ProviderConfig struct {
Endpoint string `toml:"endpoint"`
APIKey string `toml:"api_key"`
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 6991354..f71b9cc 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -68,11 +68,14 @@ func TestRunnersConfig_DefaultsAllEnabled(t *testing.T) {
if !r.ContainerEnabled() {
t.Error("container should be enabled by default (nil)")
}
+ if !r.AnthropicEnabled() {
+ t.Error("anthropic should be enabled by default (nil)")
+ }
}
func TestRunnersConfig_ExplicitFalseDisables(t *testing.T) {
f := false
- r := RunnersConfig{Claude: &f, Gemini: &f, Local: &f, Container: &f}
+ r := RunnersConfig{Claude: &f, Gemini: &f, Local: &f, Container: &f, Anthropic: &f}
if r.ClaudeEnabled() {
t.Error("explicit false should disable claude")
}
@@ -85,12 +88,15 @@ func TestRunnersConfig_ExplicitFalseDisables(t *testing.T) {
if r.ContainerEnabled() {
t.Error("explicit false should disable container")
}
+ if r.AnthropicEnabled() {
+ t.Error("explicit false should disable anthropic")
+ }
}
func TestRunnersConfig_ExplicitTrueEnables(t *testing.T) {
tr := true
- r := RunnersConfig{Claude: &tr, Gemini: &tr, Local: &tr, Container: &tr}
- if !r.ClaudeEnabled() || !r.GeminiEnabled() || !r.LocalEnabled() || !r.ContainerEnabled() {
+ r := RunnersConfig{Claude: &tr, Gemini: &tr, Local: &tr, Container: &tr, Anthropic: &tr}
+ if !r.ClaudeEnabled() || !r.GeminiEnabled() || !r.LocalEnabled() || !r.ContainerEnabled() || !r.AnthropicEnabled() {
t.Error("explicit true should keep all runners enabled")
}
}