sunpeak 0.19.2 → 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.
Files changed (65) hide show
  1. package/dist/chatgpt/index.cjs +1 -1
  2. package/dist/chatgpt/index.js +1 -1
  3. package/dist/claude/index.cjs +1 -1
  4. package/dist/claude/index.js +1 -1
  5. package/dist/host/chatgpt/index.cjs +1 -1
  6. package/dist/host/chatgpt/index.js +1 -1
  7. package/dist/index.cjs +134 -124
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +3 -1
  10. package/dist/index.js +71 -62
  11. package/dist/index.js.map +1 -1
  12. package/dist/inspector/index.cjs +1 -1
  13. package/dist/inspector/index.js +1 -1
  14. package/dist/{inspector-Cdo5BK2D.js → inspector-Bp9jrHIu.js} +218 -80
  15. package/dist/inspector-Bp9jrHIu.js.map +1 -0
  16. package/dist/{inspector-8nPV2A-z.cjs → inspector-Cvq3yjNL.cjs} +219 -81
  17. package/dist/inspector-Cvq3yjNL.cjs.map +1 -0
  18. package/dist/mcp/index.cjs +235 -138
  19. package/dist/mcp/index.cjs.map +1 -1
  20. package/dist/mcp/index.d.ts +1 -1
  21. package/dist/mcp/index.js +228 -132
  22. package/dist/mcp/index.js.map +1 -1
  23. package/dist/mcp/production-server.d.ts +31 -0
  24. package/dist/{protocol-C7kTcBr_.cjs → protocol-C8pFDmcy.cjs} +8194 -8187
  25. package/dist/protocol-C8pFDmcy.cjs.map +1 -0
  26. package/dist/{protocol-BfAACnv0.js → protocol-CRqiPTLT.js} +8186 -8185
  27. package/dist/protocol-CRqiPTLT.js.map +1 -0
  28. package/dist/{use-app-CfP9VypY.js → use-app-Ck5kR1Sf.js} +193 -93
  29. package/dist/use-app-Ck5kR1Sf.js.map +1 -0
  30. package/dist/{use-app-CzcYw1Kz.cjs → use-app-DHYiev3D.cjs} +253 -147
  31. package/dist/use-app-DHYiev3D.cjs.map +1 -0
  32. package/package.json +2 -2
  33. package/template/dist/albums/albums.html +15 -15
  34. package/template/dist/albums/albums.json +1 -1
  35. package/template/dist/carousel/carousel.html +19 -19
  36. package/template/dist/carousel/carousel.json +1 -1
  37. package/template/dist/map/map.html +14 -14
  38. package/template/dist/map/map.json +1 -1
  39. package/template/dist/review/review.html +11 -11
  40. package/template/dist/review/review.json +1 -1
  41. package/template/node_modules/.vite/deps/_metadata.json +3 -3
  42. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +192 -91
  43. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -1
  44. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +231 -92
  45. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -1
  46. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +208 -105
  47. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
  48. package/template/node_modules/.vite-mcp/deps/_metadata.json +24 -24
  49. package/template/node_modules/.vite-mcp/deps/{protocol-B_qKkui_.js → protocol-BqGB4zBx.js} +45 -45
  50. package/template/node_modules/.vite-mcp/deps/protocol-BqGB4zBx.js.map +1 -0
  51. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-chatgpt-darwin.png +0 -0
  52. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-claude-darwin.png +0 -0
  53. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-darwin.png +0 -0
  54. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-darwin.png +0 -0
  55. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-chatgpt-darwin.png +0 -0
  56. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-claude-darwin.png +0 -0
  57. package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-chatgpt-darwin.png +0 -0
  58. package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-claude-darwin.png +0 -0
  59. package/dist/inspector-8nPV2A-z.cjs.map +0 -1
  60. package/dist/inspector-Cdo5BK2D.js.map +0 -1
  61. package/dist/protocol-BfAACnv0.js.map +0 -1
  62. package/dist/protocol-C7kTcBr_.cjs.map +0 -1
  63. package/dist/use-app-CfP9VypY.js.map +0 -1
  64. package/dist/use-app-CzcYw1Kz.cjs.map +0 -1
  65. package/template/node_modules/.vite-mcp/deps/protocol-B_qKkui_.js.map +0 -1
@@ -1,10 +1,66 @@
1
1
  require("./chunk-9hOWP6kD.cjs");
2
- const require_protocol = require("./protocol-C7kTcBr_.cjs");
2
+ const require_protocol = require("./protocol-C8pFDmcy.cjs");
3
3
  let react = require("react");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
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/app.js
6
- var E = "2026-01-26", y = "ui/open-link", u = "ui/download-file", f = "ui/message", m = "ui/notifications/size-changed", i = "ui/notifications/tool-input", z = "ui/notifications/tool-input-partial", l = "ui/notifications/tool-result", r = "ui/notifications/tool-cancelled", c = "ui/notifications/host-context-changed", p = "ui/notifications/request-teardown", n = "ui/resource-teardown", a = "ui/initialize", o = "ui/notifications/initialized", s = "ui/request-display-mode";
7
- var K = class {
5
+ //#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.js
6
+ var z = class extends require_protocol.Protocol {
7
+ _registeredMethods = /* @__PURE__ */ new Set();
8
+ _eventSlots = /* @__PURE__ */ new Map();
9
+ onEventDispatch(X, Y) {}
10
+ _ensureEventSlot(X) {
11
+ let Y = this._eventSlots.get(X);
12
+ if (!Y) {
13
+ let Z = this.eventSchemas[X];
14
+ if (!Z) throw Error(`Unknown event: ${String(X)}`);
15
+ Y = { listeners: [] }, this._eventSlots.set(X, Y);
16
+ let $ = Z.shape.method.value;
17
+ this._registeredMethods.add($);
18
+ let D = Y;
19
+ super.setNotificationHandler(Z, (J) => {
20
+ let G = J.params;
21
+ this.onEventDispatch(X, G), D.onHandler?.(G);
22
+ for (let V of [...D.listeners]) V(G);
23
+ });
24
+ }
25
+ return Y;
26
+ }
27
+ setEventHandler(X, Y) {
28
+ let Z = this._ensureEventSlot(X);
29
+ if (Z.onHandler && Y) console.warn(`[MCP Apps] on${String(X)} handler replaced. Use addEventListener("${String(X)}", …) to add multiple listeners without replacing.`);
30
+ Z.onHandler = Y;
31
+ }
32
+ getEventHandler(X) {
33
+ return this._eventSlots.get(X)?.onHandler;
34
+ }
35
+ addEventListener(X, Y) {
36
+ this._ensureEventSlot(X).listeners.push(Y);
37
+ }
38
+ removeEventListener(X, Y) {
39
+ let Z = this._eventSlots.get(X);
40
+ if (!Z) return;
41
+ let $ = Z.listeners.indexOf(Y);
42
+ if ($ !== -1) Z.listeners.splice($, 1);
43
+ }
44
+ setRequestHandler = (X, Y) => {
45
+ this._assertMethodNotRegistered(X, "setRequestHandler"), super.setRequestHandler(X, Y);
46
+ };
47
+ setNotificationHandler = (X, Y) => {
48
+ this._assertMethodNotRegistered(X, "setNotificationHandler"), super.setNotificationHandler(X, Y);
49
+ };
50
+ warnIfRequestHandlerReplaced(X, Y, Z) {
51
+ if (Y && Z) console.warn(`[MCP Apps] ${X} handler replaced. Previous handler will no longer be called.`);
52
+ }
53
+ replaceRequestHandler = (X, Y) => {
54
+ let Z = X.shape.method.value;
55
+ this._registeredMethods.add(Z), super.setRequestHandler(X, Y);
56
+ };
57
+ _assertMethodNotRegistered(X, Y) {
58
+ let Z = X.shape.method.value;
59
+ 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.`);
60
+ this._registeredMethods.add(Z);
61
+ }
62
+ }, B = "2026-01-26", u = "ui/open-link", d = "ui/download-file", h = "ui/message", p = "ui/notifications/size-changed", r = "ui/notifications/tool-input", E = "ui/notifications/tool-input-partial", c = "ui/notifications/tool-result", l = "ui/notifications/tool-cancelled", n = "ui/notifications/host-context-changed", a = "ui/notifications/request-teardown", o = "ui/resource-teardown", s = "ui/initialize", t = "ui/notifications/initialized", e = "ui/request-display-mode";
63
+ var N = class {
8
64
  eventTarget;
9
65
  eventSource;
10
66
  messageListener;
@@ -37,11 +93,11 @@ var K = class {
37
93
  onmessage;
38
94
  sessionId;
39
95
  setProtocolVersion;
40
- }, v = require_protocol.union([require_protocol.literal("light"), require_protocol.literal("dark")]).describe("Color theme preference for the host environment."), D = require_protocol.union([
96
+ }, k = require_protocol.union([require_protocol.literal("light"), require_protocol.literal("dark")]).describe("Color theme preference for the host environment."), K = require_protocol.union([
41
97
  require_protocol.literal("inline"),
42
98
  require_protocol.literal("fullscreen"),
43
99
  require_protocol.literal("pip")
44
- ]).describe("Display mode for UI presentation."), $Q = require_protocol.union([
100
+ ]).describe("Display mode for UI presentation."), JQ = require_protocol.union([
45
101
  require_protocol.literal("--color-background-primary"),
46
102
  require_protocol.literal("--color-background-secondary"),
47
103
  require_protocol.literal("--color-background-tertiary"),
@@ -118,7 +174,7 @@ var K = class {
118
174
  require_protocol.literal("--shadow-sm"),
119
175
  require_protocol.literal("--shadow-md"),
120
176
  require_protocol.literal("--shadow-lg")
121
- ]).describe("CSS variable keys available to MCP apps for theming."), DQ = require_protocol.record($Q.describe(`Style variables for theming MCP apps.
177
+ ]).describe("CSS variable keys available to MCP apps for theming."), KQ = require_protocol.record(JQ.describe(`Style variables for theming MCP apps.
122
178
 
123
179
  Individual style keys are optional - hosts may provide any subset of these values.
124
180
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -136,15 +192,15 @@ Individual style keys are optional - hosts may provide any subset of these value
136
192
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
137
193
 
138
194
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
139
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`), JQ = require_protocol.object({
195
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`), GQ = require_protocol.object({
140
196
  method: require_protocol.literal("ui/open-link"),
141
197
  params: require_protocol.object({ url: require_protocol.string().describe("URL to open in the host's browser") })
142
- }), B = require_protocol.object({ isError: require_protocol.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough(), _ = require_protocol.object({ isError: require_protocol.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough(), O = require_protocol.object({ isError: require_protocol.boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough();
198
+ }), O = require_protocol.object({ isError: require_protocol.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough(), I = require_protocol.object({ isError: require_protocol.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough(), w = require_protocol.object({ isError: require_protocol.boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough();
143
199
  require_protocol.object({
144
200
  method: require_protocol.literal("ui/notifications/sandbox-proxy-ready"),
145
201
  params: require_protocol.object({})
146
202
  });
147
- var G = require_protocol.object({
203
+ var W = require_protocol.object({
148
204
  connectDomains: require_protocol.array(require_protocol.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
149
205
 
150
206
  - Maps to CSP \`connect-src\` directive
@@ -152,43 +208,43 @@ var G = require_protocol.object({
152
208
  resourceDomains: require_protocol.array(require_protocol.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
209
  frameDomains: require_protocol.array(require_protocol.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
210
  baseUriDomains: require_protocol.array(require_protocol.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
- }), V = require_protocol.object({
211
+ }), j = require_protocol.object({
156
212
  camera: require_protocol.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),
157
213
  microphone: require_protocol.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),
158
214
  geolocation: require_protocol.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),
159
215
  clipboardWrite: require_protocol.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")
160
- }), GQ = require_protocol.object({
216
+ }), NQ = require_protocol.object({
161
217
  method: require_protocol.literal("ui/notifications/size-changed"),
162
218
  params: require_protocol.object({
163
219
  width: require_protocol.number().optional().describe("New width in pixels."),
164
220
  height: require_protocol.number().optional().describe("New height in pixels.")
165
221
  })
166
- }), I = require_protocol.object({
222
+ }), A = require_protocol.object({
167
223
  method: require_protocol.literal("ui/notifications/tool-input"),
168
224
  params: require_protocol.object({ arguments: require_protocol.record(require_protocol.string(), require_protocol.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.") })
169
- }), w = require_protocol.object({
225
+ }), F = require_protocol.object({
170
226
  method: require_protocol.literal("ui/notifications/tool-input-partial"),
171
227
  params: require_protocol.object({ arguments: require_protocol.record(require_protocol.string(), require_protocol.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).") })
172
- }), A = require_protocol.object({
228
+ }), P = require_protocol.object({
173
229
  method: require_protocol.literal("ui/notifications/tool-cancelled"),
174
230
  params: require_protocol.object({ reason: require_protocol.string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
175
- }), b = require_protocol.object({ fonts: require_protocol.string().optional() }), k = require_protocol.object({
176
- variables: DQ.optional().describe("CSS variables for theming the app."),
177
- css: b.optional().describe("CSS blocks that apps can inject.")
178
- }), F = require_protocol.object({
231
+ }), g = require_protocol.object({ fonts: require_protocol.string().optional() }), x = require_protocol.object({
232
+ variables: KQ.optional().describe("CSS variables for theming the app."),
233
+ css: g.optional().describe("CSS blocks that apps can inject.")
234
+ }), q = require_protocol.object({
179
235
  method: require_protocol.literal("ui/resource-teardown"),
180
236
  params: require_protocol.object({})
181
- }), VQ = require_protocol.record(require_protocol.string(), require_protocol.unknown()), L = require_protocol.object({
237
+ }), WQ = require_protocol.record(require_protocol.string(), require_protocol.unknown()), _ = require_protocol.object({
182
238
  text: require_protocol.object({}).optional().describe("Host supports text content blocks."),
183
239
  image: require_protocol.object({}).optional().describe("Host supports image content blocks."),
184
240
  audio: require_protocol.object({}).optional().describe("Host supports audio content blocks."),
185
241
  resource: require_protocol.object({}).optional().describe("Host supports resource content blocks."),
186
242
  resourceLink: require_protocol.object({}).optional().describe("Host supports resource link content blocks."),
187
243
  structuredContent: require_protocol.object({}).optional().describe("Host supports structured content.")
188
- }), WQ = require_protocol.object({
244
+ }), jQ = require_protocol.object({
189
245
  method: require_protocol.literal("ui/notifications/request-teardown"),
190
246
  params: require_protocol.object({}).optional()
191
- }), C = require_protocol.object({
247
+ }), S = require_protocol.object({
192
248
  experimental: require_protocol.object({}).optional().describe("Experimental features (structure TBD)."),
193
249
  openLinks: require_protocol.object({}).optional().describe("Host supports opening external URLs."),
194
250
  downloadFile: require_protocol.object({}).optional().describe("Host supports file downloads via ui/download-file."),
@@ -196,21 +252,21 @@ var G = require_protocol.object({
196
252
  serverResources: require_protocol.object({ listChanged: require_protocol.boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
197
253
  logging: require_protocol.object({}).optional().describe("Host accepts log messages."),
198
254
  sandbox: require_protocol.object({
199
- permissions: V.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
200
- csp: G.optional().describe("CSP domains approved by the host.")
255
+ permissions: j.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
256
+ csp: W.optional().describe("CSP domains approved by the host.")
201
257
  }).optional().describe("Sandbox configuration applied by the host."),
202
- updateModelContext: L.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
203
- message: L.optional().describe("Host supports receiving content messages (ui/message) from the view.")
204
- }), x = require_protocol.object({
258
+ updateModelContext: _.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
259
+ message: _.optional().describe("Host supports receiving content messages (ui/message) from the view.")
260
+ }), y = require_protocol.object({
205
261
  experimental: require_protocol.object({}).optional().describe("Experimental features (structure TBD)."),
206
262
  tools: require_protocol.object({ listChanged: require_protocol.boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
207
- availableDisplayModes: require_protocol.array(D).optional().describe("Display modes the app supports.")
208
- }), NQ = require_protocol.object({
263
+ availableDisplayModes: require_protocol.array(K).optional().describe("Display modes the app supports.")
264
+ }), LQ = require_protocol.object({
209
265
  method: require_protocol.literal("ui/notifications/initialized"),
210
266
  params: require_protocol.object({}).optional()
211
- }), jQ = require_protocol.object({
212
- csp: G.optional().describe("Content Security Policy configuration for UI resources."),
213
- permissions: V.optional().describe("Sandbox permissions requested by the UI resource."),
267
+ }), zQ = require_protocol.object({
268
+ csp: W.optional().describe("Content Security Policy configuration for UI resources."),
269
+ permissions: j.optional().describe("Sandbox permissions requested by the UI resource."),
214
270
  domain: require_protocol.string().optional().describe(`Dedicated origin for view sandbox.
215
271
 
216
272
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
@@ -227,20 +283,20 @@ Boolean requesting whether a visible border and background is provided by the ho
227
283
  - \`true\`: request visible border + background
228
284
  - \`false\`: request no visible border + background
229
285
  - omitted: host decides border`)
230
- }), EQ = require_protocol.object({
286
+ }), BQ = require_protocol.object({
231
287
  method: require_protocol.literal("ui/request-display-mode"),
232
- params: require_protocol.object({ mode: D.describe("The display mode being requested.") })
233
- }), P = require_protocol.object({ mode: D.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough(), g = require_protocol.union([require_protocol.literal("model"), require_protocol.literal("app")]).describe("Tool visibility scope - who can access the tool."), zQ = require_protocol.object({
288
+ params: require_protocol.object({ mode: K.describe("The display mode being requested.") })
289
+ }), T = require_protocol.object({ mode: K.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough(), v = require_protocol.union([require_protocol.literal("model"), require_protocol.literal("app")]).describe("Tool visibility scope - who can access the tool."), EQ = require_protocol.object({
234
290
  resourceUri: require_protocol.string().optional(),
235
- visibility: require_protocol.array(g).optional().describe(`Who can access this tool. Default: ["model", "app"]
291
+ visibility: require_protocol.array(v).optional().describe(`Who can access this tool. Default: ["model", "app"]
236
292
  - "model": Tool visible to and callable by the agent
237
293
  - "app": Tool callable by the app from this server only`)
238
294
  });
239
295
  require_protocol.object({ mimeTypes: require_protocol.array(require_protocol.string()).optional().describe("Array of supported MIME types for UI resources.\nMust include `\"text/html;profile=mcp-app\"` for MCP Apps support.") });
240
- var LQ = require_protocol.object({
296
+ var _Q = require_protocol.object({
241
297
  method: require_protocol.literal("ui/download-file"),
242
298
  params: require_protocol.object({ contents: require_protocol.array(require_protocol.union([require_protocol.EmbeddedResourceSchema, require_protocol.ResourceLinkSchema])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.") })
243
- }), BQ = require_protocol.object({
299
+ }), OQ = require_protocol.object({
244
300
  method: require_protocol.literal("ui/message"),
245
301
  params: require_protocol.object({
246
302
  role: require_protocol.literal("user").describe("Message role, currently only \"user\" is supported."),
@@ -252,22 +308,22 @@ require_protocol.object({
252
308
  params: require_protocol.object({
253
309
  html: require_protocol.string().describe("HTML content to load into the inner iframe."),
254
310
  sandbox: require_protocol.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),
255
- csp: G.optional().describe("CSP configuration from resource metadata."),
256
- permissions: V.optional().describe("Sandbox permissions from resource metadata.")
311
+ csp: W.optional().describe("CSP configuration from resource metadata."),
312
+ permissions: j.optional().describe("Sandbox permissions from resource metadata.")
257
313
  })
258
314
  });
259
- var q = require_protocol.object({
315
+ var R = require_protocol.object({
260
316
  method: require_protocol.literal("ui/notifications/tool-result"),
261
317
  params: require_protocol.CallToolResultSchema.describe("Standard MCP tool execution result.")
262
- }), T = require_protocol.object({
318
+ }), U = require_protocol.object({
263
319
  toolInfo: require_protocol.object({
264
320
  id: require_protocol.RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."),
265
321
  tool: require_protocol.ToolSchema.describe("Tool definition including name, inputSchema, etc.")
266
322
  }).optional().describe("Metadata of the tool call that instantiated this App."),
267
- theme: v.optional().describe("Current color theme preference."),
268
- styles: k.optional().describe("Style configuration for theming the app."),
269
- displayMode: D.optional().describe("How the UI is currently displayed."),
270
- availableDisplayModes: require_protocol.array(D).optional().describe("Display modes the host supports."),
323
+ theme: k.optional().describe("Current color theme preference."),
324
+ styles: x.optional().describe("Style configuration for theming the app."),
325
+ displayMode: K.optional().describe("How the UI is currently displayed."),
326
+ availableDisplayModes: require_protocol.array(K).optional().describe("Display modes the host supports."),
271
327
  containerDimensions: require_protocol.union([require_protocol.object({ height: require_protocol.number().describe("Fixed container height in pixels.") }), require_protocol.object({ maxHeight: require_protocol.union([require_protocol.number(), require_protocol._undefined()]).optional().describe("Maximum container height in pixels.") })]).and(require_protocol.union([require_protocol.object({ width: require_protocol.number().describe("Fixed container width in pixels.") }), require_protocol.object({ maxWidth: require_protocol.union([require_protocol.number(), require_protocol._undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
272
328
  container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),
273
329
  locale: require_protocol.string().optional().describe("User's language and region preference in BCP 47 format."),
@@ -288,53 +344,66 @@ container holding the app. Specify either width or maxWidth, and either height o
288
344
  bottom: require_protocol.number().describe("Bottom safe area inset in pixels."),
289
345
  left: require_protocol.number().describe("Left safe area inset in pixels.")
290
346
  }).optional().describe("Mobile safe area boundaries in pixels.")
291
- }).passthrough(), R = require_protocol.object({
347
+ }).passthrough(), H = require_protocol.object({
292
348
  method: require_protocol.literal("ui/notifications/host-context-changed"),
293
- params: T.describe("Partial context update containing only changed fields.")
294
- }), OQ = require_protocol.object({
349
+ params: U.describe("Partial context update containing only changed fields.")
350
+ }), wQ = require_protocol.object({
295
351
  method: require_protocol.literal("ui/update-model-context"),
296
352
  params: require_protocol.object({
297
353
  content: require_protocol.array(require_protocol.ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."),
298
354
  structuredContent: require_protocol.record(require_protocol.string(), require_protocol.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")
299
355
  })
300
- }), IQ = require_protocol.object({
356
+ }), AQ = require_protocol.object({
301
357
  method: require_protocol.literal("ui/initialize"),
302
358
  params: require_protocol.object({
303
359
  appInfo: require_protocol.ImplementationSchema.describe("App identification (name and version)."),
304
- appCapabilities: x.describe("Features and capabilities this app provides."),
360
+ appCapabilities: y.describe("Features and capabilities this app provides."),
305
361
  protocolVersion: require_protocol.string().describe("Protocol version this app supports.")
306
362
  })
307
- }), U = require_protocol.object({
363
+ }), M = require_protocol.object({
308
364
  protocolVersion: require_protocol.string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
309
365
  hostInfo: require_protocol.ImplementationSchema.describe("Host application identification and version."),
310
- hostCapabilities: C.describe("Features and capabilities provided by the host."),
311
- hostContext: T.describe("Rich context about the host environment.")
366
+ hostCapabilities: S.describe("Features and capabilities provided by the host."),
367
+ hostContext: U.describe("Rich context about the host environment.")
312
368
  }).passthrough();
313
- function wQ() {
369
+ function FQ() {
314
370
  let X = document.documentElement.getAttribute("data-theme");
315
371
  if (X === "dark" || X === "light") return X;
316
372
  return document.documentElement.classList.contains("dark") ? "dark" : "light";
317
373
  }
318
- function AQ(X) {
374
+ function PQ(X) {
319
375
  let Y = document.documentElement;
320
376
  Y.setAttribute("data-theme", X), Y.style.colorScheme = X;
321
377
  }
322
- function FQ(X, Y = document.documentElement) {
378
+ function qQ(X, Y = document.documentElement) {
323
379
  for (let [Z, $] of Object.entries(X)) if ($ !== void 0) Y.style.setProperty(Z, $);
324
380
  }
325
- function PQ(X) {
381
+ function TQ(X) {
326
382
  if (document.getElementById("__mcp-host-fonts")) return;
327
383
  let Z = document.createElement("style");
328
384
  Z.id = "__mcp-host-fonts", Z.textContent = X, document.head.appendChild(Z);
329
385
  }
330
- var RX = "ui/resourceUri", UX = "text/html;profile=mcp-app";
331
- var kQ = class extends require_protocol.Protocol {
386
+ var MX = "ui/resourceUri", CX = "text/html;profile=mcp-app";
387
+ var gQ = class extends z {
332
388
  _appInfo;
333
389
  _capabilities;
334
390
  options;
335
391
  _hostCapabilities;
336
392
  _hostInfo;
337
393
  _hostContext;
394
+ eventSchemas = {
395
+ toolinput: A,
396
+ toolinputpartial: F,
397
+ toolresult: R,
398
+ toolcancelled: P,
399
+ hostcontextchanged: H
400
+ };
401
+ onEventDispatch(X, Y) {
402
+ if (X === "hostcontextchanged") this._hostContext = {
403
+ ...this._hostContext,
404
+ ...Y
405
+ };
406
+ }
338
407
  constructor(X, Y = {}, Z = { autoResize: !0 }) {
339
408
  super(Z);
340
409
  this._appInfo = X;
@@ -342,7 +411,7 @@ var kQ = class extends require_protocol.Protocol {
342
411
  this.options = Z;
343
412
  this.setRequestHandler(require_protocol.PingRequestSchema, ($) => {
344
413
  return console.log("Received ping:", $.params), {};
345
- }), this.onhostcontextchanged = () => {};
414
+ }), this.setEventHandler("hostcontextchanged", void 0);
346
415
  }
347
416
  getHostCapabilities() {
348
417
  return this._hostCapabilities;
@@ -353,34 +422,65 @@ var kQ = class extends require_protocol.Protocol {
353
422
  getHostContext() {
354
423
  return this._hostContext;
355
424
  }
425
+ get ontoolinput() {
426
+ return this.getEventHandler("toolinput");
427
+ }
356
428
  set ontoolinput(X) {
357
- this.setNotificationHandler(I, (Y) => X(Y.params));
429
+ this.setEventHandler("toolinput", X);
430
+ }
431
+ get ontoolinputpartial() {
432
+ return this.getEventHandler("toolinputpartial");
358
433
  }
359
434
  set ontoolinputpartial(X) {
360
- this.setNotificationHandler(w, (Y) => X(Y.params));
435
+ this.setEventHandler("toolinputpartial", X);
436
+ }
437
+ get ontoolresult() {
438
+ return this.getEventHandler("toolresult");
361
439
  }
362
440
  set ontoolresult(X) {
363
- this.setNotificationHandler(q, (Y) => X(Y.params));
441
+ this.setEventHandler("toolresult", X);
442
+ }
443
+ get ontoolcancelled() {
444
+ return this.getEventHandler("toolcancelled");
364
445
  }
365
446
  set ontoolcancelled(X) {
366
- this.setNotificationHandler(A, (Y) => X(Y.params));
447
+ this.setEventHandler("toolcancelled", X);
448
+ }
449
+ get onhostcontextchanged() {
450
+ return this.getEventHandler("hostcontextchanged");
367
451
  }
368
452
  set onhostcontextchanged(X) {
369
- this.setNotificationHandler(R, (Y) => {
370
- this._hostContext = {
371
- ...this._hostContext,
372
- ...Y.params
373
- }, X(Y.params);
374
- });
453
+ this.setEventHandler("hostcontextchanged", X);
454
+ }
455
+ _onteardown;
456
+ get onteardown() {
457
+ return this._onteardown;
375
458
  }
376
459
  set onteardown(X) {
377
- this.setRequestHandler(F, (Y, Z) => X(Y.params, Z));
460
+ this.warnIfRequestHandlerReplaced("onteardown", this._onteardown, X), this._onteardown = X, this.replaceRequestHandler(q, (Y, Z) => {
461
+ if (!this._onteardown) throw Error("No onteardown handler set");
462
+ return this._onteardown(Y.params, Z);
463
+ });
464
+ }
465
+ _oncalltool;
466
+ get oncalltool() {
467
+ return this._oncalltool;
378
468
  }
379
469
  set oncalltool(X) {
380
- this.setRequestHandler(require_protocol.CallToolRequestSchema, (Y, Z) => X(Y.params, Z));
470
+ this.warnIfRequestHandlerReplaced("oncalltool", this._oncalltool, X), this._oncalltool = X, this.replaceRequestHandler(require_protocol.CallToolRequestSchema, (Y, Z) => {
471
+ if (!this._oncalltool) throw Error("No oncalltool handler set");
472
+ return this._oncalltool(Y.params, Z);
473
+ });
474
+ }
475
+ _onlisttools;
476
+ get onlisttools() {
477
+ return this._onlisttools;
381
478
  }
382
479
  set onlisttools(X) {
383
- this.setRequestHandler(require_protocol.ListToolsRequestSchema, (Y, Z) => X(Y.params, Z));
480
+ this.warnIfRequestHandlerReplaced("onlisttools", this._onlisttools, X), this._onlisttools = X, this.replaceRequestHandler(require_protocol.ListToolsRequestSchema, (Y, Z) => {
481
+ if (!this._onlisttools) throw Error("No onlisttools handler set");
482
+ return this._onlisttools(Y.params, Z);
483
+ });
384
484
  }
385
485
  assertCapabilityForMethod(X) {}
386
486
  assertRequestHandlerCapability(X) {
@@ -424,7 +524,7 @@ var kQ = class extends require_protocol.Protocol {
424
524
  return this.request({
425
525
  method: "ui/message",
426
526
  params: X
427
- }, O, Y);
527
+ }, w, Y);
428
528
  }
429
529
  sendLog(X) {
430
530
  return this.notification({
@@ -442,14 +542,14 @@ var kQ = class extends require_protocol.Protocol {
442
542
  return this.request({
443
543
  method: "ui/open-link",
444
544
  params: X
445
- }, B, Y);
545
+ }, O, Y);
446
546
  }
447
547
  sendOpenLink = this.openLink;
448
548
  downloadFile(X, Y) {
449
549
  return this.request({
450
550
  method: "ui/download-file",
451
551
  params: X
452
- }, _, Y);
552
+ }, I, Y);
453
553
  }
454
554
  requestTeardown(X = {}) {
455
555
  return this.notification({
@@ -461,7 +561,7 @@ var kQ = class extends require_protocol.Protocol {
461
561
  return this.request({
462
562
  method: "ui/request-display-mode",
463
563
  params: X
464
- }, P, Y);
564
+ }, T, Y);
465
565
  }
466
566
  sendSizeChanged(X) {
467
567
  return this.notification({
@@ -474,22 +574,22 @@ var kQ = class extends require_protocol.Protocol {
474
574
  if (X) return;
475
575
  X = !0, requestAnimationFrame(() => {
476
576
  X = !1;
477
- let J = document.documentElement, S = J.style.height;
577
+ let J = document.documentElement, G = J.style.height;
478
578
  J.style.height = "max-content";
479
- let N = Math.ceil(J.getBoundingClientRect().height);
480
- J.style.height = S;
481
- let j = Math.ceil(window.innerWidth);
482
- if (j !== Y || N !== Z) Y = j, Z = N, this.sendSizeChanged({
483
- width: j,
484
- height: N
579
+ let V = Math.ceil(J.getBoundingClientRect().height);
580
+ J.style.height = G;
581
+ let L = Math.ceil(window.innerWidth);
582
+ if (L !== Y || V !== Z) Y = L, Z = V, this.sendSizeChanged({
583
+ width: L,
584
+ height: V
485
585
  });
486
586
  });
487
587
  };
488
588
  $();
489
- let W = new ResizeObserver($);
490
- return W.observe(document.documentElement), W.observe(document.body), () => W.disconnect();
589
+ let D = new ResizeObserver($);
590
+ return D.observe(document.documentElement), D.observe(document.body), () => D.disconnect();
491
591
  }
492
- async connect(X = new K(window.parent, window.parent), Y) {
592
+ async connect(X = new N(window.parent, window.parent), Y) {
493
593
  if (this.transport) throw Error("App is already connected. Call close() before connecting again.");
494
594
  await super.connect(X);
495
595
  try {
@@ -498,9 +598,9 @@ var kQ = class extends require_protocol.Protocol {
498
598
  params: {
499
599
  appCapabilities: this._capabilities,
500
600
  appInfo: this._appInfo,
501
- protocolVersion: E
601
+ protocolVersion: B
502
602
  }
503
- }, U, Y);
603
+ }, M, Y);
504
604
  if (Z === void 0) throw Error(`Server sent invalid initialize result: ${Z}`);
505
605
  if (this._hostCapabilities = Z.hostCapabilities, this._hostInfo = Z.hostInfo, this._hostContext = Z.hostContext, await this.notification({ method: "ui/notifications/initialized" }), this.options?.autoResize) this.setupSizeChangedNotifications();
506
606
  } catch (Z) {
@@ -569,8 +669,8 @@ async function connectWithRetry(appInfo, capabilities, onAppCreated) {
569
669
  }
570
670
  let transport = null;
571
671
  try {
572
- transport = new K(window.parent, window.parent);
573
- const newApp = new kQ(appInfo, capabilities);
672
+ transport = new N(window.parent, window.parent);
673
+ const newApp = new gQ(appInfo, capabilities);
574
674
  onAppCreated?.(newApp);
575
675
  await withTimeout(newApp.connect(transport), CONNECT_TIMEOUT_MS);
576
676
  return newApp;
@@ -684,16 +784,10 @@ Object.defineProperty(exports, "BQ", {
684
784
  return BQ;
685
785
  }
686
786
  });
687
- Object.defineProperty(exports, "C", {
688
- enumerable: true,
689
- get: function() {
690
- return C;
691
- }
692
- });
693
- Object.defineProperty(exports, "D", {
787
+ Object.defineProperty(exports, "CX", {
694
788
  enumerable: true,
695
789
  get: function() {
696
- return D;
790
+ return CX;
697
791
  }
698
792
  });
699
793
  Object.defineProperty(exports, "E", {
@@ -720,16 +814,16 @@ Object.defineProperty(exports, "FQ", {
720
814
  return FQ;
721
815
  }
722
816
  });
723
- Object.defineProperty(exports, "G", {
817
+ Object.defineProperty(exports, "GQ", {
724
818
  enumerable: true,
725
819
  get: function() {
726
- return G;
820
+ return GQ;
727
821
  }
728
822
  });
729
- Object.defineProperty(exports, "GQ", {
823
+ Object.defineProperty(exports, "H", {
730
824
  enumerable: true,
731
825
  get: function() {
732
- return GQ;
826
+ return H;
733
827
  }
734
828
  });
735
829
  Object.defineProperty(exports, "I", {
@@ -738,34 +832,34 @@ Object.defineProperty(exports, "I", {
738
832
  return I;
739
833
  }
740
834
  });
741
- Object.defineProperty(exports, "IQ", {
835
+ Object.defineProperty(exports, "K", {
742
836
  enumerable: true,
743
837
  get: function() {
744
- return IQ;
838
+ return K;
745
839
  }
746
840
  });
747
- Object.defineProperty(exports, "JQ", {
841
+ Object.defineProperty(exports, "LQ", {
748
842
  enumerable: true,
749
843
  get: function() {
750
- return JQ;
844
+ return LQ;
751
845
  }
752
846
  });
753
- Object.defineProperty(exports, "K", {
847
+ Object.defineProperty(exports, "M", {
754
848
  enumerable: true,
755
849
  get: function() {
756
- return K;
850
+ return M;
757
851
  }
758
852
  });
759
- Object.defineProperty(exports, "L", {
853
+ Object.defineProperty(exports, "MX", {
760
854
  enumerable: true,
761
855
  get: function() {
762
- return L;
856
+ return MX;
763
857
  }
764
858
  });
765
- Object.defineProperty(exports, "LQ", {
859
+ Object.defineProperty(exports, "N", {
766
860
  enumerable: true,
767
861
  get: function() {
768
- return LQ;
862
+ return N;
769
863
  }
770
864
  });
771
865
  Object.defineProperty(exports, "NQ", {
@@ -804,10 +898,10 @@ Object.defineProperty(exports, "R", {
804
898
  return R;
805
899
  }
806
900
  });
807
- Object.defineProperty(exports, "RX", {
901
+ Object.defineProperty(exports, "S", {
808
902
  enumerable: true,
809
903
  get: function() {
810
- return RX;
904
+ return S;
811
905
  }
812
906
  });
813
907
  Object.defineProperty(exports, "T", {
@@ -816,28 +910,22 @@ Object.defineProperty(exports, "T", {
816
910
  return T;
817
911
  }
818
912
  });
819
- Object.defineProperty(exports, "U", {
820
- enumerable: true,
821
- get: function() {
822
- return U;
823
- }
824
- });
825
- Object.defineProperty(exports, "UX", {
913
+ Object.defineProperty(exports, "TQ", {
826
914
  enumerable: true,
827
915
  get: function() {
828
- return UX;
916
+ return TQ;
829
917
  }
830
918
  });
831
- Object.defineProperty(exports, "V", {
919
+ Object.defineProperty(exports, "U", {
832
920
  enumerable: true,
833
921
  get: function() {
834
- return V;
922
+ return U;
835
923
  }
836
924
  });
837
- Object.defineProperty(exports, "VQ", {
925
+ Object.defineProperty(exports, "W", {
838
926
  enumerable: true,
839
927
  get: function() {
840
- return VQ;
928
+ return W;
841
929
  }
842
930
  });
843
931
  Object.defineProperty(exports, "WQ", {
@@ -852,16 +940,16 @@ Object.defineProperty(exports, "_", {
852
940
  return _;
853
941
  }
854
942
  });
855
- Object.defineProperty(exports, "a", {
943
+ Object.defineProperty(exports, "_Q", {
856
944
  enumerable: true,
857
945
  get: function() {
858
- return a;
946
+ return _Q;
859
947
  }
860
948
  });
861
- Object.defineProperty(exports, "b", {
949
+ Object.defineProperty(exports, "a", {
862
950
  enumerable: true,
863
951
  get: function() {
864
- return b;
952
+ return a;
865
953
  }
866
954
  });
867
955
  Object.defineProperty(exports, "c", {
@@ -870,10 +958,16 @@ Object.defineProperty(exports, "c", {
870
958
  return c;
871
959
  }
872
960
  });
873
- Object.defineProperty(exports, "f", {
961
+ Object.defineProperty(exports, "d", {
874
962
  enumerable: true,
875
963
  get: function() {
876
- return f;
964
+ return d;
965
+ }
966
+ });
967
+ Object.defineProperty(exports, "e", {
968
+ enumerable: true,
969
+ get: function() {
970
+ return e;
877
971
  }
878
972
  });
879
973
  Object.defineProperty(exports, "g", {
@@ -882,40 +976,40 @@ Object.defineProperty(exports, "g", {
882
976
  return g;
883
977
  }
884
978
  });
885
- Object.defineProperty(exports, "i", {
979
+ Object.defineProperty(exports, "gQ", {
886
980
  enumerable: true,
887
981
  get: function() {
888
- return i;
982
+ return gQ;
889
983
  }
890
984
  });
891
- Object.defineProperty(exports, "jQ", {
985
+ Object.defineProperty(exports, "h", {
892
986
  enumerable: true,
893
987
  get: function() {
894
- return jQ;
988
+ return h;
895
989
  }
896
990
  });
897
- Object.defineProperty(exports, "k", {
991
+ Object.defineProperty(exports, "j", {
898
992
  enumerable: true,
899
993
  get: function() {
900
- return k;
994
+ return j;
901
995
  }
902
996
  });
903
- Object.defineProperty(exports, "kQ", {
997
+ Object.defineProperty(exports, "jQ", {
904
998
  enumerable: true,
905
999
  get: function() {
906
- return kQ;
1000
+ return jQ;
907
1001
  }
908
1002
  });
909
- Object.defineProperty(exports, "l", {
1003
+ Object.defineProperty(exports, "k", {
910
1004
  enumerable: true,
911
1005
  get: function() {
912
- return l;
1006
+ return k;
913
1007
  }
914
1008
  });
915
- Object.defineProperty(exports, "m", {
1009
+ Object.defineProperty(exports, "l", {
916
1010
  enumerable: true,
917
1011
  get: function() {
918
- return m;
1012
+ return l;
919
1013
  }
920
1014
  });
921
1015
  Object.defineProperty(exports, "n", {
@@ -942,6 +1036,12 @@ Object.defineProperty(exports, "q", {
942
1036
  return q;
943
1037
  }
944
1038
  });
1039
+ Object.defineProperty(exports, "qQ", {
1040
+ enumerable: true,
1041
+ get: function() {
1042
+ return qQ;
1043
+ }
1044
+ });
945
1045
  Object.defineProperty(exports, "r", {
946
1046
  enumerable: true,
947
1047
  get: function() {
@@ -954,6 +1054,12 @@ Object.defineProperty(exports, "s", {
954
1054
  return s;
955
1055
  }
956
1056
  });
1057
+ Object.defineProperty(exports, "t", {
1058
+ enumerable: true,
1059
+ get: function() {
1060
+ return t;
1061
+ }
1062
+ });
957
1063
  Object.defineProperty(exports, "u", {
958
1064
  enumerable: true,
959
1065
  get: function() {
@@ -1009,4 +1115,4 @@ Object.defineProperty(exports, "zQ", {
1009
1115
  }
1010
1116
  });
1011
1117
 
1012
- //# sourceMappingURL=use-app-CzcYw1Kz.cjs.map
1118
+ //# sourceMappingURL=use-app-DHYiev3D.cjs.map