resolveKey method
Resolves the effective key-slot name for provider/baseUrl. The
model argument is accepted for call-site symmetry with host config
shapes; slot selection keys on provider + endpoint only (a model
never has its own slot). envNames and defaultBaseUrl are the
catalog facts — omit them (the defaults) and resolution is
store-only, so the env-name leg can never hijack a custom endpoint.
activeCustomKeyName is the active custom registry entry's own slot,
when the host tracks one.
Implementation
HostKeyResolution resolveKey({
String? provider,
required String baseUrl,
String? model,
List<String> envNames = const [],
String? defaultBaseUrl,
String? activeCustomKeyName,
}) {
// The HOST-scoped canonical (no provider-name suffix) — the same slot
// resolveEndpointKeyName probes, so the drift comparison is
// like-for-like.
final canonical = CustomProviderRegistry.keyNameFor(baseUrl);
final chained = resolveEndpointKeyName(
envNames: envNames,
defaultBaseUrl: defaultBaseUrl,
baseUrl: baseUrl,
envRead: envRead,
storeRead: storeRead,
activeCustomKeyName: activeCustomKeyName,
);
final name = _effectiveSlotName(canonical, chained);
return HostKeyResolution(
slotName: name,
fromEnv: _isEnvResolution(name, chained, envNames),
canonicalName: canonical,
driftHint: _driftHint(name, canonical),
missingKeyHint: _missingKeyHint(name, provider, baseUrl, canonical),
);
}