sunpeak 0.19.1 → 0.19.4
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 -3
- package/bin/commands/new.mjs +3 -1
- package/bin/commands/test.mjs +107 -46
- package/bin/lib/inspect/inspect-config.d.mts +4 -0
- package/bin/lib/inspect/inspect-config.mjs +2 -0
- package/bin/lib/test/base-config.mjs +16 -1
- package/bin/lib/test/test-config.d.mts +22 -0
- package/bin/lib/test/test-config.mjs +2 -0
- package/bin/lib/test/test-fixtures.d.mts +34 -1
- package/bin/lib/test/test-fixtures.mjs +43 -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-Bp9jrHIu.js} +218 -80
- package/dist/inspector-Bp9jrHIu.js.map +1 -0
- package/dist/{inspector-8nPV2A-z.cjs → inspector-Cvq3yjNL.cjs} +219 -81
- package/dist/inspector-Cvq3yjNL.cjs.map +1 -0
- package/dist/mcp/index.cjs +235 -138
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +228 -132
- 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-Ck5kR1Sf.js} +193 -93
- package/dist/use-app-Ck5kR1Sf.js.map +1 -0
- package/dist/{use-app-CzcYw1Kz.cjs → use-app-DHYiev3D.cjs} +253 -147
- package/dist/use-app-DHYiev3D.cjs.map +1 -0
- package/package.json +2 -2
- package/template/README.md +6 -3
- 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/.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 +24 -24
- 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/package.json +5 -3
- package/template/test-results/.last-run.json +4 -0
- package/template/tests/e2e/visual.spec.ts +36 -0
- 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-chatgpt-linux.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-dark-claude-linux.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-chatgpt-linux.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-fullscreen-claude-linux.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-chatgpt-linux.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-light-claude-linux.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-chatgpt-linux.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-claude-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-claude-linux.png +0 -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
|
@@ -1,12 +1,69 @@
|
|
|
1
1
|
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";
|
|
2
|
-
import { C as
|
|
3
|
-
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.
|
|
4
|
-
var
|
|
5
|
-
|
|
2
|
+
import { C as ResourceLinkSchema, E as ToolSchema, S as RequestIdSchema, T as ToolListChangedNotificationSchema, _ as LoggingMessageNotificationSchema, a as EmbeddedResourceSchema, b as ReadResourceRequestSchema, c as JSONRPCMessageSchema, d as ListResourceTemplatesRequestSchema, f as ListResourceTemplatesResultSchema, g as ListToolsResultSchema, i as ContentBlockSchema, l as ListPromptsRequestSchema, m as ListResourcesResultSchema, n as CallToolRequestSchema, p as ListResourcesRequestSchema, r as CallToolResultSchema, s as ImplementationSchema, t as Protocol, u as ListPromptsResultSchema, v as PingRequestSchema, w as ResourceListChangedNotificationSchema, x as ReadResourceResultSchema, y as PromptListChangedNotificationSchema } from "./protocol-BqGB4zBx.js";
|
|
3
|
+
//#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/app-bridge.js
|
|
4
|
+
var j = class extends Protocol {
|
|
5
|
+
_registeredMethods = /* @__PURE__ */ new Set();
|
|
6
|
+
_eventSlots = /* @__PURE__ */ new Map();
|
|
7
|
+
onEventDispatch(X, Y) {}
|
|
8
|
+
_ensureEventSlot(X) {
|
|
9
|
+
let Y = this._eventSlots.get(X);
|
|
10
|
+
if (!Y) {
|
|
11
|
+
let Z = this.eventSchemas[X];
|
|
12
|
+
if (!Z) throw Error(`Unknown event: ${String(X)}`);
|
|
13
|
+
Y = { listeners: [] }, this._eventSlots.set(X, Y);
|
|
14
|
+
let $ = Z.shape.method.value;
|
|
15
|
+
this._registeredMethods.add($);
|
|
16
|
+
let J = Y;
|
|
17
|
+
super.setNotificationHandler(Z, (K) => {
|
|
18
|
+
let N = K.params;
|
|
19
|
+
this.onEventDispatch(X, N), J.onHandler?.(N);
|
|
20
|
+
for (let W of [...J.listeners]) W(N);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return Y;
|
|
24
|
+
}
|
|
25
|
+
setEventHandler(X, Y) {
|
|
26
|
+
let Z = this._ensureEventSlot(X);
|
|
27
|
+
if (Z.onHandler && Y) console.warn(`[MCP Apps] on${String(X)} handler replaced. Use addEventListener("${String(X)}", …) to add multiple listeners without replacing.`);
|
|
28
|
+
Z.onHandler = Y;
|
|
29
|
+
}
|
|
30
|
+
getEventHandler(X) {
|
|
31
|
+
return this._eventSlots.get(X)?.onHandler;
|
|
32
|
+
}
|
|
33
|
+
addEventListener(X, Y) {
|
|
34
|
+
this._ensureEventSlot(X).listeners.push(Y);
|
|
35
|
+
}
|
|
36
|
+
removeEventListener(X, Y) {
|
|
37
|
+
let Z = this._eventSlots.get(X);
|
|
38
|
+
if (!Z) return;
|
|
39
|
+
let $ = Z.listeners.indexOf(Y);
|
|
40
|
+
if ($ !== -1) Z.listeners.splice($, 1);
|
|
41
|
+
}
|
|
42
|
+
setRequestHandler = (X, Y) => {
|
|
43
|
+
this._assertMethodNotRegistered(X, "setRequestHandler"), super.setRequestHandler(X, Y);
|
|
44
|
+
};
|
|
45
|
+
setNotificationHandler = (X, Y) => {
|
|
46
|
+
this._assertMethodNotRegistered(X, "setNotificationHandler"), super.setNotificationHandler(X, Y);
|
|
47
|
+
};
|
|
48
|
+
warnIfRequestHandlerReplaced(X, Y, Z) {
|
|
49
|
+
if (Y && Z) console.warn(`[MCP Apps] ${X} handler replaced. Previous handler will no longer be called.`);
|
|
50
|
+
}
|
|
51
|
+
replaceRequestHandler = (X, Y) => {
|
|
52
|
+
let Z = X.shape.method.value;
|
|
53
|
+
this._registeredMethods.add(Z), super.setRequestHandler(X, Y);
|
|
54
|
+
};
|
|
55
|
+
_assertMethodNotRegistered(X, Y) {
|
|
56
|
+
let Z = X.shape.method.value;
|
|
57
|
+
if (this._registeredMethods.has(Z)) throw Error(`Handler for "${Z}" already registered (via ${Y}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);
|
|
58
|
+
this._registeredMethods.add(Z);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var G = "2026-01-26", a = "ui/open-link", e = "ui/download-file", QQ = "ui/message", XQ = "ui/notifications/sandbox-proxy-ready", YQ = "ui/notifications/sandbox-resource-ready", ZQ = "ui/notifications/size-changed", $Q = "ui/notifications/tool-input", V = "ui/notifications/tool-input-partial", JQ = "ui/notifications/tool-result", KQ = "ui/notifications/tool-cancelled", GQ = "ui/notifications/host-context-changed", DQ = "ui/notifications/request-teardown", NQ = "ui/resource-teardown", WQ = "ui/initialize", jQ = "ui/notifications/initialized", zQ = "ui/request-display-mode";
|
|
62
|
+
var p = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), D = union([
|
|
6
63
|
literal("inline"),
|
|
7
64
|
literal("fullscreen"),
|
|
8
65
|
literal("pip")
|
|
9
|
-
]).describe("Display mode for UI presentation."),
|
|
66
|
+
]).describe("Display mode for UI presentation."), AQ = record(union([
|
|
10
67
|
literal("--color-background-primary"),
|
|
11
68
|
literal("--color-background-secondary"),
|
|
12
69
|
literal("--color-background-tertiary"),
|
|
@@ -101,13 +158,13 @@ Individual style keys are optional - hosts may provide any subset of these value
|
|
|
101
158
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
102
159
|
|
|
103
160
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
104
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
161
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`), A = object({
|
|
105
162
|
method: literal("ui/open-link"),
|
|
106
163
|
params: object({ url: string().describe("URL to open in the host's browser") })
|
|
107
|
-
}),
|
|
164
|
+
}), F = object({ isError: boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough(), L = object({ isError: boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough(), P = object({ isError: boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough(), T = object({
|
|
108
165
|
method: literal("ui/notifications/sandbox-proxy-ready"),
|
|
109
166
|
params: object({})
|
|
110
|
-
}),
|
|
167
|
+
}), B = object({
|
|
111
168
|
connectDomains: array(string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
112
169
|
|
|
113
170
|
- Maps to CSP \`connect-src\` directive
|
|
@@ -115,43 +172,43 @@ for compatibility with Zod schema generation. Both are functionally equivalent f
|
|
|
115
172
|
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)"),
|
|
116
173
|
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'`)"),
|
|
117
174
|
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'`)")
|
|
118
|
-
}),
|
|
175
|
+
}), E = object({
|
|
119
176
|
camera: object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),
|
|
120
177
|
microphone: object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),
|
|
121
178
|
geolocation: object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),
|
|
122
179
|
clipboardWrite: object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")
|
|
123
|
-
}),
|
|
180
|
+
}), w = object({
|
|
124
181
|
method: literal("ui/notifications/size-changed"),
|
|
125
182
|
params: object({
|
|
126
183
|
width: number().optional().describe("New width in pixels."),
|
|
127
184
|
height: number().optional().describe("New height in pixels.")
|
|
128
185
|
})
|
|
129
|
-
}),
|
|
186
|
+
}), R = object({
|
|
130
187
|
method: literal("ui/notifications/tool-input"),
|
|
131
188
|
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.") })
|
|
132
|
-
}),
|
|
189
|
+
}), U = object({
|
|
133
190
|
method: literal("ui/notifications/tool-input-partial"),
|
|
134
191
|
params: object({ arguments: record(string(), unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).") })
|
|
135
|
-
}),
|
|
192
|
+
}), H = object({
|
|
136
193
|
method: literal("ui/notifications/tool-cancelled"),
|
|
137
194
|
params: object({ reason: string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
|
|
138
|
-
}),
|
|
139
|
-
variables:
|
|
140
|
-
css:
|
|
141
|
-
}),
|
|
195
|
+
}), n = object({ fonts: string().optional() }), c = object({
|
|
196
|
+
variables: AQ.optional().describe("CSS variables for theming the app."),
|
|
197
|
+
css: n.optional().describe("CSS blocks that apps can inject.")
|
|
198
|
+
}), M = object({
|
|
142
199
|
method: literal("ui/resource-teardown"),
|
|
143
200
|
params: object({})
|
|
144
|
-
}),
|
|
201
|
+
}), g = record(string(), unknown()), I = object({
|
|
145
202
|
text: object({}).optional().describe("Host supports text content blocks."),
|
|
146
203
|
image: object({}).optional().describe("Host supports image content blocks."),
|
|
147
204
|
audio: object({}).optional().describe("Host supports audio content blocks."),
|
|
148
205
|
resource: object({}).optional().describe("Host supports resource content blocks."),
|
|
149
206
|
resourceLink: object({}).optional().describe("Host supports resource link content blocks."),
|
|
150
207
|
structuredContent: object({}).optional().describe("Host supports structured content.")
|
|
151
|
-
}),
|
|
208
|
+
}), C = object({
|
|
152
209
|
method: literal("ui/notifications/request-teardown"),
|
|
153
210
|
params: object({}).optional()
|
|
154
|
-
}),
|
|
211
|
+
}), r = object({
|
|
155
212
|
experimental: object({}).optional().describe("Experimental features (structure TBD)."),
|
|
156
213
|
openLinks: object({}).optional().describe("Host supports opening external URLs."),
|
|
157
214
|
downloadFile: object({}).optional().describe("Host supports file downloads via ui/download-file."),
|
|
@@ -159,21 +216,21 @@ for compatibility with Zod schema generation. Both are functionally equivalent f
|
|
|
159
216
|
serverResources: object({ listChanged: boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
|
|
160
217
|
logging: object({}).optional().describe("Host accepts log messages."),
|
|
161
218
|
sandbox: object({
|
|
162
|
-
permissions:
|
|
163
|
-
csp:
|
|
219
|
+
permissions: E.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
|
|
220
|
+
csp: B.optional().describe("CSP domains approved by the host.")
|
|
164
221
|
}).optional().describe("Sandbox configuration applied by the host."),
|
|
165
|
-
updateModelContext:
|
|
166
|
-
message:
|
|
167
|
-
}),
|
|
222
|
+
updateModelContext: I.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
|
|
223
|
+
message: I.optional().describe("Host supports receiving content messages (ui/message) from the view.")
|
|
224
|
+
}), l = object({
|
|
168
225
|
experimental: object({}).optional().describe("Experimental features (structure TBD)."),
|
|
169
226
|
tools: object({ listChanged: boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
|
|
170
|
-
availableDisplayModes: array(
|
|
171
|
-
}),
|
|
227
|
+
availableDisplayModes: array(D).optional().describe("Display modes the app supports.")
|
|
228
|
+
}), S = object({
|
|
172
229
|
method: literal("ui/notifications/initialized"),
|
|
173
230
|
params: object({}).optional()
|
|
174
|
-
}),
|
|
175
|
-
csp:
|
|
176
|
-
permissions:
|
|
231
|
+
}), FQ = object({
|
|
232
|
+
csp: B.optional().describe("Content Security Policy configuration for UI resources."),
|
|
233
|
+
permissions: E.optional().describe("Sandbox permissions requested by the UI resource."),
|
|
177
234
|
domain: string().optional().describe(`Dedicated origin for view sandbox.
|
|
178
235
|
|
|
179
236
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
@@ -190,45 +247,45 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
190
247
|
- \`true\`: request visible border + background
|
|
191
248
|
- \`false\`: request no visible border + background
|
|
192
249
|
- omitted: host decides border`)
|
|
193
|
-
}),
|
|
250
|
+
}), _ = object({
|
|
194
251
|
method: literal("ui/request-display-mode"),
|
|
195
|
-
params: object({ mode:
|
|
196
|
-
}),
|
|
252
|
+
params: object({ mode: D.describe("The display mode being requested.") })
|
|
253
|
+
}), q = object({ mode: D.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough(), o = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool."), LQ = object({
|
|
197
254
|
resourceUri: string().optional(),
|
|
198
|
-
visibility: array(
|
|
255
|
+
visibility: array(o).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
199
256
|
- "model": Tool visible to and callable by the agent
|
|
200
257
|
- "app": Tool callable by the app from this server only`)
|
|
201
258
|
});
|
|
202
259
|
object({ mimeTypes: array(string()).optional().describe("Array of supported MIME types for UI resources.\nMust include `\"text/html;profile=mcp-app\"` for MCP Apps support.") });
|
|
203
|
-
var
|
|
260
|
+
var f = object({
|
|
204
261
|
method: literal("ui/download-file"),
|
|
205
262
|
params: object({ contents: array(union([EmbeddedResourceSchema, ResourceLinkSchema])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.") })
|
|
206
|
-
}),
|
|
263
|
+
}), y = object({
|
|
207
264
|
method: literal("ui/message"),
|
|
208
265
|
params: object({
|
|
209
266
|
role: literal("user").describe("Message role, currently only \"user\" is supported."),
|
|
210
267
|
content: array(ContentBlockSchema).describe("Message content blocks (text, image, etc.).")
|
|
211
268
|
})
|
|
212
|
-
}),
|
|
269
|
+
}), PQ = object({
|
|
213
270
|
method: literal("ui/notifications/sandbox-resource-ready"),
|
|
214
271
|
params: object({
|
|
215
272
|
html: string().describe("HTML content to load into the inner iframe."),
|
|
216
273
|
sandbox: string().optional().describe("Optional override for the inner iframe's sandbox attribute."),
|
|
217
|
-
csp:
|
|
218
|
-
permissions:
|
|
274
|
+
csp: B.optional().describe("CSP configuration from resource metadata."),
|
|
275
|
+
permissions: E.optional().describe("Sandbox permissions from resource metadata.")
|
|
219
276
|
})
|
|
220
|
-
}),
|
|
277
|
+
}), v = object({
|
|
221
278
|
method: literal("ui/notifications/tool-result"),
|
|
222
279
|
params: CallToolResultSchema.describe("Standard MCP tool execution result.")
|
|
223
|
-
}),
|
|
280
|
+
}), x = object({
|
|
224
281
|
toolInfo: object({
|
|
225
282
|
id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."),
|
|
226
283
|
tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.")
|
|
227
284
|
}).optional().describe("Metadata of the tool call that instantiated this App."),
|
|
228
|
-
theme:
|
|
285
|
+
theme: p.optional().describe("Current color theme preference."),
|
|
229
286
|
styles: c.optional().describe("Style configuration for theming the app."),
|
|
230
|
-
displayMode:
|
|
231
|
-
availableDisplayModes: array(
|
|
287
|
+
displayMode: D.optional().describe("How the UI is currently displayed."),
|
|
288
|
+
availableDisplayModes: array(D).optional().describe("Display modes the host supports."),
|
|
232
289
|
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
|
|
233
290
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),
|
|
234
291
|
locale: string().optional().describe("User's language and region preference in BCP 47 format."),
|
|
@@ -251,27 +308,27 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
251
308
|
}).optional().describe("Mobile safe area boundaries in pixels.")
|
|
252
309
|
}).passthrough(), k = object({
|
|
253
310
|
method: literal("ui/notifications/host-context-changed"),
|
|
254
|
-
params:
|
|
255
|
-
}),
|
|
311
|
+
params: x.describe("Partial context update containing only changed fields.")
|
|
312
|
+
}), d = object({
|
|
256
313
|
method: literal("ui/update-model-context"),
|
|
257
314
|
params: object({
|
|
258
315
|
content: array(ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."),
|
|
259
316
|
structuredContent: record(string(), unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")
|
|
260
317
|
})
|
|
261
|
-
}),
|
|
318
|
+
}), b = object({
|
|
262
319
|
method: literal("ui/initialize"),
|
|
263
320
|
params: object({
|
|
264
321
|
appInfo: ImplementationSchema.describe("App identification (name and version)."),
|
|
265
|
-
appCapabilities:
|
|
322
|
+
appCapabilities: l.describe("Features and capabilities this app provides."),
|
|
266
323
|
protocolVersion: string().describe("Protocol version this app supports.")
|
|
267
324
|
})
|
|
268
|
-
}),
|
|
325
|
+
}), u = object({
|
|
269
326
|
protocolVersion: string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
|
|
270
327
|
hostInfo: ImplementationSchema.describe("Host application identification and version."),
|
|
271
|
-
hostCapabilities:
|
|
272
|
-
hostContext:
|
|
328
|
+
hostCapabilities: r.describe("Features and capabilities provided by the host."),
|
|
329
|
+
hostContext: x.describe("Rich context about the host environment.")
|
|
273
330
|
}).passthrough();
|
|
274
|
-
var
|
|
331
|
+
var z = class {
|
|
275
332
|
eventTarget;
|
|
276
333
|
eventSource;
|
|
277
334
|
messageListener;
|
|
@@ -305,26 +362,26 @@ var D = class {
|
|
|
305
362
|
sessionId;
|
|
306
363
|
setProtocolVersion;
|
|
307
364
|
};
|
|
308
|
-
var
|
|
309
|
-
function
|
|
365
|
+
var h = "ui/resourceUri", SQ = "text/html;profile=mcp-app";
|
|
366
|
+
function nY(X) {
|
|
310
367
|
let Z = X._meta?.ui?.resourceUri;
|
|
311
|
-
if (Z === void 0) Z = X._meta?.[
|
|
368
|
+
if (Z === void 0) Z = X._meta?.[h];
|
|
312
369
|
if (typeof Z === "string" && Z.startsWith("ui://")) return Z;
|
|
313
370
|
else if (Z !== void 0) throw Error(`Invalid UI resource URI: ${JSON.stringify(Z)}`);
|
|
314
371
|
}
|
|
315
|
-
function
|
|
372
|
+
function cY(X) {
|
|
316
373
|
let Z = X._meta?.ui?.visibility;
|
|
317
374
|
if (!Z) return !1;
|
|
318
375
|
if (Z.length === 1 && Z[0] === "model") return !0;
|
|
319
376
|
return !1;
|
|
320
377
|
}
|
|
321
|
-
function
|
|
378
|
+
function rY(X) {
|
|
322
379
|
let Z = X._meta?.ui?.visibility;
|
|
323
380
|
if (!Z) return !1;
|
|
324
381
|
if (Z.length === 1 && Z[0] === "app") return !0;
|
|
325
382
|
return !1;
|
|
326
383
|
}
|
|
327
|
-
function
|
|
384
|
+
function lY(X) {
|
|
328
385
|
if (!X) return "";
|
|
329
386
|
let Y = [];
|
|
330
387
|
if (X.camera) Y.push("camera");
|
|
@@ -334,21 +391,28 @@ function nY(X) {
|
|
|
334
391
|
return Y.join("; ");
|
|
335
392
|
}
|
|
336
393
|
var lQ = [G];
|
|
337
|
-
var
|
|
394
|
+
var oQ = class extends j {
|
|
338
395
|
_client;
|
|
339
396
|
_hostInfo;
|
|
340
397
|
_capabilities;
|
|
341
398
|
_appCapabilities;
|
|
342
399
|
_hostContext = {};
|
|
343
400
|
_appInfo;
|
|
401
|
+
eventSchemas = {
|
|
402
|
+
sizechange: w,
|
|
403
|
+
sandboxready: T,
|
|
404
|
+
initialized: S,
|
|
405
|
+
requestteardown: C,
|
|
406
|
+
loggingmessage: LoggingMessageNotificationSchema
|
|
407
|
+
};
|
|
344
408
|
constructor(X, Y, Z, $) {
|
|
345
409
|
super($);
|
|
346
410
|
this._client = X;
|
|
347
411
|
this._hostInfo = Y;
|
|
348
412
|
this._capabilities = Z;
|
|
349
|
-
this._hostContext = $?.hostContext || {}, this.setRequestHandler(
|
|
413
|
+
this._hostContext = $?.hostContext || {}, this.setRequestHandler(b, (J) => this._oninitialize(J)), this.setRequestHandler(PingRequestSchema, (J, K) => {
|
|
350
414
|
return this.onping?.(J.params, K), {};
|
|
351
|
-
}), this.
|
|
415
|
+
}), this.replaceRequestHandler(_, (J) => {
|
|
352
416
|
return { mode: this._hostContext.displayMode ?? "inline" };
|
|
353
417
|
});
|
|
354
418
|
}
|
|
@@ -359,51 +423,94 @@ var rQ = class extends Protocol {
|
|
|
359
423
|
return this._appInfo;
|
|
360
424
|
}
|
|
361
425
|
onping;
|
|
426
|
+
get onsizechange() {
|
|
427
|
+
return this.getEventHandler("sizechange");
|
|
428
|
+
}
|
|
362
429
|
set onsizechange(X) {
|
|
363
|
-
this.
|
|
430
|
+
this.setEventHandler("sizechange", X);
|
|
431
|
+
}
|
|
432
|
+
get onsandboxready() {
|
|
433
|
+
return this.getEventHandler("sandboxready");
|
|
364
434
|
}
|
|
365
435
|
set onsandboxready(X) {
|
|
366
|
-
this.
|
|
436
|
+
this.setEventHandler("sandboxready", X);
|
|
437
|
+
}
|
|
438
|
+
get oninitialized() {
|
|
439
|
+
return this.getEventHandler("initialized");
|
|
367
440
|
}
|
|
368
441
|
set oninitialized(X) {
|
|
369
|
-
this.
|
|
442
|
+
this.setEventHandler("initialized", X);
|
|
443
|
+
}
|
|
444
|
+
_onmessage;
|
|
445
|
+
get onmessage() {
|
|
446
|
+
return this._onmessage;
|
|
370
447
|
}
|
|
371
448
|
set onmessage(X) {
|
|
372
|
-
this.
|
|
373
|
-
|
|
449
|
+
this.warnIfRequestHandlerReplaced("onmessage", this._onmessage, X), this._onmessage = X, this.replaceRequestHandler(y, async (Y, Z) => {
|
|
450
|
+
if (!this._onmessage) throw Error("No onmessage handler set");
|
|
451
|
+
return this._onmessage(Y.params, Z);
|
|
374
452
|
});
|
|
375
453
|
}
|
|
454
|
+
_onopenlink;
|
|
455
|
+
get onopenlink() {
|
|
456
|
+
return this._onopenlink;
|
|
457
|
+
}
|
|
376
458
|
set onopenlink(X) {
|
|
377
|
-
this.
|
|
378
|
-
|
|
459
|
+
this.warnIfRequestHandlerReplaced("onopenlink", this._onopenlink, X), this._onopenlink = X, this.replaceRequestHandler(A, async (Y, Z) => {
|
|
460
|
+
if (!this._onopenlink) throw Error("No onopenlink handler set");
|
|
461
|
+
return this._onopenlink(Y.params, Z);
|
|
379
462
|
});
|
|
380
463
|
}
|
|
464
|
+
_ondownloadfile;
|
|
465
|
+
get ondownloadfile() {
|
|
466
|
+
return this._ondownloadfile;
|
|
467
|
+
}
|
|
381
468
|
set ondownloadfile(X) {
|
|
382
|
-
this.
|
|
383
|
-
|
|
469
|
+
this.warnIfRequestHandlerReplaced("ondownloadfile", this._ondownloadfile, X), this._ondownloadfile = X, this.replaceRequestHandler(f, async (Y, Z) => {
|
|
470
|
+
if (!this._ondownloadfile) throw Error("No ondownloadfile handler set");
|
|
471
|
+
return this._ondownloadfile(Y.params, Z);
|
|
384
472
|
});
|
|
385
473
|
}
|
|
474
|
+
get onrequestteardown() {
|
|
475
|
+
return this.getEventHandler("requestteardown");
|
|
476
|
+
}
|
|
386
477
|
set onrequestteardown(X) {
|
|
387
|
-
this.
|
|
478
|
+
this.setEventHandler("requestteardown", X);
|
|
479
|
+
}
|
|
480
|
+
_onrequestdisplaymode;
|
|
481
|
+
get onrequestdisplaymode() {
|
|
482
|
+
return this._onrequestdisplaymode;
|
|
388
483
|
}
|
|
389
484
|
set onrequestdisplaymode(X) {
|
|
390
|
-
this.
|
|
391
|
-
|
|
485
|
+
this.warnIfRequestHandlerReplaced("onrequestdisplaymode", this._onrequestdisplaymode, X), this._onrequestdisplaymode = X, this.replaceRequestHandler(_, async (Y, Z) => {
|
|
486
|
+
if (!this._onrequestdisplaymode) throw Error("No onrequestdisplaymode handler set");
|
|
487
|
+
return this._onrequestdisplaymode(Y.params, Z);
|
|
392
488
|
});
|
|
393
489
|
}
|
|
490
|
+
get onloggingmessage() {
|
|
491
|
+
return this.getEventHandler("loggingmessage");
|
|
492
|
+
}
|
|
394
493
|
set onloggingmessage(X) {
|
|
395
|
-
this.
|
|
396
|
-
|
|
397
|
-
|
|
494
|
+
this.setEventHandler("loggingmessage", X);
|
|
495
|
+
}
|
|
496
|
+
_onupdatemodelcontext;
|
|
497
|
+
get onupdatemodelcontext() {
|
|
498
|
+
return this._onupdatemodelcontext;
|
|
398
499
|
}
|
|
399
500
|
set onupdatemodelcontext(X) {
|
|
400
|
-
this.
|
|
401
|
-
|
|
501
|
+
this.warnIfRequestHandlerReplaced("onupdatemodelcontext", this._onupdatemodelcontext, X), this._onupdatemodelcontext = X, this.replaceRequestHandler(d, async (Y, Z) => {
|
|
502
|
+
if (!this._onupdatemodelcontext) throw Error("No onupdatemodelcontext handler set");
|
|
503
|
+
return this._onupdatemodelcontext(Y.params, Z);
|
|
402
504
|
});
|
|
403
505
|
}
|
|
506
|
+
_oncalltool;
|
|
507
|
+
get oncalltool() {
|
|
508
|
+
return this._oncalltool;
|
|
509
|
+
}
|
|
404
510
|
set oncalltool(X) {
|
|
405
|
-
this.
|
|
406
|
-
|
|
511
|
+
this.warnIfRequestHandlerReplaced("oncalltool", this._oncalltool, X), this._oncalltool = X, this.replaceRequestHandler(CallToolRequestSchema, async (Y, Z) => {
|
|
512
|
+
if (!this._oncalltool) throw Error("No oncalltool handler set");
|
|
513
|
+
return this._oncalltool(Y.params, Z);
|
|
407
514
|
});
|
|
408
515
|
}
|
|
409
516
|
sendToolListChanged(X = {}) {
|
|
@@ -412,19 +519,34 @@ var rQ = class extends Protocol {
|
|
|
412
519
|
params: X
|
|
413
520
|
});
|
|
414
521
|
}
|
|
522
|
+
_onlistresources;
|
|
523
|
+
get onlistresources() {
|
|
524
|
+
return this._onlistresources;
|
|
525
|
+
}
|
|
415
526
|
set onlistresources(X) {
|
|
416
|
-
this.
|
|
417
|
-
|
|
527
|
+
this.warnIfRequestHandlerReplaced("onlistresources", this._onlistresources, X), this._onlistresources = X, this.replaceRequestHandler(ListResourcesRequestSchema, async (Y, Z) => {
|
|
528
|
+
if (!this._onlistresources) throw Error("No onlistresources handler set");
|
|
529
|
+
return this._onlistresources(Y.params, Z);
|
|
418
530
|
});
|
|
419
531
|
}
|
|
532
|
+
_onlistresourcetemplates;
|
|
533
|
+
get onlistresourcetemplates() {
|
|
534
|
+
return this._onlistresourcetemplates;
|
|
535
|
+
}
|
|
420
536
|
set onlistresourcetemplates(X) {
|
|
421
|
-
this.
|
|
422
|
-
|
|
537
|
+
this.warnIfRequestHandlerReplaced("onlistresourcetemplates", this._onlistresourcetemplates, X), this._onlistresourcetemplates = X, this.replaceRequestHandler(ListResourceTemplatesRequestSchema, async (Y, Z) => {
|
|
538
|
+
if (!this._onlistresourcetemplates) throw Error("No onlistresourcetemplates handler set");
|
|
539
|
+
return this._onlistresourcetemplates(Y.params, Z);
|
|
423
540
|
});
|
|
424
541
|
}
|
|
542
|
+
_onreadresource;
|
|
543
|
+
get onreadresource() {
|
|
544
|
+
return this._onreadresource;
|
|
545
|
+
}
|
|
425
546
|
set onreadresource(X) {
|
|
426
|
-
this.
|
|
427
|
-
|
|
547
|
+
this.warnIfRequestHandlerReplaced("onreadresource", this._onreadresource, X), this._onreadresource = X, this.replaceRequestHandler(ReadResourceRequestSchema, async (Y, Z) => {
|
|
548
|
+
if (!this._onreadresource) throw Error("No onreadresource handler set");
|
|
549
|
+
return this._onreadresource(Y.params, Z);
|
|
428
550
|
});
|
|
429
551
|
}
|
|
430
552
|
sendResourceListChanged(X = {}) {
|
|
@@ -433,9 +555,14 @@ var rQ = class extends Protocol {
|
|
|
433
555
|
params: X
|
|
434
556
|
});
|
|
435
557
|
}
|
|
558
|
+
_onlistprompts;
|
|
559
|
+
get onlistprompts() {
|
|
560
|
+
return this._onlistprompts;
|
|
561
|
+
}
|
|
436
562
|
set onlistprompts(X) {
|
|
437
|
-
this.
|
|
438
|
-
|
|
563
|
+
this.warnIfRequestHandlerReplaced("onlistprompts", this._onlistprompts, X), this._onlistprompts = X, this.replaceRequestHandler(ListPromptsRequestSchema, async (Y, Z) => {
|
|
564
|
+
if (!this._onlistprompts) throw Error("No onlistprompts handler set");
|
|
565
|
+
return this._onlistprompts(Y.params, Z);
|
|
439
566
|
});
|
|
440
567
|
}
|
|
441
568
|
sendPromptListChanged(X = {}) {
|
|
@@ -469,7 +596,7 @@ var rQ = class extends Protocol {
|
|
|
469
596
|
let Y = {}, Z = !1;
|
|
470
597
|
for (let $ of Object.keys(X)) {
|
|
471
598
|
let J = this._hostContext[$], K = X[$];
|
|
472
|
-
if (
|
|
599
|
+
if (tQ(J, K)) continue;
|
|
473
600
|
Y[$] = K, Z = !0;
|
|
474
601
|
}
|
|
475
602
|
if (Z) this._hostContext = X, this.sendHostContextChange(Y);
|
|
@@ -514,9 +641,21 @@ var rQ = class extends Protocol {
|
|
|
514
641
|
return this.request({
|
|
515
642
|
method: "ui/resource-teardown",
|
|
516
643
|
params: X
|
|
517
|
-
},
|
|
644
|
+
}, g, Y);
|
|
518
645
|
}
|
|
519
646
|
sendResourceTeardown = this.teardownResource;
|
|
647
|
+
callTool(X, Y) {
|
|
648
|
+
return this.request({
|
|
649
|
+
method: "tools/call",
|
|
650
|
+
params: X
|
|
651
|
+
}, CallToolResultSchema, Y);
|
|
652
|
+
}
|
|
653
|
+
listTools(X, Y) {
|
|
654
|
+
return this.request({
|
|
655
|
+
method: "tools/list",
|
|
656
|
+
params: X
|
|
657
|
+
}, ListToolsResultSchema, Y);
|
|
658
|
+
}
|
|
520
659
|
async connect(X) {
|
|
521
660
|
if (this.transport) throw Error("AppBridge is already connected. Call close() before connecting again.");
|
|
522
661
|
if (this._client) {
|
|
@@ -560,10 +699,10 @@ var rQ = class extends Protocol {
|
|
|
560
699
|
return super.connect(X);
|
|
561
700
|
}
|
|
562
701
|
};
|
|
563
|
-
function
|
|
702
|
+
function tQ(X, Y) {
|
|
564
703
|
return JSON.stringify(X) === JSON.stringify(Y);
|
|
565
704
|
}
|
|
566
705
|
//#endregion
|
|
567
|
-
export {
|
|
706
|
+
export { oQ as AppBridge, e as DOWNLOAD_FILE_METHOD, GQ as HOST_CONTEXT_CHANGED_METHOD, jQ as INITIALIZED_METHOD, WQ as INITIALIZE_METHOD, G as LATEST_PROTOCOL_VERSION, QQ as MESSAGE_METHOD, l as McpUiAppCapabilitiesSchema, D as McpUiDisplayModeSchema, f as McpUiDownloadFileRequestSchema, L as McpUiDownloadFileResultSchema, r as McpUiHostCapabilitiesSchema, k as McpUiHostContextChangedNotificationSchema, x as McpUiHostContextSchema, n as McpUiHostCssSchema, c as McpUiHostStylesSchema, b as McpUiInitializeRequestSchema, u as McpUiInitializeResultSchema, S as McpUiInitializedNotificationSchema, y as McpUiMessageRequestSchema, P as McpUiMessageResultSchema, A as McpUiOpenLinkRequestSchema, F as McpUiOpenLinkResultSchema, _ as McpUiRequestDisplayModeRequestSchema, q as McpUiRequestDisplayModeResultSchema, C as McpUiRequestTeardownNotificationSchema, B as McpUiResourceCspSchema, FQ as McpUiResourceMetaSchema, E as McpUiResourcePermissionsSchema, M as McpUiResourceTeardownRequestSchema, g as McpUiResourceTeardownResultSchema, T as McpUiSandboxProxyReadyNotificationSchema, PQ as McpUiSandboxResourceReadyNotificationSchema, w as McpUiSizeChangedNotificationSchema, I as McpUiSupportedContentBlockModalitiesSchema, p as McpUiThemeSchema, H as McpUiToolCancelledNotificationSchema, R as McpUiToolInputNotificationSchema, U as McpUiToolInputPartialNotificationSchema, LQ as McpUiToolMetaSchema, v as McpUiToolResultNotificationSchema, o as McpUiToolVisibilitySchema, d as McpUiUpdateModelContextRequestSchema, a as OPEN_LINK_METHOD, z as PostMessageTransport, zQ as REQUEST_DISPLAY_MODE_METHOD, DQ as REQUEST_TEARDOWN_METHOD, SQ as RESOURCE_MIME_TYPE, NQ as RESOURCE_TEARDOWN_METHOD, h as RESOURCE_URI_META_KEY, XQ as SANDBOX_PROXY_READY_METHOD, YQ as SANDBOX_RESOURCE_READY_METHOD, ZQ as SIZE_CHANGED_METHOD, lQ as SUPPORTED_PROTOCOL_VERSIONS, KQ as TOOL_CANCELLED_METHOD, $Q as TOOL_INPUT_METHOD, V as TOOL_INPUT_PARTIAL_METHOD, JQ as TOOL_RESULT_METHOD, lY as buildAllowAttribute, nY as getToolUiResourceUri, rY as isToolVisibilityAppOnly, cY as isToolVisibilityModelOnly };
|
|
568
707
|
|
|
569
708
|
//# sourceMappingURL=@modelcontextprotocol_ext-apps_app-bridge.js.map
|