@xpert-ai/chatkit-ui 0.5.2 → 0.5.3

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 (338) hide show
  1. package/dist/app/assets/{_baseUniq-DMPA_oa4.js → _baseUniq-ChT9Qo4e.js} +1 -1
  2. package/dist/app/assets/{abap-Cj2zL0JN.js → abap-Ce7DiJV3.js} +1 -1
  3. package/dist/app/assets/{abnf-CX4bCmMj.js → abnf-BVHFzq1y.js} +1 -1
  4. package/dist/app/assets/{actionscript-D-EhiET_.js → actionscript-b1N6pm-O.js} +1 -1
  5. package/dist/app/assets/{ada-Bqjbr4-K.js → ada-rBXyByh8.js} +1 -1
  6. package/dist/app/assets/{agda-DTG3BItC.js → agda-BBQB7lJp.js} +1 -1
  7. package/dist/app/assets/{al-quk_zUjL.js → al-Bo-88aPW.js} +1 -1
  8. package/dist/app/assets/{antlr4-C-SKSOZR.js → antlr4-BP25W3T7.js} +1 -1
  9. package/dist/app/assets/{apacheconf-B4MHVph_.js → apacheconf-hxzhJkXa.js} +1 -1
  10. package/dist/app/assets/{apex-cbqOGViP.js → apex-B9XGHTVl.js} +1 -1
  11. package/dist/app/assets/{apl-BLpOFeja.js → apl-CnE-JBL6.js} +1 -1
  12. package/dist/app/assets/{applescript-CK66K0iL.js → applescript-BGxq2QF0.js} +1 -1
  13. package/dist/app/assets/{aql-BeBrwxVC.js → aql-KrbZMJlr.js} +1 -1
  14. package/dist/app/assets/{arc-CcRTWZ_M.js → arc-BmJ5F6oU.js} +1 -1
  15. package/dist/app/assets/{architectureDiagram-Q4EWVU46-BGOqzZxe.js → architectureDiagram-Q4EWVU46-Dz1_Ibzx.js} +1 -1
  16. package/dist/app/assets/{arduino-CuMzU4Nc.js → arduino-BrA3jTJh.js} +1 -1
  17. package/dist/app/assets/{arff-D6des0tj.js → arff-O0GaAEXp.js} +1 -1
  18. package/dist/app/assets/{asciidoc-DkUYz8D6.js → asciidoc-ClkiMNF8.js} +1 -1
  19. package/dist/app/assets/{asm6502-CDxIqge4.js → asm6502-5bKj4vQ6.js} +1 -1
  20. package/dist/app/assets/{asmatmel-DA5GvT3C.js → asmatmel-DgpgDfTH.js} +1 -1
  21. package/dist/app/assets/{aspnet-DwHgq8BN.js → aspnet-DIULsgBh.js} +1 -1
  22. package/dist/app/assets/{autohotkey-m_x4HDjz.js → autohotkey-DPq46f5T.js} +1 -1
  23. package/dist/app/assets/{autoit-DD3JIMtp.js → autoit-DDnxI--a.js} +1 -1
  24. package/dist/app/assets/{avisynth-BQ6krU9c.js → avisynth-C1Lt9ROp.js} +1 -1
  25. package/dist/app/assets/{avro-idl-RNMFYlHc.js → avro-idl-CGvQ4UxL.js} +1 -1
  26. package/dist/app/assets/{bash-DsSMsygL.js → bash-D8eqCsZ8.js} +1 -1
  27. package/dist/app/assets/{basic-CWxIL949.js → basic-DrODtqCb.js} +1 -1
  28. package/dist/app/assets/{batch-B_YcBqUM.js → batch-DqeGqoQZ.js} +1 -1
  29. package/dist/app/assets/{bbcode-m2CB613Z.js → bbcode-CY9lX15S.js} +1 -1
  30. package/dist/app/assets/{bicep-CZoEzXRK.js → bicep-BDv89DRM.js} +1 -1
  31. package/dist/app/assets/{birb-C45GxEuv.js → birb-DgNPr1Tg.js} +1 -1
  32. package/dist/app/assets/{bison-B2Cyv-Jg.js → bison-BH6C31Lr.js} +1 -1
  33. package/dist/app/assets/{blockDiagram-DXYQGD6D-Bw_AvB9J.js → blockDiagram-DXYQGD6D-BizaVLYu.js} +1 -1
  34. package/dist/app/assets/{bnf-Bqy7WaG8.js → bnf-BBDWrGyG.js} +1 -1
  35. package/dist/app/assets/{brainfuck-CZfj6bhY.js → brainfuck-DhaNdGJl.js} +1 -1
  36. package/dist/app/assets/{brightscript-CYTjxugS.js → brightscript-DiGiUax0.js} +1 -1
  37. package/dist/app/assets/{bro-TUn5kzss.js → bro-DZY9XGEu.js} +1 -1
  38. package/dist/app/assets/{bsl-DIouJkZU.js → bsl-W7fV4TQH.js} +1 -1
  39. package/dist/app/assets/{c-DgEMJzlq.js → c-CkCwgvhy.js} +1 -1
  40. package/dist/app/assets/{c4Diagram-AHTNJAMY-BZ1aSEKn.js → c4Diagram-AHTNJAMY-0Cj5K2_S.js} +1 -1
  41. package/dist/app/assets/{cfscript-CXMqhOEs.js → cfscript-CPFnj1HR.js} +1 -1
  42. package/dist/app/assets/{chaiscript-CbswHI99.js → chaiscript-RQ2qKbDX.js} +1 -1
  43. package/dist/app/assets/channel-CrrgI7jC.js +1 -0
  44. package/dist/app/assets/{chunk-4BX2VUAB-C1NxsBOT.js → chunk-4BX2VUAB-jYTZLj5e.js} +1 -1
  45. package/dist/app/assets/{chunk-4TB4RGXK-DVMRNBq9.js → chunk-4TB4RGXK-59Kj6DwN.js} +1 -1
  46. package/dist/app/assets/{chunk-55IACEB6-Cc2HT1dN.js → chunk-55IACEB6-M7fxqf0U.js} +1 -1
  47. package/dist/app/assets/{chunk-EDXVE4YY-CE4IFknJ.js → chunk-EDXVE4YY-Bk0s3eDs.js} +1 -1
  48. package/dist/app/assets/{chunk-FMBD7UC4-Dpwq2Fyq.js → chunk-FMBD7UC4-DHgDQnYu.js} +1 -1
  49. package/dist/app/assets/{chunk-OYMX7WX6-B5HRrsAE.js → chunk-OYMX7WX6-DId-EsyC.js} +1 -1
  50. package/dist/app/assets/{chunk-QZHKN3VN-DW4jQzcx.js → chunk-QZHKN3VN-DAUAP7IC.js} +1 -1
  51. package/dist/app/assets/{chunk-YZCP3GAM-DibQdouJ.js → chunk-YZCP3GAM-BsCgIURb.js} +1 -1
  52. package/dist/app/assets/{cil-BoU9SAC0.js → cil-BB0yck4I.js} +1 -1
  53. package/dist/app/assets/classDiagram-6PBFFD2Q-DK7Wbhmk.js +1 -0
  54. package/dist/app/assets/classDiagram-v2-HSJHXN6E-DK7Wbhmk.js +1 -0
  55. package/dist/app/assets/{clike-_aTdr-fb.js → clike-DIAL6hbW.js} +1 -1
  56. package/dist/app/assets/{clojure-C9TT8oBQ.js → clojure-CFCnhIDV.js} +1 -1
  57. package/dist/app/assets/clone-BurOzDBp.js +1 -0
  58. package/dist/app/assets/{cmake-Dy5-b1yK.js → cmake-BJ7M3VLa.js} +1 -1
  59. package/dist/app/assets/{cobol-NUAmiaV7.js → cobol-CHafHfaf.js} +1 -1
  60. package/dist/app/assets/{coffeescript-CNW8xSj3.js → coffeescript-D-myNsVo.js} +1 -1
  61. package/dist/app/assets/{concurnas-zmOlqEBl.js → concurnas-CMSXd2bi.js} +1 -1
  62. package/dist/app/assets/{coq-BjQlvNZL.js → coq-2WMbyt5L.js} +1 -1
  63. package/dist/app/assets/{core-CjEsXh7s.js → core-D_mcgtst.js} +1 -1
  64. package/dist/app/assets/{cose-bilkent-S5V4N54A-DTpBdRjm.js → cose-bilkent-S5V4N54A-CFYSME8q.js} +1 -1
  65. package/dist/app/assets/{cpp-DlbtfO9_.js → cpp-BFYZXt4W.js} +1 -1
  66. package/dist/app/assets/{crystal-D_FpS8EO.js → crystal-YbXf5NLu.js} +1 -1
  67. package/dist/app/assets/{csharp-CcBkcqul.js → csharp-CrpatUEr.js} +1 -1
  68. package/dist/app/assets/{cshtml-Co8xpPOu.js → cshtml-DdDPOFL2.js} +1 -1
  69. package/dist/app/assets/{csp-I3DvvTD_.js → csp-BuLrc-qp.js} +1 -1
  70. package/dist/app/assets/{css-B96lK0h5.js → css-BP2xEqtJ.js} +1 -1
  71. package/dist/app/assets/{css-extras-DK8RR_-K.js → css-extras-BUdZfgaW.js} +1 -1
  72. package/dist/app/assets/{csv-COrR5Oay.js → csv-CxUvYF3W.js} +1 -1
  73. package/dist/app/assets/{cypher-BT7uRwlq.js → cypher-dyjlMPfG.js} +1 -1
  74. package/dist/app/assets/{d-BgMcdgIJ.js → d-CAXNQWlH.js} +1 -1
  75. package/dist/app/assets/{dagre-KV5264BT-BzAdnA6d.js → dagre-KV5264BT-B9TaDHlk.js} +1 -1
  76. package/dist/app/assets/{dart-yK6F88CW.js → dart-J8aLCmN6.js} +1 -1
  77. package/dist/app/assets/{dataweave-Dm-qpzhK.js → dataweave-DF9ImZ3N.js} +1 -1
  78. package/dist/app/assets/{dax-Cj2gxnM-.js → dax-BT2AHpyf.js} +1 -1
  79. package/dist/app/assets/{dhall-nQjelIAq.js → dhall-Dg1Tevpu.js} +1 -1
  80. package/dist/app/assets/{diagram-5BDNPKRD-CvZU2QL3.js → diagram-5BDNPKRD-WO42pTkv.js} +1 -1
  81. package/dist/app/assets/{diagram-G4DWMVQ6-CQ5Hcvj3.js → diagram-G4DWMVQ6-7TQ5HPZE.js} +1 -1
  82. package/dist/app/assets/{diagram-MMDJMWI5-yACl-dt-.js → diagram-MMDJMWI5-7RdXMs-Z.js} +1 -1
  83. package/dist/app/assets/{diagram-TYMM5635-BUu215MN.js → diagram-TYMM5635-WTtOoqLh.js} +1 -1
  84. package/dist/app/assets/{diff-D4n6eVkt.js → diff-CqmM9jMk.js} +1 -1
  85. package/dist/app/assets/{django-B9MiHxlG.js → django-BV_Txwli.js} +1 -1
  86. package/dist/app/assets/{dns-zone-file-VD8eyEBf.js → dns-zone-file-chHftqfl.js} +1 -1
  87. package/dist/app/assets/{docker-Dd8HMn45.js → docker-CP5sCvPc.js} +1 -1
  88. package/dist/app/assets/{dot-nHpGp3MO.js → dot-CslM1TDF.js} +1 -1
  89. package/dist/app/assets/{ebnf-ZDntitCJ.js → ebnf-D2Ek46XJ.js} +1 -1
  90. package/dist/app/assets/{editorconfig-D_mDhoqj.js → editorconfig-Ci8FK60B.js} +1 -1
  91. package/dist/app/assets/{eiffel-BBAjnLtv.js → eiffel-Cwub3-yA.js} +1 -1
  92. package/dist/app/assets/{ejs-D41FeLkK.js → ejs-C6kPczUt.js} +1 -1
  93. package/dist/app/assets/{elixir-CJpjQBGg.js → elixir-DC01nBAk.js} +1 -1
  94. package/dist/app/assets/{elm-C8xeCxT5.js → elm-ng29Uzm3.js} +1 -1
  95. package/dist/app/assets/{erDiagram-SMLLAGMA-B_XYwb20.js → erDiagram-SMLLAGMA-CSu1K2TE.js} +1 -1
  96. package/dist/app/assets/{erb-CDlRljTJ.js → erb-BmVXUkNt.js} +1 -1
  97. package/dist/app/assets/{erlang-DAsGKBqs.js → erlang-DX8lZuNY.js} +1 -1
  98. package/dist/app/assets/{etlua-080SN-ad.js → etlua-DF9WPqFy.js} +1 -1
  99. package/dist/app/assets/{excel-formula-C1ourZkH.js → excel-formula-DHOUaKKc.js} +1 -1
  100. package/dist/app/assets/{factor-3iu3Iq_3.js → factor-BBsagI82.js} +1 -1
  101. package/dist/app/assets/{false-BssRf9La.js → false-BwLYv3CT.js} +1 -1
  102. package/dist/app/assets/{firestore-security-rules-CBt6qjzb.js → firestore-security-rules-CsYkwF2L.js} +1 -1
  103. package/dist/app/assets/{flow-B6-gkILu.js → flow-fPHEMMRe.js} +1 -1
  104. package/dist/app/assets/{flowDiagram-DWJPFMVM-BW8OeHws.js → flowDiagram-DWJPFMVM-CjMcT8VF.js} +1 -1
  105. package/dist/app/assets/{fortran--gLPNveO.js → fortran-BlFC22wE.js} +1 -1
  106. package/dist/app/assets/{fsharp-Ccsw25Pl.js → fsharp-qPaHfboo.js} +1 -1
  107. package/dist/app/assets/{ftl-BAbnPQW4.js → ftl-Dez07P0T.js} +1 -1
  108. package/dist/app/assets/{ganttDiagram-T4ZO3ILL-Cjx_nnPG.js → ganttDiagram-T4ZO3ILL-BiQxSqt_.js} +1 -1
  109. package/dist/app/assets/{gap-Ccu9ovLm.js → gap-DJplhPXp.js} +1 -1
  110. package/dist/app/assets/{gcode-Cy1a8PDW.js → gcode-Dg1b5k4P.js} +1 -1
  111. package/dist/app/assets/{gdscript-y4aaFG00.js → gdscript-BVrkBC3R.js} +1 -1
  112. package/dist/app/assets/{gedcom-BuHJMovk.js → gedcom-CrxzyI_t.js} +1 -1
  113. package/dist/app/assets/{gherkin-DI_FlrZP.js → gherkin-XsNIfB3o.js} +1 -1
  114. package/dist/app/assets/{git-CdMKKQEU.js → git-sYqvjDtZ.js} +1 -1
  115. package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-CdHhQZSB.js → gitGraphDiagram-UUTBAWPF-BLuiUQC4.js} +1 -1
  116. package/dist/app/assets/{glsl-4F4N5Sux.js → glsl-DBAWeWvj.js} +1 -1
  117. package/dist/app/assets/{gml-D81YX-Rx.js → gml-D9dDabjR.js} +1 -1
  118. package/dist/app/assets/{gn-DnsgJxRB.js → gn-C_VSOkBi.js} +1 -1
  119. package/dist/app/assets/{go-CfGHIbHP.js → go-WIUDW1GS.js} +1 -1
  120. package/dist/app/assets/{go-module-v1qReyj4.js → go-module-C_q6u5lV.js} +1 -1
  121. package/dist/app/assets/{graph-BXB1kC50.js → graph-CQZE41Xl.js} +1 -1
  122. package/dist/app/assets/{graphql-B3jwaFVl.js → graphql-CCzYeA7K.js} +1 -1
  123. package/dist/app/assets/{groovy-CqJsjrfP.js → groovy-Dcndc-8V.js} +1 -1
  124. package/dist/app/assets/{haml-CnEGtX4u.js → haml-DAdQxEtZ.js} +1 -1
  125. package/dist/app/assets/{handlebars-BMvQ3BzY.js → handlebars-DdcZ78iT.js} +1 -1
  126. package/dist/app/assets/{haskell-Cf0RBiXF.js → haskell-CL_s7J5t.js} +1 -1
  127. package/dist/app/assets/{haxe-CUFzN8sZ.js → haxe-D6kxxTPa.js} +1 -1
  128. package/dist/app/assets/{hcl-BAnkSgip.js → hcl-v_Duxzy7.js} +1 -1
  129. package/dist/app/assets/{hlsl-DCwNlMrb.js → hlsl-DvMfgEKG.js} +1 -1
  130. package/dist/app/assets/{hoon-C15vAmJ-.js → hoon-DtG7k-4U.js} +1 -1
  131. package/dist/app/assets/{hpkp-C3kAfIYl.js → hpkp-j-ypNrrU.js} +1 -1
  132. package/dist/app/assets/{hsts-Bhenzx1_.js → hsts-ukPmjqGZ.js} +1 -1
  133. package/dist/app/assets/{http-DPLUui5c.js → http-BMxLX5wW.js} +1 -1
  134. package/dist/app/assets/{ichigojam-CjxT7NsH.js → ichigojam-CKMzeTbi.js} +1 -1
  135. package/dist/app/assets/{icon-Cbzclc37.js → icon-BI_YktC6.js} +1 -1
  136. package/dist/app/assets/{icu-message-format-39S6o6G6.js → icu-message-format-CKWPiv_u.js} +1 -1
  137. package/dist/app/assets/{idris-CzUqPzGL.js → idris-CEoG17tH.js} +1 -1
  138. package/dist/app/assets/{iecst-D75uKMw6.js → iecst-BPgsr1sk.js} +1 -1
  139. package/dist/app/assets/{ignore-DD-Nam9y.js → ignore-D3mP-IeM.js} +1 -1
  140. package/dist/app/assets/index-BfTgPY7i.css +1 -0
  141. package/dist/app/assets/index-Wv8qdZGD.js +785 -0
  142. package/dist/app/assets/{infoDiagram-42DDH7IO-B8Rc8Ml2.js → infoDiagram-42DDH7IO-CXt53QRt.js} +1 -1
  143. package/dist/app/assets/{inform7-DnYdJ-VQ.js → inform7-BRNaKTTS.js} +1 -1
  144. package/dist/app/assets/{ini-CvifbSz9.js → ini-Co63A9KY.js} +1 -1
  145. package/dist/app/assets/{io-DVWzqa0n.js → io-Y6dFSwsb.js} +1 -1
  146. package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-D5_HvTRV.js → ishikawaDiagram-UXIWVN3A-BtfknNuf.js} +1 -1
  147. package/dist/app/assets/{j-BY7qyUJ5.js → j-Cpt-bjtI.js} +1 -1
  148. package/dist/app/assets/{java-ChK2qUMm.js → java-OV7NSS4M.js} +1 -1
  149. package/dist/app/assets/{javadoc-CX4rgTSj.js → javadoc-1xPzWdCF.js} +1 -1
  150. package/dist/app/assets/{javadoclike-IU9Y8dsz.js → javadoclike-BcMUnjFK.js} +1 -1
  151. package/dist/app/assets/{javascript-mp-N-liG.js → javascript-CqCV1NzJ.js} +1 -1
  152. package/dist/app/assets/{javastacktrace-CijsCdli.js → javastacktrace-BUFSCM4B.js} +1 -1
  153. package/dist/app/assets/{jexl-CdTS_LMa.js → jexl-CCwB7QfC.js} +1 -1
  154. package/dist/app/assets/{jolie-CSLVrie0.js → jolie-CI7ZKpQW.js} +1 -1
  155. package/dist/app/assets/{journeyDiagram-VCZTEJTY-T4W9I372.js → journeyDiagram-VCZTEJTY-CtPUPowP.js} +1 -1
  156. package/dist/app/assets/{jq-BCAti0ZE.js → jq-Cat52Ckh.js} +1 -1
  157. package/dist/app/assets/{js-extras-C0llDM_8.js → js-extras-BW8AY5FQ.js} +1 -1
  158. package/dist/app/assets/{js-templates-BBzwC4yV.js → js-templates-pTyGClWG.js} +1 -1
  159. package/dist/app/assets/{jsdoc-B5c682J0.js → jsdoc-C5dISiXN.js} +1 -1
  160. package/dist/app/assets/{json-B6fifvmp.js → json-BV_ZLpYa.js} +1 -1
  161. package/dist/app/assets/{json5-lhM974rx.js → json5-CaLO3fQi.js} +1 -1
  162. package/dist/app/assets/{jsonp-Df-i1Psr.js → jsonp-DsV6uVRp.js} +1 -1
  163. package/dist/app/assets/{jsstacktrace-CGlls4Vc.js → jsstacktrace-CcXrnL18.js} +1 -1
  164. package/dist/app/assets/{jsx-CyoPYOBK.js → jsx-D59JtHOy.js} +1 -1
  165. package/dist/app/assets/{julia-3ryHaHXf.js → julia-CclEoB-n.js} +1 -1
  166. package/dist/app/assets/{kanban-definition-6JOO6SKY-Dg098cTB.js → kanban-definition-6JOO6SKY-DAwZttRD.js} +1 -1
  167. package/dist/app/assets/{keepalived-D_ad2ZoL.js → keepalived-CFWxCW-H.js} +1 -1
  168. package/dist/app/assets/{keyman-BcEhx9gP.js → keyman-BVv9EQYe.js} +1 -1
  169. package/dist/app/assets/{kotlin-Da5vJL1Z.js → kotlin-CslW8NWU.js} +1 -1
  170. package/dist/app/assets/{kumir-CjOTreP0.js → kumir-DTu9BtLG.js} +1 -1
  171. package/dist/app/assets/{kusto-DapEHOsI.js → kusto-CtqoVlVe.js} +1 -1
  172. package/dist/app/assets/{latex-2otmSFTQ.js → latex-18RzpOnX.js} +1 -1
  173. package/dist/app/assets/{latte-CHcNDgGe.js → latte-BLDf5fvr.js} +1 -1
  174. package/dist/app/assets/{layout-DdWXXHsC.js → layout-kfH7ie9s.js} +1 -1
  175. package/dist/app/assets/{less-1cuPUrve.js → less-CBsIVmwy.js} +1 -1
  176. package/dist/app/assets/{lilypond-C01MfJr5.js → lilypond-Diikt1xh.js} +1 -1
  177. package/dist/app/assets/{linear-Cue29L8J.js → linear-CpWdLpIW.js} +1 -1
  178. package/dist/app/assets/{liquid-T3d-Jjz8.js → liquid-CYsFgJAn.js} +1 -1
  179. package/dist/app/assets/{lisp-DlC_64cM.js → lisp-D5IX2IMS.js} +1 -1
  180. package/dist/app/assets/{livescript-X_Nv563A.js → livescript-CFLCkEiE.js} +1 -1
  181. package/dist/app/assets/{llvm-BlMM3E2w.js → llvm-CHtlwgXC.js} +1 -1
  182. package/dist/app/assets/{log-cRhyBxgW.js → log-Bb0q4gWy.js} +1 -1
  183. package/dist/app/assets/{lolcode-B710kwlH.js → lolcode-DcN_7oO2.js} +1 -1
  184. package/dist/app/assets/{lua-NNXJ23Pq.js → lua-t7DZ5tkJ.js} +1 -1
  185. package/dist/app/assets/{magma-q5JeQg-k.js → magma-72K2RrWH.js} +1 -1
  186. package/dist/app/assets/{makefile-PAGfpPD0.js → makefile-DvrABWRt.js} +1 -1
  187. package/dist/app/assets/{markdown-B8N4gsSe.js → markdown-CF5Lb7qd.js} +1 -1
  188. package/dist/app/assets/{markup-DhDTZYHM.js → markup-CrH5Qer4.js} +1 -1
  189. package/dist/app/assets/{markup-templating-DDsqqM79.js → markup-templating-BqtThcnw.js} +1 -1
  190. package/dist/app/assets/{matlab-BXuUDvsA.js → matlab-Cl5LNbiN.js} +1 -1
  191. package/dist/app/assets/{maxscript-Ck9qDjH2.js → maxscript-DryW9P8J.js} +1 -1
  192. package/dist/app/assets/{mel-7zzDDxVd.js → mel-C4tZH7tA.js} +1 -1
  193. package/dist/app/assets/{mermaid-iLA8KbdM.js → mermaid-CMyXjaN5.js} +1 -1
  194. package/dist/app/assets/{min-CNdWWplt.js → min-BSLr1xjt.js} +1 -1
  195. package/dist/app/assets/{mindmap-definition-QFDTVHPH-0OnT-ARj.js → mindmap-definition-QFDTVHPH-D_rZAJl5.js} +1 -1
  196. package/dist/app/assets/{mizar-BHRRxVF_.js → mizar-Hb1RtA6I.js} +1 -1
  197. package/dist/app/assets/{mongodb-LWsLd7ke.js → mongodb-C9eHJ0I9.js} +1 -1
  198. package/dist/app/assets/{monkey-BuQXg-U8.js → monkey-5znuwlAY.js} +1 -1
  199. package/dist/app/assets/{moonscript-BE_r-EfQ.js → moonscript-BiOwz93j.js} +1 -1
  200. package/dist/app/assets/{n1ql-DmSGOs0a.js → n1ql-BOK-qtfI.js} +1 -1
  201. package/dist/app/assets/{n4js-CJ1VQre2.js → n4js-gUw2INcg.js} +1 -1
  202. package/dist/app/assets/{nand2tetris-hdl-BRqm3JJX.js → nand2tetris-hdl-DulMQ1fH.js} +1 -1
  203. package/dist/app/assets/{naniscript-B54PZYOr.js → naniscript-Fwk03Juz.js} +1 -1
  204. package/dist/app/assets/{nasm-Bw7pDJBj.js → nasm-DyQXh7z1.js} +1 -1
  205. package/dist/app/assets/{neon-Btmhw7Ub.js → neon-DpkOLWSF.js} +1 -1
  206. package/dist/app/assets/{nevod-DhI0_sqm.js → nevod-BXopGva8.js} +1 -1
  207. package/dist/app/assets/{nginx-DW1MSbQn.js → nginx-DPSO5ekf.js} +1 -1
  208. package/dist/app/assets/{nim-CXfKNptR.js → nim-Bq6d6_Bu.js} +1 -1
  209. package/dist/app/assets/{nix-BI9LrRLV.js → nix-Dy2iCPYK.js} +1 -1
  210. package/dist/app/assets/{nsis-C45AtXuI.js → nsis-C53FxEmM.js} +1 -1
  211. package/dist/app/assets/{objectivec-DoO786la.js → objectivec-ClHOfm6L.js} +1 -1
  212. package/dist/app/assets/{ocaml-DrOZ6uhT.js → ocaml-Bd4mMVMR.js} +1 -1
  213. package/dist/app/assets/{opencl-f3QHGMdv.js → opencl-CH3K7nMz.js} +1 -1
  214. package/dist/app/assets/{openqasm-DnrYX2xV.js → openqasm-SOdUhTmx.js} +1 -1
  215. package/dist/app/assets/{oz-Cve8q8bA.js → oz-BOUspg_L.js} +1 -1
  216. package/dist/app/assets/{parigp-Lh1bwfe1.js → parigp-BnU6Vr73.js} +1 -1
  217. package/dist/app/assets/{parser-BuuUTn0B.js → parser-jweo2qRc.js} +1 -1
  218. package/dist/app/assets/{pascal-B44YxN9A.js → pascal-CKG3Ve5B.js} +1 -1
  219. package/dist/app/assets/{pascaligo-scYe-UN-.js → pascaligo-DnSgOfZi.js} +1 -1
  220. package/dist/app/assets/{pcaxis-D-IBiT9E.js → pcaxis-s94ah1qs.js} +1 -1
  221. package/dist/app/assets/{peoplecode-D3sw6W4w.js → peoplecode-DoIvIKcb.js} +1 -1
  222. package/dist/app/assets/{perl-CAWraJC1.js → perl-BXJBS0qx.js} +1 -1
  223. package/dist/app/assets/{php-CDW877Rv.js → php-BlzlR4_v.js} +1 -1
  224. package/dist/app/assets/{php-extras-Ex6l_6iC.js → php-extras-hjEa1iTA.js} +1 -1
  225. package/dist/app/assets/{phpdoc-BjNC6X9h.js → phpdoc-Ch0l7Uv9.js} +1 -1
  226. package/dist/app/assets/{pieDiagram-DEJITSTG-BtzVkX77.js → pieDiagram-DEJITSTG-BK8YBT53.js} +1 -1
  227. package/dist/app/assets/{plsql-CQQK_Pez.js → plsql-BmSD3Q1k.js} +1 -1
  228. package/dist/app/assets/{powerquery-CJuVpd-P.js → powerquery-DM7b-u-o.js} +1 -1
  229. package/dist/app/assets/{powershell-Cc1fiasK.js → powershell-CXsqbD80.js} +1 -1
  230. package/dist/app/assets/{processing-CDodPUaF.js → processing-RuoLznsF.js} +1 -1
  231. package/dist/app/assets/{prolog-Ji8Z1wBQ.js → prolog-Bu4ZaUxi.js} +1 -1
  232. package/dist/app/assets/{promql-B504eXKs.js → promql-DOOZUaV8.js} +1 -1
  233. package/dist/app/assets/{properties-4pit0xKE.js → properties-Be3moloV.js} +1 -1
  234. package/dist/app/assets/{protobuf-D65fgnCD.js → protobuf-N7mb4_Rv.js} +1 -1
  235. package/dist/app/assets/{psl-BKfdnwL1.js → psl-Cww5iKGd.js} +1 -1
  236. package/dist/app/assets/{pug-44XVrvbS.js → pug-DSLvyPtG.js} +1 -1
  237. package/dist/app/assets/{puppet-CQ6pr95X.js → puppet-CxmK6KXr.js} +1 -1
  238. package/dist/app/assets/{pure-B4d8unMA.js → pure-CEWpRrG_.js} +1 -1
  239. package/dist/app/assets/{purebasic-DIykjgce.js → purebasic-BkihQx2l.js} +1 -1
  240. package/dist/app/assets/{purescript-b6UyO-Xd.js → purescript-Dv8RWtry.js} +1 -1
  241. package/dist/app/assets/{q-Dnh5m5NP.js → q-BWG_IRXv.js} +1 -1
  242. package/dist/app/assets/{qml-DT98Gva2.js → qml-DNdfSfok.js} +1 -1
  243. package/dist/app/assets/{qore-DCDmqmqp.js → qore-DN6GB5B6.js} +1 -1
  244. package/dist/app/assets/{qsharp-DlVIr-Lk.js → qsharp-DwetPVRU.js} +1 -1
  245. package/dist/app/assets/{quadrantDiagram-34T5L4WZ-CPX0aeas.js → quadrantDiagram-34T5L4WZ-wVPtNsq8.js} +1 -1
  246. package/dist/app/assets/{r-C0SqQ1if.js → r-mq6rsL09.js} +1 -1
  247. package/dist/app/assets/{racket-D6Rv9Y58.js → racket-DG9wIycI.js} +1 -1
  248. package/dist/app/assets/{reason-DOnbeD4h.js → reason-QDeJ9fGt.js} +1 -1
  249. package/dist/app/assets/{regex-BCE-dtFq.js → regex-CJq5NHvY.js} +1 -1
  250. package/dist/app/assets/{rego-CrqPRQqA.js → rego-CuCkTZEO.js} +1 -1
  251. package/dist/app/assets/{renpy-DIdQy3U0.js → renpy-CF60Vgpp.js} +1 -1
  252. package/dist/app/assets/{requirementDiagram-MS252O5E-DFqVROz9.js → requirementDiagram-MS252O5E-NYm3MUgE.js} +1 -1
  253. package/dist/app/assets/{rest-lUPl_Dmb.js → rest-pvM9_VPV.js} +1 -1
  254. package/dist/app/assets/{rip-DpzQKsBT.js → rip-knfZMbzc.js} +1 -1
  255. package/dist/app/assets/{roboconf-_7841m8Q.js → roboconf-DE2PK0Rv.js} +1 -1
  256. package/dist/app/assets/{robotframework-Byk4ohWk.js → robotframework-CLlyRuvY.js} +1 -1
  257. package/dist/app/assets/{ruby-BqQe_4Re.js → ruby-x5dznEbw.js} +1 -1
  258. package/dist/app/assets/{rust-By7W81wI.js → rust-9aWCBT_0.js} +1 -1
  259. package/dist/app/assets/{sankeyDiagram-XADWPNL6-C153VKrH.js → sankeyDiagram-XADWPNL6-BOYwPyyU.js} +1 -1
  260. package/dist/app/assets/{sas-CCW8wZ8Y.js → sas-C2Y0yCZT.js} +1 -1
  261. package/dist/app/assets/{sass-Che-FE1n.js → sass-BVG4jrsz.js} +1 -1
  262. package/dist/app/assets/{scala-Bzj7EBGD.js → scala-CILasXNs.js} +1 -1
  263. package/dist/app/assets/{scheme-CXNP4zbg.js → scheme-DMT3k7Ay.js} +1 -1
  264. package/dist/app/assets/{scss-BifR9Paq.js → scss-DM3koaoe.js} +1 -1
  265. package/dist/app/assets/{sequenceDiagram-FGHM5R23-CwrMkWeC.js → sequenceDiagram-FGHM5R23-DL40pkmm.js} +1 -1
  266. package/dist/app/assets/{shell-session-BIeaOWoA.js → shell-session-Dxpec_d0.js} +1 -1
  267. package/dist/app/assets/{smali-BhhFxYnC.js → smali-D1whxEhZ.js} +1 -1
  268. package/dist/app/assets/{smalltalk-CqeF5SEc.js → smalltalk-BQMH8qD7.js} +1 -1
  269. package/dist/app/assets/{smarty-DODx5tBJ.js → smarty-JrMCkQIc.js} +1 -1
  270. package/dist/app/assets/{sml-CMLl-jfZ.js → sml-mhC7b4QX.js} +1 -1
  271. package/dist/app/assets/{solidity-DfihEf5n.js → solidity-BSynZrZc.js} +1 -1
  272. package/dist/app/assets/{solution-file-C-G5iX9Q.js → solution-file-DAfssftu.js} +1 -1
  273. package/dist/app/assets/{soy-BjYcrOfB.js → soy-DU7nZVR7.js} +1 -1
  274. package/dist/app/assets/{sparql-Bo9ifGdT.js → sparql-Cq3r5HHF.js} +1 -1
  275. package/dist/app/assets/{splunk-spl-C1rMe6Nu.js → splunk-spl-CGcTPfRb.js} +1 -1
  276. package/dist/app/assets/{sqf-DTlxXox6.js → sqf-CG8TBMKD.js} +1 -1
  277. package/dist/app/assets/{sql-Bw_EHPvn.js → sql-e3vFyHiF.js} +1 -1
  278. package/dist/app/assets/{squirrel-DW457Ax9.js → squirrel-CYCMghr2.js} +1 -1
  279. package/dist/app/assets/{stan-B7n50noR.js → stan-DQRnUJX1.js} +1 -1
  280. package/dist/app/assets/{stateDiagram-FHFEXIEX-CEQf98RN.js → stateDiagram-FHFEXIEX-BXjm3A3K.js} +1 -1
  281. package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-WTCPU8pQ.js +1 -0
  282. package/dist/app/assets/{stylus-Dv2Gpd2n.js → stylus-C7mZgsLR.js} +1 -1
  283. package/dist/app/assets/{swift-BAIbo1ZL.js → swift-FgNu5uOF.js} +1 -1
  284. package/dist/app/assets/{systemd-CM8gGPdt.js → systemd-Gxav6pEn.js} +1 -1
  285. package/dist/app/assets/{t4-cs-DJQvnuVA.js → t4-cs-DmynqUb7.js} +1 -1
  286. package/dist/app/assets/{t4-templating---KLNzA1.js → t4-templating-yOruJMSa.js} +1 -1
  287. package/dist/app/assets/{t4-vb-Cseiaqvq.js → t4-vb-BKIzALAO.js} +1 -1
  288. package/dist/app/assets/{tap-BI8A4lyv.js → tap-DS5QmC0E.js} +1 -1
  289. package/dist/app/assets/{tcl-D0Ygia4-.js → tcl-AP9wIHUu.js} +1 -1
  290. package/dist/app/assets/{textile-Ckovp5lE.js → textile-Cwund-GG.js} +1 -1
  291. package/dist/app/assets/{timeline-definition-GMOUNBTQ-QGPqOu2_.js → timeline-definition-GMOUNBTQ-CUgfdbl8.js} +1 -1
  292. package/dist/app/assets/{toml-ic0y606Q.js → toml-DdbNJSTB.js} +1 -1
  293. package/dist/app/assets/{tremor-DjtMl9Xw.js → tremor-Ci5mLsoz.js} +1 -1
  294. package/dist/app/assets/{tt2-DIAkCzMt.js → tt2-DMnaiyrl.js} +1 -1
  295. package/dist/app/assets/{turtle-CRztIQUt.js → turtle-CtmHhGlr.js} +1 -1
  296. package/dist/app/assets/{twig-DMU8J6pK.js → twig-jOh3JXGe.js} +1 -1
  297. package/dist/app/assets/{typescript-Iz5CtnCc.js → typescript-C9ZO1Bsq.js} +1 -1
  298. package/dist/app/assets/{typoscript-zTZzZE8x.js → typoscript-BPJJK2gF.js} +1 -1
  299. package/dist/app/assets/{unrealscript-CODlSqBt.js → unrealscript-D5q598j9.js} +1 -1
  300. package/dist/app/assets/{uorazor-TLqdcdSp.js → uorazor-ig8gHEFY.js} +1 -1
  301. package/dist/app/assets/{uri-X04B-1Ku.js → uri-B0NV-CTl.js} +1 -1
  302. package/dist/app/assets/{v-uEza4RBu.js → v-DLKo3VP1.js} +1 -1
  303. package/dist/app/assets/{vala-D9bku9j-.js → vala-DQyQ3_G9.js} +1 -1
  304. package/dist/app/assets/{vbnet-DW8U376e.js → vbnet-C2EluvGs.js} +1 -1
  305. package/dist/app/assets/{velocity-Chey_Yus.js → velocity-CocU3Pr_.js} +1 -1
  306. package/dist/app/assets/{vennDiagram-DHZGUBPP-aPpSiaPL.js → vennDiagram-DHZGUBPP-C6HjVfSH.js} +1 -1
  307. package/dist/app/assets/{verilog-BQ8HwcNa.js → verilog-C5-NnnGo.js} +1 -1
  308. package/dist/app/assets/{vhdl-BrZZFPeO.js → vhdl-1lTwYkMl.js} +1 -1
  309. package/dist/app/assets/{vim-CIqO-Os5.js → vim-BFFrBSnn.js} +1 -1
  310. package/dist/app/assets/{visual-basic-Dt7-DW2C.js → visual-basic-DmqiNP3t.js} +1 -1
  311. package/dist/app/assets/{wardley-RL74JXVD-BIubZMCY.js → wardley-RL74JXVD-B_Ds6kTY.js} +1 -1
  312. package/dist/app/assets/{wardleyDiagram-NUSXRM2D-DYAY6Rx4.js → wardleyDiagram-NUSXRM2D-DBuGTx4P.js} +1 -1
  313. package/dist/app/assets/{warpscript-BaRoeM5L.js → warpscript-DbCf6a2h.js} +1 -1
  314. package/dist/app/assets/{wasm-czQaol6D.js → wasm-BdwrQDsu.js} +1 -1
  315. package/dist/app/assets/{web-idl-Bsa21vQT.js → web-idl-Ci16LhtK.js} +1 -1
  316. package/dist/app/assets/{wiki-LSYNKBVL.js → wiki-DkGStcp9.js} +1 -1
  317. package/dist/app/assets/{wolfram-C5If9Dhv.js → wolfram-DIKPY0pR.js} +1 -1
  318. package/dist/app/assets/{wren-DDo7JOZT.js → wren-Co-reRGP.js} +1 -1
  319. package/dist/app/assets/{xeora-Ktg8q8zo.js → xeora-DzP_NAXE.js} +1 -1
  320. package/dist/app/assets/{xml-doc-DBE-2UUP.js → xml-doc-0qJkt3-O.js} +1 -1
  321. package/dist/app/assets/{xojo-DWfIpwtt.js → xojo-CGBxZsBv.js} +1 -1
  322. package/dist/app/assets/{xquery-CFJU3zRn.js → xquery-C4AX9sLX.js} +1 -1
  323. package/dist/app/assets/{xychartDiagram-5P7HB3ND-BJY2wkwC.js → xychartDiagram-5P7HB3ND-CK9Q1OGP.js} +1 -1
  324. package/dist/app/assets/{yaml-DJmmt8p-.js → yaml-Dxa8k2xC.js} +1 -1
  325. package/dist/app/assets/{yang-Bf5HN1Sx.js → yang-CcCtKZOu.js} +1 -1
  326. package/dist/app/assets/{zig-Sgl0VF72.js → zig-DURHftPm.js} +1 -1
  327. package/dist/app/index.html +2 -2
  328. package/dist/app/mcp-app-sandbox-proxy.html +114 -0
  329. package/dist/index.cjs +1041 -215
  330. package/dist/index.js +1056 -223
  331. package/package.json +3 -3
  332. package/dist/app/assets/channel-C9F_V90G.js +0 -1
  333. package/dist/app/assets/classDiagram-6PBFFD2Q-Cf8DAzB0.js +0 -1
  334. package/dist/app/assets/classDiagram-v2-HSJHXN6E-Cf8DAzB0.js +0 -1
  335. package/dist/app/assets/clone-1urtxbkU.js +0 -1
  336. package/dist/app/assets/index-ByEJy9Db.css +0 -1
  337. package/dist/app/assets/index-C4MhPDCR.js +0 -783
  338. package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-DN7a7q3Y.js +0 -1
package/dist/index.cjs CHANGED
@@ -2477,7 +2477,16 @@ var en_US_default = {
2477
2477
  moreTags: "+{{count}}"
2478
2478
  },
2479
2479
  mcpApp: {
2480
- loading: "Loading MCP App"
2480
+ loading: "Loading MCP App",
2481
+ fullscreen: "Open fullscreen",
2482
+ pictureInPicture: "Open picture in picture",
2483
+ returnInline: "Return inline",
2484
+ approvalTitle: "Confirm MCP App action",
2485
+ toolApprovalDescription: 'The app wants to run "{{tool}}". Review the request before allowing it.',
2486
+ downloadApprovalDescription: "The app wants to download files to this device. Review the file details before allowing it.",
2487
+ requestDetails: "Request details",
2488
+ approve: "Allow",
2489
+ reject: "Reject"
2481
2490
  },
2482
2491
  contextCompression: {
2483
2492
  running: "Automatically compressing context",
@@ -2960,7 +2969,16 @@ var zh_CN_default = {
2960
2969
  moreTags: "+{{count}}"
2961
2970
  },
2962
2971
  mcpApp: {
2963
- loading: "\u6B63\u5728\u52A0\u8F7D MCP App"
2972
+ loading: "\u6B63\u5728\u52A0\u8F7D MCP App",
2973
+ fullscreen: "\u5168\u5C4F\u663E\u793A",
2974
+ pictureInPicture: "\u753B\u4E2D\u753B\u663E\u793A",
2975
+ returnInline: "\u8FD4\u56DE\u884C\u5185\u663E\u793A",
2976
+ approvalTitle: "\u786E\u8BA4 MCP App \u64CD\u4F5C",
2977
+ toolApprovalDescription: "App \u8BF7\u6C42\u8FD0\u884C\u201C{{tool}}\u201D\u3002\u8BF7\u68C0\u67E5\u8BF7\u6C42\u5185\u5BB9\u540E\u518D\u51B3\u5B9A\u662F\u5426\u5141\u8BB8\u3002",
2978
+ downloadApprovalDescription: "App \u8BF7\u6C42\u5C06\u6587\u4EF6\u4E0B\u8F7D\u5230\u6B64\u8BBE\u5907\u3002\u8BF7\u68C0\u67E5\u6587\u4EF6\u8BE6\u60C5\u540E\u518D\u51B3\u5B9A\u662F\u5426\u5141\u8BB8\u3002",
2979
+ requestDetails: "\u8BF7\u6C42\u8BE6\u60C5",
2980
+ approve: "\u5141\u8BB8",
2981
+ reject: "\u62D2\u7EDD"
2964
2982
  },
2965
2983
  contextCompression: {
2966
2984
  running: "\u6B63\u5728\u81EA\u52A8\u538B\u7F29\u4E0A\u4E0B\u6587",
@@ -5791,8 +5809,8 @@ function JsonTreeNode({
5791
5809
  depth = 0
5792
5810
  }) {
5793
5811
  const isArray = Array.isArray(value);
5794
- const isObject2 = isJsonObjectValue(value);
5795
- const isExpandable = isArray || isObject2;
5812
+ const isObject3 = isJsonObjectValue(value);
5813
+ const isExpandable = isArray || isObject3;
5796
5814
  const [isExpanded, setIsExpanded] = React18.useState(depth < 2);
5797
5815
  if (!isExpandable) {
5798
5816
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex min-w-0 gap-2 leading-6", children: [
@@ -9558,8 +9576,8 @@ function getFallbackPalette(isDarkMode) {
9558
9576
  text: "#18181b"
9559
9577
  };
9560
9578
  }
9561
- function resolveColor(styles, property, fallback, background) {
9562
- const parsed = parseCssColor(styles.getPropertyValue(property));
9579
+ function resolveColor(styles, property2, fallback, background) {
9580
+ const parsed = parseCssColor(styles.getPropertyValue(property2));
9563
9581
  if (!parsed) return fallback;
9564
9582
  if (parsed.a < 1 && background) {
9565
9583
  return rgbaToHex(compositeColor(parsed, background));
@@ -13093,15 +13111,15 @@ function getObjectProperty(value, key) {
13093
13111
  if (!isPlainObject2(value)) {
13094
13112
  return void 0;
13095
13113
  }
13096
- const property = value[key];
13097
- return isPlainObject2(property) ? property : void 0;
13114
+ const property2 = value[key];
13115
+ return isPlainObject2(property2) ? property2 : void 0;
13098
13116
  }
13099
13117
  function getStringProperty(value, key) {
13100
13118
  if (!isPlainObject2(value)) {
13101
13119
  return void 0;
13102
13120
  }
13103
- const property = value[key];
13104
- return typeof property === "string" ? property : void 0;
13121
+ const property2 = value[key];
13122
+ return typeof property2 === "string" ? property2 : void 0;
13105
13123
  }
13106
13124
  function isPlainObject2(value) {
13107
13125
  return !!value && typeof value === "object" && !Array.isArray(value);
@@ -13114,6 +13132,223 @@ function hasLegacySurface(surface) {
13114
13132
  var React37 = __toESM(require("react"), 1);
13115
13133
  var import_chatkit_types11 = require("@xpert-ai/chatkit-types");
13116
13134
  var import_lucide_react24 = require("lucide-react");
13135
+
13136
+ // src/components/thread/messages/mcp-app/host.ts
13137
+ function isObject2(value) {
13138
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
13139
+ }
13140
+ function property(value, key) {
13141
+ return Reflect.get(value, key);
13142
+ }
13143
+ function stringProperty(value, key) {
13144
+ const field = property(value, key);
13145
+ return typeof field === "string" && field.trim() ? field.trim() : void 0;
13146
+ }
13147
+ function isMcpAppRpcSuccess(value) {
13148
+ return isObject2(value) && Reflect.has(value, "result") && !Reflect.has(value, "error");
13149
+ }
13150
+ function readMcpAppDisplayMode(value) {
13151
+ if (!isObject2(value)) return void 0;
13152
+ const result = property(value, "result");
13153
+ if (!isObject2(result)) return void 0;
13154
+ const mode = property(result, "mode");
13155
+ if (mode === "picture-in-picture") return "pip";
13156
+ return mode === "inline" || mode === "fullscreen" || mode === "pip" ? mode : void 0;
13157
+ }
13158
+ function readMcpAppPendingApproval(response, request) {
13159
+ if (!isObject2(response)) return null;
13160
+ const error = property(response, "error");
13161
+ if (!isObject2(error) || property(error, "code") !== -32001) return null;
13162
+ const data = property(error, "data");
13163
+ if (!isObject2(data)) return null;
13164
+ const approvalId = stringProperty(data, "approvalId");
13165
+ const risk = property(data, "risk");
13166
+ const expiresAt = property(data, "expiresAt");
13167
+ if (!approvalId || risk !== "write" && risk !== "destructive" || typeof expiresAt !== "number" || !Number.isFinite(expiresAt)) {
13168
+ return null;
13169
+ }
13170
+ const params = isObject2(request.params) ? request.params : void 0;
13171
+ const requestedTool = params ? stringProperty(params, "name") : void 0;
13172
+ const kind = request.method === "ui/download-file" ? "download" : "tool";
13173
+ return {
13174
+ approvalId,
13175
+ risk,
13176
+ expiresAt,
13177
+ toolName: kind === "download" ? "ui/download-file" : requestedTool ?? request.method ?? "tools/call",
13178
+ kind,
13179
+ request,
13180
+ details: kind === "download" ? formatDownloadApprovalDetails(request.params) : formatApprovalDetails(request.params)
13181
+ };
13182
+ }
13183
+ function withMcpAppApprovalId(request, approvalId) {
13184
+ return {
13185
+ ...request,
13186
+ params: {
13187
+ ...isObject2(request.params) ? request.params : {},
13188
+ approvalId
13189
+ }
13190
+ };
13191
+ }
13192
+ function formatApprovalDetails(value) {
13193
+ try {
13194
+ const text = JSON.stringify(redactSensitiveValue(value, 0), null, 2);
13195
+ if (!text) return "{}";
13196
+ return text.length > 4e3 ? `${text.slice(0, 4e3)}
13197
+ \u2026` : text;
13198
+ } catch {
13199
+ return "[Request details unavailable]";
13200
+ }
13201
+ }
13202
+ function redactSensitiveValue(value, depth) {
13203
+ if (depth >= 6) return "[Nested value omitted]";
13204
+ if (typeof value === "string" && value.length > 1e3) {
13205
+ return `${value.slice(0, 1e3)}\u2026 [${value.length} characters]`;
13206
+ }
13207
+ if (Array.isArray(value)) {
13208
+ return value.slice(0, 20).map((item) => redactSensitiveValue(item, depth + 1));
13209
+ }
13210
+ if (!isObject2(value)) return value;
13211
+ const output = {};
13212
+ for (const [key, field] of Object.entries(value).slice(0, 50)) {
13213
+ output[key] = /password|secret|token|authorization|api[-_]?key/i.test(key) ? "[Redacted]" : redactSensitiveValue(field, depth + 1);
13214
+ }
13215
+ return output;
13216
+ }
13217
+ function formatDownloadApprovalDetails(value) {
13218
+ if (!isObject2(value)) return "{}";
13219
+ const contents = property(value, "contents");
13220
+ if (!Array.isArray(contents)) return "{}";
13221
+ const summary = contents.slice(0, 20).map((item) => {
13222
+ if (!isObject2(item)) return { type: "invalid" };
13223
+ if (property(item, "type") === "resource_link") {
13224
+ return {
13225
+ type: "resource_link",
13226
+ name: stringProperty(item, "name"),
13227
+ uri: stringProperty(item, "uri"),
13228
+ mimeType: stringProperty(item, "mimeType")
13229
+ };
13230
+ }
13231
+ const resource = property(item, "resource");
13232
+ if (!isObject2(resource)) return { type: property(item, "type") };
13233
+ const text = property(resource, "text");
13234
+ const blob = property(resource, "blob");
13235
+ return {
13236
+ type: "resource",
13237
+ name: stringProperty(resource, "name"),
13238
+ uri: stringProperty(resource, "uri"),
13239
+ mimeType: stringProperty(resource, "mimeType"),
13240
+ size: typeof text === "string" ? `${new TextEncoder().encode(text).byteLength} bytes` : typeof blob === "string" ? `approximately ${Math.floor(blob.length * 3 / 4)} bytes` : void 0
13241
+ };
13242
+ });
13243
+ return JSON.stringify({ files: summary }, null, 2);
13244
+ }
13245
+ function triggerMcpAppDownloads(value) {
13246
+ const downloads = parseDownloadItems(value);
13247
+ for (const download of downloads) {
13248
+ if (download.kind === "link") {
13249
+ clickDownload(download.uri, download.filename);
13250
+ continue;
13251
+ }
13252
+ const blob = new Blob(
13253
+ [
13254
+ download.text !== void 0 ? download.text : decodeBase64(download.blob ?? "")
13255
+ ],
13256
+ { type: download.mimeType }
13257
+ );
13258
+ const url = URL.createObjectURL(blob);
13259
+ clickDownload(url, download.filename);
13260
+ window.setTimeout(() => URL.revokeObjectURL(url), 0);
13261
+ }
13262
+ }
13263
+ function parseDownloadItems(value) {
13264
+ if (!isObject2(value)) throw new Error("Download params must be an object");
13265
+ if (property(value, "isError") === true) {
13266
+ throw new Error("The MCP App reported that the download failed");
13267
+ }
13268
+ const contents = property(value, "contents");
13269
+ if (!Array.isArray(contents) || contents.length === 0) {
13270
+ throw new Error("Download contents must be a non-empty array");
13271
+ }
13272
+ return contents.map((item, index) => {
13273
+ if (!isObject2(item)) throw new Error("Download content is invalid");
13274
+ const type = property(item, "type");
13275
+ if (type === "resource_link") {
13276
+ const uri2 = stringProperty(item, "uri");
13277
+ const name = stringProperty(item, "name");
13278
+ if (!uri2 || !name || !isHttpUrl(uri2)) {
13279
+ throw new Error(
13280
+ "Download link must use HTTP or HTTPS and include a name"
13281
+ );
13282
+ }
13283
+ return {
13284
+ kind: "link",
13285
+ filename: sanitizeFilename(name, index),
13286
+ uri: uri2
13287
+ };
13288
+ }
13289
+ if (type !== "resource") {
13290
+ throw new Error("Download content type is unsupported");
13291
+ }
13292
+ const resource = property(item, "resource");
13293
+ if (!isObject2(resource)) throw new Error("Embedded download is invalid");
13294
+ const uri = stringProperty(resource, "uri");
13295
+ if (!uri) throw new Error("Embedded download URI is required");
13296
+ const text = property(resource, "text");
13297
+ const blob = property(resource, "blob");
13298
+ if (typeof text !== "string" && typeof blob !== "string") {
13299
+ throw new Error("Embedded download must include text or base64 data");
13300
+ }
13301
+ const common = {
13302
+ kind: "embedded",
13303
+ filename: sanitizeFilename(
13304
+ stringProperty(resource, "name") ?? filenameFromUri(uri),
13305
+ index
13306
+ ),
13307
+ mimeType: stringProperty(resource, "mimeType") ?? "application/octet-stream"
13308
+ };
13309
+ return typeof text === "string" ? { ...common, text } : { ...common, blob };
13310
+ });
13311
+ }
13312
+ function decodeBase64(value) {
13313
+ const decoded = window.atob(value);
13314
+ return Uint8Array.from(decoded, (character) => character.charCodeAt(0));
13315
+ }
13316
+ function filenameFromUri(uri) {
13317
+ try {
13318
+ const pathname = new URL(uri).pathname;
13319
+ const segment = pathname.split("/").filter(Boolean).at(-1);
13320
+ return segment ? decodeURIComponent(segment) : "download";
13321
+ } catch {
13322
+ return uri.split("/").filter(Boolean).at(-1) ?? "download";
13323
+ }
13324
+ }
13325
+ function sanitizeFilename(value, index) {
13326
+ const sanitized = Array.from(
13327
+ value,
13328
+ (character) => character.charCodeAt(0) <= 31 || /[\\/:*?"<>|]/.test(character) ? "_" : character
13329
+ ).join("").trim().slice(0, 255);
13330
+ return sanitized || `download-${index + 1}`;
13331
+ }
13332
+ function isHttpUrl(value) {
13333
+ try {
13334
+ const url = new URL(value);
13335
+ return url.protocol === "http:" || url.protocol === "https:";
13336
+ } catch {
13337
+ return false;
13338
+ }
13339
+ }
13340
+ function clickDownload(uri, filename) {
13341
+ const anchor = document.createElement("a");
13342
+ anchor.href = uri;
13343
+ anchor.download = filename;
13344
+ anchor.rel = "noopener noreferrer";
13345
+ anchor.hidden = true;
13346
+ document.body.append(anchor);
13347
+ anchor.click();
13348
+ anchor.remove();
13349
+ }
13350
+
13351
+ // src/components/thread/messages/mcp-app.tsx
13117
13352
  var import_jsx_runtime43 = require("react/jsx-runtime");
13118
13353
  var EMPTY_INPUT_SCHEMA = {
13119
13354
  type: "object",
@@ -13146,53 +13381,28 @@ function readIconDefinition(value) {
13146
13381
  }
13147
13382
  function readStringList(value) {
13148
13383
  if (!Array.isArray(value)) return void 0;
13149
- const strings = value.filter((item) => typeof item === "string");
13384
+ const strings = value.filter(
13385
+ (item) => typeof item === "string"
13386
+ );
13150
13387
  return strings.length ? strings : void 0;
13151
13388
  }
13152
- function buildXpertApiUrl(apiUrl, path) {
13153
- const normalizedApiUrl = apiUrl.trim();
13154
- if (!normalizedApiUrl) return path;
13155
- try {
13156
- const url = new URL(normalizedApiUrl);
13157
- return `${url.origin}${path}`;
13158
- } catch {
13159
- return path;
13160
- }
13161
- }
13162
- function appendQuery(path, params) {
13163
- const query = params.toString();
13164
- return query ? `${path}?${query}` : path;
13165
- }
13166
- function buildMcpAppReviveParams(data, options) {
13167
- const params = new URLSearchParams();
13168
- const add = (key, value) => {
13169
- if (value) {
13170
- params.set(key, value);
13171
- }
13389
+ function buildMcpAppReviveQuery(data, options) {
13390
+ return {
13391
+ toolsetId: data.toolsetId,
13392
+ serverName: data.serverName,
13393
+ toolName: data.toolName,
13394
+ toolCallId: data.toolCallId,
13395
+ resourceUri: data.resourceUri,
13396
+ title: typeof data.title === "string" ? data.title : void 0,
13397
+ messageId: options?.messageId,
13398
+ token: options?.appInstanceToken ?? data.appInstanceToken
13172
13399
  };
13173
- add("toolsetId", data.toolsetId);
13174
- add("serverName", data.serverName);
13175
- add("toolName", data.toolName);
13176
- add("toolCallId", data.toolCallId);
13177
- add("resourceUri", data.resourceUri);
13178
- add("title", typeof data.title === "string" ? data.title : void 0);
13179
- add("messageId", options?.messageId);
13180
- add("token", options?.appInstanceToken ?? data.appInstanceToken);
13181
- return params;
13182
- }
13183
- function buildMcpAppEndpointPath(data, endpoint, options) {
13184
- return appendQuery(
13185
- `/api/xpert-toolset/mcp-apps/${encodeURIComponent(
13186
- data.appInstanceId
13187
- )}/${endpoint}`,
13188
- buildMcpAppReviveParams(data, options)
13189
- );
13190
13400
  }
13191
13401
  function escapeHtmlAttribute(value) {
13192
13402
  return value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
13193
13403
  }
13194
13404
  function domains(values) {
13195
- return values?.filter((value) => value.trim()).join(" ") ?? "";
13405
+ return values?.map((value) => value.trim()).filter((value) => value && !/[\s;'"<>]/.test(value)).join(" ") ?? "";
13196
13406
  }
13197
13407
  function buildCsp(csp) {
13198
13408
  const resourceDomains = domains(csp?.resourceDomains);
@@ -13207,7 +13417,9 @@ function buildCsp(csp) {
13207
13417
  `media-src data: blob: ${resourceDomains}`.trim(),
13208
13418
  `font-src data: ${resourceDomains}`.trim(),
13209
13419
  `connect-src ${connectDomains}`,
13420
+ `form-action ${connectDomains}`,
13210
13421
  `frame-src ${frameDomains}`,
13422
+ "object-src 'none'",
13211
13423
  `base-uri ${baseUriDomains}`
13212
13424
  ].join("; ");
13213
13425
  }
@@ -13293,13 +13505,14 @@ function jsonRpcResult(id, result) {
13293
13505
  result
13294
13506
  };
13295
13507
  }
13296
- function jsonRpcError(id, message) {
13508
+ function jsonRpcError(id, message, code = -32e3, data) {
13297
13509
  return {
13298
13510
  jsonrpc: "2.0",
13299
13511
  id: id ?? null,
13300
13512
  error: {
13301
- code: -32e3,
13302
- message
13513
+ code,
13514
+ message,
13515
+ ...data === void 0 ? {} : { data }
13303
13516
  }
13304
13517
  };
13305
13518
  }
@@ -13350,11 +13563,7 @@ var MCP_APP_THEME_COLOR_TOKENS = [
13350
13563
  ["--background", "--mcp-app-color-background", "oklch(1 0 0)"],
13351
13564
  ["--foreground", "--mcp-app-color-foreground", "oklch(0.145 0 0)"],
13352
13565
  ["--card", "--mcp-app-color-card", "oklch(1 0 0)"],
13353
- [
13354
- "--card-foreground",
13355
- "--mcp-app-color-card-foreground",
13356
- "oklch(0.145 0 0)"
13357
- ],
13566
+ ["--card-foreground", "--mcp-app-color-card-foreground", "oklch(0.145 0 0)"],
13358
13567
  ["--popover", "--mcp-app-color-popover", "oklch(1 0 0)"],
13359
13568
  [
13360
13569
  "--popover-foreground",
@@ -13385,11 +13594,7 @@ var MCP_APP_THEME_COLOR_TOKENS = [
13385
13594
  "--mcp-app-color-accent-foreground",
13386
13595
  "oklch(0.205 0 0)"
13387
13596
  ],
13388
- [
13389
- "--destructive",
13390
- "--mcp-app-color-destructive",
13391
- "oklch(0.577 0.245 27.325)"
13392
- ],
13597
+ ["--destructive", "--mcp-app-color-destructive", "oklch(0.577 0.245 27.325)"],
13393
13598
  [
13394
13599
  "--destructive-foreground",
13395
13600
  "--mcp-app-color-destructive-foreground",
@@ -13503,9 +13708,7 @@ function normalizeMcpAppToolInfo(value, data, resource = {}) {
13503
13708
  ...rawTool,
13504
13709
  name: originalName,
13505
13710
  title: readLocalizedText(rawTool.title) ?? title,
13506
- inputSchema: normalizeInputSchema(
13507
- rawTool.inputSchema ?? raw.inputSchema
13508
- ),
13711
+ inputSchema: normalizeInputSchema(rawTool.inputSchema ?? raw.inputSchema),
13509
13712
  ...description ? {
13510
13713
  description: readLocalizedText(rawTool.description) ?? description
13511
13714
  } : {},
@@ -13534,10 +13737,66 @@ function buildIframeAllow(permissions) {
13534
13737
  return policies.length ? policies.join("; ") : void 0;
13535
13738
  }
13536
13739
  function buildSandboxAttribute() {
13537
- return ["allow-downloads", "allow-forms", "allow-modals", "allow-scripts"].join(
13538
- " "
13740
+ return ["allow-forms", "allow-modals", "allow-scripts"].join(" ");
13741
+ }
13742
+ function isLoopbackHostname(hostname) {
13743
+ return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]";
13744
+ }
13745
+ function normalizeRequestedDomain(value) {
13746
+ const domain = value?.trim().toLowerCase().replace(/\.$/, "");
13747
+ if (!domain || /[/:?#@]/.test(domain)) return null;
13748
+ try {
13749
+ const parsed = new URL(`https://${domain}`);
13750
+ return parsed.hostname === domain && !parsed.port ? domain : null;
13751
+ } catch {
13752
+ return null;
13753
+ }
13754
+ }
13755
+ function domainMatchesAllowlist(domain, allowedDomains) {
13756
+ return Boolean(
13757
+ allowedDomains?.some((value) => {
13758
+ const entry = value.trim().toLowerCase().replace(/\.$/, "");
13759
+ if (entry.startsWith("*.")) {
13760
+ const suffix = entry.slice(2);
13761
+ return Boolean(suffix) && domain !== suffix && domain.endsWith(`.${suffix}`);
13762
+ }
13763
+ return domain === entry;
13764
+ })
13539
13765
  );
13540
13766
  }
13767
+ function resolveMcpAppSandboxProxy(options, requestedDomain, hostLocation = window.location.href) {
13768
+ const configuredUrl = options?.sandboxProxyUrl?.trim();
13769
+ if (!configuredUrl) return null;
13770
+ try {
13771
+ const hostOrigin = new URL(hostLocation).origin;
13772
+ const proxyUrl = new URL(configuredUrl, hostLocation);
13773
+ if (proxyUrl.protocol !== "https:" && !(proxyUrl.protocol === "http:" && isLoopbackHostname(proxyUrl.hostname))) {
13774
+ return null;
13775
+ }
13776
+ const domain = normalizeRequestedDomain(requestedDomain);
13777
+ const dedicatedOrigin = Boolean(
13778
+ domain && (domain === proxyUrl.hostname.toLowerCase() || domainMatchesAllowlist(domain, options?.allowedDomains))
13779
+ );
13780
+ if (domain && dedicatedOrigin) {
13781
+ proxyUrl.hostname = domain;
13782
+ proxyUrl.port = "";
13783
+ }
13784
+ if (proxyUrl.origin === hostOrigin) return null;
13785
+ const fragment = new URLSearchParams(proxyUrl.hash.slice(1));
13786
+ fragment.set("parentOrigin", hostOrigin);
13787
+ proxyUrl.hash = fragment.toString();
13788
+ return {
13789
+ url: proxyUrl.toString(),
13790
+ origin: proxyUrl.origin,
13791
+ dedicatedOrigin
13792
+ };
13793
+ } catch {
13794
+ return null;
13795
+ }
13796
+ }
13797
+ function buildMcpAppInnerSandbox(dedicatedOrigin) {
13798
+ return dedicatedOrigin ? `${buildSandboxAttribute()} allow-same-origin` : buildSandboxAttribute();
13799
+ }
13541
13800
  function stringifyToolResult(value) {
13542
13801
  if (typeof value === "string") return value;
13543
13802
  try {
@@ -13660,7 +13919,7 @@ function normalizeMcpAppResourceResponse(value, data) {
13660
13919
  rawToolResult
13661
13920
  };
13662
13921
  }
13663
- function isHttpUrl(value) {
13922
+ function isHttpUrl2(value) {
13664
13923
  try {
13665
13924
  const url = new URL(value);
13666
13925
  return url.protocol === "http:" || url.protocol === "https:";
@@ -13668,22 +13927,124 @@ function isHttpUrl(value) {
13668
13927
  return false;
13669
13928
  }
13670
13929
  }
13671
- function contentBlocksToText(content) {
13672
- if (!Array.isArray(content)) return null;
13673
- const parts = content.map((item) => {
13674
- if (!isRecord5(item)) return "";
13675
- if (item.type === "text" && typeof item.text === "string") {
13676
- return item.text;
13930
+ var MCP_APP_MESSAGE_MAX_BINARY_BYTES = 25 * 1024 * 1024;
13931
+ function normalizeMcpMimeType(value, fallback) {
13932
+ const mimeType = typeof value === "string" ? value.trim() : fallback;
13933
+ return mimeType && /^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/i.test(mimeType) ? mimeType.toLowerCase() : null;
13934
+ }
13935
+ function normalizeMcpBase64(value) {
13936
+ if (typeof value !== "string") return null;
13937
+ const data = value.replace(/\s/g, "");
13938
+ if (!data || data.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(data)) {
13939
+ return null;
13940
+ }
13941
+ return data;
13942
+ }
13943
+ function decodedBase64Bytes(data) {
13944
+ const padding = data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0;
13945
+ return data.length / 4 * 3 - padding;
13946
+ }
13947
+ function mcpMessageFile(data, mimeType, name) {
13948
+ return {
13949
+ name,
13950
+ originalName: name,
13951
+ mimeType,
13952
+ fileUrl: `data:${mimeType};base64,${data}`
13953
+ };
13954
+ }
13955
+ function resourceLabel(resource) {
13956
+ const details = {
13957
+ uri: readString3(resource.uri),
13958
+ mimeType: readString3(resource.mimeType)
13959
+ };
13960
+ return `[Resource ${stringifyToolResult(details)}]`;
13961
+ }
13962
+ function resourceLinkLabel(resourceLink) {
13963
+ const details = {
13964
+ uri: readString3(resourceLink.uri),
13965
+ name: readString3(resourceLink.name),
13966
+ description: readString3(resourceLink.description),
13967
+ mimeType: readString3(resourceLink.mimeType),
13968
+ size: typeof resourceLink.size === "number" ? resourceLink.size : void 0
13969
+ };
13970
+ return `[Resource link ${stringifyToolResult(details)}]`;
13971
+ }
13972
+ function contentBlocksToChatInput(content) {
13973
+ if (!Array.isArray(content)) {
13974
+ throw new Error("ui/message content must be an array");
13975
+ }
13976
+ const text = [];
13977
+ const files = [];
13978
+ let binaryBytes = 0;
13979
+ content.forEach((item, index) => {
13980
+ if (!isRecord5(item) || typeof item.type !== "string") {
13981
+ throw new Error(`ui/message content block ${index + 1} is invalid`);
13677
13982
  }
13678
- if (item.type === "resource_link" && typeof item.uri === "string") {
13679
- return item.uri;
13983
+ if (item.type === "text") {
13984
+ if (typeof item.text !== "string") {
13985
+ throw new Error(`ui/message text block ${index + 1} is invalid`);
13986
+ }
13987
+ if (item.text.length) text.push(item.text);
13988
+ return;
13680
13989
  }
13681
13990
  if (item.type === "image" || item.type === "audio") {
13682
- return `[${item.type}]`;
13991
+ const mimeType = normalizeMcpMimeType(item.mimeType);
13992
+ const data = normalizeMcpBase64(item.data);
13993
+ if (!mimeType || !data || !mimeType.startsWith(`${item.type}/`)) {
13994
+ throw new Error(
13995
+ `ui/message ${item.type} block ${index + 1} is invalid`
13996
+ );
13997
+ }
13998
+ binaryBytes += decodedBase64Bytes(data);
13999
+ files.push(
14000
+ mcpMessageFile(data, mimeType, `mcp-app-${item.type}-${index + 1}`)
14001
+ );
14002
+ return;
13683
14003
  }
13684
- return stringifyToolResult(item);
13685
- }).map((part) => part.trim()).filter(Boolean);
13686
- return parts.length ? parts.join("\n\n") : null;
14004
+ if (item.type === "resource") {
14005
+ const resource = readRecord(item.resource);
14006
+ if (!resource || typeof resource.uri !== "string") {
14007
+ throw new Error(`ui/message resource block ${index + 1} is invalid`);
14008
+ }
14009
+ const label = resourceLabel(resource);
14010
+ if (typeof resource.text === "string") {
14011
+ text.push(`${label}
14012
+ ${resource.text}`);
14013
+ return;
14014
+ }
14015
+ const data = normalizeMcpBase64(resource.blob);
14016
+ const mimeType = normalizeMcpMimeType(
14017
+ resource.mimeType,
14018
+ "application/octet-stream"
14019
+ );
14020
+ if (!data || !mimeType) {
14021
+ throw new Error(`ui/message resource block ${index + 1} is invalid`);
14022
+ }
14023
+ binaryBytes += decodedBase64Bytes(data);
14024
+ text.push(label);
14025
+ files.push(
14026
+ mcpMessageFile(data, mimeType, `mcp-app-resource-${index + 1}`)
14027
+ );
14028
+ return;
14029
+ }
14030
+ if (item.type === "resource_link" && typeof item.uri === "string") {
14031
+ text.push(resourceLinkLabel(item));
14032
+ return;
14033
+ }
14034
+ throw new Error(
14035
+ `ui/message content block ${index + 1} uses an unsupported type`
14036
+ );
14037
+ });
14038
+ if (binaryBytes > MCP_APP_MESSAGE_MAX_BINARY_BYTES) {
14039
+ throw new Error("ui/message binary content exceeds the 25 MiB limit");
14040
+ }
14041
+ if (!text.length && !files.length) {
14042
+ throw new Error("ui/message content is empty");
14043
+ }
14044
+ return {
14045
+ input: text.join("\n\n"),
14046
+ files
14047
+ };
13687
14048
  }
13688
14049
  function isMcpAppComponentData(data) {
13689
14050
  return isRecord5(data) && data.type === "McpApp" && typeof data.appInstanceId === "string" && typeof data.resourceUri === "string";
@@ -13691,68 +14052,205 @@ function isMcpAppComponentData(data) {
13691
14052
  function McpAppMessage({
13692
14053
  data,
13693
14054
  messageId,
13694
- className
14055
+ className,
14056
+ mcpApps
13695
14057
  }) {
13696
14058
  const { i18n: i18n2 } = useChatkitTranslation();
13697
- const {
13698
- apiUrl,
13699
- authenticatedFetch,
13700
- isLoading: streamIsLoading,
13701
- submit
13702
- } = useStreamContext();
14059
+ const { client, isLoading: streamIsLoading, submit } = useStreamContext();
13703
14060
  const iframeRef = React37.useRef(null);
14061
+ const appWindowRef = React37.useRef(null);
13704
14062
  const containerRef = React37.useRef(null);
13705
14063
  const initializedRef = React37.useRef(false);
13706
14064
  const sentInitialResultRef = React37.useRef(false);
13707
14065
  const modelContextRef = React37.useRef(null);
14066
+ const pendingApprovalRef = React37.useRef(null);
14067
+ const approvalActionRef = React37.useRef(null);
14068
+ const runtimeAppInstanceTokenRef = React37.useRef(
14069
+ data.appInstanceToken
14070
+ );
14071
+ const teardownGenerationRef = React37.useRef(0);
14072
+ const teardownStartedRef = React37.useRef(false);
14073
+ const activeAppInstanceIdRef = React37.useRef(data.appInstanceId);
13708
14074
  const [resource, setResource] = React37.useState(null);
13709
14075
  const [runtimeAppInstanceToken, setRuntimeAppInstanceToken] = React37.useState(data.appInstanceToken);
13710
14076
  const [srcDoc, setSrcDoc] = React37.useState(null);
13711
14077
  const [height, setHeight] = React37.useState(420);
14078
+ const [displayMode, setDisplayMode] = React37.useState("inline");
14079
+ const [pendingApproval, setPendingApproval] = React37.useState(null);
14080
+ const [approvalAction, setApprovalAction] = React37.useState(null);
14081
+ const [approvalError, setApprovalError] = React37.useState(null);
13712
14082
  const [error, setError] = React37.useState(null);
13713
14083
  const [isLoading, setIsLoading] = React37.useState(true);
13714
- const resourceUrl = React37.useMemo(
13715
- () => buildXpertApiUrl(
13716
- apiUrl,
13717
- buildMcpAppEndpointPath(data, "resource", {
13718
- messageId
13719
- })
13720
- ),
13721
- [apiUrl, data, messageId]
14084
+ const [isTornDown, setIsTornDown] = React37.useState(false);
14085
+ const sandboxProxy = React37.useMemo(
14086
+ () => resolveMcpAppSandboxProxy(mcpApps, resource?.domain ?? data.domain),
14087
+ [data.domain, mcpApps, resource?.domain]
13722
14088
  );
13723
- const rpcUrl = React37.useMemo(
13724
- () => buildXpertApiUrl(
13725
- apiUrl,
13726
- buildMcpAppEndpointPath(data, "rpc", {
13727
- appInstanceToken: runtimeAppInstanceToken,
13728
- messageId
13729
- })
13730
- ),
13731
- [apiUrl, data, messageId, runtimeAppInstanceToken]
14089
+ React37.useEffect(() => {
14090
+ runtimeAppInstanceTokenRef.current = runtimeAppInstanceToken;
14091
+ }, [runtimeAppInstanceToken]);
14092
+ const bindIframeRef = React37.useCallback(
14093
+ (iframe) => {
14094
+ iframeRef.current = iframe;
14095
+ if (iframe?.contentWindow) {
14096
+ appWindowRef.current = iframe.contentWindow;
14097
+ }
14098
+ },
14099
+ []
14100
+ );
14101
+ const postToApp = React37.useCallback(
14102
+ (message) => {
14103
+ iframeRef.current?.contentWindow?.postMessage(
14104
+ message,
14105
+ sandboxProxy?.origin ?? "*"
14106
+ );
14107
+ },
14108
+ [sandboxProxy?.origin]
13732
14109
  );
13733
- const postToApp = React37.useCallback((message) => {
13734
- iframeRef.current?.contentWindow?.postMessage(message, "*");
13735
- }, []);
13736
14110
  const callHostRpc = React37.useCallback(
13737
14111
  async (request) => {
13738
- const response = await authenticatedFetch(rpcUrl, {
13739
- method: "POST",
13740
- headers: {
13741
- "content-type": "application/json"
13742
- },
13743
- body: JSON.stringify({
14112
+ return client.mcp.apps.rpc(
14113
+ data.appInstanceId,
14114
+ {
13744
14115
  jsonrpc: "2.0",
13745
14116
  id: request.id ?? null,
13746
14117
  method: request.method,
13747
14118
  params: request.params
14119
+ },
14120
+ buildMcpAppReviveQuery(data, {
14121
+ appInstanceToken: runtimeAppInstanceToken,
14122
+ messageId
13748
14123
  })
14124
+ );
14125
+ },
14126
+ [client, data, messageId, runtimeAppInstanceToken]
14127
+ );
14128
+ const clearPendingApproval = React37.useCallback(() => {
14129
+ pendingApprovalRef.current = null;
14130
+ approvalActionRef.current = null;
14131
+ setPendingApproval(null);
14132
+ setApprovalAction(null);
14133
+ setApprovalError(null);
14134
+ }, []);
14135
+ const isSupersededStrictModeTeardown = React37.useCallback(
14136
+ (generation, appInstanceId) => teardownGenerationRef.current !== generation && activeAppInstanceIdRef.current === appInstanceId,
14137
+ []
14138
+ );
14139
+ const processHostRpcResponse = React37.useCallback(
14140
+ (request, response) => {
14141
+ const nextApproval = readMcpAppPendingApproval(response, request);
14142
+ if (nextApproval) {
14143
+ if (pendingApprovalRef.current) {
14144
+ postToApp(
14145
+ jsonRpcError(
14146
+ request.id,
14147
+ "Another MCP App approval request is already pending",
14148
+ -32004
14149
+ )
14150
+ );
14151
+ return;
14152
+ }
14153
+ pendingApprovalRef.current = nextApproval;
14154
+ setPendingApproval(nextApproval);
14155
+ setApprovalError(null);
14156
+ return;
14157
+ }
14158
+ const nextDisplayMode = readMcpAppDisplayMode(response);
14159
+ if (request.method === "ui/request-display-mode" && nextDisplayMode) {
14160
+ setDisplayMode(nextDisplayMode);
14161
+ }
14162
+ if (request.method === "ui/download-file" && isMcpAppRpcSuccess(response)) {
14163
+ try {
14164
+ triggerMcpAppDownloads(request.params);
14165
+ } catch (downloadError) {
14166
+ postToApp(
14167
+ jsonRpcError(request.id, getErrorMessage(downloadError), -32005)
14168
+ );
14169
+ return;
14170
+ }
14171
+ }
14172
+ postToApp(response);
14173
+ },
14174
+ [postToApp]
14175
+ );
14176
+ const dispatchHostRpc = React37.useCallback(
14177
+ async (request) => {
14178
+ try {
14179
+ processHostRpcResponse(request, await callHostRpc(request));
14180
+ } catch (rpcError) {
14181
+ postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
14182
+ }
14183
+ },
14184
+ [callHostRpc, postToApp, processHostRpcResponse]
14185
+ );
14186
+ const resolvePendingApproval = React37.useCallback(
14187
+ async (action) => {
14188
+ const approval = pendingApprovalRef.current;
14189
+ if (!approval || approvalActionRef.current) return;
14190
+ if (approval.expiresAt <= Date.now()) {
14191
+ clearPendingApproval();
14192
+ postToApp(
14193
+ jsonRpcError(
14194
+ approval.request.id,
14195
+ "The MCP App approval request expired",
14196
+ -32003
14197
+ )
14198
+ );
14199
+ return;
14200
+ }
14201
+ approvalActionRef.current = action;
14202
+ setApprovalAction(action);
14203
+ setApprovalError(null);
14204
+ const query = buildMcpAppReviveQuery(data, {
14205
+ appInstanceToken: runtimeAppInstanceToken,
14206
+ messageId
13749
14207
  });
13750
- if (!response.ok) {
13751
- throw new Error(`MCP App RPC failed with ${response.status}`);
14208
+ try {
14209
+ if (action === "reject") {
14210
+ await client.mcp.apps.reject(
14211
+ data.appInstanceId,
14212
+ approval.approvalId,
14213
+ query
14214
+ );
14215
+ clearPendingApproval();
14216
+ postToApp(
14217
+ jsonRpcError(
14218
+ approval.request.id,
14219
+ "The user rejected the MCP App action",
14220
+ -32002,
14221
+ { approvalId: approval.approvalId, rejected: true }
14222
+ )
14223
+ );
14224
+ return;
14225
+ }
14226
+ await client.mcp.apps.approve(
14227
+ data.appInstanceId,
14228
+ approval.approvalId,
14229
+ query
14230
+ );
14231
+ const retryRequest = withMcpAppApprovalId(
14232
+ approval.request,
14233
+ approval.approvalId
14234
+ );
14235
+ const response = await callHostRpc(retryRequest);
14236
+ clearPendingApproval();
14237
+ processHostRpcResponse(retryRequest, response);
14238
+ } catch (approvalRequestError) {
14239
+ approvalActionRef.current = null;
14240
+ setApprovalAction(null);
14241
+ setApprovalError(getErrorMessage(approvalRequestError));
13752
14242
  }
13753
- return response.json();
13754
14243
  },
13755
- [authenticatedFetch, rpcUrl]
14244
+ [
14245
+ callHostRpc,
14246
+ clearPendingApproval,
14247
+ client,
14248
+ data,
14249
+ messageId,
14250
+ postToApp,
14251
+ processHostRpcResponse,
14252
+ runtimeAppInstanceToken
14253
+ ]
13756
14254
  );
13757
14255
  const sendInitialToolNotifications = React37.useCallback(() => {
13758
14256
  if (!initializedRef.current || sentInitialResultRef.current || !resource) {
@@ -13785,28 +14283,35 @@ function McpAppMessage({
13785
14283
  const controller = new AbortController();
13786
14284
  initializedRef.current = false;
13787
14285
  sentInitialResultRef.current = false;
14286
+ pendingApprovalRef.current = null;
14287
+ approvalActionRef.current = null;
13788
14288
  setRuntimeAppInstanceToken(data.appInstanceToken);
14289
+ runtimeAppInstanceTokenRef.current = data.appInstanceToken;
14290
+ teardownStartedRef.current = false;
14291
+ setIsTornDown(false);
14292
+ setDisplayMode("inline");
14293
+ setPendingApproval(null);
14294
+ setApprovalAction(null);
14295
+ setApprovalError(null);
13789
14296
  setIsLoading(true);
13790
14297
  setError(null);
13791
14298
  setResource(null);
13792
14299
  setSrcDoc(null);
13793
14300
  void (async () => {
13794
14301
  try {
13795
- const response = await authenticatedFetch(resourceUrl, {
13796
- signal: controller.signal
13797
- });
13798
- if (!response.ok) {
13799
- throw new Error(`MCP App resource failed with ${response.status}`);
13800
- }
13801
- const payload = await response.json();
14302
+ const payload = await client.mcp.apps.getResource(
14303
+ data.appInstanceId,
14304
+ buildMcpAppReviveQuery(data, { messageId }),
14305
+ { signal: controller.signal }
14306
+ );
13802
14307
  const normalizedResource = normalizeMcpAppResourceResponse(
13803
14308
  payload,
13804
14309
  data
13805
14310
  );
13806
14311
  setResource(normalizedResource);
13807
- setRuntimeAppInstanceToken(
13808
- normalizedResource.appInstanceToken ?? data.appInstanceToken
13809
- );
14312
+ const nextAppInstanceToken = normalizedResource.appInstanceToken ?? data.appInstanceToken;
14313
+ runtimeAppInstanceTokenRef.current = nextAppInstanceToken;
14314
+ setRuntimeAppInstanceToken(nextAppInstanceToken);
13810
14315
  const hostLocale = normalizeHostLocale(i18n2.language);
13811
14316
  setSrcDoc(
13812
14317
  injectMcpAppTheme(
@@ -13831,26 +14336,131 @@ function McpAppMessage({
13831
14336
  controller.abort();
13832
14337
  };
13833
14338
  }, [
13834
- authenticatedFetch,
14339
+ client,
13835
14340
  data,
13836
14341
  data.appInstanceId,
13837
14342
  data.appInstanceToken,
13838
14343
  data.csp,
13839
14344
  i18n2.language,
13840
- resourceUrl
14345
+ messageId
14346
+ ]);
14347
+ React37.useEffect(() => {
14348
+ const generation = ++teardownGenerationRef.current;
14349
+ activeAppInstanceIdRef.current = data.appInstanceId;
14350
+ return () => {
14351
+ const appWindow = appWindowRef.current;
14352
+ const appOrigin = sandboxProxy?.origin ?? "*";
14353
+ const query = buildMcpAppReviveQuery(data, {
14354
+ appInstanceToken: runtimeAppInstanceTokenRef.current,
14355
+ messageId
14356
+ });
14357
+ const approval = pendingApprovalRef.current;
14358
+ queueMicrotask(() => {
14359
+ if (isSupersededStrictModeTeardown(generation, data.appInstanceId)) {
14360
+ return;
14361
+ }
14362
+ if (teardownStartedRef.current) {
14363
+ return;
14364
+ }
14365
+ teardownStartedRef.current = true;
14366
+ try {
14367
+ appWindow?.postMessage(
14368
+ {
14369
+ jsonrpc: "2.0",
14370
+ id: `xpert-teardown-${data.appInstanceId}`,
14371
+ method: "ui/resource-teardown",
14372
+ params: { reason: "host-unmount" }
14373
+ },
14374
+ appOrigin
14375
+ );
14376
+ } catch {
14377
+ }
14378
+ void (async () => {
14379
+ if (approval) {
14380
+ await client.mcp.apps.reject(data.appInstanceId, approval.approvalId, query).catch(() => void 0);
14381
+ }
14382
+ await client.mcp.apps.teardown(data.appInstanceId, query).catch(() => void 0);
14383
+ })();
14384
+ });
14385
+ };
14386
+ }, [
14387
+ client,
14388
+ data,
14389
+ data.appInstanceId,
14390
+ isSupersededStrictModeTeardown,
14391
+ messageId,
14392
+ sandboxProxy?.origin
13841
14393
  ]);
14394
+ React37.useEffect(() => {
14395
+ if (!pendingApproval) return;
14396
+ const remaining = pendingApproval.expiresAt - Date.now();
14397
+ if (remaining <= 0) {
14398
+ clearPendingApproval();
14399
+ postToApp(
14400
+ jsonRpcError(
14401
+ pendingApproval.request.id,
14402
+ "The MCP App approval request expired",
14403
+ -32003
14404
+ )
14405
+ );
14406
+ return;
14407
+ }
14408
+ const timeout = window.setTimeout(() => {
14409
+ if (pendingApprovalRef.current?.approvalId !== pendingApproval.approvalId) {
14410
+ return;
14411
+ }
14412
+ clearPendingApproval();
14413
+ postToApp(
14414
+ jsonRpcError(
14415
+ pendingApproval.request.id,
14416
+ "The MCP App approval request expired",
14417
+ -32003
14418
+ )
14419
+ );
14420
+ }, remaining);
14421
+ return () => window.clearTimeout(timeout);
14422
+ }, [clearPendingApproval, pendingApproval, postToApp]);
13842
14423
  React37.useEffect(() => {
13843
14424
  sendInitialToolNotifications();
13844
14425
  }, [sendInitialToolNotifications]);
14426
+ React37.useEffect(() => {
14427
+ if (!initializedRef.current) return;
14428
+ postToApp({
14429
+ jsonrpc: "2.0",
14430
+ method: "ui/notifications/host-context-changed",
14431
+ params: {
14432
+ displayMode,
14433
+ containerDimensions: getContainerDimensions(containerRef.current)
14434
+ }
14435
+ });
14436
+ }, [displayMode, height, postToApp]);
13845
14437
  React37.useEffect(() => {
13846
14438
  const handleMessage = async (event) => {
13847
14439
  if (event.source !== iframeRef.current?.contentWindow) {
13848
14440
  return;
13849
14441
  }
14442
+ if (sandboxProxy && event.origin !== sandboxProxy.origin) {
14443
+ return;
14444
+ }
13850
14445
  const request = normalizeJsonRpcMessage(event.data);
13851
14446
  if (!request?.method) {
13852
14447
  return;
13853
14448
  }
14449
+ if (request.method === "ui/notifications/sandbox-proxy-ready" && sandboxProxy && srcDoc) {
14450
+ const permissions = resource?.permissions ?? data.permissions;
14451
+ const csp = resource?.csp ?? data.csp;
14452
+ postToApp({
14453
+ jsonrpc: "2.0",
14454
+ method: "ui/notifications/sandbox-resource-ready",
14455
+ params: {
14456
+ html: srcDoc,
14457
+ sandbox: buildMcpAppInnerSandbox(sandboxProxy.dedicatedOrigin),
14458
+ ...csp ? { csp } : {},
14459
+ ...permissions ? { permissions } : {}
14460
+ }
14461
+ });
14462
+ return;
14463
+ }
13854
14464
  if (request.method === "ui/notifications/initialized") {
13855
14465
  initializedRef.current = true;
13856
14466
  sendInitialToolNotifications();
@@ -13863,6 +14473,39 @@ function McpAppMessage({
13863
14473
  }
13864
14474
  return;
13865
14475
  }
14476
+ if (request.method === "ui/notifications/request-teardown") {
14477
+ if (teardownStartedRef.current) {
14478
+ return;
14479
+ }
14480
+ teardownStartedRef.current = true;
14481
+ postToApp({
14482
+ jsonrpc: "2.0",
14483
+ id: `xpert-teardown-${data.appInstanceId}`,
14484
+ method: "ui/resource-teardown",
14485
+ params: { reason: "app-requested" }
14486
+ });
14487
+ const query = buildMcpAppReviveQuery(data, {
14488
+ appInstanceToken: runtimeAppInstanceTokenRef.current,
14489
+ messageId
14490
+ });
14491
+ const approval = pendingApprovalRef.current;
14492
+ try {
14493
+ if (approval) {
14494
+ await client.mcp.apps.reject(
14495
+ data.appInstanceId,
14496
+ approval.approvalId,
14497
+ query
14498
+ );
14499
+ }
14500
+ await client.mcp.apps.teardown(data.appInstanceId, query);
14501
+ clearPendingApproval();
14502
+ setIsTornDown(true);
14503
+ } catch (teardownError) {
14504
+ teardownStartedRef.current = false;
14505
+ setError(getErrorMessage(teardownError));
14506
+ }
14507
+ return;
14508
+ }
13866
14509
  if (request.method === "ui/initialize") {
13867
14510
  initializedRef.current = true;
13868
14511
  const permissions = resource?.permissions ?? data.permissions;
@@ -13886,7 +14529,11 @@ function McpAppMessage({
13886
14529
  openLinks: {},
13887
14530
  logging: {},
13888
14531
  message: {
13889
- text: {}
14532
+ text: {},
14533
+ image: {},
14534
+ audio: {},
14535
+ resource: {},
14536
+ resourceLink: {}
13890
14537
  },
13891
14538
  updateModelContext: {
13892
14539
  text: {},
@@ -13895,29 +14542,33 @@ function McpAppMessage({
13895
14542
  sandbox: {
13896
14543
  ...permissions ? { permissions } : {},
13897
14544
  ...csp ? { csp } : {}
13898
- }
14545
+ },
14546
+ downloadFile: {}
13899
14547
  },
13900
14548
  hostContext: {
13901
14549
  toolInfo,
13902
14550
  theme: theme.mode,
14551
+ styles: {
14552
+ variables: theme.cssVariables
14553
+ },
13903
14554
  themeCssVariables: theme.cssVariables,
13904
14555
  locale: hostLocale,
13905
14556
  language: hostLanguage,
13906
14557
  direction: hostDirection,
13907
14558
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
13908
- displayMode: "inline",
13909
- availableDisplayModes: ["inline"],
14559
+ displayMode,
14560
+ availableDisplayModes: ["inline", "fullscreen", "pip"],
13910
14561
  containerDimensions: getContainerDimensions(containerRef.current),
13911
14562
  userAgent: "xpert-chatkit",
13912
14563
  platform: "web",
13913
14564
  deviceCapabilities: {
13914
14565
  touch: navigator.maxTouchPoints > 0,
13915
- hover: window.matchMedia("(hover: hover)").matches
14566
+ hover: typeof window.matchMedia === "function" ? window.matchMedia("(hover: hover)").matches : false
13916
14567
  }
13917
14568
  },
13918
14569
  // Legacy compatibility for apps written before the 2026-01-26 result shape.
13919
14570
  capabilities: {
13920
- displayModes: ["inline"],
14571
+ displayModes: ["inline", "fullscreen", "pip"],
13921
14572
  serverTools: true,
13922
14573
  serverResources: true,
13923
14574
  openLinks: true
@@ -13930,8 +14581,8 @@ function McpAppMessage({
13930
14581
  language: hostLanguage,
13931
14582
  direction: hostDirection,
13932
14583
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
13933
- displayMode: "inline",
13934
- availableDisplayModes: ["inline"],
14584
+ displayMode,
14585
+ availableDisplayModes: ["inline", "fullscreen", "pip"],
13935
14586
  containerDimensions: getContainerDimensions(containerRef.current),
13936
14587
  userAgent: navigator.userAgent,
13937
14588
  platform: navigator.platform
@@ -13943,20 +14594,33 @@ function McpAppMessage({
13943
14594
  }
13944
14595
  if (request.method === "ui/open-link") {
13945
14596
  const href = isRecord5(request.params) && typeof request.params.url === "string" ? request.params.url : isRecord5(request.params) && typeof request.params.href === "string" ? request.params.href : null;
13946
- if (href && isHttpUrl(href)) {
13947
- window.open(href, "_blank", "noopener,noreferrer");
14597
+ if (!href || !isHttpUrl2(href)) {
13948
14598
  if (request.id !== void 0) {
13949
- postToApp(jsonRpcResult(request.id, {}));
14599
+ postToApp(jsonRpcError(request.id, "Invalid URL"));
13950
14600
  }
13951
- } else if (request.id !== void 0) {
13952
- postToApp(jsonRpcResult(request.id, { isError: true }));
14601
+ return;
14602
+ }
14603
+ try {
14604
+ const response = await callHostRpc({
14605
+ ...request,
14606
+ params: { url: href }
14607
+ });
14608
+ if (isMcpAppRpcSuccess(response)) {
14609
+ window.open(href, "_blank", "noopener,noreferrer");
14610
+ }
14611
+ postToApp(response);
14612
+ } catch (linkError) {
14613
+ postToApp(jsonRpcError(request.id, getErrorMessage(linkError)));
13953
14614
  }
13954
14615
  return;
13955
14616
  }
13956
14617
  if (request.method === "ui/update-model-context") {
13957
- modelContextRef.current = request.params;
13958
14618
  try {
13959
- postToApp(await callHostRpc(request));
14619
+ const response = await callHostRpc(request);
14620
+ if (isMcpAppRpcSuccess(response)) {
14621
+ modelContextRef.current = request.params;
14622
+ }
14623
+ postToApp(response);
13960
14624
  } catch (rpcError) {
13961
14625
  postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
13962
14626
  }
@@ -13974,14 +14638,12 @@ function McpAppMessage({
13974
14638
  postToApp(hostResponse);
13975
14639
  return;
13976
14640
  }
13977
- const inputText = contentBlocksToText(request.params.content);
13978
- if (!inputText) {
13979
- throw new Error("ui/message content did not include text");
13980
- }
14641
+ const messageInput = contentBlocksToChatInput(request.params.content);
13981
14642
  await submit(
13982
14643
  {
13983
14644
  input: {
13984
- input: inputText
14645
+ input: messageInput.input,
14646
+ ...messageInput.files.length ? { files: messageInput.files } : {}
13985
14647
  }
13986
14648
  },
13987
14649
  {
@@ -14006,11 +14668,7 @@ function McpAppMessage({
14006
14668
  if (request.id === void 0 && request.method.startsWith("ui/")) {
14007
14669
  return;
14008
14670
  }
14009
- try {
14010
- postToApp(await callHostRpc(request));
14011
- } catch (rpcError) {
14012
- postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
14013
- }
14671
+ await dispatchHostRpc(request);
14014
14672
  };
14015
14673
  window.addEventListener("message", handleMessage);
14016
14674
  return () => {
@@ -14018,19 +14676,20 @@ function McpAppMessage({
14018
14676
  };
14019
14677
  }, [
14020
14678
  callHostRpc,
14021
- data.appInstanceId,
14022
- data.csp,
14023
- data.permissions,
14024
- data.resourceUri,
14025
- data.title,
14026
- data.toolCallId,
14027
- data.toolName,
14679
+ clearPendingApproval,
14680
+ client,
14681
+ data,
14682
+ dispatchHostRpc,
14683
+ displayMode,
14028
14684
  i18n2.language,
14685
+ messageId,
14029
14686
  postToApp,
14030
14687
  resource?.csp,
14031
14688
  resource?.permissions,
14032
14689
  resource?.toolInfo,
14690
+ sandboxProxy,
14033
14691
  sendInitialToolNotifications,
14692
+ srcDoc,
14034
14693
  streamIsLoading,
14035
14694
  submit
14036
14695
  ]);
@@ -14039,7 +14698,7 @@ function McpAppMessage({
14039
14698
  () => buildIframeAllow(iframePermissions),
14040
14699
  [iframePermissions]
14041
14700
  );
14042
- const sandbox = React37.useMemo(() => buildSandboxAttribute(), []);
14701
+ const sandbox = sandboxProxy ? "allow-scripts allow-same-origin" : buildSandboxAttribute();
14043
14702
  const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
14044
14703
  const displayTitle = (0, import_chatkit_types11.resolveLocalizedText)(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
14045
14704
  const displayDescription = (0, import_chatkit_types11.resolveLocalizedText)(
@@ -14047,56 +14706,212 @@ function McpAppMessage({
14047
14706
  i18n2.language
14048
14707
  );
14049
14708
  const displayIcon = resource?.icon ?? data.icon;
14050
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14051
- "div",
14052
- {
14053
- ref: containerRef,
14054
- className: cn(
14055
- "overflow-hidden rounded-lg border bg-background shadow-sm",
14056
- !prefersBorder && "border-transparent shadow-none",
14057
- className
14058
- ),
14059
- children: [
14060
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
14061
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
14062
- displayIcon ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14063
- IconDefinitionRenderer,
14064
- {
14065
- icon: displayIcon,
14066
- size: 18,
14067
- className: "shrink-0",
14068
- decorative: true
14069
- }
14070
- ) : null,
14071
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0", children: [
14072
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "truncate text-sm font-medium", children: displayTitle }),
14073
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
14709
+ const elevatedDisplayMode = displayMode !== "inline";
14710
+ if (isTornDown) {
14711
+ return null;
14712
+ }
14713
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
14714
+ displayMode === "fullscreen" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14715
+ "div",
14716
+ {
14717
+ "aria-hidden": "true",
14718
+ className: "fixed inset-0 z-[79] bg-background/80 backdrop-blur-sm"
14719
+ }
14720
+ ) : null,
14721
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14722
+ "div",
14723
+ {
14724
+ ref: containerRef,
14725
+ "data-display-mode": displayMode,
14726
+ className: cn(
14727
+ "relative flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",
14728
+ displayMode === "fullscreen" && "fixed inset-4 z-[80] shadow-2xl",
14729
+ displayMode === "pip" && "fixed right-4 bottom-4 z-[80] h-[min(640px,calc(100vh-2rem))] w-[min(480px,calc(100vw-2rem))] shadow-2xl",
14730
+ !prefersBorder && "border-transparent shadow-none",
14731
+ className
14732
+ ),
14733
+ children: [
14734
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
14735
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
14736
+ displayIcon ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14737
+ IconDefinitionRenderer,
14738
+ {
14739
+ icon: displayIcon,
14740
+ size: 18,
14741
+ className: "shrink-0",
14742
+ decorative: true
14743
+ }
14744
+ ) : null,
14745
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0", children: [
14746
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "truncate text-sm font-medium", children: displayTitle }),
14747
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
14748
+ ] })
14749
+ ] }),
14750
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
14751
+ displayMode !== "fullscreen" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14752
+ Button,
14753
+ {
14754
+ type: "button",
14755
+ variant: "ghost",
14756
+ size: "icon-xs",
14757
+ title: i18n2.t("message.mcpApp.fullscreen"),
14758
+ "aria-label": i18n2.t("message.mcpApp.fullscreen"),
14759
+ onClick: () => setDisplayMode("fullscreen"),
14760
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Maximize2, {})
14761
+ }
14762
+ ) : null,
14763
+ displayMode !== "pip" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14764
+ Button,
14765
+ {
14766
+ type: "button",
14767
+ variant: "ghost",
14768
+ size: "icon-xs",
14769
+ title: i18n2.t("message.mcpApp.pictureInPicture"),
14770
+ "aria-label": i18n2.t("message.mcpApp.pictureInPicture"),
14771
+ onClick: () => setDisplayMode("pip"),
14772
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.PictureInPicture2, {})
14773
+ }
14774
+ ) : null,
14775
+ elevatedDisplayMode ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14776
+ Button,
14777
+ {
14778
+ type: "button",
14779
+ variant: "ghost",
14780
+ size: "icon-xs",
14781
+ title: i18n2.t("message.mcpApp.returnInline"),
14782
+ "aria-label": i18n2.t("message.mcpApp.returnInline"),
14783
+ onClick: () => setDisplayMode("inline"),
14784
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Minimize2, {})
14785
+ }
14786
+ ) : null,
14787
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Badge, { variant: "secondary", className: "ml-1 rounded-md", children: "MCP App" })
14074
14788
  ] })
14075
14789
  ] }),
14076
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
14077
- ] }),
14078
- isLoading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
14079
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Loader2, { className: "h-4 w-4 animate-spin" }),
14080
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: i18n2.t("message.mcpApp.loading") })
14081
- ] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
14082
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.AlertCircle, { className: "h-4 w-4 shrink-0" }),
14083
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "min-w-0 break-words", children: error })
14084
- ] }) : srcDoc ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14085
- "iframe",
14086
- {
14087
- ref: iframeRef,
14088
- title: displayTitle,
14089
- srcDoc,
14090
- className: "block w-full bg-background",
14091
- style: { height },
14092
- sandbox,
14093
- allow: iframeAllow,
14094
- referrerPolicy: "no-referrer"
14095
- }
14096
- ) : null
14097
- ]
14098
- }
14099
- );
14790
+ pendingApproval ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14791
+ "div",
14792
+ {
14793
+ role: "alertdialog",
14794
+ "aria-modal": "true",
14795
+ "aria-labelledby": `mcp-app-approval-${pendingApproval.approvalId}`,
14796
+ className: "absolute inset-0 z-20 flex items-center justify-center bg-background/90 p-4 backdrop-blur-sm",
14797
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex max-h-full w-full max-w-lg flex-col gap-4 overflow-hidden rounded-lg border bg-background p-4 shadow-xl", children: [
14798
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-start gap-3", children: [
14799
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "rounded-full bg-destructive/10 p-2 text-destructive", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.ShieldAlert, { className: "size-5" }) }),
14800
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0 flex-1", children: [
14801
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
14802
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14803
+ "h3",
14804
+ {
14805
+ id: `mcp-app-approval-${pendingApproval.approvalId}`,
14806
+ className: "text-sm font-semibold",
14807
+ children: i18n2.t("message.mcpApp.approvalTitle")
14808
+ }
14809
+ ),
14810
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14811
+ Badge,
14812
+ {
14813
+ variant: "outline",
14814
+ className: "border-destructive/40 text-destructive",
14815
+ children: pendingApproval.risk
14816
+ }
14817
+ )
14818
+ ] }),
14819
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: i18n2.t(
14820
+ pendingApproval.kind === "download" ? "message.mcpApp.downloadApprovalDescription" : "message.mcpApp.toolApprovalDescription",
14821
+ { tool: pendingApproval.toolName }
14822
+ ) })
14823
+ ] })
14824
+ ] }),
14825
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-h-0", children: [
14826
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "mb-1 text-xs font-medium", children: i18n2.t("message.mcpApp.requestDetails") }),
14827
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("pre", { className: "max-h-48 overflow-auto rounded-md border bg-muted/40 p-3 text-[11px] leading-5 whitespace-pre-wrap break-all", children: pendingApproval.details })
14828
+ ] }),
14829
+ approvalError ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14830
+ "div",
14831
+ {
14832
+ role: "alert",
14833
+ className: "flex items-start gap-2 text-xs text-destructive",
14834
+ children: [
14835
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.AlertCircle, { className: "mt-0.5 size-4 shrink-0" }),
14836
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: approvalError })
14837
+ ]
14838
+ }
14839
+ ) : null,
14840
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-end gap-2", children: [
14841
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14842
+ Button,
14843
+ {
14844
+ type: "button",
14845
+ variant: "outline",
14846
+ disabled: approvalAction !== null,
14847
+ onClick: () => void resolvePendingApproval("reject"),
14848
+ children: [
14849
+ approvalAction === "reject" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Loader2, { className: "animate-spin" }) : null,
14850
+ i18n2.t("message.mcpApp.reject")
14851
+ ]
14852
+ }
14853
+ ),
14854
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14855
+ Button,
14856
+ {
14857
+ type: "button",
14858
+ variant: pendingApproval.risk === "destructive" ? "destructive" : "default",
14859
+ disabled: approvalAction !== null,
14860
+ onClick: () => void resolvePendingApproval("approve"),
14861
+ children: [
14862
+ approvalAction === "approve" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Loader2, { className: "animate-spin" }) : null,
14863
+ i18n2.t("message.mcpApp.approve")
14864
+ ]
14865
+ }
14866
+ )
14867
+ ] })
14868
+ ] })
14869
+ }
14870
+ ) : null,
14871
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14872
+ "div",
14873
+ {
14874
+ className: cn(
14875
+ "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground",
14876
+ elevatedDisplayMode && "min-h-0 flex-1"
14877
+ ),
14878
+ children: [
14879
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Loader2, { className: "h-4 w-4 animate-spin" }),
14880
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: i18n2.t("message.mcpApp.loading") })
14881
+ ]
14882
+ }
14883
+ ) : error ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14884
+ "div",
14885
+ {
14886
+ className: cn(
14887
+ "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive",
14888
+ elevatedDisplayMode && "min-h-0 flex-1"
14889
+ ),
14890
+ children: [
14891
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.AlertCircle, { className: "h-4 w-4 shrink-0" }),
14892
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "min-w-0 break-words", children: error })
14893
+ ]
14894
+ }
14895
+ ) : srcDoc ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14896
+ "iframe",
14897
+ {
14898
+ ref: bindIframeRef,
14899
+ title: displayTitle,
14900
+ ...sandboxProxy ? { src: sandboxProxy.url } : { srcDoc },
14901
+ className: cn(
14902
+ "block w-full bg-background",
14903
+ elevatedDisplayMode && "min-h-0 flex-1"
14904
+ ),
14905
+ style: elevatedDisplayMode ? void 0 : { height },
14906
+ sandbox,
14907
+ allow: iframeAllow,
14908
+ referrerPolicy: "no-referrer"
14909
+ }
14910
+ ) : null
14911
+ ]
14912
+ }
14913
+ )
14914
+ ] });
14100
14915
  }
14101
14916
 
14102
14917
  // src/components/thread/messages/ai.tsx
@@ -14384,7 +15199,14 @@ function renderContentItem(content, index, message, lookupMessages, options) {
14384
15199
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
14385
15200
  }
14386
15201
  if (isMcpAppComponent(content)) {
14387
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(McpAppMessage, { messageId, data: content.data }) }, content.id ?? `mcp-app-${index}`);
15202
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
15203
+ McpAppMessage,
15204
+ {
15205
+ messageId,
15206
+ data: content.data,
15207
+ mcpApps: options?.mcpApps
15208
+ }
15209
+ ) }, content.id ?? `mcp-app-${index}`);
14388
15210
  }
14389
15211
  if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
14390
15212
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
@@ -14414,7 +15236,8 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
14414
15236
  isThreadRunning: options?.isThreadRunning,
14415
15237
  organizationId: options?.organizationId,
14416
15238
  apiUrl: options?.apiUrl,
14417
- isAgentOutput: options?.isAgentOutput
15239
+ isAgentOutput: options?.isAgentOutput,
15240
+ mcpApps: options?.mcpApps
14418
15241
  });
14419
15242
  }
14420
15243
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
@@ -14565,7 +15388,8 @@ function AssistantMessage({
14565
15388
  isThreadRunning,
14566
15389
  organizationId,
14567
15390
  apiUrl,
14568
- pet
15391
+ pet,
15392
+ mcpApps
14569
15393
  }) {
14570
15394
  const { t } = useChatkitTranslation();
14571
15395
  const renderTree = buildAssistantRenderTree(
@@ -14581,7 +15405,8 @@ function AssistantMessage({
14581
15405
  const answerNode = renderContent(message, lookupMessages, {
14582
15406
  isThreadRunning,
14583
15407
  organizationId,
14584
- apiUrl
15408
+ apiUrl,
15409
+ mcpApps
14585
15410
  });
14586
15411
  const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
14587
15412
  if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
@@ -20498,7 +21323,8 @@ function Chat({
20498
21323
  isThreadRunning: currentThreadIsRunning,
20499
21324
  organizationId: stream.organizationId,
20500
21325
  apiUrl: stream.apiUrl,
20501
- pet: effectivePet
21326
+ pet: effectivePet,
21327
+ mcpApps: options?.mcpApps
20502
21328
  }
20503
21329
  ) : /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
20504
21330
  message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(