@leanmcp/ui 0.3.4 → 0.3.6
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/chunk-57VDL5UC.js +138 -0
- package/dist/chunk-57VDL5UC.js.map +1 -0
- package/dist/chunk-5RGEQPF3.mjs +124 -0
- package/dist/chunk-5RGEQPF3.mjs.map +1 -0
- package/dist/globals.css +138 -0
- package/dist/index.css +641 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +1773 -0
- package/dist/index.d.ts +1773 -0
- package/dist/index.js +3751 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3521 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server.d.mts +179 -0
- package/dist/server.d.ts +179 -0
- package/dist/server.js +73 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +4 -0
- package/dist/server.mjs.map +1 -0
- package/dist/styles.css +4 -0
- package/dist/theme.css +102 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1773 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { ReactNode, ButtonHTMLAttributes, Component, ErrorInfo, HTMLAttributes, InputHTMLAttributes } from 'react';
|
|
4
|
+
import { McpUiAppCapabilities, App, McpUiHostContext, McpUiDisplayMode, McpUiHostStyles } from '@modelcontextprotocol/ext-apps';
|
|
5
|
+
export { App, McpUiAppCapabilities, McpUiDisplayMode, McpUiHostContext, McpUiHostCss, McpUiHostStyles, McpUiResourceCsp, McpUiResourceMeta, McpUiStyles, McpUiTheme, McpUiToolCancelledNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolMeta, McpUiToolResultNotification, McpUiToolVisibility, PostMessageTransport, RESOURCE_MIME_TYPE, RESOURCE_URI_META_KEY, applyDocumentTheme, applyHostFonts, applyHostStyleVariables, getDocumentTheme } from '@modelcontextprotocol/ext-apps';
|
|
6
|
+
import { CallToolResult, ContentBlock } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import { ToasterProps } from 'sonner';
|
|
8
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
9
|
+
import { VariantProps } from 'class-variance-authority';
|
|
10
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
11
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
12
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
13
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
14
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
15
|
+
import * as react_hook_form from 'react-hook-form';
|
|
16
|
+
import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
|
|
17
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
18
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
19
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
20
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
21
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
22
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
23
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
24
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
25
|
+
import { Command as Command$1 } from 'cmdk';
|
|
26
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
27
|
+
import { ClassValue } from 'clsx';
|
|
28
|
+
export { GPTApp, GPTAppOptions, UIApp, UIAppOptions, getGPTAppMetadata, getGPTAppUri, getUIAppMetadata, getUIAppUri } from './server.js';
|
|
29
|
+
import { ChartData, ChartType as ChartType$1, ChartOptions } from 'chart.js';
|
|
30
|
+
export { AppBridge } from '@modelcontextprotocol/ext-apps/app-bridge';
|
|
31
|
+
import '@modelcontextprotocol/ext-apps/server';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* App information (same as ext-apps Implementation)
|
|
35
|
+
*/
|
|
36
|
+
interface AppInfo {
|
|
37
|
+
name: string;
|
|
38
|
+
version: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Options for App behavior
|
|
42
|
+
*/
|
|
43
|
+
interface AppOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Automatically report size changes to the host using ResizeObserver.
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
autoResize?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* MCP App context value - available via useMcpApp()
|
|
52
|
+
*/
|
|
53
|
+
interface McpAppContextValue {
|
|
54
|
+
/** The ext-apps App instance */
|
|
55
|
+
app: App | null;
|
|
56
|
+
/** Whether connected to host */
|
|
57
|
+
isConnected: boolean;
|
|
58
|
+
/** Connection error, if any */
|
|
59
|
+
error: Error | null;
|
|
60
|
+
/** Host context (theme, viewport, etc.) */
|
|
61
|
+
hostContext: McpUiHostContext;
|
|
62
|
+
/** Tool input arguments received from host */
|
|
63
|
+
toolInput: Record<string, unknown> | null;
|
|
64
|
+
/** Partial tool input (streaming) */
|
|
65
|
+
toolInputPartial: Record<string, unknown> | null;
|
|
66
|
+
/** Tool result received from host */
|
|
67
|
+
toolResult: CallToolResult | null;
|
|
68
|
+
/** Whether the tool was cancelled by host */
|
|
69
|
+
toolCancelled: {
|
|
70
|
+
cancelled: boolean;
|
|
71
|
+
reason?: string;
|
|
72
|
+
};
|
|
73
|
+
/** Call a server tool */
|
|
74
|
+
callTool: (name: string, args?: Record<string, unknown>) => Promise<CallToolResult>;
|
|
75
|
+
/** Send a message to the host chat */
|
|
76
|
+
sendMessage: (text: string) => Promise<void>;
|
|
77
|
+
/** Send a log message */
|
|
78
|
+
sendLog: (level: 'debug' | 'info' | 'warning' | 'error', data: unknown) => Promise<void>;
|
|
79
|
+
/** Open a link in the host */
|
|
80
|
+
openLink: (url: string) => Promise<void>;
|
|
81
|
+
/** Request a display mode change */
|
|
82
|
+
requestDisplayMode: (mode: McpUiDisplayMode) => Promise<McpUiDisplayMode>;
|
|
83
|
+
}
|
|
84
|
+
interface AppProviderProps {
|
|
85
|
+
/** App name and version */
|
|
86
|
+
appInfo: AppInfo;
|
|
87
|
+
/** App capabilities (tools, experimental features) */
|
|
88
|
+
capabilities?: McpUiAppCapabilities;
|
|
89
|
+
/** App options (autoResize, etc.) */
|
|
90
|
+
options?: AppOptions;
|
|
91
|
+
/** Callback when host requests teardown */
|
|
92
|
+
onTeardown?: () => void | Promise<void>;
|
|
93
|
+
/** React children */
|
|
94
|
+
children: ReactNode;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* AppProvider - Root context for MCP Apps
|
|
98
|
+
*
|
|
99
|
+
* Provides connection management and hooks for MCP App components.
|
|
100
|
+
* Uses PostMessage transport for iframe communication.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```tsx
|
|
104
|
+
* function MyApp() {
|
|
105
|
+
* return (
|
|
106
|
+
* <AppProvider
|
|
107
|
+
* appInfo={{ name: "MyApp", version: "1.0.0" }}
|
|
108
|
+
* capabilities={{ tools: { listChanged: true } }}
|
|
109
|
+
* options={{ autoResize: true }}
|
|
110
|
+
* onTeardown={() => console.log('Cleaning up...')}
|
|
111
|
+
* >
|
|
112
|
+
* <MyContent />
|
|
113
|
+
* </AppProvider>
|
|
114
|
+
* );
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare function AppProvider({ appInfo, capabilities, options, onTeardown, children }: AppProviderProps): react_jsx_runtime.JSX.Element;
|
|
119
|
+
/**
|
|
120
|
+
* Hook to access the MCP App context
|
|
121
|
+
* Returns SSR-safe defaults when no provider is available (during server rendering)
|
|
122
|
+
*/
|
|
123
|
+
declare function useMcpApp(): McpAppContextValue;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* ChatGPT's window.openai interface
|
|
127
|
+
* Based on: https://developers.openai.com/apps-sdk/build/chatgpt-ui#understand-the-windowopenai-api
|
|
128
|
+
*/
|
|
129
|
+
interface OpenAISDK {
|
|
130
|
+
/** Input arguments for the tool */
|
|
131
|
+
toolInput?: Record<string, unknown>;
|
|
132
|
+
/** Structured content returned by the tool */
|
|
133
|
+
toolOutput?: any;
|
|
134
|
+
/** Metadata returned by the tool */
|
|
135
|
+
toolResponseMetadata?: Record<string, unknown>;
|
|
136
|
+
/** Persisted state for this widget instance */
|
|
137
|
+
widgetState?: Record<string, unknown>;
|
|
138
|
+
/** Call a server tool */
|
|
139
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<any>;
|
|
140
|
+
/** Send a follow-up message to chat */
|
|
141
|
+
sendFollowUpMessage?: (options: {
|
|
142
|
+
prompt: string;
|
|
143
|
+
}) => Promise<void>;
|
|
144
|
+
/** Upload a file */
|
|
145
|
+
uploadFile?: (file: File) => Promise<{
|
|
146
|
+
fileId: string;
|
|
147
|
+
}>;
|
|
148
|
+
/** Get download URL for a file */
|
|
149
|
+
getFileDownloadUrl?: (options: {
|
|
150
|
+
fileId: string;
|
|
151
|
+
}) => Promise<{
|
|
152
|
+
downloadUrl: string;
|
|
153
|
+
}>;
|
|
154
|
+
/** Persist widget state */
|
|
155
|
+
setWidgetState?: (state: Record<string, unknown>) => void;
|
|
156
|
+
/** Current theme */
|
|
157
|
+
theme?: 'light' | 'dark';
|
|
158
|
+
/** Current locale */
|
|
159
|
+
locale?: string;
|
|
160
|
+
/** Display mode */
|
|
161
|
+
displayMode?: 'inline' | 'modal' | 'fullscreen';
|
|
162
|
+
/** Maximum height for the widget */
|
|
163
|
+
maxHeight?: number;
|
|
164
|
+
/** Safe area insets */
|
|
165
|
+
safeArea?: {
|
|
166
|
+
top: number;
|
|
167
|
+
right: number;
|
|
168
|
+
bottom: number;
|
|
169
|
+
left: number;
|
|
170
|
+
};
|
|
171
|
+
/** View type */
|
|
172
|
+
view?: 'desktop' | 'mobile';
|
|
173
|
+
}
|
|
174
|
+
declare global {
|
|
175
|
+
interface Window {
|
|
176
|
+
openai?: OpenAISDK;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* GPT App context value - available via useGptApp()
|
|
181
|
+
*/
|
|
182
|
+
interface GptAppContextValue {
|
|
183
|
+
/** Whether connected to ChatGPT host */
|
|
184
|
+
isConnected: boolean;
|
|
185
|
+
/** Connection error, if any */
|
|
186
|
+
error: Error | null;
|
|
187
|
+
/** Theme from host */
|
|
188
|
+
theme: 'light' | 'dark';
|
|
189
|
+
/** Display mode */
|
|
190
|
+
displayMode: string;
|
|
191
|
+
/** Locale */
|
|
192
|
+
locale: string;
|
|
193
|
+
/** Max height from host */
|
|
194
|
+
maxHeight: number;
|
|
195
|
+
/** Call a server tool via ChatGPT */
|
|
196
|
+
callTool: (name: string, args?: Record<string, unknown>) => Promise<any>;
|
|
197
|
+
}
|
|
198
|
+
interface GPTAppProviderProps {
|
|
199
|
+
/** App name */
|
|
200
|
+
appName: string;
|
|
201
|
+
/** React children */
|
|
202
|
+
children: ReactNode;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* GPTAppProvider - Root context for ChatGPT Apps
|
|
206
|
+
*
|
|
207
|
+
* Uses ChatGPT's native window.openai SDK for host communication.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```tsx
|
|
211
|
+
* function MyGPTApp() {
|
|
212
|
+
* return (
|
|
213
|
+
* <GPTAppProvider appName="MyApp">
|
|
214
|
+
* <MyContent />
|
|
215
|
+
* </GPTAppProvider>
|
|
216
|
+
* );
|
|
217
|
+
* }
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
declare function GPTAppProvider({ appName, children }: GPTAppProviderProps): react_jsx_runtime.JSX.Element;
|
|
221
|
+
/**
|
|
222
|
+
* Hook to access the GPT App context
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```tsx
|
|
226
|
+
* function MyComponent() {
|
|
227
|
+
* const { isConnected, theme, callTool } = useGptApp();
|
|
228
|
+
* // ...
|
|
229
|
+
* }
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
declare function useGptApp(): GptAppContextValue;
|
|
233
|
+
/**
|
|
234
|
+
* Hook to call tools via ChatGPT SDK
|
|
235
|
+
* Similar to useTool but for GPT Apps
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```tsx
|
|
239
|
+
* function MyComponent() {
|
|
240
|
+
* const { call, result, loading, error } = useGptTool('myTool');
|
|
241
|
+
*
|
|
242
|
+
* useEffect(() => {
|
|
243
|
+
* call({ param: 'value' });
|
|
244
|
+
* }, []);
|
|
245
|
+
*
|
|
246
|
+
* if (loading) return <div>Loading...</div>;
|
|
247
|
+
* return <div>{JSON.stringify(result)}</div>;
|
|
248
|
+
* }
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
declare function useGptTool(toolName: string): {
|
|
252
|
+
call: (args?: Record<string, unknown>) => Promise<any>;
|
|
253
|
+
result: any;
|
|
254
|
+
loading: boolean;
|
|
255
|
+
error: Error | null;
|
|
256
|
+
isConnected: boolean;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* MCP-Native UI SDK - Core Types
|
|
261
|
+
*
|
|
262
|
+
* Type definitions for MCP-native component patterns. These types enable
|
|
263
|
+
* declarative tool binding, result handling, and resource integration.
|
|
264
|
+
*/
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Configuration for binding a UI component to an MCP tool
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```tsx
|
|
271
|
+
* // Simple string binding
|
|
272
|
+
* <ToolButton tool="refresh-data" />
|
|
273
|
+
*
|
|
274
|
+
* // Full configuration
|
|
275
|
+
* <ToolButton tool={{
|
|
276
|
+
* name: "create-item",
|
|
277
|
+
* args: { type: "note" },
|
|
278
|
+
* transform: (r) => r.item
|
|
279
|
+
* }} />
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
interface ToolBinding<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
283
|
+
/** Tool name to call */
|
|
284
|
+
name: string;
|
|
285
|
+
/** Static arguments (merged with dynamic args) */
|
|
286
|
+
args?: Partial<TArgs>;
|
|
287
|
+
/** Transform result before passing to handlers */
|
|
288
|
+
transform?: (result: CallToolResult) => TResult;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Normalized tool binding - always an object, never a string
|
|
292
|
+
*/
|
|
293
|
+
type NormalizedToolBinding<TArgs = Record<string, unknown>, TResult = unknown> = ToolBinding<TArgs, TResult>;
|
|
294
|
+
/**
|
|
295
|
+
* Helper to normalize string or ToolBinding to ToolBinding
|
|
296
|
+
*/
|
|
297
|
+
declare function normalizeToolBinding<TArgs = Record<string, unknown>, TResult = unknown>(tool: string | ToolBinding<TArgs, TResult>): NormalizedToolBinding<TArgs, TResult>;
|
|
298
|
+
/**
|
|
299
|
+
* Shared props for components that can trigger MCP tool calls
|
|
300
|
+
*/
|
|
301
|
+
interface McpActionProps<TResult = unknown> {
|
|
302
|
+
/** Tool to call on action */
|
|
303
|
+
tool?: string | ToolBinding<Record<string, unknown>, TResult>;
|
|
304
|
+
/** Called when tool execution starts */
|
|
305
|
+
onToolStart?: () => void;
|
|
306
|
+
/** Called on successful tool result */
|
|
307
|
+
onToolSuccess?: (result: TResult) => void;
|
|
308
|
+
/** Called on tool error */
|
|
309
|
+
onToolError?: (error: Error) => void;
|
|
310
|
+
/** Called after tool completes (success or error) */
|
|
311
|
+
onToolComplete?: () => void;
|
|
312
|
+
/** Disable component during tool execution (default: true) */
|
|
313
|
+
disableWhileLoading?: boolean;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Configuration for how to display tool results
|
|
317
|
+
*/
|
|
318
|
+
interface ToolResultConfig {
|
|
319
|
+
/** How to display the result */
|
|
320
|
+
display: 'inline' | 'toast' | 'modal' | 'none';
|
|
321
|
+
/** Custom result renderer */
|
|
322
|
+
renderResult?: (result: unknown) => ReactNode;
|
|
323
|
+
/** Auto-dismiss after ms (for toast) */
|
|
324
|
+
autoDismiss?: number;
|
|
325
|
+
/** Success message template */
|
|
326
|
+
successMessage?: string | ((result: unknown) => string);
|
|
327
|
+
/** Error message template */
|
|
328
|
+
errorMessage?: string | ((error: Error) => string);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Default result display config
|
|
332
|
+
*/
|
|
333
|
+
declare const DEFAULT_RESULT_CONFIG: ToolResultConfig;
|
|
334
|
+
/**
|
|
335
|
+
* Configuration for confirmation dialog before tool execution
|
|
336
|
+
*/
|
|
337
|
+
interface ConfirmConfig {
|
|
338
|
+
/** Dialog title */
|
|
339
|
+
title?: string;
|
|
340
|
+
/** Dialog description */
|
|
341
|
+
description?: string;
|
|
342
|
+
/** Confirm button text */
|
|
343
|
+
confirmText?: string;
|
|
344
|
+
/** Cancel button text */
|
|
345
|
+
cancelText?: string;
|
|
346
|
+
/** Confirm button variant */
|
|
347
|
+
confirmVariant?: 'default' | 'destructive';
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Configuration for binding a component to an MCP resource
|
|
351
|
+
*/
|
|
352
|
+
interface ResourceBinding {
|
|
353
|
+
/** Resource URI */
|
|
354
|
+
uri: string;
|
|
355
|
+
/** Refresh interval in ms */
|
|
356
|
+
refreshInterval?: number;
|
|
357
|
+
/** Subscribe to resource changes */
|
|
358
|
+
subscribe?: boolean;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* States a tool call can be in
|
|
362
|
+
*/
|
|
363
|
+
type ToolState = 'idle' | 'loading' | 'success' | 'error';
|
|
364
|
+
/**
|
|
365
|
+
* Full tool call state with data
|
|
366
|
+
*/
|
|
367
|
+
interface ToolCallState<T = unknown> {
|
|
368
|
+
/** Current state */
|
|
369
|
+
state: ToolState;
|
|
370
|
+
/** Whether currently loading */
|
|
371
|
+
loading: boolean;
|
|
372
|
+
/** Last successful result */
|
|
373
|
+
result: T | null;
|
|
374
|
+
/** Last error */
|
|
375
|
+
error: Error | null;
|
|
376
|
+
/** Whether we have a result (success or error) */
|
|
377
|
+
hasResult: boolean;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Initial tool call state
|
|
381
|
+
*/
|
|
382
|
+
declare const INITIAL_TOOL_STATE: ToolCallState;
|
|
383
|
+
/**
|
|
384
|
+
* Options for useTool hook
|
|
385
|
+
*/
|
|
386
|
+
interface UseToolOptions<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
387
|
+
/** Static arguments merged with each call */
|
|
388
|
+
defaultArgs?: Partial<TArgs>;
|
|
389
|
+
/** Transform result before returning */
|
|
390
|
+
transform?: (result: CallToolResult) => TResult;
|
|
391
|
+
/** Retry configuration */
|
|
392
|
+
retry?: number | {
|
|
393
|
+
count: number;
|
|
394
|
+
delay: number;
|
|
395
|
+
};
|
|
396
|
+
/** Callbacks */
|
|
397
|
+
onStart?: () => void;
|
|
398
|
+
onSuccess?: (result: TResult) => void;
|
|
399
|
+
onError?: (error: Error) => void;
|
|
400
|
+
onComplete?: () => void;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Return type for useTool hook
|
|
404
|
+
*/
|
|
405
|
+
interface UseToolReturn<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
406
|
+
/** Call the tool with arguments */
|
|
407
|
+
call: (args?: TArgs) => Promise<TResult>;
|
|
408
|
+
/** Mutate and call (convenience for forms) */
|
|
409
|
+
mutate: (args: TArgs) => Promise<TResult>;
|
|
410
|
+
/** Current state */
|
|
411
|
+
state: ToolState;
|
|
412
|
+
/** Loading indicator */
|
|
413
|
+
loading: boolean;
|
|
414
|
+
/** Last successful result */
|
|
415
|
+
result: TResult | null;
|
|
416
|
+
/** Last error */
|
|
417
|
+
error: Error | null;
|
|
418
|
+
/** Reset to initial state */
|
|
419
|
+
reset: () => void;
|
|
420
|
+
/** Retry last call */
|
|
421
|
+
retry: () => Promise<TResult | null>;
|
|
422
|
+
/** Abort ongoing call */
|
|
423
|
+
abort: () => void;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Options for useResource hook
|
|
427
|
+
*/
|
|
428
|
+
interface UseResourceOptions<T = unknown> {
|
|
429
|
+
/** Auto-refresh interval in ms */
|
|
430
|
+
refreshInterval?: number;
|
|
431
|
+
/** Subscribe to resource changes */
|
|
432
|
+
subscribe?: boolean;
|
|
433
|
+
/** Transform resource data */
|
|
434
|
+
transform?: (data: unknown) => T;
|
|
435
|
+
/** Skip initial fetch */
|
|
436
|
+
skip?: boolean;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Return type for useResource hook
|
|
440
|
+
*/
|
|
441
|
+
interface UseResourceReturn<T = unknown> {
|
|
442
|
+
/** Resource data */
|
|
443
|
+
data: T | null;
|
|
444
|
+
/** Loading state */
|
|
445
|
+
loading: boolean;
|
|
446
|
+
/** Error if any */
|
|
447
|
+
error: Error | null;
|
|
448
|
+
/** Refresh resource */
|
|
449
|
+
refresh: () => Promise<T>;
|
|
450
|
+
/** Last updated timestamp */
|
|
451
|
+
lastUpdated: Date | null;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Options for useToolStream hook
|
|
455
|
+
*/
|
|
456
|
+
interface UseToolStreamOptions<T = unknown> {
|
|
457
|
+
/** Called with each partial update */
|
|
458
|
+
onPartial?: (data: Partial<T>) => void;
|
|
459
|
+
/** Called when streaming completes */
|
|
460
|
+
onComplete?: (data: T) => void;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Return type for useToolStream hook
|
|
464
|
+
*/
|
|
465
|
+
interface UseToolStreamReturn<T = unknown> {
|
|
466
|
+
/** Current partial data */
|
|
467
|
+
partial: Partial<T> | null;
|
|
468
|
+
/** Final complete data */
|
|
469
|
+
complete: T | null;
|
|
470
|
+
/** Whether receiving partial data */
|
|
471
|
+
isStreaming: boolean;
|
|
472
|
+
/** Whether fully complete */
|
|
473
|
+
isComplete: boolean;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Tool provider configuration for scoped defaults
|
|
477
|
+
*/
|
|
478
|
+
interface ToolProviderConfig {
|
|
479
|
+
/** Default result display */
|
|
480
|
+
resultDisplay?: ToolResultConfig;
|
|
481
|
+
/** Default error handler */
|
|
482
|
+
onError?: (error: Error) => void;
|
|
483
|
+
/** Show loading states globally */
|
|
484
|
+
showLoading?: boolean;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* ToolContext value
|
|
489
|
+
*/
|
|
490
|
+
interface ToolContextValue {
|
|
491
|
+
/** Default result display configuration */
|
|
492
|
+
resultDisplay: ToolResultConfig;
|
|
493
|
+
/** Default error handler */
|
|
494
|
+
onError?: (error: Error) => void;
|
|
495
|
+
/** Show loading states globally */
|
|
496
|
+
showLoading: boolean;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* ToolProvider props
|
|
500
|
+
*/
|
|
501
|
+
interface ToolProviderProps {
|
|
502
|
+
/** Default configuration for all tool components */
|
|
503
|
+
defaults?: ToolProviderConfig;
|
|
504
|
+
/** Children */
|
|
505
|
+
children: ReactNode;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* ToolProvider component
|
|
509
|
+
*/
|
|
510
|
+
declare function ToolProvider({ defaults, children, }: ToolProviderProps): react_jsx_runtime.JSX.Element;
|
|
511
|
+
/**
|
|
512
|
+
* Hook to access tool context
|
|
513
|
+
*/
|
|
514
|
+
declare function useToolContext(): ToolContextValue;
|
|
515
|
+
|
|
516
|
+
declare const Toaster: ({ ...props }: ToasterProps) => react_jsx_runtime.JSX.Element;
|
|
517
|
+
|
|
518
|
+
declare const buttonVariants: (props?: ({
|
|
519
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
520
|
+
size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
|
|
521
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* State exposed to render props
|
|
525
|
+
*/
|
|
526
|
+
interface ToolButtonState {
|
|
527
|
+
/** Whether tool is currently executing */
|
|
528
|
+
loading: boolean;
|
|
529
|
+
/** Current tool state */
|
|
530
|
+
state: ToolState;
|
|
531
|
+
/** Result from last successful call */
|
|
532
|
+
result: unknown | null;
|
|
533
|
+
/** Error from last failed call */
|
|
534
|
+
error: Error | null;
|
|
535
|
+
/** Whether we have any result */
|
|
536
|
+
hasResult: boolean;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* ToolButton props
|
|
540
|
+
*/
|
|
541
|
+
interface ToolButtonProps extends Omit<React.ComponentProps<'button'>, 'children'>, VariantProps<typeof buttonVariants> {
|
|
542
|
+
/** Tool to call on click - string or full config */
|
|
543
|
+
tool: string | ToolBinding;
|
|
544
|
+
/** Tool arguments */
|
|
545
|
+
args?: Record<string, unknown>;
|
|
546
|
+
/** How to display result: 'inline' | 'toast' | 'modal' | 'none' */
|
|
547
|
+
resultDisplay?: 'inline' | 'toast' | 'modal' | 'none';
|
|
548
|
+
/** Custom result renderer */
|
|
549
|
+
renderResult?: (result: unknown) => React.ReactNode;
|
|
550
|
+
/** Duration to show result (for inline/toast) in ms */
|
|
551
|
+
resultDuration?: number;
|
|
552
|
+
/** Success message for toast */
|
|
553
|
+
successMessage?: string | ((result: unknown) => string);
|
|
554
|
+
/** Error message for toast */
|
|
555
|
+
errorMessage?: string | ((error: Error) => string);
|
|
556
|
+
/** Called when tool starts executing */
|
|
557
|
+
onToolStart?: () => void;
|
|
558
|
+
/** Called on successful result */
|
|
559
|
+
onToolSuccess?: (result: unknown) => void;
|
|
560
|
+
/** Called on error */
|
|
561
|
+
onToolError?: (error: Error) => void;
|
|
562
|
+
/** Called after completion (success or error) */
|
|
563
|
+
onToolComplete?: () => void;
|
|
564
|
+
/** Text to show while loading */
|
|
565
|
+
loadingText?: string;
|
|
566
|
+
/** Custom loading icon */
|
|
567
|
+
loadingIcon?: React.ReactNode;
|
|
568
|
+
/** Disable button while loading (default: true) */
|
|
569
|
+
disableWhileLoading?: boolean;
|
|
570
|
+
/** Require confirmation before calling */
|
|
571
|
+
confirm?: boolean | ConfirmConfig;
|
|
572
|
+
/** Button content - can be ReactNode or render function */
|
|
573
|
+
children?: React.ReactNode | ((state: ToolButtonState) => React.ReactNode);
|
|
574
|
+
/** Use Radix Slot for composition */
|
|
575
|
+
asChild?: boolean;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* ToolButton component
|
|
579
|
+
*/
|
|
580
|
+
declare function ToolButton({ tool, args, resultDisplay, renderResult, resultDuration, successMessage, errorMessage, onToolStart, onToolSuccess, onToolError, onToolComplete, loadingText, loadingIcon, disableWhileLoading, confirm, children, className, variant, size, disabled, asChild, ...props }: ToolButtonProps): react_jsx_runtime.JSX.Element;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Option type for ToolSelect
|
|
584
|
+
*/
|
|
585
|
+
interface ToolSelectOption {
|
|
586
|
+
value: string;
|
|
587
|
+
label: string;
|
|
588
|
+
disabled?: boolean;
|
|
589
|
+
icon?: React.ReactNode;
|
|
590
|
+
description?: string;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* ToolSelect props
|
|
594
|
+
*/
|
|
595
|
+
interface ToolSelectProps {
|
|
596
|
+
/** Tool to call when option selected */
|
|
597
|
+
onSelectTool?: string | ToolBinding;
|
|
598
|
+
/** Field name to pass selection value as */
|
|
599
|
+
argName?: string;
|
|
600
|
+
/** Additional args to pass with selection */
|
|
601
|
+
additionalArgs?: Record<string, unknown>;
|
|
602
|
+
/** Tool to fetch options from */
|
|
603
|
+
optionsTool?: string | ToolBinding;
|
|
604
|
+
/** Args for options tool */
|
|
605
|
+
optionsArgs?: Record<string, unknown>;
|
|
606
|
+
/** Transform tool result to options */
|
|
607
|
+
transformOptions?: (result: unknown) => ToolSelectOption[];
|
|
608
|
+
/** Static options (combined with tool options) */
|
|
609
|
+
options?: ToolSelectOption[];
|
|
610
|
+
/** Placeholder text */
|
|
611
|
+
placeholder?: string;
|
|
612
|
+
/** Placeholder while loading options */
|
|
613
|
+
loadingPlaceholder?: string;
|
|
614
|
+
/** Empty state message */
|
|
615
|
+
emptyMessage?: string;
|
|
616
|
+
/** Controlled value */
|
|
617
|
+
value?: string;
|
|
618
|
+
/** Default value */
|
|
619
|
+
defaultValue?: string;
|
|
620
|
+
/** Called when value changes */
|
|
621
|
+
onValueChange?: (value: string) => void;
|
|
622
|
+
/** Called when options are loaded */
|
|
623
|
+
onOptionsLoaded?: (options: ToolSelectOption[]) => void;
|
|
624
|
+
/** Called when selection tool succeeds */
|
|
625
|
+
onSelectionSuccess?: (result: unknown) => void;
|
|
626
|
+
/** Called when selection tool fails */
|
|
627
|
+
onSelectionError?: (error: Error) => void;
|
|
628
|
+
/** Show toast on selection success */
|
|
629
|
+
showSuccessToast?: boolean;
|
|
630
|
+
/** Success message */
|
|
631
|
+
successMessage?: string | ((result: unknown) => string);
|
|
632
|
+
className?: string;
|
|
633
|
+
disabled?: boolean;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* ToolSelect component
|
|
637
|
+
*/
|
|
638
|
+
declare function ToolSelect({ onSelectTool, argName, additionalArgs, optionsTool, optionsArgs, transformOptions, options: staticOptions, placeholder, loadingPlaceholder, emptyMessage, value: controlledValue, defaultValue, onValueChange, onOptionsLoaded, onSelectionSuccess, onSelectionError, showSuccessToast, successMessage, className, disabled, }: ToolSelectProps): react_jsx_runtime.JSX.Element;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Suggestion type for autocomplete
|
|
642
|
+
*/
|
|
643
|
+
interface ToolInputSuggestion {
|
|
644
|
+
value: string;
|
|
645
|
+
label: string;
|
|
646
|
+
icon?: React.ReactNode;
|
|
647
|
+
description?: string;
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* ToolInput props
|
|
651
|
+
*/
|
|
652
|
+
interface ToolInputProps extends Omit<React.ComponentProps<'input'>, 'onChange'> {
|
|
653
|
+
/** Tool to call on input change (debounced) */
|
|
654
|
+
searchTool?: string | ToolBinding;
|
|
655
|
+
/** Debounce delay in ms */
|
|
656
|
+
debounce?: number;
|
|
657
|
+
/** Minimum characters before calling tool */
|
|
658
|
+
minChars?: number;
|
|
659
|
+
/** Field name for the input value */
|
|
660
|
+
argName?: string;
|
|
661
|
+
/** Additional args to pass with search */
|
|
662
|
+
additionalArgs?: Record<string, unknown>;
|
|
663
|
+
/** Enable autocomplete dropdown */
|
|
664
|
+
autocomplete?: boolean;
|
|
665
|
+
/** Transform search results to suggestions */
|
|
666
|
+
transformSuggestions?: (result: unknown) => ToolInputSuggestion[];
|
|
667
|
+
/** Called when suggestion is selected */
|
|
668
|
+
onSuggestionSelect?: (suggestion: ToolInputSuggestion) => void;
|
|
669
|
+
/** Empty state message */
|
|
670
|
+
emptyMessage?: string;
|
|
671
|
+
value?: string;
|
|
672
|
+
onChange?: (value: string) => void;
|
|
673
|
+
/** Called with search results */
|
|
674
|
+
onSearchResults?: (results: unknown) => void;
|
|
675
|
+
/** Called on search error */
|
|
676
|
+
onSearchError?: (error: Error) => void;
|
|
677
|
+
/** Show search icon */
|
|
678
|
+
showSearchIcon?: boolean;
|
|
679
|
+
/** Show clear button */
|
|
680
|
+
showClearButton?: boolean;
|
|
681
|
+
/** Show loading indicator */
|
|
682
|
+
showLoadingIndicator?: boolean;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* ToolInput component
|
|
686
|
+
*/
|
|
687
|
+
declare function ToolInput({ searchTool, debounce, minChars, argName, additionalArgs, autocomplete, transformSuggestions, onSuggestionSelect, emptyMessage, value: controlledValue, onChange, onSearchResults, onSearchError, showSearchIcon, showClearButton, showLoadingIndicator, className, placeholder, disabled, ...props }: ToolInputProps): react_jsx_runtime.JSX.Element;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Form field definition
|
|
691
|
+
*/
|
|
692
|
+
interface ToolFormField {
|
|
693
|
+
/** Field name (matches tool input schema) */
|
|
694
|
+
name: string;
|
|
695
|
+
/** Display label */
|
|
696
|
+
label: string;
|
|
697
|
+
/** Input type */
|
|
698
|
+
type?: 'text' | 'number' | 'email' | 'password' | 'textarea' | 'select' | 'checkbox' | 'switch' | 'slider';
|
|
699
|
+
/** Placeholder text */
|
|
700
|
+
placeholder?: string;
|
|
701
|
+
/** Default value */
|
|
702
|
+
defaultValue?: string | number | boolean;
|
|
703
|
+
/** Required field */
|
|
704
|
+
required?: boolean;
|
|
705
|
+
/** Helper text */
|
|
706
|
+
description?: string;
|
|
707
|
+
/** Options for select type */
|
|
708
|
+
options?: Array<{
|
|
709
|
+
value: string;
|
|
710
|
+
label: string;
|
|
711
|
+
}>;
|
|
712
|
+
/** Min value for number/slider */
|
|
713
|
+
min?: number;
|
|
714
|
+
/** Max value for number/slider */
|
|
715
|
+
max?: number;
|
|
716
|
+
/** Step for number/slider */
|
|
717
|
+
step?: number;
|
|
718
|
+
/** Disable field */
|
|
719
|
+
disabled?: boolean;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* ToolForm props
|
|
723
|
+
*/
|
|
724
|
+
interface ToolFormProps {
|
|
725
|
+
/** Tool name to call on submit */
|
|
726
|
+
toolName: string;
|
|
727
|
+
/** Form fields (optional if autoSchema) */
|
|
728
|
+
fields?: ToolFormField[];
|
|
729
|
+
/** Auto-generate form from tool schema */
|
|
730
|
+
autoSchema?: boolean;
|
|
731
|
+
/** Submit button text */
|
|
732
|
+
submitText?: string;
|
|
733
|
+
/** Loading text */
|
|
734
|
+
loadingText?: string;
|
|
735
|
+
/** Callback when tool call succeeds */
|
|
736
|
+
onSuccess?: (result: unknown) => void;
|
|
737
|
+
/** Callback when tool call fails */
|
|
738
|
+
onError?: (error: Error) => void;
|
|
739
|
+
/** Show result after success */
|
|
740
|
+
showResult?: boolean;
|
|
741
|
+
/** Show toast on success */
|
|
742
|
+
showSuccessToast?: boolean;
|
|
743
|
+
/** Success message */
|
|
744
|
+
successMessage?: string | ((result: unknown) => string);
|
|
745
|
+
/** Reset form on success */
|
|
746
|
+
resetOnSuccess?: boolean;
|
|
747
|
+
/** Additional class name */
|
|
748
|
+
className?: string;
|
|
749
|
+
/** Layout - vertical or horizontal */
|
|
750
|
+
layout?: 'vertical' | 'horizontal';
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* ToolForm component
|
|
754
|
+
*/
|
|
755
|
+
declare function ToolForm({ toolName, fields: manualFields, autoSchema, submitText, loadingText, onSuccess, onError, showResult, showSuccessToast, successMessage, resetOnSuccess, className, layout, }: ToolFormProps): react_jsx_runtime.JSX.Element;
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Resource metadata passed to children
|
|
759
|
+
*/
|
|
760
|
+
interface ResourceMeta {
|
|
761
|
+
/** Resource URI */
|
|
762
|
+
uri: string;
|
|
763
|
+
/** Refresh the resource */
|
|
764
|
+
refresh: () => Promise<unknown>;
|
|
765
|
+
/** Last updated timestamp */
|
|
766
|
+
lastUpdated: Date | null;
|
|
767
|
+
/** Whether currently refreshing */
|
|
768
|
+
isRefreshing: boolean;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* ResourceView props
|
|
772
|
+
*/
|
|
773
|
+
interface ResourceViewProps<T = unknown> {
|
|
774
|
+
/** Resource URI */
|
|
775
|
+
uri: string;
|
|
776
|
+
/** Refresh interval in ms */
|
|
777
|
+
refreshInterval?: number;
|
|
778
|
+
/** Subscribe to updates (when supported) */
|
|
779
|
+
subscribe?: boolean;
|
|
780
|
+
/** Transform resource data */
|
|
781
|
+
transform?: (data: unknown) => T;
|
|
782
|
+
/** Loading placeholder */
|
|
783
|
+
loading?: React.ReactNode;
|
|
784
|
+
/** Error display */
|
|
785
|
+
error?: React.ReactNode | ((error: Error, retry: () => void) => React.ReactNode);
|
|
786
|
+
/** Render function for resource data */
|
|
787
|
+
children: (data: T, meta: ResourceMeta) => React.ReactNode;
|
|
788
|
+
/** Additional className */
|
|
789
|
+
className?: string;
|
|
790
|
+
/** Skip initial fetch */
|
|
791
|
+
skip?: boolean;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* ResourceView component
|
|
795
|
+
*/
|
|
796
|
+
declare function ResourceView<T = unknown>({ uri, refreshInterval, subscribe, transform, loading: loadingContent, error: errorContent, children, className, skip, }: ResourceViewProps<T>): react_jsx_runtime.JSX.Element;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* StreamingContent props
|
|
800
|
+
*/
|
|
801
|
+
interface StreamingContentProps<T = unknown> {
|
|
802
|
+
/** Fallback while no data available */
|
|
803
|
+
fallback?: React.ReactNode;
|
|
804
|
+
/** Show streaming progress indicator */
|
|
805
|
+
showProgress?: boolean;
|
|
806
|
+
/** Progress value (0-100) if known */
|
|
807
|
+
progress?: number;
|
|
808
|
+
/** Called with partial data updates */
|
|
809
|
+
onPartial?: (data: Partial<T>) => void;
|
|
810
|
+
/** Called when data is complete */
|
|
811
|
+
onComplete?: (data: T) => void;
|
|
812
|
+
/** Render function for data */
|
|
813
|
+
children: (data: T | Partial<T>, isComplete: boolean) => React.ReactNode;
|
|
814
|
+
/** Additional className */
|
|
815
|
+
className?: string;
|
|
816
|
+
/** Style to apply while streaming (e.g., opacity) */
|
|
817
|
+
streamingStyle?: 'opacity' | 'blur' | 'none';
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* StreamingContent component
|
|
821
|
+
*/
|
|
822
|
+
declare function StreamingContent<T = unknown>({ fallback, showProgress, progress: externalProgress, onPartial, onComplete, children, className, streamingStyle, }: StreamingContentProps<T>): react_jsx_runtime.JSX.Element;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Column definition for ToolDataGrid
|
|
826
|
+
*/
|
|
827
|
+
interface ToolDataGridColumn<T = Record<string, unknown>> {
|
|
828
|
+
/** Unique key for this column (dot notation supported) */
|
|
829
|
+
key: string;
|
|
830
|
+
/** Column header */
|
|
831
|
+
header: string;
|
|
832
|
+
/** Enable sorting for this column */
|
|
833
|
+
sortable?: boolean;
|
|
834
|
+
/** Custom cell renderer */
|
|
835
|
+
render?: (value: unknown, row: T, index: number) => React.ReactNode;
|
|
836
|
+
/** Column width (CSS value) */
|
|
837
|
+
width?: string;
|
|
838
|
+
/** Align content */
|
|
839
|
+
align?: 'left' | 'center' | 'right';
|
|
840
|
+
/** Hide column on small screens */
|
|
841
|
+
hideMobile?: boolean;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Row action definition
|
|
845
|
+
*/
|
|
846
|
+
interface ToolDataGridRowAction<T = Record<string, unknown>> {
|
|
847
|
+
/** Action button label */
|
|
848
|
+
label: string;
|
|
849
|
+
/** Icon to show */
|
|
850
|
+
icon?: React.ReactNode;
|
|
851
|
+
/** Tool to call */
|
|
852
|
+
tool: string | ToolBinding;
|
|
853
|
+
/** Get args from row data */
|
|
854
|
+
getArgs?: (row: T) => Record<string, unknown>;
|
|
855
|
+
/** Button variant */
|
|
856
|
+
variant?: 'default' | 'outline' | 'ghost' | 'destructive';
|
|
857
|
+
/** Require confirmation */
|
|
858
|
+
confirm?: boolean | ConfirmConfig;
|
|
859
|
+
/** Hide for certain rows */
|
|
860
|
+
hidden?: (row: T) => boolean;
|
|
861
|
+
/** Called on success */
|
|
862
|
+
onSuccess?: (result: unknown, row: T) => void;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Sort state
|
|
866
|
+
*/
|
|
867
|
+
interface SortState {
|
|
868
|
+
column: string | null;
|
|
869
|
+
direction: 'asc' | 'desc';
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Data result from transform function
|
|
873
|
+
*/
|
|
874
|
+
interface ToolDataGridData<T = Record<string, unknown>> {
|
|
875
|
+
rows: T[];
|
|
876
|
+
total: number;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* ToolDataGrid props
|
|
880
|
+
*/
|
|
881
|
+
interface ToolDataGridProps<T = Record<string, unknown>> {
|
|
882
|
+
/** Tool to fetch data from */
|
|
883
|
+
dataTool: string | ToolBinding;
|
|
884
|
+
/** Column definitions */
|
|
885
|
+
columns: ToolDataGridColumn<T>[];
|
|
886
|
+
/** Transform tool result to grid data */
|
|
887
|
+
transformData?: (result: unknown) => ToolDataGridData<T>;
|
|
888
|
+
/** Actions to show for each row */
|
|
889
|
+
rowActions?: ToolDataGridRowAction<T>[];
|
|
890
|
+
/** Enable pagination */
|
|
891
|
+
pagination?: boolean;
|
|
892
|
+
/** Page sizes to offer */
|
|
893
|
+
pageSizes?: number[];
|
|
894
|
+
/** Default page size */
|
|
895
|
+
defaultPageSize?: number;
|
|
896
|
+
/** Default sort */
|
|
897
|
+
defaultSort?: SortState;
|
|
898
|
+
/** Auto-refresh interval in ms */
|
|
899
|
+
refreshInterval?: number;
|
|
900
|
+
/** Show refresh button */
|
|
901
|
+
showRefresh?: boolean;
|
|
902
|
+
/** Called when data is loaded */
|
|
903
|
+
onDataLoaded?: (data: ToolDataGridData<T>) => void;
|
|
904
|
+
/** Called on error */
|
|
905
|
+
onError?: (error: Error) => void;
|
|
906
|
+
/** Called when row is clicked */
|
|
907
|
+
onRowClick?: (row: T, index: number) => void;
|
|
908
|
+
/** Key extractor for rows */
|
|
909
|
+
getRowKey?: (row: T, index: number) => string;
|
|
910
|
+
/** Empty state content */
|
|
911
|
+
emptyContent?: React.ReactNode;
|
|
912
|
+
/** Loading content */
|
|
913
|
+
loadingContent?: React.ReactNode;
|
|
914
|
+
className?: string;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* ToolDataGrid component
|
|
918
|
+
*/
|
|
919
|
+
declare function ToolDataGrid<T = Record<string, unknown>>({ dataTool, columns, transformData, rowActions, pagination, pageSizes, defaultPageSize, defaultSort, refreshInterval, showRefresh, onDataLoaded, onError, onRowClick, getRowKey, emptyContent, loadingContent, className, }: ToolDataGridProps<T>): react_jsx_runtime.JSX.Element;
|
|
920
|
+
|
|
921
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
922
|
+
/** Button variant */
|
|
923
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'destructive' | 'outline';
|
|
924
|
+
/** Button size */
|
|
925
|
+
size?: 'sm' | 'md' | 'lg' | 'icon';
|
|
926
|
+
/** Loading state */
|
|
927
|
+
loading?: boolean;
|
|
928
|
+
/** Render as child component (Radix Slot) */
|
|
929
|
+
asChild?: boolean;
|
|
930
|
+
/** Left icon */
|
|
931
|
+
leftIcon?: ReactNode;
|
|
932
|
+
/** Right icon */
|
|
933
|
+
rightIcon?: ReactNode;
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Button component with multiple variants and loading state
|
|
937
|
+
*
|
|
938
|
+
* @example
|
|
939
|
+
* ```tsx
|
|
940
|
+
* <Button variant="primary" onClick={handleClick}>
|
|
941
|
+
* Click Me
|
|
942
|
+
* </Button>
|
|
943
|
+
*
|
|
944
|
+
* <Button variant="ghost" loading>
|
|
945
|
+
* Loading...
|
|
946
|
+
* </Button>
|
|
947
|
+
* ```
|
|
948
|
+
*/
|
|
949
|
+
declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
950
|
+
|
|
951
|
+
interface ActionButtonProps extends Omit<ButtonProps, 'onClick' | 'loading' | 'onError'> {
|
|
952
|
+
/** Tool name to call */
|
|
953
|
+
toolName: string;
|
|
954
|
+
/** Arguments to pass to the tool */
|
|
955
|
+
toolArgs?: Record<string, unknown>;
|
|
956
|
+
/** Callback when tool call succeeds */
|
|
957
|
+
onToolSuccess?: (result: unknown) => void;
|
|
958
|
+
/** Callback when tool call fails */
|
|
959
|
+
onToolError?: (error: Error) => void;
|
|
960
|
+
/** Show result inline after success */
|
|
961
|
+
showResult?: boolean;
|
|
962
|
+
/** Custom result renderer */
|
|
963
|
+
renderResult?: (result: unknown) => ReactNode;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* ActionButton - Button that calls an MCP tool with loading state
|
|
967
|
+
*
|
|
968
|
+
* @example
|
|
969
|
+
* ```tsx
|
|
970
|
+
* <ActionButton
|
|
971
|
+
* toolName="get-weather"
|
|
972
|
+
* toolArgs={{ city: 'London' }}
|
|
973
|
+
* onToolSuccess={(data) => console.log(data)}
|
|
974
|
+
* >
|
|
975
|
+
* Get Weather
|
|
976
|
+
* </ActionButton>
|
|
977
|
+
* ```
|
|
978
|
+
*/
|
|
979
|
+
declare function ActionButton({ toolName, toolArgs, onToolSuccess, onToolError, showResult, renderResult, children, ...buttonProps }: ActionButtonProps): react_jsx_runtime.JSX.Element;
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* RequireConnection props
|
|
983
|
+
*/
|
|
984
|
+
interface RequireConnectionProps {
|
|
985
|
+
/** Loading fallback */
|
|
986
|
+
loading?: React.ReactNode;
|
|
987
|
+
/** Error fallback */
|
|
988
|
+
error?: React.ReactNode | ((error: Error) => React.ReactNode);
|
|
989
|
+
/** Disconnected fallback (different from error) */
|
|
990
|
+
disconnected?: React.ReactNode;
|
|
991
|
+
/** Content to render when connected */
|
|
992
|
+
children: React.ReactNode;
|
|
993
|
+
/** Additional className for wrapper */
|
|
994
|
+
className?: string;
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* RequireConnection component
|
|
998
|
+
*/
|
|
999
|
+
declare function RequireConnection({ loading: loadingContent, error: errorContent, disconnected: disconnectedContent, children, className, }: RequireConnectionProps): react_jsx_runtime.JSX.Element;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* ToolErrorBoundary props
|
|
1003
|
+
*/
|
|
1004
|
+
interface ToolErrorBoundaryProps {
|
|
1005
|
+
/** Fallback UI on error */
|
|
1006
|
+
fallback?: ReactNode | ((error: Error, retry: () => void) => ReactNode);
|
|
1007
|
+
/** Called on error */
|
|
1008
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
1009
|
+
/** Reset error on these props changing */
|
|
1010
|
+
resetKeys?: unknown[];
|
|
1011
|
+
/** Children to render */
|
|
1012
|
+
children: ReactNode;
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* ToolErrorBoundary state
|
|
1016
|
+
*/
|
|
1017
|
+
interface State {
|
|
1018
|
+
hasError: boolean;
|
|
1019
|
+
error: Error | null;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* ToolErrorBoundary component
|
|
1023
|
+
*/
|
|
1024
|
+
declare class ToolErrorBoundary extends Component<ToolErrorBoundaryProps, State> {
|
|
1025
|
+
constructor(props: ToolErrorBoundaryProps);
|
|
1026
|
+
static getDerivedStateFromError(error: Error): State;
|
|
1027
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
1028
|
+
componentDidUpdate(prevProps: ToolErrorBoundaryProps): void;
|
|
1029
|
+
reset: () => void;
|
|
1030
|
+
render(): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* useTool hook for calling MCP tools with full state management
|
|
1035
|
+
*/
|
|
1036
|
+
declare function useTool<TArgs extends Record<string, unknown> = Record<string, unknown>, TResult = unknown>(toolName: string, options?: UseToolOptions<TArgs, TResult>): UseToolReturn<TArgs, TResult>;
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Hook for receiving streaming/partial tool input from the host
|
|
1040
|
+
*/
|
|
1041
|
+
declare function useToolStream<T = unknown>(options?: UseToolStreamOptions<T>): UseToolStreamReturn<T>;
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Hook for reading and managing MCP server resources
|
|
1045
|
+
*/
|
|
1046
|
+
declare function useResource<T = unknown>(uri: string, options?: UseResourceOptions<T>): UseResourceReturn<T>;
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* Result returned by useMessage hook
|
|
1050
|
+
*/
|
|
1051
|
+
interface UseMessageReturn {
|
|
1052
|
+
/** Send a text message to the host chat */
|
|
1053
|
+
send: (text: string) => Promise<void>;
|
|
1054
|
+
/** Send structured content blocks */
|
|
1055
|
+
sendContent: (content: ContentBlock[]) => Promise<void>;
|
|
1056
|
+
/** Request the agent to call a specific tool */
|
|
1057
|
+
requestTool: (toolName: string, args?: Record<string, unknown>) => Promise<void>;
|
|
1058
|
+
/** Whether currently sending a message */
|
|
1059
|
+
sending: boolean;
|
|
1060
|
+
/** Last error if any */
|
|
1061
|
+
error: Error | null;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Hook for sending messages to the MCP host chat
|
|
1065
|
+
*/
|
|
1066
|
+
declare function useMessage(): UseMessageReturn;
|
|
1067
|
+
|
|
1068
|
+
interface UseHostContextReturn {
|
|
1069
|
+
/** Current theme: 'light' or 'dark' */
|
|
1070
|
+
theme: 'light' | 'dark';
|
|
1071
|
+
/** Display mode: 'inline', 'fullscreen', 'pip' */
|
|
1072
|
+
displayMode: 'inline' | 'fullscreen' | 'pip';
|
|
1073
|
+
/** Available display modes supported by the host */
|
|
1074
|
+
availableDisplayModes: string[];
|
|
1075
|
+
/** Viewport dimensions */
|
|
1076
|
+
viewport: {
|
|
1077
|
+
width: number;
|
|
1078
|
+
height: number;
|
|
1079
|
+
maxWidth?: number;
|
|
1080
|
+
maxHeight?: number;
|
|
1081
|
+
} | null;
|
|
1082
|
+
/** User locale (e.g., 'en-US') */
|
|
1083
|
+
locale: string | null;
|
|
1084
|
+
/** User timezone (e.g., 'America/New_York') */
|
|
1085
|
+
timeZone: string | null;
|
|
1086
|
+
/** Platform type */
|
|
1087
|
+
platform: 'web' | 'desktop' | 'mobile' | null;
|
|
1088
|
+
/** Host application identifier */
|
|
1089
|
+
userAgent: string | null;
|
|
1090
|
+
/** Device input capabilities */
|
|
1091
|
+
deviceCapabilities: {
|
|
1092
|
+
touch?: boolean;
|
|
1093
|
+
hover?: boolean;
|
|
1094
|
+
} | null;
|
|
1095
|
+
/** Mobile safe area insets */
|
|
1096
|
+
safeAreaInsets: {
|
|
1097
|
+
top: number;
|
|
1098
|
+
right: number;
|
|
1099
|
+
bottom: number;
|
|
1100
|
+
left: number;
|
|
1101
|
+
} | null;
|
|
1102
|
+
/** Host-provided style configuration */
|
|
1103
|
+
styles: McpUiHostStyles | null;
|
|
1104
|
+
/** Full raw context */
|
|
1105
|
+
rawContext: McpUiHostContext;
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Hook to access host context
|
|
1109
|
+
*
|
|
1110
|
+
* FIX #8: Now exposes all fields from McpUiHostContext including:
|
|
1111
|
+
* - styles (CSS variables and fonts)
|
|
1112
|
+
* - availableDisplayModes
|
|
1113
|
+
* - userAgent
|
|
1114
|
+
* - deviceCapabilities
|
|
1115
|
+
* - safeAreaInsets
|
|
1116
|
+
*
|
|
1117
|
+
* @example
|
|
1118
|
+
* ```tsx
|
|
1119
|
+
* function ThemedCard() {
|
|
1120
|
+
* const { theme, locale, deviceCapabilities, styles } = useHostContext();
|
|
1121
|
+
*
|
|
1122
|
+
* return (
|
|
1123
|
+
* <div className={theme === 'dark' ? 'dark-mode' : 'light-mode'}>
|
|
1124
|
+
* <p>Locale: {locale}</p>
|
|
1125
|
+
* <p>Touch: {deviceCapabilities?.touch ? 'Yes' : 'No'}</p>
|
|
1126
|
+
* </div>
|
|
1127
|
+
* );
|
|
1128
|
+
* }
|
|
1129
|
+
* ```
|
|
1130
|
+
*/
|
|
1131
|
+
declare function useHostContext(): UseHostContextReturn;
|
|
1132
|
+
|
|
1133
|
+
interface UseToolResultReturn<T = unknown> {
|
|
1134
|
+
/** The tool result, typed as T */
|
|
1135
|
+
result: T | null;
|
|
1136
|
+
/** Raw CallToolResult from MCP */
|
|
1137
|
+
rawResult: CallToolResult | null;
|
|
1138
|
+
/** Whether a result has been received */
|
|
1139
|
+
hasResult: boolean;
|
|
1140
|
+
/** Extract text content from result */
|
|
1141
|
+
textContent: string | null;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Hook to access tool result from host
|
|
1145
|
+
*
|
|
1146
|
+
* @example
|
|
1147
|
+
* ```tsx
|
|
1148
|
+
* function WeatherCard() {
|
|
1149
|
+
* const { result } = useToolResult<{ city: string; temp: number }>();
|
|
1150
|
+
*
|
|
1151
|
+
* if (!result) return <div>Loading...</div>;
|
|
1152
|
+
*
|
|
1153
|
+
* return <div>{result.city}: {result.temp}°C</div>;
|
|
1154
|
+
* }
|
|
1155
|
+
* ```
|
|
1156
|
+
*/
|
|
1157
|
+
declare function useToolResult<T = unknown>(): UseToolResultReturn<T>;
|
|
1158
|
+
|
|
1159
|
+
interface UseToolInputReturn<T = Record<string, unknown>> {
|
|
1160
|
+
/** The tool input arguments, typed as T */
|
|
1161
|
+
input: T | null;
|
|
1162
|
+
/** Whether input has been received */
|
|
1163
|
+
hasInput: boolean;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Hook to access tool input arguments from host
|
|
1167
|
+
*
|
|
1168
|
+
* @example
|
|
1169
|
+
* ```tsx
|
|
1170
|
+
* function WeatherCard() {
|
|
1171
|
+
* const { input } = useToolInput<{ city: string }>();
|
|
1172
|
+
*
|
|
1173
|
+
* if (!input) return <div>Loading...</div>;
|
|
1174
|
+
*
|
|
1175
|
+
* return <div>Weather for: {input.city}</div>;
|
|
1176
|
+
* }
|
|
1177
|
+
* ```
|
|
1178
|
+
*/
|
|
1179
|
+
declare function useToolInput$1<T = Record<string, unknown>>(): UseToolInputReturn<T>;
|
|
1180
|
+
|
|
1181
|
+
interface UseToolInputPartialReturn {
|
|
1182
|
+
/** Partial arguments currently available */
|
|
1183
|
+
partialArgs: Record<string, unknown> | null;
|
|
1184
|
+
/** Whether partial args are being received */
|
|
1185
|
+
isStreaming: boolean;
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Hook to access streaming partial tool input
|
|
1189
|
+
*
|
|
1190
|
+
* @example
|
|
1191
|
+
* ```tsx
|
|
1192
|
+
* function MyComponent() {
|
|
1193
|
+
* const { partialArgs, isStreaming } = useToolInputPartial();
|
|
1194
|
+
*
|
|
1195
|
+
* if (isStreaming) {
|
|
1196
|
+
* return <div>Receiving: {JSON.stringify(partialArgs)}</div>;
|
|
1197
|
+
* }
|
|
1198
|
+
* return <div>Ready for input</div>;
|
|
1199
|
+
* }
|
|
1200
|
+
* ```
|
|
1201
|
+
*/
|
|
1202
|
+
declare function useToolInputPartial(): UseToolInputPartialReturn;
|
|
1203
|
+
|
|
1204
|
+
interface UseToolSubscriptionOptions {
|
|
1205
|
+
/** Polling interval in milliseconds */
|
|
1206
|
+
interval?: number;
|
|
1207
|
+
/** Whether to start polling immediately */
|
|
1208
|
+
enabled?: boolean;
|
|
1209
|
+
/** Arguments to pass to the tool */
|
|
1210
|
+
args?: Record<string, unknown>;
|
|
1211
|
+
}
|
|
1212
|
+
interface UseToolSubscriptionResult<T = unknown> {
|
|
1213
|
+
/** Tool call result data */
|
|
1214
|
+
result: T | null;
|
|
1215
|
+
/** Loading state */
|
|
1216
|
+
loading: boolean;
|
|
1217
|
+
/** Error if any */
|
|
1218
|
+
error: Error | null;
|
|
1219
|
+
/** Start polling */
|
|
1220
|
+
start: () => void;
|
|
1221
|
+
/** Stop polling */
|
|
1222
|
+
stop: () => void;
|
|
1223
|
+
/** Whether polling is active */
|
|
1224
|
+
isPolling: boolean;
|
|
1225
|
+
/** Manually refresh (call tool immediately) */
|
|
1226
|
+
refresh: () => Promise<T>;
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Hook for subscribing to tool updates with automatic polling
|
|
1230
|
+
*
|
|
1231
|
+
* @example
|
|
1232
|
+
* ```tsx
|
|
1233
|
+
* function StockTicker() {
|
|
1234
|
+
* const { result, isPolling, start, stop } = useToolSubscription<StockData>(
|
|
1235
|
+
* 'get-stock-price',
|
|
1236
|
+
* { interval: 5000, args: { symbol: 'AAPL' } }
|
|
1237
|
+
* );
|
|
1238
|
+
*
|
|
1239
|
+
* return (
|
|
1240
|
+
* <div>
|
|
1241
|
+
* <div>Price: ${result?.price}</div>
|
|
1242
|
+
* <button onClick={isPolling ? stop : start}>
|
|
1243
|
+
* {isPolling ? 'Stop' : 'Start'} Updates
|
|
1244
|
+
* </button>
|
|
1245
|
+
* </div>
|
|
1246
|
+
* );
|
|
1247
|
+
* }
|
|
1248
|
+
* ```
|
|
1249
|
+
*/
|
|
1250
|
+
declare function useToolSubscription<T = unknown>(toolName: string, options?: UseToolSubscriptionOptions): UseToolSubscriptionResult<T>;
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* useAuth - Authentication hook for GPT Apps
|
|
1254
|
+
*
|
|
1255
|
+
* Provides auth status and triggers ChatGPT's OAuth linking UI
|
|
1256
|
+
* when tools return _meta["mcp/www_authenticate"].
|
|
1257
|
+
*/
|
|
1258
|
+
/**
|
|
1259
|
+
* Authenticated user info
|
|
1260
|
+
*/
|
|
1261
|
+
interface AuthUser {
|
|
1262
|
+
/** User ID (subject) */
|
|
1263
|
+
id: string;
|
|
1264
|
+
/** Display name */
|
|
1265
|
+
name?: string;
|
|
1266
|
+
/** Email address */
|
|
1267
|
+
email?: string;
|
|
1268
|
+
/** Profile picture URL */
|
|
1269
|
+
picture?: string;
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Return type for useAuth hook
|
|
1273
|
+
*/
|
|
1274
|
+
interface UseAuthReturn {
|
|
1275
|
+
/** Whether user is authenticated */
|
|
1276
|
+
isAuthenticated: boolean;
|
|
1277
|
+
/** Currently authenticated user (if any) */
|
|
1278
|
+
user: AuthUser | null;
|
|
1279
|
+
/** Loading state */
|
|
1280
|
+
loading: boolean;
|
|
1281
|
+
/** Authentication error (if any) */
|
|
1282
|
+
error: Error | null;
|
|
1283
|
+
/** Trigger an auth-required tool to initiate OAuth flow */
|
|
1284
|
+
triggerAuth: () => Promise<void>;
|
|
1285
|
+
/** Clear auth state (for sign-out UI) */
|
|
1286
|
+
clearAuth: () => void;
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Authentication hook for GPT Apps
|
|
1290
|
+
*
|
|
1291
|
+
* In ChatGPT, authentication is triggered automatically when a tool
|
|
1292
|
+
* returns `_meta["mcp/www_authenticate"]`. Use this hook to:
|
|
1293
|
+
*
|
|
1294
|
+
* 1. Check if the user is authenticated
|
|
1295
|
+
* 2. Show loading state during auth
|
|
1296
|
+
* 3. Display user info after auth
|
|
1297
|
+
* 4. Manually trigger auth by calling an auth-required tool
|
|
1298
|
+
*
|
|
1299
|
+
* @example
|
|
1300
|
+
* ```tsx
|
|
1301
|
+
* function MyComponent() {
|
|
1302
|
+
* const { isAuthenticated, user, triggerAuth, loading } = useAuth();
|
|
1303
|
+
*
|
|
1304
|
+
* if (loading) return <div>Authenticating...</div>;
|
|
1305
|
+
*
|
|
1306
|
+
* if (!isAuthenticated) {
|
|
1307
|
+
* return (
|
|
1308
|
+
* <Button onClick={triggerAuth}>
|
|
1309
|
+
* Sign in with GitHub
|
|
1310
|
+
* </Button>
|
|
1311
|
+
* );
|
|
1312
|
+
* }
|
|
1313
|
+
*
|
|
1314
|
+
* return <div>Welcome, {user?.name}!</div>;
|
|
1315
|
+
* }
|
|
1316
|
+
* ```
|
|
1317
|
+
*/
|
|
1318
|
+
declare function useAuth(): UseAuthReturn;
|
|
1319
|
+
|
|
1320
|
+
interface OpenAiGlobals {
|
|
1321
|
+
toolInput: Record<string, unknown>;
|
|
1322
|
+
toolOutput: any;
|
|
1323
|
+
toolResponseMetadata: Record<string, unknown>;
|
|
1324
|
+
widgetState: Record<string, unknown>;
|
|
1325
|
+
theme: 'light' | 'dark';
|
|
1326
|
+
displayMode: 'inline' | 'modal' | 'fullscreen';
|
|
1327
|
+
maxHeight: number;
|
|
1328
|
+
safeArea: {
|
|
1329
|
+
top: number;
|
|
1330
|
+
right: number;
|
|
1331
|
+
bottom: number;
|
|
1332
|
+
left: number;
|
|
1333
|
+
};
|
|
1334
|
+
view: 'desktop' | 'mobile';
|
|
1335
|
+
locale: string;
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* React hook to subscribe to window.openai global values.
|
|
1339
|
+
* Source: https://developers.openai.com/apps-sdk/build/chatgpt-ui#useopenaiglobal
|
|
1340
|
+
*/
|
|
1341
|
+
declare function useOpenAiGlobal<K extends keyof OpenAiGlobals>(key: K): OpenAiGlobals[K] | undefined;
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Access the structured content returned by the tool.
|
|
1345
|
+
* Maps to 'structuredContent' in the tool response.
|
|
1346
|
+
*/
|
|
1347
|
+
declare function useToolOutput<T = any>(): T | undefined;
|
|
1348
|
+
/**
|
|
1349
|
+
* Access metadata about the tool response.
|
|
1350
|
+
* Maps to '_meta' in the tool response.
|
|
1351
|
+
*/
|
|
1352
|
+
declare function useToolResponseMetadata<T = any>(): T | undefined;
|
|
1353
|
+
/**
|
|
1354
|
+
* Access the input arguments passed to the tool.
|
|
1355
|
+
*/
|
|
1356
|
+
declare function useToolInput<T = any>(): T | undefined;
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* Hook to read and write widget state.
|
|
1360
|
+
* Widget state persists across the session for this specific widget instance.
|
|
1361
|
+
*
|
|
1362
|
+
* @param initialState - Default state if none exists
|
|
1363
|
+
*/
|
|
1364
|
+
declare function useWidgetState<T extends Record<string, unknown>>(initialState: T | (() => T)): [T, (newState: T | ((prev: T) => T)) => void];
|
|
1365
|
+
|
|
1366
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
1367
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
1368
|
+
|
|
1369
|
+
declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1370
|
+
|
|
1371
|
+
declare function Textarea({ className, ...props }: React.ComponentProps<"textarea">): react_jsx_runtime.JSX.Element;
|
|
1372
|
+
|
|
1373
|
+
declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1374
|
+
declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): react_jsx_runtime.JSX.Element;
|
|
1375
|
+
declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): react_jsx_runtime.JSX.Element;
|
|
1376
|
+
declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
1377
|
+
size?: "sm" | "default";
|
|
1378
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1379
|
+
declare function SelectContent({ className, children, position, align, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
1380
|
+
declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): react_jsx_runtime.JSX.Element;
|
|
1381
|
+
declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): react_jsx_runtime.JSX.Element;
|
|
1382
|
+
declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): react_jsx_runtime.JSX.Element;
|
|
1383
|
+
declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): react_jsx_runtime.JSX.Element;
|
|
1384
|
+
declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): react_jsx_runtime.JSX.Element;
|
|
1385
|
+
|
|
1386
|
+
declare function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1387
|
+
|
|
1388
|
+
declare function Slider({ className, defaultValue, value, min, max, ...props }: React.ComponentProps<typeof SliderPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1389
|
+
|
|
1390
|
+
declare function Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1391
|
+
|
|
1392
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
1393
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
1394
|
+
declare const useFormField: () => {
|
|
1395
|
+
invalid: boolean;
|
|
1396
|
+
isDirty: boolean;
|
|
1397
|
+
isTouched: boolean;
|
|
1398
|
+
isValidating: boolean;
|
|
1399
|
+
error?: react_hook_form.FieldError;
|
|
1400
|
+
id: string;
|
|
1401
|
+
name: string;
|
|
1402
|
+
formItemId: string;
|
|
1403
|
+
formDescriptionId: string;
|
|
1404
|
+
formMessageId: string;
|
|
1405
|
+
};
|
|
1406
|
+
declare function FormItem({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
1407
|
+
declare function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1408
|
+
declare function FormControl({ ...props }: React.ComponentProps<typeof Slot>): react_jsx_runtime.JSX.Element;
|
|
1409
|
+
declare function FormDescription({ className, ...props }: React.ComponentProps<"p">): react_jsx_runtime.JSX.Element;
|
|
1410
|
+
declare function FormMessage({ className, ...props }: React.ComponentProps<"p">): react_jsx_runtime.JSX.Element | null;
|
|
1411
|
+
|
|
1412
|
+
declare const alertVariants: (props?: ({
|
|
1413
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
1414
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1415
|
+
declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): react_jsx_runtime.JSX.Element;
|
|
1416
|
+
declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
1417
|
+
declare function AlertDescription({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
1418
|
+
|
|
1419
|
+
declare const badgeVariants: (props?: ({
|
|
1420
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
1421
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1422
|
+
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
1423
|
+
asChild?: boolean;
|
|
1424
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1425
|
+
|
|
1426
|
+
declare function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1427
|
+
|
|
1428
|
+
declare function Skeleton({ className, ...props }: React__default.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
1429
|
+
|
|
1430
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1431
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
1432
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): react_jsx_runtime.JSX.Element;
|
|
1433
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): react_jsx_runtime.JSX.Element;
|
|
1434
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): react_jsx_runtime.JSX.Element;
|
|
1435
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
1436
|
+
showCloseButton?: boolean;
|
|
1437
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1438
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
1439
|
+
declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
1440
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime.JSX.Element;
|
|
1441
|
+
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime.JSX.Element;
|
|
1442
|
+
|
|
1443
|
+
declare function TabsList({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.List>): react_jsx_runtime.JSX.Element;
|
|
1444
|
+
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
1445
|
+
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
1446
|
+
|
|
1447
|
+
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1448
|
+
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
1449
|
+
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
1450
|
+
declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): react_jsx_runtime.JSX.Element;
|
|
1451
|
+
|
|
1452
|
+
declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<typeof SeparatorPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1453
|
+
|
|
1454
|
+
declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1455
|
+
declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): react_jsx_runtime.JSX.Element;
|
|
1456
|
+
|
|
1457
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1458
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): react_jsx_runtime.JSX.Element;
|
|
1459
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
1460
|
+
declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
1461
|
+
declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): react_jsx_runtime.JSX.Element;
|
|
1462
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
1463
|
+
inset?: boolean;
|
|
1464
|
+
variant?: "default" | "destructive";
|
|
1465
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1466
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): react_jsx_runtime.JSX.Element;
|
|
1467
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): react_jsx_runtime.JSX.Element;
|
|
1468
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): react_jsx_runtime.JSX.Element;
|
|
1469
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
1470
|
+
inset?: boolean;
|
|
1471
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1472
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): react_jsx_runtime.JSX.Element;
|
|
1473
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
1474
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): react_jsx_runtime.JSX.Element;
|
|
1475
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
1476
|
+
inset?: boolean;
|
|
1477
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1478
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): react_jsx_runtime.JSX.Element;
|
|
1479
|
+
|
|
1480
|
+
declare function Command({ className, ...props }: React.ComponentProps<typeof Command$1>): react_jsx_runtime.JSX.Element;
|
|
1481
|
+
declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: React.ComponentProps<typeof Dialog> & {
|
|
1482
|
+
title?: string;
|
|
1483
|
+
description?: string;
|
|
1484
|
+
className?: string;
|
|
1485
|
+
showCloseButton?: boolean;
|
|
1486
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1487
|
+
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof Command$1.Input>): react_jsx_runtime.JSX.Element;
|
|
1488
|
+
declare function CommandList({ className, ...props }: React.ComponentProps<typeof Command$1.List>): react_jsx_runtime.JSX.Element;
|
|
1489
|
+
declare function CommandEmpty({ ...props }: React.ComponentProps<typeof Command$1.Empty>): react_jsx_runtime.JSX.Element;
|
|
1490
|
+
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof Command$1.Group>): react_jsx_runtime.JSX.Element;
|
|
1491
|
+
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof Command$1.Separator>): react_jsx_runtime.JSX.Element;
|
|
1492
|
+
declare function CommandItem({ className, ...props }: React.ComponentProps<typeof Command$1.Item>): react_jsx_runtime.JSX.Element;
|
|
1493
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
1494
|
+
|
|
1495
|
+
declare function Table({ className, ...props }: React.ComponentProps<"table">): react_jsx_runtime.JSX.Element;
|
|
1496
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): react_jsx_runtime.JSX.Element;
|
|
1497
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): react_jsx_runtime.JSX.Element;
|
|
1498
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): react_jsx_runtime.JSX.Element;
|
|
1499
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): react_jsx_runtime.JSX.Element;
|
|
1500
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): react_jsx_runtime.JSX.Element;
|
|
1501
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): react_jsx_runtime.JSX.Element;
|
|
1502
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): react_jsx_runtime.JSX.Element;
|
|
1503
|
+
|
|
1504
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): react_jsx_runtime.JSX.Element;
|
|
1505
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
1506
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
1507
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* Utility function for merging Tailwind CSS classes
|
|
1511
|
+
* Uses clsx for conditional classes and tailwind-merge to handle conflicts
|
|
1512
|
+
*/
|
|
1513
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
1514
|
+
|
|
1515
|
+
interface DataGridColumn<T> {
|
|
1516
|
+
/** Column key (accessor) */
|
|
1517
|
+
key: keyof T | string;
|
|
1518
|
+
/** Column header */
|
|
1519
|
+
header: string;
|
|
1520
|
+
/** Custom cell renderer */
|
|
1521
|
+
cell?: (value: unknown, row: T) => ReactNode;
|
|
1522
|
+
/** Enable sorting */
|
|
1523
|
+
sortable?: boolean;
|
|
1524
|
+
/** Column width */
|
|
1525
|
+
width?: number | string;
|
|
1526
|
+
}
|
|
1527
|
+
interface DataGridProps<T extends Record<string, unknown>> {
|
|
1528
|
+
/** Data array */
|
|
1529
|
+
data: T[];
|
|
1530
|
+
/** Column definitions */
|
|
1531
|
+
columns: DataGridColumn<T>[];
|
|
1532
|
+
/** Enable global search */
|
|
1533
|
+
searchable?: boolean;
|
|
1534
|
+
/** Search placeholder */
|
|
1535
|
+
searchPlaceholder?: string;
|
|
1536
|
+
/** Row click handler */
|
|
1537
|
+
onRowClick?: (row: T) => void;
|
|
1538
|
+
/** Loading state */
|
|
1539
|
+
loading?: boolean;
|
|
1540
|
+
/** Empty state message */
|
|
1541
|
+
emptyMessage?: string;
|
|
1542
|
+
/** Additional class name */
|
|
1543
|
+
className?: string;
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* DataGrid - Sortable, filterable data table for tool results
|
|
1547
|
+
*
|
|
1548
|
+
* @example
|
|
1549
|
+
* ```tsx
|
|
1550
|
+
* const { result } = useTool<{ items: Item[] }>('get-items');
|
|
1551
|
+
*
|
|
1552
|
+
* <DataGrid
|
|
1553
|
+
* data={result?.items ?? []}
|
|
1554
|
+
* columns={[
|
|
1555
|
+
* { key: 'name', header: 'Name', sortable: true },
|
|
1556
|
+
* { key: 'price', header: 'Price', cell: (v) => `$${v}` },
|
|
1557
|
+
* ]}
|
|
1558
|
+
* searchable
|
|
1559
|
+
* />
|
|
1560
|
+
* ```
|
|
1561
|
+
*/
|
|
1562
|
+
declare function DataGrid<T extends Record<string, unknown>>({ data, columns, searchable, searchPlaceholder, onRowClick, loading, emptyMessage, className, }: DataGridProps<T>): react_jsx_runtime.JSX.Element;
|
|
1563
|
+
|
|
1564
|
+
type ChartType = 'line' | 'bar' | 'pie' | 'doughnut';
|
|
1565
|
+
interface ChartProps {
|
|
1566
|
+
/** Chart type */
|
|
1567
|
+
type: ChartType;
|
|
1568
|
+
/** Chart data */
|
|
1569
|
+
data: ChartData<ChartType$1>;
|
|
1570
|
+
/** Chart options */
|
|
1571
|
+
options?: ChartOptions<ChartType$1>;
|
|
1572
|
+
/** Chart height */
|
|
1573
|
+
height?: number | string;
|
|
1574
|
+
/** Chart width */
|
|
1575
|
+
width?: number | string;
|
|
1576
|
+
/** Additional class name */
|
|
1577
|
+
className?: string;
|
|
1578
|
+
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Chart component for data visualization
|
|
1581
|
+
*
|
|
1582
|
+
* @example
|
|
1583
|
+
* ```tsx
|
|
1584
|
+
* const { result } = useTool<{ prices: number[], labels: string[] }>('get-stock-data');
|
|
1585
|
+
*
|
|
1586
|
+
* <Chart
|
|
1587
|
+
* type="line"
|
|
1588
|
+
* data={{
|
|
1589
|
+
* labels: result?.labels ?? [],
|
|
1590
|
+
* datasets: [{
|
|
1591
|
+
* label: 'Price',
|
|
1592
|
+
* data: result?.prices ?? [],
|
|
1593
|
+
* borderColor: '#6366f1',
|
|
1594
|
+
* tension: 0.4,
|
|
1595
|
+
* }],
|
|
1596
|
+
* }}
|
|
1597
|
+
* height={300}
|
|
1598
|
+
* />
|
|
1599
|
+
* ```
|
|
1600
|
+
*/
|
|
1601
|
+
declare function Chart({ type, data, options, height, width, className, }: ChartProps): react_jsx_runtime.JSX.Element;
|
|
1602
|
+
|
|
1603
|
+
interface AppShellProps extends HTMLAttributes<HTMLDivElement> {
|
|
1604
|
+
/** Header content */
|
|
1605
|
+
header?: ReactNode;
|
|
1606
|
+
/** Sidebar content */
|
|
1607
|
+
sidebar?: ReactNode;
|
|
1608
|
+
/** Footer content */
|
|
1609
|
+
footer?: ReactNode;
|
|
1610
|
+
/** Sidebar position */
|
|
1611
|
+
sidebarPosition?: 'left' | 'right';
|
|
1612
|
+
/** Sidebar width */
|
|
1613
|
+
sidebarWidth?: number | string;
|
|
1614
|
+
/** Enable auto-resize to content (uses ext-apps sendSizeChanged) */
|
|
1615
|
+
autoResize?: boolean;
|
|
1616
|
+
/** Padding */
|
|
1617
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* AppShell - Root layout container for MCP Apps
|
|
1621
|
+
*
|
|
1622
|
+
* Provides header, sidebar, main content, and footer areas with auto-resize support.
|
|
1623
|
+
* Uses the ext-apps protocol for proper size change notifications.
|
|
1624
|
+
*
|
|
1625
|
+
* @example
|
|
1626
|
+
* ```tsx
|
|
1627
|
+
* <AppShell
|
|
1628
|
+
* header={<h1>My App</h1>}
|
|
1629
|
+
* sidebar={<Navigation />}
|
|
1630
|
+
* autoResize
|
|
1631
|
+
* >
|
|
1632
|
+
* <MainContent />
|
|
1633
|
+
* </AppShell>
|
|
1634
|
+
* ```
|
|
1635
|
+
*/
|
|
1636
|
+
declare function AppShell({ header, sidebar, footer, sidebarPosition, sidebarWidth, autoResize, padding, className, children, ...props }: AppShellProps): react_jsx_runtime.JSX.Element;
|
|
1637
|
+
|
|
1638
|
+
interface TabItem {
|
|
1639
|
+
value: string;
|
|
1640
|
+
label: string;
|
|
1641
|
+
disabled?: boolean;
|
|
1642
|
+
}
|
|
1643
|
+
interface TabsProps {
|
|
1644
|
+
/** Tab items */
|
|
1645
|
+
tabs: TabItem[];
|
|
1646
|
+
/** Default active tab (uncontrolled) */
|
|
1647
|
+
defaultValue?: string;
|
|
1648
|
+
/** Active tab value (controlled) */
|
|
1649
|
+
value?: string;
|
|
1650
|
+
/** Change handler */
|
|
1651
|
+
onValueChange?: (value: string) => void;
|
|
1652
|
+
/** Children (tab content) */
|
|
1653
|
+
children?: React__default.ReactNode;
|
|
1654
|
+
/** Additional class name */
|
|
1655
|
+
className?: string;
|
|
1656
|
+
}
|
|
1657
|
+
interface TabContentProps {
|
|
1658
|
+
/** Tab value this content belongs to */
|
|
1659
|
+
value: string;
|
|
1660
|
+
/** Children */
|
|
1661
|
+
children: React__default.ReactNode;
|
|
1662
|
+
/** Additional class name */
|
|
1663
|
+
className?: string;
|
|
1664
|
+
}
|
|
1665
|
+
declare function Tabs({ tabs, defaultValue, value, onValueChange, children, className, }: TabsProps): react_jsx_runtime.JSX.Element;
|
|
1666
|
+
declare function TabContent({ value, children, className }: TabContentProps): react_jsx_runtime.JSX.Element;
|
|
1667
|
+
|
|
1668
|
+
interface ModalProps {
|
|
1669
|
+
/** Open state */
|
|
1670
|
+
open?: boolean;
|
|
1671
|
+
/** Default open (uncontrolled) */
|
|
1672
|
+
defaultOpen?: boolean;
|
|
1673
|
+
/** Change handler */
|
|
1674
|
+
onOpenChange?: (open: boolean) => void;
|
|
1675
|
+
/** Modal title */
|
|
1676
|
+
title?: string;
|
|
1677
|
+
/** Modal description */
|
|
1678
|
+
description?: string;
|
|
1679
|
+
/** Children content */
|
|
1680
|
+
children?: ReactNode;
|
|
1681
|
+
/** Additional class name */
|
|
1682
|
+
className?: string;
|
|
1683
|
+
/** Trigger element */
|
|
1684
|
+
trigger?: ReactNode;
|
|
1685
|
+
}
|
|
1686
|
+
declare function Modal({ open, defaultOpen, onOpenChange, title, description, children, className, trigger, }: ModalProps): react_jsx_runtime.JSX.Element;
|
|
1687
|
+
|
|
1688
|
+
interface CodeBlockProps {
|
|
1689
|
+
/** Code content */
|
|
1690
|
+
code: string;
|
|
1691
|
+
/** Programming language */
|
|
1692
|
+
language?: string;
|
|
1693
|
+
/** Show line numbers */
|
|
1694
|
+
showLineNumbers?: boolean;
|
|
1695
|
+
/** Enable copy button */
|
|
1696
|
+
copyable?: boolean;
|
|
1697
|
+
/** Additional class name */
|
|
1698
|
+
className?: string;
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* CodeBlock - Syntax highlighted code display
|
|
1702
|
+
*
|
|
1703
|
+
* @example
|
|
1704
|
+
* ```tsx
|
|
1705
|
+
* <CodeBlock
|
|
1706
|
+
* code={`const greeting = "Hello, World!";`}
|
|
1707
|
+
* language="javascript"
|
|
1708
|
+
* copyable
|
|
1709
|
+
* />
|
|
1710
|
+
* ```
|
|
1711
|
+
*/
|
|
1712
|
+
declare function CodeBlock({ code, language, showLineNumbers, copyable, className, }: CodeBlockProps): react_jsx_runtime.JSX.Element;
|
|
1713
|
+
|
|
1714
|
+
interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
1715
|
+
/** Card variant */
|
|
1716
|
+
variant?: 'default' | 'outline' | 'elevated';
|
|
1717
|
+
/** Padding size */
|
|
1718
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
1719
|
+
/** Make card interactive (hover effects) */
|
|
1720
|
+
interactive?: boolean;
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Card container component
|
|
1724
|
+
*/
|
|
1725
|
+
declare const Card: React__default.ForwardRefExoticComponent<CardProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1726
|
+
interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
1727
|
+
/** Header title */
|
|
1728
|
+
title?: ReactNode;
|
|
1729
|
+
/** Header description */
|
|
1730
|
+
description?: ReactNode;
|
|
1731
|
+
/** Right-side action */
|
|
1732
|
+
action?: ReactNode;
|
|
1733
|
+
}
|
|
1734
|
+
declare const CardHeader: React__default.ForwardRefExoticComponent<CardHeaderProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1735
|
+
interface CardContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
1736
|
+
}
|
|
1737
|
+
declare const CardContent: React__default.ForwardRefExoticComponent<CardContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1738
|
+
interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
1739
|
+
}
|
|
1740
|
+
declare const CardFooter: React__default.ForwardRefExoticComponent<CardFooterProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
1741
|
+
|
|
1742
|
+
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
1743
|
+
/** Input label */
|
|
1744
|
+
label?: string;
|
|
1745
|
+
/** Helper text */
|
|
1746
|
+
helperText?: string;
|
|
1747
|
+
/** Error message */
|
|
1748
|
+
error?: string;
|
|
1749
|
+
/** Input size */
|
|
1750
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1751
|
+
/** Left icon or element */
|
|
1752
|
+
leftElement?: ReactNode;
|
|
1753
|
+
/** Right icon or element */
|
|
1754
|
+
rightElement?: ReactNode;
|
|
1755
|
+
/** Full width */
|
|
1756
|
+
fullWidth?: boolean;
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Input component with label, validation, and icon support
|
|
1760
|
+
*
|
|
1761
|
+
* @example
|
|
1762
|
+
* ```tsx
|
|
1763
|
+
* <Input
|
|
1764
|
+
* label="Email"
|
|
1765
|
+
* type="email"
|
|
1766
|
+
* placeholder="Enter your email"
|
|
1767
|
+
* error={errors.email}
|
|
1768
|
+
* />
|
|
1769
|
+
* ```
|
|
1770
|
+
*/
|
|
1771
|
+
declare const Input: React__default.ForwardRefExoticComponent<InputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
1772
|
+
|
|
1773
|
+
export { ActionButton, type ActionButtonProps, Alert, AlertDescription, AlertTitle, type AppInfo, type AppOptions, AppProvider, type AppProviderProps, AppShell, type AppShellProps, type AuthUser, Badge, Button, type ButtonProps, Card, CardContent, type CardContentProps, CardDescription, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, Chart, type ChartProps, type ChartType, Checkbox, CodeBlock, type CodeBlockProps, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, type ConfirmConfig, DEFAULT_RESULT_CONFIG, DataGrid, type DataGridColumn, type DataGridProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GPTAppProvider, type GPTAppProviderProps, type GptAppContextValue, INITIAL_TOOL_STATE, Input, type InputProps, Label, type McpActionProps, type McpAppContextValue, Modal, type ModalProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RequireConnection, type RequireConnectionProps, type ResourceBinding, type ResourceMeta, ResourceView, type ResourceViewProps, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Skeleton, Slider, StreamingContent, type StreamingContentProps, Switch, TabContent, type TabContentProps, type TabItem, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, type TabsProps, TabsTrigger, Textarea, Toaster, type ToolBinding, ToolButton, type ToolButtonProps, type ToolButtonState, type ToolCallState, type ToolContextValue, ToolDataGrid, type ToolDataGridColumn, type ToolDataGridProps, type ToolDataGridRowAction, ToolErrorBoundary, type ToolErrorBoundaryProps, ToolForm, type ToolFormField, type ToolFormProps, ToolInput, type ToolInputProps, type ToolInputSuggestion, ToolProvider, type ToolProviderProps, type ToolResultConfig, ToolSelect, type ToolSelectOption, type ToolSelectProps, type ToolState, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseAuthReturn, type UseHostContextReturn, type UseMessageReturn, type UseResourceOptions, type UseResourceReturn, type UseToolInputPartialReturn, type UseToolInputReturn, type UseToolOptions, type UseToolResultReturn, type UseToolReturn, type UseToolStreamOptions, type UseToolStreamReturn, badgeVariants, buttonVariants, cn, normalizeToolBinding, useAuth, useFormField, useGptApp, useGptTool, useHostContext, useMcpApp, useMessage, useOpenAiGlobal, useResource, useTool, useToolContext, useToolInput$1 as useToolInput, useToolInputPartial, useToolInput as useToolInputSpec, useToolOutput, useToolResponseMetadata, useToolResult, useToolStream, useToolSubscription, useWidgetState };
|