@xpert-ai/chatkit-ui 0.5.1 → 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-Ce9kroYt.js → _baseUniq-ChT9Qo4e.js} +1 -1
  2. package/dist/app/assets/{abap-n34Q__Y2.js → abap-Ce7DiJV3.js} +1 -1
  3. package/dist/app/assets/{abnf-C6UcGmhd.js → abnf-BVHFzq1y.js} +1 -1
  4. package/dist/app/assets/{actionscript-CorZU6Nf.js → actionscript-b1N6pm-O.js} +1 -1
  5. package/dist/app/assets/{ada-tLvNZOQh.js → ada-rBXyByh8.js} +1 -1
  6. package/dist/app/assets/{agda-DbFkZh7g.js → agda-BBQB7lJp.js} +1 -1
  7. package/dist/app/assets/{al-D0vYS2t5.js → al-Bo-88aPW.js} +1 -1
  8. package/dist/app/assets/{antlr4-CnwZDtYg.js → antlr4-BP25W3T7.js} +1 -1
  9. package/dist/app/assets/{apacheconf-xvN2ZspY.js → apacheconf-hxzhJkXa.js} +1 -1
  10. package/dist/app/assets/{apex-Ca7x_VSV.js → apex-B9XGHTVl.js} +1 -1
  11. package/dist/app/assets/{apl-Nlqpwd_h.js → apl-CnE-JBL6.js} +1 -1
  12. package/dist/app/assets/{applescript-B7voCk61.js → applescript-BGxq2QF0.js} +1 -1
  13. package/dist/app/assets/{aql-DgJPtgpm.js → aql-KrbZMJlr.js} +1 -1
  14. package/dist/app/assets/{arc-CsunRIF0.js → arc-BmJ5F6oU.js} +1 -1
  15. package/dist/app/assets/{architectureDiagram-Q4EWVU46-pomq3v1V.js → architectureDiagram-Q4EWVU46-Dz1_Ibzx.js} +1 -1
  16. package/dist/app/assets/{arduino-o8aJCPRY.js → arduino-BrA3jTJh.js} +1 -1
  17. package/dist/app/assets/{arff-BUeLNSP_.js → arff-O0GaAEXp.js} +1 -1
  18. package/dist/app/assets/{asciidoc-CCuKAHbX.js → asciidoc-ClkiMNF8.js} +1 -1
  19. package/dist/app/assets/{asm6502-nv6NOrZ1.js → asm6502-5bKj4vQ6.js} +1 -1
  20. package/dist/app/assets/{asmatmel-CnOLubJx.js → asmatmel-DgpgDfTH.js} +1 -1
  21. package/dist/app/assets/{aspnet-DVUcYapb.js → aspnet-DIULsgBh.js} +1 -1
  22. package/dist/app/assets/{autohotkey-CGe8-Vkb.js → autohotkey-DPq46f5T.js} +1 -1
  23. package/dist/app/assets/{autoit-DLNStY8z.js → autoit-DDnxI--a.js} +1 -1
  24. package/dist/app/assets/{avisynth-zfhebB-x.js → avisynth-C1Lt9ROp.js} +1 -1
  25. package/dist/app/assets/{avro-idl-B6HK8dnl.js → avro-idl-CGvQ4UxL.js} +1 -1
  26. package/dist/app/assets/{bash-DKyhbfmw.js → bash-D8eqCsZ8.js} +1 -1
  27. package/dist/app/assets/{basic-BGbUzkZk.js → basic-DrODtqCb.js} +1 -1
  28. package/dist/app/assets/{batch-B_xESmm_.js → batch-DqeGqoQZ.js} +1 -1
  29. package/dist/app/assets/{bbcode-Bb7EayNp.js → bbcode-CY9lX15S.js} +1 -1
  30. package/dist/app/assets/{bicep-DgMgkIZg.js → bicep-BDv89DRM.js} +1 -1
  31. package/dist/app/assets/{birb-DLc39bo4.js → birb-DgNPr1Tg.js} +1 -1
  32. package/dist/app/assets/{bison-DP2ldkO8.js → bison-BH6C31Lr.js} +1 -1
  33. package/dist/app/assets/{blockDiagram-DXYQGD6D-CHPjX37-.js → blockDiagram-DXYQGD6D-BizaVLYu.js} +1 -1
  34. package/dist/app/assets/{bnf-Br-Qarn0.js → bnf-BBDWrGyG.js} +1 -1
  35. package/dist/app/assets/{brainfuck-DmZ-6z5e.js → brainfuck-DhaNdGJl.js} +1 -1
  36. package/dist/app/assets/{brightscript-BmorAJiX.js → brightscript-DiGiUax0.js} +1 -1
  37. package/dist/app/assets/{bro-ui-o0ljK.js → bro-DZY9XGEu.js} +1 -1
  38. package/dist/app/assets/{bsl-CP9I-0dQ.js → bsl-W7fV4TQH.js} +1 -1
  39. package/dist/app/assets/{c-C4OyJNBq.js → c-CkCwgvhy.js} +1 -1
  40. package/dist/app/assets/{c4Diagram-AHTNJAMY-DTeO2JDt.js → c4Diagram-AHTNJAMY-0Cj5K2_S.js} +1 -1
  41. package/dist/app/assets/{cfscript-DX-iTpAV.js → cfscript-CPFnj1HR.js} +1 -1
  42. package/dist/app/assets/{chaiscript-BR2QXPQ1.js → chaiscript-RQ2qKbDX.js} +1 -1
  43. package/dist/app/assets/channel-CrrgI7jC.js +1 -0
  44. package/dist/app/assets/{chunk-4BX2VUAB-CjtJRi8f.js → chunk-4BX2VUAB-jYTZLj5e.js} +1 -1
  45. package/dist/app/assets/{chunk-4TB4RGXK-CM0eB5d0.js → chunk-4TB4RGXK-59Kj6DwN.js} +1 -1
  46. package/dist/app/assets/{chunk-55IACEB6-BxP67n9y.js → chunk-55IACEB6-M7fxqf0U.js} +1 -1
  47. package/dist/app/assets/{chunk-EDXVE4YY-Bt3onUxq.js → chunk-EDXVE4YY-Bk0s3eDs.js} +1 -1
  48. package/dist/app/assets/{chunk-FMBD7UC4-9UeRly0Y.js → chunk-FMBD7UC4-DHgDQnYu.js} +1 -1
  49. package/dist/app/assets/{chunk-OYMX7WX6-B34wN_7o.js → chunk-OYMX7WX6-DId-EsyC.js} +1 -1
  50. package/dist/app/assets/{chunk-QZHKN3VN-ClX44MR5.js → chunk-QZHKN3VN-DAUAP7IC.js} +1 -1
  51. package/dist/app/assets/{chunk-YZCP3GAM-6U6v2Ij5.js → chunk-YZCP3GAM-BsCgIURb.js} +1 -1
  52. package/dist/app/assets/{cil-DTGWd9p2.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-Drp-qkIS.js → clike-DIAL6hbW.js} +1 -1
  56. package/dist/app/assets/{clojure-DPhPcpXc.js → clojure-CFCnhIDV.js} +1 -1
  57. package/dist/app/assets/clone-BurOzDBp.js +1 -0
  58. package/dist/app/assets/{cmake-C5ihWdjd.js → cmake-BJ7M3VLa.js} +1 -1
  59. package/dist/app/assets/{cobol-DfdQKzy-.js → cobol-CHafHfaf.js} +1 -1
  60. package/dist/app/assets/{coffeescript-ILUZkjNM.js → coffeescript-D-myNsVo.js} +1 -1
  61. package/dist/app/assets/{concurnas-CDS4cF-K.js → concurnas-CMSXd2bi.js} +1 -1
  62. package/dist/app/assets/{coq-CMcikezn.js → coq-2WMbyt5L.js} +1 -1
  63. package/dist/app/assets/{core-DNVeH_3a.js → core-D_mcgtst.js} +1 -1
  64. package/dist/app/assets/{cose-bilkent-S5V4N54A-BSyBdp9N.js → cose-bilkent-S5V4N54A-CFYSME8q.js} +1 -1
  65. package/dist/app/assets/{cpp-BRKriMlK.js → cpp-BFYZXt4W.js} +1 -1
  66. package/dist/app/assets/{crystal-B-fnvxvI.js → crystal-YbXf5NLu.js} +1 -1
  67. package/dist/app/assets/{csharp-DpXgCaWk.js → csharp-CrpatUEr.js} +1 -1
  68. package/dist/app/assets/{cshtml-dmLvM2uH.js → cshtml-DdDPOFL2.js} +1 -1
  69. package/dist/app/assets/{csp-Dbw-zK12.js → csp-BuLrc-qp.js} +1 -1
  70. package/dist/app/assets/{css-DQ6uGRR1.js → css-BP2xEqtJ.js} +1 -1
  71. package/dist/app/assets/{css-extras-DBnbwFR3.js → css-extras-BUdZfgaW.js} +1 -1
  72. package/dist/app/assets/{csv-gTIFW0jL.js → csv-CxUvYF3W.js} +1 -1
  73. package/dist/app/assets/{cypher-BrMaFn8s.js → cypher-dyjlMPfG.js} +1 -1
  74. package/dist/app/assets/{d-DTUwRQFn.js → d-CAXNQWlH.js} +1 -1
  75. package/dist/app/assets/{dagre-KV5264BT-BL-XJIT6.js → dagre-KV5264BT-B9TaDHlk.js} +1 -1
  76. package/dist/app/assets/{dart-B0eIMGx2.js → dart-J8aLCmN6.js} +1 -1
  77. package/dist/app/assets/{dataweave-BDWjNgl1.js → dataweave-DF9ImZ3N.js} +1 -1
  78. package/dist/app/assets/{dax-B3X4ILlW.js → dax-BT2AHpyf.js} +1 -1
  79. package/dist/app/assets/{dhall-D2V6j5gZ.js → dhall-Dg1Tevpu.js} +1 -1
  80. package/dist/app/assets/{diagram-5BDNPKRD-DjSf5aPM.js → diagram-5BDNPKRD-WO42pTkv.js} +1 -1
  81. package/dist/app/assets/{diagram-G4DWMVQ6-CjgjKQZL.js → diagram-G4DWMVQ6-7TQ5HPZE.js} +1 -1
  82. package/dist/app/assets/{diagram-MMDJMWI5-7h7nqJCu.js → diagram-MMDJMWI5-7RdXMs-Z.js} +1 -1
  83. package/dist/app/assets/{diagram-TYMM5635-Blv4tCDc.js → diagram-TYMM5635-WTtOoqLh.js} +1 -1
  84. package/dist/app/assets/{diff-B9ExgdIq.js → diff-CqmM9jMk.js} +1 -1
  85. package/dist/app/assets/{django-DORrnMzH.js → django-BV_Txwli.js} +1 -1
  86. package/dist/app/assets/{dns-zone-file-C8pb3-VQ.js → dns-zone-file-chHftqfl.js} +1 -1
  87. package/dist/app/assets/{docker-K5zfOBbh.js → docker-CP5sCvPc.js} +1 -1
  88. package/dist/app/assets/{dot-CvXtQhe1.js → dot-CslM1TDF.js} +1 -1
  89. package/dist/app/assets/{ebnf-N8Sygx-N.js → ebnf-D2Ek46XJ.js} +1 -1
  90. package/dist/app/assets/{editorconfig-CrLAxwn-.js → editorconfig-Ci8FK60B.js} +1 -1
  91. package/dist/app/assets/{eiffel-BJwHlQOK.js → eiffel-Cwub3-yA.js} +1 -1
  92. package/dist/app/assets/{ejs-GGhkWnqP.js → ejs-C6kPczUt.js} +1 -1
  93. package/dist/app/assets/{elixir-DNWJz4Xa.js → elixir-DC01nBAk.js} +1 -1
  94. package/dist/app/assets/{elm-BDj2cjFK.js → elm-ng29Uzm3.js} +1 -1
  95. package/dist/app/assets/{erDiagram-SMLLAGMA-Qd-vYbo0.js → erDiagram-SMLLAGMA-CSu1K2TE.js} +1 -1
  96. package/dist/app/assets/{erb-DZbc5cT0.js → erb-BmVXUkNt.js} +1 -1
  97. package/dist/app/assets/{erlang-HJFTxOlp.js → erlang-DX8lZuNY.js} +1 -1
  98. package/dist/app/assets/{etlua-DQuXDXVj.js → etlua-DF9WPqFy.js} +1 -1
  99. package/dist/app/assets/{excel-formula-CLcITwv0.js → excel-formula-DHOUaKKc.js} +1 -1
  100. package/dist/app/assets/{factor-D6TFKT97.js → factor-BBsagI82.js} +1 -1
  101. package/dist/app/assets/{false-CYOIbDmC.js → false-BwLYv3CT.js} +1 -1
  102. package/dist/app/assets/{firestore-security-rules-BuK7qGD7.js → firestore-security-rules-CsYkwF2L.js} +1 -1
  103. package/dist/app/assets/{flow-C9RrJxhr.js → flow-fPHEMMRe.js} +1 -1
  104. package/dist/app/assets/{flowDiagram-DWJPFMVM-B4wKPM8W.js → flowDiagram-DWJPFMVM-CjMcT8VF.js} +1 -1
  105. package/dist/app/assets/{fortran-Cd_ZN6vC.js → fortran-BlFC22wE.js} +1 -1
  106. package/dist/app/assets/{fsharp-GjO2h33T.js → fsharp-qPaHfboo.js} +1 -1
  107. package/dist/app/assets/{ftl-aJWw1c8T.js → ftl-Dez07P0T.js} +1 -1
  108. package/dist/app/assets/{ganttDiagram-T4ZO3ILL-rd9NbSdv.js → ganttDiagram-T4ZO3ILL-BiQxSqt_.js} +1 -1
  109. package/dist/app/assets/{gap-DNVVFLRr.js → gap-DJplhPXp.js} +1 -1
  110. package/dist/app/assets/{gcode-D4lPKbIg.js → gcode-Dg1b5k4P.js} +1 -1
  111. package/dist/app/assets/{gdscript-DfNV-tUB.js → gdscript-BVrkBC3R.js} +1 -1
  112. package/dist/app/assets/{gedcom-BYPvubZJ.js → gedcom-CrxzyI_t.js} +1 -1
  113. package/dist/app/assets/{gherkin-BMNoBcck.js → gherkin-XsNIfB3o.js} +1 -1
  114. package/dist/app/assets/{git-CPJZLB2T.js → git-sYqvjDtZ.js} +1 -1
  115. package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-C99FXzLh.js → gitGraphDiagram-UUTBAWPF-BLuiUQC4.js} +1 -1
  116. package/dist/app/assets/{glsl-Nh5fsOnK.js → glsl-DBAWeWvj.js} +1 -1
  117. package/dist/app/assets/{gml-txELJam3.js → gml-D9dDabjR.js} +1 -1
  118. package/dist/app/assets/{gn-CgbeYSf5.js → gn-C_VSOkBi.js} +1 -1
  119. package/dist/app/assets/{go-Dk6Du7he.js → go-WIUDW1GS.js} +1 -1
  120. package/dist/app/assets/{go-module-Bo2KYSxb.js → go-module-C_q6u5lV.js} +1 -1
  121. package/dist/app/assets/{graph-CLnrzjFn.js → graph-CQZE41Xl.js} +1 -1
  122. package/dist/app/assets/{graphql-4dWoWhbW.js → graphql-CCzYeA7K.js} +1 -1
  123. package/dist/app/assets/{groovy-B4OrjFbV.js → groovy-Dcndc-8V.js} +1 -1
  124. package/dist/app/assets/{haml-BvDou6bp.js → haml-DAdQxEtZ.js} +1 -1
  125. package/dist/app/assets/{handlebars-M16IKRgI.js → handlebars-DdcZ78iT.js} +1 -1
  126. package/dist/app/assets/{haskell-DfIt0IAN.js → haskell-CL_s7J5t.js} +1 -1
  127. package/dist/app/assets/{haxe-C85tjL19.js → haxe-D6kxxTPa.js} +1 -1
  128. package/dist/app/assets/{hcl-DmdFYIW6.js → hcl-v_Duxzy7.js} +1 -1
  129. package/dist/app/assets/{hlsl-spPkbYrW.js → hlsl-DvMfgEKG.js} +1 -1
  130. package/dist/app/assets/{hoon-CG21lORC.js → hoon-DtG7k-4U.js} +1 -1
  131. package/dist/app/assets/{hpkp-oexmO6k-.js → hpkp-j-ypNrrU.js} +1 -1
  132. package/dist/app/assets/{hsts-DdwaHzev.js → hsts-ukPmjqGZ.js} +1 -1
  133. package/dist/app/assets/{http-Cg3ksPMe.js → http-BMxLX5wW.js} +1 -1
  134. package/dist/app/assets/{ichigojam-BdxMuPXk.js → ichigojam-CKMzeTbi.js} +1 -1
  135. package/dist/app/assets/{icon-wGd3Tmq9.js → icon-BI_YktC6.js} +1 -1
  136. package/dist/app/assets/{icu-message-format-CPXO2yc9.js → icu-message-format-CKWPiv_u.js} +1 -1
  137. package/dist/app/assets/{idris-D5u9JHmM.js → idris-CEoG17tH.js} +1 -1
  138. package/dist/app/assets/{iecst-DYq8QbAy.js → iecst-BPgsr1sk.js} +1 -1
  139. package/dist/app/assets/{ignore-Ci5lSqDb.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-BoJMIP_v.js → infoDiagram-42DDH7IO-CXt53QRt.js} +1 -1
  143. package/dist/app/assets/{inform7-DUJXcXaB.js → inform7-BRNaKTTS.js} +1 -1
  144. package/dist/app/assets/{ini-CuJ_bmMO.js → ini-Co63A9KY.js} +1 -1
  145. package/dist/app/assets/{io-C-FJQSO3.js → io-Y6dFSwsb.js} +1 -1
  146. package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-BAmPMiIi.js → ishikawaDiagram-UXIWVN3A-BtfknNuf.js} +1 -1
  147. package/dist/app/assets/{j-DtaSK1sz.js → j-Cpt-bjtI.js} +1 -1
  148. package/dist/app/assets/{java-CDetIt27.js → java-OV7NSS4M.js} +1 -1
  149. package/dist/app/assets/{javadoc-CZ3CDS4n.js → javadoc-1xPzWdCF.js} +1 -1
  150. package/dist/app/assets/{javadoclike-BeacuSWR.js → javadoclike-BcMUnjFK.js} +1 -1
  151. package/dist/app/assets/{javascript-BfOPyJLM.js → javascript-CqCV1NzJ.js} +1 -1
  152. package/dist/app/assets/{javastacktrace-29iN0R0u.js → javastacktrace-BUFSCM4B.js} +1 -1
  153. package/dist/app/assets/{jexl-BnpIjElm.js → jexl-CCwB7QfC.js} +1 -1
  154. package/dist/app/assets/{jolie-D93yxHe4.js → jolie-CI7ZKpQW.js} +1 -1
  155. package/dist/app/assets/{journeyDiagram-VCZTEJTY-DMpcabcO.js → journeyDiagram-VCZTEJTY-CtPUPowP.js} +1 -1
  156. package/dist/app/assets/{jq-BugvYH1H.js → jq-Cat52Ckh.js} +1 -1
  157. package/dist/app/assets/{js-extras-C0MSZLc1.js → js-extras-BW8AY5FQ.js} +1 -1
  158. package/dist/app/assets/{js-templates-CIxTZsvj.js → js-templates-pTyGClWG.js} +1 -1
  159. package/dist/app/assets/{jsdoc-p5Pfu_De.js → jsdoc-C5dISiXN.js} +1 -1
  160. package/dist/app/assets/{json-BQjux9AS.js → json-BV_ZLpYa.js} +1 -1
  161. package/dist/app/assets/{json5-DtGyU4mC.js → json5-CaLO3fQi.js} +1 -1
  162. package/dist/app/assets/{jsonp-nmJM1qGA.js → jsonp-DsV6uVRp.js} +1 -1
  163. package/dist/app/assets/{jsstacktrace-idjkM4Fl.js → jsstacktrace-CcXrnL18.js} +1 -1
  164. package/dist/app/assets/{jsx-Bgnu51Le.js → jsx-D59JtHOy.js} +1 -1
  165. package/dist/app/assets/{julia-Bn7OUNnL.js → julia-CclEoB-n.js} +1 -1
  166. package/dist/app/assets/{kanban-definition-6JOO6SKY-bkQodnTu.js → kanban-definition-6JOO6SKY-DAwZttRD.js} +1 -1
  167. package/dist/app/assets/{keepalived-D4SLcdBV.js → keepalived-CFWxCW-H.js} +1 -1
  168. package/dist/app/assets/{keyman-PLQYqBep.js → keyman-BVv9EQYe.js} +1 -1
  169. package/dist/app/assets/{kotlin-C4WnY-H1.js → kotlin-CslW8NWU.js} +1 -1
  170. package/dist/app/assets/{kumir-BNZk5sfe.js → kumir-DTu9BtLG.js} +1 -1
  171. package/dist/app/assets/{kusto-3PKAizI3.js → kusto-CtqoVlVe.js} +1 -1
  172. package/dist/app/assets/{latex-6XZaVCJa.js → latex-18RzpOnX.js} +1 -1
  173. package/dist/app/assets/{latte-CV-fKPnc.js → latte-BLDf5fvr.js} +1 -1
  174. package/dist/app/assets/{layout-1vS3Wjec.js → layout-kfH7ie9s.js} +1 -1
  175. package/dist/app/assets/{less-SX3s-KN_.js → less-CBsIVmwy.js} +1 -1
  176. package/dist/app/assets/{lilypond-Dy86N6CJ.js → lilypond-Diikt1xh.js} +1 -1
  177. package/dist/app/assets/{linear-C0n3Pq7-.js → linear-CpWdLpIW.js} +1 -1
  178. package/dist/app/assets/{liquid-L9Zjy8lu.js → liquid-CYsFgJAn.js} +1 -1
  179. package/dist/app/assets/{lisp-DJFjEPwB.js → lisp-D5IX2IMS.js} +1 -1
  180. package/dist/app/assets/{livescript-DQotEykh.js → livescript-CFLCkEiE.js} +1 -1
  181. package/dist/app/assets/{llvm-DvKCeTL1.js → llvm-CHtlwgXC.js} +1 -1
  182. package/dist/app/assets/{log--xBJ8aU-.js → log-Bb0q4gWy.js} +1 -1
  183. package/dist/app/assets/{lolcode-Cg9QnKMI.js → lolcode-DcN_7oO2.js} +1 -1
  184. package/dist/app/assets/{lua-DEQhbUQJ.js → lua-t7DZ5tkJ.js} +1 -1
  185. package/dist/app/assets/{magma-D1XGKRht.js → magma-72K2RrWH.js} +1 -1
  186. package/dist/app/assets/{makefile-BLlH1MLd.js → makefile-DvrABWRt.js} +1 -1
  187. package/dist/app/assets/{markdown-Dj_RZXj9.js → markdown-CF5Lb7qd.js} +1 -1
  188. package/dist/app/assets/{markup-BXU1zXD3.js → markup-CrH5Qer4.js} +1 -1
  189. package/dist/app/assets/{markup-templating-D0wFjPUm.js → markup-templating-BqtThcnw.js} +1 -1
  190. package/dist/app/assets/{matlab-C6S4uunt.js → matlab-Cl5LNbiN.js} +1 -1
  191. package/dist/app/assets/{maxscript-BdKoHZYI.js → maxscript-DryW9P8J.js} +1 -1
  192. package/dist/app/assets/{mel-Couq0V6g.js → mel-C4tZH7tA.js} +1 -1
  193. package/dist/app/assets/{mermaid-CMZsziQ6.js → mermaid-CMyXjaN5.js} +1 -1
  194. package/dist/app/assets/{min-BzZkQG2V.js → min-BSLr1xjt.js} +1 -1
  195. package/dist/app/assets/{mindmap-definition-QFDTVHPH-DiRQVvqc.js → mindmap-definition-QFDTVHPH-D_rZAJl5.js} +1 -1
  196. package/dist/app/assets/{mizar-CmFVSskP.js → mizar-Hb1RtA6I.js} +1 -1
  197. package/dist/app/assets/{mongodb-CLcoBk0S.js → mongodb-C9eHJ0I9.js} +1 -1
  198. package/dist/app/assets/{monkey-C9CvZyfC.js → monkey-5znuwlAY.js} +1 -1
  199. package/dist/app/assets/{moonscript-BuimfgIY.js → moonscript-BiOwz93j.js} +1 -1
  200. package/dist/app/assets/{n1ql-CTSd0zm2.js → n1ql-BOK-qtfI.js} +1 -1
  201. package/dist/app/assets/{n4js-CbUC_VS8.js → n4js-gUw2INcg.js} +1 -1
  202. package/dist/app/assets/{nand2tetris-hdl-CCeNYzYf.js → nand2tetris-hdl-DulMQ1fH.js} +1 -1
  203. package/dist/app/assets/{naniscript-x_Bk9Hzy.js → naniscript-Fwk03Juz.js} +1 -1
  204. package/dist/app/assets/{nasm-2Q9W1sFN.js → nasm-DyQXh7z1.js} +1 -1
  205. package/dist/app/assets/{neon-C1WpBpfz.js → neon-DpkOLWSF.js} +1 -1
  206. package/dist/app/assets/{nevod-DDSjKKhW.js → nevod-BXopGva8.js} +1 -1
  207. package/dist/app/assets/{nginx-iykGSiRV.js → nginx-DPSO5ekf.js} +1 -1
  208. package/dist/app/assets/{nim-CQWNrhbj.js → nim-Bq6d6_Bu.js} +1 -1
  209. package/dist/app/assets/{nix-JWm7pRtl.js → nix-Dy2iCPYK.js} +1 -1
  210. package/dist/app/assets/{nsis-BETMjcJ8.js → nsis-C53FxEmM.js} +1 -1
  211. package/dist/app/assets/{objectivec-EAqrfrLq.js → objectivec-ClHOfm6L.js} +1 -1
  212. package/dist/app/assets/{ocaml-B73L71D-.js → ocaml-Bd4mMVMR.js} +1 -1
  213. package/dist/app/assets/{opencl-Dv19N-y4.js → opencl-CH3K7nMz.js} +1 -1
  214. package/dist/app/assets/{openqasm-BmgYVbuD.js → openqasm-SOdUhTmx.js} +1 -1
  215. package/dist/app/assets/{oz-D7xUetz0.js → oz-BOUspg_L.js} +1 -1
  216. package/dist/app/assets/{parigp-BGPB83BL.js → parigp-BnU6Vr73.js} +1 -1
  217. package/dist/app/assets/{parser-DFwHmecM.js → parser-jweo2qRc.js} +1 -1
  218. package/dist/app/assets/{pascal-Bg0EHupl.js → pascal-CKG3Ve5B.js} +1 -1
  219. package/dist/app/assets/{pascaligo-qppvQVZh.js → pascaligo-DnSgOfZi.js} +1 -1
  220. package/dist/app/assets/{pcaxis-zxwNMmzG.js → pcaxis-s94ah1qs.js} +1 -1
  221. package/dist/app/assets/{peoplecode-aPBh21FL.js → peoplecode-DoIvIKcb.js} +1 -1
  222. package/dist/app/assets/{perl-DPlCkPwa.js → perl-BXJBS0qx.js} +1 -1
  223. package/dist/app/assets/{php-DlClIcn1.js → php-BlzlR4_v.js} +1 -1
  224. package/dist/app/assets/{php-extras-B6nC-epf.js → php-extras-hjEa1iTA.js} +1 -1
  225. package/dist/app/assets/{phpdoc-CQwATDWr.js → phpdoc-Ch0l7Uv9.js} +1 -1
  226. package/dist/app/assets/{pieDiagram-DEJITSTG-ZZdynjQu.js → pieDiagram-DEJITSTG-BK8YBT53.js} +1 -1
  227. package/dist/app/assets/{plsql-gwEVqfo5.js → plsql-BmSD3Q1k.js} +1 -1
  228. package/dist/app/assets/{powerquery-BLpUU-Qe.js → powerquery-DM7b-u-o.js} +1 -1
  229. package/dist/app/assets/{powershell-CIWIjKwt.js → powershell-CXsqbD80.js} +1 -1
  230. package/dist/app/assets/{processing-DKWcA2i2.js → processing-RuoLznsF.js} +1 -1
  231. package/dist/app/assets/{prolog-9OQJdrqd.js → prolog-Bu4ZaUxi.js} +1 -1
  232. package/dist/app/assets/{promql-DKIqOQse.js → promql-DOOZUaV8.js} +1 -1
  233. package/dist/app/assets/{properties-HZOZNshI.js → properties-Be3moloV.js} +1 -1
  234. package/dist/app/assets/{protobuf-D4e9GvZm.js → protobuf-N7mb4_Rv.js} +1 -1
  235. package/dist/app/assets/{psl-BDJcNy4H.js → psl-Cww5iKGd.js} +1 -1
  236. package/dist/app/assets/{pug-BciWBcyM.js → pug-DSLvyPtG.js} +1 -1
  237. package/dist/app/assets/{puppet-BwKdHDrd.js → puppet-CxmK6KXr.js} +1 -1
  238. package/dist/app/assets/{pure-BSz8_WDZ.js → pure-CEWpRrG_.js} +1 -1
  239. package/dist/app/assets/{purebasic-Ce_8iIHd.js → purebasic-BkihQx2l.js} +1 -1
  240. package/dist/app/assets/{purescript-CHrsPtZ9.js → purescript-Dv8RWtry.js} +1 -1
  241. package/dist/app/assets/{q-Djr7XowN.js → q-BWG_IRXv.js} +1 -1
  242. package/dist/app/assets/{qml-DbX95iXW.js → qml-DNdfSfok.js} +1 -1
  243. package/dist/app/assets/{qore-BHW3iBdM.js → qore-DN6GB5B6.js} +1 -1
  244. package/dist/app/assets/{qsharp-BaAkOfW0.js → qsharp-DwetPVRU.js} +1 -1
  245. package/dist/app/assets/{quadrantDiagram-34T5L4WZ-dzekw0wf.js → quadrantDiagram-34T5L4WZ-wVPtNsq8.js} +1 -1
  246. package/dist/app/assets/{r-C2Wi4ctz.js → r-mq6rsL09.js} +1 -1
  247. package/dist/app/assets/{racket-CtmIzacn.js → racket-DG9wIycI.js} +1 -1
  248. package/dist/app/assets/{reason-BLzyiTlK.js → reason-QDeJ9fGt.js} +1 -1
  249. package/dist/app/assets/{regex-CH5UvELj.js → regex-CJq5NHvY.js} +1 -1
  250. package/dist/app/assets/{rego-v3vNlK8Q.js → rego-CuCkTZEO.js} +1 -1
  251. package/dist/app/assets/{renpy-BsOG2Btw.js → renpy-CF60Vgpp.js} +1 -1
  252. package/dist/app/assets/{requirementDiagram-MS252O5E-CMtqQ9Uq.js → requirementDiagram-MS252O5E-NYm3MUgE.js} +1 -1
  253. package/dist/app/assets/{rest-DiRiIIU_.js → rest-pvM9_VPV.js} +1 -1
  254. package/dist/app/assets/{rip-Dn-VCwd0.js → rip-knfZMbzc.js} +1 -1
  255. package/dist/app/assets/{roboconf-XNQCqxFr.js → roboconf-DE2PK0Rv.js} +1 -1
  256. package/dist/app/assets/{robotframework-8GvGUNLP.js → robotframework-CLlyRuvY.js} +1 -1
  257. package/dist/app/assets/{ruby-DTQqq5Uk.js → ruby-x5dznEbw.js} +1 -1
  258. package/dist/app/assets/{rust-D6sLZv9h.js → rust-9aWCBT_0.js} +1 -1
  259. package/dist/app/assets/{sankeyDiagram-XADWPNL6-DWO_8lqE.js → sankeyDiagram-XADWPNL6-BOYwPyyU.js} +1 -1
  260. package/dist/app/assets/{sas-BZ3aX4ak.js → sas-C2Y0yCZT.js} +1 -1
  261. package/dist/app/assets/{sass-B5upkPlg.js → sass-BVG4jrsz.js} +1 -1
  262. package/dist/app/assets/{scala-C2MBe7Td.js → scala-CILasXNs.js} +1 -1
  263. package/dist/app/assets/{scheme-B6zEBCUv.js → scheme-DMT3k7Ay.js} +1 -1
  264. package/dist/app/assets/{scss-m1aDBK-3.js → scss-DM3koaoe.js} +1 -1
  265. package/dist/app/assets/{sequenceDiagram-FGHM5R23-Bk8amHDy.js → sequenceDiagram-FGHM5R23-DL40pkmm.js} +1 -1
  266. package/dist/app/assets/{shell-session-BVS7EgIU.js → shell-session-Dxpec_d0.js} +1 -1
  267. package/dist/app/assets/{smali-DHLQ25o5.js → smali-D1whxEhZ.js} +1 -1
  268. package/dist/app/assets/{smalltalk-C5AE6G6i.js → smalltalk-BQMH8qD7.js} +1 -1
  269. package/dist/app/assets/{smarty-C6oBJXh8.js → smarty-JrMCkQIc.js} +1 -1
  270. package/dist/app/assets/{sml-CBjer1Ju.js → sml-mhC7b4QX.js} +1 -1
  271. package/dist/app/assets/{solidity-Hg07d2HS.js → solidity-BSynZrZc.js} +1 -1
  272. package/dist/app/assets/{solution-file-Knd6ACih.js → solution-file-DAfssftu.js} +1 -1
  273. package/dist/app/assets/{soy-DYzVZHI3.js → soy-DU7nZVR7.js} +1 -1
  274. package/dist/app/assets/{sparql-C-Jfk-cp.js → sparql-Cq3r5HHF.js} +1 -1
  275. package/dist/app/assets/{splunk-spl-BzboKtD3.js → splunk-spl-CGcTPfRb.js} +1 -1
  276. package/dist/app/assets/{sqf-DPSSziDQ.js → sqf-CG8TBMKD.js} +1 -1
  277. package/dist/app/assets/{sql-BpvJJLoy.js → sql-e3vFyHiF.js} +1 -1
  278. package/dist/app/assets/{squirrel-DvWBwB7O.js → squirrel-CYCMghr2.js} +1 -1
  279. package/dist/app/assets/{stan-DG_yEc3A.js → stan-DQRnUJX1.js} +1 -1
  280. package/dist/app/assets/{stateDiagram-FHFEXIEX-BGAhAMai.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-DYUYpQhv.js → stylus-C7mZgsLR.js} +1 -1
  283. package/dist/app/assets/{swift-D5VOcoR8.js → swift-FgNu5uOF.js} +1 -1
  284. package/dist/app/assets/{systemd-KJkpMcrQ.js → systemd-Gxav6pEn.js} +1 -1
  285. package/dist/app/assets/{t4-cs-CE0gFjd-.js → t4-cs-DmynqUb7.js} +1 -1
  286. package/dist/app/assets/{t4-templating-BMkR24_U.js → t4-templating-yOruJMSa.js} +1 -1
  287. package/dist/app/assets/{t4-vb-CcnWMj0o.js → t4-vb-BKIzALAO.js} +1 -1
  288. package/dist/app/assets/{tap-B-ocJA2K.js → tap-DS5QmC0E.js} +1 -1
  289. package/dist/app/assets/{tcl-Bo29AqFv.js → tcl-AP9wIHUu.js} +1 -1
  290. package/dist/app/assets/{textile-DKIJinMX.js → textile-Cwund-GG.js} +1 -1
  291. package/dist/app/assets/{timeline-definition-GMOUNBTQ-DmlLkskM.js → timeline-definition-GMOUNBTQ-CUgfdbl8.js} +1 -1
  292. package/dist/app/assets/{toml-TiCqiK8W.js → toml-DdbNJSTB.js} +1 -1
  293. package/dist/app/assets/{tremor-TviGxnOS.js → tremor-Ci5mLsoz.js} +1 -1
  294. package/dist/app/assets/{tt2-BDrpTMf6.js → tt2-DMnaiyrl.js} +1 -1
  295. package/dist/app/assets/{turtle-CeKxSdxX.js → turtle-CtmHhGlr.js} +1 -1
  296. package/dist/app/assets/{twig-M1UoMMo1.js → twig-jOh3JXGe.js} +1 -1
  297. package/dist/app/assets/{typescript-dmFE31vI.js → typescript-C9ZO1Bsq.js} +1 -1
  298. package/dist/app/assets/{typoscript-Cs5VF1Pa.js → typoscript-BPJJK2gF.js} +1 -1
  299. package/dist/app/assets/{unrealscript-BaCib-aq.js → unrealscript-D5q598j9.js} +1 -1
  300. package/dist/app/assets/{uorazor-cOXF8C6j.js → uorazor-ig8gHEFY.js} +1 -1
  301. package/dist/app/assets/{uri-C3nd05kl.js → uri-B0NV-CTl.js} +1 -1
  302. package/dist/app/assets/{v-BFr1Nrw0.js → v-DLKo3VP1.js} +1 -1
  303. package/dist/app/assets/{vala-jfSJop5D.js → vala-DQyQ3_G9.js} +1 -1
  304. package/dist/app/assets/{vbnet-jaTxhVMf.js → vbnet-C2EluvGs.js} +1 -1
  305. package/dist/app/assets/{velocity-CVfdGYZP.js → velocity-CocU3Pr_.js} +1 -1
  306. package/dist/app/assets/{vennDiagram-DHZGUBPP-D86j4tQE.js → vennDiagram-DHZGUBPP-C6HjVfSH.js} +1 -1
  307. package/dist/app/assets/{verilog-BaTLhycC.js → verilog-C5-NnnGo.js} +1 -1
  308. package/dist/app/assets/{vhdl-x7L2ZBgk.js → vhdl-1lTwYkMl.js} +1 -1
  309. package/dist/app/assets/{vim-CRU4WmNE.js → vim-BFFrBSnn.js} +1 -1
  310. package/dist/app/assets/{visual-basic-vAcTdpjq.js → visual-basic-DmqiNP3t.js} +1 -1
  311. package/dist/app/assets/{wardley-RL74JXVD-BDTrCqQK.js → wardley-RL74JXVD-B_Ds6kTY.js} +1 -1
  312. package/dist/app/assets/{wardleyDiagram-NUSXRM2D-DqIrmIbD.js → wardleyDiagram-NUSXRM2D-DBuGTx4P.js} +1 -1
  313. package/dist/app/assets/{warpscript-lYsG9Rkh.js → warpscript-DbCf6a2h.js} +1 -1
  314. package/dist/app/assets/{wasm-oxbyypoF.js → wasm-BdwrQDsu.js} +1 -1
  315. package/dist/app/assets/{web-idl-DBv_A4kj.js → web-idl-Ci16LhtK.js} +1 -1
  316. package/dist/app/assets/{wiki-zAnycImx.js → wiki-DkGStcp9.js} +1 -1
  317. package/dist/app/assets/{wolfram-DtHwCvJp.js → wolfram-DIKPY0pR.js} +1 -1
  318. package/dist/app/assets/{wren-C0U7cO-m.js → wren-Co-reRGP.js} +1 -1
  319. package/dist/app/assets/{xeora-YTtLCsFY.js → xeora-DzP_NAXE.js} +1 -1
  320. package/dist/app/assets/{xml-doc-BQ4V5a_v.js → xml-doc-0qJkt3-O.js} +1 -1
  321. package/dist/app/assets/{xojo-CrVjUIj3.js → xojo-CGBxZsBv.js} +1 -1
  322. package/dist/app/assets/{xquery-Pt47xtXe.js → xquery-C4AX9sLX.js} +1 -1
  323. package/dist/app/assets/{xychartDiagram-5P7HB3ND-psgl64K2.js → xychartDiagram-5P7HB3ND-CK9Q1OGP.js} +1 -1
  324. package/dist/app/assets/{yaml-BH2r0ki2.js → yaml-Dxa8k2xC.js} +1 -1
  325. package/dist/app/assets/{yang-BqFz9lM6.js → yang-CcCtKZOu.js} +1 -1
  326. package/dist/app/assets/{zig-Dkt3Koao.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 +1067 -219
  330. package/dist/index.js +1082 -227
  331. package/package.json +4 -4
  332. package/dist/app/assets/channel-BfT1OHH9.js +0 -1
  333. package/dist/app/assets/classDiagram-6PBFFD2Q-CYuX4PUt.js +0 -1
  334. package/dist/app/assets/classDiagram-v2-HSJHXN6E-CYuX4PUt.js +0 -1
  335. package/dist/app/assets/clone-Cv1YxYN0.js +0 -1
  336. package/dist/app/assets/index-B_RltYYB.js +0 -783
  337. package/dist/app/assets/index-ByEJy9Db.css +0 -1
  338. package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-BaAQ_O_b.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));
@@ -12356,6 +12374,24 @@ function ToolStepIcon({
12356
12374
  React35.useEffect(() => {
12357
12375
  setFailedIconUrl(null);
12358
12376
  }, [iconUrl]);
12377
+ if (data.icon) {
12378
+ return /* @__PURE__ */ jsx40(
12379
+ IconDefinitionRenderer,
12380
+ {
12381
+ icon: data.icon,
12382
+ className,
12383
+ dataSlot: "tool-step-icon",
12384
+ fallback: /* @__PURE__ */ jsx40(
12385
+ CircleHelp,
12386
+ {
12387
+ className,
12388
+ "aria-hidden": "true",
12389
+ "data-slot": "tool-step-icon"
12390
+ }
12391
+ )
12392
+ }
12393
+ );
12394
+ }
12359
12395
  if (avatar) {
12360
12396
  return /* @__PURE__ */ jsx40(
12361
12397
  ToolAvatarIcon,
@@ -13189,15 +13225,15 @@ function getObjectProperty(value, key) {
13189
13225
  if (!isPlainObject2(value)) {
13190
13226
  return void 0;
13191
13227
  }
13192
- const property = value[key];
13193
- return isPlainObject2(property) ? property : void 0;
13228
+ const property2 = value[key];
13229
+ return isPlainObject2(property2) ? property2 : void 0;
13194
13230
  }
13195
13231
  function getStringProperty(value, key) {
13196
13232
  if (!isPlainObject2(value)) {
13197
13233
  return void 0;
13198
13234
  }
13199
- const property = value[key];
13200
- return typeof property === "string" ? property : void 0;
13235
+ const property2 = value[key];
13236
+ return typeof property2 === "string" ? property2 : void 0;
13201
13237
  }
13202
13238
  function isPlainObject2(value) {
13203
13239
  return !!value && typeof value === "object" && !Array.isArray(value);
@@ -13211,8 +13247,232 @@ import * as React37 from "react";
13211
13247
  import {
13212
13248
  resolveLocalizedText as resolveLocalizedText3
13213
13249
  } from "@xpert-ai/chatkit-types";
13214
- import { AlertCircle as AlertCircle2, Loader2 as Loader28 } from "lucide-react";
13215
- 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";
13216
13476
  var EMPTY_INPUT_SCHEMA = {
13217
13477
  type: "object",
13218
13478
  properties: {}
@@ -13244,53 +13504,28 @@ function readIconDefinition(value) {
13244
13504
  }
13245
13505
  function readStringList(value) {
13246
13506
  if (!Array.isArray(value)) return void 0;
13247
- const strings = value.filter((item) => typeof item === "string");
13507
+ const strings = value.filter(
13508
+ (item) => typeof item === "string"
13509
+ );
13248
13510
  return strings.length ? strings : void 0;
13249
13511
  }
13250
- function buildXpertApiUrl(apiUrl, path) {
13251
- const normalizedApiUrl = apiUrl.trim();
13252
- if (!normalizedApiUrl) return path;
13253
- try {
13254
- const url = new URL(normalizedApiUrl);
13255
- return `${url.origin}${path}`;
13256
- } catch {
13257
- return path;
13258
- }
13259
- }
13260
- function appendQuery(path, params) {
13261
- const query = params.toString();
13262
- return query ? `${path}?${query}` : path;
13263
- }
13264
- function buildMcpAppReviveParams(data, options) {
13265
- const params = new URLSearchParams();
13266
- const add = (key, value) => {
13267
- if (value) {
13268
- params.set(key, value);
13269
- }
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
13270
13522
  };
13271
- add("toolsetId", data.toolsetId);
13272
- add("serverName", data.serverName);
13273
- add("toolName", data.toolName);
13274
- add("toolCallId", data.toolCallId);
13275
- add("resourceUri", data.resourceUri);
13276
- add("title", typeof data.title === "string" ? data.title : void 0);
13277
- add("messageId", options?.messageId);
13278
- add("token", options?.appInstanceToken ?? data.appInstanceToken);
13279
- return params;
13280
- }
13281
- function buildMcpAppEndpointPath(data, endpoint, options) {
13282
- return appendQuery(
13283
- `/api/xpert-toolset/mcp-apps/${encodeURIComponent(
13284
- data.appInstanceId
13285
- )}/${endpoint}`,
13286
- buildMcpAppReviveParams(data, options)
13287
- );
13288
13523
  }
13289
13524
  function escapeHtmlAttribute(value) {
13290
13525
  return value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
13291
13526
  }
13292
13527
  function domains(values) {
13293
- return values?.filter((value) => value.trim()).join(" ") ?? "";
13528
+ return values?.map((value) => value.trim()).filter((value) => value && !/[\s;'"<>]/.test(value)).join(" ") ?? "";
13294
13529
  }
13295
13530
  function buildCsp(csp) {
13296
13531
  const resourceDomains = domains(csp?.resourceDomains);
@@ -13305,7 +13540,9 @@ function buildCsp(csp) {
13305
13540
  `media-src data: blob: ${resourceDomains}`.trim(),
13306
13541
  `font-src data: ${resourceDomains}`.trim(),
13307
13542
  `connect-src ${connectDomains}`,
13543
+ `form-action ${connectDomains}`,
13308
13544
  `frame-src ${frameDomains}`,
13545
+ "object-src 'none'",
13309
13546
  `base-uri ${baseUriDomains}`
13310
13547
  ].join("; ");
13311
13548
  }
@@ -13391,13 +13628,14 @@ function jsonRpcResult(id, result) {
13391
13628
  result
13392
13629
  };
13393
13630
  }
13394
- function jsonRpcError(id, message) {
13631
+ function jsonRpcError(id, message, code = -32e3, data) {
13395
13632
  return {
13396
13633
  jsonrpc: "2.0",
13397
13634
  id: id ?? null,
13398
13635
  error: {
13399
- code: -32e3,
13400
- message
13636
+ code,
13637
+ message,
13638
+ ...data === void 0 ? {} : { data }
13401
13639
  }
13402
13640
  };
13403
13641
  }
@@ -13448,11 +13686,7 @@ var MCP_APP_THEME_COLOR_TOKENS = [
13448
13686
  ["--background", "--mcp-app-color-background", "oklch(1 0 0)"],
13449
13687
  ["--foreground", "--mcp-app-color-foreground", "oklch(0.145 0 0)"],
13450
13688
  ["--card", "--mcp-app-color-card", "oklch(1 0 0)"],
13451
- [
13452
- "--card-foreground",
13453
- "--mcp-app-color-card-foreground",
13454
- "oklch(0.145 0 0)"
13455
- ],
13689
+ ["--card-foreground", "--mcp-app-color-card-foreground", "oklch(0.145 0 0)"],
13456
13690
  ["--popover", "--mcp-app-color-popover", "oklch(1 0 0)"],
13457
13691
  [
13458
13692
  "--popover-foreground",
@@ -13483,11 +13717,7 @@ var MCP_APP_THEME_COLOR_TOKENS = [
13483
13717
  "--mcp-app-color-accent-foreground",
13484
13718
  "oklch(0.205 0 0)"
13485
13719
  ],
13486
- [
13487
- "--destructive",
13488
- "--mcp-app-color-destructive",
13489
- "oklch(0.577 0.245 27.325)"
13490
- ],
13720
+ ["--destructive", "--mcp-app-color-destructive", "oklch(0.577 0.245 27.325)"],
13491
13721
  [
13492
13722
  "--destructive-foreground",
13493
13723
  "--mcp-app-color-destructive-foreground",
@@ -13601,9 +13831,7 @@ function normalizeMcpAppToolInfo(value, data, resource = {}) {
13601
13831
  ...rawTool,
13602
13832
  name: originalName,
13603
13833
  title: readLocalizedText(rawTool.title) ?? title,
13604
- inputSchema: normalizeInputSchema(
13605
- rawTool.inputSchema ?? raw.inputSchema
13606
- ),
13834
+ inputSchema: normalizeInputSchema(rawTool.inputSchema ?? raw.inputSchema),
13607
13835
  ...description ? {
13608
13836
  description: readLocalizedText(rawTool.description) ?? description
13609
13837
  } : {},
@@ -13632,10 +13860,66 @@ function buildIframeAllow(permissions) {
13632
13860
  return policies.length ? policies.join("; ") : void 0;
13633
13861
  }
13634
13862
  function buildSandboxAttribute() {
13635
- return ["allow-downloads", "allow-forms", "allow-modals", "allow-scripts"].join(
13636
- " "
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
+ })
13637
13888
  );
13638
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
+ }
13639
13923
  function stringifyToolResult(value) {
13640
13924
  if (typeof value === "string") return value;
13641
13925
  try {
@@ -13758,7 +14042,7 @@ function normalizeMcpAppResourceResponse(value, data) {
13758
14042
  rawToolResult
13759
14043
  };
13760
14044
  }
13761
- function isHttpUrl(value) {
14045
+ function isHttpUrl2(value) {
13762
14046
  try {
13763
14047
  const url = new URL(value);
13764
14048
  return url.protocol === "http:" || url.protocol === "https:";
@@ -13766,22 +14050,124 @@ function isHttpUrl(value) {
13766
14050
  return false;
13767
14051
  }
13768
14052
  }
13769
- function contentBlocksToText(content) {
13770
- if (!Array.isArray(content)) return null;
13771
- const parts = content.map((item) => {
13772
- if (!isRecord5(item)) return "";
13773
- if (item.type === "text" && typeof item.text === "string") {
13774
- 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`);
13775
14105
  }
13776
- if (item.type === "resource_link" && typeof item.uri === "string") {
13777
- 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;
13778
14112
  }
13779
14113
  if (item.type === "image" || item.type === "audio") {
13780
- 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;
13781
14126
  }
13782
- return stringifyToolResult(item);
13783
- }).map((part) => part.trim()).filter(Boolean);
13784
- return parts.length ? parts.join("\n\n") : null;
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;
14156
+ }
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
+ };
13785
14171
  }
13786
14172
  function isMcpAppComponentData(data) {
13787
14173
  return isRecord5(data) && data.type === "McpApp" && typeof data.appInstanceId === "string" && typeof data.resourceUri === "string";
@@ -13789,68 +14175,205 @@ function isMcpAppComponentData(data) {
13789
14175
  function McpAppMessage({
13790
14176
  data,
13791
14177
  messageId,
13792
- className
14178
+ className,
14179
+ mcpApps
13793
14180
  }) {
13794
14181
  const { i18n: i18n2 } = useChatkitTranslation();
13795
- const {
13796
- apiUrl,
13797
- authenticatedFetch,
13798
- isLoading: streamIsLoading,
13799
- submit
13800
- } = useStreamContext();
14182
+ const { client, isLoading: streamIsLoading, submit } = useStreamContext();
13801
14183
  const iframeRef = React37.useRef(null);
14184
+ const appWindowRef = React37.useRef(null);
13802
14185
  const containerRef = React37.useRef(null);
13803
14186
  const initializedRef = React37.useRef(false);
13804
14187
  const sentInitialResultRef = React37.useRef(false);
13805
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);
13806
14197
  const [resource, setResource] = React37.useState(null);
13807
14198
  const [runtimeAppInstanceToken, setRuntimeAppInstanceToken] = React37.useState(data.appInstanceToken);
13808
14199
  const [srcDoc, setSrcDoc] = React37.useState(null);
13809
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);
13810
14205
  const [error, setError] = React37.useState(null);
13811
14206
  const [isLoading, setIsLoading] = React37.useState(true);
13812
- const resourceUrl = React37.useMemo(
13813
- () => buildXpertApiUrl(
13814
- apiUrl,
13815
- buildMcpAppEndpointPath(data, "resource", {
13816
- messageId
13817
- })
13818
- ),
13819
- [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]
13820
14211
  );
13821
- const rpcUrl = React37.useMemo(
13822
- () => buildXpertApiUrl(
13823
- apiUrl,
13824
- buildMcpAppEndpointPath(data, "rpc", {
13825
- appInstanceToken: runtimeAppInstanceToken,
13826
- messageId
13827
- })
13828
- ),
13829
- [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]
13830
14232
  );
13831
- const postToApp = React37.useCallback((message) => {
13832
- iframeRef.current?.contentWindow?.postMessage(message, "*");
13833
- }, []);
13834
14233
  const callHostRpc = React37.useCallback(
13835
14234
  async (request) => {
13836
- const response = await authenticatedFetch(rpcUrl, {
13837
- method: "POST",
13838
- headers: {
13839
- "content-type": "application/json"
13840
- },
13841
- body: JSON.stringify({
14235
+ return client.mcp.apps.rpc(
14236
+ data.appInstanceId,
14237
+ {
13842
14238
  jsonrpc: "2.0",
13843
14239
  id: request.id ?? null,
13844
14240
  method: request.method,
13845
14241
  params: request.params
14242
+ },
14243
+ buildMcpAppReviveQuery(data, {
14244
+ appInstanceToken: runtimeAppInstanceToken,
14245
+ messageId
13846
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
13847
14330
  });
13848
- if (!response.ok) {
13849
- 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));
13850
14365
  }
13851
- return response.json();
13852
14366
  },
13853
- [authenticatedFetch, rpcUrl]
14367
+ [
14368
+ callHostRpc,
14369
+ clearPendingApproval,
14370
+ client,
14371
+ data,
14372
+ messageId,
14373
+ postToApp,
14374
+ processHostRpcResponse,
14375
+ runtimeAppInstanceToken
14376
+ ]
13854
14377
  );
13855
14378
  const sendInitialToolNotifications = React37.useCallback(() => {
13856
14379
  if (!initializedRef.current || sentInitialResultRef.current || !resource) {
@@ -13883,28 +14406,35 @@ function McpAppMessage({
13883
14406
  const controller = new AbortController();
13884
14407
  initializedRef.current = false;
13885
14408
  sentInitialResultRef.current = false;
14409
+ pendingApprovalRef.current = null;
14410
+ approvalActionRef.current = null;
13886
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);
13887
14419
  setIsLoading(true);
13888
14420
  setError(null);
13889
14421
  setResource(null);
13890
14422
  setSrcDoc(null);
13891
14423
  void (async () => {
13892
14424
  try {
13893
- const response = await authenticatedFetch(resourceUrl, {
13894
- signal: controller.signal
13895
- });
13896
- if (!response.ok) {
13897
- throw new Error(`MCP App resource failed with ${response.status}`);
13898
- }
13899
- 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
+ );
13900
14430
  const normalizedResource = normalizeMcpAppResourceResponse(
13901
14431
  payload,
13902
14432
  data
13903
14433
  );
13904
14434
  setResource(normalizedResource);
13905
- setRuntimeAppInstanceToken(
13906
- normalizedResource.appInstanceToken ?? data.appInstanceToken
13907
- );
14435
+ const nextAppInstanceToken = normalizedResource.appInstanceToken ?? data.appInstanceToken;
14436
+ runtimeAppInstanceTokenRef.current = nextAppInstanceToken;
14437
+ setRuntimeAppInstanceToken(nextAppInstanceToken);
13908
14438
  const hostLocale = normalizeHostLocale(i18n2.language);
13909
14439
  setSrcDoc(
13910
14440
  injectMcpAppTheme(
@@ -13929,26 +14459,131 @@ function McpAppMessage({
13929
14459
  controller.abort();
13930
14460
  };
13931
14461
  }, [
13932
- authenticatedFetch,
14462
+ client,
13933
14463
  data,
13934
14464
  data.appInstanceId,
13935
14465
  data.appInstanceToken,
13936
14466
  data.csp,
13937
14467
  i18n2.language,
13938
- 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
13939
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]);
13940
14546
  React37.useEffect(() => {
13941
14547
  sendInitialToolNotifications();
13942
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]);
13943
14560
  React37.useEffect(() => {
13944
14561
  const handleMessage = async (event) => {
13945
14562
  if (event.source !== iframeRef.current?.contentWindow) {
13946
14563
  return;
13947
14564
  }
14565
+ if (sandboxProxy && event.origin !== sandboxProxy.origin) {
14566
+ return;
14567
+ }
13948
14568
  const request = normalizeJsonRpcMessage(event.data);
13949
14569
  if (!request?.method) {
13950
14570
  return;
13951
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
+ }
13952
14587
  if (request.method === "ui/notifications/initialized") {
13953
14588
  initializedRef.current = true;
13954
14589
  sendInitialToolNotifications();
@@ -13961,6 +14596,39 @@ function McpAppMessage({
13961
14596
  }
13962
14597
  return;
13963
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
+ }
13964
14632
  if (request.method === "ui/initialize") {
13965
14633
  initializedRef.current = true;
13966
14634
  const permissions = resource?.permissions ?? data.permissions;
@@ -13984,7 +14652,11 @@ function McpAppMessage({
13984
14652
  openLinks: {},
13985
14653
  logging: {},
13986
14654
  message: {
13987
- text: {}
14655
+ text: {},
14656
+ image: {},
14657
+ audio: {},
14658
+ resource: {},
14659
+ resourceLink: {}
13988
14660
  },
13989
14661
  updateModelContext: {
13990
14662
  text: {},
@@ -13993,29 +14665,33 @@ function McpAppMessage({
13993
14665
  sandbox: {
13994
14666
  ...permissions ? { permissions } : {},
13995
14667
  ...csp ? { csp } : {}
13996
- }
14668
+ },
14669
+ downloadFile: {}
13997
14670
  },
13998
14671
  hostContext: {
13999
14672
  toolInfo,
14000
14673
  theme: theme.mode,
14674
+ styles: {
14675
+ variables: theme.cssVariables
14676
+ },
14001
14677
  themeCssVariables: theme.cssVariables,
14002
14678
  locale: hostLocale,
14003
14679
  language: hostLanguage,
14004
14680
  direction: hostDirection,
14005
14681
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
14006
- displayMode: "inline",
14007
- availableDisplayModes: ["inline"],
14682
+ displayMode,
14683
+ availableDisplayModes: ["inline", "fullscreen", "pip"],
14008
14684
  containerDimensions: getContainerDimensions(containerRef.current),
14009
14685
  userAgent: "xpert-chatkit",
14010
14686
  platform: "web",
14011
14687
  deviceCapabilities: {
14012
14688
  touch: navigator.maxTouchPoints > 0,
14013
- hover: window.matchMedia("(hover: hover)").matches
14689
+ hover: typeof window.matchMedia === "function" ? window.matchMedia("(hover: hover)").matches : false
14014
14690
  }
14015
14691
  },
14016
14692
  // Legacy compatibility for apps written before the 2026-01-26 result shape.
14017
14693
  capabilities: {
14018
- displayModes: ["inline"],
14694
+ displayModes: ["inline", "fullscreen", "pip"],
14019
14695
  serverTools: true,
14020
14696
  serverResources: true,
14021
14697
  openLinks: true
@@ -14028,8 +14704,8 @@ function McpAppMessage({
14028
14704
  language: hostLanguage,
14029
14705
  direction: hostDirection,
14030
14706
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
14031
- displayMode: "inline",
14032
- availableDisplayModes: ["inline"],
14707
+ displayMode,
14708
+ availableDisplayModes: ["inline", "fullscreen", "pip"],
14033
14709
  containerDimensions: getContainerDimensions(containerRef.current),
14034
14710
  userAgent: navigator.userAgent,
14035
14711
  platform: navigator.platform
@@ -14041,20 +14717,33 @@ function McpAppMessage({
14041
14717
  }
14042
14718
  if (request.method === "ui/open-link") {
14043
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;
14044
- if (href && isHttpUrl(href)) {
14045
- window.open(href, "_blank", "noopener,noreferrer");
14720
+ if (!href || !isHttpUrl2(href)) {
14046
14721
  if (request.id !== void 0) {
14047
- postToApp(jsonRpcResult(request.id, {}));
14722
+ postToApp(jsonRpcError(request.id, "Invalid URL"));
14048
14723
  }
14049
- } else if (request.id !== void 0) {
14050
- 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)));
14051
14737
  }
14052
14738
  return;
14053
14739
  }
14054
14740
  if (request.method === "ui/update-model-context") {
14055
- modelContextRef.current = request.params;
14056
14741
  try {
14057
- postToApp(await callHostRpc(request));
14742
+ const response = await callHostRpc(request);
14743
+ if (isMcpAppRpcSuccess(response)) {
14744
+ modelContextRef.current = request.params;
14745
+ }
14746
+ postToApp(response);
14058
14747
  } catch (rpcError) {
14059
14748
  postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
14060
14749
  }
@@ -14072,14 +14761,12 @@ function McpAppMessage({
14072
14761
  postToApp(hostResponse);
14073
14762
  return;
14074
14763
  }
14075
- const inputText = contentBlocksToText(request.params.content);
14076
- if (!inputText) {
14077
- throw new Error("ui/message content did not include text");
14078
- }
14764
+ const messageInput = contentBlocksToChatInput(request.params.content);
14079
14765
  await submit(
14080
14766
  {
14081
14767
  input: {
14082
- input: inputText
14768
+ input: messageInput.input,
14769
+ ...messageInput.files.length ? { files: messageInput.files } : {}
14083
14770
  }
14084
14771
  },
14085
14772
  {
@@ -14104,11 +14791,7 @@ function McpAppMessage({
14104
14791
  if (request.id === void 0 && request.method.startsWith("ui/")) {
14105
14792
  return;
14106
14793
  }
14107
- try {
14108
- postToApp(await callHostRpc(request));
14109
- } catch (rpcError) {
14110
- postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
14111
- }
14794
+ await dispatchHostRpc(request);
14112
14795
  };
14113
14796
  window.addEventListener("message", handleMessage);
14114
14797
  return () => {
@@ -14116,19 +14799,20 @@ function McpAppMessage({
14116
14799
  };
14117
14800
  }, [
14118
14801
  callHostRpc,
14119
- data.appInstanceId,
14120
- data.csp,
14121
- data.permissions,
14122
- data.resourceUri,
14123
- data.title,
14124
- data.toolCallId,
14125
- data.toolName,
14802
+ clearPendingApproval,
14803
+ client,
14804
+ data,
14805
+ dispatchHostRpc,
14806
+ displayMode,
14126
14807
  i18n2.language,
14808
+ messageId,
14127
14809
  postToApp,
14128
14810
  resource?.csp,
14129
14811
  resource?.permissions,
14130
14812
  resource?.toolInfo,
14813
+ sandboxProxy,
14131
14814
  sendInitialToolNotifications,
14815
+ srcDoc,
14132
14816
  streamIsLoading,
14133
14817
  submit
14134
14818
  ]);
@@ -14137,7 +14821,7 @@ function McpAppMessage({
14137
14821
  () => buildIframeAllow(iframePermissions),
14138
14822
  [iframePermissions]
14139
14823
  );
14140
- const sandbox = React37.useMemo(() => buildSandboxAttribute(), []);
14824
+ const sandbox = sandboxProxy ? "allow-scripts allow-same-origin" : buildSandboxAttribute();
14141
14825
  const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
14142
14826
  const displayTitle = resolveLocalizedText3(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
14143
14827
  const displayDescription = resolveLocalizedText3(
@@ -14145,56 +14829,212 @@ function McpAppMessage({
14145
14829
  i18n2.language
14146
14830
  );
14147
14831
  const displayIcon = resource?.icon ?? data.icon;
14148
- return /* @__PURE__ */ jsxs29(
14149
- "div",
14150
- {
14151
- ref: containerRef,
14152
- className: cn(
14153
- "overflow-hidden rounded-lg border bg-background shadow-sm",
14154
- !prefersBorder && "border-transparent shadow-none",
14155
- className
14156
- ),
14157
- children: [
14158
- /* @__PURE__ */ jsxs29("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
14159
- /* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 items-center gap-2", children: [
14160
- displayIcon ? /* @__PURE__ */ jsx43(
14161
- IconDefinitionRenderer,
14162
- {
14163
- icon: displayIcon,
14164
- size: 18,
14165
- className: "shrink-0",
14166
- decorative: true
14167
- }
14168
- ) : null,
14169
- /* @__PURE__ */ jsxs29("div", { className: "min-w-0", children: [
14170
- /* @__PURE__ */ jsx43("div", { className: "truncate text-sm font-medium", children: displayTitle }),
14171
- /* @__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" })
14172
14911
  ] })
14173
14912
  ] }),
14174
- /* @__PURE__ */ jsx43(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
14175
- ] }),
14176
- isLoading ? /* @__PURE__ */ jsxs29("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
14177
- /* @__PURE__ */ jsx43(Loader28, { className: "h-4 w-4 animate-spin" }),
14178
- /* @__PURE__ */ jsx43("span", { children: i18n2.t("message.mcpApp.loading") })
14179
- ] }) : error ? /* @__PURE__ */ jsxs29("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
14180
- /* @__PURE__ */ jsx43(AlertCircle2, { className: "h-4 w-4 shrink-0" }),
14181
- /* @__PURE__ */ jsx43("span", { className: "min-w-0 break-words", children: error })
14182
- ] }) : srcDoc ? /* @__PURE__ */ jsx43(
14183
- "iframe",
14184
- {
14185
- ref: iframeRef,
14186
- title: displayTitle,
14187
- srcDoc,
14188
- className: "block w-full bg-background",
14189
- style: { height },
14190
- sandbox,
14191
- allow: iframeAllow,
14192
- referrerPolicy: "no-referrer"
14193
- }
14194
- ) : null
14195
- ]
14196
- }
14197
- );
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
+ ] });
14198
15038
  }
14199
15039
 
14200
15040
  // src/components/thread/messages/ai.tsx
@@ -14482,7 +15322,14 @@ function renderContentItem(content, index, message, lookupMessages, options) {
14482
15322
  return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
14483
15323
  }
14484
15324
  if (isMcpAppComponent(content)) {
14485
- 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}`);
14486
15333
  }
14487
15334
  if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
14488
15335
  return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
@@ -14512,7 +15359,8 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
14512
15359
  isThreadRunning: options?.isThreadRunning,
14513
15360
  organizationId: options?.organizationId,
14514
15361
  apiUrl: options?.apiUrl,
14515
- isAgentOutput: options?.isAgentOutput
15362
+ isAgentOutput: options?.isAgentOutput,
15363
+ mcpApps: options?.mcpApps
14516
15364
  });
14517
15365
  }
14518
15366
  return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
@@ -14663,7 +15511,8 @@ function AssistantMessage({
14663
15511
  isThreadRunning,
14664
15512
  organizationId,
14665
15513
  apiUrl,
14666
- pet
15514
+ pet,
15515
+ mcpApps
14667
15516
  }) {
14668
15517
  const { t } = useChatkitTranslation();
14669
15518
  const renderTree = buildAssistantRenderTree(
@@ -14679,7 +15528,8 @@ function AssistantMessage({
14679
15528
  const answerNode = renderContent(message, lookupMessages, {
14680
15529
  isThreadRunning,
14681
15530
  organizationId,
14682
- apiUrl
15531
+ apiUrl,
15532
+ mcpApps
14683
15533
  });
14684
15534
  const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx44(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
14685
15535
  if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
@@ -15101,6 +15951,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
15101
15951
  client,
15102
15952
  threadId,
15103
15953
  assistantId,
15954
+ projectId,
15104
15955
  isReady,
15105
15956
  isLoading: isStreamLoading,
15106
15957
  error: streamError
@@ -15119,7 +15970,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
15119
15970
  setError(null);
15120
15971
  try {
15121
15972
  const { items } = await client.conversations.search({
15122
- where: { xpertId: assistantId },
15973
+ where: { xpertId: assistantId, ...projectId ? { projectId } : {} },
15123
15974
  limit,
15124
15975
  order: { updatedAt: "DESC" }
15125
15976
  });
@@ -15129,11 +15980,14 @@ function useThreads(limit = DEFAULT_LIMIT) {
15129
15980
  } finally {
15130
15981
  setIsLoading(false);
15131
15982
  }
15132
- }, [client, limit, assistantId]);
15983
+ }, [client, limit, assistantId, projectId]);
15133
15984
  const createThread = React42.useCallback(
15134
15985
  async (input) => {
15135
15986
  setError(null);
15136
- const payload = {};
15987
+ const payload = {
15988
+ xpertId: assistantId,
15989
+ ...projectId ? { projectId } : {}
15990
+ };
15137
15991
  if (input?.recordId) payload.id = input.recordId;
15138
15992
  if (input?.threadId) payload.threadId = input.threadId;
15139
15993
  if (input?.title) payload.title = input.title;
@@ -15142,7 +15996,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
15142
15996
  upsertThreadRecord(created);
15143
15997
  return created;
15144
15998
  },
15145
- [client, upsertThreadRecord]
15999
+ [assistantId, client, projectId, upsertThreadRecord]
15146
16000
  );
15147
16001
  const updateThread = React42.useCallback(
15148
16002
  async (recordId, payload) => {
@@ -16940,13 +17794,13 @@ import {
16940
17794
  } from "@xpert-ai/xpert-sdk";
16941
17795
  import {
16942
17796
  Loader2 as Loader210,
16943
- Maximize2,
16944
- Minimize2,
17797
+ Maximize2 as Maximize22,
17798
+ Minimize2 as Minimize22,
16945
17799
  PanelRight,
16946
17800
  RotateCcw,
16947
17801
  X as X8
16948
17802
  } from "lucide-react";
16949
- 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";
16950
17804
  var WorkbenchContext = React52.createContext({
16951
17805
  enabled: false,
16952
17806
  open: false,
@@ -18322,7 +19176,7 @@ function formatElapsed(value) {
18322
19176
  }
18323
19177
 
18324
19178
  // src/components/chat.tsx
18325
- 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";
18326
19180
  var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
18327
19181
  var COMPOSER_INPUT_MAX_HEIGHT = 128;
18328
19182
  var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
@@ -20450,7 +21304,7 @@ function Chat({
20450
21304
  ) }) }),
20451
21305
  /* @__PURE__ */ jsx60(TooltipContent, { side: "bottom", children: t("settings.open") })
20452
21306
  ] }),
20453
- history?.enabled !== false && /* @__PURE__ */ jsxs42(Fragment11, { children: [
21307
+ history?.enabled !== false && /* @__PURE__ */ jsxs42(Fragment12, { children: [
20454
21308
  /* @__PURE__ */ jsxs42(Tooltip, { children: [
20455
21309
  /* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx60(
20456
21310
  "button",
@@ -20627,9 +21481,10 @@ function Chat({
20627
21481
  isThreadRunning: currentThreadIsRunning,
20628
21482
  organizationId: stream.organizationId,
20629
21483
  apiUrl: stream.apiUrl,
20630
- pet: effectivePet
21484
+ pet: effectivePet,
21485
+ mcpApps: options?.mcpApps
20631
21486
  }
20632
- ) : /* @__PURE__ */ jsxs42(Fragment11, { children: [
21487
+ ) : /* @__PURE__ */ jsxs42(Fragment12, { children: [
20633
21488
  message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsx60(
20634
21489
  HumanRuntimeCapabilityChips,
20635
21490
  {