fix(agent): inject media store in isolation and fix config unmarshal panic
This commit is contained in:
parent
728a98c2f6
commit
9c2b440f1c
2 changed files with 30 additions and 27 deletions
|
|
@ -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
|
// Set its ID to match the routed agent so prompts and logs match
|
||||||
agent.ID = route.AgentID
|
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
|
// Re-register shared tools (web, message, spawn) to this transient agent
|
||||||
// We pass a mini-registry containing only this 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)
|
registerSharedTools(al, al.cfg, al.bus, &AgentRegistry{agents: map[string]*AgentInstance{agent.ID: agent}}, baseAgent.Provider)
|
||||||
|
|
|
||||||
|
|
@ -696,7 +696,7 @@ func (c *ModelConfig) UnmarshalJSON(data []byte) error {
|
||||||
type Alias ModelConfig
|
type Alias ModelConfig
|
||||||
aux := &struct {
|
aux := &struct {
|
||||||
APIKey string `json:"api_key"`
|
APIKey string `json:"api_key"`
|
||||||
APIKeys []string `json:"api_keys"`
|
APIKeys FlexibleStringSlice `json:"api_keys"`
|
||||||
*Alias
|
*Alias
|
||||||
}{
|
}{
|
||||||
Alias: (*Alias)(c),
|
Alias: (*Alias)(c),
|
||||||
|
|
@ -905,8 +905,8 @@ type SkillsToolsConfig struct {
|
||||||
Github SkillsGithubConfig `yaml:"github,omitempty" json:"github"`
|
Github SkillsGithubConfig `yaml:"github,omitempty" json:"github"`
|
||||||
MaxConcurrentSearches int `yaml:"-" json:"max_concurrent_searches" env:"PICOCLAW_TOOLS_SKILLS_MAX_CONCURRENT_SEARCHES"`
|
MaxConcurrentSearches int `yaml:"-" json:"max_concurrent_searches" env:"PICOCLAW_TOOLS_SKILLS_MAX_CONCURRENT_SEARCHES"`
|
||||||
SearchCache SearchCacheConfig `yaml:"-" json:"search_cache"`
|
SearchCache SearchCacheConfig `yaml:"-" json:"search_cache"`
|
||||||
Whitelist FlexibleStringSlice `json:"whitelist,omitempty" env:"PICOCLAW_TOOLS_SKILLS_WHITELIST"`
|
Whitelist FlexibleStringSlice `json:"whitelist,omitempty" yaml:"-" env:"PICOCLAW_TOOLS_SKILLS_WHITELIST"`
|
||||||
WhitelistEnabled bool `json:"whitelist_enabled,omitempty" env:"PICOCLAW_TOOLS_SKILLS_WHITELIST_ENABLED"`
|
WhitelistEnabled bool `json:"whitelist_enabled,omitempty" yaml:"-" env:"PICOCLAW_TOOLS_SKILLS_WHITELIST_ENABLED"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MediaCleanupConfig struct {
|
type MediaCleanupConfig struct {
|
||||||
|
|
@ -1273,7 +1273,7 @@ func MergeAPIKeys(apiKey string, apiKeys []string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, k := range apiKeys {
|
for _, k := range apiKeys {
|
||||||
if trimmed := strings.TrimSpace(k); trimmed != "" {
|
if trimmed := strings.TrimSpace(k); trimmed != "" && trimmed != "[NOT_HERE]" {
|
||||||
if _, exists := seen[trimmed]; !exists {
|
if _, exists := seen[trimmed]; !exists {
|
||||||
seen[trimmed] = struct{}{}
|
seen[trimmed] = struct{}{}
|
||||||
all = append(all, trimmed)
|
all = append(all, trimmed)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue