This commit is contained in:
2026-06-09 21:19:30 +08:00
parent 8b41ff9360
commit 0484e79978
66 changed files with 4043 additions and 533 deletions
+6 -4
View File
@@ -197,14 +197,15 @@ type AcpConfig struct {
EventTruncateField int `mapstructure:"event_truncate_field_bytes"`
EventRetentionDays int `mapstructure:"event_retention_days"`
ShutdownGrace time.Duration `mapstructure:"shutdown_grace"`
PermissionTimeout time.Duration `mapstructure:"permission_timeout"`
}
// MCPConfig 控制 MCP 模块的开关、对外 URL(注入 ACP 子进程 env)、system token TTL 与速率限制。
type MCPConfig struct {
Enabled bool `mapstructure:"enabled"`
PublicURL string `mapstructure:"public_url"`
SystemTokenTTL time.Duration `mapstructure:"system_token_ttl"`
RateLimit MCPRateLimitCfg `mapstructure:"rate_limit"`
Enabled bool `mapstructure:"enabled"`
PublicURL string `mapstructure:"public_url"`
SystemTokenTTL time.Duration `mapstructure:"system_token_ttl"`
RateLimit MCPRateLimitCfg `mapstructure:"rate_limit"`
}
// MCPRateLimitCfg 控制 token bucket 容量。两层独立桶:per-token + 全局。
@@ -278,6 +279,7 @@ func Load(configFile string) (*Config, error) {
v.SetDefault("acp.event_truncate_field_bytes", 4096)
v.SetDefault("acp.event_retention_days", 7)
v.SetDefault("acp.shutdown_grace", "30s")
v.SetDefault("acp.permission_timeout", "5m")
v.SetDefault("mcp.enabled", true)
v.SetDefault("mcp.public_url", "http://localhost:8080/mcp")
v.SetDefault("mcp.system_token_ttl", "24h")