mcp-app-studio 0.3.2

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/index.js ADDED
@@ -0,0 +1,358 @@
1
+ import {
2
+ imageBlock,
3
+ textBlock
4
+ } from "./chunk-KRCGOYZ5.js";
5
+ import {
6
+ ChatGPTBridge
7
+ } from "./chunk-L2RRNF7V.js";
8
+ import {
9
+ MCPBridge
10
+ } from "./chunk-QO43ZGJI.js";
11
+ import {
12
+ CHATGPT_CAPABILITIES,
13
+ MCP_CAPABILITIES,
14
+ hasFeature
15
+ } from "./chunk-4LAH4JH6.js";
16
+
17
+ // src/universal/detect.ts
18
+ var MCP_MARKERS = {
19
+ URL_PARAM: "mcp-host",
20
+ WINDOW_PROP: "__MCP_HOST__",
21
+ DATA_ATTR: "data-mcp-host"
22
+ };
23
+ var DEBUG_KEY = "__CHATGPT_APP_DEBUG__";
24
+ function isDebugMode() {
25
+ if (typeof window === "undefined") return false;
26
+ return window[DEBUG_KEY] === true;
27
+ }
28
+ function debugLog(message, data) {
29
+ if (!isDebugMode()) return;
30
+ console.log(`[mcp-app-studio] ${message}`, data ?? "");
31
+ }
32
+ function detectPlatformDetailed() {
33
+ const checks = {
34
+ windowOpenai: false,
35
+ mcpUrlParam: false,
36
+ mcpWindowProp: false,
37
+ mcpDataAttr: false
38
+ };
39
+ if (typeof window === "undefined") {
40
+ debugLog("detectPlatform: No window object (SSR/Node.js)");
41
+ return { platform: "unknown", detectedBy: null, checks };
42
+ }
43
+ if (window["openai"]) {
44
+ checks.windowOpenai = true;
45
+ debugLog("detectPlatform: Found window.openai", { platform: "chatgpt" });
46
+ return { platform: "chatgpt", detectedBy: "window.openai", checks };
47
+ }
48
+ try {
49
+ const params = new URLSearchParams(window.location.search);
50
+ if (params.has(MCP_MARKERS.URL_PARAM)) {
51
+ checks.mcpUrlParam = true;
52
+ debugLog("detectPlatform: Found MCP URL param", {
53
+ param: MCP_MARKERS.URL_PARAM,
54
+ platform: "mcp"
55
+ });
56
+ return { platform: "mcp", detectedBy: `URL param: ${MCP_MARKERS.URL_PARAM}`, checks };
57
+ }
58
+ } catch {
59
+ debugLog("detectPlatform: URL parsing failed");
60
+ }
61
+ if (MCP_MARKERS.WINDOW_PROP in window) {
62
+ checks.mcpWindowProp = true;
63
+ debugLog("detectPlatform: Found MCP window property", {
64
+ prop: MCP_MARKERS.WINDOW_PROP,
65
+ platform: "mcp"
66
+ });
67
+ return { platform: "mcp", detectedBy: `window.${MCP_MARKERS.WINDOW_PROP}`, checks };
68
+ }
69
+ try {
70
+ const frameElement = window.frameElement;
71
+ if (frameElement?.hasAttribute(MCP_MARKERS.DATA_ATTR)) {
72
+ checks.mcpDataAttr = true;
73
+ debugLog("detectPlatform: Found MCP data attribute", {
74
+ attr: MCP_MARKERS.DATA_ATTR,
75
+ platform: "mcp"
76
+ });
77
+ return { platform: "mcp", detectedBy: `iframe: ${MCP_MARKERS.DATA_ATTR}`, checks };
78
+ }
79
+ } catch {
80
+ debugLog("detectPlatform: Frame element access failed (cross-origin)");
81
+ }
82
+ debugLog("detectPlatform: No platform markers found", { checks });
83
+ return { platform: "unknown", detectedBy: null, checks };
84
+ }
85
+ function detectPlatform() {
86
+ return detectPlatformDetailed().platform;
87
+ }
88
+ function isChatGPT() {
89
+ return detectPlatform() === "chatgpt";
90
+ }
91
+ function isMCP() {
92
+ return detectPlatform() === "mcp";
93
+ }
94
+ function enableDebugMode() {
95
+ if (typeof window !== "undefined") {
96
+ window[DEBUG_KEY] = true;
97
+ console.log("[mcp-app-studio] Debug mode enabled. Platform detection will log to console.");
98
+ }
99
+ }
100
+ function disableDebugMode() {
101
+ if (typeof window !== "undefined") {
102
+ window[DEBUG_KEY] = false;
103
+ }
104
+ }
105
+
106
+ // src/universal/provider.tsx
107
+ import {
108
+ createContext,
109
+ useContext,
110
+ useEffect,
111
+ useState
112
+ } from "react";
113
+ import { jsx } from "react/jsx-runtime";
114
+ var UniversalContext = createContext(null);
115
+ var PlatformContext = createContext("unknown");
116
+ function UniversalProvider({
117
+ children,
118
+ appInfo,
119
+ appCapabilities
120
+ }) {
121
+ const [bridge, setBridge] = useState(null);
122
+ const [platform, setPlatform] = useState("unknown");
123
+ const [ready, setReady] = useState(false);
124
+ useEffect(() => {
125
+ const detected = detectPlatform();
126
+ setPlatform(detected);
127
+ let newBridge;
128
+ if (detected === "chatgpt") {
129
+ newBridge = new ChatGPTBridge();
130
+ } else if (detected === "mcp") {
131
+ newBridge = new MCPBridge(appInfo, appCapabilities);
132
+ } else {
133
+ setReady(true);
134
+ return;
135
+ }
136
+ newBridge.connect().then(() => {
137
+ setBridge(newBridge);
138
+ setReady(true);
139
+ });
140
+ }, [appInfo, appCapabilities]);
141
+ if (!ready) return null;
142
+ return /* @__PURE__ */ jsx(PlatformContext.Provider, { value: platform, children: /* @__PURE__ */ jsx(UniversalContext.Provider, { value: bridge, children }) });
143
+ }
144
+ function useUniversalBridge() {
145
+ return useContext(UniversalContext);
146
+ }
147
+ function usePlatform() {
148
+ return useContext(PlatformContext);
149
+ }
150
+
151
+ // src/universal/hooks.tsx
152
+ import { useEffect as useEffect2, useState as useState2, useCallback } from "react";
153
+ function useHostContext() {
154
+ const bridge = useUniversalBridge();
155
+ const [context, setContext] = useState2(
156
+ bridge?.getHostContext() ?? null
157
+ );
158
+ useEffect2(() => {
159
+ if (!bridge) return;
160
+ return bridge.onHostContextChanged((ctx) => {
161
+ setContext(
162
+ (prev) => prev ? { ...prev, ...ctx } : ctx
163
+ );
164
+ });
165
+ }, [bridge]);
166
+ return context;
167
+ }
168
+ function useTheme() {
169
+ const context = useHostContext();
170
+ return context?.theme ?? "light";
171
+ }
172
+ function useCapabilities() {
173
+ const bridge = useUniversalBridge();
174
+ return bridge?.capabilities ?? null;
175
+ }
176
+ function useToolInput() {
177
+ const bridge = useUniversalBridge();
178
+ const [input, setInput] = useState2(null);
179
+ useEffect2(() => {
180
+ if (!bridge) return;
181
+ return bridge.onToolInput((args) => setInput(args));
182
+ }, [bridge]);
183
+ return input;
184
+ }
185
+ function useToolInputPartial() {
186
+ const bridge = useUniversalBridge();
187
+ const platform = usePlatform();
188
+ const [input, setInput] = useState2(null);
189
+ useEffect2(() => {
190
+ if (!bridge || platform !== "mcp") return;
191
+ if (!bridge.onToolInputPartial) return;
192
+ return bridge.onToolInputPartial((args) => setInput(args));
193
+ }, [bridge, platform]);
194
+ return input;
195
+ }
196
+ function useToolResult() {
197
+ const bridge = useUniversalBridge();
198
+ const [result, setResult] = useState2(null);
199
+ useEffect2(() => {
200
+ if (!bridge) return;
201
+ return bridge.onToolResult(setResult);
202
+ }, [bridge]);
203
+ return result;
204
+ }
205
+ function useDisplayMode() {
206
+ const bridge = useUniversalBridge();
207
+ const context = useHostContext();
208
+ const mode = context?.displayMode ?? "inline";
209
+ const setMode = useCallback(
210
+ async (newMode) => {
211
+ if (!bridge) return;
212
+ await bridge.requestDisplayMode(newMode);
213
+ },
214
+ [bridge]
215
+ );
216
+ return [mode, setMode];
217
+ }
218
+ function useCallTool() {
219
+ const bridge = useUniversalBridge();
220
+ return useCallback(
221
+ async (name, args) => {
222
+ if (!bridge) {
223
+ throw new Error(
224
+ "Bridge not available. Make sure your component is wrapped with <UniversalProvider>."
225
+ );
226
+ }
227
+ return bridge.callTool(name, args);
228
+ },
229
+ [bridge]
230
+ );
231
+ }
232
+ function useOpenLink() {
233
+ const bridge = useUniversalBridge();
234
+ return useCallback(
235
+ async (url) => {
236
+ if (!bridge) {
237
+ throw new Error(
238
+ "Bridge not available. Make sure your component is wrapped with <UniversalProvider>."
239
+ );
240
+ }
241
+ return bridge.openLink(url);
242
+ },
243
+ [bridge]
244
+ );
245
+ }
246
+ function useSendMessage() {
247
+ const bridge = useUniversalBridge();
248
+ return useCallback(
249
+ async (text) => {
250
+ if (!bridge?.sendMessage) {
251
+ throw new Error(
252
+ "sendMessage not available. This feature may not be supported on the current platform."
253
+ );
254
+ }
255
+ return bridge.sendMessage({
256
+ role: "user",
257
+ content: [{ type: "text", text }]
258
+ });
259
+ },
260
+ [bridge]
261
+ );
262
+ }
263
+ function useUpdateModelContext() {
264
+ const bridge = useUniversalBridge();
265
+ const platform = usePlatform();
266
+ return useCallback(
267
+ async (ctx) => {
268
+ if (platform !== "mcp") {
269
+ console.warn(
270
+ "useUpdateModelContext: This feature is only available on MCP hosts. On ChatGPT, consider using useWidgetState instead."
271
+ );
272
+ return;
273
+ }
274
+ if (!bridge?.updateModelContext) {
275
+ throw new Error(
276
+ "updateModelContext not available on the current bridge."
277
+ );
278
+ }
279
+ return bridge.updateModelContext(ctx);
280
+ },
281
+ [bridge, platform]
282
+ );
283
+ }
284
+ function useWidgetState() {
285
+ const bridge = useUniversalBridge();
286
+ const platform = usePlatform();
287
+ const [state, setState] = useState2(() => {
288
+ if (platform !== "chatgpt" || !bridge?.getWidgetState) return null;
289
+ return bridge.getWidgetState();
290
+ });
291
+ const setWidgetState = useCallback(
292
+ (newState) => {
293
+ if (platform !== "chatgpt") {
294
+ console.warn(
295
+ "useWidgetState: This feature is only available on ChatGPT. On MCP hosts, consider using useUpdateModelContext instead."
296
+ );
297
+ return;
298
+ }
299
+ if (!bridge?.setWidgetState) return;
300
+ bridge.setWidgetState(newState);
301
+ setState(newState);
302
+ },
303
+ [bridge, platform]
304
+ );
305
+ return [state, setWidgetState];
306
+ }
307
+ function useLog() {
308
+ const bridge = useUniversalBridge();
309
+ const platform = usePlatform();
310
+ return useCallback(
311
+ (level, data) => {
312
+ if (platform !== "mcp") {
313
+ console.warn(
314
+ "useLog: Structured logging is only available on MCP hosts. Falling back to console.log."
315
+ );
316
+ console.log(`[${level}]`, data);
317
+ return;
318
+ }
319
+ if (!bridge?.sendLog) return;
320
+ bridge.sendLog(level, data);
321
+ },
322
+ [bridge, platform]
323
+ );
324
+ }
325
+ function useFeature(feature) {
326
+ const capabilities = useCapabilities();
327
+ return hasFeature(capabilities, feature);
328
+ }
329
+ export {
330
+ CHATGPT_CAPABILITIES,
331
+ MCP_CAPABILITIES,
332
+ UniversalProvider,
333
+ detectPlatform,
334
+ detectPlatformDetailed,
335
+ disableDebugMode,
336
+ enableDebugMode,
337
+ hasFeature,
338
+ imageBlock,
339
+ isChatGPT,
340
+ isMCP,
341
+ textBlock,
342
+ useCallTool,
343
+ useCapabilities,
344
+ useDisplayMode,
345
+ useFeature,
346
+ useHostContext,
347
+ useLog,
348
+ useOpenLink,
349
+ usePlatform,
350
+ useSendMessage,
351
+ useTheme,
352
+ useToolInput,
353
+ useToolInputPartial,
354
+ useToolResult,
355
+ useUniversalBridge,
356
+ useUpdateModelContext,
357
+ useWidgetState
358
+ };
@@ -0,0 +1,158 @@
1
+ import { ExtendedBridge, HostCapabilities, HostContext, ToolInputCallback, ToolResultCallback, HostContextChangedCallback, ToolResult, DisplayMode, ChatMessage } from '../../core/index.js';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { ReactNode } from 'react';
4
+
5
+ interface ChatGPTGlobals {
6
+ theme: "light" | "dark";
7
+ locale: string;
8
+ displayMode: "pip" | "inline" | "fullscreen";
9
+ previousDisplayMode: "pip" | "inline" | "fullscreen" | null;
10
+ maxHeight: number;
11
+ toolInput: Record<string, unknown>;
12
+ toolOutput: Record<string, unknown> | null;
13
+ toolResponseMetadata: Record<string, unknown> | null;
14
+ widgetState: Record<string, unknown> | null;
15
+ userAgent: {
16
+ device: {
17
+ type: "mobile" | "tablet" | "desktop" | "resizable";
18
+ };
19
+ capabilities: {
20
+ hover: boolean;
21
+ touch: boolean;
22
+ };
23
+ };
24
+ safeArea: {
25
+ insets: {
26
+ top: number;
27
+ bottom: number;
28
+ left: number;
29
+ right: number;
30
+ };
31
+ };
32
+ view: {
33
+ mode: "modal" | "inline";
34
+ params: Record<string, unknown> | null;
35
+ } | null;
36
+ userLocation: {
37
+ city?: string;
38
+ region?: string;
39
+ country?: string;
40
+ timezone?: string;
41
+ longitude?: number;
42
+ latitude?: number;
43
+ } | null;
44
+ }
45
+ declare global {
46
+ interface Window {
47
+ openai?: ChatGPTGlobals & {
48
+ callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
49
+ setWidgetState(state: Record<string, unknown> | null): void;
50
+ requestDisplayMode(args: {
51
+ mode: string;
52
+ }): Promise<{
53
+ mode: string;
54
+ }>;
55
+ notifyIntrinsicHeight(height: number): void;
56
+ requestClose(): void;
57
+ sendFollowUpMessage(args: {
58
+ prompt: string;
59
+ }): Promise<void>;
60
+ openExternal(payload: {
61
+ href: string;
62
+ }): void;
63
+ uploadFile(file: File): Promise<{
64
+ fileId: string;
65
+ }>;
66
+ getFileDownloadUrl(args: {
67
+ fileId: string;
68
+ }): Promise<{
69
+ downloadUrl: string;
70
+ }>;
71
+ requestModal(options: unknown): Promise<void>;
72
+ };
73
+ }
74
+ }
75
+
76
+ declare class ChatGPTBridge implements ExtendedBridge {
77
+ readonly platform: "chatgpt";
78
+ readonly capabilities: HostCapabilities;
79
+ private toolInputCallbacks;
80
+ private toolResultCallbacks;
81
+ private contextCallbacks;
82
+ private lastContext;
83
+ private connected;
84
+ private get openai();
85
+ connect(): Promise<void>;
86
+ private buildHostContext;
87
+ private mapDeviceType;
88
+ private handleGlobalsChange;
89
+ getHostContext(): HostContext | null;
90
+ onToolInput(callback: ToolInputCallback): () => void;
91
+ onToolResult(callback: ToolResultCallback): () => void;
92
+ onHostContextChanged(callback: HostContextChangedCallback): () => void;
93
+ callTool(name: string, args: Record<string, unknown>): Promise<ToolResult>;
94
+ openLink(url: string): Promise<void>;
95
+ requestDisplayMode(mode: DisplayMode): Promise<DisplayMode>;
96
+ sendSizeChanged(size: {
97
+ width?: number;
98
+ height?: number;
99
+ }): void;
100
+ sendMessage(message: ChatMessage): Promise<void>;
101
+ setWidgetState(state: Record<string, unknown> | null): void;
102
+ getWidgetState(): Record<string, unknown> | null;
103
+ uploadFile(file: File): Promise<{
104
+ fileId: string;
105
+ }>;
106
+ getFileDownloadUrl(fileId: string): Promise<{
107
+ downloadUrl: string;
108
+ }>;
109
+ requestClose(): void;
110
+ requestModal(options: {
111
+ title?: string;
112
+ params?: Record<string, unknown>;
113
+ anchor?: {
114
+ x: number;
115
+ y: number;
116
+ width: number;
117
+ height: number;
118
+ };
119
+ }): Promise<void>;
120
+ }
121
+
122
+ declare function ChatGPTProvider({ children }: {
123
+ children: ReactNode;
124
+ }): react_jsx_runtime.JSX.Element | null;
125
+ declare function useHostContext(): HostContext | null;
126
+ declare function useTheme(): "light" | "dark";
127
+ declare function useToolInput<T = Record<string, unknown>>(): T | null;
128
+ declare function useToolResult(): ToolResult | null;
129
+ declare function useDisplayMode(): [
130
+ DisplayMode,
131
+ (mode: DisplayMode) => Promise<void>
132
+ ];
133
+ declare function useWidgetState<T = Record<string, unknown>>(): [
134
+ T | null,
135
+ (state: T | null) => void
136
+ ];
137
+ declare function useCallTool(): (name: string, args: Record<string, unknown>) => Promise<ToolResult>;
138
+ declare function useOpenLink(): (url: string) => Promise<void>;
139
+ declare function useSendMessage(): (text: string) => Promise<void>;
140
+ declare function useUploadFile(): (file: File) => Promise<{
141
+ fileId: string;
142
+ }>;
143
+ declare function useGetFileDownloadUrl(): (fileId: string) => Promise<{
144
+ downloadUrl: string;
145
+ }>;
146
+ declare function useRequestClose(): () => void;
147
+ declare function useRequestModal(): (options: {
148
+ title?: string;
149
+ params?: Record<string, unknown>;
150
+ anchor?: {
151
+ x: number;
152
+ y: number;
153
+ width: number;
154
+ height: number;
155
+ };
156
+ }) => Promise<void>;
157
+
158
+ export { ChatGPTBridge, type ChatGPTGlobals, ChatGPTProvider, useCallTool, useDisplayMode, useGetFileDownloadUrl, useHostContext, useOpenLink, useRequestClose, useRequestModal, useSendMessage, useTheme, useToolInput, useToolResult, useUploadFile, useWidgetState };
@@ -0,0 +1,149 @@
1
+ import {
2
+ ChatGPTBridge
3
+ } from "../../chunk-L2RRNF7V.js";
4
+ import "../../chunk-4LAH4JH6.js";
5
+
6
+ // src/platforms/chatgpt/hooks.tsx
7
+ import {
8
+ createContext,
9
+ useContext,
10
+ useEffect,
11
+ useState,
12
+ useCallback
13
+ } from "react";
14
+ import { jsx } from "react/jsx-runtime";
15
+ var ChatGPTContext = createContext(null);
16
+ function ChatGPTProvider({ children }) {
17
+ const [bridge] = useState(() => new ChatGPTBridge());
18
+ const [ready, setReady] = useState(false);
19
+ useEffect(() => {
20
+ bridge.connect().then(() => setReady(true));
21
+ }, [bridge]);
22
+ if (!ready) return null;
23
+ return /* @__PURE__ */ jsx(ChatGPTContext.Provider, { value: bridge, children });
24
+ }
25
+ function useChatGPTBridge() {
26
+ const bridge = useContext(ChatGPTContext);
27
+ if (!bridge) {
28
+ throw new Error("useChatGPT* hooks must be used within ChatGPTProvider");
29
+ }
30
+ return bridge;
31
+ }
32
+ function useHostContext() {
33
+ const bridge = useChatGPTBridge();
34
+ const [context, setContext] = useState(
35
+ bridge.getHostContext()
36
+ );
37
+ useEffect(() => {
38
+ return bridge.onHostContextChanged((ctx) => {
39
+ setContext((prev) => ({ ...prev, ...ctx }));
40
+ });
41
+ }, [bridge]);
42
+ return context;
43
+ }
44
+ function useTheme() {
45
+ const context = useHostContext();
46
+ return context?.theme ?? "light";
47
+ }
48
+ function useToolInput() {
49
+ const bridge = useChatGPTBridge();
50
+ const [input, setInput] = useState(null);
51
+ useEffect(() => {
52
+ return bridge.onToolInput((args) => setInput(args));
53
+ }, [bridge]);
54
+ return input;
55
+ }
56
+ function useToolResult() {
57
+ const bridge = useChatGPTBridge();
58
+ const [result, setResult] = useState(null);
59
+ useEffect(() => {
60
+ return bridge.onToolResult(setResult);
61
+ }, [bridge]);
62
+ return result;
63
+ }
64
+ function useDisplayMode() {
65
+ const bridge = useChatGPTBridge();
66
+ const context = useHostContext();
67
+ const mode = context?.displayMode ?? "inline";
68
+ const setMode = useCallback(
69
+ async (newMode) => {
70
+ await bridge.requestDisplayMode(newMode);
71
+ },
72
+ [bridge]
73
+ );
74
+ return [mode, setMode];
75
+ }
76
+ function useWidgetState() {
77
+ const bridge = useChatGPTBridge();
78
+ const [state, setState] = useState(
79
+ bridge.getWidgetState()
80
+ );
81
+ const setWidgetState = useCallback(
82
+ (newState) => {
83
+ bridge.setWidgetState(newState);
84
+ setState(newState);
85
+ },
86
+ [bridge]
87
+ );
88
+ return [state, setWidgetState];
89
+ }
90
+ function useCallTool() {
91
+ const bridge = useChatGPTBridge();
92
+ return useCallback(
93
+ (name, args) => bridge.callTool(name, args),
94
+ [bridge]
95
+ );
96
+ }
97
+ function useOpenLink() {
98
+ const bridge = useChatGPTBridge();
99
+ return useCallback((url) => bridge.openLink(url), [bridge]);
100
+ }
101
+ function useSendMessage() {
102
+ const bridge = useChatGPTBridge();
103
+ return useCallback(
104
+ (text) => bridge.sendMessage({
105
+ role: "user",
106
+ content: [{ type: "text", text }]
107
+ }),
108
+ [bridge]
109
+ );
110
+ }
111
+ function useUploadFile() {
112
+ const bridge = useChatGPTBridge();
113
+ return useCallback((file) => bridge.uploadFile(file), [bridge]);
114
+ }
115
+ function useGetFileDownloadUrl() {
116
+ const bridge = useChatGPTBridge();
117
+ return useCallback(
118
+ (fileId) => bridge.getFileDownloadUrl(fileId),
119
+ [bridge]
120
+ );
121
+ }
122
+ function useRequestClose() {
123
+ const bridge = useChatGPTBridge();
124
+ return useCallback(() => bridge.requestClose(), [bridge]);
125
+ }
126
+ function useRequestModal() {
127
+ const bridge = useChatGPTBridge();
128
+ return useCallback(
129
+ (options) => bridge.requestModal(options),
130
+ [bridge]
131
+ );
132
+ }
133
+ export {
134
+ ChatGPTBridge,
135
+ ChatGPTProvider,
136
+ useCallTool,
137
+ useDisplayMode,
138
+ useGetFileDownloadUrl,
139
+ useHostContext,
140
+ useOpenLink,
141
+ useRequestClose,
142
+ useRequestModal,
143
+ useSendMessage,
144
+ useTheme,
145
+ useToolInput,
146
+ useToolResult,
147
+ useUploadFile,
148
+ useWidgetState
149
+ };
@@ -0,0 +1,37 @@
1
+ import { A as AppCapabilities } from '../../bridge-BOSEqpaS.js';
2
+ export { M as MCPBridge, a as MCPBridgeOptions } from '../../bridge-BOSEqpaS.js';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { ReactNode } from 'react';
5
+ import { HostContext, ToolResult, DisplayMode, ContentBlock } from '../../core/index.js';
6
+ import '@modelcontextprotocol/ext-apps';
7
+
8
+ interface MCPProviderProps {
9
+ children: ReactNode;
10
+ appInfo?: {
11
+ name: string;
12
+ version: string;
13
+ };
14
+ appCapabilities?: AppCapabilities;
15
+ }
16
+ declare function MCPProvider({ children, appInfo, appCapabilities, }: MCPProviderProps): react_jsx_runtime.JSX.Element | null;
17
+ declare function useHostContext(): HostContext | null;
18
+ declare function useTheme(): "light" | "dark";
19
+ declare function useToolInput<T = Record<string, unknown>>(): T | null;
20
+ declare function useToolInputPartial<T = Record<string, unknown>>(): T | null;
21
+ declare function useToolResult(): ToolResult | null;
22
+ declare function useToolCancellation(callback: (reason: string) => void): void;
23
+ declare function useTeardown(callback: () => Promise<void> | void): void;
24
+ declare function useDisplayMode(): [
25
+ DisplayMode,
26
+ (mode: DisplayMode) => Promise<void>
27
+ ];
28
+ declare function useCallTool(): (name: string, args: Record<string, unknown>) => Promise<ToolResult>;
29
+ declare function useOpenLink(): (url: string) => Promise<void>;
30
+ declare function useSendMessage(): (text: string) => Promise<void>;
31
+ declare function useUpdateModelContext(): (ctx: {
32
+ content?: ContentBlock[];
33
+ structuredContent?: Record<string, unknown>;
34
+ }) => Promise<void>;
35
+ declare function useLog(): (level: "debug" | "info" | "warning" | "error", data: string) => void;
36
+
37
+ export { AppCapabilities, MCPProvider, type MCPProviderProps, useCallTool, useDisplayMode, useHostContext, useLog, useOpenLink, useSendMessage, useTeardown, useTheme, useToolCancellation, useToolInput, useToolInputPartial, useToolResult, useUpdateModelContext };