@pancake-apps/web 0.0.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/dist/index.cjs +929 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +479 -0
- package/dist/index.d.ts +479 -0
- package/dist/index.js +919 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.cjs +1067 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +536 -0
- package/dist/react/index.d.ts +536 -0
- package/dist/react/index.js +1053 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +83 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host context provided by MCP or OpenAI hosts
|
|
3
|
+
*/
|
|
4
|
+
interface HostContext {
|
|
5
|
+
/** Current theme */
|
|
6
|
+
theme: 'light' | 'dark';
|
|
7
|
+
/** Current display mode */
|
|
8
|
+
displayMode: 'inline' | 'fullscreen' | 'pip';
|
|
9
|
+
/** Available display modes */
|
|
10
|
+
availableDisplayModes: string[];
|
|
11
|
+
/** Viewport dimensions */
|
|
12
|
+
viewport: {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
/** User's locale (e.g., 'en-US') */
|
|
17
|
+
locale: string;
|
|
18
|
+
/** User's timezone */
|
|
19
|
+
timeZone: string;
|
|
20
|
+
/** Platform type */
|
|
21
|
+
platform: 'desktop' | 'mobile' | 'web';
|
|
22
|
+
/** Current view identifier (if applicable) */
|
|
23
|
+
view?: string;
|
|
24
|
+
/** Safe area insets for mobile */
|
|
25
|
+
safeAreaInsets?: {
|
|
26
|
+
top: number;
|
|
27
|
+
right: number;
|
|
28
|
+
bottom: number;
|
|
29
|
+
left: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* View parameters passed to the UI
|
|
34
|
+
*/
|
|
35
|
+
interface ViewParams<TInputs = unknown, TData = unknown> {
|
|
36
|
+
/** Input parameters passed to the view */
|
|
37
|
+
inputs: TInputs;
|
|
38
|
+
/** Data returned by the view handler */
|
|
39
|
+
data: TData;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Global Pancake API available on window.pancake
|
|
43
|
+
*/
|
|
44
|
+
interface PancakeGlobal {
|
|
45
|
+
/** Host context (theme, display mode, etc.) */
|
|
46
|
+
readonly hostContext: HostContext;
|
|
47
|
+
/** Current view parameters */
|
|
48
|
+
readonly viewParams: ViewParams;
|
|
49
|
+
/** Current view state */
|
|
50
|
+
readonly viewState: unknown;
|
|
51
|
+
/**
|
|
52
|
+
* Navigate to a different view.
|
|
53
|
+
* This triggers a tool call on the model side.
|
|
54
|
+
*/
|
|
55
|
+
navigateToView(viewName: string, viewParams?: Record<string, unknown>): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Send a message to the model.
|
|
58
|
+
*/
|
|
59
|
+
say(message: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Set the view state.
|
|
62
|
+
* State is persisted in ChatGPT, volatile in MCP.
|
|
63
|
+
*/
|
|
64
|
+
setViewState(state: unknown): void;
|
|
65
|
+
/**
|
|
66
|
+
* Dispatch an action (write operation).
|
|
67
|
+
* This calls the action tool on the server.
|
|
68
|
+
*/
|
|
69
|
+
dispatch<T = unknown>(actionName: string, actionParams?: Record<string, unknown>): Promise<T>;
|
|
70
|
+
/**
|
|
71
|
+
* Get data from a data fetcher (read operation).
|
|
72
|
+
* This calls the data tool on the server.
|
|
73
|
+
*/
|
|
74
|
+
getData<T = unknown>(dataName: string, dataParams?: Record<string, unknown>): Promise<T>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Protocol types
|
|
78
|
+
*/
|
|
79
|
+
type Protocol = 'mcp' | 'openai' | 'mock';
|
|
80
|
+
/**
|
|
81
|
+
* Default host context
|
|
82
|
+
*/
|
|
83
|
+
declare const DEFAULT_HOST_CONTEXT: HostContext;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Protocol adapter interface.
|
|
87
|
+
* Abstracts communication with the host (MCP or OpenAI).
|
|
88
|
+
*/
|
|
89
|
+
interface ProtocolAdapter {
|
|
90
|
+
/** Protocol name */
|
|
91
|
+
readonly protocol: 'mcp' | 'openai' | 'mock';
|
|
92
|
+
/** Whether the adapter is connected */
|
|
93
|
+
isConnected(): boolean;
|
|
94
|
+
/** Connect to the host */
|
|
95
|
+
connect(): Promise<void>;
|
|
96
|
+
/** Disconnect from the host */
|
|
97
|
+
disconnect(): Promise<void>;
|
|
98
|
+
/** Get the current host context */
|
|
99
|
+
getHostContext(): HostContext;
|
|
100
|
+
/** Subscribe to host context changes */
|
|
101
|
+
onHostContextChange(handler: (ctx: HostContext) => void): () => void;
|
|
102
|
+
/** Get the current view parameters (inputs + data) */
|
|
103
|
+
getViewParams(): ViewParams;
|
|
104
|
+
/** Get the current tool input (what the model sent) */
|
|
105
|
+
getToolInput(): Record<string, unknown> | undefined;
|
|
106
|
+
/** Get the current tool output (what the handler returned) */
|
|
107
|
+
getToolOutput(): Record<string, unknown> | undefined;
|
|
108
|
+
/** Subscribe to tool input changes */
|
|
109
|
+
onToolInput(handler: (input: unknown) => void): () => void;
|
|
110
|
+
/** Subscribe to tool output changes */
|
|
111
|
+
onToolOutput(handler: (output: unknown) => void): () => void;
|
|
112
|
+
/** Call a tool on the server */
|
|
113
|
+
callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
114
|
+
/** Send a message to the model */
|
|
115
|
+
sendMessage(content: {
|
|
116
|
+
type: string;
|
|
117
|
+
text: string;
|
|
118
|
+
}): Promise<void>;
|
|
119
|
+
/** Open a link in the host */
|
|
120
|
+
openLink(url: string): Promise<void>;
|
|
121
|
+
/** Request a display mode change */
|
|
122
|
+
requestDisplayMode(mode: 'inline' | 'fullscreen' | 'pip'): Promise<{
|
|
123
|
+
mode: string;
|
|
124
|
+
}>;
|
|
125
|
+
/** Request to close the UI */
|
|
126
|
+
requestClose(): void;
|
|
127
|
+
/** Get the current view state */
|
|
128
|
+
getState<T>(): T | null;
|
|
129
|
+
/** Set the view state */
|
|
130
|
+
setState<T>(state: T): void;
|
|
131
|
+
/** Subscribe to tool cancellation */
|
|
132
|
+
onToolCancelled(handler: (reason?: string) => void): () => void;
|
|
133
|
+
/** Subscribe to teardown */
|
|
134
|
+
onTeardown(handler: (reason?: string) => void): () => void;
|
|
135
|
+
/** Log a message */
|
|
136
|
+
log(level: 'debug' | 'info' | 'warn' | 'error', data: unknown): void;
|
|
137
|
+
/** Notify the host of a size change */
|
|
138
|
+
sendSizeChanged(params: {
|
|
139
|
+
width: number;
|
|
140
|
+
height: number;
|
|
141
|
+
}): Promise<void>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Options for creating a Pancake client
|
|
146
|
+
*/
|
|
147
|
+
interface PancakeClientOptions {
|
|
148
|
+
/** Force a specific protocol adapter */
|
|
149
|
+
forceAdapter?: Protocol;
|
|
150
|
+
/** Enable auto-resize (default: true) */
|
|
151
|
+
autoResize?: boolean;
|
|
152
|
+
/** Initial tool input (for mock adapter) */
|
|
153
|
+
toolInput?: Record<string, unknown>;
|
|
154
|
+
/** Initial tool output (for mock adapter) */
|
|
155
|
+
toolOutput?: Record<string, unknown>;
|
|
156
|
+
/** Initial host context (for mock adapter) */
|
|
157
|
+
hostContext?: Partial<HostContext>;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Pancake client that wraps a protocol adapter.
|
|
161
|
+
*/
|
|
162
|
+
declare class PancakeClient {
|
|
163
|
+
private adapter;
|
|
164
|
+
private constructor();
|
|
165
|
+
/**
|
|
166
|
+
* Create and connect a Pancake client.
|
|
167
|
+
*/
|
|
168
|
+
static create(options?: PancakeClientOptions): Promise<PancakeClient>;
|
|
169
|
+
/**
|
|
170
|
+
* Create a Pancake client with a pre-configured adapter.
|
|
171
|
+
*/
|
|
172
|
+
static fromAdapter(adapter: ProtocolAdapter): PancakeClient;
|
|
173
|
+
/**
|
|
174
|
+
* Get the underlying protocol adapter.
|
|
175
|
+
*/
|
|
176
|
+
getAdapter(): ProtocolAdapter;
|
|
177
|
+
/**
|
|
178
|
+
* Get the current protocol.
|
|
179
|
+
*/
|
|
180
|
+
get protocol(): Protocol;
|
|
181
|
+
/**
|
|
182
|
+
* Check if the client is connected.
|
|
183
|
+
*/
|
|
184
|
+
isConnected(): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Get the current host context.
|
|
187
|
+
*/
|
|
188
|
+
getHostContext(): HostContext;
|
|
189
|
+
/**
|
|
190
|
+
* Subscribe to host context changes.
|
|
191
|
+
*/
|
|
192
|
+
onHostContextChange(handler: (ctx: HostContext) => void): () => void;
|
|
193
|
+
/**
|
|
194
|
+
* Get the current view parameters.
|
|
195
|
+
*/
|
|
196
|
+
getViewParams(): ViewParams;
|
|
197
|
+
/**
|
|
198
|
+
* Get the current tool input.
|
|
199
|
+
*/
|
|
200
|
+
getToolInput(): Record<string, unknown> | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Get the current tool output.
|
|
203
|
+
*/
|
|
204
|
+
getToolOutput(): Record<string, unknown> | undefined;
|
|
205
|
+
/**
|
|
206
|
+
* Subscribe to tool input changes.
|
|
207
|
+
*/
|
|
208
|
+
onToolInput(handler: (input: unknown) => void): () => void;
|
|
209
|
+
/**
|
|
210
|
+
* Subscribe to tool output changes.
|
|
211
|
+
*/
|
|
212
|
+
onToolOutput(handler: (output: unknown) => void): () => void;
|
|
213
|
+
/**
|
|
214
|
+
* Call a tool on the server.
|
|
215
|
+
*/
|
|
216
|
+
callTool<T = unknown>(name: string, args?: Record<string, unknown>): Promise<T>;
|
|
217
|
+
/**
|
|
218
|
+
* Navigate to a view (calls view:name tool).
|
|
219
|
+
*/
|
|
220
|
+
navigateToView(viewName: string, params?: Record<string, unknown>): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* Dispatch an action (calls action:name tool).
|
|
223
|
+
*/
|
|
224
|
+
dispatch<T = unknown>(actionName: string, params?: Record<string, unknown>): Promise<T>;
|
|
225
|
+
/**
|
|
226
|
+
* Get data from a data fetcher (calls data:name tool).
|
|
227
|
+
*/
|
|
228
|
+
getData<T = unknown>(dataName: string, params?: Record<string, unknown>): Promise<T>;
|
|
229
|
+
/**
|
|
230
|
+
* Send a message to the model.
|
|
231
|
+
*/
|
|
232
|
+
say(message: string): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Open a link in the host.
|
|
235
|
+
*/
|
|
236
|
+
openLink(url: string): Promise<void>;
|
|
237
|
+
/**
|
|
238
|
+
* Request a display mode change.
|
|
239
|
+
*/
|
|
240
|
+
requestDisplayMode(mode: 'inline' | 'fullscreen' | 'pip'): Promise<{
|
|
241
|
+
mode: string;
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* Request to close the UI.
|
|
245
|
+
*/
|
|
246
|
+
requestClose(): void;
|
|
247
|
+
/**
|
|
248
|
+
* Get the current view state.
|
|
249
|
+
*/
|
|
250
|
+
getState<T>(): T | null;
|
|
251
|
+
/**
|
|
252
|
+
* Set the view state.
|
|
253
|
+
*/
|
|
254
|
+
setState<T>(state: T): void;
|
|
255
|
+
/**
|
|
256
|
+
* Subscribe to tool cancellation.
|
|
257
|
+
*/
|
|
258
|
+
onToolCancelled(handler: (reason?: string) => void): () => void;
|
|
259
|
+
/**
|
|
260
|
+
* Subscribe to teardown.
|
|
261
|
+
*/
|
|
262
|
+
onTeardown(handler: (reason?: string) => void): () => void;
|
|
263
|
+
/**
|
|
264
|
+
* Log a message.
|
|
265
|
+
*/
|
|
266
|
+
log(level: 'debug' | 'info' | 'warn' | 'error', data: unknown): void;
|
|
267
|
+
/**
|
|
268
|
+
* Notify the host of a size change.
|
|
269
|
+
*/
|
|
270
|
+
sendSizeChanged(params: {
|
|
271
|
+
width: number;
|
|
272
|
+
height: number;
|
|
273
|
+
}): Promise<void>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Get or create the global Pancake client.
|
|
278
|
+
*/
|
|
279
|
+
declare function getClient(): Promise<PancakeClient>;
|
|
280
|
+
/**
|
|
281
|
+
* Initialize the global window.pancake API.
|
|
282
|
+
*/
|
|
283
|
+
declare function initializePancake(): Promise<PancakeGlobal>;
|
|
284
|
+
/**
|
|
285
|
+
* Get the current global API (for synchronous access after initialization).
|
|
286
|
+
*/
|
|
287
|
+
declare function getPancake(): PancakeGlobal | undefined;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Detect which protocol/host environment the UI is running in.
|
|
291
|
+
*/
|
|
292
|
+
declare function detectProtocol(): Protocol;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* MCP protocol adapter.
|
|
296
|
+
* Uses @modelcontextprotocol/ext-apps for communication with MCP hosts.
|
|
297
|
+
*/
|
|
298
|
+
declare class McpAdapter implements ProtocolAdapter {
|
|
299
|
+
private options?;
|
|
300
|
+
readonly protocol: "mcp";
|
|
301
|
+
private app;
|
|
302
|
+
private connected;
|
|
303
|
+
private context;
|
|
304
|
+
private currentToolInput;
|
|
305
|
+
private currentToolOutput;
|
|
306
|
+
private state;
|
|
307
|
+
private hostContextHandlers;
|
|
308
|
+
private toolInputHandlers;
|
|
309
|
+
private toolOutputHandlers;
|
|
310
|
+
private toolCancelledHandlers;
|
|
311
|
+
private teardownHandlers;
|
|
312
|
+
constructor(options?: {
|
|
313
|
+
autoResize?: boolean;
|
|
314
|
+
} | undefined);
|
|
315
|
+
isConnected(): boolean;
|
|
316
|
+
connect(): Promise<void>;
|
|
317
|
+
disconnect(): Promise<void>;
|
|
318
|
+
private mapHostContext;
|
|
319
|
+
getHostContext(): HostContext;
|
|
320
|
+
onHostContextChange(handler: (ctx: HostContext) => void): () => void;
|
|
321
|
+
getViewParams(): ViewParams;
|
|
322
|
+
getToolInput(): Record<string, unknown> | undefined;
|
|
323
|
+
getToolOutput(): Record<string, unknown> | undefined;
|
|
324
|
+
onToolInput(handler: (input: unknown) => void): () => void;
|
|
325
|
+
onToolOutput(handler: (output: unknown) => void): () => void;
|
|
326
|
+
callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
327
|
+
sendMessage(content: {
|
|
328
|
+
type: string;
|
|
329
|
+
text: string;
|
|
330
|
+
}): Promise<void>;
|
|
331
|
+
openLink(url: string): Promise<void>;
|
|
332
|
+
requestDisplayMode(mode: 'inline' | 'fullscreen' | 'pip'): Promise<{
|
|
333
|
+
mode: string;
|
|
334
|
+
}>;
|
|
335
|
+
requestClose(): void;
|
|
336
|
+
getState<T>(): T | null;
|
|
337
|
+
setState<T>(state: T): void;
|
|
338
|
+
onToolCancelled(handler: (reason?: string) => void): () => void;
|
|
339
|
+
onTeardown(handler: (reason?: string) => void): () => void;
|
|
340
|
+
log(level: 'debug' | 'info' | 'warn' | 'error', data: unknown): void;
|
|
341
|
+
sendSizeChanged(params: {
|
|
342
|
+
width: number;
|
|
343
|
+
height: number;
|
|
344
|
+
}): Promise<void>;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* OpenAI/ChatGPT protocol adapter.
|
|
349
|
+
* Uses window.openai SDK injected by the ChatGPT sandbox.
|
|
350
|
+
*/
|
|
351
|
+
declare class OpenAIAdapter implements ProtocolAdapter {
|
|
352
|
+
readonly protocol: "openai";
|
|
353
|
+
private connected;
|
|
354
|
+
private context;
|
|
355
|
+
private currentToolInput;
|
|
356
|
+
private currentToolOutput;
|
|
357
|
+
private state;
|
|
358
|
+
private hostContextHandlers;
|
|
359
|
+
private toolInputHandlers;
|
|
360
|
+
private toolOutputHandlers;
|
|
361
|
+
private toolCancelledHandlers;
|
|
362
|
+
private teardownHandlers;
|
|
363
|
+
private globalsHandler;
|
|
364
|
+
private setGlobalsHandler;
|
|
365
|
+
isConnected(): boolean;
|
|
366
|
+
private getOpenAI;
|
|
367
|
+
connect(): Promise<void>;
|
|
368
|
+
disconnect(): Promise<void>;
|
|
369
|
+
private waitForOpenAI;
|
|
370
|
+
private isSetGlobalsMessage;
|
|
371
|
+
private setupGlobalsListener;
|
|
372
|
+
private updateContextFromGlobals;
|
|
373
|
+
private readContextFromSDK;
|
|
374
|
+
private readToolDataFromSDK;
|
|
375
|
+
getHostContext(): HostContext;
|
|
376
|
+
onHostContextChange(handler: (ctx: HostContext) => void): () => void;
|
|
377
|
+
getViewParams(): ViewParams;
|
|
378
|
+
getToolInput(): Record<string, unknown> | undefined;
|
|
379
|
+
getToolOutput(): Record<string, unknown> | undefined;
|
|
380
|
+
onToolInput(handler: (input: unknown) => void): () => void;
|
|
381
|
+
onToolOutput(handler: (output: unknown) => void): () => void;
|
|
382
|
+
callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
383
|
+
sendMessage(content: {
|
|
384
|
+
type: string;
|
|
385
|
+
text: string;
|
|
386
|
+
}): Promise<void>;
|
|
387
|
+
openLink(url: string): Promise<void>;
|
|
388
|
+
requestDisplayMode(mode: 'inline' | 'fullscreen' | 'pip'): Promise<{
|
|
389
|
+
mode: string;
|
|
390
|
+
}>;
|
|
391
|
+
requestClose(): void;
|
|
392
|
+
getState<T>(): T | null;
|
|
393
|
+
setState<T>(state: T): void;
|
|
394
|
+
onToolCancelled(handler: (reason?: string) => void): () => void;
|
|
395
|
+
onTeardown(handler: (reason?: string) => void): () => void;
|
|
396
|
+
log(level: 'debug' | 'info' | 'warn' | 'error', data: unknown): void;
|
|
397
|
+
sendSizeChanged(params: {
|
|
398
|
+
width: number;
|
|
399
|
+
height: number;
|
|
400
|
+
}): Promise<void>;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Mock protocol adapter for testing and development.
|
|
405
|
+
*/
|
|
406
|
+
declare class MockAdapter implements ProtocolAdapter {
|
|
407
|
+
readonly protocol: "mock";
|
|
408
|
+
private connected;
|
|
409
|
+
private context;
|
|
410
|
+
private toolInput;
|
|
411
|
+
private toolOutput;
|
|
412
|
+
private state;
|
|
413
|
+
private hostContextHandlers;
|
|
414
|
+
private toolInputHandlers;
|
|
415
|
+
private toolOutputHandlers;
|
|
416
|
+
private toolCancelledHandlers;
|
|
417
|
+
private teardownHandlers;
|
|
418
|
+
private toolHandlers;
|
|
419
|
+
constructor(options?: {
|
|
420
|
+
hostContext?: Partial<HostContext>;
|
|
421
|
+
toolInput?: Record<string, unknown>;
|
|
422
|
+
toolOutput?: Record<string, unknown>;
|
|
423
|
+
});
|
|
424
|
+
isConnected(): boolean;
|
|
425
|
+
connect(): Promise<void>;
|
|
426
|
+
disconnect(): Promise<void>;
|
|
427
|
+
/**
|
|
428
|
+
* Set the host context (for testing)
|
|
429
|
+
*/
|
|
430
|
+
setHostContext(ctx: Partial<HostContext>): void;
|
|
431
|
+
/**
|
|
432
|
+
* Set the tool input (for testing)
|
|
433
|
+
*/
|
|
434
|
+
setToolInput(input: Record<string, unknown>): void;
|
|
435
|
+
/**
|
|
436
|
+
* Set the tool output (for testing)
|
|
437
|
+
*/
|
|
438
|
+
setToolOutput(output: Record<string, unknown>): void;
|
|
439
|
+
/**
|
|
440
|
+
* Register a tool handler (for testing)
|
|
441
|
+
*/
|
|
442
|
+
registerToolHandler(name: string, handler: (args: Record<string, unknown>) => Promise<unknown>): void;
|
|
443
|
+
/**
|
|
444
|
+
* Trigger tool cancellation (for testing)
|
|
445
|
+
*/
|
|
446
|
+
triggerToolCancelled(reason?: string): void;
|
|
447
|
+
/**
|
|
448
|
+
* Trigger teardown (for testing)
|
|
449
|
+
*/
|
|
450
|
+
triggerTeardown(reason?: string): void;
|
|
451
|
+
getHostContext(): HostContext;
|
|
452
|
+
onHostContextChange(handler: (ctx: HostContext) => void): () => void;
|
|
453
|
+
getViewParams(): ViewParams;
|
|
454
|
+
getToolInput(): Record<string, unknown> | undefined;
|
|
455
|
+
getToolOutput(): Record<string, unknown> | undefined;
|
|
456
|
+
onToolInput(handler: (input: unknown) => void): () => void;
|
|
457
|
+
onToolOutput(handler: (output: unknown) => void): () => void;
|
|
458
|
+
callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
459
|
+
sendMessage(content: {
|
|
460
|
+
type: string;
|
|
461
|
+
text: string;
|
|
462
|
+
}): Promise<void>;
|
|
463
|
+
openLink(url: string): Promise<void>;
|
|
464
|
+
requestDisplayMode(mode: 'inline' | 'fullscreen' | 'pip'): Promise<{
|
|
465
|
+
mode: string;
|
|
466
|
+
}>;
|
|
467
|
+
requestClose(): void;
|
|
468
|
+
getState<T>(): T | null;
|
|
469
|
+
setState<T>(state: T): void;
|
|
470
|
+
onToolCancelled(handler: (reason?: string) => void): () => void;
|
|
471
|
+
onTeardown(handler: (reason?: string) => void): () => void;
|
|
472
|
+
log(level: 'debug' | 'info' | 'warn' | 'error', data: unknown): void;
|
|
473
|
+
sendSizeChanged(params: {
|
|
474
|
+
width: number;
|
|
475
|
+
height: number;
|
|
476
|
+
}): Promise<void>;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export { DEFAULT_HOST_CONTEXT, type HostContext, McpAdapter, MockAdapter, OpenAIAdapter, PancakeClient, type PancakeClientOptions, type PancakeGlobal, type Protocol, type ProtocolAdapter, type ViewParams, detectProtocol, getClient, getPancake, initializePancake };
|