fix: pass ContextManagerConfig to factory in resolveContextManager

- Add ContextManagerConfig json.RawMessage field to AgentDefaults
- Pass al.cfg.Agents.Defaults.ContextManagerConfig to factory call
This commit is contained in:
Liu Yuan 2026-04-01 23:23:11 +08:00
parent 2ec15c7bc7
commit 318d2beda0
2 changed files with 19 additions and 18 deletions

View file

@ -2852,7 +2852,7 @@ func (al *AgentLoop) resolveContextManager() ContextManager {
})
return &legacyContextManager{al: al}
}
cm, err := factory(nil, al)
cm, err := factory(al.cfg.Agents.Defaults.ContextManagerConfig, al)
if err != nil {
logger.WarnCF("agent", "Failed to create context manager, falling back to legacy", map[string]any{
"name": name,

View file

@ -247,6 +247,7 @@ type AgentDefaults struct {
ToolFeedback ToolFeedbackConfig `json:"tool_feedback,omitempty"`
SplitOnMarker bool `json:"split_on_marker" env:"PICOCLAW_AGENTS_DEFAULTS_SPLIT_ON_MARKER"` // split messages on <|[SPLIT]|> marker
ContextManager string `json:"context_manager,omitempty" env:"PICOCLAW_AGENTS_DEFAULTS_CONTEXT_MANAGER"`
ContextManagerConfig json.RawMessage `json:"context_manager_config,omitempty" env:"PICOCLAW_AGENTS_DEFAULTS_CONTEXT_MANAGER_CONFIG"`
}
const DefaultMaxMediaSize = 20 * 1024 * 1024 // 20 MB