@lantos1618/better-ui 0.6.1 → 0.7.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/README.md +22 -1
- package/dist/{ThemeProvider-BYeqWMsn.d.mts → ThemeProvider-A7krFsCJ.d.mts} +2 -2
- package/dist/{ThemeProvider-BaVZaDBO.d.ts → ThemeProvider-CGxHnF2T.d.ts} +2 -2
- package/dist/agui/index.d.mts +1 -1
- package/dist/agui/index.d.ts +1 -1
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/mcp/index.d.mts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/{tool-Ca2x-VNK.d.mts → tool-DGpwM6G6.d.mts} +1 -1
- package/dist/{tool-Ca2x-VNK.d.ts → tool-DGpwM6G6.d.ts} +1 -1
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
> Define once. Render in UI. Serve over MCP. Type-safe AI tools with views.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@lantos1618/better-ui)
|
|
6
|
+
[](https://www.npmjs.com/package/@lantos1618/better-ui)
|
|
7
|
+
[](https://github.com/lantos1618/better-ui/actions/workflows/test.yml)
|
|
6
8
|
[](LICENSE)
|
|
7
9
|
[](https://www.typescriptlang.org/)
|
|
8
10
|
|
|
11
|
+
**[Guide](./GUIDE.md)** · **[API Reference](./docs/)** · **[Examples](./examples/)**
|
|
12
|
+
|
|
9
13
|
## The Problem
|
|
10
14
|
|
|
11
15
|
Every AI framework lets you define tools. None of them let the tool own its own UI. You end up with tool definitions in one place, rendering logic scattered somewhere else, and no way to expose those same tools to external AI clients.
|
|
@@ -568,10 +572,27 @@ examples/
|
|
|
568
572
|
```bash
|
|
569
573
|
npm install
|
|
570
574
|
npm run build # Build library
|
|
571
|
-
npm test # Run tests
|
|
575
|
+
npm test # Run 228 tests across 11 suites
|
|
572
576
|
npm run type-check # TypeScript check
|
|
573
577
|
```
|
|
574
578
|
|
|
579
|
+
## Deploy the Demo
|
|
580
|
+
|
|
581
|
+
The `examples/nextjs-demo/` is a full-featured chat app ready to deploy:
|
|
582
|
+
|
|
583
|
+
```bash
|
|
584
|
+
cd examples/nextjs-demo
|
|
585
|
+
npm install
|
|
586
|
+
# Set OPENAI_API_KEY in .env.local
|
|
587
|
+
npm run dev
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
To deploy on Vercel, set the **Root Directory** to `examples/nextjs-demo` in your project settings.
|
|
591
|
+
|
|
592
|
+
## Contributing
|
|
593
|
+
|
|
594
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
|
595
|
+
|
|
575
596
|
## License
|
|
576
597
|
|
|
577
598
|
MIT
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { UIMessage, ChatStatus } from 'ai';
|
|
4
|
-
import { T as Tool } from './tool-
|
|
4
|
+
import { T as Tool } from './tool-DGpwM6G6.mjs';
|
|
5
5
|
import { P as PersistenceAdapter, T as Thread$1 } from './types-CAOfGUPH.mjs';
|
|
6
6
|
|
|
7
7
|
interface ToolStateEntry {
|
|
@@ -184,4 +184,4 @@ interface ThemeProviderProps {
|
|
|
184
184
|
*/
|
|
185
185
|
declare function ThemeProvider({ theme, variables, className, children, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
186
186
|
|
|
187
|
-
export { type
|
|
187
|
+
export { type ChatProps as C, type MessageProps as M, type ThemeProviderProps as T, type ChatProviderProps as a, type ComposerProps as b, type ThreadProps as c, type ToolPartInfo as d, type ToolResultProps as e, type ToolStateStore as f, type ToolStateEntry as g, Chat as h, ChatProvider as i, Composer as j, Message as k, ThemeProvider as l, Thread as m, ToolResult as n, createToolStateStore as o, useToolState as p, useChatContext as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { UIMessage, ChatStatus } from 'ai';
|
|
4
|
-
import { T as Tool } from './tool-
|
|
4
|
+
import { T as Tool } from './tool-DGpwM6G6.js';
|
|
5
5
|
import { P as PersistenceAdapter, T as Thread$1 } from './types-CAOfGUPH.js';
|
|
6
6
|
|
|
7
7
|
interface ToolStateEntry {
|
|
@@ -184,4 +184,4 @@ interface ThemeProviderProps {
|
|
|
184
184
|
*/
|
|
185
185
|
declare function ThemeProvider({ theme, variables, className, children, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
186
186
|
|
|
187
|
-
export { type
|
|
187
|
+
export { type ChatProps as C, type MessageProps as M, type ThemeProviderProps as T, type ChatProviderProps as a, type ComposerProps as b, type ThreadProps as c, type ToolPartInfo as d, type ToolResultProps as e, type ToolStateStore as f, type ToolStateEntry as g, Chat as h, ChatProvider as i, Composer as j, Message as k, ThemeProvider as l, Thread as m, ToolResult as n, createToolStateStore as o, useToolState as p, useChatContext as u };
|
package/dist/agui/index.d.mts
CHANGED
package/dist/agui/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as ToolStateStore, g as ToolStateEntry } from '../ThemeProvider-
|
|
2
|
-
export {
|
|
1
|
+
import { f as ToolStateStore, g as ToolStateEntry } from '../ThemeProvider-A7krFsCJ.mjs';
|
|
2
|
+
export { h as Chat, C as ChatProps, i as ChatProvider, a as ChatProviderProps, j as Composer, b as ComposerProps, k as Message, M as MessageProps, l as ThemeProvider, T as ThemeProviderProps, m as Thread, c as ThreadProps, d as ToolPartInfo, n as ToolResult, e as ToolResultProps, o as createToolStateStore, u as useChatContext, p as useToolState } from '../ThemeProvider-A7krFsCJ.mjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { T as Tool } from '../tool-
|
|
4
|
+
import { T as Tool } from '../tool-DGpwM6G6.mjs';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import 'ai';
|
|
7
7
|
import '../types-CAOfGUPH.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as ToolStateStore, g as ToolStateEntry } from '../ThemeProvider-
|
|
2
|
-
export {
|
|
1
|
+
import { f as ToolStateStore, g as ToolStateEntry } from '../ThemeProvider-CGxHnF2T.js';
|
|
2
|
+
export { h as Chat, C as ChatProps, i as ChatProvider, a as ChatProviderProps, j as Composer, b as ComposerProps, k as Message, M as MessageProps, l as ThemeProvider, T as ThemeProviderProps, m as Thread, c as ThreadProps, d as ToolPartInfo, n as ToolResult, e as ToolResultProps, o as createToolStateStore, u as useChatContext, p as useToolState } from '../ThemeProvider-CGxHnF2T.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { T as Tool } from '../tool-
|
|
4
|
+
import { T as Tool } from '../tool-DGpwM6G6.js';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import 'ai';
|
|
7
7
|
import '../types-CAOfGUPH.js';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as CacheConfig, a as ClientFetchConfig, b as ClientHandler, S as ServerHandler, c as StreamCallback, d as StreamHandler, T as Tool, e as ToolBuilder, f as ToolConfig, g as ToolContext, V as ViewComponent, h as ViewState, t as tool } from './tool-DGpwM6G6.mjs';
|
|
2
2
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
3
|
-
export {
|
|
3
|
+
export { C as ChatProps, a as ChatProviderProps, b as ComposerProps, M as MessageProps, T as ThemeProviderProps, c as ThreadProps, d as ToolPartInfo, e as ToolResultProps } from './ThemeProvider-A7krFsCJ.mjs';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react/jsx-runtime';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as CacheConfig, a as ClientFetchConfig, b as ClientHandler, S as ServerHandler, c as StreamCallback, d as StreamHandler, T as Tool, e as ToolBuilder, f as ToolConfig, g as ToolContext, V as ViewComponent, h as ViewState, t as tool } from './tool-DGpwM6G6.js';
|
|
2
2
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
3
|
-
export {
|
|
3
|
+
export { C as ChatProps, a as ChatProviderProps, b as ComposerProps, M as MessageProps, T as ThemeProviderProps, c as ThreadProps, d as ToolPartInfo, e as ToolResultProps } from './ThemeProvider-CGxHnF2T.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react/jsx-runtime';
|
package/dist/mcp/index.d.mts
CHANGED
package/dist/mcp/index.d.ts
CHANGED
package/dist/react/index.d.mts
CHANGED
package/dist/react/index.d.ts
CHANGED
|
@@ -358,4 +358,4 @@ declare class ToolBuilder<TInput = any, TOutput = any> {
|
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
export { type
|
|
361
|
+
export { type CacheConfig as C, type ServerHandler as S, Tool as T, type ViewComponent as V, type ClientFetchConfig as a, type ClientHandler as b, type StreamCallback as c, type StreamHandler as d, ToolBuilder as e, type ToolConfig as f, type ToolContext as g, type ViewState as h, tool as t };
|
|
@@ -358,4 +358,4 @@ declare class ToolBuilder<TInput = any, TOutput = any> {
|
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
export { type
|
|
361
|
+
export { type CacheConfig as C, type ServerHandler as S, Tool as T, type ViewComponent as V, type ClientFetchConfig as a, type ClientHandler as b, type StreamCallback as c, type StreamHandler as d, ToolBuilder as e, type ToolConfig as f, type ToolContext as g, type ViewState as h, tool as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lantos1618/better-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A minimal, type-safe AI-first UI framework for building tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -75,18 +75,18 @@
|
|
|
75
75
|
"prepublishOnly": "npm run build:lib"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@ai-sdk/openai": "^
|
|
79
|
-
"@ai-sdk/react": "^
|
|
80
|
-
"ai": "^
|
|
78
|
+
"@ai-sdk/openai": "^3.0.49",
|
|
79
|
+
"@ai-sdk/react": "^3.0.145",
|
|
80
|
+
"ai": "^6.0.143",
|
|
81
81
|
"react-markdown": "^10.1.0",
|
|
82
82
|
"remark-gfm": "^4.0.1",
|
|
83
|
-
"shiki": "^
|
|
84
|
-
"zod": "^3.
|
|
83
|
+
"shiki": "^4.0.2",
|
|
84
|
+
"zod": "^3.25.76"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@ai-sdk/anthropic": "^
|
|
88
|
-
"@ai-sdk/google": "^
|
|
89
|
-
"jose": "^
|
|
87
|
+
"@ai-sdk/anthropic": "^3.0.0",
|
|
88
|
+
"@ai-sdk/google": "^3.0.0",
|
|
89
|
+
"jose": "^6.0.0",
|
|
90
90
|
"react": "^19.0.0",
|
|
91
91
|
"react-dom": "^19.0.0"
|
|
92
92
|
},
|
|
@@ -110,18 +110,18 @@
|
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@jest/globals": "^29.7.0",
|
|
112
112
|
"@testing-library/jest-dom": "^6.9.1",
|
|
113
|
-
"@testing-library/react": "^16.3.
|
|
113
|
+
"@testing-library/react": "^16.3.2",
|
|
114
114
|
"@types/jest": "^30.0.0",
|
|
115
|
-
"@types/node": "^20",
|
|
116
|
-
"@types/react": "^19",
|
|
117
|
-
"@types/react-dom": "^19",
|
|
115
|
+
"@types/node": "^20.19.37",
|
|
116
|
+
"@types/react": "^19.2.14",
|
|
117
|
+
"@types/react-dom": "^19.2.3",
|
|
118
118
|
"jest": "^29.7.0",
|
|
119
|
-
"jest-environment-jsdom": "^30.
|
|
120
|
-
"jose": "^6.
|
|
121
|
-
"react": "^19.2.
|
|
122
|
-
"react-dom": "^19.2.
|
|
123
|
-
"ts-jest": "^29.4.
|
|
119
|
+
"jest-environment-jsdom": "^30.3.0",
|
|
120
|
+
"jose": "^6.2.2",
|
|
121
|
+
"react": "^19.2.4",
|
|
122
|
+
"react-dom": "^19.2.4",
|
|
123
|
+
"ts-jest": "^29.4.9",
|
|
124
124
|
"tsup": "^8.5.1",
|
|
125
|
-
"typescript": "^5"
|
|
125
|
+
"typescript": "^5.9.3"
|
|
126
126
|
}
|
|
127
127
|
}
|