@mcp-use/inspector 20.0.0-beta.6 → 20.0.0-beta.8

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 (189) hide show
  1. package/dist/cdn/{AnimatePresence-Dcw-FOy8.js → AnimatePresence-D1bZ5_-l.js} +79 -78
  2. package/dist/cdn/{ChatTab-D6J3Gyp7.js → ChatTab-C-Ysv6Zf.js} +1951 -1932
  3. package/dist/cdn/CheckboxIndicator-BjF73mGX.js +252 -0
  4. package/dist/cdn/{ConnectionSettingsForm-CWQueI8J.js → ConnectionSettingsForm-CNuMa6jp.js} +202 -202
  5. package/dist/cdn/{ConnectionSettingsTab-FGyt3QaI.js → ConnectionSettingsTab-qSVQ1aIF.js} +36 -35
  6. package/dist/cdn/{ElicitationTab-CL1KJ0bz.js → ElicitationTab-PEmEDvC5.js} +47 -46
  7. package/dist/cdn/{FormContext-tmgN_Vdr.js → FormContext-NtUiZclE.js} +26 -26
  8. package/dist/cdn/{InspectorContext-UjtEbNod.js → InspectorContext-BBKCdfmK.js} +1 -1
  9. package/dist/cdn/{JSONDisplay-BFxf5oEu.js → JSONDisplay-BJqMz7Ny.js} +22 -22
  10. package/dist/cdn/{ListTabHeader-Cv-GmtGF.js → ListTabHeader-DzmTtN1e.js} +20 -19
  11. package/dist/cdn/{WidgetWrapper-CruwjBOd.js → MCPAppsDebugControls-BpP-Ifap.js} +514 -550
  12. package/dist/cdn/{ManufactOAuthCallback-B98kSYCj.js → ManufactOAuthCallback-ChbbjFIT.js} +2 -2
  13. package/dist/cdn/{MarkdownRenderer-gLqUICEd.js → MarkdownRenderer-CK_6n3T9.js} +23 -23
  14. package/dist/cdn/McpAppsViewPanel-jlsYQ7uS.js +56 -0
  15. package/dist/cdn/{NotificationsTab-CeImSrhx.js → NotificationsTab-B7uebqMV.js} +21 -21
  16. package/dist/cdn/{OAuthCallback-Bg2bP-o9.js → OAuthCallback--NZdLoWx.js} +3 -3
  17. package/dist/cdn/PromptsTab-DSGYL32k.js +902 -0
  18. package/dist/cdn/{ResourcesTab-CQkKni-P.js → ResourcesTab-d3wxN7xC.js} +116 -114
  19. package/dist/cdn/{SamplingTab-D8q-iCMc.js → SamplingTab-DETdWNJk.js} +34 -33
  20. package/dist/cdn/{ServerMetadataTab-CvrKX8fz.js → ServerMetadataTab-BM3VhSLf.js} +9 -9
  21. package/dist/cdn/{StatusIcon-D0-ARyOh.js → StatusIcon-Q3n3YRtE.js} +10 -11
  22. package/dist/cdn/{ToolsTab-6xaVH43x.js → ToolsTab-BMcnfEWg.js} +665 -653
  23. package/dist/cdn/{ViewPreview-Ohh6JwOn.js → ViewPreview-CBhrVdwx.js} +3 -3
  24. package/dist/cdn/{WidgetDebugContext-D4usL_MA.js → WidgetDebugContext-B6yoOVVV.js} +1 -11
  25. package/dist/cdn/WidgetWrapper-BlbQAh_X.js +12 -0
  26. package/dist/cdn/{bell-CGjAO_0s.js → bell-GrTZcnD2.js} +1 -1
  27. package/dist/cdn/{browser-CbQIH4w2.js → browser-DG2Z8392.js} +1 -1
  28. package/dist/cdn/{brush-B_mKhyxG.js → brush-CelVvMGp.js} +1 -1
  29. package/dist/cdn/button-CB4uOoUV.js +2509 -0
  30. package/dist/cdn/card-BA-DQk-G.js +41 -0
  31. package/dist/cdn/{checkbox-By0FklhG.js → checkbox-kwVa4gRX.js} +7 -7
  32. package/dist/cdn/{clock-CmUbSx_B.js → clock-YMF8Gtw5.js} +1 -1
  33. package/dist/cdn/{code-V_0nf5rg.js → code-C8sN2OGR.js} +1 -1
  34. package/dist/cdn/{jsx-runtime-CIxvMpEo.js → createLucideIcon-BONxC1L5.js} +57 -24
  35. package/dist/cdn/{dialog-BsDpuJd3.js → dialog-CJGnC5Ag.js} +171 -171
  36. package/dist/cdn/{dist-DaMB0Su9.js → dist-CTJnCYmk.js} +1 -1
  37. package/dist/cdn/{dist-CXHFvGre.js → dist-SxRsB1iS.js} +3 -3
  38. package/dist/cdn/{external-link-CjmfT6rW.js → external-link-Bo4lQxr1.js} +1 -1
  39. package/dist/cdn/{eye-B7H96av8.js → eye-pSGG7nvf.js} +1 -1
  40. package/dist/cdn/{folder-open-B3lu2rG_.js → folder-open-aM8CPtBO.js} +1 -1
  41. package/dist/cdn/{hash-BVQnWi7q.js → hash-DDs2vE1k.js} +1 -1
  42. package/dist/cdn/{history-Csw4rb44.js → history-BfUFpL1d.js} +1 -1
  43. package/dist/cdn/{index-browser-DkQOzkvX.js → index-browser-Dm3R1Mfe.js} +1 -1
  44. package/dist/cdn/{info-CNiOwqkf.js → info-BMkB68mB.js} +1 -1
  45. package/dist/cdn/{input-C2OBd4PJ.js → input-BCpgLXU1.js} +2993 -5499
  46. package/dist/cdn/inspector.css +1 -1
  47. package/dist/cdn/inspector.js +7106 -7140
  48. package/dist/cdn/{label-B9Jmm9be.js → label-A0UGV8FE.js} +9 -9
  49. package/dist/cdn/{loader-circle-BLy9A_pp.js → loader-circle-BKRHJEB7.js} +1 -1
  50. package/dist/cdn/{maximize-2-CH5Lq90B.js → maximize-2-DdrB_spi.js} +1 -1
  51. package/dist/cdn/{maximize-BALCV_ep.js → maximize-hSOCz133.js} +1 -1
  52. package/dist/cdn/{message-square-BnxdpJxZ.js → message-square-D3tKB3uJ.js} +1 -1
  53. package/dist/cdn/{not-found-DEtSM_Wd.js → not-found-BajFyZpp.js} +9 -11
  54. package/dist/cdn/{play-vuZ5PLnI.js → play-B1leulYf.js} +1 -1
  55. package/dist/cdn/providerMeta-CjGU4rID.js +436 -0
  56. package/dist/cdn/{react-BLtCruam.js → react-Bl-hSkvn.js} +562 -512
  57. package/dist/cdn/{refresh-cw-BXY-Pa0U.js → refresh-cw-CyvXrS91.js} +1 -1
  58. package/dist/cdn/{save-Tgil_AJZ.js → save-CmdEPUAm.js} +1 -1
  59. package/dist/cdn/{select-DDdiIPR2.js → select-CCFHjOGk.js} +808 -807
  60. package/dist/cdn/{servers-Dm72iTpY.js → servers-Dd0Vcp81.js} +5 -1
  61. package/dist/cdn/{shared-DaILIQPP.js → shared-CJVHJhag.js} +36 -36
  62. package/dist/cdn/{sheet-Br_l2kry.js → sheet-oyq1mIyg.js} +620 -619
  63. package/dist/cdn/{sparkles-BntO2rDR.js → sparkles-CxeZpVtX.js} +1 -1
  64. package/dist/cdn/spinner-Be1GlSGX.js +15 -0
  65. package/dist/cdn/{square-check-big-BvwQ17Bl.js → square-check-big-C_4wbfwF.js} +1 -1
  66. package/dist/cdn/{switch-C3IyQuid.js → switch-DHXEA_N5.js} +190 -189
  67. package/dist/cdn/{tabs-subtle-CkdI6Mac.js → tabs-subtle-Dubd6Kj8.js} +269 -268
  68. package/dist/cdn/{telemetry-C7Ytz2BG.js → telemetry-DjQn_Xm9.js} +2 -2
  69. package/dist/cdn/{textarea-DSbwcFVt.js → textarea-CwmI8_uI.js} +6 -6
  70. package/dist/cdn/{trash-2-RwpJY5SL.js → trash-2-BhumJAFE.js} +1 -1
  71. package/dist/cdn/{useAriaLabelledBy-DqAdnppm.js → useAriaLabelledBy-Cra6w3YY.js} +2 -1
  72. package/dist/cdn/{useCompositeItem-BRqEzYh-.js → useCompositeItem-Dhnm-7el.js} +3 -3
  73. package/dist/cdn/{useConfig-BW6uQf2m.js → useConfig-B_adtnP1.js} +2 -2
  74. package/dist/cdn/{useSavedRequests-Ci2I919u.js → useSavedRequests-mSIsDd4c.js} +1 -1
  75. package/dist/cdn/{useViewHostProps-CINeSkth.js → useViewHostProps-CDOm2w6u.js} +124 -109
  76. package/dist/cdn/{wrench-DzGmCfnb.js → wrench-DvK20LUT.js} +1 -1
  77. package/dist/cdn/{x-C3vRQIYu.js → x-EilKPiCX.js} +1 -1
  78. package/dist/cdn/{zap-Mb-pbw2X.js → zap-0Wr9QO7N.js} +1 -1
  79. package/dist/cli.js +61 -2
  80. package/dist/client/components/ChatTab.d.ts.map +1 -1
  81. package/dist/client/components/MCPAppsDebugControls.d.ts.map +1 -1
  82. package/dist/client/components/ToolsTab.d.ts.map +1 -1
  83. package/dist/client/components/chat/ConfigurationDialog.d.ts.map +1 -1
  84. package/dist/client/components/chat/ToolResultRenderer.d.ts.map +1 -1
  85. package/dist/client/components/mcp-apps/McpAppsViewPanel.d.ts +29 -0
  86. package/dist/client/components/mcp-apps/McpAppsViewPanel.d.ts.map +1 -0
  87. package/dist/client/components/tools/ToolExecutionPanel.d.ts.map +1 -1
  88. package/dist/client/components/tools/ToolResultDisplay.d.ts +2 -1
  89. package/dist/client/components/tools/ToolResultDisplay.d.ts.map +1 -1
  90. package/dist/client/components/tools/useToolsTabNavigation.d.ts.map +1 -1
  91. package/dist/client/components/ui/MeshGradientCanvas.d.ts.map +1 -1
  92. package/dist/client/components/ui/mesh-animation-pause.d.ts +14 -0
  93. package/dist/client/components/ui/mesh-animation-pause.d.ts.map +1 -0
  94. package/dist/client/components/ui/mesh-gradient-colors.d.ts +6 -0
  95. package/dist/client/components/ui/mesh-gradient-colors.d.ts.map +1 -0
  96. package/dist/client/components/ui/mesh-tab-background.d.ts +1 -1
  97. package/dist/client/components/ui/mesh-tab-background.d.ts.map +1 -1
  98. package/dist/client/components/ui/not-found.d.ts.map +1 -1
  99. package/dist/client/context/WidgetDebugContext.d.ts +1 -11
  100. package/dist/client/context/WidgetDebugContext.d.ts.map +1 -1
  101. package/dist/client/hooks/useDeviceViewport.d.ts +1 -5
  102. package/dist/client/hooks/useDeviceViewport.d.ts.map +1 -1
  103. package/dist/client/hooks/useViewHostProps.d.ts +1 -1
  104. package/dist/client/hooks/useViewHostProps.d.ts.map +1 -1
  105. package/dist/client/index.js +2087 -1861
  106. package/dist/client/utils/servers.d.ts +5 -0
  107. package/dist/client/utils/servers.d.ts.map +1 -1
  108. package/dist/server/cdn-shell.d.ts.map +1 -1
  109. package/dist/server/cdn-shell.js +2 -2
  110. package/dist/server/{chunk-GBY4WAVP.js → chunk-BD3ROXCC.js} +1 -1
  111. package/dist/server/{chunk-NUHI6MJ6.js → chunk-BPXKTFQ5.js} +1 -1
  112. package/dist/server/{chunk-IFF5T5J4.js → chunk-XTVIGRTB.js} +61 -2
  113. package/dist/server/cli.js +2 -2
  114. package/dist/server/index.js +3 -3
  115. package/dist/server/middleware.js +3 -3
  116. package/dist/server/version.js +1 -1
  117. package/dist/web/assets/AnimatePresence-FfDQQNFJ.js +9 -0
  118. package/dist/web/assets/ChatTab-DxD-KLW_.js +18 -0
  119. package/dist/web/assets/ConnectionSettingsTab-pO6p0U0f.js +1 -0
  120. package/dist/web/assets/ElicitationTab-o5_z6gqe.js +1 -0
  121. package/dist/web/assets/FormContext-sV-yByKz.js +1 -0
  122. package/dist/web/assets/ListTabHeader-CrGae306.js +1 -0
  123. package/dist/web/assets/MCPAppsDebugControls-CZW1uZdH.js +34 -0
  124. package/dist/web/assets/{ManufactOAuthCallback-BRO6TPkZ.js → ManufactOAuthCallback-BnWhf5bW.js} +1 -1
  125. package/dist/web/assets/{MarkdownRenderer-gaJFjbtr.js → MarkdownRenderer-gUUHRIm1.js} +2 -2
  126. package/dist/web/assets/McpAppsViewPanel-CDJDb4t-.js +1 -0
  127. package/dist/web/assets/{NotificationsTab-LYcfRjyd.js → NotificationsTab-CkJ5E_sR.js} +1 -1
  128. package/dist/web/assets/{OAuthCallback-D8UItgTB.js → OAuthCallback-Dv_mFcua.js} +1 -1
  129. package/dist/web/assets/PromptsTab-CLwWFf6d.js +15 -0
  130. package/dist/web/assets/ResourcesTab-B8cnuq-m.js +2 -0
  131. package/dist/web/assets/SamplingTab-BjYHYRHX.js +1 -0
  132. package/dist/web/assets/ServerMetadataTab-CPlclbb7.js +1 -0
  133. package/dist/web/assets/ToolsTab-BSSwvp4Q.js +8 -0
  134. package/dist/web/assets/{ViewPreview--z6jL0Zg.js → ViewPreview-C_LJdgt9.js} +1 -1
  135. package/dist/web/assets/WidgetWrapper-cv_BM1bY.js +1 -0
  136. package/dist/web/assets/{brush--0LobUi4.js → brush-DX0UZ_pI.js} +1 -1
  137. package/dist/web/assets/button-C8Xa2k4x.js +1 -0
  138. package/dist/web/assets/checkbox-BuuDhnpk.js +1 -0
  139. package/dist/web/assets/code-B14rVdNt.js +1 -0
  140. package/dist/web/assets/createLucideIcon-BEHeJH0M.js +1 -0
  141. package/dist/web/assets/{dist-B8sA8Zml.js → dist-C39gcmyH.js} +4 -4
  142. package/dist/web/assets/index-CyvvaDNR.js +499 -0
  143. package/dist/web/assets/index-bCIH1Sdx.css +1 -0
  144. package/dist/web/assets/input-C0OQCUZy.js +1 -0
  145. package/dist/web/assets/{label-Cdim77Jw.js → label-CI7JWQOo.js} +1 -1
  146. package/dist/web/assets/{maximize-2-BTT9QQU9.js → maximize-2-Br1WQzT2.js} +1 -1
  147. package/dist/web/assets/{maximize-_O55kFcr.js → maximize-CJNgRe6S.js} +1 -1
  148. package/dist/web/assets/{refresh-cw-C9wQl8_d.js → refresh-cw-B5iaAZKn.js} +1 -1
  149. package/dist/web/assets/{save-B-MsgxX9.js → save-TM6fvNrt.js} +1 -1
  150. package/dist/web/assets/select-D6jzbLJn.js +1 -0
  151. package/dist/web/assets/shared-Chk1rURG.js +1 -0
  152. package/dist/web/assets/{sparkles-2OAsc1aP.js → sparkles-BGYTDThM.js} +1 -1
  153. package/dist/web/assets/tabs-subtle-CK4nucyB.js +1 -0
  154. package/dist/web/assets/textarea-CRTXuRmE.js +1 -0
  155. package/dist/web/assets/{useConfig-BAsKhUxf.js → useConfig-CgQbKjVT.js} +1 -1
  156. package/dist/web/assets/useViewHostProps-DFI7Ywo7.js +1 -0
  157. package/dist/web/assets/{zap-Du2Uc5pa.js → zap-BDWHCVHU.js} +1 -1
  158. package/dist/web/index.html +10 -10
  159. package/package.json +2 -2
  160. package/dist/cdn/CheckboxIndicator-Bt4IICtv.js +0 -251
  161. package/dist/cdn/PromptsTab-C4LuwyWN.js +0 -901
  162. package/dist/cdn/card-DgiYnSg-.js +0 -41
  163. package/dist/cdn/createLucideIcon-C5fZZ6oB.js +0 -38
  164. package/dist/cdn/providerMeta-BQIfHuNL.js +0 -379
  165. package/dist/cdn/spinner-jQtC7EBj.js +0 -15
  166. package/dist/web/assets/AnimatePresence-C5p0yiY1.js +0 -9
  167. package/dist/web/assets/ChatTab-CsBPVCSc.js +0 -18
  168. package/dist/web/assets/ConnectionSettingsTab-DQTXfnl1.js +0 -1
  169. package/dist/web/assets/ElicitationTab-_FKB7nNG.js +0 -1
  170. package/dist/web/assets/FormContext-DH2caWKO.js +0 -1
  171. package/dist/web/assets/ListTabHeader-R17w_JsB.js +0 -1
  172. package/dist/web/assets/PromptsTab-B2uVMRR2.js +0 -15
  173. package/dist/web/assets/ResourcesTab-DhOZYPjE.js +0 -2
  174. package/dist/web/assets/SamplingTab-C-oY2hoi.js +0 -1
  175. package/dist/web/assets/ServerMetadataTab-BkTxO5KS.js +0 -1
  176. package/dist/web/assets/ToolsTab-DupHgo7A.js +0 -8
  177. package/dist/web/assets/WidgetWrapper-CZaEVEw4.js +0 -34
  178. package/dist/web/assets/checkbox-BQ9mI_6k.js +0 -1
  179. package/dist/web/assets/code-tME-5H6D.js +0 -1
  180. package/dist/web/assets/createLucideIcon-B3b8EU0b.js +0 -1
  181. package/dist/web/assets/index-C_fCIJ4C.js +0 -492
  182. package/dist/web/assets/index-fBX3akc8.css +0 -1
  183. package/dist/web/assets/input-CLYhA7PK.js +0 -1
  184. package/dist/web/assets/jsx-runtime-Cjj9sGSy.js +0 -1
  185. package/dist/web/assets/select-CJ57-Bor.js +0 -1
  186. package/dist/web/assets/shared-CCC9rTz4.js +0 -1
  187. package/dist/web/assets/tabs-subtle-246ABJqx.js +0 -1
  188. package/dist/web/assets/textarea-DLAmNVf_.js +0 -1
  189. package/dist/web/assets/useViewHostProps-CV5zBxUb.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { a as e, s as t, t as n } from "./react-BIs9pQ3H.js";
2
- import { A as r, C as i, D as a, E as o, I as s, M as c, N as l, O as u, P as d, S as f, T as p, _ as m, a as h, b as g, c as _, d as v, f as ee, g as te, h as y, i as b, j as x, k as S, l as C, m as ne, n as w, o as T, p as E, r as re, s as ie, t as ae, v as D, w as O, x as oe, y as k } from "./cfWorker-Bxcs9rNe.js";
2
+ import { A as r, C as i, D as a, E as o, I as s, M as c, N as l, O as u, P as d, S as f, T as p, _ as m, a as h, b as g, c as _, d as v, f as ee, g as te, h as y, i as b, j as x, k as S, l as C, m as ne, n as w, o as re, p as T, r as E, s as ie, t as ae, v as D, w as O, x as oe, y as k } from "./cfWorker-Bxcs9rNe.js";
3
3
  //#region ../../node_modules/.pnpm/@modelcontextprotocol+core@2.0.0-beta.4/node_modules/@modelcontextprotocol/core/dist/auth-DFgbUATV.mjs
4
4
  var A = /* @__PURE__ */ t(n(), 1), se = "io.modelcontextprotocol/related-task", j = "io.modelcontextprotocol/subscriptionId", M = oe(() => x([
5
5
  r(),
@@ -10,93 +10,93 @@ var A = /* @__PURE__ */ t(n(), 1), se = "io.modelcontextprotocol/related-task",
10
10
  m(M)
11
11
  ])), N = S(r(), M);
12
12
  m(M);
13
- var ce = x([r(), p().int()]), P = r(), le = o({ ttl: p().optional() }), ue = o({ taskId: r() }), de = i({
14
- progressToken: ce.optional(),
13
+ var P = x([r(), p().int()]), ce = r(), le = o({ ttl: p().optional() }), ue = o({ taskId: r() }), F = i({
14
+ progressToken: P.optional(),
15
15
  [se]: ue.optional()
16
- }), F = o({ _meta: de.optional() }), fe = F.extend({ task: le.optional() }), I = o({
16
+ }), I = o({ _meta: F.optional() }), de = I.extend({ task: le.optional() }), L = o({
17
17
  method: r(),
18
- params: F.loose().optional()
19
- }), L = o({ _meta: de.optional() }), R = o({
18
+ params: I.loose().optional()
19
+ }), R = o({ _meta: F.optional() }), z = o({
20
20
  method: r(),
21
- params: L.loose().optional()
22
- }), z = i({ _meta: de.optional() }), pe = x([r(), p().int()]), me = o({
21
+ params: R.loose().optional()
22
+ }), B = i({ _meta: F.optional() }), fe = x([r(), p().int()]), V = o({
23
23
  jsonrpc: f("2.0"),
24
- id: pe,
25
- ...I.shape
26
- }).strict(), he = o({
24
+ id: fe,
25
+ ...L.shape
26
+ }).strict(), pe = o({
27
27
  jsonrpc: f("2.0"),
28
- ...R.shape
29
- }).strict(), ge = o({
28
+ ...z.shape
29
+ }).strict(), me = o({
30
30
  jsonrpc: f("2.0"),
31
- id: pe,
32
- result: z
33
- }).strict(), _e = o({
31
+ id: fe,
32
+ result: B
33
+ }).strict(), he = o({
34
34
  jsonrpc: f("2.0"),
35
- id: pe.optional(),
35
+ id: fe.optional(),
36
36
  error: o({
37
37
  code: p().int(),
38
38
  message: r(),
39
39
  data: c().optional()
40
40
  })
41
- }).strict(), ve = x([
41
+ }).strict(), ge = x([
42
+ V,
43
+ pe,
42
44
  me,
43
- he,
44
- ge,
45
- _e
45
+ he
46
46
  ]);
47
- x([ge, _e]);
48
- var ye = z.strict(), be = L.extend({
49
- requestId: pe.optional(),
47
+ x([me, he]);
48
+ var _e = B.strict(), ve = R.extend({
49
+ requestId: fe.optional(),
50
50
  reason: r().optional()
51
- }), xe = R.extend({
51
+ }), ye = z.extend({
52
52
  method: f("notifications/cancelled"),
53
- params: be
54
- }), Se = o({ icons: m(o({
53
+ params: ve
54
+ }), be = o({ icons: m(o({
55
55
  src: r(),
56
56
  mimeType: r().optional(),
57
57
  sizes: m(r()).optional(),
58
- theme: E(["light", "dark"]).optional()
59
- })).optional() }), Ce = o({
58
+ theme: T(["light", "dark"]).optional()
59
+ })).optional() }), xe = o({
60
60
  name: r(),
61
61
  title: r().optional()
62
- }), B = Ce.extend({
63
- ...Ce.shape,
64
- ...Se.shape,
62
+ }), Se = xe.extend({
63
+ ...xe.shape,
64
+ ...be.shape,
65
65
  version: r(),
66
66
  websiteUrl: r().optional(),
67
67
  description: r().optional()
68
- }), we = u((e) => e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0 ? { form: {} } : e, g(o({
68
+ }), Ce = u((e) => e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0 ? { form: {} } : e, g(o({
69
69
  form: g(o({ applyDefaults: D().optional() }), N).optional(),
70
70
  url: N.optional()
71
- }), N.optional())), Te = i({
71
+ }), N.optional())), we = i({
72
72
  list: N.optional(),
73
73
  cancel: N.optional(),
74
74
  requests: i({
75
75
  sampling: i({ createMessage: N.optional() }).optional(),
76
76
  elicitation: i({ create: N.optional() }).optional()
77
77
  }).optional()
78
- }), Ee = i({
78
+ }), Te = i({
79
79
  list: N.optional(),
80
80
  cancel: N.optional(),
81
81
  requests: i({ tools: i({ call: N.optional() }).optional() }).optional()
82
- }), De = o({
82
+ }), H = o({
83
83
  experimental: S(r(), N).optional(),
84
84
  sampling: o({
85
85
  context: N.optional(),
86
86
  tools: N.optional()
87
87
  }).optional(),
88
- elicitation: we.optional(),
88
+ elicitation: Ce.optional(),
89
89
  roots: o({ listChanged: D().optional() }).optional(),
90
- tasks: Te.optional(),
90
+ tasks: we.optional(),
91
91
  extensions: S(r(), N).optional()
92
- }), Oe = F.extend({
92
+ }), Ee = I.extend({
93
93
  protocolVersion: r(),
94
- capabilities: De,
95
- clientInfo: B
96
- }), ke = I.extend({
94
+ capabilities: H,
95
+ clientInfo: Se
96
+ }), De = L.extend({
97
97
  method: f("initialize"),
98
- params: Oe
99
- }), Ae = o({
98
+ params: Ee
99
+ }), Oe = o({
100
100
  experimental: S(r(), N).optional(),
101
101
  logging: N.optional(),
102
102
  completions: N.optional(),
@@ -106,79 +106,79 @@ var ye = z.strict(), be = L.extend({
106
106
  listChanged: D().optional()
107
107
  }).optional(),
108
108
  tools: o({ listChanged: D().optional() }).optional(),
109
- tasks: Ee.optional(),
109
+ tasks: Te.optional(),
110
110
  extensions: S(r(), N).optional()
111
- }), V = z.extend({
111
+ }), ke = B.extend({
112
112
  protocolVersion: r(),
113
- capabilities: Ae,
114
- serverInfo: B,
113
+ capabilities: Oe,
114
+ serverInfo: Se,
115
115
  instructions: r().optional()
116
- }), je = R.extend({
116
+ }), Ae = z.extend({
117
117
  method: f("notifications/initialized"),
118
- params: L.optional()
119
- }), Me = I.extend({
118
+ params: R.optional()
119
+ }), je = L.extend({
120
120
  method: f("server/discover"),
121
- params: F.optional()
122
- }), Ne = z.extend({
121
+ params: I.optional()
122
+ }), Me = B.extend({
123
123
  supportedVersions: m(r()),
124
- capabilities: Ae,
125
- serverInfo: B,
124
+ capabilities: Oe,
125
+ serverInfo: Se,
126
126
  instructions: r().optional()
127
- }), Pe = I.extend({
127
+ }), Ne = L.extend({
128
128
  method: f("ping"),
129
- params: F.optional()
130
- }), Fe = o({
129
+ params: I.optional()
130
+ }), Pe = o({
131
131
  progress: p(),
132
132
  total: a(p()),
133
133
  message: a(r())
134
- }), H = o({
135
- ...L.shape,
136
- ...Fe.shape,
137
- progressToken: ce
138
- }), Ie = R.extend({
134
+ }), U = o({
135
+ ...R.shape,
136
+ ...Pe.shape,
137
+ progressToken: P
138
+ }), Fe = z.extend({
139
139
  method: f("notifications/progress"),
140
- params: H
141
- }), Le = F.extend({ cursor: P.optional() }), U = I.extend({ params: Le.optional() }), Re = z.extend({ nextCursor: P.optional() }), W = o({
140
+ params: U
141
+ }), Ie = I.extend({ cursor: ce.optional() }), W = L.extend({ params: Ie.optional() }), Le = B.extend({ nextCursor: ce.optional() }), G = o({
142
142
  uri: r(),
143
143
  mimeType: a(r()),
144
144
  _meta: S(r(), c()).optional()
145
- }), ze = W.extend({ text: r() }), G = r().refine((e) => {
145
+ }), Re = G.extend({ text: r() }), K = r().refine((e) => {
146
146
  try {
147
147
  return atob(e), !0;
148
148
  } catch {
149
149
  return !1;
150
150
  }
151
- }, { message: "Invalid Base64 string" }), K = W.extend({ blob: G }), Be = E(["user", "assistant"]), Ve = o({
152
- audience: m(Be).optional(),
151
+ }, { message: "Invalid Base64 string" }), q = G.extend({ blob: K }), ze = T(["user", "assistant"]), Be = o({
152
+ audience: m(ze).optional(),
153
153
  priority: p().min(0).max(1).optional(),
154
154
  lastModified: d({ offset: !0 }).optional()
155
- }), He = o({
156
- ...Ce.shape,
157
- ...Se.shape,
155
+ }), Ve = o({
156
+ ...xe.shape,
157
+ ...be.shape,
158
158
  uri: r(),
159
159
  description: a(r()),
160
160
  mimeType: a(r()),
161
161
  size: a(p()),
162
- annotations: Ve.optional(),
162
+ annotations: Be.optional(),
163
163
  _meta: a(i({}))
164
- }), Ue = o({
165
- ...Ce.shape,
166
- ...Se.shape,
164
+ }), He = o({
165
+ ...xe.shape,
166
+ ...be.shape,
167
167
  uriTemplate: r(),
168
168
  description: a(r()),
169
169
  mimeType: a(r()),
170
- annotations: Ve.optional(),
170
+ annotations: Be.optional(),
171
171
  _meta: a(i({}))
172
- }), We = U.extend({ method: f("resources/list") }), q = Re.extend({ resources: m(He) }), Ge = U.extend({ method: f("resources/templates/list") }), Ke = Re.extend({ resourceTemplates: m(Ue) }), qe = F.extend({ uri: r() }), Je = qe, Ye = I.extend({
172
+ }), Ue = W.extend({ method: f("resources/list") }), We = Le.extend({ resources: m(Ve) }), Ge = W.extend({ method: f("resources/templates/list") }), Ke = Le.extend({ resourceTemplates: m(He) }), qe = I.extend({ uri: r() }), Je = qe, Ye = L.extend({
173
173
  method: f("resources/read"),
174
174
  params: Je
175
- }), Xe = z.extend({ contents: m(x([ze, K])) }), Ze = R.extend({
175
+ }), Xe = B.extend({ contents: m(x([Re, q])) }), Ze = z.extend({
176
176
  method: f("notifications/resources/list_changed"),
177
- params: L.optional()
178
- }), Qe = qe, $e = I.extend({
177
+ params: R.optional()
178
+ }), Qe = qe, $e = L.extend({
179
179
  method: f("resources/subscribe"),
180
180
  params: Qe
181
- }), et = qe, tt = I.extend({
181
+ }), et = qe, tt = L.extend({
182
182
  method: f("resources/unsubscribe"),
183
183
  params: et
184
184
  }), nt = o({
@@ -186,13 +186,13 @@ var ye = z.strict(), be = L.extend({
186
186
  promptsListChanged: D().optional(),
187
187
  resourcesListChanged: D().optional(),
188
188
  resourceSubscriptions: m(r()).optional()
189
- }), J = F.extend({ notifications: nt }), rt = I.extend({
189
+ }), J = I.extend({ notifications: nt }), rt = L.extend({
190
190
  method: f("subscriptions/listen"),
191
191
  params: J
192
- }), it = L.extend({ notifications: nt }), Y = R.extend({
192
+ }), it = R.extend({ notifications: nt }), Y = z.extend({
193
193
  method: f("notifications/subscriptions/acknowledged"),
194
194
  params: it
195
- }), at = i({ [j]: pe }), ot = z.extend({ _meta: at }), st = L.extend({ uri: r() }), ct = R.extend({
195
+ }), at = i({ [j]: fe }), ot = B.extend({ _meta: at }), st = R.extend({ uri: r() }), ct = z.extend({
196
196
  method: f("notifications/resources/updated"),
197
197
  params: st
198
198
  }), lt = o({
@@ -200,33 +200,33 @@ var ye = z.strict(), be = L.extend({
200
200
  description: a(r()),
201
201
  required: a(D())
202
202
  }), ut = o({
203
- ...Ce.shape,
204
- ...Se.shape,
203
+ ...xe.shape,
204
+ ...be.shape,
205
205
  description: a(r()),
206
206
  arguments: a(m(lt)),
207
207
  _meta: a(i({}))
208
- }), dt = U.extend({ method: f("prompts/list") }), ft = Re.extend({ prompts: m(ut) }), pt = F.extend({
208
+ }), dt = W.extend({ method: f("prompts/list") }), ft = Le.extend({ prompts: m(ut) }), pt = I.extend({
209
209
  name: r(),
210
210
  arguments: S(r(), r()).optional()
211
- }), mt = I.extend({
211
+ }), mt = L.extend({
212
212
  method: f("prompts/get"),
213
213
  params: pt
214
214
  }), ht = o({
215
215
  type: f("text"),
216
216
  text: r(),
217
- annotations: Ve.optional(),
217
+ annotations: Be.optional(),
218
218
  _meta: S(r(), c()).optional()
219
219
  }), gt = o({
220
220
  type: f("image"),
221
- data: G,
221
+ data: K,
222
222
  mimeType: r(),
223
- annotations: Ve.optional(),
223
+ annotations: Be.optional(),
224
224
  _meta: S(r(), c()).optional()
225
225
  }), _t = o({
226
226
  type: f("audio"),
227
- data: G,
227
+ data: K,
228
228
  mimeType: r(),
229
- annotations: Ve.optional(),
229
+ annotations: Be.optional(),
230
230
  _meta: S(r(), c()).optional()
231
231
  }), vt = o({
232
232
  type: f("tool_use"),
@@ -236,37 +236,37 @@ var ye = z.strict(), be = L.extend({
236
236
  _meta: S(r(), c()).optional()
237
237
  }), yt = o({
238
238
  type: f("resource"),
239
- resource: x([ze, K]),
240
- annotations: Ve.optional(),
239
+ resource: x([Re, q]),
240
+ annotations: Be.optional(),
241
241
  _meta: S(r(), c()).optional()
242
- }), bt = He.extend({ type: f("resource_link") }), xt = x([
242
+ }), bt = Ve.extend({ type: f("resource_link") }), xt = x([
243
243
  ht,
244
244
  gt,
245
245
  _t,
246
246
  bt,
247
247
  yt
248
248
  ]), St = o({
249
- role: Be,
249
+ role: ze,
250
250
  content: xt
251
- }), Ct = z.extend({
251
+ }), Ct = B.extend({
252
252
  description: r().optional(),
253
253
  messages: m(St)
254
- }), wt = R.extend({
254
+ }), wt = z.extend({
255
255
  method: f("notifications/prompts/list_changed"),
256
- params: L.optional()
256
+ params: R.optional()
257
257
  }), Tt = o({
258
258
  title: r().optional(),
259
259
  readOnlyHint: D().optional(),
260
260
  destructiveHint: D().optional(),
261
261
  idempotentHint: D().optional(),
262
262
  openWorldHint: D().optional()
263
- }), Et = o({ taskSupport: E([
263
+ }), Et = o({ taskSupport: T([
264
264
  "required",
265
265
  "optional",
266
266
  "forbidden"
267
267
  ]).optional() }), Dt = o({
268
- ...Ce.shape,
269
- ...Se.shape,
268
+ ...xe.shape,
269
+ ...be.shape,
270
270
  description: r().optional(),
271
271
  inputSchema: o({
272
272
  type: f("object"),
@@ -277,27 +277,27 @@ var ye = z.strict(), be = L.extend({
277
277
  annotations: Tt.optional(),
278
278
  execution: Et.optional(),
279
279
  _meta: S(r(), c()).optional()
280
- }), Ot = U.extend({ method: f("tools/list") }), kt = Re.extend({ tools: m(Dt) }), At = z.extend({
280
+ }), Ot = W.extend({ method: f("tools/list") }), kt = Le.extend({ tools: m(Dt) }), At = B.extend({
281
281
  content: m(xt).default([]),
282
282
  structuredContent: c().optional(),
283
283
  isError: D().optional()
284
284
  });
285
- At.or(z.extend({ toolResult: c() }));
286
- var jt = fe.extend({
285
+ At.or(B.extend({ toolResult: c() }));
286
+ var jt = de.extend({
287
287
  name: r(),
288
288
  arguments: S(r(), c()).optional()
289
- }), Mt = I.extend({
289
+ }), Mt = L.extend({
290
290
  method: f("tools/call"),
291
291
  params: jt
292
- }), Nt = R.extend({
292
+ }), Nt = z.extend({
293
293
  method: f("notifications/tools/list_changed"),
294
- params: L.optional()
294
+ params: R.optional()
295
295
  });
296
296
  o({
297
297
  autoRefresh: D().default(!0),
298
298
  debounceMs: p().int().nonnegative().default(300)
299
299
  });
300
- var Pt = E([
300
+ var Pt = T([
301
301
  "debug",
302
302
  "info",
303
303
  "notice",
@@ -306,14 +306,14 @@ var Pt = E([
306
306
  "critical",
307
307
  "alert",
308
308
  "emergency"
309
- ]), Ft = F.extend({ level: Pt }), It = I.extend({
309
+ ]), Ft = I.extend({ level: Pt }), It = L.extend({
310
310
  method: f("logging/setLevel"),
311
311
  params: Ft
312
- }), Lt = L.extend({
312
+ }), Lt = R.extend({
313
313
  level: Pt,
314
314
  logger: r().optional(),
315
315
  data: c()
316
- }), Rt = R.extend({
316
+ }), Rt = z.extend({
317
317
  method: f("notifications/message"),
318
318
  params: Lt
319
319
  }), zt = o({
@@ -321,7 +321,7 @@ var Pt = E([
321
321
  costPriority: p().min(0).max(1).optional(),
322
322
  speedPriority: p().min(0).max(1).optional(),
323
323
  intelligencePriority: p().min(0).max(1).optional()
324
- }), Bt = o({ mode: E([
324
+ }), Bt = o({ mode: T([
325
325
  "auto",
326
326
  "required",
327
327
  "none"
@@ -343,14 +343,14 @@ var Pt = E([
343
343
  vt,
344
344
  Vt
345
345
  ]), Wt = o({
346
- role: Be,
346
+ role: ze,
347
347
  content: x([Ut, m(Ut)]),
348
348
  _meta: S(r(), c()).optional()
349
- }), Gt = fe.extend({
349
+ }), Gt = de.extend({
350
350
  messages: m(Wt),
351
351
  modelPreferences: zt.optional(),
352
352
  systemPrompt: r().optional(),
353
- includeContext: E([
353
+ includeContext: T([
354
354
  "none",
355
355
  "thisServer",
356
356
  "allServers"
@@ -361,27 +361,27 @@ var Pt = E([
361
361
  metadata: N.optional(),
362
362
  tools: m(Dt).optional(),
363
363
  toolChoice: Bt.optional()
364
- }), Kt = I.extend({
364
+ }), Kt = L.extend({
365
365
  method: f("sampling/createMessage"),
366
366
  params: Gt
367
- }), qt = z.extend({
367
+ }), qt = B.extend({
368
368
  model: r(),
369
- stopReason: a(E([
369
+ stopReason: a(T([
370
370
  "endTurn",
371
371
  "stopSequence",
372
372
  "maxTokens"
373
373
  ]).or(r())),
374
- role: Be,
374
+ role: ze,
375
375
  content: Ht
376
- }), Jt = z.extend({
376
+ }), Jt = B.extend({
377
377
  model: r(),
378
- stopReason: a(E([
378
+ stopReason: a(T([
379
379
  "endTurn",
380
380
  "stopSequence",
381
381
  "maxTokens",
382
382
  "toolUse"
383
383
  ]).or(r())),
384
- role: Be,
384
+ role: ze,
385
385
  content: x([Ut, m(Ut)])
386
386
  }), Yt = o({
387
387
  type: f("boolean"),
@@ -394,7 +394,7 @@ var Pt = E([
394
394
  description: r().optional(),
395
395
  minLength: p().optional(),
396
396
  maxLength: p().optional(),
397
- format: E([
397
+ format: T([
398
398
  "email",
399
399
  "uri",
400
400
  "date",
@@ -402,7 +402,7 @@ var Pt = E([
402
402
  ]).optional(),
403
403
  default: r().optional()
404
404
  }), Zt = o({
405
- type: E(["number", "integer"]),
405
+ type: T(["number", "integer"]),
406
406
  title: r().optional(),
407
407
  description: r().optional(),
408
408
  minimum: p().optional(),
@@ -461,7 +461,7 @@ var Pt = E([
461
461
  Yt,
462
462
  Xt,
463
463
  Zt
464
- ]), tn = x([fe.extend({
464
+ ]), tn = x([de.extend({
465
465
  mode: f("form").optional(),
466
466
  message: r(),
467
467
  requestedSchema: o({
@@ -469,19 +469,19 @@ var Pt = E([
469
469
  properties: S(r(), en),
470
470
  required: m(r()).optional()
471
471
  }).catchall(c())
472
- }), fe.extend({
472
+ }), de.extend({
473
473
  mode: f("url"),
474
474
  message: r(),
475
475
  elicitationId: r(),
476
476
  url: r().url()
477
- })]), nn = I.extend({
477
+ })]), nn = L.extend({
478
478
  method: f("elicitation/create"),
479
479
  params: tn
480
- }), rn = L.extend({ elicitationId: r() }), an = R.extend({
480
+ }), rn = R.extend({ elicitationId: r() }), an = z.extend({
481
481
  method: f("notifications/elicitation/complete"),
482
482
  params: rn
483
- }), on = z.extend({
484
- action: E([
483
+ }), on = B.extend({
484
+ action: T([
485
485
  "accept",
486
486
  "decline",
487
487
  "cancel"
@@ -498,17 +498,17 @@ var Pt = E([
498
498
  }), cn = o({
499
499
  type: f("ref/prompt"),
500
500
  name: r()
501
- }), ln = F.extend({
501
+ }), ln = I.extend({
502
502
  ref: x([cn, sn]),
503
503
  argument: o({
504
504
  name: r(),
505
505
  value: r()
506
506
  }),
507
507
  context: o({ arguments: S(r(), r()).optional() }).optional()
508
- }), un = I.extend({
508
+ }), un = L.extend({
509
509
  method: f("completion/complete"),
510
510
  params: ln
511
- }), dn = z.extend({ completion: i({
511
+ }), dn = B.extend({ completion: i({
512
512
  values: m(r()).max(100),
513
513
  total: a(p().int()),
514
514
  hasMore: a(D())
@@ -516,18 +516,18 @@ var Pt = E([
516
516
  uri: r().startsWith("file://"),
517
517
  name: r().optional(),
518
518
  _meta: S(r(), c()).optional()
519
- }), pn = I.extend({
519
+ }), pn = L.extend({
520
520
  method: f("roots/list"),
521
- params: F.optional()
522
- }), mn = z.extend({ roots: m(fn) }), hn = R.extend({
521
+ params: I.optional()
522
+ }), mn = B.extend({ roots: m(fn) }), hn = z.extend({
523
523
  method: f("notifications/roots/list_changed"),
524
- params: L.optional()
524
+ params: R.optional()
525
525
  });
526
526
  i({
527
527
  ttl: p().optional(),
528
528
  pollInterval: p().optional()
529
529
  });
530
- var gn = E([
530
+ var gn = T([
531
531
  "working",
532
532
  "input_required",
533
533
  "completed",
@@ -542,29 +542,29 @@ var gn = E([
542
542
  pollInterval: a(p()),
543
543
  statusMessage: a(r())
544
544
  });
545
- z.extend({ task: _n });
546
- var vn = L.merge(_n);
547
- R.extend({
545
+ B.extend({ task: _n });
546
+ var vn = R.merge(_n);
547
+ z.extend({
548
548
  method: f("notifications/tasks/status"),
549
549
  params: vn
550
- }), I.extend({
550
+ }), L.extend({
551
551
  method: f("tasks/get"),
552
- params: F.extend({ taskId: r() })
553
- }), z.merge(_n), I.extend({
552
+ params: I.extend({ taskId: r() })
553
+ }), B.merge(_n), L.extend({
554
554
  method: f("tasks/result"),
555
- params: F.extend({ taskId: r() })
556
- }), z.loose(), U.extend({ method: f("tasks/list") }), Re.extend({ tasks: m(_n) }), I.extend({
555
+ params: I.extend({ taskId: r() })
556
+ }), B.loose(), W.extend({ method: f("tasks/list") }), Le.extend({ tasks: m(_n) }), L.extend({
557
557
  method: f("tasks/cancel"),
558
- params: F.extend({ taskId: r() })
559
- }), z.merge(_n), x([
560
- Pe,
561
- ke,
562
- Me,
558
+ params: I.extend({ taskId: r() })
559
+ }), B.merge(_n), x([
560
+ Ne,
561
+ De,
562
+ je,
563
563
  un,
564
564
  It,
565
565
  mt,
566
566
  dt,
567
- We,
567
+ Ue,
568
568
  Ge,
569
569
  Ye,
570
570
  $e,
@@ -573,24 +573,24 @@ R.extend({
573
573
  Mt,
574
574
  Ot
575
575
  ]), x([
576
- xe,
577
- Ie,
578
- je,
576
+ ye,
577
+ Fe,
578
+ Ae,
579
579
  hn
580
580
  ]), x([
581
- ye,
581
+ _e,
582
582
  qt,
583
583
  Jt,
584
584
  on,
585
585
  mn
586
586
  ]), x([
587
- Pe,
587
+ Ne,
588
588
  Kt,
589
589
  nn,
590
590
  pn
591
591
  ]), x([
592
- xe,
593
- Ie,
592
+ ye,
593
+ Fe,
594
594
  Rt,
595
595
  ct,
596
596
  Ze,
@@ -599,13 +599,13 @@ R.extend({
599
599
  Y,
600
600
  an
601
601
  ]), x([
602
- ye,
603
- V,
604
- Ne,
602
+ _e,
603
+ ke,
604
+ Me,
605
605
  dn,
606
606
  Ct,
607
607
  ft,
608
- q,
608
+ We,
609
609
  Ke,
610
610
  Xe,
611
611
  At,
@@ -978,7 +978,7 @@ o({
978
978
  });
979
979
  var Yn = o({
980
980
  toolInfo: o({
981
- id: pe.optional().describe("JSON-RPC id of the tools/call request."),
981
+ id: fe.optional().describe("JSON-RPC id of the tools/call request."),
982
982
  tool: Dt.describe("Tool definition including name, inputSchema, etc.")
983
983
  }).optional().describe("Metadata of the tool call that instantiated this App."),
984
984
  theme: Tn.optional().describe("Current color theme preference."),
@@ -1018,13 +1018,13 @@ var Xn = o({
1018
1018
  }), Zn = o({
1019
1019
  method: f("ui/initialize"),
1020
1020
  params: o({
1021
- appInfo: B.describe("App identification (name and version)."),
1021
+ appInfo: Se.describe("App identification (name and version)."),
1022
1022
  appCapabilities: Hn.describe("Features and capabilities this app provides."),
1023
1023
  protocolVersion: r().describe("Protocol version this app supports.")
1024
1024
  })
1025
1025
  }), Qn = o({
1026
1026
  protocolVersion: r().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
1027
- hostInfo: B.describe("Host application identification and version."),
1027
+ hostInfo: Se.describe("Host application identification and version."),
1028
1028
  hostCapabilities: Vn.describe("Features and capabilities provided by the host."),
1029
1029
  hostContext: Yn.describe("Rich context about the host environment.")
1030
1030
  }).passthrough(), $n = class {
@@ -1037,7 +1037,7 @@ var Xn = o({
1037
1037
  console.debug("Ignoring message from unknown source", e);
1038
1038
  return;
1039
1039
  }
1040
- let n = ve.safeParse(e.data);
1040
+ let n = ge.safeParse(e.data);
1041
1041
  n.success ? (console.debug("Parsed message", n.data), this.onmessage?.(n.data)) : e.data?.jsonrpc === "2.0" ? (console.error("Failed to parse message", n.error.message, e), this.onerror?.(Error("Invalid JSON-RPC message received: " + n.error.message))) : console.debug("Ignoring non-JSON-RPC message", n.error.message, e);
1042
1042
  };
1043
1043
  }
@@ -1219,7 +1219,7 @@ var nr = [wn], rr = class extends ie {
1219
1219
  set onupdatemodelcontext(e) {
1220
1220
  this.warnIfRequestHandlerReplaced("onupdatemodelcontext", this._onupdatemodelcontext, e), this._onupdatemodelcontext = e, this.setRequestHandler("ui/update-model-context", {
1221
1221
  params: Xn.shape.params,
1222
- result: ye
1222
+ result: _e
1223
1223
  }, async (e, t) => {
1224
1224
  if (!this._onupdatemodelcontext) throw Error("No onupdatemodelcontext handler set");
1225
1225
  return this._onupdatemodelcontext(e, t);
@@ -1645,7 +1645,7 @@ function Nr(e) {
1645
1645
  var Pr = class {
1646
1646
  getValidator(e) {
1647
1647
  let t = Nr(e);
1648
- return (t === void 0 ? new T() : new T({ draft: t })).getValidator(e);
1648
+ return (t === void 0 ? new re() : new re({ draft: t })).getValidator(e);
1649
1649
  }
1650
1650
  };
1651
1651
  mr();
@@ -1944,7 +1944,7 @@ var Lr = { "~standard": {
1944
1944
  };
1945
1945
  function zr(e, t = 0) {
1946
1946
  if (!e || t > 5) return !1;
1947
- if (e instanceof re || e instanceof C && e.status === 401) return !0;
1947
+ if (e instanceof E || e instanceof C && e.status === 401) return !0;
1948
1948
  if (e instanceof Error) {
1949
1949
  if (e.cause && zr(e.cause, t + 1)) return !0;
1950
1950
  let n = e instanceof _ ? e.data : void 0;
@@ -2198,7 +2198,7 @@ var Vr = class extends Rr {
2198
2198
  }
2199
2199
  await super.cleanupResources();
2200
2200
  }
2201
- }, Hr = "2.0.0-beta.3";
2201
+ }, Hr = "2.0.0-beta.4";
2202
2202
  function Ur() {
2203
2203
  return Hr;
2204
2204
  }
@@ -3100,7 +3100,7 @@ var Pi = class e {
3100
3100
  }, Fi = 5 * 6e4;
3101
3101
  function Ii(e, t = 0) {
3102
3102
  if (!e || t > 5) return !1;
3103
- if (e instanceof re) return !0;
3103
+ if (e instanceof E) return !0;
3104
3104
  if (e instanceof Error) {
3105
3105
  if (e.code === 401 || e.name === "UnauthorizedError") return !0;
3106
3106
  let n = e.message ?? "";
@@ -3672,7 +3672,7 @@ function ua(e) {
3672
3672
  }
3673
3673
  var da = 3e3, fa = 5e3;
3674
3674
  function pa(e) {
3675
- let { url: t, enabled: n = !0, callbackUrl: r = typeof window < "u" ? Yr(new URL("/oauth/callback", window.location.origin).toString()) : "/oauth/callback", storageKeyPrefix: i = "mcp:auth", authProvider: a, headers: o, proxyConfig: s, oauthProxyUrl: c, autoProxyFallback: l = !1, logLevel: u = "silent", autoRetry: d = !1, autoReconnect: f = !0, reconnectionOptions: p, preventAutoAuth: m = !0, useRedirectFlow: h = !1, onPopupWindow: g, timeout: _ = 3e4, wrapTransport: v, serverId: ee, fetch: te, clientOptions: y, protocolNegotiation: x, onNotification: S, onSampling: C, onElicitation: ne, oauth: w } = e, T = "http", E = w?.clientId?.trim() || void 0, re = w?.clientMetadataUrl?.trim() || void 0, ie = w?.scope?.trim() || void 0, ae = (0, A.useMemo)(() => E ? { client_id: E } : void 0, [E]), D = (0, A.useMemo)(() => {
3675
+ let { url: t, enabled: n = !0, callbackUrl: r = typeof window < "u" ? Yr(new URL("/oauth/callback", window.location.origin).toString()) : "/oauth/callback", storageKeyPrefix: i = "mcp:auth", authProvider: a, headers: o, proxyConfig: s, oauthProxyUrl: c, autoProxyFallback: l = !1, logLevel: u = "silent", autoRetry: d = !1, autoReconnect: f = !0, reconnectionOptions: p, preventAutoAuth: m = !0, useRedirectFlow: h = !1, onPopupWindow: g, timeout: _ = 3e4, wrapTransport: v, serverId: ee, fetch: te, clientOptions: y, protocolNegotiation: x, onNotification: S, onSampling: C, onElicitation: ne, oauth: w } = e, re = "http", T = w?.clientId?.trim() || void 0, E = w?.clientMetadataUrl?.trim() || void 0, ie = w?.scope?.trim() || void 0, ae = (0, A.useMemo)(() => T ? { client_id: T } : void 0, [T]), D = (0, A.useMemo)(() => {
3676
3676
  let e = `useMcp:${t || "no-url"}`, n = pr.get(e);
3677
3677
  return u && (n.level = u), n;
3678
3678
  }, [t, u]), O = o ?? {}, oe = (0, A.useMemo)(() => Jr(y), [y]), k = C, se = ne, j = (0, A.useMemo)(() => ({
@@ -3685,7 +3685,7 @@ function pa(e) {
3685
3685
  }), []), M = (0, A.useMemo)(() => e.clientInfo ? {
3686
3686
  ...j,
3687
3687
  ...e.clientInfo
3688
- } : j, [e.clientInfo, j]), N = (0, A.useMemo)(() => ia(M), [M]), ce = (0, A.useMemo)(() => {
3688
+ } : j, [e.clientInfo, j]), N = (0, A.useMemo)(() => ia(M), [M]), P = (0, A.useMemo)(() => {
3689
3689
  if (!l) return {
3690
3690
  enabled: !1,
3691
3691
  proxyAddress: void 0
@@ -3702,7 +3702,7 @@ function pa(e) {
3702
3702
  enabled: l.enabled !== !1 && !!e,
3703
3703
  proxyAddress: e
3704
3704
  };
3705
- }, [l, s]), P = (0, A.useMemo)(() => f === !1 ? {
3705
+ }, [l, s]), ce = (0, A.useMemo)(() => f === !1 ? {
3706
3706
  enabled: !1,
3707
3707
  initialDelay: 0,
3708
3708
  healthCheckInterval: !1,
@@ -3726,7 +3726,7 @@ function pa(e) {
3726
3726
  (0, A.useEffect)(() => {
3727
3727
  ue(void 0);
3728
3728
  }, [t, s]);
3729
- let de = (0, A.useMemo)(() => {
3729
+ let F = (0, A.useMemo)(() => {
3730
3730
  if (!le?.proxyAddress) return s;
3731
3731
  let e = s?.headers ?? {};
3732
3732
  return {
@@ -3736,18 +3736,18 @@ function pa(e) {
3736
3736
  ...le.headers ?? {}
3737
3737
  }
3738
3738
  };
3739
- }, [le, s]), F = de?.proxyAddress, fe = de?.headers ?? {}, I = (0, A.useMemo)(() => t || "", [t]), L = (0, A.useMemo)(() => ({
3740
- ...fe,
3739
+ }, [le, s]), I = F?.proxyAddress, de = F?.headers ?? {}, L = (0, A.useMemo)(() => t || "", [t]), R = (0, A.useMemo)(() => ({
3740
+ ...de,
3741
3741
  ...O
3742
- }), [fe, O]), [R, z] = (0, A.useState)("discovering"), [pe, me] = (0, A.useState)([]), [he, ge] = (0, A.useState)([]), [_e, ve] = (0, A.useState)([]), [ye, be] = (0, A.useState)([]), [xe, Se] = (0, A.useState)(e._initialServerInfo?.name ? e._initialServerInfo : void 0), [Ce, B] = (0, A.useState)(), [we, Te] = (0, A.useState)(void 0), [Ee, De] = (0, A.useState)(void 0), [Oe, ke] = (0, A.useState)(), [Ae, V] = (0, A.useState)({}), [je, Me] = (0, A.useState)(void 0), [Ne, Pe] = (0, A.useState)([]), [Fe, H] = (0, A.useState)(void 0), [Ie, Le] = (0, A.useState)(void 0), U = (0, A.useRef)(null), Re = (0, A.useRef)(null), W = (0, A.useRef)(a ?? null), ze = (0, A.useRef)(null), G = (0, A.useRef)(!1), K = (0, A.useRef)(!0), Be = (0, A.useRef)(0), Ve = (0, A.useRef)(0), He = (0, A.useRef)(null), Ue = (0, A.useRef)(!1), We = (0, A.useRef)(!1), q = (0, A.useRef)(R), Ge = (0, A.useRef)(f), Ke = (0, A.useRef)(null), qe = (0, A.useRef)(null), Je = (0, A.useRef)(null), Ye = (0, A.useRef)(k), Xe = (0, A.useRef)(se), Ze = (0, A.useRef)(k !== void 0), Qe = (0, A.useRef)(se !== void 0), $e = (0, A.useRef)(S);
3742
+ }), [de, O]), [z, B] = (0, A.useState)("discovering"), [fe, V] = (0, A.useState)([]), [pe, me] = (0, A.useState)([]), [he, ge] = (0, A.useState)([]), [_e, ve] = (0, A.useState)([]), [ye, be] = (0, A.useState)(e._initialServerInfo?.name ? e._initialServerInfo : void 0), [xe, Se] = (0, A.useState)(), [Ce, we] = (0, A.useState)(void 0), [Te, H] = (0, A.useState)(void 0), [Ee, De] = (0, A.useState)(), [Oe, ke] = (0, A.useState)({}), [Ae, je] = (0, A.useState)(void 0), [Me, Ne] = (0, A.useState)([]), [Pe, U] = (0, A.useState)(void 0), [Fe, Ie] = (0, A.useState)(void 0), W = (0, A.useRef)(null), Le = (0, A.useRef)(null), G = (0, A.useRef)(a ?? null), Re = (0, A.useRef)(null), K = (0, A.useRef)(!1), q = (0, A.useRef)(!0), ze = (0, A.useRef)(0), Be = (0, A.useRef)(0), Ve = (0, A.useRef)(null), He = (0, A.useRef)(!1), Ue = (0, A.useRef)(!1), We = (0, A.useRef)(z), Ge = (0, A.useRef)(f), Ke = (0, A.useRef)(null), qe = (0, A.useRef)(null), Je = (0, A.useRef)(null), Ye = (0, A.useRef)(k), Xe = (0, A.useRef)(se), Ze = (0, A.useRef)(k !== void 0), Qe = (0, A.useRef)(se !== void 0), $e = (0, A.useRef)(S);
3743
3743
  k !== void 0 && (Ye.current = k), se !== void 0 && (Xe.current = se), Ze.current = k !== void 0, Qe.current = se !== void 0, $e.current = S;
3744
3744
  let et = (0, A.useCallback)(async (e) => Ye.current(e), []), tt = (0, A.useCallback)(async (e) => Xe.current(e), []), nt = (0, A.useCallback)((e) => {
3745
3745
  $e.current?.(e);
3746
3746
  }, []);
3747
3747
  (0, A.useEffect)(() => {
3748
- q.current = R, Ge.current = f;
3749
- }, [R, f]), (0, A.useEffect)(() => {
3750
- W.current = a ?? null;
3748
+ We.current = z, Ge.current = f;
3749
+ }, [z, f]), (0, A.useEffect)(() => {
3750
+ G.current = a ?? null;
3751
3751
  }, [a]);
3752
3752
  let J = (0, A.useCallback)((e, t, ...n) => {
3753
3753
  let r = n.length > 0 ? `${t} ${n.map((e) => JSON.stringify(e)).join(" ")}` : t, i = `[useMcp] ${r}`;
@@ -3766,115 +3766,115 @@ function pa(e) {
3766
3766
  break;
3767
3767
  default: D.info(i);
3768
3768
  }
3769
- K.current && Pe((t) => [...t.slice(-100), {
3769
+ q.current && Ne((t) => [...t.slice(-100), {
3770
3770
  level: e,
3771
3771
  message: r,
3772
3772
  timestamp: Date.now()
3773
3773
  }]);
3774
3774
  }, [D]), rt = ua({
3775
- stateRef: q,
3776
- connectionRef: Re,
3777
- hasClient: () => U.current !== null,
3778
- isMounted: () => K.current,
3779
- setTools: me,
3780
- setResources: ge,
3781
- setResourceTemplates: ve,
3782
- setPrompts: be,
3775
+ stateRef: We,
3776
+ connectionRef: Le,
3777
+ hasClient: () => W.current !== null,
3778
+ isMounted: () => q.current,
3779
+ setTools: V,
3780
+ setResources: me,
3781
+ setResourceTemplates: ge,
3782
+ setPrompts: ve,
3783
3783
  addLog: J
3784
3784
  }), it = (0, A.useCallback)(async (e = !1) => {
3785
- e || J("info", "Disconnecting..."), G.current = !1, He.current && clearTimeout(He.current), He.current = null;
3786
- let t = Ve.current, n = U.current;
3785
+ e || J("info", "Disconnecting..."), K.current = !1, Ve.current && clearTimeout(Ve.current), Ve.current = null;
3786
+ let t = Be.current, n = W.current;
3787
3787
  if (n) try {
3788
- let e = ea, t = n === U.current ? Re.current : null;
3788
+ let e = ea, t = n === W.current ? Le.current : null;
3789
3789
  t && t._healthCheckCleanup && (t._healthCheckCleanup(), t._healthCheckCleanup = null), t && await n.closeSession(e);
3790
3790
  } catch (t) {
3791
3791
  e || J("warn", "Error closing connection:", t);
3792
3792
  }
3793
- let r = Ve.current !== t;
3794
- U.current === n && !r && (U.current = null, Re.current = null), K.current && !e && !r && (z("discovering"), me([]), ge([]), ve([]), be([]), Me(void 0), H(void 0), Le(void 0), Se(void 0), B(void 0), Te(void 0), De(void 0), ke(void 0), V({}));
3793
+ let r = Be.current !== t;
3794
+ W.current === n && !r && (W.current = null, Le.current = null), q.current && !e && !r && (B("discovering"), V([]), me([]), ge([]), ve([]), je(void 0), U(void 0), Ie(void 0), be(void 0), Se(void 0), we(void 0), H(void 0), De(void 0), ke({}));
3795
3795
  }, [J]), Y = (0, A.useCallback)((e, n) => {
3796
3796
  J("error", e, n ?? "");
3797
- let r = n && "code" in n ? n.code : void 0, i = ce.enabled && !de?.proxyAddress, o = e.includes("CORS") || e.includes("blocked by CORS policy") || e.includes("Failed to fetch"), s = r === 400;
3798
- if (i && (o || s || typeof r == "number" && r >= 404 && r < 500) && !(r === 401 || r === 403)) return J("info", `Direct connection failed with ${o ? "CORS error" : s ? "HTTP 400 (Bad Request)" : "HTTP 4xx error"}. Trying with proxy...`), U.current = null, a || (W.current = null), J("debug", "Cleared client and auth provider for proxy fallback"), ue({ proxyAddress: ce.proxyAddress }), K.current && z("discovering"), setTimeout(() => {
3799
- K.current && qe.current?.();
3797
+ let r = n && "code" in n ? n.code : void 0, i = P.enabled && !F?.proxyAddress, o = e.includes("CORS") || e.includes("blocked by CORS policy") || e.includes("Failed to fetch"), s = r === 400;
3798
+ if (i && (o || s || typeof r == "number" && r >= 404 && r < 500) && !(r === 401 || r === 403)) return J("info", `Direct connection failed with ${o ? "CORS error" : s ? "HTTP 400 (Bad Request)" : "HTTP 4xx error"}. Trying with proxy...`), W.current = null, a || (G.current = null), J("debug", "Cleared client and auth provider for proxy fallback"), ue({ proxyAddress: P.proxyAddress }), q.current && B("discovering"), setTimeout(() => {
3799
+ q.current && qe.current?.();
3800
3800
  }, 1e3), !0;
3801
- if (K.current) {
3802
- J("info", "Setting state to FAILED:", e), z("failed"), Me(e);
3803
- let t = W.current?.getLastAttemptedAuthUrl?.();
3804
- t && (H(t), J("info", "Manual authentication URL may be available.", t));
3801
+ if (q.current) {
3802
+ J("info", "Setting state to FAILED:", e), B("failed"), je(e);
3803
+ let t = G.current?.getLastAttemptedAuthUrl?.();
3804
+ t && (U(t), J("info", "Manual authentication URL may be available.", t));
3805
3805
  }
3806
- return G.current = !1, t && Pi.getInstance().trackUseMcpConnection({
3806
+ return K.current = !1, t && Pi.getInstance().trackUseMcpConnection({
3807
3807
  url: t,
3808
- transportType: T,
3808
+ transportType: re,
3809
3809
  success: !1,
3810
3810
  errorType: n?.name || "UnknownError",
3811
- hasOAuth: !!W.current,
3811
+ hasOAuth: !!G.current,
3812
3812
  hasSampling: Ze.current,
3813
3813
  hasElicitation: Qe.current
3814
3814
  }).catch(() => {}), !1;
3815
3815
  }, [
3816
3816
  J,
3817
3817
  t,
3818
- T,
3819
- ce,
3820
- de,
3818
+ re,
3819
+ P,
3820
+ F,
3821
3821
  a
3822
3822
  ]), at = (0, A.useCallback)(async () => {
3823
3823
  if (!n || !t) {
3824
3824
  J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag.");
3825
3825
  return;
3826
3826
  }
3827
- if (G.current) {
3827
+ if (K.current) {
3828
3828
  J("debug", "Connection attempt already in progress.");
3829
3829
  return;
3830
3830
  }
3831
- if (!K.current) {
3831
+ if (!q.current) {
3832
3832
  J("debug", "Connect called after unmount, aborting.");
3833
3833
  return;
3834
3834
  }
3835
- if (G.current = !0, Ve.current += 1, Be.current += 1, Me(void 0), H(void 0), Ke.current = null, z("discovering"), me([]), ge([]), ve([]), be([]), Se(void 0), B(void 0), Te(void 0), De(void 0), ke(void 0), V({}), J("info", `Connecting attempt #${Be.current} to ${t}...`), !W.current) {
3835
+ if (K.current = !0, Be.current += 1, ze.current += 1, je(void 0), U(void 0), Ke.current = null, B("discovering"), V([]), me([]), ge([]), ve([]), be(void 0), Se(void 0), we(void 0), H(void 0), De(void 0), ke({}), J("info", `Connecting attempt #${ze.current} to ${t}...`), !G.current) {
3836
3836
  let { provider: e, oauthProxyUrl: t } = sa({
3837
- effectiveOAuthUrl: I,
3837
+ effectiveOAuthUrl: L,
3838
3838
  storageKeyPrefix: i,
3839
3839
  oauthClientConfig: N,
3840
3840
  callbackUrl: r,
3841
3841
  preventAutoAuth: m,
3842
3842
  useRedirectFlow: h,
3843
- gatewayUrl: F,
3843
+ gatewayUrl: I,
3844
3844
  oauthProxyUrl: c,
3845
3845
  onPopupWindow: g,
3846
3846
  proxyOAuthRequests: !0,
3847
3847
  staticClientInfo: ae,
3848
- clientMetadataUrl: re,
3848
+ clientMetadataUrl: E,
3849
3849
  scope: ie
3850
3850
  });
3851
- W.current = e, t && J("debug", `OAuth BFF enabled: ${t}`), J("debug", `BrowserOAuthClientProvider initialized with URL: ${I}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${F ? "enabled" : "disabled"}`);
3851
+ G.current = e, t && J("debug", `OAuth BFF enabled: ${t}`), J("debug", `BrowserOAuthClientProvider initialized with URL: ${L}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${I ? "enabled" : "disabled"}`);
3852
3852
  }
3853
- U.current ? J("debug", "BrowserMCPClient already exists, reusing.") : (U.current = new Ki(), J("debug", "BrowserMCPClient initialized in connect."));
3853
+ W.current ? J("debug", "BrowserMCPClient already exists, reusing.") : (W.current = new Ki(), J("debug", "BrowserMCPClient initialized in connect."));
3854
3854
  let e = async (n) => {
3855
- if (!K.current) return J("debug", "Connection attempt aborted - component unmounted"), "failed";
3856
- J("info", `Attempting connection with transport: ${n}`), J("debug", `Client ref status at start of tryConnectWithTransport: ${U.current ? "initialized" : "NULL"}`);
3855
+ if (!q.current) return J("debug", "Connection attempt aborted - component unmounted"), "failed";
3856
+ J("info", `Attempting connection with transport: ${n}`), J("debug", `Client ref status at start of tryConnectWithTransport: ${W.current ? "initialized" : "NULL"}`);
3857
3857
  try {
3858
3858
  let e = ea, r = {
3859
3859
  url: t,
3860
3860
  timeout: _,
3861
3861
  clientInfo: M,
3862
3862
  ...(() => {
3863
- let e = W.current?.getProxyFetch?.(te) ?? te;
3863
+ let e = G.current?.getProxyFetch?.(te) ?? te;
3864
3864
  return e ? { fetch: e } : {};
3865
3865
  })(),
3866
3866
  ...oe && { clientOptions: oe },
3867
3867
  ...x !== void 0 && { protocolNegotiation: x },
3868
3868
  ...p ? { reconnectionOptions: p } : f === !1 ? { reconnectionOptions: { maxRetries: 0 } } : {}
3869
3869
  };
3870
- if (F && (r.gatewayUrl = F, J("debug", `Using proxy gateway: ${F} for target: ${t}`)), L && Object.keys(L).length > 0 && (r.headers = L), !U.current) {
3871
- if (!K.current) return J("debug", "Connection aborted - component unmounted, client cleaned up"), "failed";
3870
+ if (I && (r.gatewayUrl = I, J("debug", `Using proxy gateway: ${I} for target: ${t}`)), R && Object.keys(R).length > 0 && (r.headers = R), !W.current) {
3871
+ if (!q.current) return J("debug", "Connection aborted - component unmounted, client cleaned up"), "failed";
3872
3872
  let e = /* @__PURE__ */ Error("Client not initialized - this is a bug in the connection flow");
3873
3873
  throw J("error", "Client ref is null in tryConnectWithTransport but component is still mounted"), e;
3874
3874
  }
3875
- U.current.addServer(e, {
3875
+ W.current.addServer(e, {
3876
3876
  ...r,
3877
- authProvider: W.current,
3877
+ authProvider: G.current,
3878
3878
  onSampling: Ze.current ? et : void 0,
3879
3879
  onElicitation: Qe.current ? tt : void 0,
3880
3880
  onNotification: (e) => {
@@ -3882,15 +3882,15 @@ function pa(e) {
3882
3882
  },
3883
3883
  wrapTransport: v ? (n) => (J("debug", "Applying transport wrapper for server:", e, "url:", t), v(n, ee ?? t)) : void 0
3884
3884
  });
3885
- let i = await U.current.connect(e);
3886
- if (Re.current = i, !K.current) return J("debug", "Connection aborted after connection creation - component unmounted"), "failed";
3887
- J("info", "✅ Successfully connected to MCP server"), J("info", "Server info:", i.info.server), J("info", "Server capabilities:", i.info.capabilities), P.enabled && P.healthCheckInterval !== !1 && (i._healthCheckCleanup = ca({
3888
- gatewayUrl: F,
3885
+ let i = await W.current.connect(e);
3886
+ if (Le.current = i, !q.current) return J("debug", "Connection aborted after connection creation - component unmounted"), "failed";
3887
+ J("info", "✅ Successfully connected to MCP server"), J("info", "Server info:", i.info.server), J("info", "Server capabilities:", i.info.capabilities), ce.enabled && ce.healthCheckInterval !== !1 && (i._healthCheckCleanup = ca({
3888
+ gatewayUrl: I,
3889
3889
  url: t,
3890
- allHeaders: L,
3890
+ allHeaders: R,
3891
3891
  getAuthHeaders: async () => {
3892
3892
  try {
3893
- let e = await W.current?.tokens?.();
3893
+ let e = await G.current?.tokens?.();
3894
3894
  if (e?.access_token) {
3895
3895
  let t = e.token_type || "bearer";
3896
3896
  return { Authorization: `${t.charAt(0).toUpperCase() + t.slice(1)} ${e.access_token}` };
@@ -3898,62 +3898,62 @@ function pa(e) {
3898
3898
  } catch {}
3899
3899
  return {};
3900
3900
  },
3901
- isMountedRef: K,
3902
- stateRef: q,
3901
+ isMountedRef: q,
3902
+ stateRef: We,
3903
3903
  autoReconnectRef: Ge,
3904
- setState: z,
3904
+ setState: B,
3905
3905
  addLog: J,
3906
3906
  connect: at,
3907
- defaultReconnectDelay: P.initialDelay,
3908
- healthCheckIntervalMs: P.healthCheckInterval,
3909
- healthCheckTimeoutMs: P.healthCheckTimeout
3907
+ defaultReconnectDelay: ce.initialDelay,
3908
+ healthCheckIntervalMs: ce.healthCheckInterval,
3909
+ healthCheckTimeoutMs: ce.healthCheckTimeout
3910
3910
  })), Pi.getInstance().trackUseMcpConnection({
3911
3911
  url: t,
3912
3912
  transportType: n,
3913
3913
  success: !0,
3914
- hasOAuth: !!W.current,
3914
+ hasOAuth: !!G.current,
3915
3915
  hasSampling: Ze.current,
3916
3916
  hasElicitation: Qe.current
3917
- }).catch(() => {}), me(i.tools || []);
3917
+ }).catch(() => {}), V(i.tools || []);
3918
3918
  let [a, o, s] = await Promise.all([
3919
3919
  i.listAllResources(),
3920
3920
  i.listPrompts(),
3921
3921
  i.supports("resources") ? i.listResourceTemplates() : Promise.resolve({ resourceTemplates: [] })
3922
3922
  ]);
3923
- if (!K.current) return J("debug", "Connection aborted after discovery - component unmounted"), "failed";
3924
- ge(a.resources || []), be(o.prompts || []), ve(s.resourceTemplates || []);
3923
+ if (!q.current) return J("debug", "Connection aborted after discovery - component unmounted"), "failed";
3924
+ me(a.resources || []), ve(o.prompts || []), ge(s.resourceTemplates || []);
3925
3925
  let { server: c, capabilities: l, protocolEra: u, protocolVersion: d, instructions: m, extensions: h } = i.info;
3926
- if (K.current && (Te(u), De(d), ke(m), V(h)), c) {
3927
- if (J("debug", "Server info:", c), !K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3928
- Se(c), ze.current = na({
3926
+ if (q.current && (we(u), H(d), De(m), ke(h)), c) {
3927
+ if (J("debug", "Server info:", c), !q.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3928
+ be(c), Re.current = na({
3929
3929
  serverInfo: c,
3930
3930
  url: t,
3931
- isMounted: () => K.current,
3932
- setServerInfo: Se,
3931
+ isMounted: () => q.current,
3932
+ setServerInfo: be,
3933
3933
  addLog: J
3934
3934
  });
3935
3935
  }
3936
3936
  if (l) {
3937
- if (J("debug", "Server capabilities:", l), !K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3938
- B(l);
3937
+ if (J("debug", "Server capabilities:", l), !q.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3938
+ Se(l);
3939
3939
  }
3940
- if (W.current) {
3941
- let e = await W.current.tokens?.();
3942
- if (!K.current) return J("debug", "Connection aborted after token fetch for auth tokens - component unmounted"), "failed";
3940
+ if (G.current) {
3941
+ let e = await G.current.tokens?.();
3942
+ if (!q.current) return J("debug", "Connection aborted after token fetch for auth tokens - component unmounted"), "failed";
3943
3943
  if (e?.access_token) {
3944
3944
  let t = e.expires_in ? Date.now() + e.expires_in * 1e3 : void 0, n = null, r = null;
3945
3945
  try {
3946
- n = await W.current.getTokenEndpoint?.() ?? null;
3946
+ n = await G.current.getTokenEndpoint?.() ?? null;
3947
3947
  } catch {
3948
3948
  n = null;
3949
3949
  }
3950
3950
  try {
3951
- r = await W.current.getClientCredentials?.() ?? null;
3951
+ r = await G.current.getClientCredentials?.() ?? null;
3952
3952
  } catch {
3953
3953
  r = null;
3954
3954
  }
3955
- if (!K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3956
- Le({
3955
+ if (!q.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3956
+ Ie({
3957
3957
  access_token: e.access_token,
3958
3958
  token_type: e.token_type || "Bearer",
3959
3959
  expires_at: t,
@@ -3965,35 +3965,35 @@ function pa(e) {
3965
3965
  });
3966
3966
  }
3967
3967
  }
3968
- return Ke.current = n, z("ready"), "success";
3968
+ return Ke.current = n, B("ready"), "success";
3969
3969
  } catch (r) {
3970
- let i = r, a = i?.message || String(r), o = W.current?.getLastAttemptedAuthUrl?.();
3971
- if (o && W.current && m) return J("info", "OAuth already discovered (stored auth URL present); awaiting manual authentication."), K.current && (z("pending_auth"), H(o)), G.current = !1, "auth_redirect";
3970
+ let i = r, a = i?.message || String(r), o = G.current?.getLastAttemptedAuthUrl?.();
3971
+ if (o && G.current && m) return J("info", "OAuth already discovered (stored auth URL present); awaiting manual authentication."), q.current && (B("pending_auth"), U(o)), K.current = !1, "auth_redirect";
3972
3972
  let s = aa(r), c = Ii(r);
3973
3973
  if (s && O && Object.keys(O).length > 0) return Y("Authentication failed (HTTP 401). Server does not support OAuth. Check your Authorization header value is correct."), "failed";
3974
3974
  if (s && (!O || Object.keys(O).length === 0)) return Y("Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed";
3975
3975
  if (c) {
3976
3976
  if (s) return Y("Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed";
3977
- if (W.current) if (J("info", "Authentication required. OAuth provider available."), m) {
3978
- if (J("info", "Waiting for user to initiate authentication flow..."), K.current) {
3979
- z("pending_auth");
3980
- let e = W.current?.getLastAttemptedAuthUrl?.();
3981
- e && (H(e), J("info", "Retrieved stored auth URL for manual authentication"));
3977
+ if (G.current) if (J("info", "Authentication required. OAuth provider available."), m) {
3978
+ if (J("info", "Waiting for user to initiate authentication flow..."), q.current) {
3979
+ B("pending_auth");
3980
+ let e = G.current?.getLastAttemptedAuthUrl?.();
3981
+ e && (U(e), J("info", "Retrieved stored auth URL for manual authentication"));
3982
3982
  }
3983
- return G.current = !1, "auth_redirect";
3983
+ return K.current = !1, "auth_redirect";
3984
3984
  } else {
3985
3985
  J("info", "Triggering automatic OAuth authentication flow...");
3986
3986
  try {
3987
- if (await b(W.current, {
3987
+ if (await b(G.current, {
3988
3988
  serverUrl: t,
3989
- fetchFn: W.current.getProxyFetch?.()
3989
+ fetchFn: G.current.getProxyFetch?.()
3990
3990
  }) === "REDIRECT") {
3991
- let e = await W.current.getAuthorizationCode?.();
3991
+ let e = await G.current.getAuthorizationCode?.();
3992
3992
  if (!e) throw Error("Authorization code not captured by headless provider");
3993
- await b(W.current, {
3993
+ await b(G.current, {
3994
3994
  serverUrl: t,
3995
3995
  authorizationCode: e,
3996
- fetchFn: W.current.getProxyFetch?.()
3996
+ fetchFn: G.current.getProxyFetch?.()
3997
3997
  });
3998
3998
  }
3999
3999
  return J("info", "OAuth flow completed, reconnecting..."), await e(n);
@@ -4006,7 +4006,7 @@ function pa(e) {
4006
4006
  return Y(a, i instanceof Error ? i : Error(String(i))) ? "auth_redirect" : "failed";
4007
4007
  }
4008
4008
  }, a = "failed";
4009
- J("debug", "Connecting via streamable HTTP"), a = await e("http"), (a === "success" || a === "failed" || a === "auth_redirect") && (G.current = !1), J("debug", `Connection sequence finished with status: ${a}`);
4009
+ J("debug", "Connecting via streamable HTTP"), a = await e("http"), (a === "success" || a === "failed" || a === "auth_redirect") && (K.current = !1), J("debug", `Connection sequence finished with status: ${a}`);
4010
4010
  }, [
4011
4011
  J,
4012
4012
  Y,
@@ -4019,10 +4019,10 @@ function pa(e) {
4019
4019
  N.uri,
4020
4020
  N.logo_uri,
4021
4021
  ae,
4022
- re,
4022
+ E,
4023
4023
  ie,
4024
4024
  O,
4025
- T,
4025
+ re,
4026
4026
  m,
4027
4027
  h,
4028
4028
  g,
@@ -4031,10 +4031,10 @@ function pa(e) {
4031
4031
  M,
4032
4032
  oe,
4033
4033
  x,
4034
- F,
4034
+ I,
4035
4035
  c,
4036
+ R,
4036
4037
  L,
4037
- I,
4038
4038
  et,
4039
4039
  tt,
4040
4040
  nt
@@ -4043,32 +4043,32 @@ function pa(e) {
4043
4043
  qe.current = at, Je.current = Y;
4044
4044
  }, [at, Y]);
4045
4045
  let ot = (0, A.useCallback)(() => {
4046
- q.current === "failed" ? (J("info", "Retry requested..."), qe.current?.()) : J("warn", `Retry called but state is not 'failed' (state: ${q.current}). Ignoring.`);
4046
+ We.current === "failed" ? (J("info", "Retry requested..."), qe.current?.()) : J("warn", `Retry called but state is not 'failed' (state: ${We.current}). Ignoring.`);
4047
4047
  }, [J]), st = (0, A.useCallback)(async () => {
4048
4048
  J("info", "Manual authentication requested...");
4049
- let e = q.current;
4049
+ let e = We.current;
4050
4050
  if (e === "failed") J("info", "Attempting to reconnect and authenticate via retry..."), ot();
4051
4051
  else if (e === "pending_auth") {
4052
4052
  J("info", "Proceeding with authentication from pending state...");
4053
4053
  try {
4054
- if (ta(W.current, "Auth Provider not available for manual auth"), ta(t, "Server URL is required for authentication"), a) {
4054
+ if (ta(G.current, "Auth Provider not available for manual auth"), ta(t, "Server URL is required for authentication"), a) {
4055
4055
  J("info", "Using provided authProvider for manual authentication");
4056
4056
  let e = new URL(t), n = e.origin + e.pathname.replace(/\/+$/, "");
4057
- await b(W.current, {
4057
+ await b(G.current, {
4058
4058
  serverUrl: n,
4059
- fetchFn: W.current.getProxyFetch?.()
4059
+ fetchFn: G.current.getProxyFetch?.()
4060
4060
  }), qe.current?.();
4061
4061
  return;
4062
4062
  }
4063
- J("info", `Cleared ${W.current.clearStorage?.() ?? 0} OAuth storage item(s) for fresh authentication`), z("authenticating");
4063
+ J("info", `Cleared ${G.current.clearStorage?.() ?? 0} OAuth storage item(s) for fresh authentication`), B("authenticating");
4064
4064
  let e = null, n = null, { provider: o, oauthProxyUrl: s } = sa({
4065
- effectiveOAuthUrl: I,
4065
+ effectiveOAuthUrl: L,
4066
4066
  storageKeyPrefix: i,
4067
4067
  oauthClientConfig: N,
4068
4068
  callbackUrl: r,
4069
4069
  preventAutoAuth: !1,
4070
4070
  useRedirectFlow: h,
4071
- gatewayUrl: F,
4071
+ gatewayUrl: I,
4072
4072
  oauthProxyUrl: c,
4073
4073
  onPopupWindow: (t, r, i) => {
4074
4074
  e = i;
@@ -4079,10 +4079,10 @@ function pa(e) {
4079
4079
  },
4080
4080
  proxyOAuthRequests: !0,
4081
4081
  staticClientInfo: ae,
4082
- clientMetadataUrl: re,
4082
+ clientMetadataUrl: E,
4083
4083
  scope: ie
4084
4084
  });
4085
- s && J("info", "Scoped OAuth proxy fetch enabled for manual auth"), W.current = o, J("info", "Triggering fresh OAuth authorization...");
4085
+ s && J("info", "Scoped OAuth proxy fetch enabled for manual auth"), G.current = o, J("info", "Triggering fresh OAuth authorization...");
4086
4086
  let l = new URL(t), u = l.origin + l.pathname.replace(/\/+$/, "");
4087
4087
  try {
4088
4088
  await b(o, {
@@ -4093,7 +4093,7 @@ function pa(e) {
4093
4093
  J("info", "OAuth flow initiated (popup/redirect):", e instanceof Error ? e.message : "Redirecting...");
4094
4094
  }
4095
4095
  let d = o.getLastAttemptedAuthUrl?.();
4096
- if (d && (H(d), J("info", "Updated auth URL for fallback:", d), !n)) try {
4096
+ if (d && (U(d), J("info", "Updated auth URL for fallback:", d), !n)) try {
4097
4097
  n = new URL(d).searchParams.get("state");
4098
4098
  } catch {}
4099
4099
  if (h) return;
@@ -4102,7 +4102,7 @@ function pa(e) {
4102
4102
  J("warn", "Could not derive tokens storage key; relying on callback listener.");
4103
4103
  return;
4104
4104
  }
4105
- We.current = !0;
4105
+ Ue.current = !0;
4106
4106
  let p;
4107
4107
  try {
4108
4108
  p = await Or({
@@ -4111,18 +4111,18 @@ function pa(e) {
4111
4111
  tokensKey: f
4112
4112
  });
4113
4113
  } finally {
4114
- We.current = !1;
4114
+ Ue.current = !1;
4115
4115
  }
4116
- if (!K.current) return;
4116
+ if (!q.current) return;
4117
4117
  switch (p.kind) {
4118
4118
  case "success":
4119
- J("info", "Authentication succeeded; reconnecting to MCP server..."), G.current = !1, qe.current?.();
4119
+ J("info", "Authentication succeeded; reconnecting to MCP server..."), K.current = !1, qe.current?.();
4120
4120
  break;
4121
4121
  case "cancelled":
4122
- J("warn", "Authentication popup was closed before completing. Returning to pending_auth."), z("pending_auth");
4122
+ J("warn", "Authentication popup was closed before completing. Returning to pending_auth."), B("pending_auth");
4123
4123
  break;
4124
4124
  case "timeout":
4125
- J("warn", "Authentication timed out waiting for the popup. Returning to pending_auth."), z("pending_auth");
4125
+ J("warn", "Authentication timed out waiting for the popup. Returning to pending_auth."), B("pending_auth");
4126
4126
  break;
4127
4127
  case "error":
4128
4128
  Y(`Authentication failed: ${p.error}`);
@@ -4130,19 +4130,19 @@ function pa(e) {
4130
4130
  default: break;
4131
4131
  }
4132
4132
  } catch (e) {
4133
- if (!K.current) return;
4134
- z("pending_auth"), J("error", `Manual authentication failed: ${e instanceof Error ? e.message : String(e)}`);
4133
+ if (!q.current) return;
4134
+ B("pending_auth"), J("error", `Manual authentication failed: ${e instanceof Error ? e.message : String(e)}`);
4135
4135
  }
4136
4136
  } else if (e === "authenticating") {
4137
4137
  J("warn", "Already attempting authentication. Check for blocked popups or wait for timeout.");
4138
- let e = W.current?.getLastAttemptedAuthUrl?.();
4139
- e && !Fe && (H(e), J("info", "Manual authentication URL retrieved:", e));
4138
+ let e = G.current?.getLastAttemptedAuthUrl?.();
4139
+ e && !Pe && (U(e), J("info", "Manual authentication URL retrieved:", e));
4140
4140
  } else J("info", `Client not in a state requiring manual authentication trigger (state: ${e}). If needed, try disconnecting and reconnecting.`);
4141
4141
  }, [
4142
4142
  J,
4143
4143
  ot,
4144
4144
  Y,
4145
- Fe,
4145
+ Pe,
4146
4146
  t,
4147
4147
  h,
4148
4148
  g,
@@ -4151,13 +4151,13 @@ function pa(e) {
4151
4151
  N.uri,
4152
4152
  N.logo_uri,
4153
4153
  ae,
4154
- re,
4154
+ E,
4155
4155
  ie,
4156
4156
  r,
4157
4157
  M,
4158
4158
  a
4159
4159
  ]), ct = (0, A.useCallback)(() => {
4160
- W.current?.clearStorage ? (J("info", `Cleared ${W.current.clearStorage()} item(s) from localStorage for ${t}.`), H(void 0), it()) : J("warn", "Auth provider not initialized, cannot clear storage.");
4160
+ G.current?.clearStorage ? (J("info", `Cleared ${G.current.clearStorage()} item(s) from localStorage for ${t}.`), U(void 0), it()) : J("warn", "Auth provider not initialized, cannot clear storage.");
4161
4161
  }, [
4162
4162
  t,
4163
4163
  J,
@@ -4166,21 +4166,21 @@ function pa(e) {
4166
4166
  (0, A.useEffect)(() => {
4167
4167
  if (typeof window > "u") return;
4168
4168
  let e = (e, t) => {
4169
- if (We.current) {
4169
+ if (Ue.current) {
4170
4170
  J("debug", `Ignoring auth callback via ${t}; manual popup flow owns this result.`);
4171
4171
  return;
4172
4172
  }
4173
- let n = W.current?.serverUrlHash;
4173
+ let n = G.current?.serverUrlHash;
4174
4174
  if (e?.serverUrlHash && n && e.serverUrlHash !== n) {
4175
4175
  J("debug", `Ignoring auth callback via ${t} for a different server.`);
4176
4176
  return;
4177
4177
  }
4178
- if (J("info", `Received auth callback via ${t}.`, e), He.current && clearTimeout(He.current), He.current = null, e?.success) J("info", "Authentication successful via popup. Reconnecting client..."), G.current && J("debug", "Connection attempt already in progress, resetting flag to allow reconnection."), G.current = !1, setTimeout(() => {
4179
- K.current && (J("debug", "Initiating reconnection after successful auth callback."), qe.current?.());
4178
+ if (J("info", `Received auth callback via ${t}.`, e), Ve.current && clearTimeout(Ve.current), Ve.current = null, e?.success) J("info", "Authentication successful via popup. Reconnecting client..."), K.current && J("debug", "Connection attempt already in progress, resetting flag to allow reconnection."), K.current = !1, setTimeout(() => {
4179
+ q.current && (J("debug", "Initiating reconnection after successful auth callback."), qe.current?.());
4180
4180
  }, 100);
4181
4181
  else {
4182
- if (q.current !== "authenticating" && q.current !== "pending_auth") {
4183
- J("debug", `Ignoring stale auth failure callback (state=${q.current}).`);
4182
+ if (We.current !== "authenticating" && We.current !== "pending_auth") {
4183
+ J("debug", `Ignoring stale auth failure callback (state=${We.current}).`);
4184
4184
  return;
4185
4185
  }
4186
4186
  Je.current?.(`Authentication failed in callback: ${e?.error || "Unknown reason."}`);
@@ -4204,33 +4204,33 @@ function pa(e) {
4204
4204
  } catch {}
4205
4205
  J("debug", "Auth callback BroadcastChannel listener removed.");
4206
4206
  }
4207
- He.current && clearTimeout(He.current);
4207
+ Ve.current && clearTimeout(Ve.current);
4208
4208
  };
4209
4209
  }, [J]), (0, A.useEffect)(() => {
4210
- if (K.current = !0, !n || !t) return J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag."), z("discovering"), () => {
4211
- K.current = !1;
4210
+ if (q.current = !0, !n || !t) return J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag."), B("discovering"), () => {
4211
+ q.current = !1;
4212
4212
  };
4213
- if (J("debug", "useMcp mounted, initiating connection."), Be.current = 0, a) W.current = a, J("debug", "Using externally provided authProvider");
4214
- else if (!W.current || W.current.serverUrl !== I) {
4213
+ if (J("debug", "useMcp mounted, initiating connection."), ze.current = 0, a) G.current = a, J("debug", "Using externally provided authProvider");
4214
+ else if (!G.current || G.current.serverUrl !== L) {
4215
4215
  let { provider: e, oauthProxyUrl: t } = sa({
4216
- effectiveOAuthUrl: I,
4216
+ effectiveOAuthUrl: L,
4217
4217
  storageKeyPrefix: i,
4218
4218
  oauthClientConfig: N,
4219
4219
  callbackUrl: r,
4220
4220
  preventAutoAuth: m,
4221
4221
  useRedirectFlow: h,
4222
- gatewayUrl: F,
4222
+ gatewayUrl: I,
4223
4223
  oauthProxyUrl: c,
4224
4224
  onPopupWindow: g,
4225
4225
  proxyOAuthRequests: !0,
4226
4226
  staticClientInfo: ae,
4227
- clientMetadataUrl: re,
4227
+ clientMetadataUrl: E,
4228
4228
  scope: ie
4229
4229
  });
4230
- W.current = e, t && J("debug", `OAuth proxy URL in effect: ${t}`), J("debug", `BrowserOAuthClientProvider initialized/updated with URL: ${I}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${F ? "enabled" : "disabled"}`);
4230
+ G.current = e, t && J("debug", `OAuth proxy URL in effect: ${t}`), J("debug", `BrowserOAuthClientProvider initialized/updated with URL: ${L}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${I ? "enabled" : "disabled"}`);
4231
4231
  }
4232
4232
  return at(), () => {
4233
- K.current = !1, J("debug", "useMcp unmounting, disconnecting."), it(!0);
4233
+ q.current = !1, J("debug", "useMcp unmounting, disconnecting."), it(!0);
4234
4234
  };
4235
4235
  }, [
4236
4236
  t,
@@ -4242,11 +4242,11 @@ function pa(e) {
4242
4242
  N.uri,
4243
4243
  N.logo_uri,
4244
4244
  ae,
4245
- re,
4245
+ E,
4246
4246
  ie,
4247
4247
  h,
4248
4248
  M,
4249
- I,
4249
+ L,
4250
4250
  s,
4251
4251
  a
4252
4252
  ]);
@@ -4255,38 +4255,38 @@ function pa(e) {
4255
4255
  lt.current = ot, ut.current = J;
4256
4256
  }, [ot, J]), (0, A.useEffect)(() => {
4257
4257
  let e = null;
4258
- if (R === "failed" && d && Be.current > 0) {
4259
- if (!Ue.current) {
4260
- Ue.current = !0;
4258
+ if (z === "failed" && d && ze.current > 0) {
4259
+ if (!He.current) {
4260
+ He.current = !0;
4261
4261
  let t = typeof d == "number" ? d : fa;
4262
4262
  ut.current("info", `Connection failed, auto-retrying in ${t}ms...`), e = setTimeout(() => {
4263
- Ue.current = !1, K.current && q.current === "failed" && lt.current();
4263
+ He.current = !1, q.current && We.current === "failed" && lt.current();
4264
4264
  }, t);
4265
4265
  }
4266
- } else R !== "failed" && (Ue.current = !1);
4266
+ } else z !== "failed" && (He.current = !1);
4267
4267
  return () => {
4268
- e && (clearTimeout(e), Ue.current = !1);
4268
+ e && (clearTimeout(e), He.current = !1);
4269
4269
  };
4270
- }, [R, d]);
4271
- let dt = (0, A.useCallback)(async () => q.current === "ready" ? xe?.icon ? xe.icon : ze.current ? (J("debug", "Waiting for icon to finish loading..."), await ze.current) : (J("debug", "No icon available and no loading in progress"), null) : (J("warn", "Cannot ensure icon loaded - not connected"), null), [xe, J]);
4270
+ }, [z, d]);
4271
+ let dt = (0, A.useCallback)(async () => We.current === "ready" ? ye?.icon ? ye.icon : Re.current ? (J("debug", "Waiting for icon to finish loading..."), await Re.current) : (J("debug", "No icon available and no loading in progress"), null) : (J("warn", "Cannot ensure icon loaded - not connected"), null), [ye, J]);
4272
4272
  return {
4273
- state: R,
4274
- name: xe?.name || t || "",
4275
- tools: pe,
4276
- resources: he,
4277
- resourceTemplates: _e,
4278
- prompts: ye,
4279
- serverInfo: xe,
4280
- capabilities: Ce,
4281
- protocolEra: we,
4282
- protocolVersion: Ee,
4283
- instructions: Oe,
4284
- extensions: Ae,
4285
- error: je,
4286
- log: Ne,
4287
- authUrl: Fe,
4288
- authTokens: Ie,
4289
- client: U.current,
4273
+ state: z,
4274
+ name: ye?.name || t || "",
4275
+ tools: fe,
4276
+ resources: pe,
4277
+ resourceTemplates: he,
4278
+ prompts: _e,
4279
+ serverInfo: ye,
4280
+ capabilities: xe,
4281
+ protocolEra: Ce,
4282
+ protocolVersion: Te,
4283
+ instructions: Ee,
4284
+ extensions: Oe,
4285
+ error: Ae,
4286
+ log: Me,
4287
+ authUrl: Pe,
4288
+ authTokens: Fe,
4289
+ client: W.current,
4290
4290
  ...rt,
4291
4291
  retry: ot,
4292
4292
  disconnect: it,
@@ -4622,9 +4622,9 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4622
4622
  t.connectionMode,
4623
4623
  t.proxyConfig,
4624
4624
  l
4625
- ]), ne = (0, A.useCallback)((t) => u(e, t), [e, u]), w = (0, A.useCallback)(() => d(e), [e, d]), T = (0, A.useRef)(c), E = (0, A.useRef)(null);
4625
+ ]), ne = (0, A.useCallback)((t) => u(e, t), [e, u]), w = (0, A.useCallback)(() => d(e), [e, d]), re = (0, A.useRef)(c), T = (0, A.useRef)(null);
4626
4626
  return (0, A.useEffect)(() => {
4627
- T.current = c;
4627
+ re.current = c;
4628
4628
  }, [c]), (0, A.useEffect)(() => {
4629
4629
  let n = {
4630
4630
  ...Ea(t),
@@ -4646,8 +4646,8 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4646
4646
  setHeaders: C,
4647
4647
  setDisplayName: ne,
4648
4648
  reconnect: w
4649
- }, r = E.current;
4650
- !r || !ja(r, n) ? (E.current = n, T.current(n)) : Q.debug(`[McpServerWrapper ${e}] No meaningful changes detected, skipping onUpdate`);
4649
+ }, r = T.current;
4650
+ !r || !ja(r, n) ? (T.current = n, re.current(n)) : Q.debug(`[McpServerWrapper ${e}] No meaningful changes detected, skipping onUpdate`);
4651
4651
  }, [
4652
4652
  e,
4653
4653
  h,
@@ -4679,19 +4679,19 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4679
4679
  (0, A.useEffect)(() => {
4680
4680
  S.current = _;
4681
4681
  }, [_]);
4682
- let C = (0, A.useRef)({}), [ne, w] = (0, A.useState)(void 0), [T, E] = (0, A.useState)(!1);
4682
+ let C = (0, A.useRef)({}), [ne, w] = (0, A.useState)(void 0), [re, T] = (0, A.useState)(!1);
4683
4683
  (0, A.useEffect)(() => {
4684
4684
  if (!l || typeof window > "u") {
4685
- w(void 0), E(!0);
4685
+ w(void 0), T(!0);
4686
4686
  return;
4687
4687
  }
4688
4688
  Promise.resolve().then(() => (wr(), hr)).then((e) => {
4689
- Q.debug("[McpClientProvider] RPC logger loaded"), w(() => e.wrapTransportForLogging), E(!0);
4689
+ Q.debug("[McpClientProvider] RPC logger loaded"), w(() => e.wrapTransportForLogging), T(!0);
4690
4690
  }).catch((e) => {
4691
- Q.error("[McpClientProvider] Failed to load RPC logger:", e), w(void 0), E(!0);
4691
+ Q.error("[McpClientProvider] Failed to load RPC logger:", e), w(void 0), T(!0);
4692
4692
  });
4693
4693
  }, [l]), (0, A.useEffect)(() => {
4694
- if (!T) {
4694
+ if (!re) {
4695
4695
  Q.debug("[McpClientProvider] Waiting for RPC logging to be ready before loading servers");
4696
4696
  return;
4697
4697
  }
@@ -4733,7 +4733,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4733
4733
  }, [
4734
4734
  c,
4735
4735
  t,
4736
- T
4736
+ re
4737
4737
  ]), (0, A.useEffect)(() => {
4738
4738
  !c || !y || (async () => {
4739
4739
  try {
@@ -4748,7 +4748,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4748
4748
  c,
4749
4749
  y
4750
4750
  ]);
4751
- let re = (0, A.useCallback)((e) => {
4751
+ let E = (0, A.useCallback)((e) => {
4752
4752
  Q.debug(`[McpClientProvider] handleServerUpdate called for server ${e.id}`, {
4753
4753
  toolCount: e.tools.length,
4754
4754
  state: e.state
@@ -4863,7 +4863,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4863
4863
  D,
4864
4864
  k,
4865
4865
  y
4866
- ]), { capabilities: j, ...M } = s || {}, N = (0, A.useMemo)(() => Object.keys(M).length ? M : void 0, [s]), ce = (0, A.useMemo)(() => h.map((e) => {
4866
+ ]), { capabilities: j, ...M } = s || {}, N = (0, A.useMemo)(() => Object.keys(M).length ? M : void 0, [s]), P = (0, A.useMemo)(() => h.map((e) => {
4867
4867
  let t = o ? {
4868
4868
  ...o,
4869
4869
  ...e.options
@@ -4885,8 +4885,8 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4885
4885
  h,
4886
4886
  j,
4887
4887
  o
4888
- ]), P = typeof window < "u" && /\/oauth\/callback\/?$/.test(window.location.pathname);
4889
- return /* @__PURE__ */ A.createElement(Aa.Provider, { value: se }, e, !P && ce.map((e) => /* @__PURE__ */ A.createElement(Ma, {
4888
+ ]), ce = typeof window < "u" && /\/oauth\/callback\/?$/.test(window.location.pathname);
4889
+ return /* @__PURE__ */ A.createElement(Aa.Provider, { value: se }, e, !ce && P.map((e) => /* @__PURE__ */ A.createElement(Ma, {
4890
4890
  key: `${e.id}-v${ee[e.id] ?? 0}`,
4891
4891
  id: e.id,
4892
4892
  options: e.options,
@@ -4896,7 +4896,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4896
4896
  defaultAutoProxyFallback: a,
4897
4897
  clientInfo: N,
4898
4898
  cachedMetadata: C.current[e.id],
4899
- onUpdate: re,
4899
+ onUpdate: E,
4900
4900
  onUpdateConfig: D,
4901
4901
  onUpdateDisplayName: (e, t) => oe(e, { name: t }),
4902
4902
  onReconnect: O,
@@ -5028,8 +5028,8 @@ function Ua(e) {
5028
5028
  let t = "<script>window.__SANDBOX_SEARCH__ = " + JSON.stringify(e).replace(/</g, "\\u003c") + ";<\/script>";
5029
5029
  return Ha.replace("<body>", "<body>" + t);
5030
5030
  }
5031
- var Wa = "fixed inset-0 z-[100] w-full h-full min-h-0 bg-background flex flex-col [&:fullscreen]:h-full [&:fullscreen]:w-full [&:fullscreen]:bg-background", Ga = [
5032
- "fixed top-4 left-1/2 -translate-x-1/2 z-[100]",
5031
+ var Wa = "fixed inset-0 z-[200] w-full h-full min-h-0 bg-background flex flex-col [&:fullscreen]:h-full [&:fullscreen]:w-full [&:fullscreen]:bg-background", Ga = [
5032
+ "fixed top-4 left-1/2 -translate-x-1/2 z-[200]",
5033
5033
  "rounded-3xl w-full min-w-[300px] h-[400px]",
5034
5034
  "shadow-2xl border overflow-hidden",
5035
5035
  "bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",
@@ -5057,7 +5057,8 @@ function Ya({ displayMode: e, setDisplayMode: t }) {
5057
5057
  }
5058
5058
  var Xa = {
5059
5059
  PIP_MAX_WIDTH: 700,
5060
- DEFAULT_HEIGHT: 400
5060
+ DEFAULT_HEIGHT: 400,
5061
+ FULLSCREEN_HEADER_HEIGHT: 50
5061
5062
  };
5062
5063
  function Za(e) {
5063
5064
  let t = e?.ui;
@@ -5080,7 +5081,20 @@ var eo = {
5080
5081
  updateModelContext: { text: {} },
5081
5082
  message: { text: {} }
5082
5083
  };
5083
- function io(e) {
5084
+ function io() {
5085
+ return /* @__PURE__ */ A.createElement("svg", {
5086
+ width: "14",
5087
+ height: "14",
5088
+ viewBox: "0 0 24 24",
5089
+ fill: "none",
5090
+ stroke: "currentColor",
5091
+ strokeWidth: "2",
5092
+ strokeLinecap: "round",
5093
+ strokeLinejoin: "round",
5094
+ "aria-hidden": !0
5095
+ }, /* @__PURE__ */ A.createElement("path", { d: "M18 6 6 18" }), /* @__PURE__ */ A.createElement("path", { d: "m6 6 12 12" }));
5096
+ }
5097
+ function ao(e) {
5084
5098
  return new Promise((t) => {
5085
5099
  let n = (r) => {
5086
5100
  r.source === e.contentWindow && r.data?.method === no && (window.removeEventListener("message", n), t());
@@ -5088,7 +5102,7 @@ function io(e) {
5088
5102
  window.addEventListener("message", n);
5089
5103
  });
5090
5104
  }
5091
- function ao(e) {
5105
+ function oo(e) {
5092
5106
  let t = e.oninitialized;
5093
5107
  return new Promise((n) => {
5094
5108
  e.oninitialized = (...r) => {
@@ -5096,71 +5110,76 @@ function ao(e) {
5096
5110
  };
5097
5111
  });
5098
5112
  }
5099
- function oo(e, t) {
5113
+ function so(e, t) {
5100
5114
  let n = Ia(t);
5101
5115
  return Object.keys(n).length > 0 ? {
5102
5116
  ...typeof e == "object" && e ? e : {},
5103
5117
  structuredContent: n
5104
5118
  } : e ?? null;
5105
5119
  }
5106
- function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInput: i, toolOutput: a, partialToolInput: o, customProps: s, cancelled: c, hostInfo: l = eo, hostContext: u, hostCapabilities: d, cspMode: f = "widget-declared", displayMode: p, onDisplayModeChange: m, inlineMaxWidth: h = 768, chromeless: g, onMessage: _, onModelContextUpdate: v, onLog: ee, onReady: te, onLifecycleChange: y, onError: b, onCspViolation: x, onResourceResolved: S, wrapTransport: C, toolCallTimeout: ne = to, mockOpenAiFileApis: w = !1, className: T, testId: E = "mcp-app-frame", invoking: re, invoked: ie }) {
5107
- let ae = (0, A.useRef)(null), D = (0, A.useRef)(null), O = (0, A.useRef)(null), oe = (0, A.useRef)(t.kind === "live" ? t.connection : null), [k, se] = (0, A.useState)(null), [j, M] = (0, A.useState)(null), [N, ce] = (0, A.useState)(null), [P, le] = (0, A.useState)(0), [ue, de] = (0, A.useState)(!0), [F, fe] = (0, A.useState)(Xa.DEFAULT_HEIGHT), [I, L] = (0, A.useState)("inline"), R = p ?? I, z = (0, A.useRef)(u);
5108
- z.current = u;
5109
- let pe = (0, A.useRef)(_);
5110
- pe.current = _;
5111
- let me = (0, A.useRef)(i);
5112
- me.current = i;
5113
- let he = (0, A.useRef)(o);
5114
- he.current = o;
5115
- let ge = (0, A.useRef)(a);
5116
- ge.current = a;
5117
- let _e = (0, A.useRef)(s);
5118
- _e.current = s;
5119
- let ve = (0, A.useRef)(S);
5120
- ve.current = S;
5121
- let ye = (0, A.useRef)(v);
5122
- ye.current = v;
5123
- let be = (0, A.useRef)(ee);
5124
- be.current = ee;
5125
- let xe = (0, A.useRef)(b);
5126
- xe.current = b;
5127
- let Se = (0, A.useRef)(x);
5128
- Se.current = x;
5129
- let Ce = (0, A.useRef)(te);
5130
- Ce.current = te;
5131
- let B = (0, A.useRef)(y);
5132
- B.current = y;
5133
- let we = (0, A.useRef)(n);
5134
- we.current = n;
5135
- let Te = (0, A.useRef)(f);
5136
- Te.current = f;
5137
- let Ee = (0, A.useRef)(w);
5138
- Ee.current = w;
5139
- let De = (0, A.useCallback)((e) => {
5140
- let t = we.current;
5120
+ function co({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInput: i, toolOutput: a, partialToolInput: o, customProps: s, cancelled: c, hostInfo: l = eo, hostContext: u, hostCapabilities: d, cspMode: f = "widget-declared", displayMode: p, onDisplayModeChange: m, inlineMaxWidth: h = 768, chromeless: g, onMessage: _, onModelContextUpdate: v, onLog: ee, onReady: te, onLifecycleChange: y, onError: b, onCspViolation: x, onResourceResolved: S, wrapTransport: C, toolCallTimeout: ne = to, mockOpenAiFileApis: w = !1, onInlineHeightChange: re, fullscreenHeader: T, renderFullscreenClose: E, className: ie, testId: ae = "mcp-app-frame", invoking: D, invoked: O }) {
5121
+ let oe = (0, A.useRef)(null), k = (0, A.useRef)(null), se = (0, A.useRef)(null), j = (0, A.useRef)(t.kind === "live" ? t.connection : null), [M, N] = (0, A.useState)(null), [P, ce] = (0, A.useState)(null), [le, ue] = (0, A.useState)(null), [F, I] = (0, A.useState)(0), [de, L] = (0, A.useState)(!0), [R, z] = (0, A.useState)(Xa.DEFAULT_HEIGHT), [B, fe] = (0, A.useState)("inline"), V = p ?? B, pe = (0, A.useMemo)(() => !u || u.displayMode === V ? u : {
5122
+ ...u,
5123
+ displayMode: V
5124
+ }, [u, V]), me = (0, A.useRef)(pe);
5125
+ me.current = pe;
5126
+ let he = (0, A.useRef)(_);
5127
+ he.current = _;
5128
+ let ge = (0, A.useRef)(i);
5129
+ ge.current = i;
5130
+ let _e = (0, A.useRef)(o);
5131
+ _e.current = o;
5132
+ let ve = (0, A.useRef)(a);
5133
+ ve.current = a;
5134
+ let ye = (0, A.useRef)(s);
5135
+ ye.current = s;
5136
+ let be = (0, A.useRef)(S);
5137
+ be.current = S;
5138
+ let xe = (0, A.useRef)(v);
5139
+ xe.current = v;
5140
+ let Se = (0, A.useRef)(ee);
5141
+ Se.current = ee;
5142
+ let Ce = (0, A.useRef)(b);
5143
+ Ce.current = b;
5144
+ let we = (0, A.useRef)(x);
5145
+ we.current = x;
5146
+ let Te = (0, A.useRef)(te);
5147
+ Te.current = te;
5148
+ let H = (0, A.useRef)(y);
5149
+ H.current = y;
5150
+ let Ee = (0, A.useRef)(re);
5151
+ Ee.current = re;
5152
+ let De = (0, A.useRef)(n);
5153
+ De.current = n;
5154
+ let Oe = (0, A.useRef)(f);
5155
+ Oe.current = f;
5156
+ let ke = (0, A.useRef)(w);
5157
+ ke.current = w;
5158
+ let Ae = (0, A.useCallback)((e) => {
5159
+ let t = De.current;
5141
5160
  return t ? typeof t == "function" ? t(e) : t : Va({
5142
- cspMode: Te.current,
5161
+ cspMode: Oe.current,
5143
5162
  permissions: e.permissions,
5144
5163
  widgetCsp: e.declaredCsp
5145
5164
  });
5146
- }, []), { handleDisplayModeChange: Oe, fullscreenShellClassName: ke, pipShellClassName: Ae, isFullscreen: V, isPip: je } = Ya({
5147
- containerRef: O,
5148
- displayMode: R,
5165
+ }, []), { handleDisplayModeChange: je, fullscreenShellClassName: Me, pipShellClassName: Ne, isFullscreen: Pe, isPip: U } = Ya({
5166
+ containerRef: se,
5167
+ displayMode: V,
5149
5168
  setDisplayMode: (0, A.useCallback)((e) => {
5150
- m ? m(e) : L(e);
5169
+ m ? m(e) : fe(e);
5151
5170
  }, [m])
5152
- }), Me = (0, A.useRef)(Oe);
5153
- Me.current = Oe;
5154
- let Ne = (0, A.useRef)(R);
5155
- Ne.current = R;
5156
- let Pe = t.kind === "live" ? t.resourceUri : void 0, Fe = t.kind === "preloaded" ? t.html : void 0;
5157
- t.kind === "live" && (oe.current = t.connection), (0, A.useEffect)(() => {
5171
+ }), Fe = (0, A.useRef)(je);
5172
+ Fe.current = je;
5173
+ let Ie = (0, A.useRef)(V);
5174
+ Ie.current = V;
5175
+ let W = t.kind === "live" ? t.resourceUri : void 0, Le = t.kind === "preloaded" ? t.html : void 0;
5176
+ t.kind === "live" && (j.current = t.connection), (0, A.useEffect)(() => {
5158
5177
  let e = !1;
5159
- B.current?.({ status: "resolving" });
5178
+ H.current?.({ status: "resolving" });
5160
5179
  let n = (e) => {
5161
- se(e), B.current?.({ status: "sandbox-loading" });
5162
- let t = De(e);
5163
- M((e) => e?.href === t.href ? e : t), ve.current?.(e);
5180
+ N(e), H.current?.({ status: "sandbox-loading" });
5181
+ let t = Ae(e);
5182
+ ce((e) => e?.href === t.href ? e : t), be.current?.(e);
5164
5183
  };
5165
5184
  if (t.kind === "preloaded") {
5166
5185
  n({
@@ -5176,7 +5195,7 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5176
5195
  return;
5177
5196
  }
5178
5197
  let { connection: r, resourceUri: i } = t;
5179
- return oe.current = r, (async () => {
5198
+ return j.current = r, (async () => {
5180
5199
  try {
5181
5200
  let t = await r.readResource(i);
5182
5201
  if (e) return;
@@ -5188,7 +5207,7 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5188
5207
  });
5189
5208
  if (!o.mimeTypeValid) {
5190
5209
  let e = o.mimeTypeWarning || "Invalid MIME type - SEP-1865 requires \"text/html;profile=mcp-app\"";
5191
- ce(e), B.current?.({
5210
+ ue(e), H.current?.({
5192
5211
  status: "error",
5193
5212
  error: e
5194
5213
  });
@@ -5197,7 +5216,7 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5197
5216
  n(o);
5198
5217
  } catch (t) {
5199
5218
  if (e) return;
5200
- ce(t instanceof Error ? t.message : "Failed to prepare view"), B.current?.({
5219
+ ue(t instanceof Error ? t.message : "Failed to prepare view"), H.current?.({
5201
5220
  status: "error",
5202
5221
  error: t instanceof Error ? t.message : "Failed to prepare view"
5203
5222
  });
@@ -5207,30 +5226,30 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5207
5226
  };
5208
5227
  }, [
5209
5228
  t.kind,
5210
- Pe,
5211
- Fe,
5229
+ W,
5230
+ Le,
5212
5231
  f,
5213
- De
5232
+ Ae
5214
5233
  ]), (0, A.useEffect)(() => {
5215
- let e = j;
5234
+ let e = P;
5216
5235
  return () => {
5217
5236
  e?.protocol === "blob:" && URL.revokeObjectURL(e.href);
5218
5237
  };
5219
- }, [j]);
5220
- let H = j?.protocol === "blob:", Ie = !j || H ? null : (() => {
5238
+ }, [P]);
5239
+ let G = P?.protocol === "blob:", Re = !P || G ? null : (() => {
5221
5240
  try {
5222
- return j.origin;
5241
+ return P.origin;
5223
5242
  } catch {
5224
5243
  return null;
5225
5244
  }
5226
5245
  })();
5227
5246
  (0, A.useEffect)(() => {
5228
- if (!Ie && !H) return;
5247
+ if (!Re && !G) return;
5229
5248
  let e = (e) => {
5230
- let t = ae.current;
5231
- if (t?.contentWindow && e.source === t.contentWindow && !(!H && e.origin !== Ie && Ie !== "*")) {
5249
+ let t = oe.current;
5250
+ if (t?.contentWindow && e.source === t.contentWindow && !(!G && e.origin !== Re && Re !== "*")) {
5232
5251
  if (e.data?.type === "mcp-apps:csp-violation") {
5233
- Se.current?.({
5252
+ we.current?.({
5234
5253
  directive: e.data.directive,
5235
5254
  effectiveDirective: e.data.effectiveDirective,
5236
5255
  blockedUri: e.data.blockedUri,
@@ -5242,33 +5261,33 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5242
5261
  });
5243
5262
  return;
5244
5263
  }
5245
- e.data?.type === "iframe-console-log" && be.current && be.current({
5264
+ e.data?.type === "iframe-console-log" && Se.current && Se.current({
5246
5265
  level: e.data.level ?? "log",
5247
5266
  data: e.data.args
5248
5267
  });
5249
5268
  }
5250
5269
  };
5251
5270
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
5252
- }, [Ie, H]), (0, A.useEffect)(() => {
5253
- if (!k || !j) return;
5254
- let t = ae.current;
5271
+ }, [Re, G]), (0, A.useEffect)(() => {
5272
+ if (!M || !P) return;
5273
+ let t = oe.current;
5255
5274
  if (!t) return;
5256
5275
  let n = !1, r = null;
5257
5276
  return (async () => {
5258
5277
  try {
5259
- B.current?.({ status: "connecting" }), t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
5260
- let i = tr(k.permissions);
5278
+ H.current?.({ status: "connecting" }), t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
5279
+ let i = tr(M.permissions);
5261
5280
  i && t.setAttribute("allow", i);
5262
- let a = io(t);
5263
- if (t.src = j.href, await a, n) return;
5281
+ let a = ao(t);
5282
+ if (t.src = P.href, await a, n) return;
5264
5283
  r = new rr(null, l, {
5265
5284
  ...d ?? ro,
5266
5285
  sandbox: {
5267
- csp: f === "permissive" ? void 0 : k.csp,
5268
- permissions: k.permissions
5286
+ csp: f === "permissive" ? void 0 : M.csp,
5287
+ permissions: M.permissions
5269
5288
  }
5270
- }, { hostContext: z.current }), r.onmessage = async ({ content: e }) => (e.length > 0 && pe.current && pe.current(e), {}), r.onopenlink = async ({ url: e }) => (e && window.open(e, "_blank", "noopener,noreferrer"), {}), r.oncalltool = (async ({ name: e, arguments: t }) => {
5271
- let n = oe.current;
5289
+ }, { hostContext: me.current }), r.onmessage = async ({ content: e }) => (e.length > 0 && he.current && he.current(e), {}), r.onopenlink = async ({ url: e }) => (e && window.open(e, "_blank", "noopener,noreferrer"), {}), r.oncalltool = (async ({ name: e, arguments: t }) => {
5290
+ let n = j.current;
5272
5291
  if (!n) throw Error("Server connection not available");
5273
5292
  try {
5274
5293
  return await n.callTool(e, t || {}, {
@@ -5279,51 +5298,51 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5279
5298
  throw r?.sendToolCancelled({ reason: e instanceof Error ? e.message : String(e) }), e;
5280
5299
  }
5281
5300
  }), r.onreadresource = (async ({ uri: e }) => {
5282
- let t = oe.current;
5301
+ let t = j.current;
5283
5302
  if (!t) throw Error("Server connection not available");
5284
5303
  return await t.readResource(e);
5285
5304
  }), r.onlistresources = (async () => {
5286
- let e = oe.current;
5305
+ let e = j.current;
5287
5306
  if (!e) throw Error("Server connection not available");
5288
5307
  return { resources: [...e.resources ?? []] };
5289
5308
  }), r.onrequestdisplaymode = async ({ mode: e }) => {
5290
- let t = e ?? "inline", n = (z.current?.availableDisplayModes ?? [
5309
+ let t = e ?? "inline", n = (me.current?.availableDisplayModes ?? [
5291
5310
  "inline",
5292
5311
  "pip",
5293
5312
  "fullscreen"
5294
- ]).includes(t) ? t : Ne.current;
5295
- return await Me.current(n), { mode: n };
5296
- }, r.onupdatemodelcontext = async ({ content: e, structuredContent: t }) => (ye.current?.({
5313
+ ]).includes(t) ? t : Ie.current;
5314
+ return await Fe.current(n), { mode: n };
5315
+ }, r.onupdatemodelcontext = async ({ content: e, structuredContent: t }) => (xe.current?.({
5297
5316
  content: e,
5298
5317
  structuredContent: t
5299
- }), {}), r.onloggingmessage = async ({ level: e, data: t }) => (be.current?.({
5318
+ }), {}), r.onloggingmessage = async ({ level: e, data: t }) => (Se.current?.({
5300
5319
  level: e,
5301
5320
  data: t
5302
5321
  }), {}), r.onsizechange = async ({ height: e }) => {
5303
- Ne.current === "inline" && e !== void 0 && fe(e);
5322
+ Ie.current === "inline" && e !== void 0 && (z(e), Ee.current?.(e));
5304
5323
  };
5305
- let o = ao(r), s = new $n(t.contentWindow, t.contentWindow);
5324
+ let o = oo(r), s = new $n(t.contentWindow, t.contentWindow);
5306
5325
  if (C && (s = C(s, e)), await r.connect(s), n || (await r.sendSandboxResourceReady({
5307
- html: Ee.current ? Ra(k.html) : k.html,
5308
- csp: k.csp,
5309
- permissions: k.permissions
5326
+ html: ke.current ? Ra(M.html) : M.html,
5327
+ csp: M.csp,
5328
+ permissions: M.permissions
5310
5329
  }), await o, n)) return;
5311
- D.current = r, le((e) => e + 1), B.current?.({ status: "initialized" });
5312
- let c = he.current;
5330
+ k.current = r, I((e) => e + 1), H.current?.({ status: "initialized" });
5331
+ let c = _e.current;
5313
5332
  if (c) r.sendToolInputPartial({ arguments: c });
5314
5333
  else {
5315
5334
  let e = {
5316
- ...me.current,
5317
- ...Ia(_e.current)
5335
+ ...ge.current,
5336
+ ...Ia(ye.current)
5318
5337
  };
5319
5338
  r.sendToolInput({ arguments: e });
5320
5339
  }
5321
- let u = oo(ge.current, _e.current);
5322
- u && r.sendToolResult(u), B.current?.({ status: "ready" });
5340
+ let u = so(ve.current, ye.current);
5341
+ u && r.sendToolResult(u), H.current?.({ status: "ready" });
5323
5342
  } catch (e) {
5324
5343
  if (!n) {
5325
5344
  let t = e instanceof Error ? e.message : "Failed to connect view";
5326
- ce(t), xe.current?.(t), B.current?.({
5345
+ ue(t), Ce.current?.(t), H.current?.({
5327
5346
  status: "error",
5328
5347
  error: t
5329
5348
  });
@@ -5332,17 +5351,17 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5332
5351
  })(), () => {
5333
5352
  n = !0;
5334
5353
  let e = r;
5335
- D.current = null, e && (B.current?.({ status: "tearing-down" }), (async () => {
5354
+ k.current = null, e && (H.current?.({ status: "tearing-down" }), (async () => {
5336
5355
  try {
5337
5356
  await Promise.race([e.teardownResource({}), new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("teardown timeout")), 2e3))]);
5338
5357
  } catch {} finally {
5339
- e.close().catch(() => {}), B.current?.({ status: "closed" });
5358
+ e.close().catch(() => {}), H.current?.({ status: "closed" });
5340
5359
  }
5341
5360
  })());
5342
5361
  };
5343
5362
  }, [
5344
- k,
5345
- j,
5363
+ M,
5364
+ P,
5346
5365
  l,
5347
5366
  d,
5348
5367
  f,
@@ -5351,82 +5370,113 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5351
5370
  ne,
5352
5371
  w
5353
5372
  ]), (0, A.useEffect)(() => {
5354
- let e = D.current;
5355
- !e || P === 0 || !u || e.setHostContext(u);
5356
- }, [u, P]), (0, A.useEffect)(() => {
5357
- let e = D.current;
5358
- !e || P === 0 || !o || e.sendToolInputPartial({ arguments: o });
5359
- }, [P, o]), (0, A.useEffect)(() => {
5360
- let e = D.current;
5361
- if (!e || P === 0 || o) return;
5373
+ let e = k.current;
5374
+ !e || F === 0 || !pe || e.setHostContext(pe);
5375
+ }, [pe, F]), (0, A.useEffect)(() => {
5376
+ let e = k.current;
5377
+ !e || F === 0 || !o || e.sendToolInputPartial({ arguments: o });
5378
+ }, [F, o]), (0, A.useEffect)(() => {
5379
+ let e = k.current;
5380
+ if (!e || F === 0 || o) return;
5362
5381
  let t = {
5363
5382
  ...i,
5364
5383
  ...Ia(s)
5365
5384
  };
5366
5385
  e.sendToolInput({ arguments: t });
5367
5386
  }, [
5368
- P,
5387
+ F,
5369
5388
  i,
5370
5389
  o,
5371
5390
  s
5372
5391
  ]), (0, A.useEffect)(() => {
5373
- let e = D.current;
5374
- if (!e || P === 0) return;
5375
- let t = oo(a, s);
5392
+ let e = k.current;
5393
+ if (!e || F === 0) return;
5394
+ let t = so(a, s);
5376
5395
  t && e.sendToolResult(t);
5377
5396
  }, [
5378
- P,
5397
+ F,
5379
5398
  a,
5380
5399
  s
5381
5400
  ]), (0, A.useEffect)(() => {
5382
- let e = D.current;
5383
- !e || P === 0 || !c || e.sendToolCancelled({ reason: "Cancelled by user" });
5384
- }, [c, P]);
5385
- let Le = (0, A.useRef)(!1);
5386
- if ((0, A.useEffect)(() => {
5387
- Le.current || P === 0 || (Le.current = !0, Ce.current?.());
5388
- }, [P]), (0, A.useEffect)(() => {
5389
- if (P === 0 || !ue) return;
5390
- let e = setTimeout(() => de(!1), 300);
5401
+ let e = k.current;
5402
+ !e || F === 0 || !c || e.sendToolCancelled({ reason: "Cancelled by user" });
5403
+ }, [c, F]);
5404
+ let K = (0, A.useRef)(!1);
5405
+ (0, A.useEffect)(() => {
5406
+ K.current || F === 0 || (K.current = !0, Te.current?.());
5407
+ }, [F]), (0, A.useEffect)(() => {
5408
+ if (F === 0 || !de) return;
5409
+ let e = setTimeout(() => L(!1), 300);
5391
5410
  return () => clearTimeout(e);
5392
- }, [P, ue]), N) return /* @__PURE__ */ A.createElement("div", { className: T }, /* @__PURE__ */ A.createElement("div", { className: "border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4" }, /* @__PURE__ */ A.createElement("p", { className: "text-sm text-red-600 dark:text-red-400" }, "Failed to load view: ", N)));
5393
- if (!k) return /* @__PURE__ */ A.createElement("div", { className: T }, /* @__PURE__ */ A.createElement("div", { className: "flex items-center justify-center w-full h-[200px]" }, /* @__PURE__ */ A.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading view…")));
5394
- let U = ke ?? Ae ?? "flex group flex-1 items-center justify-center", Re = {
5395
- height: V || je ? "100%" : `${F}px`,
5411
+ }, [F, de]);
5412
+ let q = M !== null && M.prefersBorder && V !== "fullscreen";
5413
+ if (le) return /* @__PURE__ */ A.createElement("div", { className: ie }, /* @__PURE__ */ A.createElement("div", { className: "border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4" }, /* @__PURE__ */ A.createElement("p", { className: "text-sm text-red-600 dark:text-red-400" }, "Failed to load view: ", le)));
5414
+ if (!M) return /* @__PURE__ */ A.createElement("div", { className: ie }, /* @__PURE__ */ A.createElement("div", { className: "flex items-center justify-center w-full h-[200px]" }, /* @__PURE__ */ A.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading view…")));
5415
+ let ze = Me ?? Ne ?? "flex group flex-1 items-center justify-center", Be = {
5416
+ height: Pe || U ? "100%" : `${R}px`,
5396
5417
  width: "100%",
5397
- maxWidth: R === "inline" ? `${h}px` : "100%",
5398
- transition: V || je ? void 0 : "height 300ms ease-out"
5399
- }, W = /* @__PURE__ */ A.createElement("div", {
5400
- ref: O,
5401
- className: U,
5402
- style: je ? {
5418
+ maxWidth: V === "inline" ? `${h}px` : "100%",
5419
+ transition: Pe || U ? void 0 : "height 300ms ease-out"
5420
+ }, Ve = /* @__PURE__ */ A.createElement("div", {
5421
+ ref: se,
5422
+ className: Pe ? `${ze} flex flex-col` : ze,
5423
+ style: U ? {
5403
5424
  height: Xa.DEFAULT_HEIGHT,
5404
5425
  maxWidth: Xa.PIP_MAX_WIDTH,
5405
5426
  zIndex: 100
5406
- } : V ? { zIndex: 100 } : void 0
5407
- }, (V || je) && /* @__PURE__ */ A.createElement("button", {
5427
+ } : Pe ? { zIndex: 100 } : void 0
5428
+ }, Pe && /* @__PURE__ */ A.createElement("header", {
5429
+ className: "grid shrink-0 items-center border-b border-zinc-200 bg-background px-3 dark:border-zinc-700",
5430
+ style: {
5431
+ height: Xa.FULLSCREEN_HEADER_HEIGHT,
5432
+ gridTemplateColumns: "auto 1fr auto"
5433
+ }
5434
+ }, E ? E({
5435
+ onClick: () => void je("inline"),
5436
+ "data-testid": "debugger-exit-fullscreen-button",
5437
+ "aria-label": "Exit fullscreen"
5438
+ }) : /* @__PURE__ */ A.createElement("button", {
5439
+ type: "button",
5440
+ "data-testid": "debugger-exit-fullscreen-button",
5441
+ "aria-label": "Exit fullscreen",
5442
+ className: "flex size-8 cursor-pointer items-center justify-center rounded-full border border-zinc-200 bg-background text-foreground shadow-sm hover:bg-muted dark:border-zinc-700",
5443
+ onClick: () => void je("inline")
5444
+ }, /* @__PURE__ */ A.createElement(io, null)), /* @__PURE__ */ A.createElement("div", { className: "flex min-w-0 items-center justify-center gap-2 px-2" }, T?.iconUrl ? /* @__PURE__ */ A.createElement("img", {
5445
+ src: T.iconUrl,
5446
+ alt: "",
5447
+ className: "size-6 shrink-0 rounded-md object-contain"
5448
+ }) : null, /* @__PURE__ */ A.createElement("span", { className: "truncate text-sm font-medium text-foreground" }, T?.title ?? r)), /* @__PURE__ */ A.createElement("div", {
5449
+ className: "size-8 shrink-0",
5450
+ "aria-hidden": !0
5451
+ })), U && (E ? /* @__PURE__ */ A.createElement("div", {
5452
+ className: "absolute right-3 top-3",
5453
+ style: { zIndex: 110 }
5454
+ }, E({
5455
+ onClick: () => void je("inline"),
5456
+ "data-testid": "debugger-exit-pip-button",
5457
+ "aria-label": "Exit picture-in-picture"
5458
+ })) : /* @__PURE__ */ A.createElement("button", {
5408
5459
  type: "button",
5409
- "data-testid": V ? "debugger-exit-fullscreen-button" : "debugger-exit-pip-button",
5410
- "aria-label": V ? "Exit fullscreen" : "Exit picture-in-picture",
5411
- className: "absolute right-3 top-3 z-[110] flex size-8 items-center justify-center rounded-full border border-border bg-background/90 text-lg leading-none text-foreground shadow-sm backdrop-blur-sm hover:bg-background",
5460
+ "data-testid": "debugger-exit-pip-button",
5461
+ "aria-label": "Exit picture-in-picture",
5462
+ className: "absolute right-3 top-3 z-[110] flex size-8 cursor-pointer items-center justify-center rounded-full border border-border bg-background/90 text-foreground shadow-sm backdrop-blur-sm hover:bg-background",
5412
5463
  style: { zIndex: 110 },
5413
- onClick: () => void Oe("inline")
5414
- }, "×"), /* @__PURE__ */ A.createElement("div", { className: V || je ? "relative w-full h-full min-h-0 flex flex-1 flex-col" : "relative w-full flex flex-1 justify-center items-center" }, ue && /* @__PURE__ */ A.createElement("div", { className: "flex absolute inset-0 items-center justify-center z-10" }, /* @__PURE__ */ A.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading…")), !je && !V && (re || ie) && /* @__PURE__ */ A.createElement("div", { className: "absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground" }, re && !a ? re : ie), /* @__PURE__ */ A.createElement("div", {
5415
- "data-testid": E,
5464
+ onClick: () => void je("inline")
5465
+ }, /* @__PURE__ */ A.createElement(io, null))), /* @__PURE__ */ A.createElement("div", { className: Pe ? "relative flex min-h-0 w-full flex-1 flex-col" : U ? "relative w-full h-full min-h-0 flex flex-1 flex-col" : "relative w-full flex flex-1 justify-center items-center" }, de && /* @__PURE__ */ A.createElement("div", { className: "flex absolute inset-0 items-center justify-center z-10" }, /* @__PURE__ */ A.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading…")), !U && !Pe && (D || O) && /* @__PURE__ */ A.createElement("div", { className: "absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground" }, D && !a ? D : O), /* @__PURE__ */ A.createElement("div", {
5466
+ "data-testid": ae,
5416
5467
  "data-mcp-app-tool": r,
5417
- className: R === "fullscreen" ? "w-full h-full overflow-hidden" : "w-full overflow-hidden",
5418
- style: Re
5468
+ className: V === "fullscreen" ? "w-full h-full overflow-hidden" : "w-full overflow-hidden",
5469
+ style: Be
5419
5470
  }, /* @__PURE__ */ A.createElement("iframe", {
5420
- ref: ae,
5471
+ ref: oe,
5421
5472
  title: `MCP App: ${r}`,
5422
- className: "w-full h-full border-0 bg-transparent",
5423
- style: { border: k.prefersBorder && R !== "fullscreen" ? void 0 : "none" }
5473
+ className: q ? "w-full h-full bg-transparent border border-border rounded-xl" : "w-full h-full bg-transparent border-0"
5424
5474
  }))));
5425
- return /* @__PURE__ */ A.createElement("div", { className: T }, W);
5475
+ return /* @__PURE__ */ A.createElement("div", { className: ie }, Ve);
5426
5476
  }
5427
- function co(e, t) {
5428
- return !(e.viewId !== t.viewId || e.source !== t.source || e.sandboxUrl !== t.sandboxUrl || e.displayMode !== t.displayMode || e.cancelled !== t.cancelled || e.toolInput !== t.toolInput || e.toolOutput !== t.toolOutput || e.partialToolInput !== t.partialToolInput || e.customProps !== t.customProps || e.hostContext !== t.hostContext || e.hostCapabilities !== t.hostCapabilities || e.cspMode !== t.cspMode || e.mockOpenAiFileApis !== t.mockOpenAiFileApis || e.className !== t.className || e.onReady !== t.onReady || e.onLifecycleChange !== t.onLifecycleChange);
5477
+ function lo(e, t) {
5478
+ return !(e.viewId !== t.viewId || e.source !== t.source || e.sandboxUrl !== t.sandboxUrl || e.displayMode !== t.displayMode || e.cancelled !== t.cancelled || e.toolInput !== t.toolInput || e.toolOutput !== t.toolOutput || e.partialToolInput !== t.partialToolInput || e.customProps !== t.customProps || e.hostContext !== t.hostContext || e.hostCapabilities !== t.hostCapabilities || e.cspMode !== t.cspMode || e.mockOpenAiFileApis !== t.mockOpenAiFileApis || e.onInlineHeightChange !== t.onInlineHeightChange || e.fullscreenHeader !== t.fullscreenHeader || e.renderFullscreenClose !== t.renderFullscreenClose || e.className !== t.className || e.onReady !== t.onReady || e.onLifecycleChange !== t.onLifecycleChange);
5429
5479
  }
5430
- var lo = (0, A.memo)(so, co);
5480
+ var uo = (0, A.memo)(co, lo);
5431
5481
  //#endregion
5432
- export { _r as a, Qa as c, Pa as d, yr as i, Sa as l, Na as n, Za as o, lo as r, $a as s, Fa as t, vr as u };
5482
+ export { _r as a, Qa as c, Pa as d, yr as i, Sa as l, Na as n, Za as o, uo as r, $a as s, Fa as t, vr as u };