on main help sign in
fix: agent init
commitf2b9ed007c1fed6446697f7ceb746aea9d40c1e3 authorKujtim Hoxha <kujtimii.h@gmail.com> dateMon 14 Jul 2025, 20:05 (1 year ago) parent682aa79
4 files changed+35−33
internal/config/config.go+31 internal/config/load.go+1−33 internal/tui/components/chat/splash/splash.go+1 internal/tui/util/util.go+2
internal/config/config.go+31
@@ -371,3 +371,34 @@ func (c *Config) SetProviderAPIKey(providerID, apiKey string) error {
371371 c.Providers[providerID] = providerConfig
372372 return nil
373373}
374+
375+func (c *Config) SetupAgents() {
376+ agents := map[string]Agent{
377+ "coder": {
378+ ID: "coder",
379+ Name: "Coder",
380+ Description: "An agent that helps with executing coding tasks.",
381+ Model: SelectedModelTypeLarge,
382+ ContextPaths: c.Options.ContextPaths,
383+ // All tools allowed
384+ },
385+ "task": {
386+ ID: "task",
387+ Name: "Task",
388+ Description: "An agent that helps with searching for context and finding implementation details.",
389+ Model: SelectedModelTypeLarge,
390+ ContextPaths: c.Options.ContextPaths,
391+ AllowedTools: []string{
392+ "glob",
393+ "grep",
394+ "ls",
395+ "sourcegraph",
396+ "view",
397+ },
398+ // NO MCPs or LSPs by default
399+ AllowedMCP: map[string][]string{},
400+ AllowedLSP: []string{},
401+ },
402+ }
403+ c.Agents = agents
404+}
internal/config/load.go+1−33
@@ -83,37 +83,7 @@ func Load(workingDir string, debug bool) (*Config, error) {
8383 if err := cfg.configureSelectedModels(providers); err != nil {
8484 return nil, fmt.Errorf("failed to configure selected models: %w", err)
8585 }
86−
87− // TODO: remove the agents concept from the config
88− agents := map[string]Agent{
89− "coder": {
90− ID: "coder",
91− Name: "Coder",
92− Description: "An agent that helps with executing coding tasks.",
93− Model: SelectedModelTypeLarge,
94− ContextPaths: cfg.Options.ContextPaths,
95− // All tools allowed
96− },
97− "task": {
98− ID: "task",
99− Name: "Task",
100− Description: "An agent that helps with searching for context and finding implementation details.",
101− Model: SelectedModelTypeLarge,
102− ContextPaths: cfg.Options.ContextPaths,
103− AllowedTools: []string{
104− "glob",
105− "grep",
106− "ls",
107− "sourcegraph",
108− "view",
109− },
110− // NO MCPs or LSPs by default
111− AllowedMCP: map[string][]string{},
112− AllowedLSP: []string{},
113− },
114− }
115− cfg.Agents = agents
116−
86+ cfg.SetupAgents()
11787 return cfg, nil
11888}
11989
@@ -387,8 +357,6 @@ func (cfg *Config) configureSelectedModels(knownProviders []provider.Provider) e
387357 large.Provider = largeModelSelected.Provider
388358 }
389359 model := cfg.GetModel(large.Provider, large.Model)
390− slog.Info("Configuring selected large model", "provider", large.Provider, "model", large.Model)
391− slog.Info("Model configured", "model", model)
392360 if model == nil {
393361 large = defaultLarge
394362 // override the model type to large
internal/tui/components/chat/splash/splash.go+1
@@ -313,6 +313,7 @@ func (s *splashCmp) setPreferredModel(selectedItem models.ModelOption) tea.Cmd {
313313 return util.ReportError(err)
314314 }
315315 }
316+ cfg.SetupAgents()
316317 return nil
317318}
318319
internal/tui/util/util.go+2
@@ -1,6 +1,7 @@
11package util
22
33import (
4+ "log/slog"
45 "time"
56
67 tea "github.com/charmbracelet/bubbletea/v2"
@@ -22,6 +23,7 @@ func CmdHandler(msg tea.Msg) tea.Cmd {
2223}
2324
2425func ReportError(err error) tea.Cmd {
26+ slog.Error("Error reported", "error", err)
2527 return CmdHandler(InfoMsg{
2628 Type: InfoTypeError,
2729 Msg: err.Error(),