sunpeak 0.18.2 → 0.18.7
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/bin/commands/dev.mjs +6 -2
- package/bin/commands/inspect.mjs +405 -5
- package/bin/commands/new.mjs +5 -0
- package/bin/lib/dev-overlay.mjs +50 -0
- package/bin/lib/live/live-config.d.mts +3 -0
- package/bin/lib/live/live-config.mjs +3 -1
- package/bin/lib/sandbox-server.mjs +11 -1
- package/dist/chatgpt/index.cjs +2 -2
- package/dist/chatgpt/index.js +2 -2
- package/dist/claude/index.cjs +1 -1
- package/dist/claude/index.js +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-request-teardown.d.ts +21 -0
- package/dist/host/chatgpt/index.cjs +1 -1
- package/dist/host/chatgpt/index.js +1 -1
- package/dist/index.cjs +110 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +68 -31
- package/dist/index.js.map +1 -1
- package/dist/inspector/hosts.d.ts +12 -0
- package/dist/inspector/index.cjs +2 -2
- package/dist/inspector/index.js +2 -2
- package/dist/inspector/inspector-url.d.ts +13 -0
- package/dist/inspector/mcp-app-host.d.ts +3 -0
- package/dist/inspector/simple-sidebar.d.ts +1 -1
- package/dist/inspector/use-inspector-state.d.ts +2 -0
- package/dist/inspector/use-mcp-connection.d.ts +9 -1
- package/dist/{inspector-CByJjmPD.cjs → inspector-CKc58UuI.cjs} +557 -136
- package/dist/inspector-CKc58UuI.cjs.map +1 -0
- package/dist/{inspector-ClhpqKLi.js → inspector-DZrN0kej.js} +556 -135
- package/dist/inspector-DZrN0kej.js.map +1 -0
- package/dist/{inspector-url-7qhtJwY6.cjs → inspector-url-C3LTKgXt.cjs} +3 -1
- package/dist/inspector-url-C3LTKgXt.cjs.map +1 -0
- package/dist/{inspector-url-DuEFmxLP.js → inspector-url-CyQcuBI9.js} +3 -1
- package/dist/inspector-url-CyQcuBI9.js.map +1 -0
- package/dist/mcp/index.cjs +119 -40
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.js +116 -37
- package/dist/mcp/index.js.map +1 -1
- package/dist/style.css +12 -0
- package/dist/{use-app-X7JbGskk.js → use-app-BNbz1uzj.js} +51 -42
- package/dist/use-app-BNbz1uzj.js.map +1 -0
- package/dist/{use-app-D2h-aiyr.cjs → use-app-Dqh20JPP.cjs} +93 -72
- package/dist/use-app-Dqh20JPP.cjs.map +1 -0
- package/package.json +2 -2
- package/template/dist/albums/albums.html +3 -3
- package/template/dist/albums/albums.json +1 -1
- package/template/dist/carousel/carousel.html +3 -3
- package/template/dist/carousel/carousel.json +1 -1
- package/template/dist/map/map.html +3 -3
- package/template/dist/map/map.json +1 -1
- package/template/dist/review/review.html +3 -3
- package/template/dist/review/review.json +1 -1
- package/template/node_modules/.vite/deps/_metadata.json +3 -3
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +51 -42
- 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 +56 -50
- 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 +52 -43
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/_metadata.json +22 -22
- package/template/tests/e2e/albums.spec.ts +20 -16
- package/template/tests/e2e/carousel.spec.ts +1 -1
- package/template/tests/e2e/dev-overlay.spec.ts +118 -0
- package/template/tests/e2e/helpers.ts +13 -0
- package/template/tests/e2e/map.spec.ts +1 -1
- package/template/tests/e2e/review.spec.ts +1 -1
- package/template/tests/live/albums.spec.ts +10 -0
- package/template/tests/live/playwright.config.ts +1 -1
- package/dist/inspector-CByJjmPD.cjs.map +0 -1
- package/dist/inspector-ClhpqKLi.js.map +0 -1
- package/dist/inspector-url-7qhtJwY6.cjs.map +0 -1
- package/dist/inspector-url-DuEFmxLP.js.map +0 -1
- package/dist/use-app-D2h-aiyr.cjs.map +0 -1
- package/dist/use-app-X7JbGskk.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { App, PostMessageTransport, RESOURCE_MIME_TYPE, RESOURCE_URI_META_KEY, LATEST_PROTOCOL_VERSION, applyHostStyleVariables, applyHostFonts, applyDocumentTheme, getDocumentTheme, } from '@modelcontextprotocol/ext-apps';
|
|
2
|
-
export { INITIALIZE_METHOD, INITIALIZED_METHOD, OPEN_LINK_METHOD, MESSAGE_METHOD, REQUEST_DISPLAY_MODE_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
|
-
export { McpUiThemeSchema, McpUiDisplayModeSchema, McpUiHostContextSchema, McpUiHostCapabilitiesSchema, McpUiAppCapabilitiesSchema, McpUiHostCssSchema, McpUiHostStylesSchema, McpUiInitializeRequestSchema, McpUiInitializeResultSchema, McpUiInitializedNotificationSchema, McpUiToolInputNotificationSchema, McpUiToolInputPartialNotificationSchema, McpUiToolResultNotificationSchema, McpUiToolCancelledNotificationSchema, McpUiHostContextChangedNotificationSchema, McpUiSizeChangedNotificationSchema, McpUiOpenLinkRequestSchema, McpUiOpenLinkResultSchema, McpUiMessageRequestSchema, McpUiMessageResultSchema, McpUiUpdateModelContextRequestSchema, McpUiRequestDisplayModeRequestSchema, McpUiRequestDisplayModeResultSchema, 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, McpUiDownloadFileRequest, McpUiDownloadFileResult, AppRequest, AppNotification, AppResult, } from '@modelcontextprotocol/ext-apps';
|
|
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
|
+
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';
|
|
5
5
|
export * from './hooks';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export * from './lib';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { $ as literal, L as RequestIdSchema, Q as boolean, R as ResourceLinkSchema, U as ToolSchema, X as _undefined, Z as array, _ as ImplementationSchema, a as CallToolResultSchema, at as unknown, et as number, it as union, nt as record, p as EmbeddedResourceSchema, rt as string, s as ContentBlockSchema, tt as object } from "./protocol-DJmRaBzO.js";
|
|
2
|
-
import { $ as
|
|
3
|
-
import { S as DEFAULT_STYLE_VARIABLES } from "./inspector-
|
|
2
|
+
import { $ as s, A as V, B as e, C as QQ, D as T, E as S, F as _Q, G as k, H as gQ, I as a, J as o, K as m, L as b, M as W, N as WQ, O as TQ, P as _, Q as r, R as c, S as PQ, T as RQ, U as h, V as g, W as jQ, X as q, Y as p, Z as qQ, _ as LQ, a as B, at as zQ, b as OQ, c as EQ, d as G, et as t, f as I, g as L, h as K, i as AQ, it as z, j as VQ, k as U, l as F, m as J, n as AppProvider, nt as w, o as BQ, p as IQ, q as n, r as A, rt as x, s as C, t as useApp, tt as vX, u as FQ, v as MX, w as R, x as P, y as O, z as d } from "./use-app-BNbz1uzj.js";
|
|
3
|
+
import { S as DEFAULT_STYLE_VARIABLES } from "./inspector-DZrN0kej.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 m$1 = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."),
|
|
10
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.3.1_@modelcontextprotocol+sdk@1.27.1_zod@4.3.6__react-_cd1fb28fd87e0bddd0a29eba0721855d/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.js
|
|
11
|
+
var m$1 = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), W$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."), qJ = record(union([
|
|
16
16
|
literal("--color-background-primary"),
|
|
17
17
|
literal("--color-background-secondary"),
|
|
18
18
|
literal("--color-background-tertiary"),
|
|
@@ -152,23 +152,28 @@ 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 c = object({ fonts: string().optional() }), r$2 = object({
|
|
156
|
-
variables:
|
|
157
|
-
css: c.optional().describe("CSS blocks that apps can inject.")
|
|
155
|
+
var c$1 = object({ fonts: string().optional() }), r$2 = object({
|
|
156
|
+
variables: qJ.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."),
|
|
168
168
|
resource: object({}).optional().describe("Host supports resource content blocks."),
|
|
169
169
|
resourceLink: object({}).optional().describe("Host supports resource link content blocks."),
|
|
170
170
|
structuredContent: object({}).optional().describe("Host supports structured content.")
|
|
171
|
-
})
|
|
171
|
+
});
|
|
172
|
+
object({
|
|
173
|
+
method: literal("ui/notifications/request-teardown"),
|
|
174
|
+
params: object({}).optional()
|
|
175
|
+
});
|
|
176
|
+
var l = object({
|
|
172
177
|
experimental: object({}).optional().describe("Experimental features (structure TBD)."),
|
|
173
178
|
openLinks: object({}).optional().describe("Host supports opening external URLs."),
|
|
174
179
|
downloadFile: object({}).optional().describe("Host supports file downloads via ui/download-file."),
|
|
@@ -179,12 +184,12 @@ var M = object({
|
|
|
179
184
|
permissions: _$1.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
|
|
180
185
|
csp: P$1.optional().describe("CSP domains approved by the host.")
|
|
181
186
|
}).optional().describe("Sandbox configuration applied by the host."),
|
|
182
|
-
updateModelContext:
|
|
183
|
-
message:
|
|
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.")
|
|
184
189
|
}), i = object({
|
|
185
190
|
experimental: object({}).optional().describe("Experimental features (structure TBD)."),
|
|
186
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."),
|
|
187
|
-
availableDisplayModes: array(
|
|
192
|
+
availableDisplayModes: array(W$1).optional().describe("Display modes the app supports.")
|
|
188
193
|
});
|
|
189
194
|
object({
|
|
190
195
|
method: literal("ui/notifications/initialized"),
|
|
@@ -212,9 +217,9 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
212
217
|
});
|
|
213
218
|
object({
|
|
214
219
|
method: literal("ui/request-display-mode"),
|
|
215
|
-
params: object({ mode:
|
|
220
|
+
params: object({ mode: W$1.describe("The display mode being requested.") })
|
|
216
221
|
});
|
|
217
|
-
object({ mode:
|
|
222
|
+
object({ mode: W$1.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
|
|
218
223
|
var p$1 = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool.");
|
|
219
224
|
object({
|
|
220
225
|
resourceUri: string().optional(),
|
|
@@ -254,8 +259,8 @@ var g$1 = object({
|
|
|
254
259
|
}).optional().describe("Metadata of the tool call that instantiated this App."),
|
|
255
260
|
theme: m$1.optional().describe("Current color theme preference."),
|
|
256
261
|
styles: r$2.optional().describe("Style configuration for theming the app."),
|
|
257
|
-
displayMode:
|
|
258
|
-
availableDisplayModes: array(
|
|
262
|
+
displayMode: W$1.optional().describe("How the UI is currently displayed."),
|
|
263
|
+
availableDisplayModes: array(W$1).optional().describe("Display modes the host supports."),
|
|
259
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
|
|
260
265
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),
|
|
261
266
|
locale: string().optional().describe("User's language and region preference in BCP 47 format."),
|
|
@@ -299,7 +304,7 @@ object({
|
|
|
299
304
|
object({
|
|
300
305
|
protocolVersion: string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
|
|
301
306
|
hostInfo: ImplementationSchema.describe("Host application identification and version."),
|
|
302
|
-
hostCapabilities: l
|
|
307
|
+
hostCapabilities: l.describe("Features and capabilities provided by the host."),
|
|
303
308
|
hostContext: g$1.describe("Rich context about the host environment.")
|
|
304
309
|
}).passthrough();
|
|
305
310
|
function O$1() {
|
|
@@ -319,13 +324,13 @@ function I$1(K) {
|
|
|
319
324
|
let X = document.createElement("style");
|
|
320
325
|
X.id = "__mcp-host-fonts", X.textContent = K, document.head.appendChild(X);
|
|
321
326
|
}
|
|
322
|
-
function
|
|
327
|
+
function eK(K, Q) {
|
|
323
328
|
useEffect(() => {
|
|
324
329
|
if (!K) return;
|
|
325
330
|
return K.setupSizeChangedNotifications();
|
|
326
331
|
}, [K, Q]);
|
|
327
332
|
}
|
|
328
|
-
function
|
|
333
|
+
function XQ() {
|
|
329
334
|
let [K, Q] = useState(O$1);
|
|
330
335
|
return useEffect(() => {
|
|
331
336
|
let X = new MutationObserver(() => {
|
|
@@ -340,7 +345,7 @@ function JQ() {
|
|
|
340
345
|
}), () => X.disconnect();
|
|
341
346
|
}, []), K;
|
|
342
347
|
}
|
|
343
|
-
function
|
|
348
|
+
function rJ(K, Q) {
|
|
344
349
|
let X = useRef(!1);
|
|
345
350
|
useEffect(() => {
|
|
346
351
|
if (X.current) return;
|
|
@@ -355,7 +360,7 @@ function mJ(K, Q) {
|
|
|
355
360
|
};
|
|
356
361
|
}, [K]);
|
|
357
362
|
}
|
|
358
|
-
function
|
|
363
|
+
function lJ(K, Q) {
|
|
359
364
|
let X = useRef(!1);
|
|
360
365
|
useEffect(() => {
|
|
361
366
|
if (X.current) return;
|
|
@@ -367,8 +372,8 @@ function cJ(K, Q) {
|
|
|
367
372
|
};
|
|
368
373
|
}, [K]);
|
|
369
374
|
}
|
|
370
|
-
function
|
|
371
|
-
|
|
375
|
+
function GQ(K, Q) {
|
|
376
|
+
rJ(K, Q), lJ(K, Q);
|
|
372
377
|
}
|
|
373
378
|
//#endregion
|
|
374
379
|
//#region src/hooks/use-host-context.ts
|
|
@@ -387,8 +392,8 @@ var registries$1 = /* @__PURE__ */ new WeakMap();
|
|
|
387
392
|
* Host-provided variables override defaults since they're applied after.
|
|
388
393
|
*/
|
|
389
394
|
function applyStyles(variables) {
|
|
390
|
-
|
|
391
|
-
if (variables)
|
|
395
|
+
TQ(DEFAULT_STYLE_VARIABLES);
|
|
396
|
+
if (variables) TQ(variables);
|
|
392
397
|
}
|
|
393
398
|
function getRegistry$1(app) {
|
|
394
399
|
let subs = registries$1.get(app);
|
|
@@ -396,15 +401,15 @@ function getRegistry$1(app) {
|
|
|
396
401
|
subs = /* @__PURE__ */ new Set();
|
|
397
402
|
registries$1.set(app, subs);
|
|
398
403
|
const ctx = app.getHostContext();
|
|
399
|
-
if (ctx?.theme)
|
|
404
|
+
if (ctx?.theme) qQ(ctx.theme);
|
|
400
405
|
applyStyles(ctx?.styles?.variables);
|
|
401
|
-
if (ctx?.styles?.css?.fonts)
|
|
406
|
+
if (ctx?.styles?.css?.fonts) RQ(ctx.styles.css.fonts);
|
|
402
407
|
let debounceTimer = null;
|
|
403
408
|
app.onhostcontextchanged = () => {
|
|
404
409
|
const ctx = app.getHostContext();
|
|
405
|
-
if (ctx?.theme)
|
|
410
|
+
if (ctx?.theme) qQ(ctx.theme);
|
|
406
411
|
applyStyles(ctx?.styles?.variables);
|
|
407
|
-
if (ctx?.styles?.css?.fonts)
|
|
412
|
+
if (ctx?.styles?.css?.fonts) RQ(ctx.styles.css.fonts);
|
|
408
413
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
409
414
|
debounceTimer = setTimeout(() => {
|
|
410
415
|
debounceTimer = null;
|
|
@@ -879,6 +884,38 @@ function useRequestDisplayMode() {
|
|
|
879
884
|
};
|
|
880
885
|
}
|
|
881
886
|
//#endregion
|
|
887
|
+
//#region src/hooks/use-request-teardown.ts
|
|
888
|
+
/**
|
|
889
|
+
* Hook to request the host to tear down this app.
|
|
890
|
+
*
|
|
891
|
+
* Sends a notification to the host requesting that it initiate teardown.
|
|
892
|
+
* If the host approves, it will send the standard teardown request back
|
|
893
|
+
* to the app (triggering any `useTeardown` callbacks) before unmounting.
|
|
894
|
+
*
|
|
895
|
+
* @example
|
|
896
|
+
* ```tsx
|
|
897
|
+
* function MyApp() {
|
|
898
|
+
* const requestTeardown = useRequestTeardown();
|
|
899
|
+
*
|
|
900
|
+
* return (
|
|
901
|
+
* <button onClick={() => requestTeardown()}>
|
|
902
|
+
* Close App
|
|
903
|
+
* </button>
|
|
904
|
+
* );
|
|
905
|
+
* }
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
function useRequestTeardown() {
|
|
909
|
+
const app = useApp();
|
|
910
|
+
return useCallback(async () => {
|
|
911
|
+
if (!app) {
|
|
912
|
+
console.warn("[useRequestTeardown] App not connected");
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
await app.requestTeardown();
|
|
916
|
+
}, [app]);
|
|
917
|
+
}
|
|
918
|
+
//#endregion
|
|
882
919
|
//#region src/hooks/use-send-log.ts
|
|
883
920
|
/**
|
|
884
921
|
* Hook to send structured log messages to the host.
|
|
@@ -3168,6 +3205,6 @@ var prefersReducedMotion = createMediaQueryFn("(prefers-reduced-motion: reduce)"
|
|
|
3168
3205
|
var isPrimarilyTouchDevice = createMediaQueryFn("(pointer: coarse)");
|
|
3169
3206
|
var isHoverAvailable = createMediaQueryFn("(hover: hover)");
|
|
3170
3207
|
//#endregion
|
|
3171
|
-
export {
|
|
3208
|
+
export { gQ as App, AppProvider, h as DOWNLOAD_FILE_METHOD, a as HOST_CONTEXT_CHANGED_METHOD, e as INITIALIZED_METHOD, t as INITIALIZE_METHOD, W as LATEST_PROTOCOL_VERSION, m as MESSAGE_METHOD, g as McpUiAppCapabilitiesSchema, J as McpUiDisplayModeSchema, OQ as McpUiDownloadFileRequestSchema, _ as McpUiDownloadFileResultSchema, x as McpUiHostCapabilitiesSchema, R as McpUiHostContextChangedNotificationSchema, T as McpUiHostContextSchema, k as McpUiHostCssSchema, C as McpUiHostStylesSchema, FQ as McpUiInitializeRequestSchema, U as McpUiInitializeResultSchema, zQ as McpUiInitializedNotificationSchema, IQ as McpUiMessageRequestSchema, O as McpUiMessageResultSchema, VQ as McpUiOpenLinkRequestSchema, B as McpUiOpenLinkResultSchema, BQ as McpUiRequestDisplayModeRequestSchema, P as McpUiRequestDisplayModeResultSchema, WQ as McpUiRequestTeardownNotificationSchema, G as McpUiResourceCspSchema, LQ as McpUiResourceMetaSchema, V as McpUiResourcePermissionsSchema, F as McpUiResourceTeardownRequestSchema, EQ as McpUiResourceTeardownResultSchema, jQ as McpUiSizeChangedNotificationSchema, L as McpUiSupportedContentBlockModalitiesSchema, b as McpUiThemeSchema, A as McpUiToolCancelledNotificationSchema, I as McpUiToolInputNotificationSchema, w as McpUiToolInputPartialNotificationSchema, _Q as McpUiToolMetaSchema, q as McpUiToolResultNotificationSchema, S as McpUiToolVisibilitySchema, AQ as McpUiUpdateModelContextRequestSchema, d as OPEN_LINK_METHOD, K as PostMessageTransport, QQ as REQUEST_DISPLAY_MODE_METHOD, o as REQUEST_TEARDOWN_METHOD, vX as RESOURCE_MIME_TYPE, s as RESOURCE_TEARDOWN_METHOD, MX as RESOURCE_URI_META_KEY, r as SIZE_CHANGED_METHOD, SafeArea, n as TOOL_CANCELLED_METHOD, p as TOOL_INPUT_METHOD, z as TOOL_INPUT_PARTIAL_METHOD, c as TOOL_RESULT_METHOD, qQ as applyDocumentTheme, RQ as applyHostFonts, TQ as applyHostStyleVariables, chatgpt_exports as chatgpt, cn, detectHost, PQ as getDocumentTheme, inspector_exports as inspector, isChatGPT, isClaude, isHoverAvailable, isPrimarilyTouchDevice, prefersReducedMotion, useApp, useAppState, useAppTools, eK as useAutoResize, useCallServerTool, useDeviceCapabilities, useDisplayMode, XQ as useDocumentTheme, useDownloadFile, useHostContext, lJ as useHostFonts, useHostInfo, rJ as useHostStyleVariables, GQ as useHostStyles, useIsMobile, useListServerResources, useLocale, useOpenLink, usePlatform, useReadServerResource, useRequestDisplayMode, useRequestTeardown, useSafeArea, useSendLog, useSendMessage, useStyles, useTeardown, useTheme, useTimeZone, useToolData, useToolInfo, useUpdateModelContext, useUserAgent, useViewport };
|
|
3172
3209
|
|
|
3173
3210
|
//# sourceMappingURL=index.js.map
|