mirror of
https://github.com/bitbaum/ai-kit.git
synced 2026-12-04 05:48:21 +01:00
The first app to adopt the merged package broke on it, which is the fastest
possible feedback and worth acting on rather than patching around.
`ai-forms` is ESM-only. Re-exporting it from this root meant that importing the
CHAIN pulled the forms package in behind it, so AOZ — which wanted `freeChain`
and nothing else — had its Jest run die on `Unexpected token 'export'` inside a
module it never asked for. Three suites, seven tests.
The available remedy was a `transformIgnorePatterns` entry in AOZ. Then the same
entry in the next adopter, and the one after: a single class of breakage, paid
once per repo, forever. That is precisely the shape this fleet has a rule
against, so the fix goes here instead.
One install was always the promise, and it is untouched. Same package, same
version, nothing new to install — only the import path moves:
import { freeChain } from "ai-kit"; // the chain
import { defineFields } from "ai-kit/forms"; // form filling
import { useAssist } from "ai-kit/react"; // the React hook
Which is what the exports map was for. Collapsing it into the root threw away
the one thing it buys: a server that wants a provider chain no longer pays for
a form library, or for a UI peer behind it.
BREAKING for anyone importing form symbols from the root. Measured before
changing rather than assumed: across both consumers — FleetCrown (5 files) and
AOZ (2) — every root import is chain, limits or fair-share. Zero form symbols.
Nothing in the fleet has to change.
The absence is now a test, not a convention. `test/exports.test.js` asserts both
that `ai-kit/forms` resolves and that the root does NOT carry those symbols,
because a convenience re-export added back at the root would read as harmless in
review and break the next consumer in exactly this way.
verify: lint, typecheck, build, 48/48 tests.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
86 lines
2.0 KiB
JSON
86 lines
2.0 KiB
JSON
{
|
|
"name": "ai-kit",
|
|
"version": "0.4.0",
|
|
"description": "One install for the AI layer of an app: which model to call and what to do when the vendor retires it, 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/maonakamoto/ai-kit#readme",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/maonakamoto/ai-kit.git"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/maonakamoto/ai-kit/issues"
|
|
},
|
|
"keywords": [
|
|
"ai",
|
|
"llm",
|
|
"form-fill",
|
|
"fallback",
|
|
"free-tier",
|
|
"rate-limit",
|
|
"quota",
|
|
"fair-share",
|
|
"groq",
|
|
"openrouter"
|
|
],
|
|
"type": "module",
|
|
"sideEffects": false,
|
|
"engines": {
|
|
"node": ">=18"
|
|
},
|
|
"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
|
|
}
|
|
}
|
|
}
|