sunpeak 0.19.2 → 0.19.10
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 +6 -4
- package/bin/commands/dev.mjs +1 -1
- package/bin/commands/inspect.mjs +1 -1
- package/bin/commands/new.mjs +9 -5
- package/bin/commands/start.mjs +3 -1
- package/bin/commands/test-init.mjs +478 -76
- package/bin/commands/test.mjs +357 -4
- package/bin/lib/eval/eval-reporter.mjs +105 -0
- package/bin/lib/eval/eval-runner.mjs +310 -0
- package/bin/lib/eval/eval-types.d.mts +168 -0
- package/bin/lib/eval/eval-vitest-plugin.mjs +158 -0
- package/bin/lib/eval/model-registry.mjs +73 -0
- package/bin/lib/sandbox-server.mjs +5 -2
- package/bin/sunpeak.js +1 -0
- package/dist/chatgpt/index.cjs +1 -1
- package/dist/chatgpt/index.js +1 -1
- package/dist/claude/index.cjs +1 -1
- package/dist/claude/index.js +1 -1
- package/dist/host/chatgpt/index.cjs +1 -1
- package/dist/host/chatgpt/index.js +1 -1
- package/dist/index.cjs +134 -124
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +71 -62
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.cjs +1 -1
- package/dist/inspector/index.js +1 -1
- package/dist/{inspector-Cdo5BK2D.js → inspector-D5DckQuU.js} +236 -98
- package/dist/inspector-D5DckQuU.js.map +1 -0
- package/dist/{inspector-8nPV2A-z.cjs → inspector-jY9O18z9.cjs} +237 -99
- package/dist/inspector-jY9O18z9.cjs.map +1 -0
- package/dist/mcp/index.cjs +237 -140
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +230 -134
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/production-server.d.ts +31 -0
- package/dist/{protocol-C7kTcBr_.cjs → protocol-C8pFDmcy.cjs} +8194 -8187
- package/dist/protocol-C8pFDmcy.cjs.map +1 -0
- package/dist/{protocol-BfAACnv0.js → protocol-CRqiPTLT.js} +8186 -8185
- package/dist/protocol-CRqiPTLT.js.map +1 -0
- package/dist/{use-app-CfP9VypY.js → use-app-Bfargfa3.js} +194 -94
- package/dist/use-app-Bfargfa3.js.map +1 -0
- package/dist/{use-app-CzcYw1Kz.cjs → use-app-CbsBEmwv.cjs} +254 -148
- package/dist/use-app-CbsBEmwv.cjs.map +1 -0
- package/package.json +27 -3
- package/template/README.md +17 -7
- package/template/_gitignore +2 -0
- package/template/dist/albums/albums.html +15 -15
- package/template/dist/albums/albums.json +1 -1
- package/template/dist/carousel/carousel.html +19 -19
- package/template/dist/carousel/carousel.json +1 -1
- package/template/dist/map/map.html +14 -14
- package/template/dist/map/map.json +1 -1
- package/template/dist/review/review.html +11 -11
- package/template/dist/review/review.json +1 -1
- package/template/node_modules/.bin/vitest +2 -2
- package/template/node_modules/.vite/deps/_metadata.json +3 -3
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +192 -91
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +231 -92
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +208 -105
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/_metadata.json +25 -25
- package/template/node_modules/.vite-mcp/deps/{protocol-B_qKkui_.js → protocol-BqGB4zBx.js} +45 -45
- package/template/node_modules/.vite-mcp/deps/protocol-BqGB4zBx.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/vitest.js +7 -7
- package/template/node_modules/.vite-mcp/deps/vitest.js.map +1 -1
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-chatgpt-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-claude-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-chatgpt-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-claude-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-chatgpt-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-claude-darwin.png +0 -0
- package/template/tests/evals/.env.example +5 -0
- package/template/tests/evals/albums.eval.ts +28 -0
- package/template/tests/evals/carousel.eval.ts +26 -0
- package/template/tests/evals/eval.config.ts +26 -0
- package/template/tests/evals/map.eval.ts +23 -0
- package/template/tests/evals/review.eval.ts +48 -0
- package/dist/inspector-8nPV2A-z.cjs.map +0 -1
- package/dist/inspector-Cdo5BK2D.js.map +0 -1
- package/dist/protocol-BfAACnv0.js.map +0 -1
- package/dist/protocol-C7kTcBr_.cjs.map +0 -1
- package/dist/use-app-CfP9VypY.js.map +0 -1
- package/dist/use-app-CzcYw1Kz.cjs.map +0 -1
- package/template/node_modules/.vite-mcp/deps/protocol-B_qKkui_.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { App, PostMessageTransport, RESOURCE_MIME_TYPE, RESOURCE_URI_META_KEY, LATEST_PROTOCOL_VERSION, applyHostStyleVariables, applyHostFonts, applyDocumentTheme, getDocumentTheme, } from '@modelcontextprotocol/ext-apps';
|
|
2
2
|
export { INITIALIZE_METHOD, INITIALIZED_METHOD, OPEN_LINK_METHOD, MESSAGE_METHOD, REQUEST_DISPLAY_MODE_METHOD, REQUEST_TEARDOWN_METHOD, RESOURCE_TEARDOWN_METHOD, SIZE_CHANGED_METHOD, TOOL_INPUT_METHOD, TOOL_INPUT_PARTIAL_METHOD, TOOL_RESULT_METHOD, TOOL_CANCELLED_METHOD, HOST_CONTEXT_CHANGED_METHOD, DOWNLOAD_FILE_METHOD, } from '@modelcontextprotocol/ext-apps';
|
|
3
3
|
export { McpUiThemeSchema, McpUiDisplayModeSchema, McpUiHostContextSchema, McpUiHostCapabilitiesSchema, McpUiAppCapabilitiesSchema, McpUiHostCssSchema, McpUiHostStylesSchema, McpUiInitializeRequestSchema, McpUiInitializeResultSchema, McpUiInitializedNotificationSchema, McpUiToolInputNotificationSchema, McpUiToolInputPartialNotificationSchema, McpUiToolResultNotificationSchema, McpUiToolCancelledNotificationSchema, McpUiHostContextChangedNotificationSchema, McpUiSizeChangedNotificationSchema, McpUiOpenLinkRequestSchema, McpUiOpenLinkResultSchema, McpUiMessageRequestSchema, McpUiMessageResultSchema, McpUiUpdateModelContextRequestSchema, McpUiRequestDisplayModeRequestSchema, McpUiRequestDisplayModeResultSchema, McpUiRequestTeardownNotificationSchema, McpUiResourceTeardownRequestSchema, McpUiResourceTeardownResultSchema, McpUiResourceCspSchema, McpUiResourcePermissionsSchema, McpUiResourceMetaSchema, McpUiToolVisibilitySchema, McpUiToolMetaSchema, McpUiSupportedContentBlockModalitiesSchema, McpUiDownloadFileRequestSchema, McpUiDownloadFileResultSchema, } from '@modelcontextprotocol/ext-apps';
|
|
4
|
-
export type { McpUiInitializeRequest, McpUiInitializeResult, McpUiOpenLinkRequest, McpUiOpenLinkResult, McpUiMessageRequest, McpUiMessageResult, McpUiUpdateModelContextRequest, McpUiRequestDisplayModeRequest, McpUiRequestDisplayModeResult, McpUiResourceTeardownRequest, McpUiResourceTeardownResult, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiToolCancelledNotification, McpUiHostContextChangedNotification, McpUiInitializedNotification, McpUiSizeChangedNotification, McpUiRequestTeardownNotification, McpUiDownloadFileRequest, McpUiDownloadFileResult, AppRequest, AppNotification, AppResult, } from '@modelcontextprotocol/ext-apps';
|
|
4
|
+
export type { McpUiInitializeRequest, McpUiInitializeResult, McpUiOpenLinkRequest, McpUiOpenLinkResult, McpUiMessageRequest, McpUiMessageResult, McpUiUpdateModelContextRequest, McpUiRequestDisplayModeRequest, McpUiRequestDisplayModeResult, McpUiResourceTeardownRequest, McpUiResourceTeardownResult, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiToolCancelledNotification, McpUiHostContextChangedNotification, McpUiInitializedNotification, McpUiSizeChangedNotification, McpUiRequestTeardownNotification, McpUiDownloadFileRequest, McpUiDownloadFileResult, AppRequest, AppNotification, AppResult, AppEventMap, } from '@modelcontextprotocol/ext-apps';
|
|
5
|
+
export { ProtocolWithEvents } from '@modelcontextprotocol/ext-apps';
|
|
6
|
+
export type { AppBridgeEventMap } from '@modelcontextprotocol/ext-apps/app-bridge';
|
|
5
7
|
export * from './hooks';
|
|
6
8
|
export * from './types';
|
|
7
9
|
export * from './lib';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as
|
|
3
|
-
import { S as DEFAULT_STYLE_VARIABLES } from "./inspector-
|
|
1
|
+
import { C as EmbeddedResourceSchema, D as ImplementationSchema, J as RequestIdSchema, Y as ResourceLinkSchema, _ as ContentBlockSchema, ct as array, dt as number, et as ToolSchema, ft as object, gt as unknown, h as CallToolResultSchema, ht as union, lt as boolean, mt as string, pt as record, st as _undefined, ut as literal } from "./protocol-CRqiPTLT.js";
|
|
2
|
+
import { $ as u, A as W, B as h, C as P, D as T, E as S, F as c, G as n, H as jQ, I as d, J as q, K as o, L as e, M as _, N as _Q, O as TQ, P as a, Q as t, R as g, S as OQ, T as R, U as k, V as j, W as l, X as r, Y as qQ, Z as s, _ as M, a as B, at as z, b as NQ, c as E, d as FQ, et as v, f as GQ, g as LQ, h as K, i as AQ, it as y, j as WQ, k as U, l as EQ, m as I, n as AppProvider, nt as wQ, o as BQ, ot as zQ, p as H, q as p, r as A, rt as x, s as CX, t as useApp, tt as w, u as F, v as MX, w as PQ, x as O, y as N, z as gQ } from "./use-app-Bfargfa3.js";
|
|
3
|
+
import { S as DEFAULT_STYLE_VARIABLES } from "./inspector-D5DckQuU.js";
|
|
4
4
|
import { detectHost, isChatGPT, isClaude } from "./host/index.js";
|
|
5
5
|
import { t as inspector_exports } from "./inspector/index.js";
|
|
6
6
|
import { t as chatgpt_exports } from "./chatgpt/index.js";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.
|
|
11
|
-
var
|
|
10
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.5.0_@modelcontextprotocol+sdk@1.29.0_zod@4.3.6__react-_f4871531d9cf52c692eb6edc1ee416ef/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.js
|
|
11
|
+
var m = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), N$1 = union([
|
|
12
12
|
literal("inline"),
|
|
13
13
|
literal("fullscreen"),
|
|
14
14
|
literal("pip")
|
|
15
|
-
]).describe("Display mode for UI presentation."),
|
|
15
|
+
]).describe("Display mode for UI presentation."), IJ = record(union([
|
|
16
16
|
literal("--color-background-primary"),
|
|
17
17
|
literal("--color-background-secondary"),
|
|
18
18
|
literal("--color-background-tertiary"),
|
|
@@ -119,7 +119,7 @@ object({
|
|
|
119
119
|
method: literal("ui/notifications/sandbox-proxy-ready"),
|
|
120
120
|
params: object({})
|
|
121
121
|
});
|
|
122
|
-
var V
|
|
122
|
+
var V = object({
|
|
123
123
|
connectDomains: array(string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
124
124
|
|
|
125
125
|
- Maps to CSP \`connect-src\` directive
|
|
@@ -127,7 +127,7 @@ var V$1 = object({
|
|
|
127
127
|
resourceDomains: array(string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),
|
|
128
128
|
frameDomains: array(string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),
|
|
129
129
|
baseUriDomains: array(string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")
|
|
130
|
-
}),
|
|
130
|
+
}), _$1 = object({
|
|
131
131
|
camera: object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),
|
|
132
132
|
microphone: object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),
|
|
133
133
|
geolocation: object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),
|
|
@@ -152,16 +152,16 @@ object({
|
|
|
152
152
|
method: literal("ui/notifications/tool-cancelled"),
|
|
153
153
|
params: object({ reason: string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
|
|
154
154
|
});
|
|
155
|
-
var
|
|
156
|
-
variables:
|
|
157
|
-
css:
|
|
155
|
+
var c$1 = object({ fonts: string().optional() }), r$2 = object({
|
|
156
|
+
variables: IJ.optional().describe("CSS variables for theming the app."),
|
|
157
|
+
css: c$1.optional().describe("CSS blocks that apps can inject.")
|
|
158
158
|
});
|
|
159
159
|
object({
|
|
160
160
|
method: literal("ui/resource-teardown"),
|
|
161
161
|
params: object({})
|
|
162
162
|
});
|
|
163
163
|
record(string(), unknown());
|
|
164
|
-
var
|
|
164
|
+
var w$1 = object({
|
|
165
165
|
text: object({}).optional().describe("Host supports text content blocks."),
|
|
166
166
|
image: object({}).optional().describe("Host supports image content blocks."),
|
|
167
167
|
audio: object({}).optional().describe("Host supports audio content blocks."),
|
|
@@ -173,7 +173,7 @@ object({
|
|
|
173
173
|
method: literal("ui/notifications/request-teardown"),
|
|
174
174
|
params: object({}).optional()
|
|
175
175
|
});
|
|
176
|
-
var
|
|
176
|
+
var l$1 = object({
|
|
177
177
|
experimental: object({}).optional().describe("Experimental features (structure TBD)."),
|
|
178
178
|
openLinks: object({}).optional().describe("Host supports opening external URLs."),
|
|
179
179
|
downloadFile: object({}).optional().describe("Host supports file downloads via ui/download-file."),
|
|
@@ -181,23 +181,23 @@ var r$2 = object({
|
|
|
181
181
|
serverResources: object({ listChanged: boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
|
|
182
182
|
logging: object({}).optional().describe("Host accepts log messages."),
|
|
183
183
|
sandbox: object({
|
|
184
|
-
permissions:
|
|
185
|
-
csp: V
|
|
184
|
+
permissions: _$1.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
|
|
185
|
+
csp: V.optional().describe("CSP domains approved by the host.")
|
|
186
186
|
}).optional().describe("Sandbox configuration applied by the host."),
|
|
187
|
-
updateModelContext:
|
|
188
|
-
message:
|
|
189
|
-
}),
|
|
187
|
+
updateModelContext: w$1.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
|
|
188
|
+
message: w$1.optional().describe("Host supports receiving content messages (ui/message) from the view.")
|
|
189
|
+
}), i = object({
|
|
190
190
|
experimental: object({}).optional().describe("Experimental features (structure TBD)."),
|
|
191
191
|
tools: object({ listChanged: boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
|
|
192
|
-
availableDisplayModes: array(
|
|
192
|
+
availableDisplayModes: array(N$1).optional().describe("Display modes the app supports.")
|
|
193
193
|
});
|
|
194
194
|
object({
|
|
195
195
|
method: literal("ui/notifications/initialized"),
|
|
196
196
|
params: object({}).optional()
|
|
197
197
|
});
|
|
198
198
|
object({
|
|
199
|
-
csp: V
|
|
200
|
-
permissions:
|
|
199
|
+
csp: V.optional().describe("Content Security Policy configuration for UI resources."),
|
|
200
|
+
permissions: _$1.optional().describe("Sandbox permissions requested by the UI resource."),
|
|
201
201
|
domain: string().optional().describe(`Dedicated origin for view sandbox.
|
|
202
202
|
|
|
203
203
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
@@ -217,13 +217,13 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
217
217
|
});
|
|
218
218
|
object({
|
|
219
219
|
method: literal("ui/request-display-mode"),
|
|
220
|
-
params: object({ mode:
|
|
220
|
+
params: object({ mode: N$1.describe("The display mode being requested.") })
|
|
221
221
|
});
|
|
222
|
-
object({ mode:
|
|
223
|
-
var
|
|
222
|
+
object({ mode: N$1.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
|
|
223
|
+
var p$1 = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool.");
|
|
224
224
|
object({
|
|
225
225
|
resourceUri: string().optional(),
|
|
226
|
-
visibility: array(
|
|
226
|
+
visibility: array(p$1).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
227
227
|
- "model": Tool visible to and callable by the agent
|
|
228
228
|
- "app": Tool callable by the app from this server only`)
|
|
229
229
|
});
|
|
@@ -244,23 +244,23 @@ object({
|
|
|
244
244
|
params: object({
|
|
245
245
|
html: string().describe("HTML content to load into the inner iframe."),
|
|
246
246
|
sandbox: string().optional().describe("Optional override for the inner iframe's sandbox attribute."),
|
|
247
|
-
csp: V
|
|
248
|
-
permissions:
|
|
247
|
+
csp: V.optional().describe("CSP configuration from resource metadata."),
|
|
248
|
+
permissions: _$1.optional().describe("Sandbox permissions from resource metadata.")
|
|
249
249
|
})
|
|
250
250
|
});
|
|
251
251
|
object({
|
|
252
252
|
method: literal("ui/notifications/tool-result"),
|
|
253
253
|
params: CallToolResultSchema.describe("Standard MCP tool execution result.")
|
|
254
254
|
});
|
|
255
|
-
var
|
|
255
|
+
var v$1 = object({
|
|
256
256
|
toolInfo: object({
|
|
257
257
|
id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."),
|
|
258
258
|
tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.")
|
|
259
259
|
}).optional().describe("Metadata of the tool call that instantiated this App."),
|
|
260
|
-
theme:
|
|
261
|
-
styles:
|
|
262
|
-
displayMode:
|
|
263
|
-
availableDisplayModes: array(
|
|
260
|
+
theme: m.optional().describe("Current color theme preference."),
|
|
261
|
+
styles: r$2.optional().describe("Style configuration for theming the app."),
|
|
262
|
+
displayMode: N$1.optional().describe("How the UI is currently displayed."),
|
|
263
|
+
availableDisplayModes: array(N$1).optional().describe("Display modes the host supports."),
|
|
264
264
|
containerDimensions: union([object({ height: number().describe("Fixed container height in pixels.") }), object({ maxHeight: union([number(), _undefined()]).optional().describe("Maximum container height in pixels.") })]).and(union([object({ width: number().describe("Fixed container width in pixels.") }), object({ maxWidth: union([number(), _undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
265
265
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),
|
|
266
266
|
locale: string().optional().describe("User's language and region preference in BCP 47 format."),
|
|
@@ -284,7 +284,7 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
284
284
|
}).passthrough();
|
|
285
285
|
object({
|
|
286
286
|
method: literal("ui/notifications/host-context-changed"),
|
|
287
|
-
params:
|
|
287
|
+
params: v$1.describe("Partial context update containing only changed fields.")
|
|
288
288
|
});
|
|
289
289
|
object({
|
|
290
290
|
method: literal("ui/update-model-context"),
|
|
@@ -297,44 +297,44 @@ object({
|
|
|
297
297
|
method: literal("ui/initialize"),
|
|
298
298
|
params: object({
|
|
299
299
|
appInfo: ImplementationSchema.describe("App identification (name and version)."),
|
|
300
|
-
appCapabilities:
|
|
300
|
+
appCapabilities: i.describe("Features and capabilities this app provides."),
|
|
301
301
|
protocolVersion: string().describe("Protocol version this app supports.")
|
|
302
302
|
})
|
|
303
303
|
});
|
|
304
304
|
object({
|
|
305
305
|
protocolVersion: string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
|
|
306
306
|
hostInfo: ImplementationSchema.describe("Host application identification and version."),
|
|
307
|
-
hostCapabilities:
|
|
308
|
-
hostContext:
|
|
307
|
+
hostCapabilities: l$1.describe("Features and capabilities provided by the host."),
|
|
308
|
+
hostContext: v$1.describe("Rich context about the host environment.")
|
|
309
309
|
}).passthrough();
|
|
310
|
-
function
|
|
310
|
+
function O$1() {
|
|
311
311
|
let K = document.documentElement.getAttribute("data-theme");
|
|
312
312
|
if (K === "dark" || K === "light") return K;
|
|
313
313
|
return document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function P$1(K) {
|
|
316
316
|
let Q = document.documentElement;
|
|
317
317
|
Q.setAttribute("data-theme", K), Q.style.colorScheme = K;
|
|
318
318
|
}
|
|
319
319
|
function q$1(K, Q = document.documentElement) {
|
|
320
320
|
for (let [X, Y] of Object.entries(K)) if (Y !== void 0) Q.style.setProperty(X, Y);
|
|
321
321
|
}
|
|
322
|
-
function D
|
|
322
|
+
function D(K) {
|
|
323
323
|
if (document.getElementById("__mcp-host-fonts")) return;
|
|
324
324
|
let X = document.createElement("style");
|
|
325
325
|
X.id = "__mcp-host-fonts", X.textContent = K, document.head.appendChild(X);
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function QQ(K, Q) {
|
|
328
328
|
useEffect(() => {
|
|
329
329
|
if (!K) return;
|
|
330
330
|
return K.setupSizeChangedNotifications();
|
|
331
331
|
}, [K, Q]);
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
let [K, Q] = useState(
|
|
333
|
+
function $Q() {
|
|
334
|
+
let [K, Q] = useState(O$1);
|
|
335
335
|
return useEffect(() => {
|
|
336
336
|
let X = new MutationObserver(() => {
|
|
337
|
-
Q(
|
|
337
|
+
Q(O$1());
|
|
338
338
|
});
|
|
339
339
|
return X.observe(document.documentElement, {
|
|
340
340
|
attributes: !0,
|
|
@@ -345,35 +345,37 @@ function XQ() {
|
|
|
345
345
|
}), () => X.disconnect();
|
|
346
346
|
}, []), K;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function lJ(K, Q) {
|
|
349
349
|
let X = useRef(!1);
|
|
350
350
|
useEffect(() => {
|
|
351
351
|
if (X.current) return;
|
|
352
|
-
if (Q?.theme)
|
|
352
|
+
if (Q?.theme) P$1(Q.theme);
|
|
353
353
|
if (Q?.styles?.variables) q$1(Q.styles.variables);
|
|
354
354
|
if (Q?.theme || Q?.styles?.variables) X.current = !0;
|
|
355
355
|
}, [Q]), useEffect(() => {
|
|
356
356
|
if (!K) return;
|
|
357
|
-
|
|
358
|
-
if (
|
|
359
|
-
if (
|
|
357
|
+
let Y = (Z) => {
|
|
358
|
+
if (Z.theme) P$1(Z.theme);
|
|
359
|
+
if (Z.styles?.variables) q$1(Z.styles.variables);
|
|
360
360
|
};
|
|
361
|
+
return K.addEventListener("hostcontextchanged", Y), () => K.removeEventListener("hostcontextchanged", Y);
|
|
361
362
|
}, [K]);
|
|
362
363
|
}
|
|
363
|
-
function
|
|
364
|
+
function iJ(K, Q) {
|
|
364
365
|
let X = useRef(!1);
|
|
365
366
|
useEffect(() => {
|
|
366
367
|
if (X.current) return;
|
|
367
|
-
if (Q?.styles?.css?.fonts) D
|
|
368
|
+
if (Q?.styles?.css?.fonts) D(Q.styles.css.fonts), X.current = !0;
|
|
368
369
|
}, [Q]), useEffect(() => {
|
|
369
370
|
if (!K) return;
|
|
370
|
-
|
|
371
|
-
if (
|
|
371
|
+
let Y = (Z) => {
|
|
372
|
+
if (Z.styles?.css?.fonts) D(Z.styles.css.fonts);
|
|
372
373
|
};
|
|
374
|
+
return K.addEventListener("hostcontextchanged", Y), () => K.removeEventListener("hostcontextchanged", Y);
|
|
373
375
|
}, [K]);
|
|
374
376
|
}
|
|
375
|
-
function
|
|
376
|
-
|
|
377
|
+
function LQ$1(K, Q) {
|
|
378
|
+
lJ(K, Q), iJ(K, Q);
|
|
377
379
|
}
|
|
378
380
|
//#endregion
|
|
379
381
|
//#region src/hooks/use-host-context.ts
|
|
@@ -392,8 +394,8 @@ var registries$1 = /* @__PURE__ */ new WeakMap();
|
|
|
392
394
|
* Host-provided variables override defaults since they're applied after.
|
|
393
395
|
*/
|
|
394
396
|
function applyStyles(variables) {
|
|
395
|
-
|
|
396
|
-
if (variables)
|
|
397
|
+
qQ(DEFAULT_STYLE_VARIABLES);
|
|
398
|
+
if (variables) qQ(variables);
|
|
397
399
|
}
|
|
398
400
|
function getRegistry$1(app) {
|
|
399
401
|
let subs = registries$1.get(app);
|
|
@@ -401,15 +403,15 @@ function getRegistry$1(app) {
|
|
|
401
403
|
subs = /* @__PURE__ */ new Set();
|
|
402
404
|
registries$1.set(app, subs);
|
|
403
405
|
const ctx = app.getHostContext();
|
|
404
|
-
if (ctx?.theme)
|
|
406
|
+
if (ctx?.theme) PQ(ctx.theme);
|
|
405
407
|
applyStyles(ctx?.styles?.variables);
|
|
406
|
-
if (ctx?.styles?.css?.fonts)
|
|
408
|
+
if (ctx?.styles?.css?.fonts) TQ(ctx.styles.css.fonts);
|
|
407
409
|
let debounceTimer = null;
|
|
408
410
|
app.onhostcontextchanged = () => {
|
|
409
411
|
const ctx = app.getHostContext();
|
|
410
|
-
if (ctx?.theme)
|
|
412
|
+
if (ctx?.theme) PQ(ctx.theme);
|
|
411
413
|
applyStyles(ctx?.styles?.variables);
|
|
412
|
-
if (ctx?.styles?.css?.fonts)
|
|
414
|
+
if (ctx?.styles?.css?.fonts) TQ(ctx.styles.css.fonts);
|
|
413
415
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
414
416
|
debounceTimer = setTimeout(() => {
|
|
415
417
|
debounceTimer = null;
|
|
@@ -1139,7 +1141,14 @@ function useAppTools(config) {
|
|
|
1139
1141
|
useEffect(() => {
|
|
1140
1142
|
if (!app) return;
|
|
1141
1143
|
app.onlisttools = () => {
|
|
1142
|
-
return Promise.resolve({ tools: config.tools.map((t) =>
|
|
1144
|
+
return Promise.resolve({ tools: config.tools.map((t) => ({
|
|
1145
|
+
name: t.name,
|
|
1146
|
+
...t.description ? { description: t.description } : {},
|
|
1147
|
+
inputSchema: {
|
|
1148
|
+
type: "object",
|
|
1149
|
+
...t.inputSchema
|
|
1150
|
+
}
|
|
1151
|
+
})) });
|
|
1143
1152
|
};
|
|
1144
1153
|
app.oncalltool = (params) => {
|
|
1145
1154
|
return Promise.resolve(config.onCallTool(params));
|
|
@@ -3205,6 +3214,6 @@ var prefersReducedMotion = createMediaQueryFn("(prefers-reduced-motion: reduce)"
|
|
|
3205
3214
|
var isPrimarilyTouchDevice = createMediaQueryFn("(pointer: coarse)");
|
|
3206
3215
|
var isHoverAvailable = createMediaQueryFn("(hover: hover)");
|
|
3207
3216
|
//#endregion
|
|
3208
|
-
export {
|
|
3217
|
+
export { gQ as App, AppProvider, d as DOWNLOAD_FILE_METHOD, n as HOST_CONTEXT_CHANGED_METHOD, t as INITIALIZED_METHOD, s as INITIALIZE_METHOD, B as LATEST_PROTOCOL_VERSION, h as MESSAGE_METHOD, y as McpUiAppCapabilitiesSchema, K as McpUiDisplayModeSchema, _Q as McpUiDownloadFileRequestSchema, I as McpUiDownloadFileResultSchema, S as McpUiHostCapabilitiesSchema, H as McpUiHostContextChangedNotificationSchema, U as McpUiHostContextSchema, g as McpUiHostCssSchema, x as McpUiHostStylesSchema, AQ as McpUiInitializeRequestSchema, M as McpUiInitializeResultSchema, LQ as McpUiInitializedNotificationSchema, OQ as McpUiMessageRequestSchema, w as McpUiMessageResultSchema, GQ as McpUiOpenLinkRequestSchema, O as McpUiOpenLinkResultSchema, BQ as McpUiRequestDisplayModeRequestSchema, T as McpUiRequestDisplayModeResultSchema, jQ as McpUiRequestTeardownNotificationSchema, W as McpUiResourceCspSchema, zQ as McpUiResourceMetaSchema, j as McpUiResourcePermissionsSchema, q as McpUiResourceTeardownRequestSchema, WQ as McpUiResourceTeardownResultSchema, NQ as McpUiSizeChangedNotificationSchema, _ as McpUiSupportedContentBlockModalitiesSchema, k as McpUiThemeSchema, P as McpUiToolCancelledNotificationSchema, A as McpUiToolInputNotificationSchema, F as McpUiToolInputPartialNotificationSchema, EQ as McpUiToolMetaSchema, R as McpUiToolResultNotificationSchema, v as McpUiToolVisibilitySchema, wQ as McpUiUpdateModelContextRequestSchema, u as OPEN_LINK_METHOD, N as PostMessageTransport, z as ProtocolWithEvents, e as REQUEST_DISPLAY_MODE_METHOD, a as REQUEST_TEARDOWN_METHOD, CX as RESOURCE_MIME_TYPE, o as RESOURCE_TEARDOWN_METHOD, MX as RESOURCE_URI_META_KEY, p as SIZE_CHANGED_METHOD, SafeArea, l as TOOL_CANCELLED_METHOD, r as TOOL_INPUT_METHOD, E as TOOL_INPUT_PARTIAL_METHOD, c as TOOL_RESULT_METHOD, PQ as applyDocumentTheme, TQ as applyHostFonts, qQ as applyHostStyleVariables, chatgpt_exports as chatgpt, cn, detectHost, FQ as getDocumentTheme, inspector_exports as inspector, isChatGPT, isClaude, isHoverAvailable, isPrimarilyTouchDevice, prefersReducedMotion, useApp, useAppState, useAppTools, QQ as useAutoResize, useCallServerTool, useDeviceCapabilities, useDisplayMode, $Q as useDocumentTheme, useDownloadFile, useHostContext, iJ as useHostFonts, useHostInfo, lJ as useHostStyleVariables, LQ$1 as useHostStyles, useIsMobile, useListServerResources, useLocale, useOpenLink, usePlatform, useReadServerResource, useRequestDisplayMode, useRequestTeardown, useSafeArea, useSendLog, useSendMessage, useStyles, useTeardown, useTheme, useTimeZone, useToolData, useToolInfo, useUpdateModelContext, useUserAgent, useViewport };
|
|
3209
3218
|
|
|
3210
3219
|
//# sourceMappingURL=index.js.map
|