removeProvider method

Future<void> removeProvider(
  1. CustomProviderEntry entry
)

Removes a saved custom provider from the registry (the /provider picker's Delete action). Clears the active-entry marker when needed and notifies AgentCliConfig.onProviderChanged so the host persists the registry — deletion never switches the active model, so without the notification the deletion silently vanished on restart.

Implementation

Future<void> removeProvider(CustomProviderEntry entry) async {
  final registry = config.customProviders;
  if (registry == null) return;
  registry.entries.removeWhere((e) => e.name == entry.name);
  if (_activeCustomName == entry.name) _activeCustomName = null;
  io.writeln('deleted provider ${entry.name}');
  await config.onProviderChanged?.call(_providerKind, _apiKey);
}