@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.cjs CHANGED
@@ -2477,7 +2477,16 @@ var en_US_default = {
2477
2477
  moreTags: "+{{count}}"
2478
2478
  },
2479
2479
  mcpApp: {
2480
- loading: "Loading MCP App"
2480
+ loading: "Loading MCP App",
2481
+ fullscreen: "Open fullscreen",
2482
+ pictureInPicture: "Open picture in picture",
2483
+ returnInline: "Return inline",
2484
+ approvalTitle: "Confirm MCP App action",
2485
+ toolApprovalDescription: 'The app wants to run "{{tool}}". Review the request before allowing it.',
2486
+ downloadApprovalDescription: "The app wants to download files to this device. Review the file details before allowing it.",
2487
+ requestDetails: "Request details",
2488
+ approve: "Allow",
2489
+ reject: "Reject"
2481
2490
  },
2482
2491
  contextCompression: {
2483
2492
  running: "Automatically compressing context",
@@ -2960,7 +2969,16 @@ var zh_CN_default = {
2960
2969
  moreTags: "+{{count}}"
2961
2970
  },
2962
2971
  mcpApp: {
2963
- loading: "\u6B63\u5728\u52A0\u8F7D MCP App"
2972
+ loading: "\u6B63\u5728\u52A0\u8F7D MCP App",
2973
+ fullscreen: "\u5168\u5C4F\u663E\u793A",
2974
+ pictureInPicture: "\u753B\u4E2D\u753B\u663E\u793A",
2975
+ returnInline: "\u8FD4\u56DE\u884C\u5185\u663E\u793A",
2976
+ approvalTitle: "\u786E\u8BA4 MCP App \u64CD\u4F5C",
2977
+ toolApprovalDescription: "App \u8BF7\u6C42\u8FD0\u884C\u201C{{tool}}\u201D\u3002\u8BF7\u68C0\u67E5\u8BF7\u6C42\u5185\u5BB9\u540E\u518D\u51B3\u5B9A\u662F\u5426\u5141\u8BB8\u3002",
2978
+ downloadApprovalDescription: "App \u8BF7\u6C42\u5C06\u6587\u4EF6\u4E0B\u8F7D\u5230\u6B64\u8BBE\u5907\u3002\u8BF7\u68C0\u67E5\u6587\u4EF6\u8BE6\u60C5\u540E\u518D\u51B3\u5B9A\u662F\u5426\u5141\u8BB8\u3002",
2979
+ requestDetails: "\u8BF7\u6C42\u8BE6\u60C5",
2980
+ approve: "\u5141\u8BB8",
2981
+ reject: "\u62D2\u7EDD"
2964
2982
  },
2965
2983
  contextCompression: {
2966
2984
  running: "\u6B63\u5728\u81EA\u52A8\u538B\u7F29\u4E0A\u4E0B\u6587",
@@ -5791,8 +5809,8 @@ function JsonTreeNode({
5791
5809
  depth = 0
5792
5810
  }) {
5793
5811
  const isArray = Array.isArray(value);
5794
- const isObject2 = isJsonObjectValue(value);
5795
- const isExpandable = isArray || isObject2;
5812
+ const isObject3 = isJsonObjectValue(value);
5813
+ const isExpandable = isArray || isObject3;
5796
5814
  const [isExpanded, setIsExpanded] = React18.useState(depth < 2);
5797
5815
  if (!isExpandable) {
5798
5816
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex min-w-0 gap-2 leading-6", children: [
@@ -9558,8 +9576,8 @@ function getFallbackPalette(isDarkMode) {
9558
9576
  text: "#18181b"
9559
9577
  };
9560
9578
  }
9561
- function resolveColor(styles, property, fallback, background) {
9562
- const parsed = parseCssColor(styles.getPropertyValue(property));
9579
+ function resolveColor(styles, property2, fallback, background) {
9580
+ const parsed = parseCssColor(styles.getPropertyValue(property2));
9563
9581
  if (!parsed) return fallback;
9564
9582
  if (parsed.a < 1 && background) {
9565
9583
  return rgbaToHex(compositeColor(parsed, background));
@@ -12249,6 +12267,24 @@ function ToolStepIcon({
12249
12267
  React35.useEffect(() => {
12250
12268
  setFailedIconUrl(null);
12251
12269
  }, [iconUrl]);
12270
+ if (data.icon) {
12271
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
12272
+ IconDefinitionRenderer,
12273
+ {
12274
+ icon: data.icon,
12275
+ className,
12276
+ dataSlot: "tool-step-icon",
12277
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
12278
+ import_lucide_react22.CircleHelp,
12279
+ {
12280
+ className,
12281
+ "aria-hidden": "true",
12282
+ "data-slot": "tool-step-icon"
12283
+ }
12284
+ )
12285
+ }
12286
+ );
12287
+ }
12252
12288
  if (avatar) {
12253
12289
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
12254
12290
  ToolAvatarIcon,
@@ -13075,15 +13111,15 @@ function getObjectProperty(value, key) {
13075
13111
  if (!isPlainObject2(value)) {
13076
13112
  return void 0;
13077
13113
  }
13078
- const property = value[key];
13079
- return isPlainObject2(property) ? property : void 0;
13114
+ const property2 = value[key];
13115
+ return isPlainObject2(property2) ? property2 : void 0;
13080
13116
  }
13081
13117
  function getStringProperty(value, key) {
13082
13118
  if (!isPlainObject2(value)) {
13083
13119
  return void 0;
13084
13120
  }
13085
- const property = value[key];
13086
- return typeof property === "string" ? property : void 0;
13121
+ const property2 = value[key];
13122
+ return typeof property2 === "string" ? property2 : void 0;
13087
13123
  }
13088
13124
  function isPlainObject2(value) {
13089
13125
  return !!value && typeof value === "object" && !Array.isArray(value);
@@ -13096,6 +13132,223 @@ function hasLegacySurface(surface) {
13096
13132
  var React37 = __toESM(require("react"), 1);
13097
13133
  var import_chatkit_types11 = require("@xpert-ai/chatkit-types");
13098
13134
  var import_lucide_react24 = require("lucide-react");
13135
+
13136
+ // src/components/thread/messages/mcp-app/host.ts
13137
+ function isObject2(value) {
13138
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
13139
+ }
13140
+ function property(value, key) {
13141
+ return Reflect.get(value, key);
13142
+ }
13143
+ function stringProperty(value, key) {
13144
+ const field = property(value, key);
13145
+ return typeof field === "string" && field.trim() ? field.trim() : void 0;
13146
+ }
13147
+ function isMcpAppRpcSuccess(value) {
13148
+ return isObject2(value) && Reflect.has(value, "result") && !Reflect.has(value, "error");
13149
+ }
13150
+ function readMcpAppDisplayMode(value) {
13151
+ if (!isObject2(value)) return void 0;
13152
+ const result = property(value, "result");
13153
+ if (!isObject2(result)) return void 0;
13154
+ const mode = property(result, "mode");
13155
+ if (mode === "picture-in-picture") return "pip";
13156
+ return mode === "inline" || mode === "fullscreen" || mode === "pip" ? mode : void 0;
13157
+ }
13158
+ function readMcpAppPendingApproval(response, request) {
13159
+ if (!isObject2(response)) return null;
13160
+ const error = property(response, "error");
13161
+ if (!isObject2(error) || property(error, "code") !== -32001) return null;
13162
+ const data = property(error, "data");
13163
+ if (!isObject2(data)) return null;
13164
+ const approvalId = stringProperty(data, "approvalId");
13165
+ const risk = property(data, "risk");
13166
+ const expiresAt = property(data, "expiresAt");
13167
+ if (!approvalId || risk !== "write" && risk !== "destructive" || typeof expiresAt !== "number" || !Number.isFinite(expiresAt)) {
13168
+ return null;
13169
+ }
13170
+ const params = isObject2(request.params) ? request.params : void 0;
13171
+ const requestedTool = params ? stringProperty(params, "name") : void 0;
13172
+ const kind = request.method === "ui/download-file" ? "download" : "tool";
13173
+ return {
13174
+ approvalId,
13175
+ risk,
13176
+ expiresAt,
13177
+ toolName: kind === "download" ? "ui/download-file" : requestedTool ?? request.method ?? "tools/call",
13178
+ kind,
13179
+ request,
13180
+ details: kind === "download" ? formatDownloadApprovalDetails(request.params) : formatApprovalDetails(request.params)
13181
+ };
13182
+ }
13183
+ function withMcpAppApprovalId(request, approvalId) {
13184
+ return {
13185
+ ...request,
13186
+ params: {
13187
+ ...isObject2(request.params) ? request.params : {},
13188
+ approvalId
13189
+ }
13190
+ };
13191
+ }
13192
+ function formatApprovalDetails(value) {
13193
+ try {
13194
+ const text = JSON.stringify(redactSensitiveValue(value, 0), null, 2);
13195
+ if (!text) return "{}";
13196
+ return text.length > 4e3 ? `${text.slice(0, 4e3)}
13197
+ \u2026` : text;
13198
+ } catch {
13199
+ return "[Request details unavailable]";
13200
+ }
13201
+ }
13202
+ function redactSensitiveValue(value, depth) {
13203
+ if (depth >= 6) return "[Nested value omitted]";
13204
+ if (typeof value === "string" && value.length > 1e3) {
13205
+ return `${value.slice(0, 1e3)}\u2026 [${value.length} characters]`;
13206
+ }
13207
+ if (Array.isArray(value)) {
13208
+ return value.slice(0, 20).map((item) => redactSensitiveValue(item, depth + 1));
13209
+ }
13210
+ if (!isObject2(value)) return value;
13211
+ const output = {};
13212
+ for (const [key, field] of Object.entries(value).slice(0, 50)) {
13213
+ output[key] = /password|secret|token|authorization|api[-_]?key/i.test(key) ? "[Redacted]" : redactSensitiveValue(field, depth + 1);
13214
+ }
13215
+ return output;
13216
+ }
13217
+ function formatDownloadApprovalDetails(value) {
13218
+ if (!isObject2(value)) return "{}";
13219
+ const contents = property(value, "contents");
13220
+ if (!Array.isArray(contents)) return "{}";
13221
+ const summary = contents.slice(0, 20).map((item) => {
13222
+ if (!isObject2(item)) return { type: "invalid" };
13223
+ if (property(item, "type") === "resource_link") {
13224
+ return {
13225
+ type: "resource_link",
13226
+ name: stringProperty(item, "name"),
13227
+ uri: stringProperty(item, "uri"),
13228
+ mimeType: stringProperty(item, "mimeType")
13229
+ };
13230
+ }
13231
+ const resource = property(item, "resource");
13232
+ if (!isObject2(resource)) return { type: property(item, "type") };
13233
+ const text = property(resource, "text");
13234
+ const blob = property(resource, "blob");
13235
+ return {
13236
+ type: "resource",
13237
+ name: stringProperty(resource, "name"),
13238
+ uri: stringProperty(resource, "uri"),
13239
+ mimeType: stringProperty(resource, "mimeType"),
13240
+ size: typeof text === "string" ? `${new TextEncoder().encode(text).byteLength} bytes` : typeof blob === "string" ? `approximately ${Math.floor(blob.length * 3 / 4)} bytes` : void 0
13241
+ };
13242
+ });
13243
+ return JSON.stringify({ files: summary }, null, 2);
13244
+ }
13245
+ function triggerMcpAppDownloads(value) {
13246
+ const downloads = parseDownloadItems(value);
13247
+ for (const download of downloads) {
13248
+ if (download.kind === "link") {
13249
+ clickDownload(download.uri, download.filename);
13250
+ continue;
13251
+ }
13252
+ const blob = new Blob(
13253
+ [
13254
+ download.text !== void 0 ? download.text : decodeBase64(download.blob ?? "")
13255
+ ],
13256
+ { type: download.mimeType }
13257
+ );
13258
+ const url = URL.createObjectURL(blob);
13259
+ clickDownload(url, download.filename);
13260
+ window.setTimeout(() => URL.revokeObjectURL(url), 0);
13261
+ }
13262
+ }
13263
+ function parseDownloadItems(value) {
13264
+ if (!isObject2(value)) throw new Error("Download params must be an object");
13265
+ if (property(value, "isError") === true) {
13266
+ throw new Error("The MCP App reported that the download failed");
13267
+ }
13268
+ const contents = property(value, "contents");
13269
+ if (!Array.isArray(contents) || contents.length === 0) {
13270
+ throw new Error("Download contents must be a non-empty array");
13271
+ }
13272
+ return contents.map((item, index) => {
13273
+ if (!isObject2(item)) throw new Error("Download content is invalid");
13274
+ const type = property(item, "type");
13275
+ if (type === "resource_link") {
13276
+ const uri2 = stringProperty(item, "uri");
13277
+ const name = stringProperty(item, "name");
13278
+ if (!uri2 || !name || !isHttpUrl(uri2)) {
13279
+ throw new Error(
13280
+ "Download link must use HTTP or HTTPS and include a name"
13281
+ );
13282
+ }
13283
+ return {
13284
+ kind: "link",
13285
+ filename: sanitizeFilename(name, index),
13286
+ uri: uri2
13287
+ };
13288
+ }
13289
+ if (type !== "resource") {
13290
+ throw new Error("Download content type is unsupported");
13291
+ }
13292
+ const resource = property(item, "resource");
13293
+ if (!isObject2(resource)) throw new Error("Embedded download is invalid");
13294
+ const uri = stringProperty(resource, "uri");
13295
+ if (!uri) throw new Error("Embedded download URI is required");
13296
+ const text = property(resource, "text");
13297
+ const blob = property(resource, "blob");
13298
+ if (typeof text !== "string" && typeof blob !== "string") {
13299
+ throw new Error("Embedded download must include text or base64 data");
13300
+ }
13301
+ const common = {
13302
+ kind: "embedded",
13303
+ filename: sanitizeFilename(
13304
+ stringProperty(resource, "name") ?? filenameFromUri(uri),
13305
+ index
13306
+ ),
13307
+ mimeType: stringProperty(resource, "mimeType") ?? "application/octet-stream"
13308
+ };
13309
+ return typeof text === "string" ? { ...common, text } : { ...common, blob };
13310
+ });
13311
+ }
13312
+ function decodeBase64(value) {
13313
+ const decoded = window.atob(value);
13314
+ return Uint8Array.from(decoded, (character) => character.charCodeAt(0));
13315
+ }
13316
+ function filenameFromUri(uri) {
13317
+ try {
13318
+ const pathname = new URL(uri).pathname;
13319
+ const segment = pathname.split("/").filter(Boolean).at(-1);
13320
+ return segment ? decodeURIComponent(segment) : "download";
13321
+ } catch {
13322
+ return uri.split("/").filter(Boolean).at(-1) ?? "download";
13323
+ }
13324
+ }
13325
+ function sanitizeFilename(value, index) {
13326
+ const sanitized = Array.from(
13327
+ value,
13328
+ (character) => character.charCodeAt(0) <= 31 || /[\\/:*?"<>|]/.test(character) ? "_" : character
13329
+ ).join("").trim().slice(0, 255);
13330
+ return sanitized || `download-${index + 1}`;
13331
+ }
13332
+ function isHttpUrl(value) {
13333
+ try {
13334
+ const url = new URL(value);
13335
+ return url.protocol === "http:" || url.protocol === "https:";
13336
+ } catch {
13337
+ return false;
13338
+ }
13339
+ }
13340
+ function clickDownload(uri, filename) {
13341
+ const anchor = document.createElement("a");
13342
+ anchor.href = uri;
13343
+ anchor.download = filename;
13344
+ anchor.rel = "noopener noreferrer";
13345
+ anchor.hidden = true;
13346
+ document.body.append(anchor);
13347
+ anchor.click();
13348
+ anchor.remove();
13349
+ }
13350
+
13351
+ // src/components/thread/messages/mcp-app.tsx
13099
13352
  var import_jsx_runtime43 = require("react/jsx-runtime");
13100
13353
  var EMPTY_INPUT_SCHEMA = {
13101
13354
  type: "object",
@@ -13128,53 +13381,28 @@ function readIconDefinition(value) {
13128
13381
  }
13129
13382
  function readStringList(value) {
13130
13383
  if (!Array.isArray(value)) return void 0;
13131
- const strings = value.filter((item) => typeof item === "string");
13384
+ const strings = value.filter(
13385
+ (item) => typeof item === "string"
13386
+ );
13132
13387
  return strings.length ? strings : void 0;
13133
13388
  }
13134
- function buildXpertApiUrl(apiUrl, path) {
13135
- const normalizedApiUrl = apiUrl.trim();
13136
- if (!normalizedApiUrl) return path;
13137
- try {
13138
- const url = new URL(normalizedApiUrl);
13139
- return `${url.origin}${path}`;
13140
- } catch {
13141
- return path;
13142
- }
13143
- }
13144
- function appendQuery(path, params) {
13145
- const query = params.toString();
13146
- return query ? `${path}?${query}` : path;
13147
- }
13148
- function buildMcpAppReviveParams(data, options) {
13149
- const params = new URLSearchParams();
13150
- const add = (key, value) => {
13151
- if (value) {
13152
- params.set(key, value);
13153
- }
13389
+ function buildMcpAppReviveQuery(data, options) {
13390
+ return {
13391
+ toolsetId: data.toolsetId,
13392
+ serverName: data.serverName,
13393
+ toolName: data.toolName,
13394
+ toolCallId: data.toolCallId,
13395
+ resourceUri: data.resourceUri,
13396
+ title: typeof data.title === "string" ? data.title : void 0,
13397
+ messageId: options?.messageId,
13398
+ token: options?.appInstanceToken ?? data.appInstanceToken
13154
13399
  };
13155
- add("toolsetId", data.toolsetId);
13156
- add("serverName", data.serverName);
13157
- add("toolName", data.toolName);
13158
- add("toolCallId", data.toolCallId);
13159
- add("resourceUri", data.resourceUri);
13160
- add("title", typeof data.title === "string" ? data.title : void 0);
13161
- add("messageId", options?.messageId);
13162
- add("token", options?.appInstanceToken ?? data.appInstanceToken);
13163
- return params;
13164
- }
13165
- function buildMcpAppEndpointPath(data, endpoint, options) {
13166
- return appendQuery(
13167
- `/api/xpert-toolset/mcp-apps/${encodeURIComponent(
13168
- data.appInstanceId
13169
- )}/${endpoint}`,
13170
- buildMcpAppReviveParams(data, options)
13171
- );
13172
13400
  }
13173
13401
  function escapeHtmlAttribute(value) {
13174
13402
  return value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
13175
13403
  }
13176
13404
  function domains(values) {
13177
- return values?.filter((value) => value.trim()).join(" ") ?? "";
13405
+ return values?.map((value) => value.trim()).filter((value) => value && !/[\s;'"<>]/.test(value)).join(" ") ?? "";
13178
13406
  }
13179
13407
  function buildCsp(csp) {
13180
13408
  const resourceDomains = domains(csp?.resourceDomains);
@@ -13189,7 +13417,9 @@ function buildCsp(csp) {
13189
13417
  `media-src data: blob: ${resourceDomains}`.trim(),
13190
13418
  `font-src data: ${resourceDomains}`.trim(),
13191
13419
  `connect-src ${connectDomains}`,
13420
+ `form-action ${connectDomains}`,
13192
13421
  `frame-src ${frameDomains}`,
13422
+ "object-src 'none'",
13193
13423
  `base-uri ${baseUriDomains}`
13194
13424
  ].join("; ");
13195
13425
  }
@@ -13275,13 +13505,14 @@ function jsonRpcResult(id, result) {
13275
13505
  result
13276
13506
  };
13277
13507
  }
13278
- function jsonRpcError(id, message) {
13508
+ function jsonRpcError(id, message, code = -32e3, data) {
13279
13509
  return {
13280
13510
  jsonrpc: "2.0",
13281
13511
  id: id ?? null,
13282
13512
  error: {
13283
- code: -32e3,
13284
- message
13513
+ code,
13514
+ message,
13515
+ ...data === void 0 ? {} : { data }
13285
13516
  }
13286
13517
  };
13287
13518
  }
@@ -13332,11 +13563,7 @@ var MCP_APP_THEME_COLOR_TOKENS = [
13332
13563
  ["--background", "--mcp-app-color-background", "oklch(1 0 0)"],
13333
13564
  ["--foreground", "--mcp-app-color-foreground", "oklch(0.145 0 0)"],
13334
13565
  ["--card", "--mcp-app-color-card", "oklch(1 0 0)"],
13335
- [
13336
- "--card-foreground",
13337
- "--mcp-app-color-card-foreground",
13338
- "oklch(0.145 0 0)"
13339
- ],
13566
+ ["--card-foreground", "--mcp-app-color-card-foreground", "oklch(0.145 0 0)"],
13340
13567
  ["--popover", "--mcp-app-color-popover", "oklch(1 0 0)"],
13341
13568
  [
13342
13569
  "--popover-foreground",
@@ -13367,11 +13594,7 @@ var MCP_APP_THEME_COLOR_TOKENS = [
13367
13594
  "--mcp-app-color-accent-foreground",
13368
13595
  "oklch(0.205 0 0)"
13369
13596
  ],
13370
- [
13371
- "--destructive",
13372
- "--mcp-app-color-destructive",
13373
- "oklch(0.577 0.245 27.325)"
13374
- ],
13597
+ ["--destructive", "--mcp-app-color-destructive", "oklch(0.577 0.245 27.325)"],
13375
13598
  [
13376
13599
  "--destructive-foreground",
13377
13600
  "--mcp-app-color-destructive-foreground",
@@ -13485,9 +13708,7 @@ function normalizeMcpAppToolInfo(value, data, resource = {}) {
13485
13708
  ...rawTool,
13486
13709
  name: originalName,
13487
13710
  title: readLocalizedText(rawTool.title) ?? title,
13488
- inputSchema: normalizeInputSchema(
13489
- rawTool.inputSchema ?? raw.inputSchema
13490
- ),
13711
+ inputSchema: normalizeInputSchema(rawTool.inputSchema ?? raw.inputSchema),
13491
13712
  ...description ? {
13492
13713
  description: readLocalizedText(rawTool.description) ?? description
13493
13714
  } : {},
@@ -13516,10 +13737,66 @@ function buildIframeAllow(permissions) {
13516
13737
  return policies.length ? policies.join("; ") : void 0;
13517
13738
  }
13518
13739
  function buildSandboxAttribute() {
13519
- return ["allow-downloads", "allow-forms", "allow-modals", "allow-scripts"].join(
13520
- " "
13740
+ return ["allow-forms", "allow-modals", "allow-scripts"].join(" ");
13741
+ }
13742
+ function isLoopbackHostname(hostname) {
13743
+ return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]";
13744
+ }
13745
+ function normalizeRequestedDomain(value) {
13746
+ const domain = value?.trim().toLowerCase().replace(/\.$/, "");
13747
+ if (!domain || /[/:?#@]/.test(domain)) return null;
13748
+ try {
13749
+ const parsed = new URL(`https://${domain}`);
13750
+ return parsed.hostname === domain && !parsed.port ? domain : null;
13751
+ } catch {
13752
+ return null;
13753
+ }
13754
+ }
13755
+ function domainMatchesAllowlist(domain, allowedDomains) {
13756
+ return Boolean(
13757
+ allowedDomains?.some((value) => {
13758
+ const entry = value.trim().toLowerCase().replace(/\.$/, "");
13759
+ if (entry.startsWith("*.")) {
13760
+ const suffix = entry.slice(2);
13761
+ return Boolean(suffix) && domain !== suffix && domain.endsWith(`.${suffix}`);
13762
+ }
13763
+ return domain === entry;
13764
+ })
13521
13765
  );
13522
13766
  }
13767
+ function resolveMcpAppSandboxProxy(options, requestedDomain, hostLocation = window.location.href) {
13768
+ const configuredUrl = options?.sandboxProxyUrl?.trim();
13769
+ if (!configuredUrl) return null;
13770
+ try {
13771
+ const hostOrigin = new URL(hostLocation).origin;
13772
+ const proxyUrl = new URL(configuredUrl, hostLocation);
13773
+ if (proxyUrl.protocol !== "https:" && !(proxyUrl.protocol === "http:" && isLoopbackHostname(proxyUrl.hostname))) {
13774
+ return null;
13775
+ }
13776
+ const domain = normalizeRequestedDomain(requestedDomain);
13777
+ const dedicatedOrigin = Boolean(
13778
+ domain && (domain === proxyUrl.hostname.toLowerCase() || domainMatchesAllowlist(domain, options?.allowedDomains))
13779
+ );
13780
+ if (domain && dedicatedOrigin) {
13781
+ proxyUrl.hostname = domain;
13782
+ proxyUrl.port = "";
13783
+ }
13784
+ if (proxyUrl.origin === hostOrigin) return null;
13785
+ const fragment = new URLSearchParams(proxyUrl.hash.slice(1));
13786
+ fragment.set("parentOrigin", hostOrigin);
13787
+ proxyUrl.hash = fragment.toString();
13788
+ return {
13789
+ url: proxyUrl.toString(),
13790
+ origin: proxyUrl.origin,
13791
+ dedicatedOrigin
13792
+ };
13793
+ } catch {
13794
+ return null;
13795
+ }
13796
+ }
13797
+ function buildMcpAppInnerSandbox(dedicatedOrigin) {
13798
+ return dedicatedOrigin ? `${buildSandboxAttribute()} allow-same-origin` : buildSandboxAttribute();
13799
+ }
13523
13800
  function stringifyToolResult(value) {
13524
13801
  if (typeof value === "string") return value;
13525
13802
  try {
@@ -13642,7 +13919,7 @@ function normalizeMcpAppResourceResponse(value, data) {
13642
13919
  rawToolResult
13643
13920
  };
13644
13921
  }
13645
- function isHttpUrl(value) {
13922
+ function isHttpUrl2(value) {
13646
13923
  try {
13647
13924
  const url = new URL(value);
13648
13925
  return url.protocol === "http:" || url.protocol === "https:";
@@ -13650,22 +13927,124 @@ function isHttpUrl(value) {
13650
13927
  return false;
13651
13928
  }
13652
13929
  }
13653
- function contentBlocksToText(content) {
13654
- if (!Array.isArray(content)) return null;
13655
- const parts = content.map((item) => {
13656
- if (!isRecord5(item)) return "";
13657
- if (item.type === "text" && typeof item.text === "string") {
13658
- return item.text;
13930
+ var MCP_APP_MESSAGE_MAX_BINARY_BYTES = 25 * 1024 * 1024;
13931
+ function normalizeMcpMimeType(value, fallback) {
13932
+ const mimeType = typeof value === "string" ? value.trim() : fallback;
13933
+ return mimeType && /^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/i.test(mimeType) ? mimeType.toLowerCase() : null;
13934
+ }
13935
+ function normalizeMcpBase64(value) {
13936
+ if (typeof value !== "string") return null;
13937
+ const data = value.replace(/\s/g, "");
13938
+ if (!data || data.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(data)) {
13939
+ return null;
13940
+ }
13941
+ return data;
13942
+ }
13943
+ function decodedBase64Bytes(data) {
13944
+ const padding = data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0;
13945
+ return data.length / 4 * 3 - padding;
13946
+ }
13947
+ function mcpMessageFile(data, mimeType, name) {
13948
+ return {
13949
+ name,
13950
+ originalName: name,
13951
+ mimeType,
13952
+ fileUrl: `data:${mimeType};base64,${data}`
13953
+ };
13954
+ }
13955
+ function resourceLabel(resource) {
13956
+ const details = {
13957
+ uri: readString3(resource.uri),
13958
+ mimeType: readString3(resource.mimeType)
13959
+ };
13960
+ return `[Resource ${stringifyToolResult(details)}]`;
13961
+ }
13962
+ function resourceLinkLabel(resourceLink) {
13963
+ const details = {
13964
+ uri: readString3(resourceLink.uri),
13965
+ name: readString3(resourceLink.name),
13966
+ description: readString3(resourceLink.description),
13967
+ mimeType: readString3(resourceLink.mimeType),
13968
+ size: typeof resourceLink.size === "number" ? resourceLink.size : void 0
13969
+ };
13970
+ return `[Resource link ${stringifyToolResult(details)}]`;
13971
+ }
13972
+ function contentBlocksToChatInput(content) {
13973
+ if (!Array.isArray(content)) {
13974
+ throw new Error("ui/message content must be an array");
13975
+ }
13976
+ const text = [];
13977
+ const files = [];
13978
+ let binaryBytes = 0;
13979
+ content.forEach((item, index) => {
13980
+ if (!isRecord5(item) || typeof item.type !== "string") {
13981
+ throw new Error(`ui/message content block ${index + 1} is invalid`);
13659
13982
  }
13660
- if (item.type === "resource_link" && typeof item.uri === "string") {
13661
- return item.uri;
13983
+ if (item.type === "text") {
13984
+ if (typeof item.text !== "string") {
13985
+ throw new Error(`ui/message text block ${index + 1} is invalid`);
13986
+ }
13987
+ if (item.text.length) text.push(item.text);
13988
+ return;
13662
13989
  }
13663
13990
  if (item.type === "image" || item.type === "audio") {
13664
- return `[${item.type}]`;
13991
+ const mimeType = normalizeMcpMimeType(item.mimeType);
13992
+ const data = normalizeMcpBase64(item.data);
13993
+ if (!mimeType || !data || !mimeType.startsWith(`${item.type}/`)) {
13994
+ throw new Error(
13995
+ `ui/message ${item.type} block ${index + 1} is invalid`
13996
+ );
13997
+ }
13998
+ binaryBytes += decodedBase64Bytes(data);
13999
+ files.push(
14000
+ mcpMessageFile(data, mimeType, `mcp-app-${item.type}-${index + 1}`)
14001
+ );
14002
+ return;
14003
+ }
14004
+ if (item.type === "resource") {
14005
+ const resource = readRecord(item.resource);
14006
+ if (!resource || typeof resource.uri !== "string") {
14007
+ throw new Error(`ui/message resource block ${index + 1} is invalid`);
14008
+ }
14009
+ const label = resourceLabel(resource);
14010
+ if (typeof resource.text === "string") {
14011
+ text.push(`${label}
14012
+ ${resource.text}`);
14013
+ return;
14014
+ }
14015
+ const data = normalizeMcpBase64(resource.blob);
14016
+ const mimeType = normalizeMcpMimeType(
14017
+ resource.mimeType,
14018
+ "application/octet-stream"
14019
+ );
14020
+ if (!data || !mimeType) {
14021
+ throw new Error(`ui/message resource block ${index + 1} is invalid`);
14022
+ }
14023
+ binaryBytes += decodedBase64Bytes(data);
14024
+ text.push(label);
14025
+ files.push(
14026
+ mcpMessageFile(data, mimeType, `mcp-app-resource-${index + 1}`)
14027
+ );
14028
+ return;
13665
14029
  }
13666
- return stringifyToolResult(item);
13667
- }).map((part) => part.trim()).filter(Boolean);
13668
- return parts.length ? parts.join("\n\n") : null;
14030
+ if (item.type === "resource_link" && typeof item.uri === "string") {
14031
+ text.push(resourceLinkLabel(item));
14032
+ return;
14033
+ }
14034
+ throw new Error(
14035
+ `ui/message content block ${index + 1} uses an unsupported type`
14036
+ );
14037
+ });
14038
+ if (binaryBytes > MCP_APP_MESSAGE_MAX_BINARY_BYTES) {
14039
+ throw new Error("ui/message binary content exceeds the 25 MiB limit");
14040
+ }
14041
+ if (!text.length && !files.length) {
14042
+ throw new Error("ui/message content is empty");
14043
+ }
14044
+ return {
14045
+ input: text.join("\n\n"),
14046
+ files
14047
+ };
13669
14048
  }
13670
14049
  function isMcpAppComponentData(data) {
13671
14050
  return isRecord5(data) && data.type === "McpApp" && typeof data.appInstanceId === "string" && typeof data.resourceUri === "string";
@@ -13673,68 +14052,205 @@ function isMcpAppComponentData(data) {
13673
14052
  function McpAppMessage({
13674
14053
  data,
13675
14054
  messageId,
13676
- className
14055
+ className,
14056
+ mcpApps
13677
14057
  }) {
13678
14058
  const { i18n: i18n2 } = useChatkitTranslation();
13679
- const {
13680
- apiUrl,
13681
- authenticatedFetch,
13682
- isLoading: streamIsLoading,
13683
- submit
13684
- } = useStreamContext();
14059
+ const { client, isLoading: streamIsLoading, submit } = useStreamContext();
13685
14060
  const iframeRef = React37.useRef(null);
14061
+ const appWindowRef = React37.useRef(null);
13686
14062
  const containerRef = React37.useRef(null);
13687
14063
  const initializedRef = React37.useRef(false);
13688
14064
  const sentInitialResultRef = React37.useRef(false);
13689
14065
  const modelContextRef = React37.useRef(null);
14066
+ const pendingApprovalRef = React37.useRef(null);
14067
+ const approvalActionRef = React37.useRef(null);
14068
+ const runtimeAppInstanceTokenRef = React37.useRef(
14069
+ data.appInstanceToken
14070
+ );
14071
+ const teardownGenerationRef = React37.useRef(0);
14072
+ const teardownStartedRef = React37.useRef(false);
14073
+ const activeAppInstanceIdRef = React37.useRef(data.appInstanceId);
13690
14074
  const [resource, setResource] = React37.useState(null);
13691
14075
  const [runtimeAppInstanceToken, setRuntimeAppInstanceToken] = React37.useState(data.appInstanceToken);
13692
14076
  const [srcDoc, setSrcDoc] = React37.useState(null);
13693
14077
  const [height, setHeight] = React37.useState(420);
14078
+ const [displayMode, setDisplayMode] = React37.useState("inline");
14079
+ const [pendingApproval, setPendingApproval] = React37.useState(null);
14080
+ const [approvalAction, setApprovalAction] = React37.useState(null);
14081
+ const [approvalError, setApprovalError] = React37.useState(null);
13694
14082
  const [error, setError] = React37.useState(null);
13695
14083
  const [isLoading, setIsLoading] = React37.useState(true);
13696
- const resourceUrl = React37.useMemo(
13697
- () => buildXpertApiUrl(
13698
- apiUrl,
13699
- buildMcpAppEndpointPath(data, "resource", {
13700
- messageId
13701
- })
13702
- ),
13703
- [apiUrl, data, messageId]
14084
+ const [isTornDown, setIsTornDown] = React37.useState(false);
14085
+ const sandboxProxy = React37.useMemo(
14086
+ () => resolveMcpAppSandboxProxy(mcpApps, resource?.domain ?? data.domain),
14087
+ [data.domain, mcpApps, resource?.domain]
13704
14088
  );
13705
- const rpcUrl = React37.useMemo(
13706
- () => buildXpertApiUrl(
13707
- apiUrl,
13708
- buildMcpAppEndpointPath(data, "rpc", {
13709
- appInstanceToken: runtimeAppInstanceToken,
13710
- messageId
13711
- })
13712
- ),
13713
- [apiUrl, data, messageId, runtimeAppInstanceToken]
14089
+ React37.useEffect(() => {
14090
+ runtimeAppInstanceTokenRef.current = runtimeAppInstanceToken;
14091
+ }, [runtimeAppInstanceToken]);
14092
+ const bindIframeRef = React37.useCallback(
14093
+ (iframe) => {
14094
+ iframeRef.current = iframe;
14095
+ if (iframe?.contentWindow) {
14096
+ appWindowRef.current = iframe.contentWindow;
14097
+ }
14098
+ },
14099
+ []
14100
+ );
14101
+ const postToApp = React37.useCallback(
14102
+ (message) => {
14103
+ iframeRef.current?.contentWindow?.postMessage(
14104
+ message,
14105
+ sandboxProxy?.origin ?? "*"
14106
+ );
14107
+ },
14108
+ [sandboxProxy?.origin]
13714
14109
  );
13715
- const postToApp = React37.useCallback((message) => {
13716
- iframeRef.current?.contentWindow?.postMessage(message, "*");
13717
- }, []);
13718
14110
  const callHostRpc = React37.useCallback(
13719
14111
  async (request) => {
13720
- const response = await authenticatedFetch(rpcUrl, {
13721
- method: "POST",
13722
- headers: {
13723
- "content-type": "application/json"
13724
- },
13725
- body: JSON.stringify({
14112
+ return client.mcp.apps.rpc(
14113
+ data.appInstanceId,
14114
+ {
13726
14115
  jsonrpc: "2.0",
13727
14116
  id: request.id ?? null,
13728
14117
  method: request.method,
13729
14118
  params: request.params
14119
+ },
14120
+ buildMcpAppReviveQuery(data, {
14121
+ appInstanceToken: runtimeAppInstanceToken,
14122
+ messageId
13730
14123
  })
14124
+ );
14125
+ },
14126
+ [client, data, messageId, runtimeAppInstanceToken]
14127
+ );
14128
+ const clearPendingApproval = React37.useCallback(() => {
14129
+ pendingApprovalRef.current = null;
14130
+ approvalActionRef.current = null;
14131
+ setPendingApproval(null);
14132
+ setApprovalAction(null);
14133
+ setApprovalError(null);
14134
+ }, []);
14135
+ const isSupersededStrictModeTeardown = React37.useCallback(
14136
+ (generation, appInstanceId) => teardownGenerationRef.current !== generation && activeAppInstanceIdRef.current === appInstanceId,
14137
+ []
14138
+ );
14139
+ const processHostRpcResponse = React37.useCallback(
14140
+ (request, response) => {
14141
+ const nextApproval = readMcpAppPendingApproval(response, request);
14142
+ if (nextApproval) {
14143
+ if (pendingApprovalRef.current) {
14144
+ postToApp(
14145
+ jsonRpcError(
14146
+ request.id,
14147
+ "Another MCP App approval request is already pending",
14148
+ -32004
14149
+ )
14150
+ );
14151
+ return;
14152
+ }
14153
+ pendingApprovalRef.current = nextApproval;
14154
+ setPendingApproval(nextApproval);
14155
+ setApprovalError(null);
14156
+ return;
14157
+ }
14158
+ const nextDisplayMode = readMcpAppDisplayMode(response);
14159
+ if (request.method === "ui/request-display-mode" && nextDisplayMode) {
14160
+ setDisplayMode(nextDisplayMode);
14161
+ }
14162
+ if (request.method === "ui/download-file" && isMcpAppRpcSuccess(response)) {
14163
+ try {
14164
+ triggerMcpAppDownloads(request.params);
14165
+ } catch (downloadError) {
14166
+ postToApp(
14167
+ jsonRpcError(request.id, getErrorMessage(downloadError), -32005)
14168
+ );
14169
+ return;
14170
+ }
14171
+ }
14172
+ postToApp(response);
14173
+ },
14174
+ [postToApp]
14175
+ );
14176
+ const dispatchHostRpc = React37.useCallback(
14177
+ async (request) => {
14178
+ try {
14179
+ processHostRpcResponse(request, await callHostRpc(request));
14180
+ } catch (rpcError) {
14181
+ postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
14182
+ }
14183
+ },
14184
+ [callHostRpc, postToApp, processHostRpcResponse]
14185
+ );
14186
+ const resolvePendingApproval = React37.useCallback(
14187
+ async (action) => {
14188
+ const approval = pendingApprovalRef.current;
14189
+ if (!approval || approvalActionRef.current) return;
14190
+ if (approval.expiresAt <= Date.now()) {
14191
+ clearPendingApproval();
14192
+ postToApp(
14193
+ jsonRpcError(
14194
+ approval.request.id,
14195
+ "The MCP App approval request expired",
14196
+ -32003
14197
+ )
14198
+ );
14199
+ return;
14200
+ }
14201
+ approvalActionRef.current = action;
14202
+ setApprovalAction(action);
14203
+ setApprovalError(null);
14204
+ const query = buildMcpAppReviveQuery(data, {
14205
+ appInstanceToken: runtimeAppInstanceToken,
14206
+ messageId
13731
14207
  });
13732
- if (!response.ok) {
13733
- throw new Error(`MCP App RPC failed with ${response.status}`);
14208
+ try {
14209
+ if (action === "reject") {
14210
+ await client.mcp.apps.reject(
14211
+ data.appInstanceId,
14212
+ approval.approvalId,
14213
+ query
14214
+ );
14215
+ clearPendingApproval();
14216
+ postToApp(
14217
+ jsonRpcError(
14218
+ approval.request.id,
14219
+ "The user rejected the MCP App action",
14220
+ -32002,
14221
+ { approvalId: approval.approvalId, rejected: true }
14222
+ )
14223
+ );
14224
+ return;
14225
+ }
14226
+ await client.mcp.apps.approve(
14227
+ data.appInstanceId,
14228
+ approval.approvalId,
14229
+ query
14230
+ );
14231
+ const retryRequest = withMcpAppApprovalId(
14232
+ approval.request,
14233
+ approval.approvalId
14234
+ );
14235
+ const response = await callHostRpc(retryRequest);
14236
+ clearPendingApproval();
14237
+ processHostRpcResponse(retryRequest, response);
14238
+ } catch (approvalRequestError) {
14239
+ approvalActionRef.current = null;
14240
+ setApprovalAction(null);
14241
+ setApprovalError(getErrorMessage(approvalRequestError));
13734
14242
  }
13735
- return response.json();
13736
14243
  },
13737
- [authenticatedFetch, rpcUrl]
14244
+ [
14245
+ callHostRpc,
14246
+ clearPendingApproval,
14247
+ client,
14248
+ data,
14249
+ messageId,
14250
+ postToApp,
14251
+ processHostRpcResponse,
14252
+ runtimeAppInstanceToken
14253
+ ]
13738
14254
  );
13739
14255
  const sendInitialToolNotifications = React37.useCallback(() => {
13740
14256
  if (!initializedRef.current || sentInitialResultRef.current || !resource) {
@@ -13767,28 +14283,35 @@ function McpAppMessage({
13767
14283
  const controller = new AbortController();
13768
14284
  initializedRef.current = false;
13769
14285
  sentInitialResultRef.current = false;
14286
+ pendingApprovalRef.current = null;
14287
+ approvalActionRef.current = null;
13770
14288
  setRuntimeAppInstanceToken(data.appInstanceToken);
14289
+ runtimeAppInstanceTokenRef.current = data.appInstanceToken;
14290
+ teardownStartedRef.current = false;
14291
+ setIsTornDown(false);
14292
+ setDisplayMode("inline");
14293
+ setPendingApproval(null);
14294
+ setApprovalAction(null);
14295
+ setApprovalError(null);
13771
14296
  setIsLoading(true);
13772
14297
  setError(null);
13773
14298
  setResource(null);
13774
14299
  setSrcDoc(null);
13775
14300
  void (async () => {
13776
14301
  try {
13777
- const response = await authenticatedFetch(resourceUrl, {
13778
- signal: controller.signal
13779
- });
13780
- if (!response.ok) {
13781
- throw new Error(`MCP App resource failed with ${response.status}`);
13782
- }
13783
- const payload = await response.json();
14302
+ const payload = await client.mcp.apps.getResource(
14303
+ data.appInstanceId,
14304
+ buildMcpAppReviveQuery(data, { messageId }),
14305
+ { signal: controller.signal }
14306
+ );
13784
14307
  const normalizedResource = normalizeMcpAppResourceResponse(
13785
14308
  payload,
13786
14309
  data
13787
14310
  );
13788
14311
  setResource(normalizedResource);
13789
- setRuntimeAppInstanceToken(
13790
- normalizedResource.appInstanceToken ?? data.appInstanceToken
13791
- );
14312
+ const nextAppInstanceToken = normalizedResource.appInstanceToken ?? data.appInstanceToken;
14313
+ runtimeAppInstanceTokenRef.current = nextAppInstanceToken;
14314
+ setRuntimeAppInstanceToken(nextAppInstanceToken);
13792
14315
  const hostLocale = normalizeHostLocale(i18n2.language);
13793
14316
  setSrcDoc(
13794
14317
  injectMcpAppTheme(
@@ -13813,26 +14336,131 @@ function McpAppMessage({
13813
14336
  controller.abort();
13814
14337
  };
13815
14338
  }, [
13816
- authenticatedFetch,
14339
+ client,
13817
14340
  data,
13818
14341
  data.appInstanceId,
13819
14342
  data.appInstanceToken,
13820
14343
  data.csp,
13821
14344
  i18n2.language,
13822
- resourceUrl
14345
+ messageId
13823
14346
  ]);
14347
+ React37.useEffect(() => {
14348
+ const generation = ++teardownGenerationRef.current;
14349
+ activeAppInstanceIdRef.current = data.appInstanceId;
14350
+ return () => {
14351
+ const appWindow = appWindowRef.current;
14352
+ const appOrigin = sandboxProxy?.origin ?? "*";
14353
+ const query = buildMcpAppReviveQuery(data, {
14354
+ appInstanceToken: runtimeAppInstanceTokenRef.current,
14355
+ messageId
14356
+ });
14357
+ const approval = pendingApprovalRef.current;
14358
+ queueMicrotask(() => {
14359
+ if (isSupersededStrictModeTeardown(generation, data.appInstanceId)) {
14360
+ return;
14361
+ }
14362
+ if (teardownStartedRef.current) {
14363
+ return;
14364
+ }
14365
+ teardownStartedRef.current = true;
14366
+ try {
14367
+ appWindow?.postMessage(
14368
+ {
14369
+ jsonrpc: "2.0",
14370
+ id: `xpert-teardown-${data.appInstanceId}`,
14371
+ method: "ui/resource-teardown",
14372
+ params: { reason: "host-unmount" }
14373
+ },
14374
+ appOrigin
14375
+ );
14376
+ } catch {
14377
+ }
14378
+ void (async () => {
14379
+ if (approval) {
14380
+ await client.mcp.apps.reject(data.appInstanceId, approval.approvalId, query).catch(() => void 0);
14381
+ }
14382
+ await client.mcp.apps.teardown(data.appInstanceId, query).catch(() => void 0);
14383
+ })();
14384
+ });
14385
+ };
14386
+ }, [
14387
+ client,
14388
+ data,
14389
+ data.appInstanceId,
14390
+ isSupersededStrictModeTeardown,
14391
+ messageId,
14392
+ sandboxProxy?.origin
14393
+ ]);
14394
+ React37.useEffect(() => {
14395
+ if (!pendingApproval) return;
14396
+ const remaining = pendingApproval.expiresAt - Date.now();
14397
+ if (remaining <= 0) {
14398
+ clearPendingApproval();
14399
+ postToApp(
14400
+ jsonRpcError(
14401
+ pendingApproval.request.id,
14402
+ "The MCP App approval request expired",
14403
+ -32003
14404
+ )
14405
+ );
14406
+ return;
14407
+ }
14408
+ const timeout = window.setTimeout(() => {
14409
+ if (pendingApprovalRef.current?.approvalId !== pendingApproval.approvalId) {
14410
+ return;
14411
+ }
14412
+ clearPendingApproval();
14413
+ postToApp(
14414
+ jsonRpcError(
14415
+ pendingApproval.request.id,
14416
+ "The MCP App approval request expired",
14417
+ -32003
14418
+ )
14419
+ );
14420
+ }, remaining);
14421
+ return () => window.clearTimeout(timeout);
14422
+ }, [clearPendingApproval, pendingApproval, postToApp]);
13824
14423
  React37.useEffect(() => {
13825
14424
  sendInitialToolNotifications();
13826
14425
  }, [sendInitialToolNotifications]);
14426
+ React37.useEffect(() => {
14427
+ if (!initializedRef.current) return;
14428
+ postToApp({
14429
+ jsonrpc: "2.0",
14430
+ method: "ui/notifications/host-context-changed",
14431
+ params: {
14432
+ displayMode,
14433
+ containerDimensions: getContainerDimensions(containerRef.current)
14434
+ }
14435
+ });
14436
+ }, [displayMode, height, postToApp]);
13827
14437
  React37.useEffect(() => {
13828
14438
  const handleMessage = async (event) => {
13829
14439
  if (event.source !== iframeRef.current?.contentWindow) {
13830
14440
  return;
13831
14441
  }
14442
+ if (sandboxProxy && event.origin !== sandboxProxy.origin) {
14443
+ return;
14444
+ }
13832
14445
  const request = normalizeJsonRpcMessage(event.data);
13833
14446
  if (!request?.method) {
13834
14447
  return;
13835
14448
  }
14449
+ if (request.method === "ui/notifications/sandbox-proxy-ready" && sandboxProxy && srcDoc) {
14450
+ const permissions = resource?.permissions ?? data.permissions;
14451
+ const csp = resource?.csp ?? data.csp;
14452
+ postToApp({
14453
+ jsonrpc: "2.0",
14454
+ method: "ui/notifications/sandbox-resource-ready",
14455
+ params: {
14456
+ html: srcDoc,
14457
+ sandbox: buildMcpAppInnerSandbox(sandboxProxy.dedicatedOrigin),
14458
+ ...csp ? { csp } : {},
14459
+ ...permissions ? { permissions } : {}
14460
+ }
14461
+ });
14462
+ return;
14463
+ }
13836
14464
  if (request.method === "ui/notifications/initialized") {
13837
14465
  initializedRef.current = true;
13838
14466
  sendInitialToolNotifications();
@@ -13845,6 +14473,39 @@ function McpAppMessage({
13845
14473
  }
13846
14474
  return;
13847
14475
  }
14476
+ if (request.method === "ui/notifications/request-teardown") {
14477
+ if (teardownStartedRef.current) {
14478
+ return;
14479
+ }
14480
+ teardownStartedRef.current = true;
14481
+ postToApp({
14482
+ jsonrpc: "2.0",
14483
+ id: `xpert-teardown-${data.appInstanceId}`,
14484
+ method: "ui/resource-teardown",
14485
+ params: { reason: "app-requested" }
14486
+ });
14487
+ const query = buildMcpAppReviveQuery(data, {
14488
+ appInstanceToken: runtimeAppInstanceTokenRef.current,
14489
+ messageId
14490
+ });
14491
+ const approval = pendingApprovalRef.current;
14492
+ try {
14493
+ if (approval) {
14494
+ await client.mcp.apps.reject(
14495
+ data.appInstanceId,
14496
+ approval.approvalId,
14497
+ query
14498
+ );
14499
+ }
14500
+ await client.mcp.apps.teardown(data.appInstanceId, query);
14501
+ clearPendingApproval();
14502
+ setIsTornDown(true);
14503
+ } catch (teardownError) {
14504
+ teardownStartedRef.current = false;
14505
+ setError(getErrorMessage(teardownError));
14506
+ }
14507
+ return;
14508
+ }
13848
14509
  if (request.method === "ui/initialize") {
13849
14510
  initializedRef.current = true;
13850
14511
  const permissions = resource?.permissions ?? data.permissions;
@@ -13868,7 +14529,11 @@ function McpAppMessage({
13868
14529
  openLinks: {},
13869
14530
  logging: {},
13870
14531
  message: {
13871
- text: {}
14532
+ text: {},
14533
+ image: {},
14534
+ audio: {},
14535
+ resource: {},
14536
+ resourceLink: {}
13872
14537
  },
13873
14538
  updateModelContext: {
13874
14539
  text: {},
@@ -13877,29 +14542,33 @@ function McpAppMessage({
13877
14542
  sandbox: {
13878
14543
  ...permissions ? { permissions } : {},
13879
14544
  ...csp ? { csp } : {}
13880
- }
14545
+ },
14546
+ downloadFile: {}
13881
14547
  },
13882
14548
  hostContext: {
13883
14549
  toolInfo,
13884
14550
  theme: theme.mode,
14551
+ styles: {
14552
+ variables: theme.cssVariables
14553
+ },
13885
14554
  themeCssVariables: theme.cssVariables,
13886
14555
  locale: hostLocale,
13887
14556
  language: hostLanguage,
13888
14557
  direction: hostDirection,
13889
14558
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
13890
- displayMode: "inline",
13891
- availableDisplayModes: ["inline"],
14559
+ displayMode,
14560
+ availableDisplayModes: ["inline", "fullscreen", "pip"],
13892
14561
  containerDimensions: getContainerDimensions(containerRef.current),
13893
14562
  userAgent: "xpert-chatkit",
13894
14563
  platform: "web",
13895
14564
  deviceCapabilities: {
13896
14565
  touch: navigator.maxTouchPoints > 0,
13897
- hover: window.matchMedia("(hover: hover)").matches
14566
+ hover: typeof window.matchMedia === "function" ? window.matchMedia("(hover: hover)").matches : false
13898
14567
  }
13899
14568
  },
13900
14569
  // Legacy compatibility for apps written before the 2026-01-26 result shape.
13901
14570
  capabilities: {
13902
- displayModes: ["inline"],
14571
+ displayModes: ["inline", "fullscreen", "pip"],
13903
14572
  serverTools: true,
13904
14573
  serverResources: true,
13905
14574
  openLinks: true
@@ -13912,8 +14581,8 @@ function McpAppMessage({
13912
14581
  language: hostLanguage,
13913
14582
  direction: hostDirection,
13914
14583
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
13915
- displayMode: "inline",
13916
- availableDisplayModes: ["inline"],
14584
+ displayMode,
14585
+ availableDisplayModes: ["inline", "fullscreen", "pip"],
13917
14586
  containerDimensions: getContainerDimensions(containerRef.current),
13918
14587
  userAgent: navigator.userAgent,
13919
14588
  platform: navigator.platform
@@ -13925,20 +14594,33 @@ function McpAppMessage({
13925
14594
  }
13926
14595
  if (request.method === "ui/open-link") {
13927
14596
  const href = isRecord5(request.params) && typeof request.params.url === "string" ? request.params.url : isRecord5(request.params) && typeof request.params.href === "string" ? request.params.href : null;
13928
- if (href && isHttpUrl(href)) {
13929
- window.open(href, "_blank", "noopener,noreferrer");
14597
+ if (!href || !isHttpUrl2(href)) {
13930
14598
  if (request.id !== void 0) {
13931
- postToApp(jsonRpcResult(request.id, {}));
14599
+ postToApp(jsonRpcError(request.id, "Invalid URL"));
13932
14600
  }
13933
- } else if (request.id !== void 0) {
13934
- postToApp(jsonRpcResult(request.id, { isError: true }));
14601
+ return;
14602
+ }
14603
+ try {
14604
+ const response = await callHostRpc({
14605
+ ...request,
14606
+ params: { url: href }
14607
+ });
14608
+ if (isMcpAppRpcSuccess(response)) {
14609
+ window.open(href, "_blank", "noopener,noreferrer");
14610
+ }
14611
+ postToApp(response);
14612
+ } catch (linkError) {
14613
+ postToApp(jsonRpcError(request.id, getErrorMessage(linkError)));
13935
14614
  }
13936
14615
  return;
13937
14616
  }
13938
14617
  if (request.method === "ui/update-model-context") {
13939
- modelContextRef.current = request.params;
13940
14618
  try {
13941
- postToApp(await callHostRpc(request));
14619
+ const response = await callHostRpc(request);
14620
+ if (isMcpAppRpcSuccess(response)) {
14621
+ modelContextRef.current = request.params;
14622
+ }
14623
+ postToApp(response);
13942
14624
  } catch (rpcError) {
13943
14625
  postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
13944
14626
  }
@@ -13956,14 +14638,12 @@ function McpAppMessage({
13956
14638
  postToApp(hostResponse);
13957
14639
  return;
13958
14640
  }
13959
- const inputText = contentBlocksToText(request.params.content);
13960
- if (!inputText) {
13961
- throw new Error("ui/message content did not include text");
13962
- }
14641
+ const messageInput = contentBlocksToChatInput(request.params.content);
13963
14642
  await submit(
13964
14643
  {
13965
14644
  input: {
13966
- input: inputText
14645
+ input: messageInput.input,
14646
+ ...messageInput.files.length ? { files: messageInput.files } : {}
13967
14647
  }
13968
14648
  },
13969
14649
  {
@@ -13988,11 +14668,7 @@ function McpAppMessage({
13988
14668
  if (request.id === void 0 && request.method.startsWith("ui/")) {
13989
14669
  return;
13990
14670
  }
13991
- try {
13992
- postToApp(await callHostRpc(request));
13993
- } catch (rpcError) {
13994
- postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
13995
- }
14671
+ await dispatchHostRpc(request);
13996
14672
  };
13997
14673
  window.addEventListener("message", handleMessage);
13998
14674
  return () => {
@@ -14000,19 +14676,20 @@ function McpAppMessage({
14000
14676
  };
14001
14677
  }, [
14002
14678
  callHostRpc,
14003
- data.appInstanceId,
14004
- data.csp,
14005
- data.permissions,
14006
- data.resourceUri,
14007
- data.title,
14008
- data.toolCallId,
14009
- data.toolName,
14679
+ clearPendingApproval,
14680
+ client,
14681
+ data,
14682
+ dispatchHostRpc,
14683
+ displayMode,
14010
14684
  i18n2.language,
14685
+ messageId,
14011
14686
  postToApp,
14012
14687
  resource?.csp,
14013
14688
  resource?.permissions,
14014
14689
  resource?.toolInfo,
14690
+ sandboxProxy,
14015
14691
  sendInitialToolNotifications,
14692
+ srcDoc,
14016
14693
  streamIsLoading,
14017
14694
  submit
14018
14695
  ]);
@@ -14021,7 +14698,7 @@ function McpAppMessage({
14021
14698
  () => buildIframeAllow(iframePermissions),
14022
14699
  [iframePermissions]
14023
14700
  );
14024
- const sandbox = React37.useMemo(() => buildSandboxAttribute(), []);
14701
+ const sandbox = sandboxProxy ? "allow-scripts allow-same-origin" : buildSandboxAttribute();
14025
14702
  const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
14026
14703
  const displayTitle = (0, import_chatkit_types11.resolveLocalizedText)(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
14027
14704
  const displayDescription = (0, import_chatkit_types11.resolveLocalizedText)(
@@ -14029,56 +14706,212 @@ function McpAppMessage({
14029
14706
  i18n2.language
14030
14707
  );
14031
14708
  const displayIcon = resource?.icon ?? data.icon;
14032
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14033
- "div",
14034
- {
14035
- ref: containerRef,
14036
- className: cn(
14037
- "overflow-hidden rounded-lg border bg-background shadow-sm",
14038
- !prefersBorder && "border-transparent shadow-none",
14039
- className
14040
- ),
14041
- children: [
14042
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
14043
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
14044
- displayIcon ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14045
- IconDefinitionRenderer,
14046
- {
14047
- icon: displayIcon,
14048
- size: 18,
14049
- className: "shrink-0",
14050
- decorative: true
14051
- }
14052
- ) : null,
14053
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0", children: [
14054
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "truncate text-sm font-medium", children: displayTitle }),
14055
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
14709
+ const elevatedDisplayMode = displayMode !== "inline";
14710
+ if (isTornDown) {
14711
+ return null;
14712
+ }
14713
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
14714
+ displayMode === "fullscreen" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14715
+ "div",
14716
+ {
14717
+ "aria-hidden": "true",
14718
+ className: "fixed inset-0 z-[79] bg-background/80 backdrop-blur-sm"
14719
+ }
14720
+ ) : null,
14721
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14722
+ "div",
14723
+ {
14724
+ ref: containerRef,
14725
+ "data-display-mode": displayMode,
14726
+ className: cn(
14727
+ "relative flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",
14728
+ displayMode === "fullscreen" && "fixed inset-4 z-[80] shadow-2xl",
14729
+ displayMode === "pip" && "fixed right-4 bottom-4 z-[80] h-[min(640px,calc(100vh-2rem))] w-[min(480px,calc(100vw-2rem))] shadow-2xl",
14730
+ !prefersBorder && "border-transparent shadow-none",
14731
+ className
14732
+ ),
14733
+ children: [
14734
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
14735
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
14736
+ displayIcon ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14737
+ IconDefinitionRenderer,
14738
+ {
14739
+ icon: displayIcon,
14740
+ size: 18,
14741
+ className: "shrink-0",
14742
+ decorative: true
14743
+ }
14744
+ ) : null,
14745
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0", children: [
14746
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "truncate text-sm font-medium", children: displayTitle }),
14747
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
14748
+ ] })
14749
+ ] }),
14750
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
14751
+ displayMode !== "fullscreen" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14752
+ Button,
14753
+ {
14754
+ type: "button",
14755
+ variant: "ghost",
14756
+ size: "icon-xs",
14757
+ title: i18n2.t("message.mcpApp.fullscreen"),
14758
+ "aria-label": i18n2.t("message.mcpApp.fullscreen"),
14759
+ onClick: () => setDisplayMode("fullscreen"),
14760
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Maximize2, {})
14761
+ }
14762
+ ) : null,
14763
+ displayMode !== "pip" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14764
+ Button,
14765
+ {
14766
+ type: "button",
14767
+ variant: "ghost",
14768
+ size: "icon-xs",
14769
+ title: i18n2.t("message.mcpApp.pictureInPicture"),
14770
+ "aria-label": i18n2.t("message.mcpApp.pictureInPicture"),
14771
+ onClick: () => setDisplayMode("pip"),
14772
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.PictureInPicture2, {})
14773
+ }
14774
+ ) : null,
14775
+ elevatedDisplayMode ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14776
+ Button,
14777
+ {
14778
+ type: "button",
14779
+ variant: "ghost",
14780
+ size: "icon-xs",
14781
+ title: i18n2.t("message.mcpApp.returnInline"),
14782
+ "aria-label": i18n2.t("message.mcpApp.returnInline"),
14783
+ onClick: () => setDisplayMode("inline"),
14784
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Minimize2, {})
14785
+ }
14786
+ ) : null,
14787
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Badge, { variant: "secondary", className: "ml-1 rounded-md", children: "MCP App" })
14056
14788
  ] })
14057
14789
  ] }),
14058
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
14059
- ] }),
14060
- isLoading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
14061
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Loader2, { className: "h-4 w-4 animate-spin" }),
14062
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: i18n2.t("message.mcpApp.loading") })
14063
- ] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
14064
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.AlertCircle, { className: "h-4 w-4 shrink-0" }),
14065
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "min-w-0 break-words", children: error })
14066
- ] }) : srcDoc ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14067
- "iframe",
14068
- {
14069
- ref: iframeRef,
14070
- title: displayTitle,
14071
- srcDoc,
14072
- className: "block w-full bg-background",
14073
- style: { height },
14074
- sandbox,
14075
- allow: iframeAllow,
14076
- referrerPolicy: "no-referrer"
14077
- }
14078
- ) : null
14079
- ]
14080
- }
14081
- );
14790
+ pendingApproval ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14791
+ "div",
14792
+ {
14793
+ role: "alertdialog",
14794
+ "aria-modal": "true",
14795
+ "aria-labelledby": `mcp-app-approval-${pendingApproval.approvalId}`,
14796
+ className: "absolute inset-0 z-20 flex items-center justify-center bg-background/90 p-4 backdrop-blur-sm",
14797
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex max-h-full w-full max-w-lg flex-col gap-4 overflow-hidden rounded-lg border bg-background p-4 shadow-xl", children: [
14798
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-start gap-3", children: [
14799
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "rounded-full bg-destructive/10 p-2 text-destructive", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.ShieldAlert, { className: "size-5" }) }),
14800
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0 flex-1", children: [
14801
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
14802
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14803
+ "h3",
14804
+ {
14805
+ id: `mcp-app-approval-${pendingApproval.approvalId}`,
14806
+ className: "text-sm font-semibold",
14807
+ children: i18n2.t("message.mcpApp.approvalTitle")
14808
+ }
14809
+ ),
14810
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14811
+ Badge,
14812
+ {
14813
+ variant: "outline",
14814
+ className: "border-destructive/40 text-destructive",
14815
+ children: pendingApproval.risk
14816
+ }
14817
+ )
14818
+ ] }),
14819
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: i18n2.t(
14820
+ pendingApproval.kind === "download" ? "message.mcpApp.downloadApprovalDescription" : "message.mcpApp.toolApprovalDescription",
14821
+ { tool: pendingApproval.toolName }
14822
+ ) })
14823
+ ] })
14824
+ ] }),
14825
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-h-0", children: [
14826
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "mb-1 text-xs font-medium", children: i18n2.t("message.mcpApp.requestDetails") }),
14827
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("pre", { className: "max-h-48 overflow-auto rounded-md border bg-muted/40 p-3 text-[11px] leading-5 whitespace-pre-wrap break-all", children: pendingApproval.details })
14828
+ ] }),
14829
+ approvalError ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14830
+ "div",
14831
+ {
14832
+ role: "alert",
14833
+ className: "flex items-start gap-2 text-xs text-destructive",
14834
+ children: [
14835
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.AlertCircle, { className: "mt-0.5 size-4 shrink-0" }),
14836
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: approvalError })
14837
+ ]
14838
+ }
14839
+ ) : null,
14840
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex justify-end gap-2", children: [
14841
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14842
+ Button,
14843
+ {
14844
+ type: "button",
14845
+ variant: "outline",
14846
+ disabled: approvalAction !== null,
14847
+ onClick: () => void resolvePendingApproval("reject"),
14848
+ children: [
14849
+ approvalAction === "reject" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Loader2, { className: "animate-spin" }) : null,
14850
+ i18n2.t("message.mcpApp.reject")
14851
+ ]
14852
+ }
14853
+ ),
14854
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14855
+ Button,
14856
+ {
14857
+ type: "button",
14858
+ variant: pendingApproval.risk === "destructive" ? "destructive" : "default",
14859
+ disabled: approvalAction !== null,
14860
+ onClick: () => void resolvePendingApproval("approve"),
14861
+ children: [
14862
+ approvalAction === "approve" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Loader2, { className: "animate-spin" }) : null,
14863
+ i18n2.t("message.mcpApp.approve")
14864
+ ]
14865
+ }
14866
+ )
14867
+ ] })
14868
+ ] })
14869
+ }
14870
+ ) : null,
14871
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14872
+ "div",
14873
+ {
14874
+ className: cn(
14875
+ "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground",
14876
+ elevatedDisplayMode && "min-h-0 flex-1"
14877
+ ),
14878
+ children: [
14879
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Loader2, { className: "h-4 w-4 animate-spin" }),
14880
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: i18n2.t("message.mcpApp.loading") })
14881
+ ]
14882
+ }
14883
+ ) : error ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
14884
+ "div",
14885
+ {
14886
+ className: cn(
14887
+ "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive",
14888
+ elevatedDisplayMode && "min-h-0 flex-1"
14889
+ ),
14890
+ children: [
14891
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.AlertCircle, { className: "h-4 w-4 shrink-0" }),
14892
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "min-w-0 break-words", children: error })
14893
+ ]
14894
+ }
14895
+ ) : srcDoc ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
14896
+ "iframe",
14897
+ {
14898
+ ref: bindIframeRef,
14899
+ title: displayTitle,
14900
+ ...sandboxProxy ? { src: sandboxProxy.url } : { srcDoc },
14901
+ className: cn(
14902
+ "block w-full bg-background",
14903
+ elevatedDisplayMode && "min-h-0 flex-1"
14904
+ ),
14905
+ style: elevatedDisplayMode ? void 0 : { height },
14906
+ sandbox,
14907
+ allow: iframeAllow,
14908
+ referrerPolicy: "no-referrer"
14909
+ }
14910
+ ) : null
14911
+ ]
14912
+ }
14913
+ )
14914
+ ] });
14082
14915
  }
14083
14916
 
14084
14917
  // src/components/thread/messages/ai.tsx
@@ -14366,7 +15199,14 @@ function renderContentItem(content, index, message, lookupMessages, options) {
14366
15199
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
14367
15200
  }
14368
15201
  if (isMcpAppComponent(content)) {
14369
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(McpAppMessage, { messageId, data: content.data }) }, content.id ?? `mcp-app-${index}`);
15202
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
15203
+ McpAppMessage,
15204
+ {
15205
+ messageId,
15206
+ data: content.data,
15207
+ mcpApps: options?.mcpApps
15208
+ }
15209
+ ) }, content.id ?? `mcp-app-${index}`);
14370
15210
  }
14371
15211
  if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
14372
15212
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
@@ -14396,7 +15236,8 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
14396
15236
  isThreadRunning: options?.isThreadRunning,
14397
15237
  organizationId: options?.organizationId,
14398
15238
  apiUrl: options?.apiUrl,
14399
- isAgentOutput: options?.isAgentOutput
15239
+ isAgentOutput: options?.isAgentOutput,
15240
+ mcpApps: options?.mcpApps
14400
15241
  });
14401
15242
  }
14402
15243
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
@@ -14547,7 +15388,8 @@ function AssistantMessage({
14547
15388
  isThreadRunning,
14548
15389
  organizationId,
14549
15390
  apiUrl,
14550
- pet
15391
+ pet,
15392
+ mcpApps
14551
15393
  }) {
14552
15394
  const { t } = useChatkitTranslation();
14553
15395
  const renderTree = buildAssistantRenderTree(
@@ -14563,7 +15405,8 @@ function AssistantMessage({
14563
15405
  const answerNode = renderContent(message, lookupMessages, {
14564
15406
  isThreadRunning,
14565
15407
  organizationId,
14566
- apiUrl
15408
+ apiUrl,
15409
+ mcpApps
14567
15410
  });
14568
15411
  const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
14569
15412
  if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
@@ -14975,6 +15818,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
14975
15818
  client,
14976
15819
  threadId,
14977
15820
  assistantId,
15821
+ projectId,
14978
15822
  isReady,
14979
15823
  isLoading: isStreamLoading,
14980
15824
  error: streamError
@@ -14993,7 +15837,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
14993
15837
  setError(null);
14994
15838
  try {
14995
15839
  const { items } = await client.conversations.search({
14996
- where: { xpertId: assistantId },
15840
+ where: { xpertId: assistantId, ...projectId ? { projectId } : {} },
14997
15841
  limit,
14998
15842
  order: { updatedAt: "DESC" }
14999
15843
  });
@@ -15003,11 +15847,14 @@ function useThreads(limit = DEFAULT_LIMIT) {
15003
15847
  } finally {
15004
15848
  setIsLoading(false);
15005
15849
  }
15006
- }, [client, limit, assistantId]);
15850
+ }, [client, limit, assistantId, projectId]);
15007
15851
  const createThread = React42.useCallback(
15008
15852
  async (input) => {
15009
15853
  setError(null);
15010
- const payload = {};
15854
+ const payload = {
15855
+ xpertId: assistantId,
15856
+ ...projectId ? { projectId } : {}
15857
+ };
15011
15858
  if (input?.recordId) payload.id = input.recordId;
15012
15859
  if (input?.threadId) payload.threadId = input.threadId;
15013
15860
  if (input?.title) payload.title = input.title;
@@ -15016,7 +15863,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
15016
15863
  upsertThreadRecord(created);
15017
15864
  return created;
15018
15865
  },
15019
- [client, upsertThreadRecord]
15866
+ [assistantId, client, projectId, upsertThreadRecord]
15020
15867
  );
15021
15868
  const updateThread = React42.useCallback(
15022
15869
  async (recordId, payload) => {
@@ -20476,7 +21323,8 @@ function Chat({
20476
21323
  isThreadRunning: currentThreadIsRunning,
20477
21324
  organizationId: stream.organizationId,
20478
21325
  apiUrl: stream.apiUrl,
20479
- pet: effectivePet
21326
+ pet: effectivePet,
21327
+ mcpApps: options?.mcpApps
20480
21328
  }
20481
21329
  ) : /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
20482
21330
  message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(