mirror of
https://github.com/bitbaum/ai-kit.git
synced 2026-12-04 05:07:59 +01:00
Replaces the line every app in this fleet writes and every app gets
wrong:
const TOOL_CAPABLE_PROVIDERS = ['groq', 'openrouter'];
That list is wrong the moment a user brings a model nobody has heard of,
which is every day — and OrangeCat measured the consequence: a user on
their own frontier key is handed NO tools at all, so the person paying
most gets the least capable assistant. It is also wrong in the other
direction, because it cannot express that five of nine free models
probed here answer tools only in prose; a native-only client loses most
of its chain while believing it is fine.
The replacement is not a better list. It is three rules.
THE FIRST REAL CALL IS THE PROBE. Send the tools, read what comes back,
write down what it proved. Every model a user brings classifies itself
on its first message, at no extra cost and with no release from us.
Nothing here spends a separate request, which matters most when the key
belongs to the user.
A POSITIVE IS CHEAP, A NEGATIVE IS EXPENSIVE AND STICKY. One tool_calls
response proves capability outright. A 400 proves nothing unless the
vendor SAYS it is about tools — a context-length overflow, a content
filter or a bad parameter must be recorded as nothing at all, because
writing one down as "no tools" cripples a capable model until the record
expires and nothing in the product explains why. That asymmetry is what
`record: false` is for: the right response to an uninformative failure
is to learn nothing, not to guess. Most of the test file defends it.
"NEVER ASKED" IS ITS OWN ANSWER, READ TWO WAYS. planToolAttempt is
optimistic about it, because asking is the only way to learn.
claimableVerdict is pessimistic about it, because announcing a
capability a model has never demonstrated is a promise it may not keep,
and the user meets that as a broken feature rather than a missing one. A
single boolean cannot hold both directions at once.
Records expire, negatives sooner than positives: a model that gained
tool support and is still marked incapable is invisibly crippled, while
one that lost it says so loudly on the next call. Observations are keyed
by a HASH of the credential, never the credential, because capability
genuinely differs per key and observations must not leak across them.
A real call always overrules a registry claim, even an older one.
Storage stays with the app. This owns the shape and the rules, which is
the part everyone gets wrong; it does not own where rows live, which is
the part where apps legitimately differ.
21 new tests, 183 total green.
Claude-Session: https://claude.ai/code/session_014nayuDvAPd5BYkSfsVPHHA
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>