sunpeak 0.16.29 → 0.17.2

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 (140) hide show
  1. package/bin/commands/dev.mjs +169 -342
  2. package/bin/commands/inspect.mjs +763 -0
  3. package/bin/commands/new.mjs +2 -2
  4. package/bin/lib/inspect/inspect-config.d.mts +20 -0
  5. package/bin/lib/inspect/inspect-config.mjs +76 -0
  6. package/bin/lib/live/global-setup.mjs +6 -1
  7. package/bin/sunpeak.js +11 -1
  8. package/dist/chatgpt/globals.css +8 -0
  9. package/dist/chatgpt/index.cjs +3 -11
  10. package/dist/chatgpt/index.cjs.map +1 -1
  11. package/dist/chatgpt/index.d.ts +2 -2
  12. package/dist/chatgpt/index.js +4 -8
  13. package/dist/chatgpt/index.js.map +1 -1
  14. package/dist/claude/index.cjs +1 -1
  15. package/dist/claude/index.js +1 -1
  16. package/dist/discovery-Cgoegt62.js +114 -0
  17. package/dist/discovery-Cgoegt62.js.map +1 -0
  18. package/dist/discovery-Clu4uHp1.cjs +161 -0
  19. package/dist/discovery-Clu4uHp1.cjs.map +1 -0
  20. package/dist/index.cjs +1 -4
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.js +2 -3
  23. package/dist/index.js.map +1 -1
  24. package/dist/lib/discovery-cli.cjs +1 -1
  25. package/dist/lib/discovery-cli.js +1 -1
  26. package/dist/lib/discovery.d.ts +7 -67
  27. package/dist/lib/index.d.ts +0 -1
  28. package/dist/mcp/index.cjs +34 -23
  29. package/dist/mcp/index.cjs.map +1 -1
  30. package/dist/mcp/index.js +34 -23
  31. package/dist/mcp/index.js.map +1 -1
  32. package/dist/mcp/types.d.ts +5 -0
  33. package/dist/simulator/index.cjs +5 -11
  34. package/dist/simulator/index.cjs.map +1 -1
  35. package/dist/simulator/index.d.ts +4 -2
  36. package/dist/simulator/index.js +5 -8
  37. package/dist/simulator/index.js.map +1 -1
  38. package/dist/simulator/simple-sidebar.d.ts +7 -4
  39. package/dist/simulator/simulator-url.d.ts +8 -0
  40. package/dist/simulator/simulator.d.ts +15 -2
  41. package/dist/simulator/use-mcp-connection.d.ts +19 -0
  42. package/dist/{simulator-DIVvI69i.cjs → simulator-CH9hs0N6.cjs} +129 -21
  43. package/dist/simulator-CH9hs0N6.cjs.map +1 -0
  44. package/dist/{simulator-C7mkK7Sz.js → simulator-Dl8B-Ljb.js} +124 -22
  45. package/dist/simulator-Dl8B-Ljb.js.map +1 -0
  46. package/dist/{simulator-url-BDGD4vZD.cjs → simulator-url-CozKF1jf.cjs} +3 -1
  47. package/dist/simulator-url-CozKF1jf.cjs.map +1 -0
  48. package/dist/{simulator-url-Bkxj43yT.js → simulator-url-KoS_ToP6.js} +3 -1
  49. package/dist/simulator-url-KoS_ToP6.js.map +1 -0
  50. package/dist/style.css +8 -0
  51. package/package.json +11 -3
  52. package/template/dist/albums/albums.html +105 -0
  53. package/template/dist/albums/albums.json +16 -0
  54. package/template/dist/carousel/carousel.html +105 -0
  55. package/template/dist/carousel/carousel.json +16 -0
  56. package/template/dist/map/map.html +3060 -0
  57. package/template/dist/map/map.json +22 -0
  58. package/template/dist/review/review.html +105 -0
  59. package/template/dist/review/review.json +16 -0
  60. package/template/dist/server.js +15 -0
  61. package/template/dist/tools/review-diff.js +50 -0
  62. package/template/dist/tools/review-post.js +50 -0
  63. package/template/dist/tools/review-purchase.js +61 -0
  64. package/template/dist/tools/review.js +31 -0
  65. package/template/dist/tools/show-albums.js +56 -0
  66. package/template/dist/tools/show-carousel.js +41 -0
  67. package/template/dist/tools/show-map.js +47 -0
  68. package/template/node_modules/.vite/deps/_metadata.json +8 -0
  69. package/template/node_modules/.vite/deps/package.json +3 -0
  70. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +500 -0
  71. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -0
  72. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +563 -0
  73. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -0
  74. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +575 -0
  75. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -0
  76. package/template/node_modules/.vite-mcp/deps/@testing-library_react.js +11363 -0
  77. package/template/node_modules/.vite-mcp/deps/@testing-library_react.js.map +1 -0
  78. package/template/node_modules/.vite-mcp/deps/_metadata.json +130 -0
  79. package/template/node_modules/.vite-mcp/deps/chunk-BoAXSpZd.js +33 -0
  80. package/template/node_modules/.vite-mcp/deps/client-CU1wWud4.js +14385 -0
  81. package/template/node_modules/.vite-mcp/deps/client-CU1wWud4.js.map +1 -0
  82. package/template/node_modules/.vite-mcp/deps/clsx.js +18 -0
  83. package/template/node_modules/.vite-mcp/deps/clsx.js.map +1 -0
  84. package/template/node_modules/.vite-mcp/deps/dist-uWX8WbjY.js +505 -0
  85. package/template/node_modules/.vite-mcp/deps/dist-uWX8WbjY.js.map +1 -0
  86. package/template/node_modules/.vite-mcp/deps/embla-carousel-react.js +1461 -0
  87. package/template/node_modules/.vite-mcp/deps/embla-carousel-react.js.map +1 -0
  88. package/template/node_modules/.vite-mcp/deps/embla-carousel-wheel-gestures.js +536 -0
  89. package/template/node_modules/.vite-mcp/deps/embla-carousel-wheel-gestures.js.map +1 -0
  90. package/template/node_modules/.vite-mcp/deps/magic-string.es-Cklsmr-5.js +1013 -0
  91. package/template/node_modules/.vite-mcp/deps/magic-string.es-Cklsmr-5.js.map +1 -0
  92. package/template/node_modules/.vite-mcp/deps/mapbox-gl.js +46311 -0
  93. package/template/node_modules/.vite-mcp/deps/mapbox-gl.js.map +1 -0
  94. package/template/node_modules/.vite-mcp/deps/package.json +3 -0
  95. package/template/node_modules/.vite-mcp/deps/protocol-CTflwIfG.js +2090 -0
  96. package/template/node_modules/.vite-mcp/deps/protocol-CTflwIfG.js.map +1 -0
  97. package/template/node_modules/.vite-mcp/deps/react-dom.js +186 -0
  98. package/template/node_modules/.vite-mcp/deps/react-dom.js.map +1 -0
  99. package/template/node_modules/.vite-mcp/deps/react-dom_client.js +2 -0
  100. package/template/node_modules/.vite-mcp/deps/react.js +769 -0
  101. package/template/node_modules/.vite-mcp/deps/react.js.map +1 -0
  102. package/template/node_modules/.vite-mcp/deps/react_jsx-dev-runtime.js +205 -0
  103. package/template/node_modules/.vite-mcp/deps/react_jsx-dev-runtime.js.map +1 -0
  104. package/template/node_modules/.vite-mcp/deps/react_jsx-runtime.js +209 -0
  105. package/template/node_modules/.vite-mcp/deps/react_jsx-runtime.js.map +1 -0
  106. package/template/node_modules/.vite-mcp/deps/schemas-NsgmY9QV.js +12157 -0
  107. package/template/node_modules/.vite-mcp/deps/schemas-NsgmY9QV.js.map +1 -0
  108. package/template/node_modules/.vite-mcp/deps/tailwind-merge.js +2025 -0
  109. package/template/node_modules/.vite-mcp/deps/tailwind-merge.js.map +1 -0
  110. package/template/node_modules/.vite-mcp/deps/vitest.js +14021 -0
  111. package/template/node_modules/.vite-mcp/deps/vitest.js.map +1 -0
  112. package/template/node_modules/.vite-mcp/deps/zod.js +624 -0
  113. package/template/node_modules/.vite-mcp/deps/zod.js.map +1 -0
  114. package/template/src/tools/review-diff.test.ts +5 -1
  115. package/template/src/tools/review-diff.ts +1 -1
  116. package/template/src/tools/review-post.test.ts +5 -1
  117. package/template/src/tools/review-post.ts +1 -1
  118. package/template/src/tools/review-purchase.test.ts +5 -1
  119. package/template/src/tools/review-purchase.ts +1 -1
  120. package/template/src/tools/review.test.ts +5 -1
  121. package/template/src/tools/review.ts +1 -1
  122. package/template/src/tools/show-albums.test.ts +5 -1
  123. package/template/src/tools/show-albums.ts +1 -1
  124. package/template/src/tools/show-carousel.test.ts +5 -1
  125. package/template/src/tools/show-carousel.ts +1 -1
  126. package/template/src/tools/show-map.test.ts +5 -1
  127. package/template/src/tools/show-map.ts +1 -1
  128. package/dist/discovery-BxKCIgG5.cjs +0 -332
  129. package/dist/discovery-BxKCIgG5.cjs.map +0 -1
  130. package/dist/discovery-Du4LHrih.js +0 -261
  131. package/dist/discovery-Du4LHrih.js.map +0 -1
  132. package/dist/simulator-C7mkK7Sz.js.map +0 -1
  133. package/dist/simulator-DIVvI69i.cjs.map +0 -1
  134. package/dist/simulator-url-BDGD4vZD.cjs.map +0 -1
  135. package/dist/simulator-url-Bkxj43yT.js.map +0 -1
  136. package/template/.sunpeak/dev.tsx +0 -79
  137. package/template/.sunpeak/resource-loader.html +0 -20
  138. package/template/.sunpeak/resource-loader.tsx +0 -57
  139. package/template/index.html +0 -14
  140. package/template/src/resources/index.ts +0 -17
@@ -0,0 +1,563 @@
1
+ import { Cn as object, In as string, Jn as union, Sn as number, St as _undefined, Tt as array, Yn as unknown, jn as record, kt as boolean, ln as literal } from "./schemas-NsgmY9QV.js";
2
+ import { C as ResourceListChangedNotificationSchema, S as ResourceLinkSchema, T as ToolSchema, _ as PingRequestSchema, a as EmbeddedResourceSchema, b as ReadResourceResultSchema, c as JSONRPCMessageSchema, d as ListResourceTemplatesRequestSchema, f as ListResourceTemplatesResultSchema, g as LoggingMessageNotificationSchema, i as ContentBlockSchema, l as ListPromptsRequestSchema, m as ListResourcesResultSchema, n as CallToolRequestSchema, p as ListResourcesRequestSchema, r as CallToolResultSchema, s as ImplementationSchema, t as Protocol, u as ListPromptsResultSchema, v as PromptListChangedNotificationSchema, w as ToolListChangedNotificationSchema, x as RequestIdSchema, y as ReadResourceRequestSchema } from "./protocol-CTflwIfG.js";
3
+ //#region ../../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.2.2_@modelcontextprotocol+sdk@1.27.1_zod@4.3.6__react-_e9bf7657371391a829fe8b4e289b253c/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js
4
+ var G = "2026-01-26", t = "ui/open-link", s = "ui/download-file", e = "ui/message", QQ = "ui/notifications/sandbox-proxy-ready", XQ = "ui/notifications/sandbox-resource-ready", YQ = "ui/notifications/size-changed", ZQ = "ui/notifications/tool-input", _ = "ui/notifications/tool-input-partial", $Q = "ui/notifications/tool-result", JQ = "ui/notifications/tool-cancelled", KQ = "ui/notifications/host-context-changed", GQ = "ui/resource-teardown", DQ = "ui/initialize", NQ = "ui/notifications/initialized", jQ = "ui/request-display-mode";
5
+ var m = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), D = union([
6
+ literal("inline"),
7
+ literal("fullscreen"),
8
+ literal("pip")
9
+ ]).describe("Display mode for UI presentation."), VQ = record(union([
10
+ literal("--color-background-primary"),
11
+ literal("--color-background-secondary"),
12
+ literal("--color-background-tertiary"),
13
+ literal("--color-background-inverse"),
14
+ literal("--color-background-ghost"),
15
+ literal("--color-background-info"),
16
+ literal("--color-background-danger"),
17
+ literal("--color-background-success"),
18
+ literal("--color-background-warning"),
19
+ literal("--color-background-disabled"),
20
+ literal("--color-text-primary"),
21
+ literal("--color-text-secondary"),
22
+ literal("--color-text-tertiary"),
23
+ literal("--color-text-inverse"),
24
+ literal("--color-text-ghost"),
25
+ literal("--color-text-info"),
26
+ literal("--color-text-danger"),
27
+ literal("--color-text-success"),
28
+ literal("--color-text-warning"),
29
+ literal("--color-text-disabled"),
30
+ literal("--color-border-primary"),
31
+ literal("--color-border-secondary"),
32
+ literal("--color-border-tertiary"),
33
+ literal("--color-border-inverse"),
34
+ literal("--color-border-ghost"),
35
+ literal("--color-border-info"),
36
+ literal("--color-border-danger"),
37
+ literal("--color-border-success"),
38
+ literal("--color-border-warning"),
39
+ literal("--color-border-disabled"),
40
+ literal("--color-ring-primary"),
41
+ literal("--color-ring-secondary"),
42
+ literal("--color-ring-inverse"),
43
+ literal("--color-ring-info"),
44
+ literal("--color-ring-danger"),
45
+ literal("--color-ring-success"),
46
+ literal("--color-ring-warning"),
47
+ literal("--font-sans"),
48
+ literal("--font-mono"),
49
+ literal("--font-weight-normal"),
50
+ literal("--font-weight-medium"),
51
+ literal("--font-weight-semibold"),
52
+ literal("--font-weight-bold"),
53
+ literal("--font-text-xs-size"),
54
+ literal("--font-text-sm-size"),
55
+ literal("--font-text-md-size"),
56
+ literal("--font-text-lg-size"),
57
+ literal("--font-heading-xs-size"),
58
+ literal("--font-heading-sm-size"),
59
+ literal("--font-heading-md-size"),
60
+ literal("--font-heading-lg-size"),
61
+ literal("--font-heading-xl-size"),
62
+ literal("--font-heading-2xl-size"),
63
+ literal("--font-heading-3xl-size"),
64
+ literal("--font-text-xs-line-height"),
65
+ literal("--font-text-sm-line-height"),
66
+ literal("--font-text-md-line-height"),
67
+ literal("--font-text-lg-line-height"),
68
+ literal("--font-heading-xs-line-height"),
69
+ literal("--font-heading-sm-line-height"),
70
+ literal("--font-heading-md-line-height"),
71
+ literal("--font-heading-lg-line-height"),
72
+ literal("--font-heading-xl-line-height"),
73
+ literal("--font-heading-2xl-line-height"),
74
+ literal("--font-heading-3xl-line-height"),
75
+ literal("--border-radius-xs"),
76
+ literal("--border-radius-sm"),
77
+ literal("--border-radius-md"),
78
+ literal("--border-radius-lg"),
79
+ literal("--border-radius-xl"),
80
+ literal("--border-radius-full"),
81
+ literal("--border-width-regular"),
82
+ literal("--shadow-hairline"),
83
+ literal("--shadow-sm"),
84
+ literal("--shadow-md"),
85
+ literal("--shadow-lg")
86
+ ]).describe("CSS variable keys available to MCP apps for theming.").describe(`Style variables for theming MCP apps.
87
+
88
+ Individual style keys are optional - hosts may provide any subset of these values.
89
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
90
+
91
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
92
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`), union([string(), _undefined()]).describe(`Style variables for theming MCP apps.
93
+
94
+ Individual style keys are optional - hosts may provide any subset of these values.
95
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
96
+
97
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
98
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
99
+
100
+ Individual style keys are optional - hosts may provide any subset of these values.
101
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
102
+
103
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
104
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`), V = object({
105
+ method: literal("ui/open-link"),
106
+ params: object({ url: string().describe("URL to open in the host's browser") })
107
+ }), I = object({ isError: boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough(), A = object({ isError: boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough(), L = object({ isError: boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough(), F = object({
108
+ method: literal("ui/notifications/sandbox-proxy-ready"),
109
+ params: object({})
110
+ }), j = object({
111
+ connectDomains: array(string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
112
+
113
+ - Maps to CSP \`connect-src\` directive
114
+ - Empty or omitted → no network connections (secure default)`),
115
+ resourceDomains: array(string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),
116
+ frameDomains: array(string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),
117
+ baseUriDomains: array(string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")
118
+ }), E = object({
119
+ camera: object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),
120
+ microphone: object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),
121
+ geolocation: object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),
122
+ clipboardWrite: object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")
123
+ }), P = object({
124
+ method: literal("ui/notifications/size-changed"),
125
+ params: object({
126
+ width: number().optional().describe("New width in pixels."),
127
+ height: number().optional().describe("New height in pixels.")
128
+ })
129
+ }), T = object({
130
+ method: literal("ui/notifications/tool-input"),
131
+ params: object({ arguments: record(string(), unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.") })
132
+ }), w = object({
133
+ method: literal("ui/notifications/tool-input-partial"),
134
+ params: object({ arguments: record(string(), unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).") })
135
+ }), U = object({
136
+ method: literal("ui/notifications/tool-cancelled"),
137
+ params: object({ reason: string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
138
+ }), p = object({ fonts: string().optional() }), c = object({
139
+ variables: VQ.optional().describe("CSS variables for theming the app."),
140
+ css: p.optional().describe("CSS blocks that apps can inject.")
141
+ }), H = object({
142
+ method: literal("ui/resource-teardown"),
143
+ params: object({})
144
+ }), R = record(string(), unknown()), O = object({
145
+ text: object({}).optional().describe("Host supports text content blocks."),
146
+ image: object({}).optional().describe("Host supports image content blocks."),
147
+ audio: object({}).optional().describe("Host supports audio content blocks."),
148
+ resource: object({}).optional().describe("Host supports resource content blocks."),
149
+ resourceLink: object({}).optional().describe("Host supports resource link content blocks."),
150
+ structuredContent: object({}).optional().describe("Host supports structured content.")
151
+ }), n = object({
152
+ experimental: object({}).optional().describe("Experimental features (structure TBD)."),
153
+ openLinks: object({}).optional().describe("Host supports opening external URLs."),
154
+ downloadFile: object({}).optional().describe("Host supports file downloads via ui/download-file."),
155
+ serverTools: object({ listChanged: boolean().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."),
156
+ serverResources: object({ listChanged: boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
157
+ logging: object({}).optional().describe("Host accepts log messages."),
158
+ sandbox: object({
159
+ permissions: E.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
160
+ csp: j.optional().describe("CSP domains approved by the host.")
161
+ }).optional().describe("Sandbox configuration applied by the host."),
162
+ updateModelContext: O.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
163
+ message: O.optional().describe("Host supports receiving content messages (ui/message) from the view.")
164
+ }), i = object({
165
+ experimental: object({}).optional().describe("Experimental features (structure TBD)."),
166
+ tools: object({ listChanged: boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
167
+ availableDisplayModes: array(D).optional().describe("Display modes the app supports.")
168
+ }), M = object({
169
+ method: literal("ui/notifications/initialized"),
170
+ params: object({}).optional()
171
+ }), IQ = object({
172
+ csp: j.optional().describe("Content Security Policy configuration for UI resources."),
173
+ permissions: E.optional().describe("Sandbox permissions requested by the UI resource."),
174
+ domain: string().optional().describe(`Dedicated origin for view sandbox.
175
+
176
+ Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
177
+
178
+ **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
179
+ - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
180
+ - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
181
+
182
+ If omitted, host uses default sandbox origin (typically per-conversation).`),
183
+ prefersBorder: boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
184
+
185
+ Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
186
+
187
+ - \`true\`: request visible border + background
188
+ - \`false\`: request no visible border + background
189
+ - omitted: host decides border`)
190
+ }), W = object({
191
+ method: literal("ui/request-display-mode"),
192
+ params: object({ mode: D.describe("The display mode being requested.") })
193
+ }), v = object({ mode: D.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough(), l = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool."), AQ = object({
194
+ resourceUri: string().optional(),
195
+ visibility: array(l).optional().describe(`Who can access this tool. Default: ["model", "app"]
196
+ - "model": Tool visible to and callable by the agent
197
+ - "app": Tool callable by the app from this server only`)
198
+ });
199
+ 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.") });
200
+ var S = object({
201
+ method: literal("ui/download-file"),
202
+ params: object({ contents: array(union([EmbeddedResourceSchema, ResourceLinkSchema])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.") })
203
+ }), C = object({
204
+ method: literal("ui/message"),
205
+ params: object({
206
+ role: literal("user").describe("Message role, currently only \"user\" is supported."),
207
+ content: array(ContentBlockSchema).describe("Message content blocks (text, image, etc.).")
208
+ })
209
+ }), LQ = object({
210
+ method: literal("ui/notifications/sandbox-resource-ready"),
211
+ params: object({
212
+ html: string().describe("HTML content to load into the inner iframe."),
213
+ sandbox: string().optional().describe("Optional override for the inner iframe's sandbox attribute."),
214
+ csp: j.optional().describe("CSP configuration from resource metadata."),
215
+ permissions: E.optional().describe("Sandbox permissions from resource metadata.")
216
+ })
217
+ }), g = object({
218
+ method: literal("ui/notifications/tool-result"),
219
+ params: CallToolResultSchema.describe("Standard MCP tool execution result.")
220
+ }), q = object({
221
+ toolInfo: object({
222
+ id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."),
223
+ tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.")
224
+ }).optional().describe("Metadata of the tool call that instantiated this App."),
225
+ theme: m.optional().describe("Current color theme preference."),
226
+ styles: c.optional().describe("Style configuration for theming the app."),
227
+ displayMode: D.optional().describe("How the UI is currently displayed."),
228
+ availableDisplayModes: array(D).optional().describe("Display modes the host supports."),
229
+ 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
230
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),
231
+ locale: string().optional().describe("User's language and region preference in BCP 47 format."),
232
+ timeZone: string().optional().describe("User's timezone in IANA format."),
233
+ userAgent: string().optional().describe("Host application identifier."),
234
+ platform: union([
235
+ literal("web"),
236
+ literal("desktop"),
237
+ literal("mobile")
238
+ ]).optional().describe("Platform type for responsive design decisions."),
239
+ deviceCapabilities: object({
240
+ touch: boolean().optional().describe("Whether the device supports touch input."),
241
+ hover: boolean().optional().describe("Whether the device supports hover interactions.")
242
+ }).optional().describe("Device input capabilities."),
243
+ safeAreaInsets: object({
244
+ top: number().describe("Top safe area inset in pixels."),
245
+ right: number().describe("Right safe area inset in pixels."),
246
+ bottom: number().describe("Bottom safe area inset in pixels."),
247
+ left: number().describe("Left safe area inset in pixels.")
248
+ }).optional().describe("Mobile safe area boundaries in pixels.")
249
+ }).passthrough(), k = object({
250
+ method: literal("ui/notifications/host-context-changed"),
251
+ params: q.describe("Partial context update containing only changed fields.")
252
+ }), y = object({
253
+ method: literal("ui/update-model-context"),
254
+ params: object({
255
+ content: array(ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."),
256
+ structuredContent: record(string(), unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")
257
+ })
258
+ }), f = object({
259
+ method: literal("ui/initialize"),
260
+ params: object({
261
+ appInfo: ImplementationSchema.describe("App identification (name and version)."),
262
+ appCapabilities: i.describe("Features and capabilities this app provides."),
263
+ protocolVersion: string().describe("Protocol version this app supports.")
264
+ })
265
+ }), d = object({
266
+ protocolVersion: string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
267
+ hostInfo: ImplementationSchema.describe("Host application identification and version."),
268
+ hostCapabilities: n.describe("Features and capabilities provided by the host."),
269
+ hostContext: q.describe("Rich context about the host environment.")
270
+ }).passthrough();
271
+ var N = class {
272
+ eventTarget;
273
+ eventSource;
274
+ messageListener;
275
+ constructor(X = window.parent, Y) {
276
+ this.eventTarget = X;
277
+ this.eventSource = Y;
278
+ this.messageListener = (Z) => {
279
+ if (Y && Z.source !== this.eventSource) {
280
+ console.debug("Ignoring message from unknown source", Z);
281
+ return;
282
+ }
283
+ let $ = JSONRPCMessageSchema.safeParse(Z.data);
284
+ if ($.success) console.debug("Parsed message", $.data), this.onmessage?.($.data);
285
+ else if (Z.data?.jsonrpc !== "2.0") console.debug("Ignoring non-JSON-RPC message", $.error.message, Z);
286
+ else console.error("Failed to parse message", $.error.message, Z), this.onerror?.(Error("Invalid JSON-RPC message received: " + $.error.message));
287
+ };
288
+ }
289
+ async start() {
290
+ window.addEventListener("message", this.messageListener);
291
+ }
292
+ async send(X, Y) {
293
+ if (X.method !== "ui/notifications/tool-input-partial") console.debug("Sending message", X);
294
+ this.eventTarget.postMessage(X, "*");
295
+ }
296
+ async close() {
297
+ window.removeEventListener("message", this.messageListener), this.onclose?.();
298
+ }
299
+ onclose;
300
+ onerror;
301
+ onmessage;
302
+ sessionId;
303
+ setProtocolVersion;
304
+ };
305
+ var b = "ui/resourceUri", SQ = "text/html;profile=mcp-app";
306
+ function hY(X) {
307
+ let Z = X._meta?.ui?.resourceUri;
308
+ if (Z === void 0) Z = X._meta?.[b];
309
+ if (typeof Z === "string" && Z.startsWith("ui://")) return Z;
310
+ else if (Z !== void 0) throw Error(`Invalid UI resource URI: ${JSON.stringify(Z)}`);
311
+ }
312
+ function mY(X) {
313
+ let Z = X._meta?.ui?.visibility;
314
+ if (!Z) return !1;
315
+ if (Z.length === 1 && Z[0] === "model") return !0;
316
+ return !1;
317
+ }
318
+ function pY(X) {
319
+ let Z = X._meta?.ui?.visibility;
320
+ if (!Z) return !1;
321
+ if (Z.length === 1 && Z[0] === "app") return !0;
322
+ return !1;
323
+ }
324
+ function cY(X) {
325
+ if (!X) return "";
326
+ let Y = [];
327
+ if (X.camera) Y.push("camera");
328
+ if (X.microphone) Y.push("microphone");
329
+ if (X.geolocation) Y.push("geolocation");
330
+ if (X.clipboardWrite) Y.push("clipboard-write");
331
+ return Y.join("; ");
332
+ }
333
+ var rQ = [G];
334
+ var oQ = class extends Protocol {
335
+ _client;
336
+ _hostInfo;
337
+ _capabilities;
338
+ _appCapabilities;
339
+ _hostContext = {};
340
+ _appInfo;
341
+ constructor(X, Y, Z, $) {
342
+ super($);
343
+ this._client = X;
344
+ this._hostInfo = Y;
345
+ this._capabilities = Z;
346
+ this._hostContext = $?.hostContext || {}, this.setRequestHandler(f, (K) => this._oninitialize(K)), this.setRequestHandler(PingRequestSchema, (K, J) => {
347
+ return this.onping?.(K.params, J), {};
348
+ }), this.setRequestHandler(W, (K) => {
349
+ return { mode: this._hostContext.displayMode ?? "inline" };
350
+ });
351
+ }
352
+ getAppCapabilities() {
353
+ return this._appCapabilities;
354
+ }
355
+ getAppVersion() {
356
+ return this._appInfo;
357
+ }
358
+ onping;
359
+ set onsizechange(X) {
360
+ this.setNotificationHandler(P, (Y) => X(Y.params));
361
+ }
362
+ set onsandboxready(X) {
363
+ this.setNotificationHandler(F, (Y) => X(Y.params));
364
+ }
365
+ set oninitialized(X) {
366
+ this.setNotificationHandler(M, (Y) => X(Y.params));
367
+ }
368
+ set onmessage(X) {
369
+ this.setRequestHandler(C, async (Y, Z) => {
370
+ return X(Y.params, Z);
371
+ });
372
+ }
373
+ set onopenlink(X) {
374
+ this.setRequestHandler(V, async (Y, Z) => {
375
+ return X(Y.params, Z);
376
+ });
377
+ }
378
+ set ondownloadfile(X) {
379
+ this.setRequestHandler(S, async (Y, Z) => {
380
+ return X(Y.params, Z);
381
+ });
382
+ }
383
+ set onrequestdisplaymode(X) {
384
+ this.setRequestHandler(W, async (Y, Z) => {
385
+ return X(Y.params, Z);
386
+ });
387
+ }
388
+ set onloggingmessage(X) {
389
+ this.setNotificationHandler(LoggingMessageNotificationSchema, async (Y) => {
390
+ X(Y.params);
391
+ });
392
+ }
393
+ set onupdatemodelcontext(X) {
394
+ this.setRequestHandler(y, async (Y, Z) => {
395
+ return X(Y.params, Z);
396
+ });
397
+ }
398
+ set oncalltool(X) {
399
+ this.setRequestHandler(CallToolRequestSchema, async (Y, Z) => {
400
+ return X(Y.params, Z);
401
+ });
402
+ }
403
+ sendToolListChanged(X = {}) {
404
+ return this.notification({
405
+ method: "notifications/tools/list_changed",
406
+ params: X
407
+ });
408
+ }
409
+ set onlistresources(X) {
410
+ this.setRequestHandler(ListResourcesRequestSchema, async (Y, Z) => {
411
+ return X(Y.params, Z);
412
+ });
413
+ }
414
+ set onlistresourcetemplates(X) {
415
+ this.setRequestHandler(ListResourceTemplatesRequestSchema, async (Y, Z) => {
416
+ return X(Y.params, Z);
417
+ });
418
+ }
419
+ set onreadresource(X) {
420
+ this.setRequestHandler(ReadResourceRequestSchema, async (Y, Z) => {
421
+ return X(Y.params, Z);
422
+ });
423
+ }
424
+ sendResourceListChanged(X = {}) {
425
+ return this.notification({
426
+ method: "notifications/resources/list_changed",
427
+ params: X
428
+ });
429
+ }
430
+ set onlistprompts(X) {
431
+ this.setRequestHandler(ListPromptsRequestSchema, async (Y, Z) => {
432
+ return X(Y.params, Z);
433
+ });
434
+ }
435
+ sendPromptListChanged(X = {}) {
436
+ return this.notification({
437
+ method: "notifications/prompts/list_changed",
438
+ params: X
439
+ });
440
+ }
441
+ assertCapabilityForMethod(X) {}
442
+ assertRequestHandlerCapability(X) {}
443
+ assertNotificationCapability(X) {}
444
+ assertTaskCapability(X) {
445
+ throw Error("Tasks are not supported in MCP Apps");
446
+ }
447
+ assertTaskHandlerCapability(X) {
448
+ throw Error("Task handlers are not supported in MCP Apps");
449
+ }
450
+ getCapabilities() {
451
+ return this._capabilities;
452
+ }
453
+ async _oninitialize(X) {
454
+ let Y = X.params.protocolVersion;
455
+ return this._appCapabilities = X.params.appCapabilities, this._appInfo = X.params.appInfo, {
456
+ protocolVersion: rQ.includes(Y) ? Y : G,
457
+ hostCapabilities: this.getCapabilities(),
458
+ hostInfo: this._hostInfo,
459
+ hostContext: this._hostContext
460
+ };
461
+ }
462
+ setHostContext(X) {
463
+ let Y = {}, Z = !1;
464
+ for (let $ of Object.keys(X)) {
465
+ let K = this._hostContext[$], J = X[$];
466
+ if (aQ(K, J)) continue;
467
+ Y[$] = J, Z = !0;
468
+ }
469
+ if (Z) this._hostContext = X, this.sendHostContextChange(Y);
470
+ }
471
+ sendHostContextChange(X) {
472
+ return this.notification({
473
+ method: "ui/notifications/host-context-changed",
474
+ params: X
475
+ });
476
+ }
477
+ sendToolInput(X) {
478
+ return this.notification({
479
+ method: "ui/notifications/tool-input",
480
+ params: X
481
+ });
482
+ }
483
+ sendToolInputPartial(X) {
484
+ return this.notification({
485
+ method: "ui/notifications/tool-input-partial",
486
+ params: X
487
+ });
488
+ }
489
+ sendToolResult(X) {
490
+ return this.notification({
491
+ method: "ui/notifications/tool-result",
492
+ params: X
493
+ });
494
+ }
495
+ sendToolCancelled(X) {
496
+ return this.notification({
497
+ method: "ui/notifications/tool-cancelled",
498
+ params: X
499
+ });
500
+ }
501
+ sendSandboxResourceReady(X) {
502
+ return this.notification({
503
+ method: "ui/notifications/sandbox-resource-ready",
504
+ params: X
505
+ });
506
+ }
507
+ teardownResource(X, Y) {
508
+ return this.request({
509
+ method: "ui/resource-teardown",
510
+ params: X
511
+ }, R, Y);
512
+ }
513
+ sendResourceTeardown = this.teardownResource;
514
+ async connect(X) {
515
+ if (this.transport) throw Error("AppBridge is already connected. Call close() before connecting again.");
516
+ if (this._client) {
517
+ let Y = this._client.getServerCapabilities();
518
+ if (!Y) throw Error("Client server capabilities not available");
519
+ if (Y.tools) {
520
+ if (this.oncalltool = async (Z, $) => {
521
+ return this._client.request({
522
+ method: "tools/call",
523
+ params: Z
524
+ }, CallToolResultSchema, { signal: $.signal });
525
+ }, Y.tools.listChanged) this._client.setNotificationHandler(ToolListChangedNotificationSchema, (Z) => this.sendToolListChanged(Z.params));
526
+ }
527
+ if (Y.resources) {
528
+ if (this.onlistresources = async (Z, $) => {
529
+ return this._client.request({
530
+ method: "resources/list",
531
+ params: Z
532
+ }, ListResourcesResultSchema, { signal: $.signal });
533
+ }, this.onlistresourcetemplates = async (Z, $) => {
534
+ return this._client.request({
535
+ method: "resources/templates/list",
536
+ params: Z
537
+ }, ListResourceTemplatesResultSchema, { signal: $.signal });
538
+ }, this.onreadresource = async (Z, $) => {
539
+ return this._client.request({
540
+ method: "resources/read",
541
+ params: Z
542
+ }, ReadResourceResultSchema, { signal: $.signal });
543
+ }, Y.resources.listChanged) this._client.setNotificationHandler(ResourceListChangedNotificationSchema, (Z) => this.sendResourceListChanged(Z.params));
544
+ }
545
+ if (Y.prompts) {
546
+ if (this.onlistprompts = async (Z, $) => {
547
+ return this._client.request({
548
+ method: "prompts/list",
549
+ params: Z
550
+ }, ListPromptsResultSchema, { signal: $.signal });
551
+ }, Y.prompts.listChanged) this._client.setNotificationHandler(PromptListChangedNotificationSchema, (Z) => this.sendPromptListChanged(Z.params));
552
+ }
553
+ }
554
+ return super.connect(X);
555
+ }
556
+ };
557
+ function aQ(X, Y) {
558
+ return JSON.stringify(X) === JSON.stringify(Y);
559
+ }
560
+ //#endregion
561
+ export { oQ as AppBridge, s as DOWNLOAD_FILE_METHOD, KQ as HOST_CONTEXT_CHANGED_METHOD, NQ as INITIALIZED_METHOD, DQ as INITIALIZE_METHOD, G as LATEST_PROTOCOL_VERSION, e as MESSAGE_METHOD, i as McpUiAppCapabilitiesSchema, D as McpUiDisplayModeSchema, S as McpUiDownloadFileRequestSchema, A as McpUiDownloadFileResultSchema, n as McpUiHostCapabilitiesSchema, k as McpUiHostContextChangedNotificationSchema, q as McpUiHostContextSchema, p as McpUiHostCssSchema, c as McpUiHostStylesSchema, f as McpUiInitializeRequestSchema, d as McpUiInitializeResultSchema, M as McpUiInitializedNotificationSchema, C as McpUiMessageRequestSchema, L as McpUiMessageResultSchema, V as McpUiOpenLinkRequestSchema, I as McpUiOpenLinkResultSchema, W as McpUiRequestDisplayModeRequestSchema, v as McpUiRequestDisplayModeResultSchema, j as McpUiResourceCspSchema, IQ as McpUiResourceMetaSchema, E as McpUiResourcePermissionsSchema, H as McpUiResourceTeardownRequestSchema, R as McpUiResourceTeardownResultSchema, F as McpUiSandboxProxyReadyNotificationSchema, LQ as McpUiSandboxResourceReadyNotificationSchema, P as McpUiSizeChangedNotificationSchema, O as McpUiSupportedContentBlockModalitiesSchema, m as McpUiThemeSchema, U as McpUiToolCancelledNotificationSchema, T as McpUiToolInputNotificationSchema, w as McpUiToolInputPartialNotificationSchema, AQ as McpUiToolMetaSchema, g as McpUiToolResultNotificationSchema, l as McpUiToolVisibilitySchema, y as McpUiUpdateModelContextRequestSchema, t as OPEN_LINK_METHOD, N as PostMessageTransport, jQ as REQUEST_DISPLAY_MODE_METHOD, SQ as RESOURCE_MIME_TYPE, GQ as RESOURCE_TEARDOWN_METHOD, b as RESOURCE_URI_META_KEY, QQ as SANDBOX_PROXY_READY_METHOD, XQ as SANDBOX_RESOURCE_READY_METHOD, YQ as SIZE_CHANGED_METHOD, rQ as SUPPORTED_PROTOCOL_VERSIONS, JQ as TOOL_CANCELLED_METHOD, ZQ as TOOL_INPUT_METHOD, _ as TOOL_INPUT_PARTIAL_METHOD, $Q as TOOL_RESULT_METHOD, cY as buildAllowAttribute, hY as getToolUiResourceUri, pY as isToolVisibilityAppOnly, mY as isToolVisibilityModelOnly };
562
+
563
+ //# sourceMappingURL=@modelcontextprotocol_ext-apps_app-bridge.js.map