sunpeak 0.18.9 → 0.18.13

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 (68) hide show
  1. package/README.md +12 -0
  2. package/bin/commands/inspect.mjs +4 -1
  3. package/bin/commands/start.mjs +2 -1
  4. package/bin/lib/sandbox-server.mjs +12 -1
  5. package/dist/chatgpt/index.cjs +1 -1
  6. package/dist/chatgpt/index.js +1 -1
  7. package/dist/claude/index.cjs +1 -1
  8. package/dist/claude/index.js +1 -1
  9. package/dist/host/chatgpt/index.cjs +1 -1
  10. package/dist/host/chatgpt/index.js +1 -1
  11. package/dist/index.cjs +93 -93
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.js +54 -54
  14. package/dist/index.js.map +1 -1
  15. package/dist/inspector/hosts.d.ts +12 -0
  16. package/dist/inspector/index.cjs +1 -1
  17. package/dist/inspector/index.js +1 -1
  18. package/dist/{inspector-CTMccsz9.cjs → inspector-8nPV2A-z.cjs} +93 -51
  19. package/dist/inspector-8nPV2A-z.cjs.map +1 -0
  20. package/dist/{inspector-DkS75JCk.js → inspector-Cdo5BK2D.js} +92 -50
  21. package/dist/inspector-Cdo5BK2D.js.map +1 -0
  22. package/dist/mcp/index.cjs +69 -62
  23. package/dist/mcp/index.cjs.map +1 -1
  24. package/dist/mcp/index.js +63 -56
  25. package/dist/mcp/index.js.map +1 -1
  26. package/dist/mcp/production-server.d.ts +12 -0
  27. package/dist/{protocol-DJmRaBzO.js → protocol-BfAACnv0.js} +14 -9
  28. package/dist/{protocol-DJmRaBzO.js.map → protocol-BfAACnv0.js.map} +1 -1
  29. package/dist/{protocol-jbxhzcnS.cjs → protocol-C7kTcBr_.cjs} +14 -9
  30. package/dist/{protocol-jbxhzcnS.cjs.map → protocol-C7kTcBr_.cjs.map} +1 -1
  31. package/dist/style.css +36 -1
  32. package/dist/{use-app-BNbz1uzj.js → use-app-CfP9VypY.js} +107 -56
  33. package/dist/use-app-CfP9VypY.js.map +1 -0
  34. package/dist/{use-app-Dqh20JPP.cjs → use-app-CzcYw1Kz.cjs} +165 -114
  35. package/dist/use-app-CzcYw1Kz.cjs.map +1 -0
  36. package/package.json +3 -3
  37. package/template/README.md +12 -0
  38. package/template/dist/albums/albums.html +16 -15
  39. package/template/dist/albums/albums.json +1 -1
  40. package/template/dist/carousel/carousel.html +20 -19
  41. package/template/dist/carousel/carousel.json +1 -1
  42. package/template/dist/map/map.html +7 -6
  43. package/template/dist/map/map.json +1 -1
  44. package/template/dist/review/review.html +6 -5
  45. package/template/dist/review/review.json +1 -1
  46. package/template/node_modules/.vite/deps/_metadata.json +3 -3
  47. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +49 -49
  48. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -1
  49. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +49 -49
  50. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -1
  51. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +89 -89
  52. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
  53. package/template/node_modules/.vite-mcp/deps/_metadata.json +24 -24
  54. package/template/node_modules/.vite-mcp/deps/{protocol-CTflwIfG.js → protocol-B_qKkui_.js} +14 -9
  55. package/template/node_modules/.vite-mcp/deps/protocol-B_qKkui_.js.map +1 -0
  56. package/template/src/resources/carousel/carousel.test.tsx +16 -2
  57. package/template/src/resources/carousel/carousel.tsx +42 -14
  58. package/template/src/resources/carousel/components/carousel.tsx +20 -0
  59. package/template/src/resources/carousel/components/index.ts +1 -0
  60. package/template/src/resources/carousel/components/place-detail.tsx +153 -0
  61. package/template/tests/e2e/carousel.spec.ts +125 -0
  62. package/template/tests/live/carousel.spec.ts +2 -2
  63. package/template/tests/simulations/show-carousel.json +54 -5
  64. package/dist/inspector-CTMccsz9.cjs.map +0 -1
  65. package/dist/inspector-DkS75JCk.js.map +0 -1
  66. package/dist/use-app-BNbz1uzj.js.map +0 -1
  67. package/dist/use-app-Dqh20JPP.cjs.map +0 -1
  68. package/template/node_modules/.vite-mcp/deps/protocol-CTflwIfG.js.map +0 -1
@@ -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-DJmRaBzO.js";
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";
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";
@@ -377,7 +377,7 @@ function Conversation({ children, screenWidth, displayMode, platform, onRequestD
377
377
  //#region src/chatgpt/chatgpt-host.ts
378
378
  /**
379
379
  * ChatGPT host version info — matches what ChatGPT reports via the MCP protocol.
380
- * Verified against production ChatGPT on 2026-03-19.
380
+ * Verified against production ChatGPT on 2026-03-30.
381
381
  */
382
382
  var CHATGPT_HOST_INFO = {
383
383
  name: "chatgpt",
@@ -409,6 +409,11 @@ registerHostShell({
409
409
  hostCapabilities: CHATGPT_HOST_CAPABILITIES,
410
410
  userAgent: "chatgpt",
411
411
  styleVariables: { ...DEFAULT_STYLE_VARIABLES },
412
+ safeAreaByDisplayMode: {
413
+ inline: {},
414
+ fullscreen: { bottom: 150 },
415
+ pip: {}
416
+ },
412
417
  pageStyles: {
413
418
  "--sim-bg-sidebar": "light-dark(#ffffff, #212121)",
414
419
  "--sim-bg-conversation": "light-dark(#ffffff, #212121)",
@@ -664,7 +669,7 @@ function ClaudeConversation({ children, screenWidth, displayMode, platform, onRe
664
669
  //#region src/claude/claude-host.ts
665
670
  /**
666
671
  * Claude host version info — matches what Claude reports via the MCP protocol.
667
- * Verified against production Claude on 2026-03-25.
672
+ * Verified against production Claude on 2026-03-30.
668
673
  */
669
674
  var CLAUDE_HOST_INFO = {
670
675
  name: "Claude",
@@ -672,7 +677,7 @@ var CLAUDE_HOST_INFO = {
672
677
  };
673
678
  /**
674
679
  * Claude host capabilities — matches what Claude reports via the MCP protocol.
675
- * Verified against production Claude on 2026-03-25.
680
+ * Verified against production Claude on 2026-03-30.
676
681
  *
677
682
  * Notable: Claude supports downloadFile, updateModelContext.image, and
678
683
  * message.text. serverTools and serverResources both report listChanged.
@@ -775,6 +780,15 @@ registerHostShell({
775
780
  "--sim-bg-user-bubble": "light-dark(rgb(240, 238, 230), rgb(20, 20, 19))",
776
781
  "--sim-bg-reply-input": "light-dark(rgb(255, 255, 255), rgb(48, 48, 46))"
777
782
  },
783
+ safeAreaByDisplayMode: {
784
+ inline: {},
785
+ fullscreen: {
786
+ top: 16,
787
+ right: 16,
788
+ bottom: 138,
789
+ left: 16
790
+ }
791
+ },
778
792
  availableDisplayModes: ["inline", "fullscreen"],
779
793
  fontCss: `@font-face {
780
794
  font-family: "Anthropic Sans";
@@ -794,12 +808,12 @@ registerHostShell({
794
808
  }`
795
809
  });
796
810
  //#endregion
797
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.3.1_@modelcontextprotocol+sdk@1.27.1_zod@4.3.6__react-_cd1fb28fd87e0bddd0a29eba0721855d/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js
798
- var G = "2026-01-26", p = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), D = union([
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([
799
813
  literal("inline"),
800
814
  literal("fullscreen"),
801
815
  literal("pip")
802
- ]).describe("Display mode for UI presentation."), AQ = record(union([
816
+ ]).describe("Display mode for UI presentation."), OQ = record(union([
803
817
  literal("--color-background-primary"),
804
818
  literal("--color-background-secondary"),
805
819
  literal("--color-background-tertiary"),
@@ -904,7 +918,7 @@ object({ isError: boolean().optional().describe("True if the host rejected or fa
904
918
  var L = object({
905
919
  method: literal("ui/notifications/sandbox-proxy-ready"),
906
920
  params: object({})
907
- }), j = object({
921
+ }), N = object({
908
922
  connectDomains: array(string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
909
923
 
910
924
  - Maps to CSP \`connect-src\` directive
@@ -912,7 +926,7 @@ var L = object({
912
926
  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)"),
913
927
  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'`)"),
914
928
  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'`)")
915
- }), E = object({
929
+ }), j = object({
916
930
  camera: object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),
917
931
  microphone: object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),
918
932
  geolocation: object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),
@@ -936,9 +950,9 @@ object({
936
950
  method: literal("ui/notifications/tool-cancelled"),
937
951
  params: object({ reason: string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
938
952
  });
939
- var c = object({ fonts: string().optional() }), n = object({
940
- variables: AQ.optional().describe("CSS variables for theming the app."),
941
- css: c.optional().describe("CSS blocks that apps can inject.")
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.")
942
956
  });
943
957
  object({
944
958
  method: literal("ui/resource-teardown"),
@@ -954,7 +968,7 @@ var H = record(string(), unknown()), O = object({
954
968
  }), M = object({
955
969
  method: literal("ui/notifications/request-teardown"),
956
970
  params: object({}).optional()
957
- }), i = object({
971
+ }), n = object({
958
972
  experimental: object({}).optional().describe("Experimental features (structure TBD)."),
959
973
  openLinks: object({}).optional().describe("Host supports opening external URLs."),
960
974
  downloadFile: object({}).optional().describe("Host supports file downloads via ui/download-file."),
@@ -962,22 +976,22 @@ var H = record(string(), unknown()), O = object({
962
976
  serverResources: object({ listChanged: boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
963
977
  logging: object({}).optional().describe("Host accepts log messages."),
964
978
  sandbox: object({
965
- permissions: E.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
966
- csp: j.optional().describe("CSP domains approved by the host.")
979
+ permissions: j.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
980
+ csp: N.optional().describe("CSP domains approved by the host.")
967
981
  }).optional().describe("Sandbox configuration applied by the host."),
968
982
  updateModelContext: O.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
969
983
  message: O.optional().describe("Host supports receiving content messages (ui/message) from the view.")
970
- }), l = object({
984
+ }), i = object({
971
985
  experimental: object({}).optional().describe("Experimental features (structure TBD)."),
972
986
  tools: object({ listChanged: boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
973
- availableDisplayModes: array(D).optional().describe("Display modes the app supports.")
987
+ availableDisplayModes: array(W).optional().describe("Display modes the app supports.")
974
988
  }), v = object({
975
989
  method: literal("ui/notifications/initialized"),
976
990
  params: object({}).optional()
977
991
  });
978
992
  object({
979
- csp: j.optional().describe("Content Security Policy configuration for UI resources."),
980
- permissions: E.optional().describe("Sandbox permissions requested by the UI resource."),
993
+ csp: N.optional().describe("Content Security Policy configuration for UI resources."),
994
+ permissions: j.optional().describe("Sandbox permissions requested by the UI resource."),
981
995
  domain: string().optional().describe(`Dedicated origin for view sandbox.
982
996
 
983
997
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
@@ -995,15 +1009,15 @@ Boolean requesting whether a visible border and background is provided by the ho
995
1009
  - \`false\`: request no visible border + background
996
1010
  - omitted: host decides border`)
997
1011
  });
998
- var W = object({
1012
+ var E = object({
999
1013
  method: literal("ui/request-display-mode"),
1000
- params: object({ mode: D.describe("The display mode being requested.") })
1014
+ params: object({ mode: W.describe("The display mode being requested.") })
1001
1015
  });
1002
- object({ mode: D.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
1003
- var r = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool.");
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.");
1004
1018
  object({
1005
1019
  resourceUri: string().optional(),
1006
- visibility: array(r).optional().describe(`Who can access this tool. Default: ["model", "app"]
1020
+ visibility: array(l).optional().describe(`Who can access this tool. Default: ["model", "app"]
1007
1021
  - "model": Tool visible to and callable by the agent
1008
1022
  - "app": Tool callable by the app from this server only`)
1009
1023
  });
@@ -1023,8 +1037,8 @@ object({
1023
1037
  params: object({
1024
1038
  html: string().describe("HTML content to load into the inner iframe."),
1025
1039
  sandbox: string().optional().describe("Optional override for the inner iframe's sandbox attribute."),
1026
- csp: j.optional().describe("CSP configuration from resource metadata."),
1027
- permissions: E.optional().describe("Sandbox permissions from resource metadata.")
1040
+ csp: N.optional().describe("CSP configuration from resource metadata."),
1041
+ permissions: j.optional().describe("Sandbox permissions from resource metadata.")
1028
1042
  })
1029
1043
  });
1030
1044
  object({
@@ -1036,10 +1050,10 @@ var y = object({
1036
1050
  id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."),
1037
1051
  tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.")
1038
1052
  }).optional().describe("Metadata of the tool call that instantiated this App."),
1039
- theme: p.optional().describe("Current color theme preference."),
1040
- styles: n.optional().describe("Style configuration for theming the app."),
1041
- displayMode: D.optional().describe("How the UI is currently displayed."),
1042
- availableDisplayModes: array(D).optional().describe("Display modes the host supports."),
1053
+ theme: m.optional().describe("Current color theme preference."),
1054
+ 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."),
1043
1057
  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
1044
1058
  container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),
1045
1059
  locale: string().optional().describe("User's language and region preference in BCP 47 format."),
@@ -1075,17 +1089,17 @@ var f = object({
1075
1089
  method: literal("ui/initialize"),
1076
1090
  params: object({
1077
1091
  appInfo: ImplementationSchema.describe("App identification (name and version)."),
1078
- appCapabilities: l.describe("Features and capabilities this app provides."),
1092
+ appCapabilities: i.describe("Features and capabilities this app provides."),
1079
1093
  protocolVersion: string().describe("Protocol version this app supports.")
1080
1094
  })
1081
1095
  });
1082
1096
  object({
1083
1097
  protocolVersion: string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
1084
1098
  hostInfo: ImplementationSchema.describe("Host application identification and version."),
1085
- hostCapabilities: i.describe("Features and capabilities provided by the host."),
1099
+ hostCapabilities: n.describe("Features and capabilities provided by the host."),
1086
1100
  hostContext: y.describe("Rich context about the host environment.")
1087
1101
  }).passthrough();
1088
- var N = class {
1102
+ var D = class {
1089
1103
  eventTarget;
1090
1104
  eventSource;
1091
1105
  messageListener;
@@ -1119,8 +1133,8 @@ var N = class {
1119
1133
  sessionId;
1120
1134
  setProtocolVersion;
1121
1135
  };
1122
- var aQ = [G];
1123
- var tQ = class extends Protocol {
1136
+ var lQ = [G];
1137
+ var rQ = class extends Protocol {
1124
1138
  _client;
1125
1139
  _hostInfo;
1126
1140
  _capabilities;
@@ -1132,9 +1146,9 @@ var tQ = class extends Protocol {
1132
1146
  this._client = X;
1133
1147
  this._hostInfo = Y;
1134
1148
  this._capabilities = Z;
1135
- this._hostContext = $?.hostContext || {}, this.setRequestHandler(d, (K) => this._oninitialize(K)), this.setRequestHandler(PingRequestSchema, (K, J) => {
1136
- return this.onping?.(K.params, J), {};
1137
- }), this.setRequestHandler(W, (K) => {
1149
+ this._hostContext = $?.hostContext || {}, this.setRequestHandler(d, (J) => this._oninitialize(J)), this.setRequestHandler(PingRequestSchema, (J, K) => {
1150
+ return this.onping?.(J.params, K), {};
1151
+ }), this.setRequestHandler(E, (J) => {
1138
1152
  return { mode: this._hostContext.displayMode ?? "inline" };
1139
1153
  });
1140
1154
  }
@@ -1173,7 +1187,7 @@ var tQ = class extends Protocol {
1173
1187
  this.setNotificationHandler(M, (Y) => X(Y.params));
1174
1188
  }
1175
1189
  set onrequestdisplaymode(X) {
1176
- this.setRequestHandler(W, async (Y, Z) => {
1190
+ this.setRequestHandler(E, async (Y, Z) => {
1177
1191
  return X(Y.params, Z);
1178
1192
  });
1179
1193
  }
@@ -1245,7 +1259,7 @@ var tQ = class extends Protocol {
1245
1259
  async _oninitialize(X) {
1246
1260
  let Y = X.params.protocolVersion;
1247
1261
  return this._appCapabilities = X.params.appCapabilities, this._appInfo = X.params.appInfo, {
1248
- protocolVersion: aQ.includes(Y) ? Y : G,
1262
+ protocolVersion: lQ.includes(Y) ? Y : G,
1249
1263
  hostCapabilities: this.getCapabilities(),
1250
1264
  hostInfo: this._hostInfo,
1251
1265
  hostContext: this._hostContext
@@ -1254,9 +1268,9 @@ var tQ = class extends Protocol {
1254
1268
  setHostContext(X) {
1255
1269
  let Y = {}, Z = !1;
1256
1270
  for (let $ of Object.keys(X)) {
1257
- let K = this._hostContext[$], J = X[$];
1258
- if (sQ(K, J)) continue;
1259
- Y[$] = J, Z = !0;
1271
+ let J = this._hostContext[$], K = X[$];
1272
+ if (oQ(J, K)) continue;
1273
+ Y[$] = K, Z = !0;
1260
1274
  }
1261
1275
  if (Z) this._hostContext = X, this.sendHostContextChange(Y);
1262
1276
  }
@@ -1346,7 +1360,7 @@ var tQ = class extends Protocol {
1346
1360
  return super.connect(X);
1347
1361
  }
1348
1362
  };
1349
- function sQ(X, Y) {
1363
+ function oQ(X, Y) {
1350
1364
  return JSON.stringify(X) === JSON.stringify(Y);
1351
1365
  }
1352
1366
  //#endregion
@@ -1384,7 +1398,7 @@ var McpAppHost = class {
1384
1398
  constructor(options = {}) {
1385
1399
  this.options = options;
1386
1400
  this._prevDisplayMode = options.hostContext?.displayMode;
1387
- this.bridge = new tQ(null, options.hostInfo ?? DEFAULT_HOST_INFO, options.hostCapabilities ?? DEFAULT_HOST_CAPABILITIES, { hostContext: options.hostContext });
1401
+ this.bridge = new rQ(null, options.hostInfo ?? DEFAULT_HOST_INFO, options.hostCapabilities ?? DEFAULT_HOST_CAPABILITIES, { hostContext: options.hostContext });
1388
1402
  this.bridge.oninitialized = () => {
1389
1403
  this._initialized = true;
1390
1404
  if (this._pendingToolInput) {
@@ -1461,7 +1475,10 @@ var McpAppHost = class {
1461
1475
  if (this.options.onRequestTeardown) this.options.onRequestTeardown();
1462
1476
  else console.log("[MCP App] requestTeardown (app requested close)");
1463
1477
  };
1478
+ let sandboxReadyFired = false;
1464
1479
  this.bridge.onsandboxready = () => {
1480
+ if (sandboxReadyFired) return;
1481
+ sandboxReadyFired = true;
1465
1482
  this.options.onSandboxReady?.();
1466
1483
  };
1467
1484
  }
@@ -1481,7 +1498,7 @@ var McpAppHost = class {
1481
1498
  console.log(`%c[MCP ↑]%c app → host: %c${label}`, "color:#6ee7b7", "color:inherit", "color:#93c5fd", data);
1482
1499
  };
1483
1500
  window.addEventListener("message", this._messageListener);
1484
- const transport = new N(contentWindow, contentWindow);
1501
+ const transport = new D(contentWindow, contentWindow);
1485
1502
  await this.bridge.connect(transport);
1486
1503
  }
1487
1504
  /**
@@ -1800,6 +1817,7 @@ iframe { border: none; width: 100%; height: 100%; display: block; }
1800
1817
  });
1801
1818
 
1802
1819
  function createInnerFrame(params) {
1820
+ clearInterval(readyInterval);
1803
1821
  if (innerFrame) innerFrame.remove();
1804
1822
 
1805
1823
  innerFrame = document.createElement('iframe');
@@ -1819,6 +1837,7 @@ iframe { border: none; width: 100%; height: 100%; display: block; }
1819
1837
  }
1820
1838
 
1821
1839
  function createInnerFrameWithSrc(params) {
1840
+ clearInterval(readyInterval);
1822
1841
  if (innerFrame) innerFrame.remove();
1823
1842
 
1824
1843
  innerFrame = document.createElement('iframe');
@@ -1896,9 +1915,20 @@ iframe { border: none; width: 100%; height: 100%; display: block; }
1896
1915
  '});}});';
1897
1916
 
1898
1917
  // Signal to the host that the proxy is ready.
1899
- // Use setTimeout to ensure the host's PostMessageTransport listener
1900
- // is set up before we send the ready notification. The srcdoc is parsed
1901
- // synchronously by the browser, which can race with React's ref callback.
1918
+ // The srcdoc is parsed synchronously by the browser, which can race with
1919
+ // React's ref callback that sets up the PostMessage listener. To handle
1920
+ // this, we send the ready notification repeatedly until the host
1921
+ // acknowledges it (by sending content to load). The interval is cleared
1922
+ // as soon as we receive any message from the host (createInnerFrame or
1923
+ // createInnerFrameWithSrc), or after 10 seconds as a safety limit.
1924
+ var readyInterval = setInterval(function() {
1925
+ window.parent.postMessage({
1926
+ jsonrpc: '2.0',
1927
+ method: 'ui/notifications/sandbox-proxy-ready',
1928
+ params: {}
1929
+ }, '*');
1930
+ }, 200);
1931
+ // Send the first one immediately (next tick)
1902
1932
  setTimeout(function() {
1903
1933
  window.parent.postMessage({
1904
1934
  jsonrpc: '2.0',
@@ -1906,6 +1936,9 @@ iframe { border: none; width: 100%; height: 100%; display: block; }
1906
1936
  params: {}
1907
1937
  }, '*');
1908
1938
  }, 0);
1939
+ // Stop retrying after 10 seconds — if the host hasn't responded by then,
1940
+ // something else is wrong.
1941
+ setTimeout(function() { clearInterval(readyInterval); }, 10000);
1909
1942
  })();
1910
1943
  <\/script>
1911
1944
  </body>
@@ -2515,6 +2548,15 @@ function useInspectorState({ simulations, defaultHost = "chatgpt" }) {
2515
2548
  useEffect(() => {
2516
2549
  if (isMobileWidth(screenWidth) && displayMode === "pip") _setDisplayMode("fullscreen");
2517
2550
  }, [screenWidth, displayMode]);
2551
+ useEffect(() => {
2552
+ const modeInsets = getHostShell(activeHost)?.safeAreaByDisplayMode?.[displayMode];
2553
+ if (modeInsets) setSafeAreaInsets({
2554
+ top: modeInsets.top ?? 0,
2555
+ bottom: modeInsets.bottom ?? 0,
2556
+ left: modeInsets.left ?? 0,
2557
+ right: modeInsets.right ?? 0
2558
+ });
2559
+ }, [displayMode, activeHost]);
2518
2560
  const handleDisplayModeChange = (mode) => {
2519
2561
  setDisplayMode(mode);
2520
2562
  };
@@ -4236,4 +4278,4 @@ function Inspector({ children, simulations: initialSimulations = {}, appName = "
4236
4278
  //#endregion
4237
4279
  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 };
4238
4280
 
4239
- //# sourceMappingURL=inspector-DkS75JCk.js.map
4281
+ //# sourceMappingURL=inspector-Cdo5BK2D.js.map