sunpeak 0.18.7 → 0.18.12
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 +12 -0
- package/bin/commands/dev.mjs +3 -3
- package/bin/commands/inspect.mjs +4 -1
- package/bin/lib/sandbox-server.mjs +31 -1
- package/dist/chatgpt/index.cjs +1 -2
- package/dist/chatgpt/index.js +1 -2
- package/dist/claude/index.cjs +1 -2
- package/dist/claude/index.js +1 -2
- package/dist/host/chatgpt/index.cjs +1 -2
- package/dist/host/chatgpt/index.cjs.map +1 -1
- package/dist/host/chatgpt/index.js +1 -2
- package/dist/host/chatgpt/index.js.map +1 -1
- package/dist/index.cjs +93 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +54 -54
- package/dist/index.js.map +1 -1
- package/dist/inspector/hosts.d.ts +12 -0
- package/dist/inspector/index.cjs +1 -2
- package/dist/inspector/index.js +1 -2
- package/dist/{inspector-CKc58UuI.cjs → inspector-8nPV2A-z.cjs} +104 -54
- package/dist/inspector-8nPV2A-z.cjs.map +1 -0
- package/dist/{inspector-DZrN0kej.js → inspector-Cdo5BK2D.js} +103 -53
- package/dist/inspector-Cdo5BK2D.js.map +1 -0
- package/dist/mcp/index.cjs +85 -71
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.js +79 -65
- package/dist/mcp/index.js.map +1 -1
- package/dist/{protocol-DJmRaBzO.js → protocol-BfAACnv0.js} +14 -9
- package/dist/{protocol-DJmRaBzO.js.map → protocol-BfAACnv0.js.map} +1 -1
- package/dist/{protocol-jbxhzcnS.cjs → protocol-C7kTcBr_.cjs} +14 -9
- package/dist/{protocol-jbxhzcnS.cjs.map → protocol-C7kTcBr_.cjs.map} +1 -1
- package/dist/style.css +36 -1
- package/dist/{use-app-BNbz1uzj.js → use-app-CfP9VypY.js} +107 -56
- package/dist/use-app-CfP9VypY.js.map +1 -0
- package/dist/{use-app-Dqh20JPP.cjs → use-app-CzcYw1Kz.cjs} +165 -114
- package/dist/use-app-CzcYw1Kz.cjs.map +1 -0
- package/package.json +7 -7
- package/template/README.md +12 -0
- package/template/dist/albums/albums.html +16 -15
- package/template/dist/albums/albums.json +1 -1
- package/template/dist/carousel/carousel.html +20 -19
- package/template/dist/carousel/carousel.json +1 -1
- package/template/dist/map/map.html +7 -6
- package/template/dist/map/map.json +1 -1
- package/template/dist/review/review.html +6 -5
- package/template/dist/review/review.json +1 -1
- package/template/node_modules/.bin/vite +2 -2
- package/template/node_modules/.bin/vitest +2 -2
- package/template/node_modules/.vite/deps/_metadata.json +4 -4
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +49 -49
- 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 +49 -49
- 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 +89 -89
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/@testing-library_react.js +9 -6
- package/template/node_modules/.vite-mcp/deps/@testing-library_react.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/_metadata.json +26 -26
- package/template/node_modules/.vite-mcp/deps/{protocol-CTflwIfG.js → protocol-B_qKkui_.js} +14 -9
- package/template/node_modules/.vite-mcp/deps/protocol-B_qKkui_.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/vitest.js +366 -128
- package/template/node_modules/.vite-mcp/deps/vitest.js.map +1 -1
- package/template/package.json +2 -2
- package/template/src/resources/carousel/carousel.test.tsx +16 -2
- package/template/src/resources/carousel/carousel.tsx +42 -14
- package/template/src/resources/carousel/components/carousel.tsx +20 -0
- package/template/src/resources/carousel/components/index.ts +1 -0
- package/template/src/resources/carousel/components/place-detail.tsx +153 -0
- package/template/tests/e2e/carousel.spec.ts +125 -0
- package/template/tests/live/carousel.spec.ts +2 -2
- package/template/tests/simulations/show-carousel.json +54 -5
- package/dist/inspector-CKc58UuI.cjs.map +0 -1
- package/dist/inspector-DZrN0kej.js.map +0 -1
- package/dist/use-app-BNbz1uzj.js.map +0 -1
- package/dist/use-app-Dqh20JPP.cjs.map +0 -1
- package/template/node_modules/.vite-mcp/deps/protocol-CTflwIfG.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as __toESM } from "./chunk-BoAXSpZd.js";
|
|
2
2
|
import { t as require_react } from "./react.js";
|
|
3
3
|
import { Cn as object, In as string, Jn as union, Sn as number, St as _undefined, Tt as array, Yn as unknown, jn as record, kt as boolean, ln as literal } from "./schemas-NsgmY9QV.js";
|
|
4
|
-
import { S as ResourceLinkSchema, T as ToolSchema, _ as PingRequestSchema, a as EmbeddedResourceSchema, b as ReadResourceResultSchema, c as JSONRPCMessageSchema, h as ListToolsRequestSchema, i as ContentBlockSchema, m as ListResourcesResultSchema, n as CallToolRequestSchema, o as EmptyResultSchema, r as CallToolResultSchema, s as ImplementationSchema, t as Protocol, x as RequestIdSchema } from "./protocol-
|
|
5
|
-
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.3.
|
|
4
|
+
import { S as ResourceLinkSchema, T as ToolSchema, _ as PingRequestSchema, a as EmbeddedResourceSchema, b as ReadResourceResultSchema, c as JSONRPCMessageSchema, h as ListToolsRequestSchema, i as ContentBlockSchema, m as ListResourcesResultSchema, n as CallToolRequestSchema, o as EmptyResultSchema, r as CallToolResultSchema, s as ImplementationSchema, t as Protocol, x as RequestIdSchema } from "./protocol-B_qKkui_.js";
|
|
5
|
+
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.3.2_@modelcontextprotocol+sdk@1.29.0_zod@4.3.6__react-_38e5f6c50a4ca9cf3f1dffc73a60c951/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.js
|
|
6
6
|
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var R = "2026-01-26", o = "ui/open-link", a = "ui/download-file", s = "ui/message", t = "ui/notifications/sandbox-proxy-ready", e = "ui/notifications/sandbox-resource-ready", JJ = "ui/notifications/size-changed", KJ = "ui/notifications/tool-input", z = "ui/notifications/tool-input-partial", QJ = "ui/notifications/tool-result", XJ = "ui/notifications/tool-cancelled", YJ = "ui/notifications/host-context-changed", ZJ = "ui/notifications/request-teardown", $J = "ui/resource-teardown", GJ = "ui/initialize", WJ = "ui/notifications/initialized", jJ = "ui/request-display-mode";
|
|
8
|
+
var W = class {
|
|
9
9
|
eventTarget;
|
|
10
10
|
eventSource;
|
|
11
11
|
messageListener;
|
|
@@ -39,7 +39,7 @@ var j = class {
|
|
|
39
39
|
sessionId;
|
|
40
40
|
setProtocolVersion;
|
|
41
41
|
};
|
|
42
|
-
var
|
|
42
|
+
var h = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), j = union([
|
|
43
43
|
literal("inline"),
|
|
44
44
|
literal("fullscreen"),
|
|
45
45
|
literal("pip")
|
|
@@ -141,10 +141,10 @@ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Rec
|
|
|
141
141
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`), DJ = object({
|
|
142
142
|
method: literal("ui/open-link"),
|
|
143
143
|
params: object({ url: string().describe("URL to open in the host's browser") })
|
|
144
|
-
}),
|
|
144
|
+
}), w = object({ isError: boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough(), M = object({ isError: boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough(), T = object({ isError: boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough(), IJ = object({
|
|
145
145
|
method: literal("ui/notifications/sandbox-proxy-ready"),
|
|
146
146
|
params: object({})
|
|
147
|
-
}),
|
|
147
|
+
}), V = object({
|
|
148
148
|
connectDomains: array(string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
149
149
|
|
|
150
150
|
- Maps to CSP \`connect-src\` directive
|
|
@@ -152,7 +152,7 @@ for compatibility with Zod schema generation. Both are functionally equivalent f
|
|
|
152
152
|
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)"),
|
|
153
153
|
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'`)"),
|
|
154
154
|
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'`)")
|
|
155
|
-
}),
|
|
155
|
+
}), P = object({
|
|
156
156
|
camera: object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),
|
|
157
157
|
microphone: object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),
|
|
158
158
|
geolocation: object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),
|
|
@@ -163,22 +163,22 @@ for compatibility with Zod schema generation. Both are functionally equivalent f
|
|
|
163
163
|
width: number().optional().describe("New width in pixels."),
|
|
164
164
|
height: number().optional().describe("New height in pixels.")
|
|
165
165
|
})
|
|
166
|
-
}),
|
|
166
|
+
}), H = object({
|
|
167
167
|
method: literal("ui/notifications/tool-input"),
|
|
168
168
|
params: object({ arguments: record(string(), unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.") })
|
|
169
|
-
}),
|
|
169
|
+
}), v = object({
|
|
170
170
|
method: literal("ui/notifications/tool-input-partial"),
|
|
171
171
|
params: object({ arguments: record(string(), unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).") })
|
|
172
|
-
}),
|
|
172
|
+
}), A = object({
|
|
173
173
|
method: literal("ui/notifications/tool-cancelled"),
|
|
174
174
|
params: object({ reason: string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
|
|
175
|
-
}),
|
|
175
|
+
}), m = object({ fonts: string().optional() }), c = object({
|
|
176
176
|
variables: qJ.optional().describe("CSS variables for theming the app."),
|
|
177
|
-
css:
|
|
178
|
-
}),
|
|
177
|
+
css: m.optional().describe("CSS blocks that apps can inject.")
|
|
178
|
+
}), k = object({
|
|
179
179
|
method: literal("ui/resource-teardown"),
|
|
180
180
|
params: object({})
|
|
181
|
-
}), EJ = record(string(), unknown()),
|
|
181
|
+
}), EJ = record(string(), unknown()), U = object({
|
|
182
182
|
text: object({}).optional().describe("Host supports text content blocks."),
|
|
183
183
|
image: object({}).optional().describe("Host supports image content blocks."),
|
|
184
184
|
audio: object({}).optional().describe("Host supports audio content blocks."),
|
|
@@ -188,7 +188,7 @@ for compatibility with Zod schema generation. Both are functionally equivalent f
|
|
|
188
188
|
}), RJ = object({
|
|
189
189
|
method: literal("ui/notifications/request-teardown"),
|
|
190
190
|
params: object({}).optional()
|
|
191
|
-
}),
|
|
191
|
+
}), r = object({
|
|
192
192
|
experimental: object({}).optional().describe("Experimental features (structure TBD)."),
|
|
193
193
|
openLinks: object({}).optional().describe("Host supports opening external URLs."),
|
|
194
194
|
downloadFile: object({}).optional().describe("Host supports file downloads via ui/download-file."),
|
|
@@ -196,21 +196,21 @@ for compatibility with Zod schema generation. Both are functionally equivalent f
|
|
|
196
196
|
serverResources: object({ listChanged: boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
|
|
197
197
|
logging: object({}).optional().describe("Host accepts log messages."),
|
|
198
198
|
sandbox: object({
|
|
199
|
-
permissions:
|
|
200
|
-
csp:
|
|
199
|
+
permissions: P.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
|
|
200
|
+
csp: V.optional().describe("CSP domains approved by the host.")
|
|
201
201
|
}).optional().describe("Sandbox configuration applied by the host."),
|
|
202
|
-
updateModelContext:
|
|
203
|
-
message:
|
|
204
|
-
}),
|
|
202
|
+
updateModelContext: U.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
|
|
203
|
+
message: U.optional().describe("Host supports receiving content messages (ui/message) from the view.")
|
|
204
|
+
}), l = object({
|
|
205
205
|
experimental: object({}).optional().describe("Experimental features (structure TBD)."),
|
|
206
206
|
tools: object({ listChanged: boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
|
|
207
|
-
availableDisplayModes: array(
|
|
207
|
+
availableDisplayModes: array(j).optional().describe("Display modes the app supports.")
|
|
208
208
|
}), zJ = object({
|
|
209
209
|
method: literal("ui/notifications/initialized"),
|
|
210
210
|
params: object({}).optional()
|
|
211
211
|
}), UJ = object({
|
|
212
|
-
csp:
|
|
213
|
-
permissions:
|
|
212
|
+
csp: V.optional().describe("Content Security Policy configuration for UI resources."),
|
|
213
|
+
permissions: P.optional().describe("Sandbox permissions requested by the UI resource."),
|
|
214
214
|
domain: string().optional().describe(`Dedicated origin for view sandbox.
|
|
215
215
|
|
|
216
216
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
@@ -229,10 +229,10 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
229
229
|
- omitted: host decides border`)
|
|
230
230
|
}), wJ = object({
|
|
231
231
|
method: literal("ui/request-display-mode"),
|
|
232
|
-
params: object({ mode:
|
|
233
|
-
}),
|
|
232
|
+
params: object({ mode: j.describe("The display mode being requested.") })
|
|
233
|
+
}), b = object({ mode: j.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough(), i = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool."), MJ = object({
|
|
234
234
|
resourceUri: string().optional(),
|
|
235
|
-
visibility: array(
|
|
235
|
+
visibility: array(i).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
236
236
|
- "model": Tool visible to and callable by the agent
|
|
237
237
|
- "app": Tool callable by the app from this server only`)
|
|
238
238
|
});
|
|
@@ -251,21 +251,21 @@ var TJ = object({
|
|
|
251
251
|
params: object({
|
|
252
252
|
html: string().describe("HTML content to load into the inner iframe."),
|
|
253
253
|
sandbox: string().optional().describe("Optional override for the inner iframe's sandbox attribute."),
|
|
254
|
-
csp:
|
|
255
|
-
permissions:
|
|
254
|
+
csp: V.optional().describe("CSP configuration from resource metadata."),
|
|
255
|
+
permissions: P.optional().describe("Sandbox permissions from resource metadata.")
|
|
256
256
|
})
|
|
257
|
-
}),
|
|
257
|
+
}), S = object({
|
|
258
258
|
method: literal("ui/notifications/tool-result"),
|
|
259
259
|
params: CallToolResultSchema.describe("Standard MCP tool execution result.")
|
|
260
|
-
}),
|
|
260
|
+
}), C = object({
|
|
261
261
|
toolInfo: object({
|
|
262
262
|
id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."),
|
|
263
263
|
tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.")
|
|
264
264
|
}).optional().describe("Metadata of the tool call that instantiated this App."),
|
|
265
|
-
theme:
|
|
266
|
-
styles:
|
|
267
|
-
displayMode:
|
|
268
|
-
availableDisplayModes: array(
|
|
265
|
+
theme: h.optional().describe("Current color theme preference."),
|
|
266
|
+
styles: c.optional().describe("Style configuration for theming the app."),
|
|
267
|
+
displayMode: j.optional().describe("How the UI is currently displayed."),
|
|
268
|
+
availableDisplayModes: array(j).optional().describe("Display modes the host supports."),
|
|
269
269
|
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
|
|
270
270
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),
|
|
271
271
|
locale: string().optional().describe("User's language and region preference in BCP 47 format."),
|
|
@@ -286,9 +286,9 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
286
286
|
bottom: number().describe("Bottom safe area inset in pixels."),
|
|
287
287
|
left: number().describe("Left safe area inset in pixels.")
|
|
288
288
|
}).optional().describe("Mobile safe area boundaries in pixels.")
|
|
289
|
-
}).passthrough(),
|
|
289
|
+
}).passthrough(), g = object({
|
|
290
290
|
method: literal("ui/notifications/host-context-changed"),
|
|
291
|
-
params:
|
|
291
|
+
params: C.describe("Partial context update containing only changed fields.")
|
|
292
292
|
}), AJ = object({
|
|
293
293
|
method: literal("ui/update-model-context"),
|
|
294
294
|
params: object({
|
|
@@ -299,34 +299,34 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
299
299
|
method: literal("ui/initialize"),
|
|
300
300
|
params: object({
|
|
301
301
|
appInfo: ImplementationSchema.describe("App identification (name and version)."),
|
|
302
|
-
appCapabilities:
|
|
302
|
+
appCapabilities: l.describe("Features and capabilities this app provides."),
|
|
303
303
|
protocolVersion: string().describe("Protocol version this app supports.")
|
|
304
304
|
})
|
|
305
|
-
}),
|
|
305
|
+
}), x = object({
|
|
306
306
|
protocolVersion: string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
|
|
307
307
|
hostInfo: ImplementationSchema.describe("Host application identification and version."),
|
|
308
|
-
hostCapabilities:
|
|
309
|
-
hostContext:
|
|
308
|
+
hostCapabilities: r.describe("Features and capabilities provided by the host."),
|
|
309
|
+
hostContext: C.describe("Rich context about the host environment.")
|
|
310
310
|
}).passthrough();
|
|
311
|
-
function
|
|
311
|
+
function _() {
|
|
312
312
|
let K = document.documentElement.getAttribute("data-theme");
|
|
313
313
|
if (K === "dark" || K === "light") return K;
|
|
314
314
|
return document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function O(K) {
|
|
317
317
|
let Q = document.documentElement;
|
|
318
318
|
Q.setAttribute("data-theme", K), Q.style.colorScheme = K;
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function q(K, Q = document.documentElement) {
|
|
321
321
|
for (let [X, Y] of Object.entries(K)) if (Y !== void 0) Q.style.setProperty(X, Y);
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function D(K) {
|
|
324
324
|
if (document.getElementById("__mcp-host-fonts")) return;
|
|
325
325
|
let X = document.createElement("style");
|
|
326
326
|
X.id = "__mcp-host-fonts", X.textContent = K, document.head.appendChild(X);
|
|
327
327
|
}
|
|
328
328
|
var dK = "ui/resourceUri", uK = "text/html;profile=mcp-app";
|
|
329
|
-
var
|
|
329
|
+
var y = class extends Protocol {
|
|
330
330
|
_appInfo;
|
|
331
331
|
_capabilities;
|
|
332
332
|
options;
|
|
@@ -352,19 +352,19 @@ var f = class extends Protocol {
|
|
|
352
352
|
return this._hostContext;
|
|
353
353
|
}
|
|
354
354
|
set ontoolinput(K) {
|
|
355
|
-
this.setNotificationHandler(
|
|
355
|
+
this.setNotificationHandler(H, (Q) => K(Q.params));
|
|
356
356
|
}
|
|
357
357
|
set ontoolinputpartial(K) {
|
|
358
|
-
this.setNotificationHandler(
|
|
358
|
+
this.setNotificationHandler(v, (Q) => K(Q.params));
|
|
359
359
|
}
|
|
360
360
|
set ontoolresult(K) {
|
|
361
|
-
this.setNotificationHandler(
|
|
361
|
+
this.setNotificationHandler(S, (Q) => K(Q.params));
|
|
362
362
|
}
|
|
363
363
|
set ontoolcancelled(K) {
|
|
364
|
-
this.setNotificationHandler(
|
|
364
|
+
this.setNotificationHandler(A, (Q) => K(Q.params));
|
|
365
365
|
}
|
|
366
366
|
set onhostcontextchanged(K) {
|
|
367
|
-
this.setNotificationHandler(
|
|
367
|
+
this.setNotificationHandler(g, (Q) => {
|
|
368
368
|
this._hostContext = {
|
|
369
369
|
...this._hostContext,
|
|
370
370
|
...Q.params
|
|
@@ -372,7 +372,7 @@ var f = class extends Protocol {
|
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
374
|
set onteardown(K) {
|
|
375
|
-
this.setRequestHandler(
|
|
375
|
+
this.setRequestHandler(k, (Q, X) => K(Q.params, X));
|
|
376
376
|
}
|
|
377
377
|
set oncalltool(K) {
|
|
378
378
|
this.setRequestHandler(CallToolRequestSchema, (Q, X) => K(Q.params, X));
|
|
@@ -422,7 +422,7 @@ var f = class extends Protocol {
|
|
|
422
422
|
return this.request({
|
|
423
423
|
method: "ui/message",
|
|
424
424
|
params: K
|
|
425
|
-
},
|
|
425
|
+
}, T, Q);
|
|
426
426
|
}
|
|
427
427
|
sendLog(K) {
|
|
428
428
|
return this.notification({
|
|
@@ -440,14 +440,14 @@ var f = class extends Protocol {
|
|
|
440
440
|
return this.request({
|
|
441
441
|
method: "ui/open-link",
|
|
442
442
|
params: K
|
|
443
|
-
},
|
|
443
|
+
}, w, Q);
|
|
444
444
|
}
|
|
445
445
|
sendOpenLink = this.openLink;
|
|
446
446
|
downloadFile(K, Q) {
|
|
447
447
|
return this.request({
|
|
448
448
|
method: "ui/download-file",
|
|
449
449
|
params: K
|
|
450
|
-
},
|
|
450
|
+
}, M, Q);
|
|
451
451
|
}
|
|
452
452
|
requestTeardown(K = {}) {
|
|
453
453
|
return this.notification({
|
|
@@ -459,7 +459,7 @@ var f = class extends Protocol {
|
|
|
459
459
|
return this.request({
|
|
460
460
|
method: "ui/request-display-mode",
|
|
461
461
|
params: K
|
|
462
|
-
},
|
|
462
|
+
}, b, Q);
|
|
463
463
|
}
|
|
464
464
|
sendSizeChanged(K) {
|
|
465
465
|
return this.notification({
|
|
@@ -472,22 +472,22 @@ var f = class extends Protocol {
|
|
|
472
472
|
if (K) return;
|
|
473
473
|
K = !0, requestAnimationFrame(() => {
|
|
474
474
|
K = !1;
|
|
475
|
-
let
|
|
476
|
-
|
|
477
|
-
let L =
|
|
478
|
-
|
|
479
|
-
let
|
|
480
|
-
if (
|
|
481
|
-
width:
|
|
482
|
-
height:
|
|
475
|
+
let $ = document.documentElement, N = $.style.height;
|
|
476
|
+
$.style.height = "max-content";
|
|
477
|
+
let L = Math.ceil($.getBoundingClientRect().height);
|
|
478
|
+
$.style.height = N;
|
|
479
|
+
let G = Math.ceil(window.innerWidth);
|
|
480
|
+
if (G !== Q || L !== X) Q = G, X = L, this.sendSizeChanged({
|
|
481
|
+
width: G,
|
|
482
|
+
height: L
|
|
483
483
|
});
|
|
484
484
|
});
|
|
485
485
|
};
|
|
486
486
|
Y();
|
|
487
|
-
let
|
|
488
|
-
return
|
|
487
|
+
let Z = new ResizeObserver(Y);
|
|
488
|
+
return Z.observe(document.documentElement), Z.observe(document.body), () => Z.disconnect();
|
|
489
489
|
}
|
|
490
|
-
async connect(K = new
|
|
490
|
+
async connect(K = new W(window.parent, window.parent), Q) {
|
|
491
491
|
if (this.transport) throw Error("App is already connected. Call close() before connecting again.");
|
|
492
492
|
await super.connect(K);
|
|
493
493
|
try {
|
|
@@ -496,9 +496,9 @@ var f = class extends Protocol {
|
|
|
496
496
|
params: {
|
|
497
497
|
appCapabilities: this._capabilities,
|
|
498
498
|
appInfo: this._appInfo,
|
|
499
|
-
protocolVersion:
|
|
499
|
+
protocolVersion: R
|
|
500
500
|
}
|
|
501
|
-
},
|
|
501
|
+
}, x, Q);
|
|
502
502
|
if (X === void 0) throw Error(`Server sent invalid initialize result: ${X}`);
|
|
503
503
|
if (this._hostCapabilities = X.hostCapabilities, this._hostInfo = X.hostInfo, this._hostContext = X.hostContext, await this.notification({ method: "ui/notifications/initialized" }), this.options?.autoResize) this.setupSizeChangedNotifications();
|
|
504
504
|
} catch (X) {
|
|
@@ -507,24 +507,24 @@ var f = class extends Protocol {
|
|
|
507
507
|
}
|
|
508
508
|
};
|
|
509
509
|
function nK({ appInfo: K, capabilities: Q, onAppCreated: X }) {
|
|
510
|
-
let [Y,
|
|
510
|
+
let [Y, Z] = (0, import_react.useState)(null), [$, N] = (0, import_react.useState)(!1), [L, G] = (0, import_react.useState)(null);
|
|
511
511
|
return (0, import_react.useEffect)(() => {
|
|
512
|
-
let
|
|
513
|
-
async function
|
|
512
|
+
let F = !0;
|
|
513
|
+
async function n() {
|
|
514
514
|
try {
|
|
515
|
-
let
|
|
516
|
-
if (X?.(
|
|
517
|
-
} catch (
|
|
518
|
-
if (
|
|
515
|
+
let B = new W(window.parent, window.parent), E = new y(K, Q);
|
|
516
|
+
if (X?.(E), await E.connect(B), F) Z(E), N(!0), G(null);
|
|
517
|
+
} catch (B) {
|
|
518
|
+
if (F) Z(null), N(!1), G(B instanceof Error ? B : Error("Failed to connect"));
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
return
|
|
522
|
-
|
|
521
|
+
return n(), () => {
|
|
522
|
+
F = !1;
|
|
523
523
|
};
|
|
524
524
|
}, []), {
|
|
525
525
|
app: Y,
|
|
526
|
-
isConnected:
|
|
527
|
-
error:
|
|
526
|
+
isConnected: $,
|
|
527
|
+
error: L
|
|
528
528
|
};
|
|
529
529
|
}
|
|
530
530
|
function eK(K, Q) {
|
|
@@ -534,10 +534,10 @@ function eK(K, Q) {
|
|
|
534
534
|
}, [K, Q]);
|
|
535
535
|
}
|
|
536
536
|
function XQ() {
|
|
537
|
-
let [K, Q] = (0, import_react.useState)(
|
|
537
|
+
let [K, Q] = (0, import_react.useState)(_);
|
|
538
538
|
return (0, import_react.useEffect)(() => {
|
|
539
539
|
let X = new MutationObserver(() => {
|
|
540
|
-
Q(
|
|
540
|
+
Q(_());
|
|
541
541
|
});
|
|
542
542
|
return X.observe(document.documentElement, {
|
|
543
543
|
attributes: !0,
|
|
@@ -552,14 +552,14 @@ function rJ(K, Q) {
|
|
|
552
552
|
let X = (0, import_react.useRef)(!1);
|
|
553
553
|
(0, import_react.useEffect)(() => {
|
|
554
554
|
if (X.current) return;
|
|
555
|
-
if (Q?.theme)
|
|
556
|
-
if (Q?.styles?.variables)
|
|
555
|
+
if (Q?.theme) O(Q.theme);
|
|
556
|
+
if (Q?.styles?.variables) q(Q.styles.variables);
|
|
557
557
|
if (Q?.theme || Q?.styles?.variables) X.current = !0;
|
|
558
558
|
}, [Q]), (0, import_react.useEffect)(() => {
|
|
559
559
|
if (!K) return;
|
|
560
560
|
K.onhostcontextchanged = (Y) => {
|
|
561
|
-
if (Y.theme)
|
|
562
|
-
if (Y.styles?.variables)
|
|
561
|
+
if (Y.theme) O(Y.theme);
|
|
562
|
+
if (Y.styles?.variables) q(Y.styles.variables);
|
|
563
563
|
};
|
|
564
564
|
}, [K]);
|
|
565
565
|
}
|
|
@@ -567,11 +567,11 @@ function lJ(K, Q) {
|
|
|
567
567
|
let X = (0, import_react.useRef)(!1);
|
|
568
568
|
(0, import_react.useEffect)(() => {
|
|
569
569
|
if (X.current) return;
|
|
570
|
-
if (Q?.styles?.css?.fonts)
|
|
570
|
+
if (Q?.styles?.css?.fonts) D(Q.styles.css.fonts), X.current = !0;
|
|
571
571
|
}, [Q]), (0, import_react.useEffect)(() => {
|
|
572
572
|
if (!K) return;
|
|
573
573
|
K.onhostcontextchanged = (Y) => {
|
|
574
|
-
if (Y.styles?.css?.fonts)
|
|
574
|
+
if (Y.styles?.css?.fonts) D(Y.styles.css.fonts);
|
|
575
575
|
};
|
|
576
576
|
}, [K]);
|
|
577
577
|
}
|
|
@@ -579,6 +579,6 @@ function GQ(K, Q) {
|
|
|
579
579
|
rJ(K, Q), lJ(K, Q);
|
|
580
580
|
}
|
|
581
581
|
//#endregion
|
|
582
|
-
export {
|
|
582
|
+
export { y as App, a as DOWNLOAD_FILE_METHOD, YJ as HOST_CONTEXT_CHANGED_METHOD, WJ as INITIALIZED_METHOD, GJ as INITIALIZE_METHOD, R as LATEST_PROTOCOL_VERSION, s as MESSAGE_METHOD, l as McpUiAppCapabilitiesSchema, j as McpUiDisplayModeSchema, TJ as McpUiDownloadFileRequestSchema, M as McpUiDownloadFileResultSchema, r as McpUiHostCapabilitiesSchema, g as McpUiHostContextChangedNotificationSchema, C as McpUiHostContextSchema, m as McpUiHostCssSchema, c as McpUiHostStylesSchema, kJ as McpUiInitializeRequestSchema, x as McpUiInitializeResultSchema, zJ as McpUiInitializedNotificationSchema, HJ as McpUiMessageRequestSchema, T as McpUiMessageResultSchema, DJ as McpUiOpenLinkRequestSchema, w as McpUiOpenLinkResultSchema, wJ as McpUiRequestDisplayModeRequestSchema, b as McpUiRequestDisplayModeResultSchema, RJ as McpUiRequestTeardownNotificationSchema, V as McpUiResourceCspSchema, UJ as McpUiResourceMetaSchema, P as McpUiResourcePermissionsSchema, k as McpUiResourceTeardownRequestSchema, EJ as McpUiResourceTeardownResultSchema, IJ as McpUiSandboxProxyReadyNotificationSchema, vJ as McpUiSandboxResourceReadyNotificationSchema, FJ as McpUiSizeChangedNotificationSchema, U as McpUiSupportedContentBlockModalitiesSchema, h as McpUiThemeSchema, A as McpUiToolCancelledNotificationSchema, H as McpUiToolInputNotificationSchema, v as McpUiToolInputPartialNotificationSchema, MJ as McpUiToolMetaSchema, S as McpUiToolResultNotificationSchema, i as McpUiToolVisibilitySchema, AJ as McpUiUpdateModelContextRequestSchema, o as OPEN_LINK_METHOD, W as PostMessageTransport, jJ as REQUEST_DISPLAY_MODE_METHOD, ZJ as REQUEST_TEARDOWN_METHOD, uK as RESOURCE_MIME_TYPE, $J as RESOURCE_TEARDOWN_METHOD, dK as RESOURCE_URI_META_KEY, t as SANDBOX_PROXY_READY_METHOD, e as SANDBOX_RESOURCE_READY_METHOD, JJ as SIZE_CHANGED_METHOD, XJ as TOOL_CANCELLED_METHOD, KJ as TOOL_INPUT_METHOD, z as TOOL_INPUT_PARTIAL_METHOD, QJ as TOOL_RESULT_METHOD, O as applyDocumentTheme, D as applyHostFonts, q as applyHostStyleVariables, _ as getDocumentTheme, nK as useApp, eK as useAutoResize, XQ as useDocumentTheme, lJ as useHostFonts, rJ as useHostStyleVariables, GQ as useHostStyles };
|
|
583
583
|
|
|
584
584
|
//# sourceMappingURL=@modelcontextprotocol_ext-apps_react.js.map
|