feat: provider manager, cancellation, session summaries (store+agent)

This commit is contained in:
OpenClaw Dev 2026-10-25 04:46:40 +01:00
parent 406a523d54
commit f1b2093b22
10 changed files with 883 additions and 37 deletions

View file

@ -20,12 +20,32 @@ type LLM struct {
Model string `yaml:"model" json:"model"`
TimeoutSec int `yaml:"timeout_sec" json:"timeout_sec"`
Temperature float64 `yaml:"temperature" json:"temperature"`
// Providers holds optional per-preset settings (keys stay server-side) so the
// active provider can be switched at runtime, e.g. providers: {dahl: {api_key: ...}}.
Providers map[string]ProviderOverride `yaml:"providers" json:"providers"`
}
type ProviderOverride struct {
BaseURL string `yaml:"base_url" json:"base_url"`
APIKey string `yaml:"api_key" json:"api_key"`
Model string `yaml:"model" json:"model"`
}
type Agent struct {
SystemPrompt string `yaml:"system_prompt" json:"system_prompt"`
MaxIterations int `yaml:"max_iterations" json:"max_iterations"`
HistoryLimit int `yaml:"history_limit" json:"history_limit"`
SystemPrompt string `yaml:"system_prompt" json:"system_prompt"`
MaxIterations int `yaml:"max_iterations" json:"max_iterations"`
HistoryLimit int `yaml:"history_limit" json:"history_limit"`
Summarize Summarize `yaml:"summarize" json:"summarize"`
}
// Summarize controls automatic summarisation of long sessions.
type Summarize struct {
Enabled bool `yaml:"enabled" json:"enabled"`
// Summarise when unsummarised messages exceed MaxMessages or ~MaxTokens (chars/4).
MaxMessages int `yaml:"max_messages" json:"max_messages"`
MaxTokens int `yaml:"max_tokens" json:"max_tokens"`
// KeepRecent newest messages always stay verbatim.
KeepRecent int `yaml:"keep_recent" json:"keep_recent"`
}
type WebFetch struct {
@ -80,6 +100,7 @@ func Default() Config {
SystemPrompt: "You are ByteClaw, a concise and helpful self-hosted assistant. Use tools when they help.",
MaxIterations: 8,
HistoryLimit: 50,
Summarize: Summarize{Enabled: true, MaxMessages: 40, MaxTokens: 12000, KeepRecent: 10},
},
Tools: Tools{
WebFetch: WebFetch{Enabled: true, MaxBytes: 512 * 1024, TimeoutSec: 15},