Rate limits: - Add PoolRPS/PoolTPM/PoolTokensMonth/PoolCostMonth pool kinds - Provider defaults for Mistral/Anthropic/OpenAI/Google (tier-aware) - Config override via [rate_limits.<provider>] TOML section - Pools auto-attached to arms on registration Elf tree view (CC-style): - Structured elf.Progress type replaces flat string channel - Tree with ├─/└─ branches, per-elf stats (tool uses, tokens) - Live activity updates: tool calls, "generating… (N chars)" - Completed elfs stay in tree with "Done (duration)" until turn ends - Suppress raw elf output from chat (tree + LLM summary instead) - Remove background elf mode (wait: false) — always wait - Truncate elf results to 2000 chars for parent context - Parallel hint in system prompt and tool description Permission prompts: - Show actual command in prompt: "bash wants to execute: find . -name '*.go'" - Compact hint in separator bar: "⚠ bash: find . | wc -l [y/n]" - PermReqMsg carries tool name + args Other: - Fix /model not updating status bar (session.Local.SetModel) - Add make targets: run, check, install - Update deps: BurntSushi/toml v1.6.0, chroma v2.23.1, x/text v0.35.0, cloud.google.com/go v0.123.0
81 lines
2.0 KiB
Go
81 lines
2.0 KiB
Go
package config
|
|
|
|
import "time"
|
|
|
|
// Config is the top-level configuration.
|
|
type Config struct {
|
|
Provider ProviderSection `toml:"provider"`
|
|
Permission PermissionSection `toml:"permission"`
|
|
Tools ToolsSection `toml:"tools"`
|
|
RateLimits RateLimitSection `toml:"rate_limits"`
|
|
}
|
|
|
|
type PermissionSection struct {
|
|
Mode string `toml:"mode"`
|
|
Rules []PermissionRule `toml:"rules"`
|
|
}
|
|
|
|
type PermissionRule struct {
|
|
Tool string `toml:"tool"`
|
|
Pattern string `toml:"pattern"`
|
|
Action string `toml:"action"`
|
|
}
|
|
|
|
type ProviderSection struct {
|
|
Default string `toml:"default"`
|
|
Model string `toml:"model"`
|
|
MaxTokens int64 `toml:"max_tokens"`
|
|
Temperature *float64 `toml:"temperature"`
|
|
APIKeys map[string]string `toml:"api_keys"`
|
|
Endpoints map[string]string `toml:"endpoints"`
|
|
}
|
|
|
|
type ToolsSection struct {
|
|
BashTimeout Duration `toml:"bash_timeout"`
|
|
MaxFileSize int64 `toml:"max_file_size"`
|
|
}
|
|
|
|
// RateLimitSection allows overriding default rate limits per provider.
|
|
//
|
|
// Example config:
|
|
//
|
|
// [rate_limits.mistral]
|
|
// tier = "starter"
|
|
// rps = 1
|
|
// spend_cap = 20.0
|
|
//
|
|
// [rate_limits.anthropic]
|
|
// tier = "tier2"
|
|
// rpm = 1000
|
|
// itpm = 450000
|
|
// otpm = 90000
|
|
type RateLimitSection map[string]RateLimitOverride
|
|
|
|
type RateLimitOverride struct {
|
|
Tier string `toml:"tier"`
|
|
RPS float64 `toml:"rps"`
|
|
RPM int `toml:"rpm"`
|
|
RPD int `toml:"rpd"`
|
|
TPM int `toml:"tpm"`
|
|
ITPM int `toml:"itpm"`
|
|
OTPM int `toml:"otpm"`
|
|
TokensMonth int64 `toml:"tokens_month"`
|
|
SpendCap float64 `toml:"spend_cap"`
|
|
}
|
|
|
|
// Duration wraps time.Duration for TOML string parsing (e.g. "30s", "5m").
|
|
type Duration time.Duration
|
|
|
|
func (d *Duration) UnmarshalText(text []byte) error {
|
|
parsed, err := time.ParseDuration(string(text))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*d = Duration(parsed)
|
|
return nil
|
|
}
|
|
|
|
func (d Duration) Duration() time.Duration {
|
|
return time.Duration(d)
|
|
}
|