add method
Adds (or replaces, on name clash) entry. Throws ConfigException
when the entry is named after a built-in catalog provider — such an
entry shadows /provider <name> routing and is exactly the ghost
"openai" of issue #221; the interactive name prompts reject these
names already, this is the last line of defense for flows that
construct entries directly.
Implementation
void add(CustomProviderEntry entry) {
if (isReservedCustomProviderName(entry.name)) {
throw ConfigException(
'"${entry.name}" is a built-in provider name — a saved custom '
'entry with that name shadows /provider ${entry.name} routing; '
'pick another name',
);
}
final existing = find(entry.name);
if (existing != null) entries.remove(existing);
entries.add(entry);
}