| 1 | package config |
| 2 | |
| 3 | import ( |
| 4 | "crypto/sha256" |
| 5 | "fmt" |
| 6 | ) |
| 7 | |
| 8 | // ModelCapabilitySnapshot identifies image routing across the configured models, |
| 9 | // including potential image-understanding fallbacks. It is never provider-visible. |
| 10 | func ModelCapabilitySnapshot(cfg *Config, resolver *ModelCapabilityResolver) string { |
| 11 | h := sha256.New() |
| 12 | credentialsRevision := resolver.credentialRevision() |
| 13 | _, _ = fmt.Fprintf(h, "%q", cfg.Agent.VisionModel) |
| 14 | for _, entry := range cfg.Providers { |
| 15 | _, _ = fmt.Fprintf(h, "%q", resolver.providerFingerprintForCredentialRevision(entry, credentialsRevision)) |
| 16 | for _, model := range entry.ModelList() { |
| 17 | selected := entry |
| 18 | selected.Model = model |
| 19 | capability := resolver.resolveWithCredentialRevision(&selected, credentialsRevision) |
| 20 | _, _ = fmt.Fprintf(h, "%q:%q", model, capability.State) |
| 21 | } |
| 22 | } |
| 23 | return fmt.Sprintf("%x", h.Sum(nil)) |
| 24 | } |
| 25 |