@pancake-apps/web 0.0.0-snapshot-20260125200133

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.
@@ -0,0 +1,253 @@
1
+ /**
2
+ * MCP Apps SDK Type Definitions
3
+ *
4
+ * These types match the MCP Apps specification for Guest UI implementation.
5
+ */
6
+ type JsonRpcId = string | number;
7
+ interface JsonRpcRequest {
8
+ jsonrpc: '2.0';
9
+ id: JsonRpcId;
10
+ method: string;
11
+ params?: unknown;
12
+ }
13
+ interface JsonRpcNotification {
14
+ jsonrpc: '2.0';
15
+ method: string;
16
+ params?: unknown;
17
+ }
18
+ interface JsonRpcSuccessResponse {
19
+ jsonrpc: '2.0';
20
+ id: JsonRpcId;
21
+ result: unknown;
22
+ }
23
+ interface JsonRpcErrorResponse {
24
+ jsonrpc: '2.0';
25
+ id: JsonRpcId;
26
+ error: {
27
+ code: number;
28
+ message: string;
29
+ data?: unknown;
30
+ };
31
+ }
32
+ type JsonRpcResponse = JsonRpcSuccessResponse | JsonRpcErrorResponse;
33
+ type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
34
+ type Theme = 'light' | 'dark';
35
+ type DisplayMode = 'inline' | 'fullscreen' | 'pip';
36
+ type Platform = 'web' | 'desktop' | 'mobile';
37
+ type LogLevel = 'debug' | 'info' | 'warning' | 'error';
38
+ interface SafeAreaInsets {
39
+ top: number;
40
+ right: number;
41
+ bottom: number;
42
+ left: number;
43
+ }
44
+ interface DeviceCapabilities {
45
+ touch?: boolean;
46
+ hover?: boolean;
47
+ }
48
+ type ContainerDimensions = ({
49
+ height: number;
50
+ maxHeight?: never;
51
+ } | {
52
+ height?: never;
53
+ maxHeight?: number;
54
+ }) & ({
55
+ width: number;
56
+ maxWidth?: never;
57
+ } | {
58
+ width?: never;
59
+ maxWidth?: number;
60
+ });
61
+ /** CSS variable keys available to MCP apps for theming. */
62
+ type McpUiStyleVariableKey = '--color-background-primary' | '--color-background-secondary' | '--color-background-tertiary' | '--color-background-inverse' | '--color-background-ghost' | '--color-background-info' | '--color-background-danger' | '--color-background-success' | '--color-background-warning' | '--color-background-disabled' | '--color-text-primary' | '--color-text-secondary' | '--color-text-tertiary' | '--color-text-inverse' | '--color-text-info' | '--color-text-danger' | '--color-text-success' | '--color-text-warning' | '--color-text-disabled' | '--color-text-ghost' | '--color-border-primary' | '--color-border-secondary' | '--color-border-tertiary' | '--color-border-inverse' | '--color-border-ghost' | '--color-border-info' | '--color-border-danger' | '--color-border-success' | '--color-border-warning' | '--color-border-disabled' | '--color-ring-primary' | '--color-ring-secondary' | '--color-ring-inverse' | '--color-ring-info' | '--color-ring-danger' | '--color-ring-success' | '--color-ring-warning' | '--font-sans' | '--font-mono' | '--font-weight-normal' | '--font-weight-medium' | '--font-weight-semibold' | '--font-weight-bold' | '--font-text-xs-size' | '--font-text-sm-size' | '--font-text-md-size' | '--font-text-lg-size' | '--font-heading-xs-size' | '--font-heading-sm-size' | '--font-heading-md-size' | '--font-heading-lg-size' | '--font-heading-xl-size' | '--font-heading-2xl-size' | '--font-heading-3xl-size' | '--font-text-xs-line-height' | '--font-text-sm-line-height' | '--font-text-md-line-height' | '--font-text-lg-line-height' | '--font-heading-xs-line-height' | '--font-heading-sm-line-height' | '--font-heading-md-line-height' | '--font-heading-lg-line-height' | '--font-heading-xl-line-height' | '--font-heading-2xl-line-height' | '--font-heading-3xl-line-height' | '--border-radius-xs' | '--border-radius-sm' | '--border-radius-md' | '--border-radius-lg' | '--border-radius-xl' | '--border-radius-full' | '--border-width-regular' | '--shadow-hairline' | '--shadow-sm' | '--shadow-md' | '--shadow-lg';
63
+ type StyleVariables = Partial<Record<McpUiStyleVariableKey, string>>;
64
+ interface StyleCss {
65
+ fonts?: string;
66
+ }
67
+ interface Styles {
68
+ variables?: StyleVariables;
69
+ css?: StyleCss;
70
+ }
71
+ interface ToolInfo {
72
+ id?: JsonRpcId;
73
+ tool: {
74
+ name: string;
75
+ description?: string;
76
+ inputSchema?: object;
77
+ };
78
+ }
79
+ interface ContentBlock {
80
+ type: string;
81
+ text?: string;
82
+ [key: string]: unknown;
83
+ }
84
+ interface CallToolResult<TOutput = unknown> {
85
+ content: ContentBlock[];
86
+ structuredContent?: TOutput;
87
+ isError?: boolean;
88
+ _meta?: Record<string, unknown>;
89
+ }
90
+ interface ToolsCallParams {
91
+ name: string;
92
+ arguments?: Record<string, unknown>;
93
+ }
94
+ interface HostContext {
95
+ toolInfo?: ToolInfo;
96
+ theme?: Theme;
97
+ styles?: Styles;
98
+ displayMode?: DisplayMode;
99
+ availableDisplayModes?: DisplayMode[];
100
+ containerDimensions?: ContainerDimensions;
101
+ locale?: string;
102
+ timeZone?: string;
103
+ userAgent?: string;
104
+ platform?: Platform;
105
+ deviceCapabilities?: DeviceCapabilities;
106
+ safeAreaInsets?: SafeAreaInsets;
107
+ }
108
+ interface McpUiResourceCsp {
109
+ connectDomains?: string[];
110
+ resourceDomains?: string[];
111
+ frameDomains?: string[];
112
+ baseUriDomains?: string[];
113
+ }
114
+ interface PermissionFields {
115
+ camera?: Record<string, never>;
116
+ microphone?: Record<string, never>;
117
+ geolocation?: Record<string, never>;
118
+ clipboardWrite?: Record<string, never>;
119
+ }
120
+ interface SandboxCapabilities {
121
+ permissions?: PermissionFields;
122
+ csp?: McpUiResourceCsp;
123
+ }
124
+ interface HostCapabilities {
125
+ experimental?: object;
126
+ openLinks?: object;
127
+ serverTools?: {
128
+ listChanged?: boolean;
129
+ };
130
+ serverResources?: {
131
+ listChanged?: boolean;
132
+ };
133
+ logging?: object;
134
+ sandbox?: SandboxCapabilities;
135
+ }
136
+ interface ClientInfo {
137
+ name: string;
138
+ version: string;
139
+ }
140
+ interface HostInfo {
141
+ name: string;
142
+ version: string;
143
+ }
144
+ interface InitializeParams {
145
+ protocolVersion: string;
146
+ capabilities: object;
147
+ clientInfo: ClientInfo;
148
+ }
149
+ interface McpUiInitializeResult {
150
+ protocolVersion: string;
151
+ hostCapabilities: HostCapabilities;
152
+ hostInfo: HostInfo;
153
+ hostContext: HostContext;
154
+ }
155
+ interface InitializeOptions {
156
+ clientInfo?: ClientInfo;
157
+ capabilities?: object;
158
+ }
159
+ interface OpenLinkParams {
160
+ url: string;
161
+ }
162
+ interface UiMessageParams {
163
+ role: 'user';
164
+ content: {
165
+ type: 'text';
166
+ text: string;
167
+ };
168
+ }
169
+ interface RequestDisplayModeParams {
170
+ mode: DisplayMode;
171
+ }
172
+ interface RequestDisplayModeResult {
173
+ mode: DisplayMode;
174
+ }
175
+ interface UpdateModelContextParams {
176
+ content?: ContentBlock[];
177
+ structuredContent?: Record<string, unknown>;
178
+ }
179
+ interface SizeChangedParams {
180
+ width: number;
181
+ height: number;
182
+ }
183
+ interface LogMessageParams {
184
+ level: LogLevel;
185
+ data: unknown;
186
+ logger?: string;
187
+ }
188
+ interface ResourceTeardownParams {
189
+ reason: string;
190
+ }
191
+ interface ResourceReadParams {
192
+ uri: string;
193
+ }
194
+ interface ResourceContent {
195
+ uri: string;
196
+ mimeType: string;
197
+ text?: string;
198
+ blob?: string;
199
+ _meta?: {
200
+ ui?: {
201
+ csp?: McpUiResourceCsp;
202
+ permissions?: PermissionFields;
203
+ domain?: string;
204
+ prefersBorder?: boolean;
205
+ };
206
+ };
207
+ }
208
+ interface ResourceReadResult {
209
+ contents: ResourceContent[];
210
+ }
211
+ interface ToolInputParams {
212
+ arguments: Record<string, unknown>;
213
+ }
214
+ interface ToolInputPartialParams {
215
+ arguments: Record<string, unknown>;
216
+ }
217
+ interface ToolCancelledParams {
218
+ reason: string;
219
+ }
220
+ interface McpStoreState {
221
+ isInitialized: boolean;
222
+ hostContext: HostContext;
223
+ hostCapabilities: HostCapabilities | undefined;
224
+ hostInfo: HostInfo | undefined;
225
+ toolInput: Record<string, unknown> | undefined;
226
+ toolResult: CallToolResult | undefined;
227
+ toolInputPartial: Record<string, unknown> | undefined;
228
+ isCancelled: boolean;
229
+ cancelReason: string | undefined;
230
+ }
231
+ declare const PROTOCOL_VERSION = "2025-11-21";
232
+ declare const DEFAULT_CLIENT_INFO: ClientInfo;
233
+ declare const MCP_METHODS: {
234
+ readonly INITIALIZE: "ui/initialize";
235
+ readonly OPEN_LINK: "ui/open-link";
236
+ readonly MESSAGE: "ui/message";
237
+ readonly REQUEST_DISPLAY_MODE: "ui/request-display-mode";
238
+ readonly UPDATE_MODEL_CONTEXT: "ui/update-model-context";
239
+ readonly TOOLS_CALL: "tools/call";
240
+ readonly RESOURCES_READ: "resources/read";
241
+ readonly PING: "ping";
242
+ readonly INITIALIZED: "ui/notifications/initialized";
243
+ readonly SIZE_CHANGED: "ui/notifications/size-changed";
244
+ readonly LOG_MESSAGE: "notifications/message";
245
+ readonly TOOL_INPUT: "ui/notifications/tool-input";
246
+ readonly TOOL_INPUT_PARTIAL: "ui/notifications/tool-input-partial";
247
+ readonly TOOL_RESULT: "ui/notifications/tool-result";
248
+ readonly TOOL_CANCELLED: "ui/notifications/tool-cancelled";
249
+ readonly HOST_CONTEXT_CHANGED: "ui/notifications/host-context-changed";
250
+ readonly RESOURCE_TEARDOWN: "ui/resource-teardown";
251
+ };
252
+
253
+ export { type ResourceContent as A, type ResourceReadParams as B, type CallToolResult as C, type DisplayMode as D, type SandboxCapabilities as E, type SizeChangedParams as F, type StyleCss as G, type HostContext as H, type InitializeOptions as I, type JsonRpcId as J, type ToolCancelledParams as K, type LogLevel as L, type McpUiInitializeResult as M, type ToolInputParams as N, type OpenLinkParams as O, type Platform as P, type ToolInputPartialParams as Q, type ResourceTeardownParams as R, type StyleVariables as S, type Theme as T, type UpdateModelContextParams as U, type ToolsCallParams as V, type UiMessageParams as W, type JsonRpcRequest as a, type JsonRpcNotification as b, type JsonRpcSuccessResponse as c, type JsonRpcErrorResponse as d, type JsonRpcMessage as e, type ResourceReadResult as f, type HostCapabilities as g, type HostInfo as h, type McpStoreState as i, type ContainerDimensions as j, type SafeAreaInsets as k, type DeviceCapabilities as l, type Styles as m, type ToolInfo as n, type ClientInfo as o, type ContentBlock as p, DEFAULT_CLIENT_INFO as q, type InitializeParams as r, type JsonRpcResponse as s, type LogMessageParams as t, MCP_METHODS as u, type McpUiResourceCsp as v, PROTOCOL_VERSION as w, type PermissionFields as x, type RequestDisplayModeParams as y, type RequestDisplayModeResult as z };
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "@pancake-apps/web",
3
+ "version": "0.0.0-snapshot-20260125200133",
4
+ "description": "Pancake SDK client library for AI tool UIs",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs",
13
+ "types": "./dist/index.d.ts"
14
+ },
15
+ "./react": {
16
+ "import": "./dist/react/index.js",
17
+ "require": "./dist/react/index.cjs",
18
+ "types": "./dist/react/index.d.ts"
19
+ },
20
+ "./core": {
21
+ "import": "./dist/core/index.js",
22
+ "types": "./dist/core/index.d.ts"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "scripts": {
29
+ "build": "tsup",
30
+ "dev": "tsup --watch",
31
+ "test": "vitest run",
32
+ "test:watch": "vitest",
33
+ "typecheck": "tsc --noEmit",
34
+ "clean": "rm -rf dist",
35
+ "visual-test": "vite --config visualTest/vite.config.ts"
36
+ },
37
+ "dependencies": {
38
+ "@modelcontextprotocol/ext-apps": "^0.1.0"
39
+ },
40
+ "devDependencies": {
41
+ "@testing-library/react": "^16.0.0",
42
+ "@types/react": "^19.0.0",
43
+ "@types/react-dom": "^19.0.0",
44
+ "@vitejs/plugin-react": "^4.7.0",
45
+ "jsdom": "^25.0.0",
46
+ "react": "^19.0.0",
47
+ "react-dom": "^19.0.0",
48
+ "tsup": "^8.0.0",
49
+ "typescript": "^5.9.0",
50
+ "vite": "^5.4.21",
51
+ "vitest": "^4.0.0"
52
+ },
53
+ "peerDependencies": {
54
+ "react": "^18.0.0 || ^19.0.0",
55
+ "react-dom": "^18.0.0 || ^19.0.0"
56
+ },
57
+ "peerDependenciesMeta": {
58
+ "react": {
59
+ "optional": true
60
+ },
61
+ "react-dom": {
62
+ "optional": true
63
+ }
64
+ },
65
+ "engines": {
66
+ "node": ">=18.0.0"
67
+ },
68
+ "keywords": [
69
+ "mcp",
70
+ "ai",
71
+ "tools",
72
+ "openai",
73
+ "chatgpt",
74
+ "claude",
75
+ "react"
76
+ ],
77
+ "license": "MIT",
78
+ "homepage": "https://github.com/pancakeapps/pancake/tree/main/packages/web",
79
+ "repository": {
80
+ "type": "git",
81
+ "url": "git+https://github.com/pancakeapps/pancake.git",
82
+ "directory": "packages/web"
83
+ },
84
+ "bugs": {
85
+ "url": "https://github.com/pancakeapps/pancake/issues"
86
+ },
87
+ "publishConfig": {
88
+ "access": "public"
89
+ }
90
+ }