From 33057e885f75fee156cc3f81409d22d3c46218ed Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Fri, 8 May 2026 12:43:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(config):=20add=20jobs.mcp=5Ftokens=5Fpurge?= =?UTF-8?q?=20config=20(spec=20=C2=A76.6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Default: enabled=true, interval=24h, retention=168h (7 days). Co-Authored-By: Claude Opus 4.6 --- config.example.yaml | 4 ++++ internal/config/config.go | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/config.example.yaml b/config.example.yaml index 6bdcef4..1e5439a 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -102,6 +102,10 @@ jobs: enabled: true interval: 24h retention: 168h # 7 天 + mcp_tokens_purge: + enabled: true + interval: 24h + retention: 168h # 7 days # 通知通道配置 notify: diff --git a/internal/config/config.go b/internal/config/config.go index ada24b6..0b09e89 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -122,6 +122,7 @@ type JobsConfig struct { JobReaper JobReaperCfg `mapstructure:"job_reaper"` JobPurge JobPurgeCfg `mapstructure:"job_purge"` AcpEventsPurge AcpEventsPurgeCfg `mapstructure:"acp_events_purge"` + MCPTokensPurge MCPTokensPurgeCfg `mapstructure:"mcp_tokens_purge"` } type RunnerCfg struct { @@ -160,6 +161,12 @@ type AcpEventsPurgeCfg struct { Retention time.Duration `mapstructure:"retention"` } +type MCPTokensPurgeCfg struct { + Enabled bool `mapstructure:"enabled"` + Interval time.Duration `mapstructure:"interval"` + Retention time.Duration `mapstructure:"retention"` +} + // NotifyConfig 是 notify 模块的可选外发通道配置。当前仅 webhook。 type NotifyConfig struct { Webhook WebhookCfg `mapstructure:"webhook"` @@ -252,6 +259,9 @@ func Load(configFile string) (*Config, error) { v.SetDefault("jobs.acp_events_purge.enabled", true) v.SetDefault("jobs.acp_events_purge.interval", "24h") v.SetDefault("jobs.acp_events_purge.retention", "168h") + v.SetDefault("jobs.mcp_tokens_purge.enabled", true) + v.SetDefault("jobs.mcp_tokens_purge.interval", "24h") + v.SetDefault("jobs.mcp_tokens_purge.retention", "168h") v.SetDefault("notify.webhook.enabled", false) v.SetDefault("notify.webhook.timeout", "10s") v.SetDefault("acp.enabled", true)