roleKeyNames function

Set<String> roleKeyNames(
  1. ModelRolesConfig rolesConfig
)

The explicit apiKeyNames referenced by a roles config (the secure-store preload set; the catalog names are always preloaded), plus the endpoint-scoped FA_KEY_<HOST> slot of every chain entry pinned to a custom endpoint (gh-1000 AC5 — the same source a manual provider switch resolves; the catalog env names describe default endpoints only).

Implementation

Set<String> roleKeyNames(ModelRolesConfig rolesConfig) {
  final refs = [
    for (final chain in rolesConfig.roles.values) ...chain,
    for (final override in rolesConfig.pathOverrides)
      for (final chain in override.roles.values) ...chain,
  ];
  return {
    for (final ref in refs) ...[
      if (ref.apiKeyName != null) ref.apiKeyName!,
      if (_refNeedsEndpointSlot(ref))
        CustomProviderRegistry.keyNameFor(ref.baseUrl!),
    ],
  };
}