Decorate an IModelAdapter with retire-and-retry. Behaviour:
complete(request) to the inner adapter.MODEL_NOT_FOUND: refresh the cache, find the closest
same-family alternative, retry once with request.model = <fallback>. Original error is returned if no fallback found.stream() retries via restart-from-zero (#2550): when the inner
stream throws a MODEL_NOT_FOUND ModelError, the wrapper closes
the failed stream, picks a same-family fallback via the cache +
registry, builds a new adapter through adapterFactory, and
yields chunks from the fallback stream. The consumer sees a clean
second stream — partial content already delivered by the first
stream is NOT replayed; that's a known trade-off (the alternative
resume-with-reconciliation strategy is heavier and only useful
for tool-use loops; not implemented per the deliberate scoping in
#2550). Without adapterFactory, the original throw propagates
unchanged.countTokens, validateConfig, listModels are passthrough.
Adapters exports - Model adapters (Claude, OpenAI, Gemini, Ollama) Split from index.ts for file size compliance (Issue #285)