Files
ai-kit/test
de7319a29d feat: tryChain + createHealthTracker — walk the chain, know when it's down (#18)
The chain and catalog modules already answer WHICH model to call and
whether the vendor still lists it. What every hand-rolled adopter still
had to build itself, differently, was the loop that actually walks the
chain on failure, and a record of whether the whole thing came back
empty — the gap a real outage fell through on 2026-08-28: an app's only
key died, the chat routes caught it and answered a friendly 200, and
/health reported healthy because it only ever checked the database.

tryChain() tries each link in order and returns the first success,
throwing ChainExhaustedError (naming every link's failure, not just the
last) when none work. It ships no HTTP client, same as the rest of this
package — attempt() is supplied by the caller and makes the real
request; this only decides which link goes next.

createHealthTracker() is a factory rather than a module-level global, so
a consumer gets old-style shared-process state for free by creating
exactly one, and tests never fight over shared state. Health only
records once per whole chain walk: a success on link two is a success,
not a "degraded" report on the fallback working as designed.

Version 0.4.0 -> 0.5.0. Also fixes stale catomean/* org references in
README and package.json left over from the bitbaum rename.

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-29 09:30:40 +02:00
..