Files
ai-kit/package.json
T
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

88 lines
2.1 KiB
JSON

{
"name": "ai-kit",
"version": "0.5.0",
"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, and headless AI form filling.",
"license": "MIT",
"author": "Mao Nakamoto",
"homepage": "https://github.com/bitbaum/ai-kit#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/bitbaum/ai-kit.git"
},
"bugs": {
"url": "https://github.com/bitbaum/ai-kit/issues"
},
"keywords": [
"ai",
"llm",
"form-fill",
"fallback",
"failover",
"health-check",
"free-tier",
"rate-limit",
"quota",
"fair-share",
"groq",
"openrouter"
],
"type": "module",
"sideEffects": false,
"engines": {
"node": ">=20"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"files": [
"dist"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./forms": {
"types": "./dist/forms.d.ts",
"default": "./dist/forms.js"
},
"./react": {
"types": "./dist/react.d.ts",
"default": "./dist/react.js"
},
"./server": {
"types": "./dist/server.d.ts",
"default": "./dist/server.js"
}
},
"scripts": {
"build": "tsc -p tsconfig.json",
"lint": "eslint .",
"typecheck": "tsc -p tsconfig.json --noEmit",
"test": "node --test test/*.test.js",
"check:catalog": "npm run build && node scripts/check-catalog.mjs",
"verify": "npm run lint && npm run typecheck && npm run build && npm test",
"prepare": "npm run build"
},
"devDependencies": {
"@eslint/js": "^9.39.5",
"@types/node": "^22.10.2",
"eslint": "^9.39.5",
"globals": "^15.15.0",
"typescript": "^5.8.2",
"typescript-eslint": "^8.67.0"
},
"dependencies": {
"ai-forms": "^0.1.2"
},
"peerDependencies": {
"react": ">=18"
},
"peerDependenciesMeta": {
"react": {
"optional": true
}
}
}