mirror of
https://github.com/bitbaum/ai-kit.git
synced 2026-12-04 07:50:33 +01:00
The chain replaced one pinned model with a list of pinned models. catalog.ts then noticed the list rots too and added a check. But a check only produces a SENTENCE — somebody still has to read it, edit a file, open a PR, wait for CI and deploy, and until they do the app hands users a model that answers 404. That round trip is this module's origin. On 2026-09-13 a health check scheduled minutes earlier alerted that two ids in a consumer's registry were gone from OpenRouter. The alert was correct and fast and completely dependent on a human being awake. The vendor had published the truth the whole time. So resolveChain() treats the declared list as a PREFERENCE and asks each vendor what it actually serves. A retirement stops being an incident and becomes a no-op. Three rules, each paid for by a real failure: 1. NEVER SHRINK ON IGNORANCE. An unreadable catalogue keeps the declared list verbatim and sets `unverified`. While building this, a checkout without GROQ_API_KEY got a 401 and the first draft printed GONE for both Groq models — both live. Resolution that trusted that would let an expired key empty the chain. Tested against 401, 500, 404 and a missing key. 2. DISCOVERY EXTENDS THE TAIL, NEVER THE HEAD. Declared ids were probed with a real tool call; five of nine free models turned out to emit tool calls only as text. A discovered id has no such evidence, so it is a last resort and never a first choice. 3. DISCOVER ONLY WHAT THE VENDOR CALLS FREE AND USABLE — read, not guessed. Price, not the `:free` suffix: OpenRouter lists 19 ids ending `:free` and 22 priced at zero, and the zero-priced ids WITHOUT the suffix include `openrouter/free`, the auto-router that is the most rot-resistant entry in the whole chain. Groq publishes prices too and none are zero, so discovery there correctly finds nothing and that vendor stays curated. Then suitability: of the 19 free ids one was `nemotron-3.5-content-safety`, a classifier and the only one declaring tools:false, and two more zero-priced ids were `lyria-3-*`, which emit AUDIO. Adding every zero-priced model would have put a safety classifier and a music generator in front of a user asking a question. Requiring text-out and declared tools removes exactly those three and nothing else. Silence is refused rather than assumed throughout: a model that publishes no price is never discovered. Guessing wrong in that direction spends money, so the default declines. Measured against the live catalogues, replaying Groq's real body so no secret moved: the declared chain is 7 models, resolution yields 17 — and it flagged `dots-3-note-preview:free` as ending 2026-09-30, seventeen days of warning, because vendors sometimes publish an expiration_date and honouring it turns rot from detected-afterwards into avoided-in-advance. catalog.ts's own GET now reads the shared fetch in catalog-fetch.ts rather than keeping a second, slightly different copy — the failure its header objects to. Both vendor schemas are normalised there, because they do NOT agree: OpenRouter puts modalities under `architecture` and tools in `supported_parameters`, Groq puts modalities at the top level and uses `supported_features`. A reader that knows only one shape silently drops a working vendor. What this does NOT fix, stated plainly: presence in a catalogue is not proof a model works. This package already records an id that answered "Provider returned error" and one that returned HTTP 200 with EMPTY content. Resolution fixes "the id does not exist"; demoting an id that exists and misbehaves needs observed outcomes, and is not in this change. Verified: 257 tests pass (18 new), format, lint, typecheck and both builds clean. Claude-Session: https://claude.ai/code/session_01HJRuvHJEBd8t7iRA9Sb1iw Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
112 lines
2.7 KiB
JSON
112 lines
2.7 KiB
JSON
{
|
|
"name": "@bitbaum/ai-kit",
|
|
"version": "1.5.0",
|
|
"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,
|
|
"packageManager": "pnpm@11.25.0",
|
|
"engines": {
|
|
"node": ">=20"
|
|
},
|
|
"publishConfig": {
|
|
"access": "public",
|
|
"provenance": true
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"dist-cjs",
|
|
"src"
|
|
],
|
|
"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"
|
|
},
|
|
"./registry": {
|
|
"types": "./dist/registry.d.ts",
|
|
"require": "./dist-cjs/registry.js",
|
|
"default": "./dist/registry.js"
|
|
},
|
|
"./web": {
|
|
"types": "./dist/web/index.d.ts",
|
|
"default": "./dist/web/index.js"
|
|
},
|
|
"./capability": {
|
|
"types": "./dist/capability/index.d.ts",
|
|
"default": "./dist/capability/index.js"
|
|
},
|
|
"./grounding": {
|
|
"types": "./dist/grounding/index.d.ts",
|
|
"require": "./dist-cjs/grounding/index.js",
|
|
"default": "./dist/grounding/index.js"
|
|
}
|
|
},
|
|
"scripts": {
|
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node -e \"require('fs').writeFileSync('dist-cjs/package.json', JSON.stringify({type:'commonjs'})+'\\n')\"",
|
|
"lint": "eslint .",
|
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
"test": "node --test test/*.test.js",
|
|
"check:catalog": "pnpm run build && node scripts/check-catalog.mjs",
|
|
"smoke": "pnpm run build && node scripts/smoke.mjs",
|
|
"verify": "pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm run build && pnpm test",
|
|
"prepare": "pnpm run build",
|
|
"format": "prettier --write .",
|
|
"format:check": "prettier --check ."
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^10.0.1",
|
|
"@types/node": "^26.5.0",
|
|
"eslint": "^10.10.0",
|
|
"globals": "^17.12.0",
|
|
"prettier": "3.9.6",
|
|
"typescript": "^6.0.3",
|
|
"typescript-eslint": "^8.70.0"
|
|
},
|
|
"dependencies": {
|
|
"ai-forms": "^0.1.2"
|
|
},
|
|
"peerDependencies": {
|
|
"react": ">=18"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"react": {
|
|
"optional": true
|
|
}
|
|
}
|
|
}
|