tpmjs/packages/ui/package.json
Ajax Davis a92c2c250c feat: upgrade to AI SDK v6 beta and Zod v4 to fix tool schema errors
OpenAI was rejecting tool definitions with error "schema must be a JSON Schema of 'type: "object"'". This was caused by AI SDK v5 not properly converting Zod schemas to JSON Schema format.

**Changes:**
- Upgrade AI SDK from v5.0.104 to v6.0.0-beta.124
- Upgrade @ai-sdk/openai from v2.0.74 to v3.0.0-beta.22
- Upgrade Zod from v3.25.76 to v4.1.13 across all packages

**AI SDK v6 breaking changes:**
- Tool definition API: `parameters` renamed to `inputSchema`
- Removed `aiTool()` wrapper - use plain object with description, inputSchema, execute
- Streaming API: Use `textStream` async iterator instead of onChunk callback
- Zod schemas now properly converted to JSON Schema for OpenAI

**Zod v4 breaking changes:**
- `z.record()` now requires two arguments: `z.record(keySchema, valueSchema)`
- `z.enum()` params changed: `errorMap` removed, use `message` instead
- Type system improvements require explicit type parameters
- Fixed type errors in @tpmjs/env, @tpmjs/npm-client, @tpmjs/types

**Files changed:**
- apps/web/src/lib/ai-agent/tool-executor-agent.ts
  - Updated tool definition to use `inputSchema` instead of `parameters`
  - Removed `aiTool()` wrapper
  - Fixed streaming to use `textStream` iterator
- packages/env/src/index.ts
  - Updated type constraint from `z.ZodRawShape` to `Record<string, z.ZodTypeAny>`
- packages/npm-client/src/package.ts
  - Fixed `z.record()` calls to include both key and value schemas
  - Added type assertions for record indexing
- packages/types/src/tpmjs.ts
  - Changed `errorMap` to `message` in z.enum() calls

**Testing:**
-  Type-check passes
-  Production build succeeds
-  All routes compile correctly

This fixes the tool execution error where OpenAI rejected tool schemas with invalid format.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 19:14:01 +10:00

178 lines
5.5 KiB
JSON

{
"name": "@tpmjs/ui",
"version": "0.1.3",
"type": "module",
"exports": {
"./Button/Button": {
"types": "./dist/Button/Button.d.ts",
"default": "./dist/Button/Button.js"
},
"./Card/Card": {
"types": "./dist/Card/Card.d.ts",
"default": "./dist/Card/Card.js"
},
"./Input/Input": {
"types": "./dist/Input/Input.d.ts",
"default": "./dist/Input/Input.js"
},
"./Label/Label": {
"types": "./dist/Label/Label.d.ts",
"default": "./dist/Label/Label.js"
},
"./Badge/Badge": {
"types": "./dist/Badge/Badge.d.ts",
"default": "./dist/Badge/Badge.js"
},
"./Container/Container": {
"types": "./dist/Container/Container.d.ts",
"default": "./dist/Container/Container.js"
},
"./Icon/Icon": {
"types": "./dist/Icon/Icon.d.ts",
"default": "./dist/Icon/Icon.js"
},
"./ProgressBar/ProgressBar": {
"types": "./dist/ProgressBar/ProgressBar.d.ts",
"default": "./dist/ProgressBar/ProgressBar.js"
},
"./CodeBlock/CodeBlock": {
"types": "./dist/CodeBlock/CodeBlock.d.ts",
"default": "./dist/CodeBlock/CodeBlock.js"
},
"./Tabs/Tabs": {
"types": "./dist/Tabs/Tabs.d.ts",
"default": "./dist/Tabs/Tabs.js"
},
"./Header/Header": {
"types": "./dist/Header/Header.d.ts",
"default": "./dist/Header/Header.js"
},
"./Section/Section": {
"types": "./dist/Section/Section.d.ts",
"default": "./dist/Section/Section.js"
},
"./GridContainer/GridContainer": {
"types": "./dist/GridContainer/GridContainer.d.ts",
"default": "./dist/GridContainer/GridContainer.js"
},
"./Textarea/Textarea": {
"types": "./dist/Textarea/Textarea.d.ts",
"default": "./dist/Textarea/Textarea.js"
},
"./Checkbox/Checkbox": {
"types": "./dist/Checkbox/Checkbox.d.ts",
"default": "./dist/Checkbox/Checkbox.js"
},
"./Radio/Radio": {
"types": "./dist/Radio/Radio.d.ts",
"default": "./dist/Radio/Radio.js"
},
"./Radio/RadioGroup": {
"types": "./dist/Radio/RadioGroup.d.ts",
"default": "./dist/Radio/RadioGroup.js"
},
"./Switch/Switch": {
"types": "./dist/Switch/Switch.d.ts",
"default": "./dist/Switch/Switch.js"
},
"./Select/Select": {
"types": "./dist/Select/Select.d.ts",
"default": "./dist/Select/Select.js"
},
"./Slider/Slider": {
"types": "./dist/Slider/Slider.d.ts",
"default": "./dist/Slider/Slider.js"
},
"./FormField/FormField": {
"types": "./dist/FormField/FormField.d.ts",
"default": "./dist/FormField/FormField.js"
},
"./AnimatedCounter/AnimatedCounter": {
"types": "./dist/AnimatedCounter/AnimatedCounter.d.ts",
"default": "./dist/AnimatedCounter/AnimatedCounter.js"
},
"./StatCard/StatCard": {
"types": "./dist/StatCard/StatCard.d.ts",
"default": "./dist/StatCard/StatCard.js"
},
"./system/hooks/useScrollReveal": {
"types": "./dist/system/hooks/useScrollReveal.d.ts",
"default": "./dist/system/hooks/useScrollReveal.js"
},
"./system/hooks/useCountUp": {
"types": "./dist/system/hooks/useCountUp.d.ts",
"default": "./dist/system/hooks/useCountUp.js"
},
"./system/hooks/useParallax": {
"types": "./dist/system/hooks/useParallax.d.ts",
"default": "./dist/system/hooks/useParallax.js"
},
"./system/hooks/useReducedMotion": {
"types": "./dist/system/hooks/useReducedMotion.d.ts",
"default": "./dist/system/hooks/useReducedMotion.js"
},
"./system/hooks/useDitherAnimation": {
"types": "./dist/system/hooks/useDitherAnimation.d.ts",
"default": "./dist/system/hooks/useDitherAnimation.js"
},
"./DitherCanvas/DitherCanvas": {
"types": "./dist/DitherCanvas/DitherCanvas.d.ts",
"default": "./dist/DitherCanvas/DitherCanvas.js"
},
"./DitherText/DitherHeadline": {
"types": "./dist/DitherText/DitherHeadline.d.ts",
"default": "./dist/DitherText/DitherHeadline.js"
},
"./DitherText/DitherSectionHeader": {
"types": "./dist/DitherText/DitherSectionHeader.d.ts",
"default": "./dist/DitherText/DitherSectionHeader.js"
},
"./FlowDiagram/FlowDiagram": {
"types": "./dist/FlowDiagram/FlowDiagram.d.ts",
"default": "./dist/FlowDiagram/FlowDiagram.js"
},
"./ActivityStream/ActivityStream": {
"types": "./dist/ActivityStream/ActivityStream.d.ts",
"default": "./dist/ActivityStream/ActivityStream.js"
}
},
"files": ["dist"],
"scripts": {
"build": "NODE_OPTIONS='--max-old-space-size=4096' tsup",
"dev": "tsup --watch",
"test": "vitest run",
"test:ui": "vitest --ui",
"type-check": "tsc --noEmit",
"lint": "eslint .",
"clean": "rm -rf dist .turbo"
},
"peerDependencies": {
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
},
"dependencies": {
"@tpmjs/utils": "workspace:*",
"zod": "^4.1.13"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
"@tpmjs/eslint-config": "workspace:*",
"@tpmjs/test": "workspace:*",
"@tpmjs/tsconfig": "workspace:*",
"@types/react": "^19.0.2",
"@types/react-dom": "^19.0.2",
"eslint": "^9.39.1",
"glob": "^13.0.0",
"happy-dom": "^15.11.7",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tsup": "^8.3.5",
"typescript": "^5.9.3",
"vitest": "^2.1.8"
},
"publishConfig": {
"access": "public"
}
}