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.
Files changed (87) hide show
  1. package/README.md +6 -3
  2. package/bin/commands/new.mjs +3 -1
  3. package/bin/commands/test.mjs +107 -46
  4. package/bin/lib/inspect/inspect-config.d.mts +4 -0
  5. package/bin/lib/inspect/inspect-config.mjs +2 -0
  6. package/bin/lib/test/base-config.mjs +16 -1
  7. package/bin/lib/test/test-config.d.mts +22 -0
  8. package/bin/lib/test/test-config.mjs +2 -0
  9. package/bin/lib/test/test-fixtures.d.mts +34 -1
  10. package/bin/lib/test/test-fixtures.mjs +43 -0
  11. package/dist/chatgpt/index.cjs +1 -1
  12. package/dist/chatgpt/index.js +1 -1
  13. package/dist/claude/index.cjs +1 -1
  14. package/dist/claude/index.js +1 -1
  15. package/dist/host/chatgpt/index.cjs +1 -1
  16. package/dist/host/chatgpt/index.js +1 -1
  17. package/dist/index.cjs +134 -124
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +3 -1
  20. package/dist/index.js +71 -62
  21. package/dist/index.js.map +1 -1
  22. package/dist/inspector/index.cjs +1 -1
  23. package/dist/inspector/index.js +1 -1
  24. package/dist/{inspector-Cdo5BK2D.js → inspector-Bp9jrHIu.js} +218 -80
  25. package/dist/inspector-Bp9jrHIu.js.map +1 -0
  26. package/dist/{inspector-8nPV2A-z.cjs → inspector-Cvq3yjNL.cjs} +219 -81
  27. package/dist/inspector-Cvq3yjNL.cjs.map +1 -0
  28. package/dist/mcp/index.cjs +235 -138
  29. package/dist/mcp/index.cjs.map +1 -1
  30. package/dist/mcp/index.d.ts +1 -1
  31. package/dist/mcp/index.js +228 -132
  32. package/dist/mcp/index.js.map +1 -1
  33. package/dist/mcp/production-server.d.ts +31 -0
  34. package/dist/{protocol-C7kTcBr_.cjs → protocol-C8pFDmcy.cjs} +8194 -8187
  35. package/dist/protocol-C8pFDmcy.cjs.map +1 -0
  36. package/dist/{protocol-BfAACnv0.js → protocol-CRqiPTLT.js} +8186 -8185
  37. package/dist/protocol-CRqiPTLT.js.map +1 -0
  38. package/dist/{use-app-CfP9VypY.js → use-app-Ck5kR1Sf.js} +193 -93
  39. package/dist/use-app-Ck5kR1Sf.js.map +1 -0
  40. package/dist/{use-app-CzcYw1Kz.cjs → use-app-DHYiev3D.cjs} +253 -147
  41. package/dist/use-app-DHYiev3D.cjs.map +1 -0
  42. package/package.json +2 -2
  43. package/template/README.md +6 -3
  44. package/template/dist/albums/albums.html +15 -15
  45. package/template/dist/albums/albums.json +1 -1
  46. package/template/dist/carousel/carousel.html +19 -19
  47. package/template/dist/carousel/carousel.json +1 -1
  48. package/template/dist/map/map.html +14 -14
  49. package/template/dist/map/map.json +1 -1
  50. package/template/dist/review/review.html +11 -11
  51. package/template/dist/review/review.json +1 -1
  52. package/template/node_modules/.vite/deps/_metadata.json +3 -3
  53. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +192 -91
  54. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -1
  55. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +231 -92
  56. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -1
  57. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +208 -105
  58. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
  59. package/template/node_modules/.vite-mcp/deps/_metadata.json +24 -24
  60. package/template/node_modules/.vite-mcp/deps/{protocol-B_qKkui_.js → protocol-BqGB4zBx.js} +45 -45
  61. package/template/node_modules/.vite-mcp/deps/protocol-BqGB4zBx.js.map +1 -0
  62. package/template/package.json +5 -3
  63. package/template/test-results/.last-run.json +4 -0
  64. package/template/tests/e2e/visual.spec.ts +36 -0
  65. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-chatgpt-darwin.png +0 -0
  66. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-chatgpt-linux.png +0 -0
  67. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-claude-darwin.png +0 -0
  68. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-claude-linux.png +0 -0
  69. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-darwin.png +0 -0
  70. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-linux.png +0 -0
  71. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-darwin.png +0 -0
  72. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-linux.png +0 -0
  73. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-chatgpt-darwin.png +0 -0
  74. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-chatgpt-linux.png +0 -0
  75. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-claude-darwin.png +0 -0
  76. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-claude-linux.png +0 -0
  77. package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-chatgpt-darwin.png +0 -0
  78. package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-chatgpt-linux.png +0 -0
  79. package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-claude-darwin.png +0 -0
  80. package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-claude-linux.png +0 -0
  81. package/dist/inspector-8nPV2A-z.cjs.map +0 -1
  82. package/dist/inspector-Cdo5BK2D.js.map +0 -1
  83. package/dist/protocol-BfAACnv0.js.map +0 -1
  84. package/dist/protocol-C7kTcBr_.cjs.map +0 -1
  85. package/dist/use-app-CfP9VypY.js.map +0 -1
  86. package/dist/use-app-CzcYw1Kz.cjs.map +0 -1
  87. package/template/node_modules/.vite-mcp/deps/protocol-B_qKkui_.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../chunk-9hOWP6kD.cjs");
3
- const require_inspector = require("../inspector-8nPV2A-z.cjs");
3
+ const require_inspector = require("../inspector-Cvq3yjNL.cjs");
4
4
  const require_inspector_url = require("../inspector-url-C3LTKgXt.cjs");
5
5
  const require_discovery = require("../discovery-Clu4uHp1.cjs");
6
6
  //#region src/inspector/index.ts
@@ -1,5 +1,5 @@
1
1
  import { r as __exportAll } from "../chunk-D6g4UhsZ.js";
2
- import { _ as McpAppHost, a as SidebarControl, b as getRegisteredHosts, c as SidebarTextarea, d as ThemeProvider, f as useThemeContext, g as extractResourceCSP, h as IframeResource, i as SidebarCollapsibleControl, l as SidebarToggle, m as useInspectorState, n as resolveServerToolResult, o as SidebarInput, p as useMcpConnection, r as SidebarCheckbox, s as SidebarSelect, t as Inspector, u as SimpleSidebar, v as SCREEN_WIDTHS, x as registerHostShell, y as getHostShell } from "../inspector-Cdo5BK2D.js";
2
+ import { _ as McpAppHost, a as SidebarControl, b as getRegisteredHosts, c as SidebarTextarea, d as ThemeProvider, f as useThemeContext, g as extractResourceCSP, h as IframeResource, i as SidebarCollapsibleControl, l as SidebarToggle, m as useInspectorState, n as resolveServerToolResult, o as SidebarInput, p as useMcpConnection, r as SidebarCheckbox, s as SidebarSelect, t as Inspector, u as SimpleSidebar, v as SCREEN_WIDTHS, x as registerHostShell, y as getHostShell } from "../inspector-Bp9jrHIu.js";
3
3
  import { t as createInspectorUrl } from "../inspector-url-CyQcuBI9.js";
4
4
  import { c as toPascalCase, i as findResourceKey, n as extractSimulationKey, r as findResourceDirs, s as getComponentName, t as extractResourceKey } from "../discovery-Cgoegt62.js";
5
5
  //#region src/inspector/index.ts
@@ -1,4 +1,4 @@
1
- import { $ as literal, C as ListPromptsResultSchema, D as ListResourcesResultSchema, E as ListResourcesRequestSchema, F as ReadResourceRequestSchema, H as ToolListChangedNotificationSchema, I as ReadResourceResultSchema, L as RequestIdSchema, N as PingRequestSchema, P as PromptListChangedNotificationSchema, Q as boolean, R as ResourceLinkSchema, S as ListPromptsRequestSchema, T as ListResourceTemplatesResultSchema, U as ToolSchema, X as _undefined, Z as array, _ as ImplementationSchema, a as CallToolResultSchema, at as unknown, b as JSONRPCMessageSchema, et as number, i as CallToolRequestSchema, it as union, j as LoggingMessageNotificationSchema, nt as record, p as EmbeddedResourceSchema, rt as string, s as ContentBlockSchema, t as Protocol, tt as object, w as ListResourceTemplatesRequestSchema, z as ResourceListChangedNotificationSchema } from "./protocol-BfAACnv0.js";
1
+ import { $ as ToolListChangedNotificationSchema, A as JSONRPCMessageSchema, B as ListToolsResultSchema, C as EmbeddedResourceSchema, D as ImplementationSchema, F as ListResourceTemplatesResultSchema, G as PromptListChangedNotificationSchema, H as LoggingMessageNotificationSchema, I as ListResourcesRequestSchema, J as RequestIdSchema, K as ReadResourceRequestSchema, L as ListResourcesResultSchema, M as ListPromptsRequestSchema, N as ListPromptsResultSchema, P as ListResourceTemplatesRequestSchema, W as PingRequestSchema, X as ResourceListChangedNotificationSchema, Y as ResourceLinkSchema, _ as ContentBlockSchema, ct as array, dt as number, et as ToolSchema, ft as object, gt as unknown, h as CallToolResultSchema, ht as union, lt as boolean, m as CallToolRequestSchema, mt as string, pt as record, q as ReadResourceResultSchema, st as _undefined, t as Protocol, ut as literal } from "./protocol-CRqiPTLT.js";
2
2
  import * as React from "react";
3
3
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -808,12 +808,68 @@ registerHostShell({
808
808
  }`
809
809
  });
810
810
  //#endregion
811
- //#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-bridge.js
812
- var G = "2026-01-26", m = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), W = union([
811
+ //#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
812
+ var j = class extends Protocol {
813
+ _registeredMethods = /* @__PURE__ */ new Set();
814
+ _eventSlots = /* @__PURE__ */ new Map();
815
+ onEventDispatch(X, Y) {}
816
+ _ensureEventSlot(X) {
817
+ let Y = this._eventSlots.get(X);
818
+ if (!Y) {
819
+ let Z = this.eventSchemas[X];
820
+ if (!Z) throw Error(`Unknown event: ${String(X)}`);
821
+ Y = { listeners: [] }, this._eventSlots.set(X, Y);
822
+ let $ = Z.shape.method.value;
823
+ this._registeredMethods.add($);
824
+ let J = Y;
825
+ super.setNotificationHandler(Z, (K) => {
826
+ let N = K.params;
827
+ this.onEventDispatch(X, N), J.onHandler?.(N);
828
+ for (let W of [...J.listeners]) W(N);
829
+ });
830
+ }
831
+ return Y;
832
+ }
833
+ setEventHandler(X, Y) {
834
+ let Z = this._ensureEventSlot(X);
835
+ if (Z.onHandler && Y) console.warn(`[MCP Apps] on${String(X)} handler replaced. Use addEventListener("${String(X)}", …) to add multiple listeners without replacing.`);
836
+ Z.onHandler = Y;
837
+ }
838
+ getEventHandler(X) {
839
+ return this._eventSlots.get(X)?.onHandler;
840
+ }
841
+ addEventListener(X, Y) {
842
+ this._ensureEventSlot(X).listeners.push(Y);
843
+ }
844
+ removeEventListener(X, Y) {
845
+ let Z = this._eventSlots.get(X);
846
+ if (!Z) return;
847
+ let $ = Z.listeners.indexOf(Y);
848
+ if ($ !== -1) Z.listeners.splice($, 1);
849
+ }
850
+ setRequestHandler = (X, Y) => {
851
+ this._assertMethodNotRegistered(X, "setRequestHandler"), super.setRequestHandler(X, Y);
852
+ };
853
+ setNotificationHandler = (X, Y) => {
854
+ this._assertMethodNotRegistered(X, "setNotificationHandler"), super.setNotificationHandler(X, Y);
855
+ };
856
+ warnIfRequestHandlerReplaced(X, Y, Z) {
857
+ if (Y && Z) console.warn(`[MCP Apps] ${X} handler replaced. Previous handler will no longer be called.`);
858
+ }
859
+ replaceRequestHandler = (X, Y) => {
860
+ let Z = X.shape.method.value;
861
+ this._registeredMethods.add(Z), super.setRequestHandler(X, Y);
862
+ };
863
+ _assertMethodNotRegistered(X, Y) {
864
+ let Z = X.shape.method.value;
865
+ 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.`);
866
+ this._registeredMethods.add(Z);
867
+ }
868
+ }, G = "2026-01-26", p = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), D = union([
813
869
  literal("inline"),
814
870
  literal("fullscreen"),
815
871
  literal("pip")
816
- ]).describe("Display mode for UI presentation."), OQ = record(union([
872
+ ]).describe("Display mode for UI presentation."), AQ = record(union([
817
873
  literal("--color-background-primary"),
818
874
  literal("--color-background-secondary"),
819
875
  literal("--color-background-tertiary"),
@@ -908,17 +964,17 @@ Individual style keys are optional - hosts may provide any subset of these value
908
964
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
909
965
 
910
966
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
911
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`), V = object({
967
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`), A = object({
912
968
  method: literal("ui/open-link"),
913
969
  params: object({ url: string().describe("URL to open in the host's browser") })
914
970
  });
915
971
  object({ isError: boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough();
916
972
  object({ isError: boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough();
917
973
  object({ isError: boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough();
918
- var L = object({
974
+ var T = object({
919
975
  method: literal("ui/notifications/sandbox-proxy-ready"),
920
976
  params: object({})
921
- }), N = object({
977
+ }), B = object({
922
978
  connectDomains: array(string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
923
979
 
924
980
  - Maps to CSP \`connect-src\` directive
@@ -926,12 +982,12 @@ var L = object({
926
982
  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)"),
927
983
  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'`)"),
928
984
  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'`)")
929
- }), j = object({
985
+ }), E = object({
930
986
  camera: object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),
931
987
  microphone: object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),
932
988
  geolocation: object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),
933
989
  clipboardWrite: object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")
934
- }), P = object({
990
+ }), w = object({
935
991
  method: literal("ui/notifications/size-changed"),
936
992
  params: object({
937
993
  width: number().optional().describe("New width in pixels."),
@@ -950,25 +1006,25 @@ object({
950
1006
  method: literal("ui/notifications/tool-cancelled"),
951
1007
  params: object({ reason: string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
952
1008
  });
953
- var p = object({ fonts: string().optional() }), c = object({
954
- variables: OQ.optional().describe("CSS variables for theming the app."),
955
- css: p.optional().describe("CSS blocks that apps can inject.")
1009
+ var n = object({ fonts: string().optional() }), c = object({
1010
+ variables: AQ.optional().describe("CSS variables for theming the app."),
1011
+ css: n.optional().describe("CSS blocks that apps can inject.")
956
1012
  });
957
1013
  object({
958
1014
  method: literal("ui/resource-teardown"),
959
1015
  params: object({})
960
1016
  });
961
- var H = record(string(), unknown()), O = object({
1017
+ var g = record(string(), unknown()), I = object({
962
1018
  text: object({}).optional().describe("Host supports text content blocks."),
963
1019
  image: object({}).optional().describe("Host supports image content blocks."),
964
1020
  audio: object({}).optional().describe("Host supports audio content blocks."),
965
1021
  resource: object({}).optional().describe("Host supports resource content blocks."),
966
1022
  resourceLink: object({}).optional().describe("Host supports resource link content blocks."),
967
1023
  structuredContent: object({}).optional().describe("Host supports structured content.")
968
- }), M = object({
1024
+ }), C = object({
969
1025
  method: literal("ui/notifications/request-teardown"),
970
1026
  params: object({}).optional()
971
- }), n = object({
1027
+ }), r = object({
972
1028
  experimental: object({}).optional().describe("Experimental features (structure TBD)."),
973
1029
  openLinks: object({}).optional().describe("Host supports opening external URLs."),
974
1030
  downloadFile: object({}).optional().describe("Host supports file downloads via ui/download-file."),
@@ -976,22 +1032,22 @@ var H = record(string(), unknown()), O = object({
976
1032
  serverResources: object({ listChanged: boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
977
1033
  logging: object({}).optional().describe("Host accepts log messages."),
978
1034
  sandbox: object({
979
- permissions: j.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
980
- csp: N.optional().describe("CSP domains approved by the host.")
1035
+ permissions: E.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
1036
+ csp: B.optional().describe("CSP domains approved by the host.")
981
1037
  }).optional().describe("Sandbox configuration applied by the host."),
982
- updateModelContext: O.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
983
- message: O.optional().describe("Host supports receiving content messages (ui/message) from the view.")
984
- }), i = object({
1038
+ updateModelContext: I.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
1039
+ message: I.optional().describe("Host supports receiving content messages (ui/message) from the view.")
1040
+ }), l = object({
985
1041
  experimental: object({}).optional().describe("Experimental features (structure TBD)."),
986
1042
  tools: object({ listChanged: boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
987
- availableDisplayModes: array(W).optional().describe("Display modes the app supports.")
988
- }), v = object({
1043
+ availableDisplayModes: array(D).optional().describe("Display modes the app supports.")
1044
+ }), S = object({
989
1045
  method: literal("ui/notifications/initialized"),
990
1046
  params: object({}).optional()
991
1047
  });
992
1048
  object({
993
- csp: N.optional().describe("Content Security Policy configuration for UI resources."),
994
- permissions: j.optional().describe("Sandbox permissions requested by the UI resource."),
1049
+ csp: B.optional().describe("Content Security Policy configuration for UI resources."),
1050
+ permissions: E.optional().describe("Sandbox permissions requested by the UI resource."),
995
1051
  domain: string().optional().describe(`Dedicated origin for view sandbox.
996
1052
 
997
1053
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
@@ -1009,23 +1065,23 @@ Boolean requesting whether a visible border and background is provided by the ho
1009
1065
  - \`false\`: request no visible border + background
1010
1066
  - omitted: host decides border`)
1011
1067
  });
1012
- var E = object({
1068
+ var _ = object({
1013
1069
  method: literal("ui/request-display-mode"),
1014
- params: object({ mode: W.describe("The display mode being requested.") })
1070
+ params: object({ mode: D.describe("The display mode being requested.") })
1015
1071
  });
1016
- object({ mode: W.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
1017
- var l = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool.");
1072
+ object({ mode: D.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
1073
+ var o = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool.");
1018
1074
  object({
1019
1075
  resourceUri: string().optional(),
1020
- visibility: array(l).optional().describe(`Who can access this tool. Default: ["model", "app"]
1076
+ visibility: array(o).optional().describe(`Who can access this tool. Default: ["model", "app"]
1021
1077
  - "model": Tool visible to and callable by the agent
1022
1078
  - "app": Tool callable by the app from this server only`)
1023
1079
  });
1024
1080
  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.") });
1025
- var C = object({
1081
+ var f = object({
1026
1082
  method: literal("ui/download-file"),
1027
1083
  params: object({ contents: array(union([EmbeddedResourceSchema, ResourceLinkSchema])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.") })
1028
- }), S = object({
1084
+ }), y = object({
1029
1085
  method: literal("ui/message"),
1030
1086
  params: object({
1031
1087
  role: literal("user").describe("Message role, currently only \"user\" is supported."),
@@ -1037,23 +1093,23 @@ object({
1037
1093
  params: object({
1038
1094
  html: string().describe("HTML content to load into the inner iframe."),
1039
1095
  sandbox: string().optional().describe("Optional override for the inner iframe's sandbox attribute."),
1040
- csp: N.optional().describe("CSP configuration from resource metadata."),
1041
- permissions: j.optional().describe("Sandbox permissions from resource metadata.")
1096
+ csp: B.optional().describe("CSP configuration from resource metadata."),
1097
+ permissions: E.optional().describe("Sandbox permissions from resource metadata.")
1042
1098
  })
1043
1099
  });
1044
1100
  object({
1045
1101
  method: literal("ui/notifications/tool-result"),
1046
1102
  params: CallToolResultSchema.describe("Standard MCP tool execution result.")
1047
1103
  });
1048
- var y = object({
1104
+ var x = object({
1049
1105
  toolInfo: object({
1050
1106
  id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."),
1051
1107
  tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.")
1052
1108
  }).optional().describe("Metadata of the tool call that instantiated this App."),
1053
- theme: m.optional().describe("Current color theme preference."),
1109
+ theme: p.optional().describe("Current color theme preference."),
1054
1110
  styles: c.optional().describe("Style configuration for theming the app."),
1055
- displayMode: W.optional().describe("How the UI is currently displayed."),
1056
- availableDisplayModes: array(W).optional().describe("Display modes the host supports."),
1111
+ displayMode: D.optional().describe("How the UI is currently displayed."),
1112
+ availableDisplayModes: array(D).optional().describe("Display modes the host supports."),
1057
1113
  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
1058
1114
  container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),
1059
1115
  locale: string().optional().describe("User's language and region preference in BCP 47 format."),
@@ -1077,29 +1133,29 @@ container holding the app. Specify either width or maxWidth, and either height o
1077
1133
  }).passthrough();
1078
1134
  object({
1079
1135
  method: literal("ui/notifications/host-context-changed"),
1080
- params: y.describe("Partial context update containing only changed fields.")
1136
+ params: x.describe("Partial context update containing only changed fields.")
1081
1137
  });
1082
- var f = object({
1138
+ var d = object({
1083
1139
  method: literal("ui/update-model-context"),
1084
1140
  params: object({
1085
1141
  content: array(ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."),
1086
1142
  structuredContent: record(string(), unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")
1087
1143
  })
1088
- }), d = object({
1144
+ }), b = object({
1089
1145
  method: literal("ui/initialize"),
1090
1146
  params: object({
1091
1147
  appInfo: ImplementationSchema.describe("App identification (name and version)."),
1092
- appCapabilities: i.describe("Features and capabilities this app provides."),
1148
+ appCapabilities: l.describe("Features and capabilities this app provides."),
1093
1149
  protocolVersion: string().describe("Protocol version this app supports.")
1094
1150
  })
1095
1151
  });
1096
1152
  object({
1097
1153
  protocolVersion: string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
1098
1154
  hostInfo: ImplementationSchema.describe("Host application identification and version."),
1099
- hostCapabilities: n.describe("Features and capabilities provided by the host."),
1100
- hostContext: y.describe("Rich context about the host environment.")
1155
+ hostCapabilities: r.describe("Features and capabilities provided by the host."),
1156
+ hostContext: x.describe("Rich context about the host environment.")
1101
1157
  }).passthrough();
1102
- var D = class {
1158
+ var z = class {
1103
1159
  eventTarget;
1104
1160
  eventSource;
1105
1161
  messageListener;
@@ -1134,21 +1190,28 @@ var D = class {
1134
1190
  setProtocolVersion;
1135
1191
  };
1136
1192
  var lQ = [G];
1137
- var rQ = class extends Protocol {
1193
+ var oQ = class extends j {
1138
1194
  _client;
1139
1195
  _hostInfo;
1140
1196
  _capabilities;
1141
1197
  _appCapabilities;
1142
1198
  _hostContext = {};
1143
1199
  _appInfo;
1200
+ eventSchemas = {
1201
+ sizechange: w,
1202
+ sandboxready: T,
1203
+ initialized: S,
1204
+ requestteardown: C,
1205
+ loggingmessage: LoggingMessageNotificationSchema
1206
+ };
1144
1207
  constructor(X, Y, Z, $) {
1145
1208
  super($);
1146
1209
  this._client = X;
1147
1210
  this._hostInfo = Y;
1148
1211
  this._capabilities = Z;
1149
- this._hostContext = $?.hostContext || {}, this.setRequestHandler(d, (J) => this._oninitialize(J)), this.setRequestHandler(PingRequestSchema, (J, K) => {
1212
+ this._hostContext = $?.hostContext || {}, this.setRequestHandler(b, (J) => this._oninitialize(J)), this.setRequestHandler(PingRequestSchema, (J, K) => {
1150
1213
  return this.onping?.(J.params, K), {};
1151
- }), this.setRequestHandler(E, (J) => {
1214
+ }), this.replaceRequestHandler(_, (J) => {
1152
1215
  return { mode: this._hostContext.displayMode ?? "inline" };
1153
1216
  });
1154
1217
  }
@@ -1159,51 +1222,94 @@ var rQ = class extends Protocol {
1159
1222
  return this._appInfo;
1160
1223
  }
1161
1224
  onping;
1225
+ get onsizechange() {
1226
+ return this.getEventHandler("sizechange");
1227
+ }
1162
1228
  set onsizechange(X) {
1163
- this.setNotificationHandler(P, (Y) => X(Y.params));
1229
+ this.setEventHandler("sizechange", X);
1230
+ }
1231
+ get onsandboxready() {
1232
+ return this.getEventHandler("sandboxready");
1164
1233
  }
1165
1234
  set onsandboxready(X) {
1166
- this.setNotificationHandler(L, (Y) => X(Y.params));
1235
+ this.setEventHandler("sandboxready", X);
1236
+ }
1237
+ get oninitialized() {
1238
+ return this.getEventHandler("initialized");
1167
1239
  }
1168
1240
  set oninitialized(X) {
1169
- this.setNotificationHandler(v, (Y) => X(Y.params));
1241
+ this.setEventHandler("initialized", X);
1242
+ }
1243
+ _onmessage;
1244
+ get onmessage() {
1245
+ return this._onmessage;
1170
1246
  }
1171
1247
  set onmessage(X) {
1172
- this.setRequestHandler(S, async (Y, Z) => {
1173
- return X(Y.params, Z);
1248
+ this.warnIfRequestHandlerReplaced("onmessage", this._onmessage, X), this._onmessage = X, this.replaceRequestHandler(y, async (Y, Z) => {
1249
+ if (!this._onmessage) throw Error("No onmessage handler set");
1250
+ return this._onmessage(Y.params, Z);
1174
1251
  });
1175
1252
  }
1253
+ _onopenlink;
1254
+ get onopenlink() {
1255
+ return this._onopenlink;
1256
+ }
1176
1257
  set onopenlink(X) {
1177
- this.setRequestHandler(V, async (Y, Z) => {
1178
- return X(Y.params, Z);
1258
+ this.warnIfRequestHandlerReplaced("onopenlink", this._onopenlink, X), this._onopenlink = X, this.replaceRequestHandler(A, async (Y, Z) => {
1259
+ if (!this._onopenlink) throw Error("No onopenlink handler set");
1260
+ return this._onopenlink(Y.params, Z);
1179
1261
  });
1180
1262
  }
1263
+ _ondownloadfile;
1264
+ get ondownloadfile() {
1265
+ return this._ondownloadfile;
1266
+ }
1181
1267
  set ondownloadfile(X) {
1182
- this.setRequestHandler(C, async (Y, Z) => {
1183
- return X(Y.params, Z);
1268
+ this.warnIfRequestHandlerReplaced("ondownloadfile", this._ondownloadfile, X), this._ondownloadfile = X, this.replaceRequestHandler(f, async (Y, Z) => {
1269
+ if (!this._ondownloadfile) throw Error("No ondownloadfile handler set");
1270
+ return this._ondownloadfile(Y.params, Z);
1184
1271
  });
1185
1272
  }
1273
+ get onrequestteardown() {
1274
+ return this.getEventHandler("requestteardown");
1275
+ }
1186
1276
  set onrequestteardown(X) {
1187
- this.setNotificationHandler(M, (Y) => X(Y.params));
1277
+ this.setEventHandler("requestteardown", X);
1278
+ }
1279
+ _onrequestdisplaymode;
1280
+ get onrequestdisplaymode() {
1281
+ return this._onrequestdisplaymode;
1188
1282
  }
1189
1283
  set onrequestdisplaymode(X) {
1190
- this.setRequestHandler(E, async (Y, Z) => {
1191
- return X(Y.params, Z);
1284
+ this.warnIfRequestHandlerReplaced("onrequestdisplaymode", this._onrequestdisplaymode, X), this._onrequestdisplaymode = X, this.replaceRequestHandler(_, async (Y, Z) => {
1285
+ if (!this._onrequestdisplaymode) throw Error("No onrequestdisplaymode handler set");
1286
+ return this._onrequestdisplaymode(Y.params, Z);
1192
1287
  });
1193
1288
  }
1289
+ get onloggingmessage() {
1290
+ return this.getEventHandler("loggingmessage");
1291
+ }
1194
1292
  set onloggingmessage(X) {
1195
- this.setNotificationHandler(LoggingMessageNotificationSchema, async (Y) => {
1196
- X(Y.params);
1197
- });
1293
+ this.setEventHandler("loggingmessage", X);
1294
+ }
1295
+ _onupdatemodelcontext;
1296
+ get onupdatemodelcontext() {
1297
+ return this._onupdatemodelcontext;
1198
1298
  }
1199
1299
  set onupdatemodelcontext(X) {
1200
- this.setRequestHandler(f, async (Y, Z) => {
1201
- return X(Y.params, Z);
1300
+ this.warnIfRequestHandlerReplaced("onupdatemodelcontext", this._onupdatemodelcontext, X), this._onupdatemodelcontext = X, this.replaceRequestHandler(d, async (Y, Z) => {
1301
+ if (!this._onupdatemodelcontext) throw Error("No onupdatemodelcontext handler set");
1302
+ return this._onupdatemodelcontext(Y.params, Z);
1202
1303
  });
1203
1304
  }
1305
+ _oncalltool;
1306
+ get oncalltool() {
1307
+ return this._oncalltool;
1308
+ }
1204
1309
  set oncalltool(X) {
1205
- this.setRequestHandler(CallToolRequestSchema, async (Y, Z) => {
1206
- return X(Y.params, Z);
1310
+ this.warnIfRequestHandlerReplaced("oncalltool", this._oncalltool, X), this._oncalltool = X, this.replaceRequestHandler(CallToolRequestSchema, async (Y, Z) => {
1311
+ if (!this._oncalltool) throw Error("No oncalltool handler set");
1312
+ return this._oncalltool(Y.params, Z);
1207
1313
  });
1208
1314
  }
1209
1315
  sendToolListChanged(X = {}) {
@@ -1212,19 +1318,34 @@ var rQ = class extends Protocol {
1212
1318
  params: X
1213
1319
  });
1214
1320
  }
1321
+ _onlistresources;
1322
+ get onlistresources() {
1323
+ return this._onlistresources;
1324
+ }
1215
1325
  set onlistresources(X) {
1216
- this.setRequestHandler(ListResourcesRequestSchema, async (Y, Z) => {
1217
- return X(Y.params, Z);
1326
+ this.warnIfRequestHandlerReplaced("onlistresources", this._onlistresources, X), this._onlistresources = X, this.replaceRequestHandler(ListResourcesRequestSchema, async (Y, Z) => {
1327
+ if (!this._onlistresources) throw Error("No onlistresources handler set");
1328
+ return this._onlistresources(Y.params, Z);
1218
1329
  });
1219
1330
  }
1331
+ _onlistresourcetemplates;
1332
+ get onlistresourcetemplates() {
1333
+ return this._onlistresourcetemplates;
1334
+ }
1220
1335
  set onlistresourcetemplates(X) {
1221
- this.setRequestHandler(ListResourceTemplatesRequestSchema, async (Y, Z) => {
1222
- return X(Y.params, Z);
1336
+ this.warnIfRequestHandlerReplaced("onlistresourcetemplates", this._onlistresourcetemplates, X), this._onlistresourcetemplates = X, this.replaceRequestHandler(ListResourceTemplatesRequestSchema, async (Y, Z) => {
1337
+ if (!this._onlistresourcetemplates) throw Error("No onlistresourcetemplates handler set");
1338
+ return this._onlistresourcetemplates(Y.params, Z);
1223
1339
  });
1224
1340
  }
1341
+ _onreadresource;
1342
+ get onreadresource() {
1343
+ return this._onreadresource;
1344
+ }
1225
1345
  set onreadresource(X) {
1226
- this.setRequestHandler(ReadResourceRequestSchema, async (Y, Z) => {
1227
- return X(Y.params, Z);
1346
+ this.warnIfRequestHandlerReplaced("onreadresource", this._onreadresource, X), this._onreadresource = X, this.replaceRequestHandler(ReadResourceRequestSchema, async (Y, Z) => {
1347
+ if (!this._onreadresource) throw Error("No onreadresource handler set");
1348
+ return this._onreadresource(Y.params, Z);
1228
1349
  });
1229
1350
  }
1230
1351
  sendResourceListChanged(X = {}) {
@@ -1233,9 +1354,14 @@ var rQ = class extends Protocol {
1233
1354
  params: X
1234
1355
  });
1235
1356
  }
1357
+ _onlistprompts;
1358
+ get onlistprompts() {
1359
+ return this._onlistprompts;
1360
+ }
1236
1361
  set onlistprompts(X) {
1237
- this.setRequestHandler(ListPromptsRequestSchema, async (Y, Z) => {
1238
- return X(Y.params, Z);
1362
+ this.warnIfRequestHandlerReplaced("onlistprompts", this._onlistprompts, X), this._onlistprompts = X, this.replaceRequestHandler(ListPromptsRequestSchema, async (Y, Z) => {
1363
+ if (!this._onlistprompts) throw Error("No onlistprompts handler set");
1364
+ return this._onlistprompts(Y.params, Z);
1239
1365
  });
1240
1366
  }
1241
1367
  sendPromptListChanged(X = {}) {
@@ -1269,7 +1395,7 @@ var rQ = class extends Protocol {
1269
1395
  let Y = {}, Z = !1;
1270
1396
  for (let $ of Object.keys(X)) {
1271
1397
  let J = this._hostContext[$], K = X[$];
1272
- if (oQ(J, K)) continue;
1398
+ if (tQ(J, K)) continue;
1273
1399
  Y[$] = K, Z = !0;
1274
1400
  }
1275
1401
  if (Z) this._hostContext = X, this.sendHostContextChange(Y);
@@ -1314,9 +1440,21 @@ var rQ = class extends Protocol {
1314
1440
  return this.request({
1315
1441
  method: "ui/resource-teardown",
1316
1442
  params: X
1317
- }, H, Y);
1443
+ }, g, Y);
1318
1444
  }
1319
1445
  sendResourceTeardown = this.teardownResource;
1446
+ callTool(X, Y) {
1447
+ return this.request({
1448
+ method: "tools/call",
1449
+ params: X
1450
+ }, CallToolResultSchema, Y);
1451
+ }
1452
+ listTools(X, Y) {
1453
+ return this.request({
1454
+ method: "tools/list",
1455
+ params: X
1456
+ }, ListToolsResultSchema, Y);
1457
+ }
1320
1458
  async connect(X) {
1321
1459
  if (this.transport) throw Error("AppBridge is already connected. Call close() before connecting again.");
1322
1460
  if (this._client) {
@@ -1360,7 +1498,7 @@ var rQ = class extends Protocol {
1360
1498
  return super.connect(X);
1361
1499
  }
1362
1500
  };
1363
- function oQ(X, Y) {
1501
+ function tQ(X, Y) {
1364
1502
  return JSON.stringify(X) === JSON.stringify(Y);
1365
1503
  }
1366
1504
  //#endregion
@@ -1398,7 +1536,7 @@ var McpAppHost = class {
1398
1536
  constructor(options = {}) {
1399
1537
  this.options = options;
1400
1538
  this._prevDisplayMode = options.hostContext?.displayMode;
1401
- this.bridge = new rQ(null, options.hostInfo ?? DEFAULT_HOST_INFO, options.hostCapabilities ?? DEFAULT_HOST_CAPABILITIES, { hostContext: options.hostContext });
1539
+ this.bridge = new oQ(null, options.hostInfo ?? DEFAULT_HOST_INFO, options.hostCapabilities ?? DEFAULT_HOST_CAPABILITIES, { hostContext: options.hostContext });
1402
1540
  this.bridge.oninitialized = () => {
1403
1541
  this._initialized = true;
1404
1542
  if (this._pendingToolInput) {
@@ -1498,7 +1636,7 @@ var McpAppHost = class {
1498
1636
  console.log(`%c[MCP ↑]%c app → host: %c${label}`, "color:#6ee7b7", "color:inherit", "color:#93c5fd", data);
1499
1637
  };
1500
1638
  window.addEventListener("message", this._messageListener);
1501
- const transport = new D(contentWindow, contentWindow);
1639
+ const transport = new z(contentWindow, contentWindow);
1502
1640
  await this.bridge.connect(transport);
1503
1641
  }
1504
1642
  /**
@@ -4278,4 +4416,4 @@ function Inspector({ children, simulations: initialSimulations = {}, appName = "
4278
4416
  //#endregion
4279
4417
  export { DEFAULT_STYLE_VARIABLES as S, McpAppHost as _, SidebarControl as a, getRegisteredHosts as b, SidebarTextarea as c, ThemeProvider as d, useThemeContext as f, extractResourceCSP as g, IframeResource as h, SidebarCollapsibleControl as i, SidebarToggle as l, useInspectorState as m, resolveServerToolResult as n, SidebarInput as o, useMcpConnection as p, SidebarCheckbox as r, SidebarSelect as s, Inspector as t, SimpleSidebar as u, SCREEN_WIDTHS as v, registerHostShell as x, getHostShell as y };
4280
4418
 
4281
- //# sourceMappingURL=inspector-Cdo5BK2D.js.map
4419
+ //# sourceMappingURL=inspector-Bp9jrHIu.js.map