@bitbaum/ai-kit 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/complete.js CHANGED
@@ -291,6 +291,25 @@ export async function complete(options) {
291
291
  options.onLinkFailure?.(link, failure);
292
292
  if (failure.kind === "daily")
293
293
  deadProviders.add(link.provider.id);
294
+ // A REJECTED KEY is a verdict about the VENDOR, not the model.
295
+ //
296
+ // 401/403 says "not you". Every remaining link at this provider presents
297
+ // the identical credential, so walking them spends a request each to be
298
+ // told the same thing — and then reports "all 5 links failed", which
299
+ // reads as an outage at someone else's shop and sends the reader looking
300
+ // for one. The fact worth surfacing is that a key this app holds was
301
+ // refused.
302
+ //
303
+ // Crossing to the NEXT vendor still happens: that is a different key, and
304
+ // the whole reason the chain spans vendors.
305
+ //
306
+ // Deliberately narrow. A 404 is a retired id, a 5xx is a vendor being
307
+ // unwell, a capacity 429 is a busy minute — all three are answered by
308
+ // asking a different model, and widening this skip to cover them would
309
+ // quietly turn the chain back into the pin it replaced.
310
+ if (failure.status === 401 || failure.status === 403) {
311
+ deadProviders.add(link.provider.id);
312
+ }
294
313
  // The caller cancelled — the request they were waiting on is gone. Walking
295
314
  // the rest of the chain now would spend their daily budget on an answer
296
315
  // nobody will read, and would report "every vendor failed" about vendors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbaum/ai-kit",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "One install for the AI layer of an app: which model to call, what to do when the vendor retires it, how to walk the fallback chain and know when none of it worked, how to read the three kinds of 429, a fair daily budget across users, headless AI form filling — and now the model registry (one SSOT for every callable id, with the paid/free boundary as a field) and the grounding harness (facts, contract, deterministic fabrication check).",
5
5
  "license": "MIT",
6
6
  "author": "Mao Nakamoto",
package/src/complete.ts CHANGED
@@ -449,6 +449,26 @@ export async function complete(options: CompleteOptions): Promise<CompleteResult
449
449
 
450
450
  if (failure.kind === "daily") deadProviders.add(link.provider.id);
451
451
 
452
+ // A REJECTED KEY is a verdict about the VENDOR, not the model.
453
+ //
454
+ // 401/403 says "not you". Every remaining link at this provider presents
455
+ // the identical credential, so walking them spends a request each to be
456
+ // told the same thing — and then reports "all 5 links failed", which
457
+ // reads as an outage at someone else's shop and sends the reader looking
458
+ // for one. The fact worth surfacing is that a key this app holds was
459
+ // refused.
460
+ //
461
+ // Crossing to the NEXT vendor still happens: that is a different key, and
462
+ // the whole reason the chain spans vendors.
463
+ //
464
+ // Deliberately narrow. A 404 is a retired id, a 5xx is a vendor being
465
+ // unwell, a capacity 429 is a busy minute — all three are answered by
466
+ // asking a different model, and widening this skip to cover them would
467
+ // quietly turn the chain back into the pin it replaced.
468
+ if (failure.status === 401 || failure.status === 403) {
469
+ deadProviders.add(link.provider.id);
470
+ }
471
+
452
472
  // The caller cancelled — the request they were waiting on is gone. Walking
453
473
  // the rest of the chain now would spend their daily budget on an answer
454
474
  // nobody will read, and would report "every vendor failed" about vendors