@lantos1618/better-ui 0.6.0 → 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 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
  [![npm version](https://img.shields.io/npm/v/@lantos1618/better-ui.svg)](https://www.npmjs.com/package/@lantos1618/better-ui)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@lantos1618/better-ui.svg)](https://www.npmjs.com/package/@lantos1618/better-ui)
7
+ [![CI](https://github.com/lantos1618/better-ui/actions/workflows/test.yml/badge.svg)](https://github.com/lantos1618/better-ui/actions/workflows/test.yml)
6
8
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue)](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 (226 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-Ca2x-VNK.mjs';
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 ChatProviderProps as C, type MessageProps as M, type ToolPartInfo as T, type ThreadProps as a, type ComposerProps as b, type ToolResultProps as c, type ChatProps as d, type ThemeProviderProps as e, type ToolStateStore as f, type ToolStateEntry as g, ChatProvider as h, Thread as i, Message as j, Composer as k, ToolResult as l, Chat as m, createToolStateStore as n, useToolState as o, ThemeProvider as p, useChatContext as u };
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-Ca2x-VNK.js';
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 ChatProviderProps as C, type MessageProps as M, type ToolPartInfo as T, type ThreadProps as a, type ComposerProps as b, type ToolResultProps as c, type ChatProps as d, type ThemeProviderProps as e, type ToolStateStore as f, type ToolStateEntry as g, ChatProvider as h, Thread as i, Message as j, Composer as k, ToolResult as l, Chat as m, createToolStateStore as n, useToolState as o, ThemeProvider as p, useChatContext as u };
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,4 +1,4 @@
1
- import { T as Tool, c as ToolContext } from '../tool-Ca2x-VNK.mjs';
1
+ import { T as Tool, g as ToolContext } from '../tool-DGpwM6G6.mjs';
2
2
  import 'zod';
3
3
  import 'react';
4
4
 
@@ -35,7 +35,7 @@ interface AGUIEvent {
35
35
  interface RunAgentInput {
36
36
  threadId: string;
37
37
  runId: string;
38
- /** Tool calls to execute */
38
+ /** Tool definitions from the client */
39
39
  tools?: Array<{
40
40
  name: string;
41
41
  description?: string;
@@ -45,12 +45,18 @@ interface RunAgentInput {
45
45
  role: string;
46
46
  content: string;
47
47
  }>;
48
- /** Tool call to execute (for direct tool invocation) */
48
+ /** Single tool call to execute */
49
49
  toolCall?: {
50
50
  id: string;
51
51
  name: string;
52
52
  args: Record<string, unknown>;
53
53
  };
54
+ /** Multiple tool calls to execute in sequence */
55
+ toolCalls?: Array<{
56
+ id: string;
57
+ name: string;
58
+ args: Record<string, unknown>;
59
+ }>;
54
60
  /** State context from the frontend */
55
61
  state?: Record<string, unknown>;
56
62
  }
@@ -91,11 +97,6 @@ declare class AGUIServer {
91
97
  * Execute a tool call and emit AG-UI events.
92
98
  */
93
99
  private executeToolCall;
94
- /**
95
- * Minimal Zod-to-JSON-Schema for AG-UI tool parameters.
96
- * Delegates to the MCP schema converter if available, otherwise provides a basic fallback.
97
- */
98
- private zodToJsonSchema;
99
100
  }
100
101
  /**
101
102
  * Create an AG-UI server from a Better UI tool registry.
@@ -1,4 +1,4 @@
1
- import { T as Tool, c as ToolContext } from '../tool-Ca2x-VNK.js';
1
+ import { T as Tool, g as ToolContext } from '../tool-DGpwM6G6.js';
2
2
  import 'zod';
3
3
  import 'react';
4
4
 
@@ -35,7 +35,7 @@ interface AGUIEvent {
35
35
  interface RunAgentInput {
36
36
  threadId: string;
37
37
  runId: string;
38
- /** Tool calls to execute */
38
+ /** Tool definitions from the client */
39
39
  tools?: Array<{
40
40
  name: string;
41
41
  description?: string;
@@ -45,12 +45,18 @@ interface RunAgentInput {
45
45
  role: string;
46
46
  content: string;
47
47
  }>;
48
- /** Tool call to execute (for direct tool invocation) */
48
+ /** Single tool call to execute */
49
49
  toolCall?: {
50
50
  id: string;
51
51
  name: string;
52
52
  args: Record<string, unknown>;
53
53
  };
54
+ /** Multiple tool calls to execute in sequence */
55
+ toolCalls?: Array<{
56
+ id: string;
57
+ name: string;
58
+ args: Record<string, unknown>;
59
+ }>;
54
60
  /** State context from the frontend */
55
61
  state?: Record<string, unknown>;
56
62
  }
@@ -91,11 +97,6 @@ declare class AGUIServer {
91
97
  * Execute a tool call and emit AG-UI events.
92
98
  */
93
99
  private executeToolCall;
94
- /**
95
- * Minimal Zod-to-JSON-Schema for AG-UI tool parameters.
96
- * Delegates to the MCP schema converter if available, otherwise provides a basic fallback.
97
- */
98
- private zodToJsonSchema;
99
100
  }
100
101
  /**
101
102
  * Create an AG-UI server from a Better UI tool registry.
@@ -3,9 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __esm = (fn, res) => function __init() {
7
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
- };
9
6
  var __export = (target, all) => {
10
7
  for (var name in all)
11
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -20,11 +17,15 @@ var __copyProps = (to, from, except, desc) => {
20
17
  };
21
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
19
 
23
- // src/mcp/schema.ts
24
- var schema_exports = {};
25
- __export(schema_exports, {
26
- zodToJsonSchema: () => zodToJsonSchema
20
+ // src/agui/index.ts
21
+ var agui_exports = {};
22
+ __export(agui_exports, {
23
+ AGUIServer: () => AGUIServer,
24
+ createAGUIServer: () => createAGUIServer
27
25
  });
26
+ module.exports = __toCommonJS(agui_exports);
27
+
28
+ // src/mcp/schema.ts
28
29
  function zodToJsonSchema(schema) {
29
30
  return convert(schema);
30
31
  }
@@ -163,19 +164,6 @@ function convertArray(def) {
163
164
  if (def.description) schema.description = def.description;
164
165
  return schema;
165
166
  }
166
- var init_schema = __esm({
167
- "src/mcp/schema.ts"() {
168
- "use strict";
169
- }
170
- });
171
-
172
- // src/agui/index.ts
173
- var agui_exports = {};
174
- __export(agui_exports, {
175
- AGUIServer: () => AGUIServer,
176
- createAGUIServer: () => createAGUIServer
177
- });
178
- module.exports = __toCommonJS(agui_exports);
179
167
 
180
168
  // src/agui/server.ts
181
169
  var AGUIServer = class {
@@ -187,7 +175,7 @@ var AGUIServer = class {
187
175
  return Object.values(this.config.tools).map((tool) => ({
188
176
  name: tool.name,
189
177
  description: tool.description || tool.name,
190
- parameters: this.zodToJsonSchema(tool.inputSchema)
178
+ parameters: zodToJsonSchema(tool.inputSchema)
191
179
  }));
192
180
  }
193
181
  /**
@@ -227,8 +215,11 @@ var AGUIServer = class {
227
215
  };
228
216
  try {
229
217
  emit({ type: "RUN_STARTED", threadId, runId });
230
- if (toolCall) {
231
- await self.executeToolCall(toolCall, emit);
218
+ const calls = toolCall ? [toolCall] : input.toolCalls ?? [];
219
+ if (calls.length > 0) {
220
+ for (const call of calls) {
221
+ await self.executeToolCall(call, emit);
222
+ }
232
223
  } else {
233
224
  const tools = self.listTools();
234
225
  const messageId = `msg_${runId}`;
@@ -305,18 +296,6 @@ var AGUIServer = class {
305
296
  toolCallId: id
306
297
  });
307
298
  }
308
- /**
309
- * Minimal Zod-to-JSON-Schema for AG-UI tool parameters.
310
- * Delegates to the MCP schema converter if available, otherwise provides a basic fallback.
311
- */
312
- zodToJsonSchema(schema) {
313
- try {
314
- const { zodToJsonSchema: zodToJsonSchema2 } = (init_schema(), __toCommonJS(schema_exports));
315
- return zodToJsonSchema2(schema);
316
- } catch {
317
- return { type: "object", properties: {} };
318
- }
319
- }
320
299
  };
321
300
  function createAGUIServer(config) {
322
301
  return new AGUIServer(config);
@@ -1,10 +1,7 @@
1
1
  import {
2
- init_schema,
3
- schema_exports
4
- } from "../chunk-XDWHMRBN.mjs";
5
- import {
6
- __toCommonJS
7
- } from "../chunk-CIESM3BP.mjs";
2
+ zodToJsonSchema
3
+ } from "../chunk-OH73K7I5.mjs";
4
+ import "../chunk-Y6FXYEAI.mjs";
8
5
 
9
6
  // src/agui/server.ts
10
7
  var AGUIServer = class {
@@ -16,7 +13,7 @@ var AGUIServer = class {
16
13
  return Object.values(this.config.tools).map((tool) => ({
17
14
  name: tool.name,
18
15
  description: tool.description || tool.name,
19
- parameters: this.zodToJsonSchema(tool.inputSchema)
16
+ parameters: zodToJsonSchema(tool.inputSchema)
20
17
  }));
21
18
  }
22
19
  /**
@@ -56,8 +53,11 @@ var AGUIServer = class {
56
53
  };
57
54
  try {
58
55
  emit({ type: "RUN_STARTED", threadId, runId });
59
- if (toolCall) {
60
- await self.executeToolCall(toolCall, emit);
56
+ const calls = toolCall ? [toolCall] : input.toolCalls ?? [];
57
+ if (calls.length > 0) {
58
+ for (const call of calls) {
59
+ await self.executeToolCall(call, emit);
60
+ }
61
61
  } else {
62
62
  const tools = self.listTools();
63
63
  const messageId = `msg_${runId}`;
@@ -134,18 +134,6 @@ var AGUIServer = class {
134
134
  toolCallId: id
135
135
  });
136
136
  }
137
- /**
138
- * Minimal Zod-to-JSON-Schema for AG-UI tool parameters.
139
- * Delegates to the MCP schema converter if available, otherwise provides a basic fallback.
140
- */
141
- zodToJsonSchema(schema) {
142
- try {
143
- const { zodToJsonSchema } = (init_schema(), __toCommonJS(schema_exports));
144
- return zodToJsonSchema(schema);
145
- } catch {
146
- return { type: "object", properties: {} };
147
- }
148
- }
149
137
  };
150
138
  function createAGUIServer(config) {
151
139
  return new AGUIServer(config);
@@ -1,4 +1,4 @@
1
- import "../chunk-CIESM3BP.mjs";
1
+ import "../chunk-Y6FXYEAI.mjs";
2
2
 
3
3
  // src/auth/jwt.ts
4
4
  function jwtAuth(options) {
@@ -1,13 +1,4 @@
1
- import {
2
- __esm,
3
- __export
4
- } from "./chunk-CIESM3BP.mjs";
5
-
6
1
  // src/mcp/schema.ts
7
- var schema_exports = {};
8
- __export(schema_exports, {
9
- zodToJsonSchema: () => zodToJsonSchema
10
- });
11
2
  function zodToJsonSchema(schema) {
12
3
  return convert(schema);
13
4
  }
@@ -146,14 +137,7 @@ function convertArray(def) {
146
137
  if (def.description) schema.description = def.description;
147
138
  return schema;
148
139
  }
149
- var init_schema = __esm({
150
- "src/mcp/schema.ts"() {
151
- "use strict";
152
- }
153
- });
154
140
 
155
141
  export {
156
- zodToJsonSchema,
157
- schema_exports,
158
- init_schema
142
+ zodToJsonSchema
159
143
  };
@@ -0,0 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ export {
9
+ __require
10
+ };
@@ -1,7 +1,7 @@
1
- import { f as ToolStateStore, g as ToolStateEntry } from '../ThemeProvider-BYeqWMsn.mjs';
2
- export { m as Chat, d as ChatProps, h as ChatProvider, C as ChatProviderProps, k as Composer, b as ComposerProps, j as Message, M as MessageProps, p as ThemeProvider, e as ThemeProviderProps, i as Thread, a as ThreadProps, T as ToolPartInfo, l as ToolResult, c as ToolResultProps, n as createToolStateStore, u as useChatContext, o as useToolState } from '../ThemeProvider-BYeqWMsn.mjs';
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-Ca2x-VNK.mjs';
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-BaVZaDBO.js';
2
- export { m as Chat, d as ChatProps, h as ChatProvider, C as ChatProviderProps, k as Composer, b as ComposerProps, j as Message, M as MessageProps, p as ThemeProvider, e as ThemeProviderProps, i as Thread, a as ThreadProps, T as ToolPartInfo, l as ToolResult, c as ToolResultProps, n as createToolStateStore, u as useChatContext, o as useToolState } from '../ThemeProvider-BaVZaDBO.js';
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-Ca2x-VNK.js';
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';
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import "../chunk-CIESM3BP.mjs";
2
+ import "../chunk-Y6FXYEAI.mjs";
3
3
 
4
4
  // src/components/ChatProvider.tsx
5
5
  import { createContext, useContext, useCallback as useCallback2, useRef, useState, useEffect } from "react";
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- export { g as CacheConfig, h as ClientFetchConfig, C as ClientHandler, S as ServerHandler, d as StreamCallback, e as StreamHandler, T as Tool, a as ToolBuilder, b as ToolConfig, c as ToolContext, V as ViewComponent, f as ViewState, t as tool } from './tool-Ca2x-VNK.mjs';
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 { d as ChatProps, C as ChatProviderProps, b as ComposerProps, M as MessageProps, e as ThemeProviderProps, a as ThreadProps, T as ToolPartInfo, c as ToolResultProps } from './ThemeProvider-BYeqWMsn.mjs';
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 { g as CacheConfig, h as ClientFetchConfig, C as ClientHandler, S as ServerHandler, d as StreamCallback, e as StreamHandler, T as Tool, a as ToolBuilder, b as ToolConfig, c as ToolContext, V as ViewComponent, f as ViewState, t as tool } from './tool-Ca2x-VNK.js';
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 { d as ChatProps, C as ChatProviderProps, b as ComposerProps, M as MessageProps, e as ThemeProviderProps, a as ThreadProps, T as ToolPartInfo, c as ToolResultProps } from './ThemeProvider-BaVZaDBO.js';
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/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __require
3
- } from "./chunk-CIESM3BP.mjs";
3
+ } from "./chunk-Y6FXYEAI.mjs";
4
4
 
5
5
  // src/tool.tsx
6
6
  import { memo } from "react";
@@ -1,4 +1,4 @@
1
- import { T as Tool, c as ToolContext } from '../tool-Ca2x-VNK.mjs';
1
+ import { T as Tool, g as ToolContext } from '../tool-DGpwM6G6.mjs';
2
2
  import { z } from 'zod';
3
3
  import 'react';
4
4
 
@@ -1,4 +1,4 @@
1
- import { T as Tool, c as ToolContext } from '../tool-Ca2x-VNK.js';
1
+ import { T as Tool, g as ToolContext } from '../tool-DGpwM6G6.js';
2
2
  import { z } from 'zod';
3
3
  import 'react';
4
4
 
@@ -1,11 +1,9 @@
1
1
  import {
2
- init_schema,
3
2
  zodToJsonSchema
4
- } from "../chunk-XDWHMRBN.mjs";
5
- import "../chunk-CIESM3BP.mjs";
3
+ } from "../chunk-OH73K7I5.mjs";
4
+ import "../chunk-Y6FXYEAI.mjs";
6
5
 
7
6
  // src/mcp/server.ts
8
- init_schema();
9
7
  var PARSE_ERROR = -32700;
10
8
  var INVALID_REQUEST = -32600;
11
9
  var METHOD_NOT_FOUND = -32601;
@@ -322,9 +320,6 @@ var McpError = class extends Error {
322
320
  function createMCPServer(config) {
323
321
  return new MCPServer(config);
324
322
  }
325
-
326
- // src/mcp/index.ts
327
- init_schema();
328
323
  export {
329
324
  MCPServer,
330
325
  createMCPServer,
@@ -1,4 +1,4 @@
1
- import "../chunk-CIESM3BP.mjs";
1
+ import "../chunk-Y6FXYEAI.mjs";
2
2
 
3
3
  // src/persistence/memory.ts
4
4
  function createMemoryAdapter() {
@@ -1,4 +1,4 @@
1
- import { T as Tool, c as ToolContext } from '../tool-Ca2x-VNK.mjs';
1
+ import { g as ToolContext, T as Tool } from '../tool-DGpwM6G6.mjs';
2
2
  import 'zod';
3
3
  import 'react';
4
4
 
@@ -1,4 +1,4 @@
1
- import { T as Tool, c as ToolContext } from '../tool-Ca2x-VNK.js';
1
+ import { g as ToolContext, T as Tool } from '../tool-DGpwM6G6.js';
2
2
  import 'zod';
3
3
  import 'react';
4
4
 
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import "../chunk-CIESM3BP.mjs";
2
+ import "../chunk-Y6FXYEAI.mjs";
3
3
 
4
4
  // src/react/useTool.ts
5
5
  import { useState, useCallback, useEffect, useRef } from "react";
@@ -358,4 +358,4 @@ declare class ToolBuilder<TInput = any, TOutput = any> {
358
358
  };
359
359
  }
360
360
 
361
- export { type ClientHandler as C, type ServerHandler as S, Tool as T, type ViewComponent as V, ToolBuilder as a, type ToolConfig as b, type ToolContext as c, type StreamCallback as d, type StreamHandler as e, type ViewState as f, type CacheConfig as g, type ClientFetchConfig as h, tool as t };
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 ClientHandler as C, type ServerHandler as S, Tool as T, type ViewComponent as V, ToolBuilder as a, type ToolConfig as b, type ToolContext as c, type StreamCallback as d, type StreamHandler as e, type ViewState as f, type CacheConfig as g, type ClientFetchConfig as h, tool as t };
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.6.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": "^2.0.77",
79
- "@ai-sdk/react": "^2.0.107",
80
- "ai": "^5.0.107",
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": "^3.22.0",
84
- "zod": "^3.24.0"
83
+ "shiki": "^4.0.2",
84
+ "zod": "^3.25.76"
85
85
  },
86
86
  "peerDependencies": {
87
- "@ai-sdk/anthropic": "^2.0.0",
88
- "@ai-sdk/google": "^2.0.0",
89
- "jose": "^5.0.0",
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.0",
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.2.0",
120
- "jose": "^6.1.3",
121
- "react": "^19.2.1",
122
- "react-dom": "^19.2.1",
123
- "ts-jest": "^29.4.1",
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
  }
@@ -1,33 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
- }) : x)(function(x) {
8
- if (typeof require !== "undefined") return require.apply(this, arguments);
9
- throw Error('Dynamic require of "' + x + '" is not supported');
10
- });
11
- var __esm = (fn, res) => function __init() {
12
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
- };
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
-
28
- export {
29
- __require,
30
- __esm,
31
- __export,
32
- __toCommonJS
33
- };