@lantos1618/better-ui 0.7.0 → 0.7.1
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/dist/{ThemeProvider-CGxHnF2T.d.ts → ThemeProvider-BESbs5p6.d.ts} +1 -1
- package/dist/{ThemeProvider-A7krFsCJ.d.mts → ThemeProvider-Dx3STQtp.d.mts} +1 -1
- 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 +4 -2
- package/dist/mcp/index.d.ts +4 -2
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/{tool-DGpwM6G6.d.mts → tool-yZTixiN2.d.mts} +20 -10
- package/dist/{tool-DGpwM6G6.d.ts → tool-yZTixiN2.d.ts} +20 -10
- package/package.json +2 -2
|
@@ -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-yZTixiN2.js';
|
|
5
5
|
import { P as PersistenceAdapter, T as Thread$1 } from './types-CAOfGUPH.js';
|
|
6
6
|
|
|
7
7
|
interface ToolStateEntry {
|
|
@@ -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-yZTixiN2.mjs';
|
|
5
5
|
import { P as PersistenceAdapter, T as Thread$1 } from './types-CAOfGUPH.mjs';
|
|
6
6
|
|
|
7
7
|
interface ToolStateEntry {
|
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 { 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-
|
|
1
|
+
import { f as ToolStateStore, g as ToolStateEntry } from '../ThemeProvider-Dx3STQtp.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-Dx3STQtp.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-yZTixiN2.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 { 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-
|
|
1
|
+
import { f as ToolStateStore, g as ToolStateEntry } from '../ThemeProvider-BESbs5p6.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-BESbs5p6.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-yZTixiN2.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 { 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-
|
|
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-yZTixiN2.mjs';
|
|
2
2
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
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-
|
|
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-Dx3STQtp.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 { 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-
|
|
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-yZTixiN2.js';
|
|
2
2
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
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-
|
|
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-BESbs5p6.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react/jsx-runtime';
|
package/dist/mcp/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as Tool, g as ToolContext } from '../tool-
|
|
1
|
+
import { T as Tool, g as ToolContext } from '../tool-yZTixiN2.mjs';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -152,6 +152,8 @@ interface JsonSchema {
|
|
|
152
152
|
additionalProperties?: boolean | JsonSchema;
|
|
153
153
|
[key: string]: unknown;
|
|
154
154
|
}
|
|
155
|
-
declare function zodToJsonSchema(schema: z.ZodType
|
|
155
|
+
declare function zodToJsonSchema(schema: z.ZodType | {
|
|
156
|
+
[key: string]: any;
|
|
157
|
+
}): JsonSchema;
|
|
156
158
|
|
|
157
159
|
export { MCPServer, type MCPServerConfig, createMCPServer, zodToJsonSchema };
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as Tool, g as ToolContext } from '../tool-
|
|
1
|
+
import { T as Tool, g as ToolContext } from '../tool-yZTixiN2.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -152,6 +152,8 @@ interface JsonSchema {
|
|
|
152
152
|
additionalProperties?: boolean | JsonSchema;
|
|
153
153
|
[key: string]: unknown;
|
|
154
154
|
}
|
|
155
|
-
declare function zodToJsonSchema(schema: z.ZodType
|
|
155
|
+
declare function zodToJsonSchema(schema: z.ZodType | {
|
|
156
|
+
[key: string]: any;
|
|
157
|
+
}): JsonSchema;
|
|
156
158
|
|
|
157
159
|
export { MCPServer, type MCPServerConfig, createMCPServer, zodToJsonSchema };
|
package/dist/react/index.d.mts
CHANGED
package/dist/react/index.d.ts
CHANGED
|
@@ -8,6 +8,16 @@ import React, { ReactElement } from 'react';
|
|
|
8
8
|
* with Better UI's unique view integration.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Schema type that works with both Zod 3 and Zod 4.
|
|
13
|
+
* Zod 4 removed internal properties (_parse, _type, etc.) from ZodType,
|
|
14
|
+
* so we use a structural type instead of z.ZodType directly.
|
|
15
|
+
*/
|
|
16
|
+
type ZodSchema<T = any> = z.ZodType<T> | {
|
|
17
|
+
parse: (data: unknown) => T;
|
|
18
|
+
safeParse: (data: unknown) => any;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
11
21
|
/** Behavioral hints for tools */
|
|
12
22
|
interface ToolHints {
|
|
13
23
|
/** Tool performs destructive/irreversible actions (auto-implies requiresConfirmation) */
|
|
@@ -63,8 +73,8 @@ interface ClientFetchConfig {
|
|
|
63
73
|
interface ToolConfig<TInput, TOutput> {
|
|
64
74
|
name: string;
|
|
65
75
|
description?: string;
|
|
66
|
-
input:
|
|
67
|
-
output?:
|
|
76
|
+
input: ZodSchema<TInput>;
|
|
77
|
+
output?: ZodSchema<TOutput>;
|
|
68
78
|
tags?: string[];
|
|
69
79
|
cache?: CacheConfig<TInput>;
|
|
70
80
|
/** Configure auto-fetch behavior for client-side execution */
|
|
@@ -99,8 +109,8 @@ type ViewComponent<TOutput, TInput = unknown> = (data: TOutput, state?: ViewStat
|
|
|
99
109
|
declare class Tool<TInput = any, TOutput = any> {
|
|
100
110
|
readonly name: string;
|
|
101
111
|
readonly description?: string;
|
|
102
|
-
readonly inputSchema:
|
|
103
|
-
readonly outputSchema?:
|
|
112
|
+
readonly inputSchema: ZodSchema<TInput>;
|
|
113
|
+
readonly outputSchema?: ZodSchema<TOutput>;
|
|
104
114
|
readonly tags: string[];
|
|
105
115
|
readonly cacheConfig?: CacheConfig<TInput>;
|
|
106
116
|
readonly clientFetchConfig?: ClientFetchConfig;
|
|
@@ -233,11 +243,11 @@ declare class Tool<TInput = any, TOutput = any> {
|
|
|
233
243
|
*/
|
|
234
244
|
toAITool(): {
|
|
235
245
|
description: string;
|
|
236
|
-
inputSchema:
|
|
246
|
+
inputSchema: ZodSchema<TInput>;
|
|
237
247
|
execute?: undefined;
|
|
238
248
|
} | {
|
|
239
249
|
description: string;
|
|
240
|
-
inputSchema:
|
|
250
|
+
inputSchema: ZodSchema<TInput>;
|
|
241
251
|
execute: (input: TInput) => Promise<TOutput>;
|
|
242
252
|
};
|
|
243
253
|
}
|
|
@@ -294,11 +304,11 @@ declare class ToolBuilder<TInput = any, TOutput = any> {
|
|
|
294
304
|
* 2. The return type correctly reflects the new generic parameter
|
|
295
305
|
* 3. TypeScript doesn't support "this type mutation" in fluent builders
|
|
296
306
|
*/
|
|
297
|
-
input<T>(schema:
|
|
307
|
+
input<T>(schema: ZodSchema<T>): ToolBuilder<T, TOutput>;
|
|
298
308
|
/**
|
|
299
309
|
* Define output schema - enables type inference for results
|
|
300
310
|
*/
|
|
301
|
-
output<O>(schema:
|
|
311
|
+
output<O>(schema: ZodSchema<O>): ToolBuilder<TInput, O>;
|
|
302
312
|
tags(...tags: string[]): this;
|
|
303
313
|
cache(config: CacheConfig<TInput>): this;
|
|
304
314
|
/** Configure auto-fetch endpoint for client-side execution */
|
|
@@ -349,11 +359,11 @@ declare class ToolBuilder<TInput = any, TOutput = any> {
|
|
|
349
359
|
};
|
|
350
360
|
toAITool(): {
|
|
351
361
|
description: string;
|
|
352
|
-
inputSchema:
|
|
362
|
+
inputSchema: ZodSchema<TInput>;
|
|
353
363
|
execute?: undefined;
|
|
354
364
|
} | {
|
|
355
365
|
description: string;
|
|
356
|
-
inputSchema:
|
|
366
|
+
inputSchema: ZodSchema<TInput>;
|
|
357
367
|
execute: (input: TInput) => Promise<TOutput>;
|
|
358
368
|
};
|
|
359
369
|
}
|
|
@@ -8,6 +8,16 @@ import React, { ReactElement } from 'react';
|
|
|
8
8
|
* with Better UI's unique view integration.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Schema type that works with both Zod 3 and Zod 4.
|
|
13
|
+
* Zod 4 removed internal properties (_parse, _type, etc.) from ZodType,
|
|
14
|
+
* so we use a structural type instead of z.ZodType directly.
|
|
15
|
+
*/
|
|
16
|
+
type ZodSchema<T = any> = z.ZodType<T> | {
|
|
17
|
+
parse: (data: unknown) => T;
|
|
18
|
+
safeParse: (data: unknown) => any;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
11
21
|
/** Behavioral hints for tools */
|
|
12
22
|
interface ToolHints {
|
|
13
23
|
/** Tool performs destructive/irreversible actions (auto-implies requiresConfirmation) */
|
|
@@ -63,8 +73,8 @@ interface ClientFetchConfig {
|
|
|
63
73
|
interface ToolConfig<TInput, TOutput> {
|
|
64
74
|
name: string;
|
|
65
75
|
description?: string;
|
|
66
|
-
input:
|
|
67
|
-
output?:
|
|
76
|
+
input: ZodSchema<TInput>;
|
|
77
|
+
output?: ZodSchema<TOutput>;
|
|
68
78
|
tags?: string[];
|
|
69
79
|
cache?: CacheConfig<TInput>;
|
|
70
80
|
/** Configure auto-fetch behavior for client-side execution */
|
|
@@ -99,8 +109,8 @@ type ViewComponent<TOutput, TInput = unknown> = (data: TOutput, state?: ViewStat
|
|
|
99
109
|
declare class Tool<TInput = any, TOutput = any> {
|
|
100
110
|
readonly name: string;
|
|
101
111
|
readonly description?: string;
|
|
102
|
-
readonly inputSchema:
|
|
103
|
-
readonly outputSchema?:
|
|
112
|
+
readonly inputSchema: ZodSchema<TInput>;
|
|
113
|
+
readonly outputSchema?: ZodSchema<TOutput>;
|
|
104
114
|
readonly tags: string[];
|
|
105
115
|
readonly cacheConfig?: CacheConfig<TInput>;
|
|
106
116
|
readonly clientFetchConfig?: ClientFetchConfig;
|
|
@@ -233,11 +243,11 @@ declare class Tool<TInput = any, TOutput = any> {
|
|
|
233
243
|
*/
|
|
234
244
|
toAITool(): {
|
|
235
245
|
description: string;
|
|
236
|
-
inputSchema:
|
|
246
|
+
inputSchema: ZodSchema<TInput>;
|
|
237
247
|
execute?: undefined;
|
|
238
248
|
} | {
|
|
239
249
|
description: string;
|
|
240
|
-
inputSchema:
|
|
250
|
+
inputSchema: ZodSchema<TInput>;
|
|
241
251
|
execute: (input: TInput) => Promise<TOutput>;
|
|
242
252
|
};
|
|
243
253
|
}
|
|
@@ -294,11 +304,11 @@ declare class ToolBuilder<TInput = any, TOutput = any> {
|
|
|
294
304
|
* 2. The return type correctly reflects the new generic parameter
|
|
295
305
|
* 3. TypeScript doesn't support "this type mutation" in fluent builders
|
|
296
306
|
*/
|
|
297
|
-
input<T>(schema:
|
|
307
|
+
input<T>(schema: ZodSchema<T>): ToolBuilder<T, TOutput>;
|
|
298
308
|
/**
|
|
299
309
|
* Define output schema - enables type inference for results
|
|
300
310
|
*/
|
|
301
|
-
output<O>(schema:
|
|
311
|
+
output<O>(schema: ZodSchema<O>): ToolBuilder<TInput, O>;
|
|
302
312
|
tags(...tags: string[]): this;
|
|
303
313
|
cache(config: CacheConfig<TInput>): this;
|
|
304
314
|
/** Configure auto-fetch endpoint for client-side execution */
|
|
@@ -349,11 +359,11 @@ declare class ToolBuilder<TInput = any, TOutput = any> {
|
|
|
349
359
|
};
|
|
350
360
|
toAITool(): {
|
|
351
361
|
description: string;
|
|
352
|
-
inputSchema:
|
|
362
|
+
inputSchema: ZodSchema<TInput>;
|
|
353
363
|
execute?: undefined;
|
|
354
364
|
} | {
|
|
355
365
|
description: string;
|
|
356
|
-
inputSchema:
|
|
366
|
+
inputSchema: ZodSchema<TInput>;
|
|
357
367
|
execute: (input: TInput) => Promise<TOutput>;
|
|
358
368
|
};
|
|
359
369
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lantos1618/better-ui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
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",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"react-markdown": "^10.1.0",
|
|
82
82
|
"remark-gfm": "^4.0.1",
|
|
83
83
|
"shiki": "^4.0.2",
|
|
84
|
-
"zod": "^3.25.76"
|
|
84
|
+
"zod": "^3.25.76 || ^4.0.0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@ai-sdk/anthropic": "^3.0.0",
|