@hanzo/react 0.1.2 → 1.0.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.
Files changed (52) hide show
  1. package/README.md +317 -53
  2. package/dist/index.d.mts +255 -0
  3. package/dist/index.d.ts +255 -0
  4. package/dist/index.js +548 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +539 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +84 -91
  9. package/src/components/HanzoProvider.test.tsx +346 -0
  10. package/src/components/HanzoProvider.tsx +508 -0
  11. package/src/hooks/index.ts +39 -0
  12. package/src/hooks/types.ts +162 -0
  13. package/src/hooks/useAuth.ts +0 -0
  14. package/src/hooks/useComponent.ts +0 -0
  15. package/src/hooks/useGenerativeUI.ts +0 -0
  16. package/src/hooks/useMCP.ts +0 -0
  17. package/src/hooks/useMessage.ts +105 -0
  18. package/src/hooks/useModelConfig.ts +0 -0
  19. package/src/hooks/useStreaming.ts +161 -0
  20. package/src/hooks/useSuggestions.ts +0 -0
  21. package/src/hooks/useThread.ts +0 -0
  22. package/src/hooks/useTool.ts +0 -0
  23. package/src/index.ts +40 -0
  24. package/src/types/index.ts +25 -0
  25. package/src/utils/cn.ts +6 -0
  26. package/src/utils/id.ts +6 -0
  27. package/src/utils/stream.ts +33 -0
  28. package/LICENSE +0 -21
  29. package/dist/index.cjs.js +0 -15755
  30. package/dist/index.cjs.js.map +0 -1
  31. package/dist/index.css +0 -789
  32. package/dist/index.esm.js +0 -15736
  33. package/dist/index.esm.js.map +0 -1
  34. package/dist/index.umd.js +0 -15756
  35. package/dist/index.umd.js.map +0 -1
  36. package/src/controls/.DS_Store +0 -0
  37. package/src/controls/MUICheckbox.js +0 -108
  38. package/src/controls/MUIKeyboardDatePicker.js +0 -90
  39. package/src/controls/MUIPhone.js +0 -33
  40. package/src/controls/MUISwitch.js +0 -107
  41. package/src/controls/MUIText.js +0 -298
  42. package/src/controls/NumericFormats.js +0 -57
  43. package/src/controls/control.js +0 -148
  44. package/src/controls/index.js +0 -7
  45. package/src/controls/material-ui-phone-number/components/Item.js +0 -66
  46. package/src/controls/material-ui-phone-number/components/flags.css +0 -789
  47. package/src/controls/material-ui-phone-number/components/index.js +0 -884
  48. package/src/controls/material-ui-phone-number/components/polyfills.js +0 -82
  49. package/src/controls/material-ui-phone-number/country_data.js +0 -1536
  50. package/src/controls/material-ui-phone-number/index.js +0 -3
  51. package/src/index.js +0 -1
  52. /package/src/{core/index.js → hooks/useAttachments.ts} +0 -0
package/README.md CHANGED
@@ -1,83 +1,347 @@
1
- # 📚 rollup-jest-boilerplate
1
+ # @hanzo/react
2
2
 
3
- > Full featured boilerplate for building JavaScript libraries the modern way.
3
+ React package for building AI-powered applications with generative UI, where users interact through natural language.
4
4
 
5
5
  ## Features
6
- - 📜 [Rollup.js](https://rollupjs.org/guide/en) configuration providing compatibility with different module systems (CommonJS, ECMAScript, UMD for `<script>` tags)
7
- - 🃏 [Jest](http://jestjs.io/) setup with watch mode working
8
- - 🛀 [Renovate](https://github.com/apps/renovate) configuration for auto updates (you have to activate it via https://github.com/apps/renovate)
9
- - [Travis CI](https://travis-ci.com/)
10
- - 🏗 [.nvmrc](https://github.com/creationix/nvm) file to enforce the Node.js version for contributors and continuous integration
11
- - ⚡️ Ready to publish and use
12
-
13
- ## How to use
14
-
15
- Decide of a new library name, let's say `new-super-library` (🤦🏼‍♀️), then in a terminal:
16
-
17
- ```sh
18
- curl --output rollup-jest-boilerplate.zip -LOk https://github.com/algolia/rollup-jest-boilerplate/archive/master.zip
19
- unzip rollup-jest-boilerplate.zip
20
- rm rollup-jest-boilerplate.zip
21
- mv rollup-jest-boilerplate-master new-super-library
6
+
7
+ - 🤖 **Generative UI** - Dynamically render React components in AI responses
8
+ - 🔄 **Real-time Streaming** - Stream AI responses with progress tracking
9
+ - 💬 **Message Threads** - Manage conversation history and context
10
+ - 🛠️ **Tool Calling** - Let AI execute functions during conversations
11
+ - 🔌 **Model Context Protocol** - MCP integration for enhanced AI capabilities
12
+ - 🎨 **Component Registry** - Register custom components for AI to use
13
+ - 🔐 **Authentication** - Built-in auth support for user management
14
+ - 📎 **File Attachments** - Handle images, documents, and other files
15
+ - 💡 **Smart Suggestions** - Provide contextual suggestions to users
16
+ - ⚡ **TypeScript Support** - Full type safety and IntelliSense
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install @hanzo/react
22
+ # or
23
+ pnpm add @hanzo/react
24
+ # or
25
+ yarn add @hanzo/react
22
26
  ```
23
27
 
24
- **Next steps:**
25
- - search the project for `rollup-starter-lib` and replace everywhere with `new-super-library`
26
- - start coding in [src/index.js](src/index.js)
27
- - profit 💸
28
+ ## Quick Start
29
+
30
+ ```tsx
31
+ import { HanzoProvider, useMessage } from '@hanzo/react'
32
+
33
+ function App() {
34
+ return (
35
+ <HanzoProvider apiKey={process.env.HANZO_API_KEY}>
36
+ <ChatInterface />
37
+ </HanzoProvider>
38
+ )
39
+ }
28
40
 
29
- ## Live examples
41
+ function ChatInterface() {
42
+ const { sendMessage, isLoading, lastMessage } = useMessage()
43
+
44
+ const handleSubmit = async (text: string) => {
45
+ const response = await sendMessage(text)
46
+ console.log('AI Response:', response)
47
+ }
48
+
49
+ return (
50
+ <div>
51
+ <input onKeyDown={(e) => {
52
+ if (e.key === 'Enter') {
53
+ handleSubmit(e.currentTarget.value)
54
+ }
55
+ }} />
56
+ {isLoading && <p>Loading...</p>}
57
+ {lastMessage && <div>{lastMessage.content}</div>}
58
+ </div>
59
+ )
60
+ }
61
+ ```
62
+
63
+ ## Core Concepts
30
64
 
31
- Those examples are using the live published version of this boilerplate library on [npm](https://www.npmjs.com/rollup-jest-boilerplate) and they run with [CodeSandbox](https://codesandbox.io/).
65
+ ### HanzoProvider
32
66
 
33
- - [ECMAScript](https://codesandbox.io/s/7ojknnqjl6?module=%2Fsrc%2Findex.js)
34
- - [CommonJS](https://codesandbox.io/s/o5q018q609?module=%2Fsrc%2Findex.js)
35
- - [UMD](https://codesandbox.io/s/jyqqp21rv), this leverages [jsDelivr npm CDN](https://www.jsdelivr.com/features)
67
+ The root component that provides Hanzo context to your app:
36
68
 
37
- ## Developer environment requirements
69
+ ```tsx
70
+ <HanzoProvider
71
+ apiKey="your-api-key"
72
+ apiUrl="https://api.hanzo.ai/v1"
73
+ model="gpt-4-turbo-preview"
74
+ components={[/* your components */]}
75
+ tools={[/* your tools */]}
76
+ enableStreaming={true}
77
+ enableMCP={true}
78
+ onMessage={(message) => console.log('New message:', message)}
79
+ onError={(error) => console.error('Error:', error)}
80
+ >
81
+ <YourApp />
82
+ </HanzoProvider>
83
+ ```
38
84
 
39
- To run this project, you will need:
85
+ ### Generative UI Components
40
86
 
41
- - Node.js >= v10.5.0, use nvm - [install instructions](https://github.com/creationix/nvm#install-script)
87
+ Register components that AI can dynamically render:
42
88
 
43
- ## Running tests
89
+ ```tsx
90
+ const components = [
91
+ {
92
+ name: 'weather-card',
93
+ component: WeatherCard,
94
+ description: 'Display weather information',
95
+ parameters: z.object({
96
+ city: z.string(),
97
+ temperature: z.number(),
98
+ conditions: z.string()
99
+ })
100
+ }
101
+ ]
44
102
 
45
- ```sh
46
- npm
47
- npm test
48
- npm test --watch
103
+ <HanzoProvider components={components}>
104
+ {/* AI can now render WeatherCard in responses */}
105
+ </HanzoProvider>
49
106
  ```
50
107
 
51
- ## Dev mode
108
+ ### Message Hooks
109
+
110
+ Send messages and handle responses:
111
+
112
+ ```tsx
113
+ // Basic messaging
114
+ const { sendMessage, isLoading, error } = useMessage()
52
115
 
53
- When developing you can run:
116
+ // Streaming responses
117
+ const { streamMessage, currentMessage, progress } = useStreaming()
54
118
 
119
+ // Thread management
120
+ const { threads, activeThread, createThread, switchThread } = useThread()
55
121
  ```
56
- npm run watch
122
+
123
+ ### Tool Calling
124
+
125
+ Add tools that AI can execute:
126
+
127
+ ```tsx
128
+ const tools = [
129
+ {
130
+ name: 'calculator',
131
+ description: 'Perform calculations',
132
+ parameters: z.object({
133
+ expression: z.string()
134
+ }),
135
+ execute: async ({ expression }) => {
136
+ return { result: eval(expression) }
137
+ }
138
+ }
139
+ ]
140
+
141
+ <HanzoProvider tools={tools}>
142
+ {/* AI can now use the calculator tool */}
143
+ </HanzoProvider>
57
144
  ```
58
145
 
59
- This will regenerate the build files each time a source file is changed and serve on http://127.0.0.1:5000.
146
+ ## Available Hooks
147
+
148
+ ### Core Hooks
149
+ - `useHanzo()` - Access complete Hanzo context
150
+ - `useMessage()` - Send messages and manage state
151
+ - `useStreaming()` - Stream AI responses in real-time
152
+ - `useThread()` - Manage conversation threads
60
153
 
61
- ### Previewing umd build in the browser
154
+ ### Component & Tool Hooks
155
+ - `useComponent()` - Dynamically register/render components
156
+ - `useTool()` - Execute and manage AI tools
157
+ - `useGenerativeUI()` - Generate UI components on the fly
62
158
 
63
- If your package works in the browser, you can open `dev/index.html` to try it out.
159
+ ### Utility Hooks
160
+ - `useSuggestions()` - Provide intelligent suggestions
161
+ - `useModelConfig()` - Configure and switch AI models
162
+ - `useAttachments()` - Handle file attachments
163
+ - `useAuth()` - Manage user authentication
164
+ - `useMCP()` - Model Context Protocol integration
64
165
 
65
- ## Publishing
166
+ ## Examples
66
167
 
67
- ```sh
68
- npm publish
168
+ ### Chat Application
169
+
170
+ ```tsx
171
+ import { HanzoProvider, useMessage, useStreaming } from '@hanzo/react'
172
+
173
+ function ChatApp() {
174
+ const [messages, setMessages] = useState([])
175
+ const { sendMessage } = useMessage()
176
+ const { streamMessage, currentMessage, isStreaming } = useStreaming()
177
+
178
+ const handleSend = async (text: string) => {
179
+ // Add user message
180
+ setMessages(prev => [...prev, { role: 'user', content: text }])
181
+
182
+ // Stream AI response
183
+ await streamMessage(text)
184
+
185
+ // Add AI message when complete
186
+ setMessages(prev => [...prev, {
187
+ role: 'assistant',
188
+ content: currentMessage
189
+ }])
190
+ }
191
+
192
+ return (
193
+ <div>
194
+ {messages.map((msg, i) => (
195
+ <div key={i} className={msg.role}>
196
+ {msg.content}
197
+ </div>
198
+ ))}
199
+ {isStreaming && <div>{currentMessage}</div>}
200
+ </div>
201
+ )
202
+ }
69
203
  ```
70
204
 
71
- ## Additional tooling
205
+ ### Custom Components
206
+
207
+ ```tsx
208
+ // Define a custom visualization component
209
+ function DataChart({ data, type }) {
210
+ return <Chart data={data} type={type} />
211
+ }
212
+
213
+ // Register it with Hanzo
214
+ const components = [
215
+ {
216
+ name: 'data-chart',
217
+ component: DataChart,
218
+ description: 'Visualize data in a chart',
219
+ parameters: z.object({
220
+ data: z.array(z.number()),
221
+ type: z.enum(['bar', 'line', 'pie'])
222
+ })
223
+ }
224
+ ]
225
+
226
+ // Use in your app
227
+ <HanzoProvider components={components}>
228
+ <ChatInterface />
229
+ </HanzoProvider>
230
+ ```
231
+
232
+ ### Tool Integration
233
+
234
+ ```tsx
235
+ const tools = [
236
+ {
237
+ name: 'fetchData',
238
+ description: 'Fetch data from API',
239
+ parameters: z.object({
240
+ endpoint: z.string().url()
241
+ }),
242
+ execute: async ({ endpoint }) => {
243
+ const response = await fetch(endpoint)
244
+ return response.json()
245
+ }
246
+ },
247
+ {
248
+ name: 'saveToDatabase',
249
+ description: 'Save data to database',
250
+ parameters: z.object({
251
+ collection: z.string(),
252
+ data: z.any()
253
+ }),
254
+ execute: async ({ collection, data }) => {
255
+ await db.collection(collection).insert(data)
256
+ return { success: true }
257
+ }
258
+ }
259
+ ]
260
+
261
+ <HanzoProvider tools={tools}>
262
+ {/* AI can now fetch data and save to database */}
263
+ </HanzoProvider>
264
+ ```
265
+
266
+ ## TypeScript
267
+
268
+ Full TypeScript support with type definitions:
269
+
270
+ ```tsx
271
+ import type {
272
+ HanzoComponent,
273
+ HanzoTool,
274
+ Message,
275
+ Thread
276
+ } from '@hanzo/react'
277
+
278
+ const component: HanzoComponent = {
279
+ name: 'my-component',
280
+ component: MyComponent,
281
+ description: 'A typed component',
282
+ parameters: z.object({
283
+ title: z.string(),
284
+ count: z.number()
285
+ })
286
+ }
287
+
288
+ const tool: HanzoTool = {
289
+ name: 'my-tool',
290
+ description: 'A typed tool',
291
+ parameters: z.object({
292
+ input: z.string()
293
+ }),
294
+ execute: async ({ input }) => {
295
+ return { processed: input.toUpperCase() }
296
+ }
297
+ }
298
+ ```
299
+
300
+ ## API Reference
301
+
302
+ ### HanzoProvider Props
303
+
304
+ | Prop | Type | Required | Default | Description |
305
+ |------|------|----------|---------|-------------|
306
+ | `apiKey` | `string` | Yes | - | Your Hanzo API key |
307
+ | `apiUrl` | `string` | No | `https://api.hanzo.ai/v1` | API endpoint URL |
308
+ | `model` | `string` | No | `gpt-4-turbo-preview` | AI model to use |
309
+ | `components` | `HanzoComponent[]` | No | `[]` | Registered components |
310
+ | `tools` | `HanzoTool[]` | No | `[]` | Available tools |
311
+ | `initialMessages` | `Message[]` | No | `[]` | Initial conversation |
312
+ | `enableStreaming` | `boolean` | No | `true` | Enable streaming |
313
+ | `enableMCP` | `boolean` | No | `false` | Enable MCP |
314
+ | `onMessage` | `(message: Message) => void` | No | - | Message callback |
315
+ | `onError` | `(error: Error) => void` | No | - | Error callback |
316
+
317
+ ### Hook Options
318
+
319
+ Most hooks accept configuration options:
320
+
321
+ ```tsx
322
+ const { sendMessage } = useMessage({
323
+ threadId: 'custom-thread',
324
+ onSuccess: (message) => console.log('Sent:', message),
325
+ onError: (error) => console.error('Error:', error),
326
+ autoRetry: true,
327
+ maxRetries: 3,
328
+ retryDelay: 1000
329
+ })
330
+
331
+ const { streamMessage } = useStreaming({
332
+ onChunk: (chunk) => console.log('Chunk:', chunk),
333
+ onComplete: (message) => console.log('Complete:', message),
334
+ bufferSize: 5,
335
+ throttleMs: 100
336
+ })
337
+ ```
72
338
 
73
- Based on your need, you might want to add:
74
- - [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/)
75
- - [TypeScript](https://www.typescriptlang.org/) support
76
- - Monorepo support with [Lerna](https://lernajs.io/)
77
- - CHANGELOG.md generation with [conventional-changelog](https://github.com/conventional-changelog)
339
+ ## License
78
340
 
79
- If so, please do and open pull requests when you feel like it.
341
+ BSD-3-Clause © Hanzo AI, Inc.
80
342
 
81
- ## Original idea
343
+ ## Support
82
344
 
83
- I initially used [rollup/rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) but really needed that Jest support so I did it.
345
+ - Documentation: [https://ui.hanzo.ai/docs/hanzo-react](https://ui.hanzo.ai/docs/hanzo-react)
346
+ - GitHub: [https://github.com/hanzoai/ui](https://github.com/hanzoai/ui)
347
+ - Discord: [https://discord.gg/hanzo](https://discord.gg/hanzo)
@@ -0,0 +1,255 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React$1 from 'react';
3
+ import { z } from 'zod';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ interface HanzoComponent {
7
+ name: string;
8
+ component: React$1.ComponentType<any>;
9
+ description?: string;
10
+ parameters?: z.ZodType<any>;
11
+ generateUI?: (params: any) => React$1.ReactElement;
12
+ }
13
+ interface HanzoTool {
14
+ name: string;
15
+ description: string;
16
+ parameters: z.ZodType<any>;
17
+ execute: (params: any) => Promise<any>;
18
+ }
19
+ interface Message {
20
+ id: string;
21
+ role: 'user' | 'assistant' | 'system' | 'tool';
22
+ content: string | React$1.ReactElement;
23
+ timestamp: Date;
24
+ threadId: string;
25
+ toolCalls?: ToolCall[];
26
+ metadata?: Record<string, any>;
27
+ }
28
+ interface ToolCall {
29
+ id: string;
30
+ name: string;
31
+ arguments: any;
32
+ result?: any;
33
+ status: 'pending' | 'running' | 'completed' | 'failed';
34
+ }
35
+ interface Thread {
36
+ id: string;
37
+ messages: Message[];
38
+ createdAt: Date;
39
+ updatedAt: Date;
40
+ metadata?: Record<string, any>;
41
+ }
42
+ interface HanzoContextValue {
43
+ apiKey?: string;
44
+ apiUrl?: string;
45
+ model?: string;
46
+ components: Map<string, HanzoComponent>;
47
+ tools: Map<string, HanzoTool>;
48
+ threads: Map<string, Thread>;
49
+ activeThreadId?: string;
50
+ sendMessage: (content: string, threadId?: string) => Promise<Message>;
51
+ streamMessage: (content: string, threadId?: string) => AsyncGenerator<Message>;
52
+ createThread: (metadata?: Record<string, any>) => Thread;
53
+ switchThread: (threadId: string) => void;
54
+ deleteThread: (threadId: string) => void;
55
+ registerComponent: (component: HanzoComponent) => void;
56
+ unregisterComponent: (name: string) => void;
57
+ renderComponent: (name: string, props: any) => React$1.ReactElement | null;
58
+ registerTool: (tool: HanzoTool) => void;
59
+ unregisterTool: (name: string) => void;
60
+ executeTool: (name: string, params: any) => Promise<any>;
61
+ isStreaming: boolean;
62
+ responseStage?: 'thinking' | 'generating' | 'tool-calling' | 'completed';
63
+ error?: Error;
64
+ }
65
+ interface HanzoProviderProps {
66
+ children: React$1.ReactNode;
67
+ apiKey?: string;
68
+ apiUrl?: string;
69
+ model?: string;
70
+ components?: HanzoComponent[];
71
+ tools?: HanzoTool[];
72
+ initialMessages?: Message[];
73
+ onMessage?: (message: Message) => void;
74
+ onError?: (error: Error) => void;
75
+ enableStreaming?: boolean;
76
+ enableMCP?: boolean;
77
+ mcpServers?: string[];
78
+ }
79
+ declare function HanzoProvider({ children, apiKey, apiUrl, model, components: initialComponents, tools: initialTools, initialMessages, onMessage, onError, enableStreaming, enableMCP, // eslint-disable-line @typescript-eslint/no-unused-vars
80
+ mcpServers }: HanzoProviderProps): react_jsx_runtime.JSX.Element;
81
+ declare function useHanzo(): HanzoContextValue;
82
+
83
+ interface UseMessageOptions {
84
+ threadId?: string;
85
+ onSuccess?: (message: Message) => void;
86
+ onError?: (error: Error) => void;
87
+ autoRetry?: boolean;
88
+ maxRetries?: number;
89
+ retryDelay?: number;
90
+ }
91
+ interface UseMessageReturn {
92
+ sendMessage: (content: string) => Promise<Message>;
93
+ sendMessageWithAttachments: (content: string, attachments: File[]) => Promise<Message>;
94
+ isLoading: boolean;
95
+ error: Error | null;
96
+ lastMessage: Message | null;
97
+ clearError: () => void;
98
+ retry: () => Promise<void>;
99
+ }
100
+ declare function useMessage(options?: UseMessageOptions): UseMessageReturn;
101
+
102
+ interface UseStreamingOptions {
103
+ threadId?: string;
104
+ onChunk?: (chunk: string) => void;
105
+ onComplete?: (message: Message) => void;
106
+ onError?: (error: Error) => void;
107
+ bufferSize?: number;
108
+ throttleMs?: number;
109
+ }
110
+ interface UseStreamingReturn {
111
+ streamMessage: (content: string) => Promise<void>;
112
+ isStreaming: boolean;
113
+ currentMessage: string;
114
+ error: Error | null;
115
+ stopStreaming: () => void;
116
+ clearMessage: () => void;
117
+ progress: number;
118
+ }
119
+ declare function useStreaming(options?: UseStreamingOptions): UseStreamingReturn;
120
+
121
+ declare function cn(...inputs: ClassValue[]): string;
122
+
123
+ declare function generateId(prefix?: string): string;
124
+
125
+ declare function parseStream(stream: ReadableStream<Uint8Array>): Promise<string>;
126
+
127
+ interface UseThreadOptions {
128
+ maxThreads?: number;
129
+ autoArchive?: boolean;
130
+ }
131
+ interface UseThreadReturn {
132
+ threads: Map<string, any>;
133
+ activeThread: any | undefined;
134
+ createThread: (metadata?: Record<string, any>) => any;
135
+ switchThread: (threadId: string) => void;
136
+ deleteThread: (threadId: string) => void;
137
+ updateThreadMetadata: (threadId: string, metadata: Record<string, any>) => void;
138
+ getThreadMessages: (threadId: string) => any[];
139
+ clearThread: (threadId: string) => void;
140
+ }
141
+ interface UseComponentOptions {
142
+ lazy?: boolean;
143
+ }
144
+ interface UseComponentReturn {
145
+ registerComponent: (component: any) => void;
146
+ unregisterComponent: (name: string) => void;
147
+ renderComponent: (name: string, props: any) => React.ReactElement | null;
148
+ getComponent: (name: string) => any | undefined;
149
+ hasComponent: (name: string) => boolean;
150
+ listComponents: () => string[];
151
+ }
152
+ interface UseToolOptions {
153
+ timeout?: number;
154
+ }
155
+ interface UseToolReturn {
156
+ executeTool: (name: string, params: any) => Promise<any>;
157
+ registerTool: (tool: any) => void;
158
+ unregisterTool: (name: string) => void;
159
+ isExecuting: boolean;
160
+ lastResult: any | null;
161
+ error: Error | null;
162
+ }
163
+ interface UseSuggestionsOptions {
164
+ maxSuggestions?: number;
165
+ autoRefresh?: boolean;
166
+ refreshInterval?: number;
167
+ }
168
+ interface UseSuggestionsReturn {
169
+ suggestions: any[];
170
+ getSuggestions: (options?: any) => Promise<void>;
171
+ acceptSuggestion: (suggestion: any) => void;
172
+ dismissSuggestion: (id: string) => void;
173
+ isLoading: boolean;
174
+ }
175
+ interface UseModelConfigOptions {
176
+ defaultModel?: string;
177
+ }
178
+ interface UseModelConfigReturn {
179
+ currentModel: string;
180
+ availableModels: any[];
181
+ switchModel: (modelId: string) => void;
182
+ updateParameters: (params: any) => void;
183
+ resetToDefaults: () => void;
184
+ }
185
+ interface UseMCPOptions {
186
+ autoConnect?: boolean;
187
+ }
188
+ interface UseMCPReturn {
189
+ connectServer: (config: any) => Promise<void>;
190
+ disconnectServer: (id: string) => void;
191
+ connectedServers: any[];
192
+ executeServerTool: (serverId: string, tool: string, params: any) => Promise<any>;
193
+ getServerResources: (serverId: string) => any[];
194
+ isConnected: (serverId: string) => boolean;
195
+ }
196
+ interface UseGenerativeUIOptions {
197
+ cacheResults?: boolean;
198
+ }
199
+ interface UseGenerativeUIReturn {
200
+ generateUI: (options: any) => Promise<React.ReactElement>;
201
+ isGenerating: boolean;
202
+ generatedComponents: React.ReactElement[];
203
+ clearComponents: () => void;
204
+ saveComponent: (name: string, component: React.ReactElement) => void;
205
+ }
206
+ interface UseAuthOptions {
207
+ provider?: string;
208
+ }
209
+ interface UseAuthReturn {
210
+ user: any | null;
211
+ isAuthenticated: boolean;
212
+ isLoading: boolean;
213
+ signIn: (options?: any) => Promise<void>;
214
+ signOut: () => Promise<void>;
215
+ getToken: () => Promise<string | null>;
216
+ refreshToken: () => Promise<void>;
217
+ }
218
+ interface UseAttachmentsOptions {
219
+ maxSize?: number;
220
+ allowedTypes?: string[];
221
+ autoUpload?: boolean;
222
+ }
223
+ interface UseAttachmentsReturn {
224
+ attachments: any[];
225
+ addAttachment: (file: File) => Promise<any>;
226
+ removeAttachment: (id: string) => void;
227
+ clearAttachments: () => void;
228
+ uploadAttachment: (attachment: any) => Promise<void>;
229
+ isUploading: boolean;
230
+ uploadProgress: number;
231
+ }
232
+
233
+ interface Suggestion {
234
+ id: string;
235
+ text: string;
236
+ metadata?: Record<string, any>;
237
+ }
238
+ interface Model {
239
+ id: string;
240
+ name: string;
241
+ description: string;
242
+ parameters?: Record<string, any>;
243
+ }
244
+ interface Attachment {
245
+ id: string;
246
+ name: string;
247
+ size: number;
248
+ type: string;
249
+ url?: string;
250
+ file?: File;
251
+ }
252
+
253
+ declare const VERSION = "1.0.0";
254
+
255
+ export { type Attachment, type HanzoComponent, type HanzoContextValue, HanzoProvider, type HanzoProviderProps, type HanzoTool, type Message, type Model, type Suggestion, type Thread, type ToolCall, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseAuthOptions, type UseAuthReturn, type UseComponentOptions, type UseComponentReturn, type UseGenerativeUIOptions, type UseGenerativeUIReturn, type UseMCPOptions, type UseMCPReturn, type UseMessageOptions, type UseMessageReturn, type UseModelConfigOptions, type UseModelConfigReturn, type UseStreamingOptions, type UseStreamingReturn, type UseSuggestionsOptions, type UseSuggestionsReturn, type UseThreadOptions, type UseThreadReturn, type UseToolOptions, type UseToolReturn, VERSION, cn, generateId, parseStream, useHanzo, useMessage, useStreaming };