@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.js CHANGED
@@ -2479,7 +2479,16 @@ var en_US_default = {
2479
2479
  moreTags: "+{{count}}"
2480
2480
  },
2481
2481
  mcpApp: {
2482
- loading: "Loading MCP App"
2482
+ loading: "Loading MCP App",
2483
+ fullscreen: "Open fullscreen",
2484
+ pictureInPicture: "Open picture in picture",
2485
+ returnInline: "Return inline",
2486
+ approvalTitle: "Confirm MCP App action",
2487
+ toolApprovalDescription: 'The app wants to run "{{tool}}". Review the request before allowing it.',
2488
+ downloadApprovalDescription: "The app wants to download files to this device. Review the file details before allowing it.",
2489
+ requestDetails: "Request details",
2490
+ approve: "Allow",
2491
+ reject: "Reject"
2483
2492
  },
2484
2493
  contextCompression: {
2485
2494
  running: "Automatically compressing context",
@@ -2962,7 +2971,16 @@ var zh_CN_default = {
2962
2971
  moreTags: "+{{count}}"
2963
2972
  },
2964
2973
  mcpApp: {
2965
- loading: "\u6B63\u5728\u52A0\u8F7D MCP App"
2974
+ loading: "\u6B63\u5728\u52A0\u8F7D MCP App",
2975
+ fullscreen: "\u5168\u5C4F\u663E\u793A",
2976
+ pictureInPicture: "\u753B\u4E2D\u753B\u663E\u793A",
2977
+ returnInline: "\u8FD4\u56DE\u884C\u5185\u663E\u793A",
2978
+ approvalTitle: "\u786E\u8BA4 MCP App \u64CD\u4F5C",
2979
+ 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",
2980
+ 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",
2981
+ requestDetails: "\u8BF7\u6C42\u8BE6\u60C5",
2982
+ approve: "\u5141\u8BB8",
2983
+ reject: "\u62D2\u7EDD"
2966
2984
  },
2967
2985
  contextCompression: {
2968
2986
  running: "\u6B63\u5728\u81EA\u52A8\u538B\u7F29\u4E0A\u4E0B\u6587",
@@ -5835,8 +5853,8 @@ function JsonTreeNode({
5835
5853
  depth = 0
5836
5854
  }) {
5837
5855
  const isArray = Array.isArray(value);
5838
- const isObject2 = isJsonObjectValue(value);
5839
- const isExpandable = isArray || isObject2;
5856
+ const isObject3 = isJsonObjectValue(value);
5857
+ const isExpandable = isArray || isObject3;
5840
5858
  const [isExpanded, setIsExpanded] = React18.useState(depth < 2);
5841
5859
  if (!isExpandable) {
5842
5860
  return /* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 gap-2 leading-6", children: [
@@ -9629,8 +9647,8 @@ function getFallbackPalette(isDarkMode) {
9629
9647
  text: "#18181b"
9630
9648
  };
9631
9649
  }
9632
- function resolveColor(styles, property, fallback, background) {
9633
- const parsed = parseCssColor(styles.getPropertyValue(property));
9650
+ function resolveColor(styles, property2, fallback, background) {
9651
+ const parsed = parseCssColor(styles.getPropertyValue(property2));
9634
9652
  if (!parsed) return fallback;
9635
9653
  if (parsed.a < 1 && background) {
9636
9654
  return rgbaToHex(compositeColor(parsed, background));
@@ -13207,15 +13225,15 @@ function getObjectProperty(value, key) {
13207
13225
  if (!isPlainObject2(value)) {
13208
13226
  return void 0;
13209
13227
  }
13210
- const property = value[key];
13211
- return isPlainObject2(property) ? property : void 0;
13228
+ const property2 = value[key];
13229
+ return isPlainObject2(property2) ? property2 : void 0;
13212
13230
  }
13213
13231
  function getStringProperty(value, key) {
13214
13232
  if (!isPlainObject2(value)) {
13215
13233
  return void 0;
13216
13234
  }
13217
- const property = value[key];
13218
- return typeof property === "string" ? property : void 0;
13235
+ const property2 = value[key];
13236
+ return typeof property2 === "string" ? property2 : void 0;
13219
13237
  }
13220
13238
  function isPlainObject2(value) {
13221
13239
  return !!value && typeof value === "object" && !Array.isArray(value);
@@ -13229,8 +13247,232 @@ import * as React37 from "react";
13229
13247
  import {
13230
13248
  resolveLocalizedText as resolveLocalizedText3
13231
13249
  } from "@xpert-ai/chatkit-types";
13232
- import { AlertCircle as AlertCircle2, Loader2 as Loader28 } from "lucide-react";
13233
- import { jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
13250
+ import {
13251
+ AlertCircle as AlertCircle2,
13252
+ Loader2 as Loader28,
13253
+ Maximize2,
13254
+ Minimize2,
13255
+ PictureInPicture2,
13256
+ ShieldAlert
13257
+ } from "lucide-react";
13258
+
13259
+ // src/components/thread/messages/mcp-app/host.ts
13260
+ function isObject2(value) {
13261
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
13262
+ }
13263
+ function property(value, key) {
13264
+ return Reflect.get(value, key);
13265
+ }
13266
+ function stringProperty(value, key) {
13267
+ const field = property(value, key);
13268
+ return typeof field === "string" && field.trim() ? field.trim() : void 0;
13269
+ }
13270
+ function isMcpAppRpcSuccess(value) {
13271
+ return isObject2(value) && Reflect.has(value, "result") && !Reflect.has(value, "error");
13272
+ }
13273
+ function readMcpAppDisplayMode(value) {
13274
+ if (!isObject2(value)) return void 0;
13275
+ const result = property(value, "result");
13276
+ if (!isObject2(result)) return void 0;
13277
+ const mode = property(result, "mode");
13278
+ if (mode === "picture-in-picture") return "pip";
13279
+ return mode === "inline" || mode === "fullscreen" || mode === "pip" ? mode : void 0;
13280
+ }
13281
+ function readMcpAppPendingApproval(response, request) {
13282
+ if (!isObject2(response)) return null;
13283
+ const error = property(response, "error");
13284
+ if (!isObject2(error) || property(error, "code") !== -32001) return null;
13285
+ const data = property(error, "data");
13286
+ if (!isObject2(data)) return null;
13287
+ const approvalId = stringProperty(data, "approvalId");
13288
+ const risk = property(data, "risk");
13289
+ const expiresAt = property(data, "expiresAt");
13290
+ if (!approvalId || risk !== "write" && risk !== "destructive" || typeof expiresAt !== "number" || !Number.isFinite(expiresAt)) {
13291
+ return null;
13292
+ }
13293
+ const params = isObject2(request.params) ? request.params : void 0;
13294
+ const requestedTool = params ? stringProperty(params, "name") : void 0;
13295
+ const kind = request.method === "ui/download-file" ? "download" : "tool";
13296
+ return {
13297
+ approvalId,
13298
+ risk,
13299
+ expiresAt,
13300
+ toolName: kind === "download" ? "ui/download-file" : requestedTool ?? request.method ?? "tools/call",
13301
+ kind,
13302
+ request,
13303
+ details: kind === "download" ? formatDownloadApprovalDetails(request.params) : formatApprovalDetails(request.params)
13304
+ };
13305
+ }
13306
+ function withMcpAppApprovalId(request, approvalId) {
13307
+ return {
13308
+ ...request,
13309
+ params: {
13310
+ ...isObject2(request.params) ? request.params : {},
13311
+ approvalId
13312
+ }
13313
+ };
13314
+ }
13315
+ function formatApprovalDetails(value) {
13316
+ try {
13317
+ const text = JSON.stringify(redactSensitiveValue(value, 0), null, 2);
13318
+ if (!text) return "{}";
13319
+ return text.length > 4e3 ? `${text.slice(0, 4e3)}
13320
+ \u2026` : text;
13321
+ } catch {
13322
+ return "[Request details unavailable]";
13323
+ }
13324
+ }
13325
+ function redactSensitiveValue(value, depth) {
13326
+ if (depth >= 6) return "[Nested value omitted]";
13327
+ if (typeof value === "string" && value.length > 1e3) {
13328
+ return `${value.slice(0, 1e3)}\u2026 [${value.length} characters]`;
13329
+ }
13330
+ if (Array.isArray(value)) {
13331
+ return value.slice(0, 20).map((item) => redactSensitiveValue(item, depth + 1));
13332
+ }
13333
+ if (!isObject2(value)) return value;
13334
+ const output = {};
13335
+ for (const [key, field] of Object.entries(value).slice(0, 50)) {
13336
+ output[key] = /password|secret|token|authorization|api[-_]?key/i.test(key) ? "[Redacted]" : redactSensitiveValue(field, depth + 1);
13337
+ }
13338
+ return output;
13339
+ }
13340
+ function formatDownloadApprovalDetails(value) {
13341
+ if (!isObject2(value)) return "{}";
13342
+ const contents = property(value, "contents");
13343
+ if (!Array.isArray(contents)) return "{}";
13344
+ const summary = contents.slice(0, 20).map((item) => {
13345
+ if (!isObject2(item)) return { type: "invalid" };
13346
+ if (property(item, "type") === "resource_link") {
13347
+ return {
13348
+ type: "resource_link",
13349
+ name: stringProperty(item, "name"),
13350
+ uri: stringProperty(item, "uri"),
13351
+ mimeType: stringProperty(item, "mimeType")
13352
+ };
13353
+ }
13354
+ const resource = property(item, "resource");
13355
+ if (!isObject2(resource)) return { type: property(item, "type") };
13356
+ const text = property(resource, "text");
13357
+ const blob = property(resource, "blob");
13358
+ return {
13359
+ type: "resource",
13360
+ name: stringProperty(resource, "name"),
13361
+ uri: stringProperty(resource, "uri"),
13362
+ mimeType: stringProperty(resource, "mimeType"),
13363
+ size: typeof text === "string" ? `${new TextEncoder().encode(text).byteLength} bytes` : typeof blob === "string" ? `approximately ${Math.floor(blob.length * 3 / 4)} bytes` : void 0
13364
+ };
13365
+ });
13366
+ return JSON.stringify({ files: summary }, null, 2);
13367
+ }
13368
+ function triggerMcpAppDownloads(value) {
13369
+ const downloads = parseDownloadItems(value);
13370
+ for (const download of downloads) {
13371
+ if (download.kind === "link") {
13372
+ clickDownload(download.uri, download.filename);
13373
+ continue;
13374
+ }
13375
+ const blob = new Blob(
13376
+ [
13377
+ download.text !== void 0 ? download.text : decodeBase64(download.blob ?? "")
13378
+ ],
13379
+ { type: download.mimeType }
13380
+ );
13381
+ const url = URL.createObjectURL(blob);
13382
+ clickDownload(url, download.filename);
13383
+ window.setTimeout(() => URL.revokeObjectURL(url), 0);
13384
+ }
13385
+ }
13386
+ function parseDownloadItems(value) {
13387
+ if (!isObject2(value)) throw new Error("Download params must be an object");
13388
+ if (property(value, "isError") === true) {
13389
+ throw new Error("The MCP App reported that the download failed");
13390
+ }
13391
+ const contents = property(value, "contents");
13392
+ if (!Array.isArray(contents) || contents.length === 0) {
13393
+ throw new Error("Download contents must be a non-empty array");
13394
+ }
13395
+ return contents.map((item, index) => {
13396
+ if (!isObject2(item)) throw new Error("Download content is invalid");
13397
+ const type = property(item, "type");
13398
+ if (type === "resource_link") {
13399
+ const uri2 = stringProperty(item, "uri");
13400
+ const name = stringProperty(item, "name");
13401
+ if (!uri2 || !name || !isHttpUrl(uri2)) {
13402
+ throw new Error(
13403
+ "Download link must use HTTP or HTTPS and include a name"
13404
+ );
13405
+ }
13406
+ return {
13407
+ kind: "link",
13408
+ filename: sanitizeFilename(name, index),
13409
+ uri: uri2
13410
+ };
13411
+ }
13412
+ if (type !== "resource") {
13413
+ throw new Error("Download content type is unsupported");
13414
+ }
13415
+ const resource = property(item, "resource");
13416
+ if (!isObject2(resource)) throw new Error("Embedded download is invalid");
13417
+ const uri = stringProperty(resource, "uri");
13418
+ if (!uri) throw new Error("Embedded download URI is required");
13419
+ const text = property(resource, "text");
13420
+ const blob = property(resource, "blob");
13421
+ if (typeof text !== "string" && typeof blob !== "string") {
13422
+ throw new Error("Embedded download must include text or base64 data");
13423
+ }
13424
+ const common = {
13425
+ kind: "embedded",
13426
+ filename: sanitizeFilename(
13427
+ stringProperty(resource, "name") ?? filenameFromUri(uri),
13428
+ index
13429
+ ),
13430
+ mimeType: stringProperty(resource, "mimeType") ?? "application/octet-stream"
13431
+ };
13432
+ return typeof text === "string" ? { ...common, text } : { ...common, blob };
13433
+ });
13434
+ }
13435
+ function decodeBase64(value) {
13436
+ const decoded = window.atob(value);
13437
+ return Uint8Array.from(decoded, (character) => character.charCodeAt(0));
13438
+ }
13439
+ function filenameFromUri(uri) {
13440
+ try {
13441
+ const pathname = new URL(uri).pathname;
13442
+ const segment = pathname.split("/").filter(Boolean).at(-1);
13443
+ return segment ? decodeURIComponent(segment) : "download";
13444
+ } catch {
13445
+ return uri.split("/").filter(Boolean).at(-1) ?? "download";
13446
+ }
13447
+ }
13448
+ function sanitizeFilename(value, index) {
13449
+ const sanitized = Array.from(
13450
+ value,
13451
+ (character) => character.charCodeAt(0) <= 31 || /[\\/:*?"<>|]/.test(character) ? "_" : character
13452
+ ).join("").trim().slice(0, 255);
13453
+ return sanitized || `download-${index + 1}`;
13454
+ }
13455
+ function isHttpUrl(value) {
13456
+ try {
13457
+ const url = new URL(value);
13458
+ return url.protocol === "http:" || url.protocol === "https:";
13459
+ } catch {
13460
+ return false;
13461
+ }
13462
+ }
13463
+ function clickDownload(uri, filename) {
13464
+ const anchor = document.createElement("a");
13465
+ anchor.href = uri;
13466
+ anchor.download = filename;
13467
+ anchor.rel = "noopener noreferrer";
13468
+ anchor.hidden = true;
13469
+ document.body.append(anchor);
13470
+ anchor.click();
13471
+ anchor.remove();
13472
+ }
13473
+
13474
+ // src/components/thread/messages/mcp-app.tsx
13475
+ import { Fragment as Fragment8, jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
13234
13476
  var EMPTY_INPUT_SCHEMA = {
13235
13477
  type: "object",
13236
13478
  properties: {}
@@ -13262,53 +13504,28 @@ function readIconDefinition(value) {
13262
13504
  }
13263
13505
  function readStringList(value) {
13264
13506
  if (!Array.isArray(value)) return void 0;
13265
- const strings = value.filter((item) => typeof item === "string");
13507
+ const strings = value.filter(
13508
+ (item) => typeof item === "string"
13509
+ );
13266
13510
  return strings.length ? strings : void 0;
13267
13511
  }
13268
- function buildXpertApiUrl(apiUrl, path) {
13269
- const normalizedApiUrl = apiUrl.trim();
13270
- if (!normalizedApiUrl) return path;
13271
- try {
13272
- const url = new URL(normalizedApiUrl);
13273
- return `${url.origin}${path}`;
13274
- } catch {
13275
- return path;
13276
- }
13277
- }
13278
- function appendQuery(path, params) {
13279
- const query = params.toString();
13280
- return query ? `${path}?${query}` : path;
13281
- }
13282
- function buildMcpAppReviveParams(data, options) {
13283
- const params = new URLSearchParams();
13284
- const add = (key, value) => {
13285
- if (value) {
13286
- params.set(key, value);
13287
- }
13512
+ function buildMcpAppReviveQuery(data, options) {
13513
+ return {
13514
+ toolsetId: data.toolsetId,
13515
+ serverName: data.serverName,
13516
+ toolName: data.toolName,
13517
+ toolCallId: data.toolCallId,
13518
+ resourceUri: data.resourceUri,
13519
+ title: typeof data.title === "string" ? data.title : void 0,
13520
+ messageId: options?.messageId,
13521
+ token: options?.appInstanceToken ?? data.appInstanceToken
13288
13522
  };
13289
- add("toolsetId", data.toolsetId);
13290
- add("serverName", data.serverName);
13291
- add("toolName", data.toolName);
13292
- add("toolCallId", data.toolCallId);
13293
- add("resourceUri", data.resourceUri);
13294
- add("title", typeof data.title === "string" ? data.title : void 0);
13295
- add("messageId", options?.messageId);
13296
- add("token", options?.appInstanceToken ?? data.appInstanceToken);
13297
- return params;
13298
- }
13299
- function buildMcpAppEndpointPath(data, endpoint, options) {
13300
- return appendQuery(
13301
- `/api/xpert-toolset/mcp-apps/${encodeURIComponent(
13302
- data.appInstanceId
13303
- )}/${endpoint}`,
13304
- buildMcpAppReviveParams(data, options)
13305
- );
13306
13523
  }
13307
13524
  function escapeHtmlAttribute(value) {
13308
13525
  return value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
13309
13526
  }
13310
13527
  function domains(values) {
13311
- return values?.filter((value) => value.trim()).join(" ") ?? "";
13528
+ return values?.map((value) => value.trim()).filter((value) => value && !/[\s;'"<>]/.test(value)).join(" ") ?? "";
13312
13529
  }
13313
13530
  function buildCsp(csp) {
13314
13531
  const resourceDomains = domains(csp?.resourceDomains);
@@ -13323,7 +13540,9 @@ function buildCsp(csp) {
13323
13540
  `media-src data: blob: ${resourceDomains}`.trim(),
13324
13541
  `font-src data: ${resourceDomains}`.trim(),
13325
13542
  `connect-src ${connectDomains}`,
13543
+ `form-action ${connectDomains}`,
13326
13544
  `frame-src ${frameDomains}`,
13545
+ "object-src 'none'",
13327
13546
  `base-uri ${baseUriDomains}`
13328
13547
  ].join("; ");
13329
13548
  }
@@ -13409,13 +13628,14 @@ function jsonRpcResult(id, result) {
13409
13628
  result
13410
13629
  };
13411
13630
  }
13412
- function jsonRpcError(id, message) {
13631
+ function jsonRpcError(id, message, code = -32e3, data) {
13413
13632
  return {
13414
13633
  jsonrpc: "2.0",
13415
13634
  id: id ?? null,
13416
13635
  error: {
13417
- code: -32e3,
13418
- message
13636
+ code,
13637
+ message,
13638
+ ...data === void 0 ? {} : { data }
13419
13639
  }
13420
13640
  };
13421
13641
  }
@@ -13466,11 +13686,7 @@ var MCP_APP_THEME_COLOR_TOKENS = [
13466
13686
  ["--background", "--mcp-app-color-background", "oklch(1 0 0)"],
13467
13687
  ["--foreground", "--mcp-app-color-foreground", "oklch(0.145 0 0)"],
13468
13688
  ["--card", "--mcp-app-color-card", "oklch(1 0 0)"],
13469
- [
13470
- "--card-foreground",
13471
- "--mcp-app-color-card-foreground",
13472
- "oklch(0.145 0 0)"
13473
- ],
13689
+ ["--card-foreground", "--mcp-app-color-card-foreground", "oklch(0.145 0 0)"],
13474
13690
  ["--popover", "--mcp-app-color-popover", "oklch(1 0 0)"],
13475
13691
  [
13476
13692
  "--popover-foreground",
@@ -13501,11 +13717,7 @@ var MCP_APP_THEME_COLOR_TOKENS = [
13501
13717
  "--mcp-app-color-accent-foreground",
13502
13718
  "oklch(0.205 0 0)"
13503
13719
  ],
13504
- [
13505
- "--destructive",
13506
- "--mcp-app-color-destructive",
13507
- "oklch(0.577 0.245 27.325)"
13508
- ],
13720
+ ["--destructive", "--mcp-app-color-destructive", "oklch(0.577 0.245 27.325)"],
13509
13721
  [
13510
13722
  "--destructive-foreground",
13511
13723
  "--mcp-app-color-destructive-foreground",
@@ -13619,9 +13831,7 @@ function normalizeMcpAppToolInfo(value, data, resource = {}) {
13619
13831
  ...rawTool,
13620
13832
  name: originalName,
13621
13833
  title: readLocalizedText(rawTool.title) ?? title,
13622
- inputSchema: normalizeInputSchema(
13623
- rawTool.inputSchema ?? raw.inputSchema
13624
- ),
13834
+ inputSchema: normalizeInputSchema(rawTool.inputSchema ?? raw.inputSchema),
13625
13835
  ...description ? {
13626
13836
  description: readLocalizedText(rawTool.description) ?? description
13627
13837
  } : {},
@@ -13650,10 +13860,66 @@ function buildIframeAllow(permissions) {
13650
13860
  return policies.length ? policies.join("; ") : void 0;
13651
13861
  }
13652
13862
  function buildSandboxAttribute() {
13653
- return ["allow-downloads", "allow-forms", "allow-modals", "allow-scripts"].join(
13654
- " "
13863
+ return ["allow-forms", "allow-modals", "allow-scripts"].join(" ");
13864
+ }
13865
+ function isLoopbackHostname(hostname) {
13866
+ return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]";
13867
+ }
13868
+ function normalizeRequestedDomain(value) {
13869
+ const domain = value?.trim().toLowerCase().replace(/\.$/, "");
13870
+ if (!domain || /[/:?#@]/.test(domain)) return null;
13871
+ try {
13872
+ const parsed = new URL(`https://${domain}`);
13873
+ return parsed.hostname === domain && !parsed.port ? domain : null;
13874
+ } catch {
13875
+ return null;
13876
+ }
13877
+ }
13878
+ function domainMatchesAllowlist(domain, allowedDomains) {
13879
+ return Boolean(
13880
+ allowedDomains?.some((value) => {
13881
+ const entry = value.trim().toLowerCase().replace(/\.$/, "");
13882
+ if (entry.startsWith("*.")) {
13883
+ const suffix = entry.slice(2);
13884
+ return Boolean(suffix) && domain !== suffix && domain.endsWith(`.${suffix}`);
13885
+ }
13886
+ return domain === entry;
13887
+ })
13655
13888
  );
13656
13889
  }
13890
+ function resolveMcpAppSandboxProxy(options, requestedDomain, hostLocation = window.location.href) {
13891
+ const configuredUrl = options?.sandboxProxyUrl?.trim();
13892
+ if (!configuredUrl) return null;
13893
+ try {
13894
+ const hostOrigin = new URL(hostLocation).origin;
13895
+ const proxyUrl = new URL(configuredUrl, hostLocation);
13896
+ if (proxyUrl.protocol !== "https:" && !(proxyUrl.protocol === "http:" && isLoopbackHostname(proxyUrl.hostname))) {
13897
+ return null;
13898
+ }
13899
+ const domain = normalizeRequestedDomain(requestedDomain);
13900
+ const dedicatedOrigin = Boolean(
13901
+ domain && (domain === proxyUrl.hostname.toLowerCase() || domainMatchesAllowlist(domain, options?.allowedDomains))
13902
+ );
13903
+ if (domain && dedicatedOrigin) {
13904
+ proxyUrl.hostname = domain;
13905
+ proxyUrl.port = "";
13906
+ }
13907
+ if (proxyUrl.origin === hostOrigin) return null;
13908
+ const fragment = new URLSearchParams(proxyUrl.hash.slice(1));
13909
+ fragment.set("parentOrigin", hostOrigin);
13910
+ proxyUrl.hash = fragment.toString();
13911
+ return {
13912
+ url: proxyUrl.toString(),
13913
+ origin: proxyUrl.origin,
13914
+ dedicatedOrigin
13915
+ };
13916
+ } catch {
13917
+ return null;
13918
+ }
13919
+ }
13920
+ function buildMcpAppInnerSandbox(dedicatedOrigin) {
13921
+ return dedicatedOrigin ? `${buildSandboxAttribute()} allow-same-origin` : buildSandboxAttribute();
13922
+ }
13657
13923
  function stringifyToolResult(value) {
13658
13924
  if (typeof value === "string") return value;
13659
13925
  try {
@@ -13776,7 +14042,7 @@ function normalizeMcpAppResourceResponse(value, data) {
13776
14042
  rawToolResult
13777
14043
  };
13778
14044
  }
13779
- function isHttpUrl(value) {
14045
+ function isHttpUrl2(value) {
13780
14046
  try {
13781
14047
  const url = new URL(value);
13782
14048
  return url.protocol === "http:" || url.protocol === "https:";
@@ -13784,22 +14050,124 @@ function isHttpUrl(value) {
13784
14050
  return false;
13785
14051
  }
13786
14052
  }
13787
- function contentBlocksToText(content) {
13788
- if (!Array.isArray(content)) return null;
13789
- const parts = content.map((item) => {
13790
- if (!isRecord5(item)) return "";
13791
- if (item.type === "text" && typeof item.text === "string") {
13792
- return item.text;
14053
+ var MCP_APP_MESSAGE_MAX_BINARY_BYTES = 25 * 1024 * 1024;
14054
+ function normalizeMcpMimeType(value, fallback) {
14055
+ const mimeType = typeof value === "string" ? value.trim() : fallback;
14056
+ return mimeType && /^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/i.test(mimeType) ? mimeType.toLowerCase() : null;
14057
+ }
14058
+ function normalizeMcpBase64(value) {
14059
+ if (typeof value !== "string") return null;
14060
+ const data = value.replace(/\s/g, "");
14061
+ if (!data || data.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(data)) {
14062
+ return null;
14063
+ }
14064
+ return data;
14065
+ }
14066
+ function decodedBase64Bytes(data) {
14067
+ const padding = data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0;
14068
+ return data.length / 4 * 3 - padding;
14069
+ }
14070
+ function mcpMessageFile(data, mimeType, name) {
14071
+ return {
14072
+ name,
14073
+ originalName: name,
14074
+ mimeType,
14075
+ fileUrl: `data:${mimeType};base64,${data}`
14076
+ };
14077
+ }
14078
+ function resourceLabel(resource) {
14079
+ const details = {
14080
+ uri: readString3(resource.uri),
14081
+ mimeType: readString3(resource.mimeType)
14082
+ };
14083
+ return `[Resource ${stringifyToolResult(details)}]`;
14084
+ }
14085
+ function resourceLinkLabel(resourceLink) {
14086
+ const details = {
14087
+ uri: readString3(resourceLink.uri),
14088
+ name: readString3(resourceLink.name),
14089
+ description: readString3(resourceLink.description),
14090
+ mimeType: readString3(resourceLink.mimeType),
14091
+ size: typeof resourceLink.size === "number" ? resourceLink.size : void 0
14092
+ };
14093
+ return `[Resource link ${stringifyToolResult(details)}]`;
14094
+ }
14095
+ function contentBlocksToChatInput(content) {
14096
+ if (!Array.isArray(content)) {
14097
+ throw new Error("ui/message content must be an array");
14098
+ }
14099
+ const text = [];
14100
+ const files = [];
14101
+ let binaryBytes = 0;
14102
+ content.forEach((item, index) => {
14103
+ if (!isRecord5(item) || typeof item.type !== "string") {
14104
+ throw new Error(`ui/message content block ${index + 1} is invalid`);
13793
14105
  }
13794
- if (item.type === "resource_link" && typeof item.uri === "string") {
13795
- return item.uri;
14106
+ if (item.type === "text") {
14107
+ if (typeof item.text !== "string") {
14108
+ throw new Error(`ui/message text block ${index + 1} is invalid`);
14109
+ }
14110
+ if (item.text.length) text.push(item.text);
14111
+ return;
13796
14112
  }
13797
14113
  if (item.type === "image" || item.type === "audio") {
13798
- return `[${item.type}]`;
14114
+ const mimeType = normalizeMcpMimeType(item.mimeType);
14115
+ const data = normalizeMcpBase64(item.data);
14116
+ if (!mimeType || !data || !mimeType.startsWith(`${item.type}/`)) {
14117
+ throw new Error(
14118
+ `ui/message ${item.type} block ${index + 1} is invalid`
14119
+ );
14120
+ }
14121
+ binaryBytes += decodedBase64Bytes(data);
14122
+ files.push(
14123
+ mcpMessageFile(data, mimeType, `mcp-app-${item.type}-${index + 1}`)
14124
+ );
14125
+ return;
14126
+ }
14127
+ if (item.type === "resource") {
14128
+ const resource = readRecord(item.resource);
14129
+ if (!resource || typeof resource.uri !== "string") {
14130
+ throw new Error(`ui/message resource block ${index + 1} is invalid`);
14131
+ }
14132
+ const label = resourceLabel(resource);
14133
+ if (typeof resource.text === "string") {
14134
+ text.push(`${label}
14135
+ ${resource.text}`);
14136
+ return;
14137
+ }
14138
+ const data = normalizeMcpBase64(resource.blob);
14139
+ const mimeType = normalizeMcpMimeType(
14140
+ resource.mimeType,
14141
+ "application/octet-stream"
14142
+ );
14143
+ if (!data || !mimeType) {
14144
+ throw new Error(`ui/message resource block ${index + 1} is invalid`);
14145
+ }
14146
+ binaryBytes += decodedBase64Bytes(data);
14147
+ text.push(label);
14148
+ files.push(
14149
+ mcpMessageFile(data, mimeType, `mcp-app-resource-${index + 1}`)
14150
+ );
14151
+ return;
14152
+ }
14153
+ if (item.type === "resource_link" && typeof item.uri === "string") {
14154
+ text.push(resourceLinkLabel(item));
14155
+ return;
13799
14156
  }
13800
- return stringifyToolResult(item);
13801
- }).map((part) => part.trim()).filter(Boolean);
13802
- return parts.length ? parts.join("\n\n") : null;
14157
+ throw new Error(
14158
+ `ui/message content block ${index + 1} uses an unsupported type`
14159
+ );
14160
+ });
14161
+ if (binaryBytes > MCP_APP_MESSAGE_MAX_BINARY_BYTES) {
14162
+ throw new Error("ui/message binary content exceeds the 25 MiB limit");
14163
+ }
14164
+ if (!text.length && !files.length) {
14165
+ throw new Error("ui/message content is empty");
14166
+ }
14167
+ return {
14168
+ input: text.join("\n\n"),
14169
+ files
14170
+ };
13803
14171
  }
13804
14172
  function isMcpAppComponentData(data) {
13805
14173
  return isRecord5(data) && data.type === "McpApp" && typeof data.appInstanceId === "string" && typeof data.resourceUri === "string";
@@ -13807,68 +14175,205 @@ function isMcpAppComponentData(data) {
13807
14175
  function McpAppMessage({
13808
14176
  data,
13809
14177
  messageId,
13810
- className
14178
+ className,
14179
+ mcpApps
13811
14180
  }) {
13812
14181
  const { i18n: i18n2 } = useChatkitTranslation();
13813
- const {
13814
- apiUrl,
13815
- authenticatedFetch,
13816
- isLoading: streamIsLoading,
13817
- submit
13818
- } = useStreamContext();
14182
+ const { client, isLoading: streamIsLoading, submit } = useStreamContext();
13819
14183
  const iframeRef = React37.useRef(null);
14184
+ const appWindowRef = React37.useRef(null);
13820
14185
  const containerRef = React37.useRef(null);
13821
14186
  const initializedRef = React37.useRef(false);
13822
14187
  const sentInitialResultRef = React37.useRef(false);
13823
14188
  const modelContextRef = React37.useRef(null);
14189
+ const pendingApprovalRef = React37.useRef(null);
14190
+ const approvalActionRef = React37.useRef(null);
14191
+ const runtimeAppInstanceTokenRef = React37.useRef(
14192
+ data.appInstanceToken
14193
+ );
14194
+ const teardownGenerationRef = React37.useRef(0);
14195
+ const teardownStartedRef = React37.useRef(false);
14196
+ const activeAppInstanceIdRef = React37.useRef(data.appInstanceId);
13824
14197
  const [resource, setResource] = React37.useState(null);
13825
14198
  const [runtimeAppInstanceToken, setRuntimeAppInstanceToken] = React37.useState(data.appInstanceToken);
13826
14199
  const [srcDoc, setSrcDoc] = React37.useState(null);
13827
14200
  const [height, setHeight] = React37.useState(420);
14201
+ const [displayMode, setDisplayMode] = React37.useState("inline");
14202
+ const [pendingApproval, setPendingApproval] = React37.useState(null);
14203
+ const [approvalAction, setApprovalAction] = React37.useState(null);
14204
+ const [approvalError, setApprovalError] = React37.useState(null);
13828
14205
  const [error, setError] = React37.useState(null);
13829
14206
  const [isLoading, setIsLoading] = React37.useState(true);
13830
- const resourceUrl = React37.useMemo(
13831
- () => buildXpertApiUrl(
13832
- apiUrl,
13833
- buildMcpAppEndpointPath(data, "resource", {
13834
- messageId
13835
- })
13836
- ),
13837
- [apiUrl, data, messageId]
14207
+ const [isTornDown, setIsTornDown] = React37.useState(false);
14208
+ const sandboxProxy = React37.useMemo(
14209
+ () => resolveMcpAppSandboxProxy(mcpApps, resource?.domain ?? data.domain),
14210
+ [data.domain, mcpApps, resource?.domain]
13838
14211
  );
13839
- const rpcUrl = React37.useMemo(
13840
- () => buildXpertApiUrl(
13841
- apiUrl,
13842
- buildMcpAppEndpointPath(data, "rpc", {
13843
- appInstanceToken: runtimeAppInstanceToken,
13844
- messageId
13845
- })
13846
- ),
13847
- [apiUrl, data, messageId, runtimeAppInstanceToken]
14212
+ React37.useEffect(() => {
14213
+ runtimeAppInstanceTokenRef.current = runtimeAppInstanceToken;
14214
+ }, [runtimeAppInstanceToken]);
14215
+ const bindIframeRef = React37.useCallback(
14216
+ (iframe) => {
14217
+ iframeRef.current = iframe;
14218
+ if (iframe?.contentWindow) {
14219
+ appWindowRef.current = iframe.contentWindow;
14220
+ }
14221
+ },
14222
+ []
14223
+ );
14224
+ const postToApp = React37.useCallback(
14225
+ (message) => {
14226
+ iframeRef.current?.contentWindow?.postMessage(
14227
+ message,
14228
+ sandboxProxy?.origin ?? "*"
14229
+ );
14230
+ },
14231
+ [sandboxProxy?.origin]
13848
14232
  );
13849
- const postToApp = React37.useCallback((message) => {
13850
- iframeRef.current?.contentWindow?.postMessage(message, "*");
13851
- }, []);
13852
14233
  const callHostRpc = React37.useCallback(
13853
14234
  async (request) => {
13854
- const response = await authenticatedFetch(rpcUrl, {
13855
- method: "POST",
13856
- headers: {
13857
- "content-type": "application/json"
13858
- },
13859
- body: JSON.stringify({
14235
+ return client.mcp.apps.rpc(
14236
+ data.appInstanceId,
14237
+ {
13860
14238
  jsonrpc: "2.0",
13861
14239
  id: request.id ?? null,
13862
14240
  method: request.method,
13863
14241
  params: request.params
14242
+ },
14243
+ buildMcpAppReviveQuery(data, {
14244
+ appInstanceToken: runtimeAppInstanceToken,
14245
+ messageId
13864
14246
  })
14247
+ );
14248
+ },
14249
+ [client, data, messageId, runtimeAppInstanceToken]
14250
+ );
14251
+ const clearPendingApproval = React37.useCallback(() => {
14252
+ pendingApprovalRef.current = null;
14253
+ approvalActionRef.current = null;
14254
+ setPendingApproval(null);
14255
+ setApprovalAction(null);
14256
+ setApprovalError(null);
14257
+ }, []);
14258
+ const isSupersededStrictModeTeardown = React37.useCallback(
14259
+ (generation, appInstanceId) => teardownGenerationRef.current !== generation && activeAppInstanceIdRef.current === appInstanceId,
14260
+ []
14261
+ );
14262
+ const processHostRpcResponse = React37.useCallback(
14263
+ (request, response) => {
14264
+ const nextApproval = readMcpAppPendingApproval(response, request);
14265
+ if (nextApproval) {
14266
+ if (pendingApprovalRef.current) {
14267
+ postToApp(
14268
+ jsonRpcError(
14269
+ request.id,
14270
+ "Another MCP App approval request is already pending",
14271
+ -32004
14272
+ )
14273
+ );
14274
+ return;
14275
+ }
14276
+ pendingApprovalRef.current = nextApproval;
14277
+ setPendingApproval(nextApproval);
14278
+ setApprovalError(null);
14279
+ return;
14280
+ }
14281
+ const nextDisplayMode = readMcpAppDisplayMode(response);
14282
+ if (request.method === "ui/request-display-mode" && nextDisplayMode) {
14283
+ setDisplayMode(nextDisplayMode);
14284
+ }
14285
+ if (request.method === "ui/download-file" && isMcpAppRpcSuccess(response)) {
14286
+ try {
14287
+ triggerMcpAppDownloads(request.params);
14288
+ } catch (downloadError) {
14289
+ postToApp(
14290
+ jsonRpcError(request.id, getErrorMessage(downloadError), -32005)
14291
+ );
14292
+ return;
14293
+ }
14294
+ }
14295
+ postToApp(response);
14296
+ },
14297
+ [postToApp]
14298
+ );
14299
+ const dispatchHostRpc = React37.useCallback(
14300
+ async (request) => {
14301
+ try {
14302
+ processHostRpcResponse(request, await callHostRpc(request));
14303
+ } catch (rpcError) {
14304
+ postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
14305
+ }
14306
+ },
14307
+ [callHostRpc, postToApp, processHostRpcResponse]
14308
+ );
14309
+ const resolvePendingApproval = React37.useCallback(
14310
+ async (action) => {
14311
+ const approval = pendingApprovalRef.current;
14312
+ if (!approval || approvalActionRef.current) return;
14313
+ if (approval.expiresAt <= Date.now()) {
14314
+ clearPendingApproval();
14315
+ postToApp(
14316
+ jsonRpcError(
14317
+ approval.request.id,
14318
+ "The MCP App approval request expired",
14319
+ -32003
14320
+ )
14321
+ );
14322
+ return;
14323
+ }
14324
+ approvalActionRef.current = action;
14325
+ setApprovalAction(action);
14326
+ setApprovalError(null);
14327
+ const query = buildMcpAppReviveQuery(data, {
14328
+ appInstanceToken: runtimeAppInstanceToken,
14329
+ messageId
13865
14330
  });
13866
- if (!response.ok) {
13867
- throw new Error(`MCP App RPC failed with ${response.status}`);
14331
+ try {
14332
+ if (action === "reject") {
14333
+ await client.mcp.apps.reject(
14334
+ data.appInstanceId,
14335
+ approval.approvalId,
14336
+ query
14337
+ );
14338
+ clearPendingApproval();
14339
+ postToApp(
14340
+ jsonRpcError(
14341
+ approval.request.id,
14342
+ "The user rejected the MCP App action",
14343
+ -32002,
14344
+ { approvalId: approval.approvalId, rejected: true }
14345
+ )
14346
+ );
14347
+ return;
14348
+ }
14349
+ await client.mcp.apps.approve(
14350
+ data.appInstanceId,
14351
+ approval.approvalId,
14352
+ query
14353
+ );
14354
+ const retryRequest = withMcpAppApprovalId(
14355
+ approval.request,
14356
+ approval.approvalId
14357
+ );
14358
+ const response = await callHostRpc(retryRequest);
14359
+ clearPendingApproval();
14360
+ processHostRpcResponse(retryRequest, response);
14361
+ } catch (approvalRequestError) {
14362
+ approvalActionRef.current = null;
14363
+ setApprovalAction(null);
14364
+ setApprovalError(getErrorMessage(approvalRequestError));
13868
14365
  }
13869
- return response.json();
13870
14366
  },
13871
- [authenticatedFetch, rpcUrl]
14367
+ [
14368
+ callHostRpc,
14369
+ clearPendingApproval,
14370
+ client,
14371
+ data,
14372
+ messageId,
14373
+ postToApp,
14374
+ processHostRpcResponse,
14375
+ runtimeAppInstanceToken
14376
+ ]
13872
14377
  );
13873
14378
  const sendInitialToolNotifications = React37.useCallback(() => {
13874
14379
  if (!initializedRef.current || sentInitialResultRef.current || !resource) {
@@ -13901,28 +14406,35 @@ function McpAppMessage({
13901
14406
  const controller = new AbortController();
13902
14407
  initializedRef.current = false;
13903
14408
  sentInitialResultRef.current = false;
14409
+ pendingApprovalRef.current = null;
14410
+ approvalActionRef.current = null;
13904
14411
  setRuntimeAppInstanceToken(data.appInstanceToken);
14412
+ runtimeAppInstanceTokenRef.current = data.appInstanceToken;
14413
+ teardownStartedRef.current = false;
14414
+ setIsTornDown(false);
14415
+ setDisplayMode("inline");
14416
+ setPendingApproval(null);
14417
+ setApprovalAction(null);
14418
+ setApprovalError(null);
13905
14419
  setIsLoading(true);
13906
14420
  setError(null);
13907
14421
  setResource(null);
13908
14422
  setSrcDoc(null);
13909
14423
  void (async () => {
13910
14424
  try {
13911
- const response = await authenticatedFetch(resourceUrl, {
13912
- signal: controller.signal
13913
- });
13914
- if (!response.ok) {
13915
- throw new Error(`MCP App resource failed with ${response.status}`);
13916
- }
13917
- const payload = await response.json();
14425
+ const payload = await client.mcp.apps.getResource(
14426
+ data.appInstanceId,
14427
+ buildMcpAppReviveQuery(data, { messageId }),
14428
+ { signal: controller.signal }
14429
+ );
13918
14430
  const normalizedResource = normalizeMcpAppResourceResponse(
13919
14431
  payload,
13920
14432
  data
13921
14433
  );
13922
14434
  setResource(normalizedResource);
13923
- setRuntimeAppInstanceToken(
13924
- normalizedResource.appInstanceToken ?? data.appInstanceToken
13925
- );
14435
+ const nextAppInstanceToken = normalizedResource.appInstanceToken ?? data.appInstanceToken;
14436
+ runtimeAppInstanceTokenRef.current = nextAppInstanceToken;
14437
+ setRuntimeAppInstanceToken(nextAppInstanceToken);
13926
14438
  const hostLocale = normalizeHostLocale(i18n2.language);
13927
14439
  setSrcDoc(
13928
14440
  injectMcpAppTheme(
@@ -13947,26 +14459,131 @@ function McpAppMessage({
13947
14459
  controller.abort();
13948
14460
  };
13949
14461
  }, [
13950
- authenticatedFetch,
14462
+ client,
13951
14463
  data,
13952
14464
  data.appInstanceId,
13953
14465
  data.appInstanceToken,
13954
14466
  data.csp,
13955
14467
  i18n2.language,
13956
- resourceUrl
14468
+ messageId
14469
+ ]);
14470
+ React37.useEffect(() => {
14471
+ const generation = ++teardownGenerationRef.current;
14472
+ activeAppInstanceIdRef.current = data.appInstanceId;
14473
+ return () => {
14474
+ const appWindow = appWindowRef.current;
14475
+ const appOrigin = sandboxProxy?.origin ?? "*";
14476
+ const query = buildMcpAppReviveQuery(data, {
14477
+ appInstanceToken: runtimeAppInstanceTokenRef.current,
14478
+ messageId
14479
+ });
14480
+ const approval = pendingApprovalRef.current;
14481
+ queueMicrotask(() => {
14482
+ if (isSupersededStrictModeTeardown(generation, data.appInstanceId)) {
14483
+ return;
14484
+ }
14485
+ if (teardownStartedRef.current) {
14486
+ return;
14487
+ }
14488
+ teardownStartedRef.current = true;
14489
+ try {
14490
+ appWindow?.postMessage(
14491
+ {
14492
+ jsonrpc: "2.0",
14493
+ id: `xpert-teardown-${data.appInstanceId}`,
14494
+ method: "ui/resource-teardown",
14495
+ params: { reason: "host-unmount" }
14496
+ },
14497
+ appOrigin
14498
+ );
14499
+ } catch {
14500
+ }
14501
+ void (async () => {
14502
+ if (approval) {
14503
+ await client.mcp.apps.reject(data.appInstanceId, approval.approvalId, query).catch(() => void 0);
14504
+ }
14505
+ await client.mcp.apps.teardown(data.appInstanceId, query).catch(() => void 0);
14506
+ })();
14507
+ });
14508
+ };
14509
+ }, [
14510
+ client,
14511
+ data,
14512
+ data.appInstanceId,
14513
+ isSupersededStrictModeTeardown,
14514
+ messageId,
14515
+ sandboxProxy?.origin
13957
14516
  ]);
14517
+ React37.useEffect(() => {
14518
+ if (!pendingApproval) return;
14519
+ const remaining = pendingApproval.expiresAt - Date.now();
14520
+ if (remaining <= 0) {
14521
+ clearPendingApproval();
14522
+ postToApp(
14523
+ jsonRpcError(
14524
+ pendingApproval.request.id,
14525
+ "The MCP App approval request expired",
14526
+ -32003
14527
+ )
14528
+ );
14529
+ return;
14530
+ }
14531
+ const timeout = window.setTimeout(() => {
14532
+ if (pendingApprovalRef.current?.approvalId !== pendingApproval.approvalId) {
14533
+ return;
14534
+ }
14535
+ clearPendingApproval();
14536
+ postToApp(
14537
+ jsonRpcError(
14538
+ pendingApproval.request.id,
14539
+ "The MCP App approval request expired",
14540
+ -32003
14541
+ )
14542
+ );
14543
+ }, remaining);
14544
+ return () => window.clearTimeout(timeout);
14545
+ }, [clearPendingApproval, pendingApproval, postToApp]);
13958
14546
  React37.useEffect(() => {
13959
14547
  sendInitialToolNotifications();
13960
14548
  }, [sendInitialToolNotifications]);
14549
+ React37.useEffect(() => {
14550
+ if (!initializedRef.current) return;
14551
+ postToApp({
14552
+ jsonrpc: "2.0",
14553
+ method: "ui/notifications/host-context-changed",
14554
+ params: {
14555
+ displayMode,
14556
+ containerDimensions: getContainerDimensions(containerRef.current)
14557
+ }
14558
+ });
14559
+ }, [displayMode, height, postToApp]);
13961
14560
  React37.useEffect(() => {
13962
14561
  const handleMessage = async (event) => {
13963
14562
  if (event.source !== iframeRef.current?.contentWindow) {
13964
14563
  return;
13965
14564
  }
14565
+ if (sandboxProxy && event.origin !== sandboxProxy.origin) {
14566
+ return;
14567
+ }
13966
14568
  const request = normalizeJsonRpcMessage(event.data);
13967
14569
  if (!request?.method) {
13968
14570
  return;
13969
14571
  }
14572
+ if (request.method === "ui/notifications/sandbox-proxy-ready" && sandboxProxy && srcDoc) {
14573
+ const permissions = resource?.permissions ?? data.permissions;
14574
+ const csp = resource?.csp ?? data.csp;
14575
+ postToApp({
14576
+ jsonrpc: "2.0",
14577
+ method: "ui/notifications/sandbox-resource-ready",
14578
+ params: {
14579
+ html: srcDoc,
14580
+ sandbox: buildMcpAppInnerSandbox(sandboxProxy.dedicatedOrigin),
14581
+ ...csp ? { csp } : {},
14582
+ ...permissions ? { permissions } : {}
14583
+ }
14584
+ });
14585
+ return;
14586
+ }
13970
14587
  if (request.method === "ui/notifications/initialized") {
13971
14588
  initializedRef.current = true;
13972
14589
  sendInitialToolNotifications();
@@ -13979,6 +14596,39 @@ function McpAppMessage({
13979
14596
  }
13980
14597
  return;
13981
14598
  }
14599
+ if (request.method === "ui/notifications/request-teardown") {
14600
+ if (teardownStartedRef.current) {
14601
+ return;
14602
+ }
14603
+ teardownStartedRef.current = true;
14604
+ postToApp({
14605
+ jsonrpc: "2.0",
14606
+ id: `xpert-teardown-${data.appInstanceId}`,
14607
+ method: "ui/resource-teardown",
14608
+ params: { reason: "app-requested" }
14609
+ });
14610
+ const query = buildMcpAppReviveQuery(data, {
14611
+ appInstanceToken: runtimeAppInstanceTokenRef.current,
14612
+ messageId
14613
+ });
14614
+ const approval = pendingApprovalRef.current;
14615
+ try {
14616
+ if (approval) {
14617
+ await client.mcp.apps.reject(
14618
+ data.appInstanceId,
14619
+ approval.approvalId,
14620
+ query
14621
+ );
14622
+ }
14623
+ await client.mcp.apps.teardown(data.appInstanceId, query);
14624
+ clearPendingApproval();
14625
+ setIsTornDown(true);
14626
+ } catch (teardownError) {
14627
+ teardownStartedRef.current = false;
14628
+ setError(getErrorMessage(teardownError));
14629
+ }
14630
+ return;
14631
+ }
13982
14632
  if (request.method === "ui/initialize") {
13983
14633
  initializedRef.current = true;
13984
14634
  const permissions = resource?.permissions ?? data.permissions;
@@ -14002,7 +14652,11 @@ function McpAppMessage({
14002
14652
  openLinks: {},
14003
14653
  logging: {},
14004
14654
  message: {
14005
- text: {}
14655
+ text: {},
14656
+ image: {},
14657
+ audio: {},
14658
+ resource: {},
14659
+ resourceLink: {}
14006
14660
  },
14007
14661
  updateModelContext: {
14008
14662
  text: {},
@@ -14011,29 +14665,33 @@ function McpAppMessage({
14011
14665
  sandbox: {
14012
14666
  ...permissions ? { permissions } : {},
14013
14667
  ...csp ? { csp } : {}
14014
- }
14668
+ },
14669
+ downloadFile: {}
14015
14670
  },
14016
14671
  hostContext: {
14017
14672
  toolInfo,
14018
14673
  theme: theme.mode,
14674
+ styles: {
14675
+ variables: theme.cssVariables
14676
+ },
14019
14677
  themeCssVariables: theme.cssVariables,
14020
14678
  locale: hostLocale,
14021
14679
  language: hostLanguage,
14022
14680
  direction: hostDirection,
14023
14681
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
14024
- displayMode: "inline",
14025
- availableDisplayModes: ["inline"],
14682
+ displayMode,
14683
+ availableDisplayModes: ["inline", "fullscreen", "pip"],
14026
14684
  containerDimensions: getContainerDimensions(containerRef.current),
14027
14685
  userAgent: "xpert-chatkit",
14028
14686
  platform: "web",
14029
14687
  deviceCapabilities: {
14030
14688
  touch: navigator.maxTouchPoints > 0,
14031
- hover: window.matchMedia("(hover: hover)").matches
14689
+ hover: typeof window.matchMedia === "function" ? window.matchMedia("(hover: hover)").matches : false
14032
14690
  }
14033
14691
  },
14034
14692
  // Legacy compatibility for apps written before the 2026-01-26 result shape.
14035
14693
  capabilities: {
14036
- displayModes: ["inline"],
14694
+ displayModes: ["inline", "fullscreen", "pip"],
14037
14695
  serverTools: true,
14038
14696
  serverResources: true,
14039
14697
  openLinks: true
@@ -14046,8 +14704,8 @@ function McpAppMessage({
14046
14704
  language: hostLanguage,
14047
14705
  direction: hostDirection,
14048
14706
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
14049
- displayMode: "inline",
14050
- availableDisplayModes: ["inline"],
14707
+ displayMode,
14708
+ availableDisplayModes: ["inline", "fullscreen", "pip"],
14051
14709
  containerDimensions: getContainerDimensions(containerRef.current),
14052
14710
  userAgent: navigator.userAgent,
14053
14711
  platform: navigator.platform
@@ -14059,20 +14717,33 @@ function McpAppMessage({
14059
14717
  }
14060
14718
  if (request.method === "ui/open-link") {
14061
14719
  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;
14062
- if (href && isHttpUrl(href)) {
14063
- window.open(href, "_blank", "noopener,noreferrer");
14720
+ if (!href || !isHttpUrl2(href)) {
14064
14721
  if (request.id !== void 0) {
14065
- postToApp(jsonRpcResult(request.id, {}));
14722
+ postToApp(jsonRpcError(request.id, "Invalid URL"));
14066
14723
  }
14067
- } else if (request.id !== void 0) {
14068
- postToApp(jsonRpcResult(request.id, { isError: true }));
14724
+ return;
14725
+ }
14726
+ try {
14727
+ const response = await callHostRpc({
14728
+ ...request,
14729
+ params: { url: href }
14730
+ });
14731
+ if (isMcpAppRpcSuccess(response)) {
14732
+ window.open(href, "_blank", "noopener,noreferrer");
14733
+ }
14734
+ postToApp(response);
14735
+ } catch (linkError) {
14736
+ postToApp(jsonRpcError(request.id, getErrorMessage(linkError)));
14069
14737
  }
14070
14738
  return;
14071
14739
  }
14072
14740
  if (request.method === "ui/update-model-context") {
14073
- modelContextRef.current = request.params;
14074
14741
  try {
14075
- postToApp(await callHostRpc(request));
14742
+ const response = await callHostRpc(request);
14743
+ if (isMcpAppRpcSuccess(response)) {
14744
+ modelContextRef.current = request.params;
14745
+ }
14746
+ postToApp(response);
14076
14747
  } catch (rpcError) {
14077
14748
  postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
14078
14749
  }
@@ -14090,14 +14761,12 @@ function McpAppMessage({
14090
14761
  postToApp(hostResponse);
14091
14762
  return;
14092
14763
  }
14093
- const inputText = contentBlocksToText(request.params.content);
14094
- if (!inputText) {
14095
- throw new Error("ui/message content did not include text");
14096
- }
14764
+ const messageInput = contentBlocksToChatInput(request.params.content);
14097
14765
  await submit(
14098
14766
  {
14099
14767
  input: {
14100
- input: inputText
14768
+ input: messageInput.input,
14769
+ ...messageInput.files.length ? { files: messageInput.files } : {}
14101
14770
  }
14102
14771
  },
14103
14772
  {
@@ -14122,11 +14791,7 @@ function McpAppMessage({
14122
14791
  if (request.id === void 0 && request.method.startsWith("ui/")) {
14123
14792
  return;
14124
14793
  }
14125
- try {
14126
- postToApp(await callHostRpc(request));
14127
- } catch (rpcError) {
14128
- postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
14129
- }
14794
+ await dispatchHostRpc(request);
14130
14795
  };
14131
14796
  window.addEventListener("message", handleMessage);
14132
14797
  return () => {
@@ -14134,19 +14799,20 @@ function McpAppMessage({
14134
14799
  };
14135
14800
  }, [
14136
14801
  callHostRpc,
14137
- data.appInstanceId,
14138
- data.csp,
14139
- data.permissions,
14140
- data.resourceUri,
14141
- data.title,
14142
- data.toolCallId,
14143
- data.toolName,
14802
+ clearPendingApproval,
14803
+ client,
14804
+ data,
14805
+ dispatchHostRpc,
14806
+ displayMode,
14144
14807
  i18n2.language,
14808
+ messageId,
14145
14809
  postToApp,
14146
14810
  resource?.csp,
14147
14811
  resource?.permissions,
14148
14812
  resource?.toolInfo,
14813
+ sandboxProxy,
14149
14814
  sendInitialToolNotifications,
14815
+ srcDoc,
14150
14816
  streamIsLoading,
14151
14817
  submit
14152
14818
  ]);
@@ -14155,7 +14821,7 @@ function McpAppMessage({
14155
14821
  () => buildIframeAllow(iframePermissions),
14156
14822
  [iframePermissions]
14157
14823
  );
14158
- const sandbox = React37.useMemo(() => buildSandboxAttribute(), []);
14824
+ const sandbox = sandboxProxy ? "allow-scripts allow-same-origin" : buildSandboxAttribute();
14159
14825
  const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
14160
14826
  const displayTitle = resolveLocalizedText3(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
14161
14827
  const displayDescription = resolveLocalizedText3(
@@ -14163,56 +14829,212 @@ function McpAppMessage({
14163
14829
  i18n2.language
14164
14830
  );
14165
14831
  const displayIcon = resource?.icon ?? data.icon;
14166
- return /* @__PURE__ */ jsxs29(
14167
- "div",
14168
- {
14169
- ref: containerRef,
14170
- className: cn(
14171
- "overflow-hidden rounded-lg border bg-background shadow-sm",
14172
- !prefersBorder && "border-transparent shadow-none",
14173
- className
14174
- ),
14175
- children: [
14176
- /* @__PURE__ */ jsxs29("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
14177
- /* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 items-center gap-2", children: [
14178
- displayIcon ? /* @__PURE__ */ jsx43(
14179
- IconDefinitionRenderer,
14180
- {
14181
- icon: displayIcon,
14182
- size: 18,
14183
- className: "shrink-0",
14184
- decorative: true
14185
- }
14186
- ) : null,
14187
- /* @__PURE__ */ jsxs29("div", { className: "min-w-0", children: [
14188
- /* @__PURE__ */ jsx43("div", { className: "truncate text-sm font-medium", children: displayTitle }),
14189
- /* @__PURE__ */ jsx43("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
14832
+ const elevatedDisplayMode = displayMode !== "inline";
14833
+ if (isTornDown) {
14834
+ return null;
14835
+ }
14836
+ return /* @__PURE__ */ jsxs29(Fragment8, { children: [
14837
+ displayMode === "fullscreen" ? /* @__PURE__ */ jsx43(
14838
+ "div",
14839
+ {
14840
+ "aria-hidden": "true",
14841
+ className: "fixed inset-0 z-[79] bg-background/80 backdrop-blur-sm"
14842
+ }
14843
+ ) : null,
14844
+ /* @__PURE__ */ jsxs29(
14845
+ "div",
14846
+ {
14847
+ ref: containerRef,
14848
+ "data-display-mode": displayMode,
14849
+ className: cn(
14850
+ "relative flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",
14851
+ displayMode === "fullscreen" && "fixed inset-4 z-[80] shadow-2xl",
14852
+ displayMode === "pip" && "fixed right-4 bottom-4 z-[80] h-[min(640px,calc(100vh-2rem))] w-[min(480px,calc(100vw-2rem))] shadow-2xl",
14853
+ !prefersBorder && "border-transparent shadow-none",
14854
+ className
14855
+ ),
14856
+ children: [
14857
+ /* @__PURE__ */ jsxs29("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
14858
+ /* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 items-center gap-2", children: [
14859
+ displayIcon ? /* @__PURE__ */ jsx43(
14860
+ IconDefinitionRenderer,
14861
+ {
14862
+ icon: displayIcon,
14863
+ size: 18,
14864
+ className: "shrink-0",
14865
+ decorative: true
14866
+ }
14867
+ ) : null,
14868
+ /* @__PURE__ */ jsxs29("div", { className: "min-w-0", children: [
14869
+ /* @__PURE__ */ jsx43("div", { className: "truncate text-sm font-medium", children: displayTitle }),
14870
+ /* @__PURE__ */ jsx43("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
14871
+ ] })
14872
+ ] }),
14873
+ /* @__PURE__ */ jsxs29("div", { className: "flex shrink-0 items-center gap-1", children: [
14874
+ displayMode !== "fullscreen" ? /* @__PURE__ */ jsx43(
14875
+ Button,
14876
+ {
14877
+ type: "button",
14878
+ variant: "ghost",
14879
+ size: "icon-xs",
14880
+ title: i18n2.t("message.mcpApp.fullscreen"),
14881
+ "aria-label": i18n2.t("message.mcpApp.fullscreen"),
14882
+ onClick: () => setDisplayMode("fullscreen"),
14883
+ children: /* @__PURE__ */ jsx43(Maximize2, {})
14884
+ }
14885
+ ) : null,
14886
+ displayMode !== "pip" ? /* @__PURE__ */ jsx43(
14887
+ Button,
14888
+ {
14889
+ type: "button",
14890
+ variant: "ghost",
14891
+ size: "icon-xs",
14892
+ title: i18n2.t("message.mcpApp.pictureInPicture"),
14893
+ "aria-label": i18n2.t("message.mcpApp.pictureInPicture"),
14894
+ onClick: () => setDisplayMode("pip"),
14895
+ children: /* @__PURE__ */ jsx43(PictureInPicture2, {})
14896
+ }
14897
+ ) : null,
14898
+ elevatedDisplayMode ? /* @__PURE__ */ jsx43(
14899
+ Button,
14900
+ {
14901
+ type: "button",
14902
+ variant: "ghost",
14903
+ size: "icon-xs",
14904
+ title: i18n2.t("message.mcpApp.returnInline"),
14905
+ "aria-label": i18n2.t("message.mcpApp.returnInline"),
14906
+ onClick: () => setDisplayMode("inline"),
14907
+ children: /* @__PURE__ */ jsx43(Minimize2, {})
14908
+ }
14909
+ ) : null,
14910
+ /* @__PURE__ */ jsx43(Badge, { variant: "secondary", className: "ml-1 rounded-md", children: "MCP App" })
14190
14911
  ] })
14191
14912
  ] }),
14192
- /* @__PURE__ */ jsx43(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
14193
- ] }),
14194
- isLoading ? /* @__PURE__ */ jsxs29("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
14195
- /* @__PURE__ */ jsx43(Loader28, { className: "h-4 w-4 animate-spin" }),
14196
- /* @__PURE__ */ jsx43("span", { children: i18n2.t("message.mcpApp.loading") })
14197
- ] }) : error ? /* @__PURE__ */ jsxs29("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
14198
- /* @__PURE__ */ jsx43(AlertCircle2, { className: "h-4 w-4 shrink-0" }),
14199
- /* @__PURE__ */ jsx43("span", { className: "min-w-0 break-words", children: error })
14200
- ] }) : srcDoc ? /* @__PURE__ */ jsx43(
14201
- "iframe",
14202
- {
14203
- ref: iframeRef,
14204
- title: displayTitle,
14205
- srcDoc,
14206
- className: "block w-full bg-background",
14207
- style: { height },
14208
- sandbox,
14209
- allow: iframeAllow,
14210
- referrerPolicy: "no-referrer"
14211
- }
14212
- ) : null
14213
- ]
14214
- }
14215
- );
14913
+ pendingApproval ? /* @__PURE__ */ jsx43(
14914
+ "div",
14915
+ {
14916
+ role: "alertdialog",
14917
+ "aria-modal": "true",
14918
+ "aria-labelledby": `mcp-app-approval-${pendingApproval.approvalId}`,
14919
+ className: "absolute inset-0 z-20 flex items-center justify-center bg-background/90 p-4 backdrop-blur-sm",
14920
+ children: /* @__PURE__ */ jsxs29("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: [
14921
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-start gap-3", children: [
14922
+ /* @__PURE__ */ jsx43("div", { className: "rounded-full bg-destructive/10 p-2 text-destructive", children: /* @__PURE__ */ jsx43(ShieldAlert, { className: "size-5" }) }),
14923
+ /* @__PURE__ */ jsxs29("div", { className: "min-w-0 flex-1", children: [
14924
+ /* @__PURE__ */ jsxs29("div", { className: "flex flex-wrap items-center gap-2", children: [
14925
+ /* @__PURE__ */ jsx43(
14926
+ "h3",
14927
+ {
14928
+ id: `mcp-app-approval-${pendingApproval.approvalId}`,
14929
+ className: "text-sm font-semibold",
14930
+ children: i18n2.t("message.mcpApp.approvalTitle")
14931
+ }
14932
+ ),
14933
+ /* @__PURE__ */ jsx43(
14934
+ Badge,
14935
+ {
14936
+ variant: "outline",
14937
+ className: "border-destructive/40 text-destructive",
14938
+ children: pendingApproval.risk
14939
+ }
14940
+ )
14941
+ ] }),
14942
+ /* @__PURE__ */ jsx43("p", { className: "mt-1 text-xs text-muted-foreground", children: i18n2.t(
14943
+ pendingApproval.kind === "download" ? "message.mcpApp.downloadApprovalDescription" : "message.mcpApp.toolApprovalDescription",
14944
+ { tool: pendingApproval.toolName }
14945
+ ) })
14946
+ ] })
14947
+ ] }),
14948
+ /* @__PURE__ */ jsxs29("div", { className: "min-h-0", children: [
14949
+ /* @__PURE__ */ jsx43("div", { className: "mb-1 text-xs font-medium", children: i18n2.t("message.mcpApp.requestDetails") }),
14950
+ /* @__PURE__ */ jsx43("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 })
14951
+ ] }),
14952
+ approvalError ? /* @__PURE__ */ jsxs29(
14953
+ "div",
14954
+ {
14955
+ role: "alert",
14956
+ className: "flex items-start gap-2 text-xs text-destructive",
14957
+ children: [
14958
+ /* @__PURE__ */ jsx43(AlertCircle2, { className: "mt-0.5 size-4 shrink-0" }),
14959
+ /* @__PURE__ */ jsx43("span", { children: approvalError })
14960
+ ]
14961
+ }
14962
+ ) : null,
14963
+ /* @__PURE__ */ jsxs29("div", { className: "flex justify-end gap-2", children: [
14964
+ /* @__PURE__ */ jsxs29(
14965
+ Button,
14966
+ {
14967
+ type: "button",
14968
+ variant: "outline",
14969
+ disabled: approvalAction !== null,
14970
+ onClick: () => void resolvePendingApproval("reject"),
14971
+ children: [
14972
+ approvalAction === "reject" ? /* @__PURE__ */ jsx43(Loader28, { className: "animate-spin" }) : null,
14973
+ i18n2.t("message.mcpApp.reject")
14974
+ ]
14975
+ }
14976
+ ),
14977
+ /* @__PURE__ */ jsxs29(
14978
+ Button,
14979
+ {
14980
+ type: "button",
14981
+ variant: pendingApproval.risk === "destructive" ? "destructive" : "default",
14982
+ disabled: approvalAction !== null,
14983
+ onClick: () => void resolvePendingApproval("approve"),
14984
+ children: [
14985
+ approvalAction === "approve" ? /* @__PURE__ */ jsx43(Loader28, { className: "animate-spin" }) : null,
14986
+ i18n2.t("message.mcpApp.approve")
14987
+ ]
14988
+ }
14989
+ )
14990
+ ] })
14991
+ ] })
14992
+ }
14993
+ ) : null,
14994
+ isLoading ? /* @__PURE__ */ jsxs29(
14995
+ "div",
14996
+ {
14997
+ className: cn(
14998
+ "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground",
14999
+ elevatedDisplayMode && "min-h-0 flex-1"
15000
+ ),
15001
+ children: [
15002
+ /* @__PURE__ */ jsx43(Loader28, { className: "h-4 w-4 animate-spin" }),
15003
+ /* @__PURE__ */ jsx43("span", { children: i18n2.t("message.mcpApp.loading") })
15004
+ ]
15005
+ }
15006
+ ) : error ? /* @__PURE__ */ jsxs29(
15007
+ "div",
15008
+ {
15009
+ className: cn(
15010
+ "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive",
15011
+ elevatedDisplayMode && "min-h-0 flex-1"
15012
+ ),
15013
+ children: [
15014
+ /* @__PURE__ */ jsx43(AlertCircle2, { className: "h-4 w-4 shrink-0" }),
15015
+ /* @__PURE__ */ jsx43("span", { className: "min-w-0 break-words", children: error })
15016
+ ]
15017
+ }
15018
+ ) : srcDoc ? /* @__PURE__ */ jsx43(
15019
+ "iframe",
15020
+ {
15021
+ ref: bindIframeRef,
15022
+ title: displayTitle,
15023
+ ...sandboxProxy ? { src: sandboxProxy.url } : { srcDoc },
15024
+ className: cn(
15025
+ "block w-full bg-background",
15026
+ elevatedDisplayMode && "min-h-0 flex-1"
15027
+ ),
15028
+ style: elevatedDisplayMode ? void 0 : { height },
15029
+ sandbox,
15030
+ allow: iframeAllow,
15031
+ referrerPolicy: "no-referrer"
15032
+ }
15033
+ ) : null
15034
+ ]
15035
+ }
15036
+ )
15037
+ ] });
14216
15038
  }
14217
15039
 
14218
15040
  // src/components/thread/messages/ai.tsx
@@ -14500,7 +15322,14 @@ function renderContentItem(content, index, message, lookupMessages, options) {
14500
15322
  return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
14501
15323
  }
14502
15324
  if (isMcpAppComponent(content)) {
14503
- return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(McpAppMessage, { messageId, data: content.data }) }, content.id ?? `mcp-app-${index}`);
15325
+ return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
15326
+ McpAppMessage,
15327
+ {
15328
+ messageId,
15329
+ data: content.data,
15330
+ mcpApps: options?.mcpApps
15331
+ }
15332
+ ) }, content.id ?? `mcp-app-${index}`);
14504
15333
  }
14505
15334
  if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
14506
15335
  return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
@@ -14530,7 +15359,8 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
14530
15359
  isThreadRunning: options?.isThreadRunning,
14531
15360
  organizationId: options?.organizationId,
14532
15361
  apiUrl: options?.apiUrl,
14533
- isAgentOutput: options?.isAgentOutput
15362
+ isAgentOutput: options?.isAgentOutput,
15363
+ mcpApps: options?.mcpApps
14534
15364
  });
14535
15365
  }
14536
15366
  return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
@@ -14681,7 +15511,8 @@ function AssistantMessage({
14681
15511
  isThreadRunning,
14682
15512
  organizationId,
14683
15513
  apiUrl,
14684
- pet
15514
+ pet,
15515
+ mcpApps
14685
15516
  }) {
14686
15517
  const { t } = useChatkitTranslation();
14687
15518
  const renderTree = buildAssistantRenderTree(
@@ -14697,7 +15528,8 @@ function AssistantMessage({
14697
15528
  const answerNode = renderContent(message, lookupMessages, {
14698
15529
  isThreadRunning,
14699
15530
  organizationId,
14700
- apiUrl
15531
+ apiUrl,
15532
+ mcpApps
14701
15533
  });
14702
15534
  const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx44(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
14703
15535
  if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
@@ -16962,13 +17794,13 @@ import {
16962
17794
  } from "@xpert-ai/xpert-sdk";
16963
17795
  import {
16964
17796
  Loader2 as Loader210,
16965
- Maximize2,
16966
- Minimize2,
17797
+ Maximize2 as Maximize22,
17798
+ Minimize2 as Minimize22,
16967
17799
  PanelRight,
16968
17800
  RotateCcw,
16969
17801
  X as X8
16970
17802
  } from "lucide-react";
16971
- import { Fragment as Fragment9, jsx as jsx57, jsxs as jsxs39 } from "react/jsx-runtime";
17803
+ import { Fragment as Fragment10, jsx as jsx57, jsxs as jsxs39 } from "react/jsx-runtime";
16972
17804
  var WorkbenchContext = React52.createContext({
16973
17805
  enabled: false,
16974
17806
  open: false,
@@ -18344,7 +19176,7 @@ function formatElapsed(value) {
18344
19176
  }
18345
19177
 
18346
19178
  // src/components/chat.tsx
18347
- import { Fragment as Fragment11, jsx as jsx60, jsxs as jsxs42 } from "react/jsx-runtime";
19179
+ import { Fragment as Fragment12, jsx as jsx60, jsxs as jsxs42 } from "react/jsx-runtime";
18348
19180
  var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
18349
19181
  var COMPOSER_INPUT_MAX_HEIGHT = 128;
18350
19182
  var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
@@ -20472,7 +21304,7 @@ function Chat({
20472
21304
  ) }) }),
20473
21305
  /* @__PURE__ */ jsx60(TooltipContent, { side: "bottom", children: t("settings.open") })
20474
21306
  ] }),
20475
- history?.enabled !== false && /* @__PURE__ */ jsxs42(Fragment11, { children: [
21307
+ history?.enabled !== false && /* @__PURE__ */ jsxs42(Fragment12, { children: [
20476
21308
  /* @__PURE__ */ jsxs42(Tooltip, { children: [
20477
21309
  /* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx60(
20478
21310
  "button",
@@ -20649,9 +21481,10 @@ function Chat({
20649
21481
  isThreadRunning: currentThreadIsRunning,
20650
21482
  organizationId: stream.organizationId,
20651
21483
  apiUrl: stream.apiUrl,
20652
- pet: effectivePet
21484
+ pet: effectivePet,
21485
+ mcpApps: options?.mcpApps
20653
21486
  }
20654
- ) : /* @__PURE__ */ jsxs42(Fragment11, { children: [
21487
+ ) : /* @__PURE__ */ jsxs42(Fragment12, { children: [
20655
21488
  message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsx60(
20656
21489
  HumanRuntimeCapabilityChips,
20657
21490
  {