@leanmcp/ui 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -3
- package/dist/chunk-2HRO6CFU.js +138 -0
- package/dist/chunk-2HRO6CFU.js.map +1 -0
- package/dist/chunk-KX75VCMM.mjs +124 -0
- package/dist/chunk-KX75VCMM.mjs.map +1 -0
- package/dist/index.d.mts +105 -3
- package/dist/index.d.ts +105 -3
- package/dist/index.js +839 -665
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +520 -385
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +115 -1
- package/dist/server.d.ts +115 -1
- package/dist/server.js +48 -7
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +2 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-3PV26V5F.js +0 -50
- package/dist/chunk-3PV26V5F.js.map +0 -1
- package/dist/chunk-WORZ46KI.mjs +0 -42
- package/dist/chunk-WORZ46KI.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { ReactNode, ButtonHTMLAttributes, Component, ErrorInfo, HTMLAttributes, InputHTMLAttributes } from 'react';
|
|
4
4
|
import { McpUiAppCapabilities, App, McpUiHostContext, McpUiDisplayMode, McpUiHostStyles } from '@modelcontextprotocol/ext-apps';
|
|
5
|
-
export { App, McpUiAppCapabilities, McpUiDisplayMode, McpUiHostContext, McpUiHostStyles, McpUiStyles, McpUiToolCancelledNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, PostMessageTransport } 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
6
|
import { CallToolResult, ContentBlock } from '@modelcontextprotocol/sdk/types.js';
|
|
7
7
|
import { ToasterProps } from 'sonner';
|
|
8
8
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
@@ -25,9 +25,10 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
|
25
25
|
import { Command as Command$1 } from 'cmdk';
|
|
26
26
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
27
27
|
import { ClassValue } from 'clsx';
|
|
28
|
-
export { UIApp, UIAppOptions, getUIAppMetadata, getUIAppUri } from './server.js';
|
|
28
|
+
export { GPTApp, GPTAppOptions, UIApp, UIAppOptions, getGPTAppMetadata, getGPTAppUri, getUIAppMetadata, getUIAppUri } from './server.js';
|
|
29
29
|
import { ChartData, ChartType as ChartType$1, ChartOptions } from 'chart.js';
|
|
30
30
|
export { AppBridge } from '@modelcontextprotocol/ext-apps/app-bridge';
|
|
31
|
+
import '@modelcontextprotocol/ext-apps/server';
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* App information (same as ext-apps Implementation)
|
|
@@ -121,6 +122,107 @@ declare function AppProvider({ appInfo, capabilities, options, onTeardown, child
|
|
|
121
122
|
*/
|
|
122
123
|
declare function useMcpApp(): McpAppContextValue;
|
|
123
124
|
|
|
125
|
+
/**
|
|
126
|
+
* ChatGPT's window.openai interface
|
|
127
|
+
* Only includes properties that are confirmed to exist in the ChatGPT Apps SDK
|
|
128
|
+
*/
|
|
129
|
+
interface OpenAISDK {
|
|
130
|
+
/** Call a server tool */
|
|
131
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<any>;
|
|
132
|
+
/** Current theme */
|
|
133
|
+
theme?: 'light' | 'dark';
|
|
134
|
+
/** Current locale */
|
|
135
|
+
locale?: string;
|
|
136
|
+
/** Display mode */
|
|
137
|
+
displayMode?: 'inline' | 'modal' | 'fullscreen';
|
|
138
|
+
/** Maximum height for the widget */
|
|
139
|
+
maxHeight?: number;
|
|
140
|
+
}
|
|
141
|
+
declare global {
|
|
142
|
+
interface Window {
|
|
143
|
+
openai?: OpenAISDK;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* GPT App context value - available via useGptApp()
|
|
148
|
+
*/
|
|
149
|
+
interface GptAppContextValue {
|
|
150
|
+
/** Whether connected to ChatGPT host */
|
|
151
|
+
isConnected: boolean;
|
|
152
|
+
/** Connection error, if any */
|
|
153
|
+
error: Error | null;
|
|
154
|
+
/** Theme from host */
|
|
155
|
+
theme: 'light' | 'dark';
|
|
156
|
+
/** Display mode */
|
|
157
|
+
displayMode: string;
|
|
158
|
+
/** Locale */
|
|
159
|
+
locale: string;
|
|
160
|
+
/** Max height from host */
|
|
161
|
+
maxHeight: number;
|
|
162
|
+
/** Call a server tool via ChatGPT */
|
|
163
|
+
callTool: (name: string, args?: Record<string, unknown>) => Promise<any>;
|
|
164
|
+
}
|
|
165
|
+
interface GPTAppProviderProps {
|
|
166
|
+
/** App name */
|
|
167
|
+
appName: string;
|
|
168
|
+
/** React children */
|
|
169
|
+
children: ReactNode;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* GPTAppProvider - Root context for ChatGPT Apps
|
|
173
|
+
*
|
|
174
|
+
* Uses ChatGPT's native window.openai SDK for host communication.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```tsx
|
|
178
|
+
* function MyGPTApp() {
|
|
179
|
+
* return (
|
|
180
|
+
* <GPTAppProvider appName="MyApp">
|
|
181
|
+
* <MyContent />
|
|
182
|
+
* </GPTAppProvider>
|
|
183
|
+
* );
|
|
184
|
+
* }
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
declare function GPTAppProvider({ appName, children }: GPTAppProviderProps): react_jsx_runtime.JSX.Element;
|
|
188
|
+
/**
|
|
189
|
+
* Hook to access the GPT App context
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```tsx
|
|
193
|
+
* function MyComponent() {
|
|
194
|
+
* const { isConnected, theme, callTool } = useGptApp();
|
|
195
|
+
* // ...
|
|
196
|
+
* }
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
declare function useGptApp(): GptAppContextValue;
|
|
200
|
+
/**
|
|
201
|
+
* Hook to call tools via ChatGPT SDK
|
|
202
|
+
* Similar to useTool but for GPT Apps
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```tsx
|
|
206
|
+
* function MyComponent() {
|
|
207
|
+
* const { call, result, loading, error } = useGptTool('myTool');
|
|
208
|
+
*
|
|
209
|
+
* useEffect(() => {
|
|
210
|
+
* call({ param: 'value' });
|
|
211
|
+
* }, []);
|
|
212
|
+
*
|
|
213
|
+
* if (loading) return <div>Loading...</div>;
|
|
214
|
+
* return <div>{JSON.stringify(result)}</div>;
|
|
215
|
+
* }
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
declare function useGptTool(toolName: string): {
|
|
219
|
+
call: (args?: Record<string, unknown>) => Promise<any>;
|
|
220
|
+
result: any;
|
|
221
|
+
loading: boolean;
|
|
222
|
+
error: Error | null;
|
|
223
|
+
isConnected: boolean;
|
|
224
|
+
};
|
|
225
|
+
|
|
124
226
|
/**
|
|
125
227
|
* MCP-Native UI SDK - Core Types
|
|
126
228
|
*
|
|
@@ -1521,4 +1623,4 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'>
|
|
|
1521
1623
|
*/
|
|
1522
1624
|
declare const Input: React__default.ForwardRefExoticComponent<InputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
1523
1625
|
|
|
1524
|
-
export { ActionButton, type ActionButtonProps, Alert, AlertDescription, AlertTitle, type AppInfo, type AppOptions, AppProvider, type AppProviderProps, AppShell, type AppShellProps, 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, 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 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, useFormField, useHostContext, useMcpApp, useMessage, useResource, useTool, useToolContext, useToolInput, useToolInputPartial, useToolResult, useToolStream, useToolSubscription };
|
|
1626
|
+
export { ActionButton, type ActionButtonProps, Alert, AlertDescription, AlertTitle, type AppInfo, type AppOptions, AppProvider, type AppProviderProps, AppShell, type AppShellProps, 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 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, useFormField, useGptApp, useGptTool, useHostContext, useMcpApp, useMessage, useResource, useTool, useToolContext, useToolInput, useToolInputPartial, useToolResult, useToolStream, useToolSubscription };
|