返回 DeepSeek-Reasonix
provider_snapshot.go
根目录 / internal / config / provider_snapshot.go
1 package config
2
3 import "reflect"
4
5 // ProviderEntryConfigSnapshot strips process-only state from a provider copy so
6 // optimistic edit logs contain only persisted configuration.
7 func ProviderEntryConfigSnapshot(entry ProviderEntry) ProviderEntry {
8 stripRuntimeReasoningDefaults(&entry)
9 entry.resolvedAPIKey = ""
10 entry.resolvedSource = CredentialSource{}
11 entry.visionOverride = nil
12 entry.persistedOfficialCurrency = ""
13 return entry
14 }
15
16 // ProviderEntriesConfigEqual compares persisted provider configuration while
17 // ignoring credentials and capability state resolved only for the current
18 // process. Setup uses it for optimistic conflict detection during replay.
19 func ProviderEntriesConfigEqual(a, b ProviderEntry) bool {
20 return reflect.DeepEqual(ProviderEntryConfigSnapshot(a), ProviderEntryConfigSnapshot(b))
21 }
22
22 lines GO