seedProviderTuning function

void seedProviderTuning({
  1. List<CustomProviderEntry>? customProviders,
  2. Map<String, CustomModelDefinition>? customModels,
  3. List<ModelRef>? roleRefs,
  4. List<ProviderQueueEntry>? queueEntries,
  5. bool reset = false,
})

Registers every tuning-bearing registry entry into providerTuningRegistry. All parameters optional; entries without overrides never reach the table (the AC6 fast path: no entries → the wire seams keep today's exact values).

reset clears the table FIRST — the full-reload form (E4): boot's two passes run without it (the queue pass must ADD to the config pass), while a host applying a fresh config snapshot resets so removed entries cannot outlive their config.

Table-driven on purpose (the CRAP ratchet): each config surface maps through its own tiny _customProviderTuning/_customModelTuning/ _roleRefTuning/_queueEntryTuning adapter, and the loop lives once inside ProviderTuningRegistry.registerAll.

Implementation

void seedProviderTuning({
  List<CustomProviderEntry>? customProviders,
  Map<String, CustomModelDefinition>? customModels,
  List<ModelRef>? roleRefs,
  List<ProviderQueueEntry>? queueEntries,
  bool reset = false,
}) {
  if (reset) providerTuningRegistry.clear();
  providerTuningRegistry.registerAll(
    [
      ...?customProviders?.map(_customProviderTuning),
      ...?customModels?.entries.map(_customModelTuning),
      ...?roleRefs?.map(_roleRefTuning),
      ...?queueEntries?.map(_queueEntryTuning),
    ].nonNulls,
  );
}