feat: expand node artifact operations and retention

This commit is contained in:
lpf
2026-03-09 10:46:22 +08:00
parent be2e025fe5
commit ba3be33c91
22 changed files with 2724 additions and 151 deletions

View File

@@ -295,7 +295,9 @@ type GatewayConfig struct {
}
type GatewayNodesConfig struct {
P2P GatewayNodesP2PConfig `json:"p2p,omitempty"`
P2P GatewayNodesP2PConfig `json:"p2p,omitempty"`
Dispatch GatewayNodesDispatchConfig `json:"dispatch,omitempty"`
Artifacts GatewayNodesArtifactsConfig `json:"artifacts,omitempty"`
}
type GatewayICEConfig struct {
@@ -311,6 +313,25 @@ type GatewayNodesP2PConfig struct {
ICEServers []GatewayICEConfig `json:"ice_servers,omitempty"`
}
type GatewayNodesDispatchConfig struct {
PreferLocal bool `json:"prefer_local,omitempty"`
PreferP2P bool `json:"prefer_p2p,omitempty"`
AllowRelayFallback bool `json:"allow_relay_fallback,omitempty"`
ActionTags map[string][]string `json:"action_tags,omitempty"`
AgentTags map[string][]string `json:"agent_tags,omitempty"`
AllowActions map[string][]string `json:"allow_actions,omitempty"`
DenyActions map[string][]string `json:"deny_actions,omitempty"`
AllowAgents map[string][]string `json:"allow_agents,omitempty"`
DenyAgents map[string][]string `json:"deny_agents,omitempty"`
}
type GatewayNodesArtifactsConfig struct {
Enabled bool `json:"enabled,omitempty"`
KeepLatest int `json:"keep_latest,omitempty"`
RetainDays int `json:"retain_days,omitempty"`
PruneOnRead bool `json:"prune_on_read,omitempty"`
}
type CronConfig struct {
MinSleepSec int `json:"min_sleep_sec" env:"CLAWGO_CRON_MIN_SLEEP_SEC"`
MaxSleepSec int `json:"max_sleep_sec" env:"CLAWGO_CRON_MAX_SLEEP_SEC"`
@@ -559,6 +580,23 @@ func DefaultConfig() *Config {
STUNServers: []string{},
ICEServers: []GatewayICEConfig{},
},
Dispatch: GatewayNodesDispatchConfig{
PreferLocal: false,
PreferP2P: true,
AllowRelayFallback: true,
ActionTags: map[string][]string{},
AgentTags: map[string][]string{},
AllowActions: map[string][]string{},
DenyActions: map[string][]string{},
AllowAgents: map[string][]string{},
DenyAgents: map[string][]string{},
},
Artifacts: GatewayNodesArtifactsConfig{
Enabled: false,
KeepLatest: 500,
RetainDays: 7,
PruneOnRead: true,
},
},
},
Cron: CronConfig{