fix(agent): inject media store in isolation and fix config unmarshal panic

This commit is contained in:
stevef 2026-03-27 17:52:29 +01:00
parent 728a98c2f6
commit 9c2b440f1c
2 changed files with 30 additions and 27 deletions

View file

@ -1372,6 +1372,9 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
// Set its ID to match the routed agent so prompts and logs match
agent.ID = route.AgentID
// Inject media store so tools (like send_file) can function
agent.Tools.SetMediaStore(al.mediaStore)
// Re-register shared tools (web, message, spawn) to this transient agent
// We pass a mini-registry containing only this agent
registerSharedTools(al, al.cfg, al.bus, &AgentRegistry{agents: map[string]*AgentInstance{agent.ID: agent}}, baseAgent.Provider)

View file

@ -696,7 +696,7 @@ func (c *ModelConfig) UnmarshalJSON(data []byte) error {
type Alias ModelConfig
aux := &struct {
APIKey string `json:"api_key"`
APIKeys []string `json:"api_keys"`
APIKeys FlexibleStringSlice `json:"api_keys"`
*Alias
}{
Alias: (*Alias)(c),
@ -905,8 +905,8 @@ type SkillsToolsConfig struct {
Github SkillsGithubConfig `yaml:"github,omitempty" json:"github"`
MaxConcurrentSearches int `yaml:"-" json:"max_concurrent_searches" env:"PICOCLAW_TOOLS_SKILLS_MAX_CONCURRENT_SEARCHES"`
SearchCache SearchCacheConfig `yaml:"-" json:"search_cache"`
Whitelist FlexibleStringSlice `json:"whitelist,omitempty" env:"PICOCLAW_TOOLS_SKILLS_WHITELIST"`
WhitelistEnabled bool `json:"whitelist_enabled,omitempty" env:"PICOCLAW_TOOLS_SKILLS_WHITELIST_ENABLED"`
Whitelist FlexibleStringSlice `json:"whitelist,omitempty" yaml:"-" env:"PICOCLAW_TOOLS_SKILLS_WHITELIST"`
WhitelistEnabled bool `json:"whitelist_enabled,omitempty" yaml:"-" env:"PICOCLAW_TOOLS_SKILLS_WHITELIST_ENABLED"`
}
type MediaCleanupConfig struct {
@ -1273,7 +1273,7 @@ func MergeAPIKeys(apiKey string, apiKeys []string) []string {
}
for _, k := range apiKeys {
if trimmed := strings.TrimSpace(k); trimmed != "" {
if trimmed := strings.TrimSpace(k); trimmed != "" && trimmed != "[NOT_HERE]" {
if _, exists := seen[trimmed]; !exists {
seen[trimmed] = struct{}{}
all = append(all, trimmed)