@xpert-ai/chatkit-ui 0.3.4 → 0.3.6

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 (336) hide show
  1. package/dist/app/assets/{_baseUniq-DOSftAYs.js → _baseUniq-PQJUyd2p.js} +1 -1
  2. package/dist/app/assets/{abap-D8t_liei.js → abap-DBNQvwwq.js} +1 -1
  3. package/dist/app/assets/{abnf-jhem6Fdp.js → abnf-DAYjyqbD.js} +1 -1
  4. package/dist/app/assets/{actionscript-AgAqywOC.js → actionscript-CC6WSmTp.js} +1 -1
  5. package/dist/app/assets/{ada-BR3Q6K2R.js → ada-BKGodcKv.js} +1 -1
  6. package/dist/app/assets/{agda-s2LPXGxr.js → agda-Btmo1dV2.js} +1 -1
  7. package/dist/app/assets/{al-DbvPGDsA.js → al-ZGIJe93k.js} +1 -1
  8. package/dist/app/assets/{antlr4-Dde8A9o-.js → antlr4-5WGUtMyl.js} +1 -1
  9. package/dist/app/assets/{apacheconf-XU1nZV0U.js → apacheconf-DUR_1QqW.js} +1 -1
  10. package/dist/app/assets/{apex-dwhJyh_8.js → apex-BintsQD-.js} +1 -1
  11. package/dist/app/assets/{apl-6TVT9aj4.js → apl-B7pUHOBS.js} +1 -1
  12. package/dist/app/assets/{applescript-CK6TQ3Fp.js → applescript-CanCSogn.js} +1 -1
  13. package/dist/app/assets/{aql-CAitgyBw.js → aql-iDHrUFca.js} +1 -1
  14. package/dist/app/assets/{arc-y7BBKPBC.js → arc-VbTm84dM.js} +1 -1
  15. package/dist/app/assets/{architectureDiagram-Q4EWVU46-CKPXDiCw.js → architectureDiagram-Q4EWVU46-BwbXOlsJ.js} +1 -1
  16. package/dist/app/assets/{arduino-BX92l-fC.js → arduino-CvuY6cDV.js} +1 -1
  17. package/dist/app/assets/{arff-TZ2mzCjA.js → arff-C7UK1Sqo.js} +1 -1
  18. package/dist/app/assets/{asciidoc-CbdSoDU0.js → asciidoc-jaQgm_Ci.js} +1 -1
  19. package/dist/app/assets/{asm6502-DB6lK7kM.js → asm6502-Bec9iTSO.js} +1 -1
  20. package/dist/app/assets/{asmatmel-DUbAVWcI.js → asmatmel-CWWLYM-f.js} +1 -1
  21. package/dist/app/assets/{aspnet-BJclsNGz.js → aspnet-EICvaNos.js} +1 -1
  22. package/dist/app/assets/{autohotkey-BAHo4mzJ.js → autohotkey-CgvCc8dt.js} +1 -1
  23. package/dist/app/assets/{autoit-CpXn4Gjh.js → autoit-BbrdfXjj.js} +1 -1
  24. package/dist/app/assets/{avisynth-CB7WaK_0.js → avisynth-C7cOgG-q.js} +1 -1
  25. package/dist/app/assets/{avro-idl-C-DAHRE1.js → avro-idl-BsT9yVqS.js} +1 -1
  26. package/dist/app/assets/{bash-De_5PB_T.js → bash-BF1ylQ6_.js} +1 -1
  27. package/dist/app/assets/{basic-TAOzT46e.js → basic-DyO_cuAQ.js} +1 -1
  28. package/dist/app/assets/{batch-yBjeCG2_.js → batch-DdxmhDRT.js} +1 -1
  29. package/dist/app/assets/{bbcode-zhuhkwPV.js → bbcode-Csh0dpf7.js} +1 -1
  30. package/dist/app/assets/{bicep-3sditE87.js → bicep-CEnRCsw4.js} +1 -1
  31. package/dist/app/assets/{birb-B91lhwFM.js → birb-H4aZEyfE.js} +1 -1
  32. package/dist/app/assets/{bison-Zl9yhw_8.js → bison-B4NzJQL4.js} +1 -1
  33. package/dist/app/assets/{blockDiagram-DXYQGD6D-CbzYvF40.js → blockDiagram-DXYQGD6D-BQrs2vZp.js} +1 -1
  34. package/dist/app/assets/{bnf-BTyJWL2-.js → bnf-BpnLOKBL.js} +1 -1
  35. package/dist/app/assets/{brainfuck-D-gtcLd6.js → brainfuck-BcXFtTZS.js} +1 -1
  36. package/dist/app/assets/{brightscript-CtoapRkx.js → brightscript-C-G4maiE.js} +1 -1
  37. package/dist/app/assets/{bro-MqwpLO_C.js → bro-JcLlkXX7.js} +1 -1
  38. package/dist/app/assets/{bsl-B51ARJIQ.js → bsl-C7EgrPBt.js} +1 -1
  39. package/dist/app/assets/{c-Dd7OPCIn.js → c-0vDIBgc3.js} +1 -1
  40. package/dist/app/assets/{c4Diagram-AHTNJAMY-Cl2FGnEB.js → c4Diagram-AHTNJAMY-wtHHI5rn.js} +1 -1
  41. package/dist/app/assets/{cfscript-BEyB5tLd.js → cfscript-B5a7v4dm.js} +1 -1
  42. package/dist/app/assets/{chaiscript-BEE5daDb.js → chaiscript-CC6j4sQE.js} +1 -1
  43. package/dist/app/assets/channel-B6zrZ2OM.js +1 -0
  44. package/dist/app/assets/{chunk-4BX2VUAB-CdWO6X3v.js → chunk-4BX2VUAB-Dlz831RQ.js} +1 -1
  45. package/dist/app/assets/{chunk-4TB4RGXK-B99XSc_o.js → chunk-4TB4RGXK-D5P5dUqt.js} +1 -1
  46. package/dist/app/assets/{chunk-55IACEB6-Bf8lWYm0.js → chunk-55IACEB6-BqMvjwUA.js} +1 -1
  47. package/dist/app/assets/{chunk-EDXVE4YY-D0jGhBDV.js → chunk-EDXVE4YY-DnPhlqJA.js} +1 -1
  48. package/dist/app/assets/{chunk-FMBD7UC4-CPVhZRqV.js → chunk-FMBD7UC4-DNRIZD8O.js} +1 -1
  49. package/dist/app/assets/{chunk-OYMX7WX6-B3B3qd2F.js → chunk-OYMX7WX6-JXHjhCxm.js} +1 -1
  50. package/dist/app/assets/{chunk-QZHKN3VN-C9zZSGTB.js → chunk-QZHKN3VN-BkxXCZY4.js} +1 -1
  51. package/dist/app/assets/{chunk-YZCP3GAM-BX0g-UOY.js → chunk-YZCP3GAM-EpFGzvxp.js} +1 -1
  52. package/dist/app/assets/{cil-DfLzhPVn.js → cil-iQdhNO4Q.js} +1 -1
  53. package/dist/app/assets/classDiagram-6PBFFD2Q-CrRCjWNC.js +1 -0
  54. package/dist/app/assets/classDiagram-v2-HSJHXN6E-CrRCjWNC.js +1 -0
  55. package/dist/app/assets/{clike-Dd07rx25.js → clike-CQAeHYPM.js} +1 -1
  56. package/dist/app/assets/{clojure-Du6gb2Do.js → clojure-Cql6MpyZ.js} +1 -1
  57. package/dist/app/assets/clone-DF9MaeHz.js +1 -0
  58. package/dist/app/assets/{cmake-DpKAfrpv.js → cmake-BfKHjCsg.js} +1 -1
  59. package/dist/app/assets/{cobol-CMhyCAN0.js → cobol-CKkM0fVl.js} +1 -1
  60. package/dist/app/assets/{coffeescript-C_hK5LrH.js → coffeescript-CgyUEXhV.js} +1 -1
  61. package/dist/app/assets/{concurnas-BzzuO0wJ.js → concurnas-CeEqG40V.js} +1 -1
  62. package/dist/app/assets/{coq-D28Kf8H7.js → coq-CkWZFRlP.js} +1 -1
  63. package/dist/app/assets/{core-CkMLmhj1.js → core-CcAPm-aU.js} +1 -1
  64. package/dist/app/assets/{cose-bilkent-S5V4N54A-Bnbhbxn8.js → cose-bilkent-S5V4N54A-kULVHEg6.js} +1 -1
  65. package/dist/app/assets/{cpp-DMtEaL9D.js → cpp-Bwq_b1tA.js} +1 -1
  66. package/dist/app/assets/{crystal-BPv3cq00.js → crystal-YNIUD3Bs.js} +1 -1
  67. package/dist/app/assets/{csharp-CogydNTP.js → csharp-P6DguRUY.js} +1 -1
  68. package/dist/app/assets/{cshtml-DwKZdXN4.js → cshtml-B5QmdkLH.js} +1 -1
  69. package/dist/app/assets/{csp-EdkmOQr2.js → csp-DFeKy3lq.js} +1 -1
  70. package/dist/app/assets/{css-GGj7gjJp.js → css-CRC3M3rp.js} +1 -1
  71. package/dist/app/assets/{css-extras-_xrLQVK9.js → css-extras-BFuChsao.js} +1 -1
  72. package/dist/app/assets/{csv-DQnF4IQS.js → csv-C4LMPB8f.js} +1 -1
  73. package/dist/app/assets/{cypher-mlTzP2DC.js → cypher-HIcVk2j0.js} +1 -1
  74. package/dist/app/assets/{d-CA6ua4gG.js → d-BnjQOzu7.js} +1 -1
  75. package/dist/app/assets/{dagre-KV5264BT-2pUvoHnZ.js → dagre-KV5264BT-DYeQuZ_S.js} +1 -1
  76. package/dist/app/assets/{dart-BSRdjoJD.js → dart-BY_HEqIc.js} +1 -1
  77. package/dist/app/assets/{dataweave-CTK9G89H.js → dataweave-IZkekg5J.js} +1 -1
  78. package/dist/app/assets/{dax-CLAaspXf.js → dax-BDxI87qH.js} +1 -1
  79. package/dist/app/assets/{dhall-DvmFF2lw.js → dhall-BI7me9By.js} +1 -1
  80. package/dist/app/assets/{diagram-5BDNPKRD--2m-CBif.js → diagram-5BDNPKRD-DqUtPt3D.js} +1 -1
  81. package/dist/app/assets/{diagram-G4DWMVQ6-xfTAcTBK.js → diagram-G4DWMVQ6-DUz5iheG.js} +1 -1
  82. package/dist/app/assets/{diagram-MMDJMWI5-DJ9-7Sko.js → diagram-MMDJMWI5-DqMZVdpe.js} +1 -1
  83. package/dist/app/assets/{diagram-TYMM5635-Dbu04dwS.js → diagram-TYMM5635-D4dMAYPV.js} +1 -1
  84. package/dist/app/assets/{diff-DexI-NjF.js → diff-D1eveguk.js} +1 -1
  85. package/dist/app/assets/{django-BJtz28yd.js → django-n2RdeMZg.js} +1 -1
  86. package/dist/app/assets/{dns-zone-file-C-rZlLjq.js → dns-zone-file-C7ZVuM_8.js} +1 -1
  87. package/dist/app/assets/{docker-D3zkJQBB.js → docker-2dKv2uP8.js} +1 -1
  88. package/dist/app/assets/{dot-CYyhO0AU.js → dot-CnM9kCZh.js} +1 -1
  89. package/dist/app/assets/{ebnf-DRQkwE29.js → ebnf-DNNgDJ77.js} +1 -1
  90. package/dist/app/assets/{editorconfig-BqLWNpRj.js → editorconfig-BOtWIdJu.js} +1 -1
  91. package/dist/app/assets/{eiffel-C9PIq1yy.js → eiffel-DZJsL-6U.js} +1 -1
  92. package/dist/app/assets/{ejs-B6_5mrfN.js → ejs-DlY_5WK7.js} +1 -1
  93. package/dist/app/assets/{elixir-jtsDOmKm.js → elixir-DnflWYYw.js} +1 -1
  94. package/dist/app/assets/{elm-DRbXA7ir.js → elm-DiBtRJyK.js} +1 -1
  95. package/dist/app/assets/{erDiagram-SMLLAGMA-CrI2ZkzN.js → erDiagram-SMLLAGMA-s249XOhW.js} +1 -1
  96. package/dist/app/assets/{erb-G2oGuDtf.js → erb-Ctwnlnto.js} +1 -1
  97. package/dist/app/assets/{erlang-CT-pjUEp.js → erlang-BnrgWRyV.js} +1 -1
  98. package/dist/app/assets/{etlua-qmLyJp4f.js → etlua-B-b2a1aT.js} +1 -1
  99. package/dist/app/assets/{excel-formula-3pfMQM_6.js → excel-formula-BfwuYhTY.js} +1 -1
  100. package/dist/app/assets/{factor-Bo9zUudA.js → factor-2cFlXUFG.js} +1 -1
  101. package/dist/app/assets/{false-oN6u3jCd.js → false-DVJW4Xbm.js} +1 -1
  102. package/dist/app/assets/{firestore-security-rules-CtzUeAWq.js → firestore-security-rules-BDB3ruEY.js} +1 -1
  103. package/dist/app/assets/{flow-nzq0GfkM.js → flow-v_X8TsCx.js} +1 -1
  104. package/dist/app/assets/{flowDiagram-DWJPFMVM-CGpnDmCG.js → flowDiagram-DWJPFMVM-Dz8lk_A8.js} +1 -1
  105. package/dist/app/assets/{fortran-DVeArHMZ.js → fortran-VlXf9wYr.js} +1 -1
  106. package/dist/app/assets/{fsharp--fFnup68.js → fsharp-BgmRbToz.js} +1 -1
  107. package/dist/app/assets/{ftl-BMxP4X-x.js → ftl-CX7l6a-K.js} +1 -1
  108. package/dist/app/assets/{ganttDiagram-T4ZO3ILL-CCTn88VZ.js → ganttDiagram-T4ZO3ILL-C8JxZNAd.js} +1 -1
  109. package/dist/app/assets/{gap-B7zirCOJ.js → gap-C3towync.js} +1 -1
  110. package/dist/app/assets/{gcode-CQFJN_Te.js → gcode-pPl8BHC6.js} +1 -1
  111. package/dist/app/assets/{gdscript-BTRKMIlE.js → gdscript-CQ5KQpTU.js} +1 -1
  112. package/dist/app/assets/{gedcom-4Y3UUWcB.js → gedcom-UKqoiZ_B.js} +1 -1
  113. package/dist/app/assets/{gherkin-DK5Y4NpK.js → gherkin-oHLPyBSJ.js} +1 -1
  114. package/dist/app/assets/{git-DD3NDd7U.js → git-QJvYrr1x.js} +1 -1
  115. package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-nEeDINSI.js → gitGraphDiagram-UUTBAWPF-D8hAIW7o.js} +1 -1
  116. package/dist/app/assets/{glsl-BCT9m8QS.js → glsl-D9mjvqGV.js} +1 -1
  117. package/dist/app/assets/{gml-CCB73B6Z.js → gml-DyeDbLje.js} +1 -1
  118. package/dist/app/assets/{gn-BIFCrkIE.js → gn-CQxx-3wR.js} +1 -1
  119. package/dist/app/assets/{go-dyQD8YyU.js → go-BlxfTxGG.js} +1 -1
  120. package/dist/app/assets/{go-module-BXpIFu8x.js → go-module-aUBiuILx.js} +1 -1
  121. package/dist/app/assets/{graph-wLpqxdfC.js → graph-D-X2uhF1.js} +1 -1
  122. package/dist/app/assets/{graphql-D-ZoQblr.js → graphql-Clt8HaZ7.js} +1 -1
  123. package/dist/app/assets/{groovy-CHjkA2bW.js → groovy-CZSeQO36.js} +1 -1
  124. package/dist/app/assets/{haml-ghcX4l2W.js → haml-DMf7PiKp.js} +1 -1
  125. package/dist/app/assets/{handlebars-x0LtkeUm.js → handlebars-BphhMxT6.js} +1 -1
  126. package/dist/app/assets/{haskell-B-bDSuV-.js → haskell-Ccj1mGN_.js} +1 -1
  127. package/dist/app/assets/{haxe-Vm5mZw57.js → haxe-CtvRdMmt.js} +1 -1
  128. package/dist/app/assets/{hcl-CGN3jDav.js → hcl-HQGsM91R.js} +1 -1
  129. package/dist/app/assets/{hlsl-DMKySN6W.js → hlsl-U_2FN4GV.js} +1 -1
  130. package/dist/app/assets/{hoon-3jplpPAg.js → hoon-DSS3mQR5.js} +1 -1
  131. package/dist/app/assets/{hpkp-DMJ5jXpf.js → hpkp-BPnzFZ5n.js} +1 -1
  132. package/dist/app/assets/{hsts-CKBkWb38.js → hsts-BRaWTgmx.js} +1 -1
  133. package/dist/app/assets/{http-97sq51fE.js → http-DgZif8XP.js} +1 -1
  134. package/dist/app/assets/{ichigojam-CZ6nOPE1.js → ichigojam-ypramSfH.js} +1 -1
  135. package/dist/app/assets/{icon-CDqvp1g4.js → icon-DsD0Czia.js} +1 -1
  136. package/dist/app/assets/{icu-message-format-BjYuZ-Om.js → icu-message-format-BVJiYPkB.js} +1 -1
  137. package/dist/app/assets/{idris-pEOqm1H_.js → idris-BvurrLkY.js} +1 -1
  138. package/dist/app/assets/{iecst-CRrTHf_1.js → iecst-Clwdf_8K.js} +1 -1
  139. package/dist/app/assets/{ignore-CxkUxQmB.js → ignore-DkK-S7HP.js} +1 -1
  140. package/dist/app/assets/{index-n0Xlprbh.js → index-D-y0b7ri.js} +179 -179
  141. package/dist/app/assets/index-D4gddvdJ.css +1 -0
  142. package/dist/app/assets/{infoDiagram-42DDH7IO-C8jVtFvE.js → infoDiagram-42DDH7IO-BocjJZwC.js} +1 -1
  143. package/dist/app/assets/{inform7-CJDC1PVH.js → inform7-yFSTqWIe.js} +1 -1
  144. package/dist/app/assets/{ini-BP8l3Q_m.js → ini-BcO8nYi7.js} +1 -1
  145. package/dist/app/assets/{io-L3Lj4xsH.js → io-BBkn-xXo.js} +1 -1
  146. package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-BCChdzZf.js → ishikawaDiagram-UXIWVN3A-Dlw93ArC.js} +1 -1
  147. package/dist/app/assets/{j-BkUK2Ldb.js → j-M5UTfImQ.js} +1 -1
  148. package/dist/app/assets/{java-lKbQcHmi.js → java-Xjo5k22g.js} +1 -1
  149. package/dist/app/assets/{javadoc-CkX_P5bm.js → javadoc-D6lpCK4S.js} +1 -1
  150. package/dist/app/assets/{javadoclike-DKo0tRDk.js → javadoclike-DGBCsKaU.js} +1 -1
  151. package/dist/app/assets/{javascript-JBI-h3GD.js → javascript-DkE8xAaV.js} +1 -1
  152. package/dist/app/assets/{javastacktrace-DuXSjAnS.js → javastacktrace-Be5zC165.js} +1 -1
  153. package/dist/app/assets/{jexl-txJd9uA8.js → jexl-C1l-HPYI.js} +1 -1
  154. package/dist/app/assets/{jolie-BHXVY7fU.js → jolie-CRI76P3X.js} +1 -1
  155. package/dist/app/assets/{journeyDiagram-VCZTEJTY-DgqozfYW.js → journeyDiagram-VCZTEJTY-BOongVs3.js} +1 -1
  156. package/dist/app/assets/{jq-Csyhu6Mu.js → jq-CrFpn7ql.js} +1 -1
  157. package/dist/app/assets/{js-extras-hN_zFrKs.js → js-extras-BvLZUIJ5.js} +1 -1
  158. package/dist/app/assets/{js-templates-CKV7gOwt.js → js-templates-fYKII4Os.js} +1 -1
  159. package/dist/app/assets/{jsdoc-DvQtkqGY.js → jsdoc-DGONDzA5.js} +1 -1
  160. package/dist/app/assets/{json-BWJc5nIm.js → json-BxIxewuG.js} +1 -1
  161. package/dist/app/assets/{json5-SIZfmxdY.js → json5-BP9OBqRe.js} +1 -1
  162. package/dist/app/assets/{jsonp-BCZTSaV5.js → jsonp-Br67zaRL.js} +1 -1
  163. package/dist/app/assets/{jsstacktrace-gzJEwbAz.js → jsstacktrace-BB-1Bcpa.js} +1 -1
  164. package/dist/app/assets/{jsx-CjDjGsx0.js → jsx-BNfIlN8n.js} +1 -1
  165. package/dist/app/assets/{julia-D7oaevR9.js → julia-DVIi4XSJ.js} +1 -1
  166. package/dist/app/assets/{kanban-definition-6JOO6SKY-IxcIrcgX.js → kanban-definition-6JOO6SKY-DD7E-Llo.js} +1 -1
  167. package/dist/app/assets/{keepalived-Cd4E72kG.js → keepalived-DmPJ3LF8.js} +1 -1
  168. package/dist/app/assets/{keyman-CnnhX5FN.js → keyman-Cp-gCfcq.js} +1 -1
  169. package/dist/app/assets/{kotlin-Bb9joIt9.js → kotlin-DCptm4kq.js} +1 -1
  170. package/dist/app/assets/{kumir-2AUUqPdZ.js → kumir-Cohjvjog.js} +1 -1
  171. package/dist/app/assets/{kusto-BYT2Y4Ec.js → kusto-C2dOIgK1.js} +1 -1
  172. package/dist/app/assets/{latex-C7vJjHLG.js → latex-DaFCffTw.js} +1 -1
  173. package/dist/app/assets/{latte-B40IhbBN.js → latte-D2mtlTen.js} +1 -1
  174. package/dist/app/assets/{layout-JYzSZ2a2.js → layout-C7fpWjpB.js} +1 -1
  175. package/dist/app/assets/{less-CfVevww_.js → less-CycfawGH.js} +1 -1
  176. package/dist/app/assets/{lilypond-Car5OZdt.js → lilypond-DrvS8AAl.js} +1 -1
  177. package/dist/app/assets/{linear-C52-vlD3.js → linear-2np4qyjJ.js} +1 -1
  178. package/dist/app/assets/{liquid-B5H1JE3W.js → liquid-BQH0bAHC.js} +1 -1
  179. package/dist/app/assets/{lisp-CzR77rD6.js → lisp-BCWvn2A1.js} +1 -1
  180. package/dist/app/assets/{livescript-DaurQsHd.js → livescript-DGRf3L1-.js} +1 -1
  181. package/dist/app/assets/{llvm-HQsMJlhb.js → llvm-C_6xvGBO.js} +1 -1
  182. package/dist/app/assets/{log-p-v4zt5b.js → log-uCcZN8k2.js} +1 -1
  183. package/dist/app/assets/{lolcode-BUEwX00W.js → lolcode-XEyTNgnB.js} +1 -1
  184. package/dist/app/assets/{lua-BMmOVEjM.js → lua-Dy0fpGeF.js} +1 -1
  185. package/dist/app/assets/{magma-B8nyW6y4.js → magma-D6d2r_W9.js} +1 -1
  186. package/dist/app/assets/{makefile-DcXOWSLr.js → makefile-DOydYPAQ.js} +1 -1
  187. package/dist/app/assets/{markdown-DLWYEU3e.js → markdown-CPxRHFza.js} +1 -1
  188. package/dist/app/assets/{markup-jsuSUme0.js → markup-jgYp2Lb8.js} +1 -1
  189. package/dist/app/assets/{markup-templating-Dm7qXJKw.js → markup-templating-lT8EutTe.js} +1 -1
  190. package/dist/app/assets/{matlab-C0-FOdqd.js → matlab-y_OOgSc_.js} +1 -1
  191. package/dist/app/assets/{maxscript-Cfo0XQkR.js → maxscript-PMli6_xE.js} +1 -1
  192. package/dist/app/assets/{mel-DOCIJjQg.js → mel-CIopQCOU.js} +1 -1
  193. package/dist/app/assets/{mermaid-BflTtQG8.js → mermaid-CN6aoo9D.js} +1 -1
  194. package/dist/app/assets/{min-C1ji-XBz.js → min-DDl12nhy.js} +1 -1
  195. package/dist/app/assets/{mindmap-definition-QFDTVHPH-B5ikGBES.js → mindmap-definition-QFDTVHPH-Bosd0mf9.js} +1 -1
  196. package/dist/app/assets/{mizar-Bts2s8Hn.js → mizar-A9B8KORd.js} +1 -1
  197. package/dist/app/assets/{mongodb-DQXudfKX.js → mongodb-DV-yCsoK.js} +1 -1
  198. package/dist/app/assets/{monkey-DrRHqOn1.js → monkey-HEFodtZa.js} +1 -1
  199. package/dist/app/assets/{moonscript-C7Xd-yhU.js → moonscript-Bj3xAxEV.js} +1 -1
  200. package/dist/app/assets/{n1ql-B_wltsIt.js → n1ql-DX2KWloB.js} +1 -1
  201. package/dist/app/assets/{n4js-BzoEPRsS.js → n4js-DQoNqDS9.js} +1 -1
  202. package/dist/app/assets/{nand2tetris-hdl-DC6szN4I.js → nand2tetris-hdl-BFqj7ePK.js} +1 -1
  203. package/dist/app/assets/{naniscript-Dtp-YV0U.js → naniscript-Cz--o1by.js} +1 -1
  204. package/dist/app/assets/{nasm-0VzUWfWE.js → nasm-Dcb8t8q6.js} +1 -1
  205. package/dist/app/assets/{neon-7L9mJ622.js → neon-CK7vx6_x.js} +1 -1
  206. package/dist/app/assets/{nevod-_UYv_FLm.js → nevod-BePMNPK5.js} +1 -1
  207. package/dist/app/assets/{nginx-DjVc7ZO-.js → nginx-BmbGx2v1.js} +1 -1
  208. package/dist/app/assets/{nim-DLWLAJSB.js → nim-B8GUCE2H.js} +1 -1
  209. package/dist/app/assets/{nix-Biu8zxbr.js → nix-lGZ9zLZy.js} +1 -1
  210. package/dist/app/assets/{nsis-dCQyknmT.js → nsis-kBAOh3Cs.js} +1 -1
  211. package/dist/app/assets/{objectivec-CSM9DCwb.js → objectivec-Bngj8IHt.js} +1 -1
  212. package/dist/app/assets/{ocaml-CH0AuJ_r.js → ocaml-Bba8eOIn.js} +1 -1
  213. package/dist/app/assets/{opencl-JabGmje3.js → opencl-DgfdBrQ_.js} +1 -1
  214. package/dist/app/assets/{openqasm-BGt4V7bR.js → openqasm-CQV2wxlC.js} +1 -1
  215. package/dist/app/assets/{oz-DbIu1th5.js → oz-CcMDAMF8.js} +1 -1
  216. package/dist/app/assets/{parigp-xeAu0pqa.js → parigp-Cr7bHjhJ.js} +1 -1
  217. package/dist/app/assets/{parser-BWTLDUYa.js → parser-DX-CvQ44.js} +1 -1
  218. package/dist/app/assets/{pascal-D17KeDTg.js → pascal-CCpiRTqn.js} +1 -1
  219. package/dist/app/assets/{pascaligo-D2OO9Rgu.js → pascaligo-uYvOwN6J.js} +1 -1
  220. package/dist/app/assets/{pcaxis-BcB430lz.js → pcaxis-dCoAlH4q.js} +1 -1
  221. package/dist/app/assets/{peoplecode-Y2S6Vb55.js → peoplecode-BZU0iRIF.js} +1 -1
  222. package/dist/app/assets/{perl-DS-n0m7F.js → perl-Iesy2DKz.js} +1 -1
  223. package/dist/app/assets/{php--G5fMCND.js → php-a3Z68PaM.js} +1 -1
  224. package/dist/app/assets/{php-extras-CaqAl_Dh.js → php-extras-CSgWIoUx.js} +1 -1
  225. package/dist/app/assets/{phpdoc-DLIcyuW1.js → phpdoc-ClEamK9m.js} +1 -1
  226. package/dist/app/assets/{pieDiagram-DEJITSTG-BhkQtnMG.js → pieDiagram-DEJITSTG-D3AaN8D3.js} +1 -1
  227. package/dist/app/assets/{plsql-Fq8oOWwI.js → plsql-BUydR2je.js} +1 -1
  228. package/dist/app/assets/{powerquery-CeNFj3PH.js → powerquery-CbE5r1LK.js} +1 -1
  229. package/dist/app/assets/{powershell-DX9U9N7r.js → powershell-DubIcaqQ.js} +1 -1
  230. package/dist/app/assets/{processing-DkdV2LdA.js → processing-CGZk9MFa.js} +1 -1
  231. package/dist/app/assets/{prolog-BQyE7F2m.js → prolog-DWiKE05T.js} +1 -1
  232. package/dist/app/assets/{promql-CO35w8Xd.js → promql-ZM0X0cVe.js} +1 -1
  233. package/dist/app/assets/{properties-CD226fdu.js → properties-C_MgCVL7.js} +1 -1
  234. package/dist/app/assets/{protobuf-D44q9Zcx.js → protobuf-DTptx08I.js} +1 -1
  235. package/dist/app/assets/{psl-BKaJpoBk.js → psl-AUkZATpo.js} +1 -1
  236. package/dist/app/assets/{pug-DXId-Es4.js → pug-CiJR0sLM.js} +1 -1
  237. package/dist/app/assets/{puppet-B6U3R2i1.js → puppet-DRojzo7w.js} +1 -1
  238. package/dist/app/assets/{pure-C6n52fSg.js → pure-DAC784GG.js} +1 -1
  239. package/dist/app/assets/{purebasic-BSRzkysO.js → purebasic-VM4UEIrk.js} +1 -1
  240. package/dist/app/assets/{purescript-ac4_QHhP.js → purescript-w5sMhquf.js} +1 -1
  241. package/dist/app/assets/{q-n7P06m3R.js → q-CBWya0ez.js} +1 -1
  242. package/dist/app/assets/{qml-Bsb9t-6f.js → qml-BO1SKCTG.js} +1 -1
  243. package/dist/app/assets/{qore-BY0sM7Wa.js → qore-BLEy3V2Q.js} +1 -1
  244. package/dist/app/assets/{qsharp-DwMCUEEj.js → qsharp-DpGm5nXm.js} +1 -1
  245. package/dist/app/assets/{quadrantDiagram-34T5L4WZ-BciQCjKx.js → quadrantDiagram-34T5L4WZ-zqVJRfM0.js} +1 -1
  246. package/dist/app/assets/{r-wuXzKN8w.js → r-DJwW4woE.js} +1 -1
  247. package/dist/app/assets/{racket-EWJYOBhv.js → racket-tfAlhm9J.js} +1 -1
  248. package/dist/app/assets/{reason-b1aTIbDw.js → reason-CuQcs6Us.js} +1 -1
  249. package/dist/app/assets/{regex-BT-NVms-.js → regex-BjBaDCpX.js} +1 -1
  250. package/dist/app/assets/{rego-BkXfmH_T.js → rego-DWENKceX.js} +1 -1
  251. package/dist/app/assets/{renpy-CWSfrITs.js → renpy-BgVqATTk.js} +1 -1
  252. package/dist/app/assets/{requirementDiagram-MS252O5E-Bw_GMi8G.js → requirementDiagram-MS252O5E-B8E8SJly.js} +1 -1
  253. package/dist/app/assets/{rest-CSIS2oaI.js → rest-B9oIUmDJ.js} +1 -1
  254. package/dist/app/assets/{rip-DA5e5rbA.js → rip-kd5zQPVz.js} +1 -1
  255. package/dist/app/assets/{roboconf-CGLShPJZ.js → roboconf-B1kUkQdY.js} +1 -1
  256. package/dist/app/assets/{robotframework-AuJ8NHH8.js → robotframework-B8Cn6zw0.js} +1 -1
  257. package/dist/app/assets/{ruby-Dmo3oqYL.js → ruby-CnbgIhf_.js} +1 -1
  258. package/dist/app/assets/{rust-Yh4xDsPl.js → rust-C8OTkz5t.js} +1 -1
  259. package/dist/app/assets/{sankeyDiagram-XADWPNL6-CwpL5Ag9.js → sankeyDiagram-XADWPNL6-BWdy5fPK.js} +1 -1
  260. package/dist/app/assets/{sas-BajPfouh.js → sas-Dw7vQpkk.js} +1 -1
  261. package/dist/app/assets/{sass-BZ3IyTf0.js → sass-b7SoCESY.js} +1 -1
  262. package/dist/app/assets/{scala-BJGdd8vd.js → scala-D-p3rZbv.js} +1 -1
  263. package/dist/app/assets/{scheme-tmXEra4U.js → scheme-BPbr0IV_.js} +1 -1
  264. package/dist/app/assets/{scss-Dz5CBs5F.js → scss-Cyjt-V6Q.js} +1 -1
  265. package/dist/app/assets/{sequenceDiagram-FGHM5R23-Zb9ONvzy.js → sequenceDiagram-FGHM5R23-D-ACA62M.js} +1 -1
  266. package/dist/app/assets/{shell-session-U_ooQzX-.js → shell-session-C7s1XZ_p.js} +1 -1
  267. package/dist/app/assets/{smali-DMhdPO_F.js → smali-C621-SJz.js} +1 -1
  268. package/dist/app/assets/{smalltalk-CtwqxdOy.js → smalltalk-CuF0kpcz.js} +1 -1
  269. package/dist/app/assets/{smarty-B-_Ggfpm.js → smarty-CHbvlN7a.js} +1 -1
  270. package/dist/app/assets/{sml-Bvj3KzUv.js → sml-BGi33Pu0.js} +1 -1
  271. package/dist/app/assets/{solidity-CRfpXCnL.js → solidity-CZYdcu6z.js} +1 -1
  272. package/dist/app/assets/{solution-file-CYfvOj9X.js → solution-file-ChgVI9u6.js} +1 -1
  273. package/dist/app/assets/{soy-DoUU5YOQ.js → soy-CWvn9QzG.js} +1 -1
  274. package/dist/app/assets/{sparql-BRk34Rn9.js → sparql-7JjN18LQ.js} +1 -1
  275. package/dist/app/assets/{splunk-spl-C5FnseSI.js → splunk-spl-DOh97vYU.js} +1 -1
  276. package/dist/app/assets/{sqf-BeyFDkm3.js → sqf-x5ivlIR7.js} +1 -1
  277. package/dist/app/assets/{sql-D-HqwAd-.js → sql-BshsXXbk.js} +1 -1
  278. package/dist/app/assets/{squirrel-cZQ0YNSS.js → squirrel-BtrGPSbs.js} +1 -1
  279. package/dist/app/assets/{stan-zqHKC64S.js → stan-sDuPYbZs.js} +1 -1
  280. package/dist/app/assets/{stateDiagram-FHFEXIEX-CyoWPE1S.js → stateDiagram-FHFEXIEX-C06KYdye.js} +1 -1
  281. package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-sEMQqWl2.js +1 -0
  282. package/dist/app/assets/{stylus-jeXHFpb6.js → stylus-9qu1XZ91.js} +1 -1
  283. package/dist/app/assets/{swift-DD5qP3LK.js → swift-UgAKrg8O.js} +1 -1
  284. package/dist/app/assets/{systemd-dyYpUoVh.js → systemd-D1t2IK6h.js} +1 -1
  285. package/dist/app/assets/{t4-cs-DdzwIItd.js → t4-cs-D5pPXmrn.js} +1 -1
  286. package/dist/app/assets/{t4-templating-7MUBL1iq.js → t4-templating-DGpA7dEe.js} +1 -1
  287. package/dist/app/assets/{t4-vb-WExQNH7h.js → t4-vb-DeaFY-L7.js} +1 -1
  288. package/dist/app/assets/{tap-BK66GXcT.js → tap-B2Jlbmzn.js} +1 -1
  289. package/dist/app/assets/{tcl-CX-Ne5lF.js → tcl-D3Cxl9RS.js} +1 -1
  290. package/dist/app/assets/{textile-ByimrlEC.js → textile-vleyTozU.js} +1 -1
  291. package/dist/app/assets/{timeline-definition-GMOUNBTQ-uUI7-tyD.js → timeline-definition-GMOUNBTQ-DSaRfuOY.js} +1 -1
  292. package/dist/app/assets/{toml-BLYx3Nck.js → toml-Qo-F6Xf4.js} +1 -1
  293. package/dist/app/assets/{tremor-18nu0iOH.js → tremor-J5ixbTSm.js} +1 -1
  294. package/dist/app/assets/{tt2-bzqhHd_O.js → tt2-DOa_Af-o.js} +1 -1
  295. package/dist/app/assets/{turtle-Cjm_9khs.js → turtle-D8Su1Ry0.js} +1 -1
  296. package/dist/app/assets/{twig-D0iQcF_6.js → twig-GBJoDW8g.js} +1 -1
  297. package/dist/app/assets/{typescript-2OfP3mlH.js → typescript-DimFy1wk.js} +1 -1
  298. package/dist/app/assets/{typoscript-BsOytkAv.js → typoscript-Corm9VPj.js} +1 -1
  299. package/dist/app/assets/{unrealscript-BWxPoPCn.js → unrealscript-dSS5kIDz.js} +1 -1
  300. package/dist/app/assets/{uorazor-CscffpjI.js → uorazor-BGl4DTbK.js} +1 -1
  301. package/dist/app/assets/{uri-DoCyUAH6.js → uri-B403JigU.js} +1 -1
  302. package/dist/app/assets/{v-BTNlJKoZ.js → v-D1nzy8SK.js} +1 -1
  303. package/dist/app/assets/{vala-DiIqhFLn.js → vala-CbskSA-6.js} +1 -1
  304. package/dist/app/assets/{vbnet-CBoOr9B0.js → vbnet-BQwFvsFF.js} +1 -1
  305. package/dist/app/assets/{velocity-X1I_pFrR.js → velocity-dmmAE00U.js} +1 -1
  306. package/dist/app/assets/{vennDiagram-DHZGUBPP-B-52fvBA.js → vennDiagram-DHZGUBPP-BZ7Hb9Hn.js} +1 -1
  307. package/dist/app/assets/{verilog-LAXVYlck.js → verilog-BMPc4qiW.js} +1 -1
  308. package/dist/app/assets/{vhdl-CXjkeBYt.js → vhdl-BwLIiaQ3.js} +1 -1
  309. package/dist/app/assets/{vim-prtu90pQ.js → vim-NxGSno01.js} +1 -1
  310. package/dist/app/assets/{visual-basic-B3Hd0Gdb.js → visual-basic-DT3do2iL.js} +1 -1
  311. package/dist/app/assets/{wardley-RL74JXVD-BZVhJWb7.js → wardley-RL74JXVD-BQuDsmFg.js} +1 -1
  312. package/dist/app/assets/{wardleyDiagram-NUSXRM2D-Cm0ghnek.js → wardleyDiagram-NUSXRM2D-DwMCEfDA.js} +1 -1
  313. package/dist/app/assets/{warpscript-0VPXBfCe.js → warpscript-natO4zPn.js} +1 -1
  314. package/dist/app/assets/{wasm-6RzyTp2Y.js → wasm-BfugFzDn.js} +1 -1
  315. package/dist/app/assets/{web-idl-rCsaK0nr.js → web-idl-Bics_ax6.js} +1 -1
  316. package/dist/app/assets/{wiki-FlEbAGMc.js → wiki-Blq646qq.js} +1 -1
  317. package/dist/app/assets/{wolfram-DFlSzi0Z.js → wolfram-Ddn6uV9M.js} +1 -1
  318. package/dist/app/assets/{wren-CRHW6GG3.js → wren-CZ9gfbdr.js} +1 -1
  319. package/dist/app/assets/{xeora-BcvzW0pz.js → xeora-zVJDHWYP.js} +1 -1
  320. package/dist/app/assets/{xml-doc-DzJzyzOc.js → xml-doc-D9g-q5Fh.js} +1 -1
  321. package/dist/app/assets/{xojo-CX4Uo-V_.js → xojo-WpdjfLKR.js} +1 -1
  322. package/dist/app/assets/{xquery-Cm_nyuyl.js → xquery-DFrusbUY.js} +1 -1
  323. package/dist/app/assets/{xychartDiagram-5P7HB3ND-CeOBdBC2.js → xychartDiagram-5P7HB3ND-BRMmacnH.js} +1 -1
  324. package/dist/app/assets/{yaml-zn_2tPBx.js → yaml-DB6og7ei.js} +1 -1
  325. package/dist/app/assets/{yang-9OrfznQV.js → yang-CdFoUEPj.js} +1 -1
  326. package/dist/app/assets/{zig-DwTTGKoo.js → zig-C79X6U04.js} +1 -1
  327. package/dist/app/index.html +2 -2
  328. package/dist/index.cjs +1893 -746
  329. package/dist/index.js +1870 -708
  330. package/package.json +2 -2
  331. package/dist/app/assets/channel-Ocy9uBDH.js +0 -1
  332. package/dist/app/assets/classDiagram-6PBFFD2Q-DPVg45WL.js +0 -1
  333. package/dist/app/assets/classDiagram-v2-HSJHXN6E-DPVg45WL.js +0 -1
  334. package/dist/app/assets/clone-AdHtfCx4.js +0 -1
  335. package/dist/app/assets/index-Cb5pIUJX.css +0 -1
  336. package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-3eYSeZ9d.js +0 -1
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // src/components/chat.tsx
2
- import * as React43 from "react";
2
+ import * as React44 from "react";
3
3
  import {
4
4
  ArrowDown as ArrowDown2,
5
5
  FileText as FileText3,
6
6
  ImageIcon,
7
- Loader2 as Loader25,
7
+ Loader2 as Loader26,
8
8
  Pencil as Pencil4,
9
9
  Quote,
10
10
  RefreshCw as RefreshCw2,
@@ -145,7 +145,7 @@ import {
145
145
  } from "@xpert-ai/xpert-sdk";
146
146
  import "@langchain/core/messages/tool";
147
147
  import {
148
- ChatMessageEventTypeEnum,
148
+ ChatMessageEventTypeEnum as ChatMessageEventTypeEnum2,
149
149
  ChatMessageTypeEnum,
150
150
  REQUEST_USER_INPUT_RESULT_PURPOSE_IMPLEMENTATION_CONFIRMATION,
151
151
  REQUEST_USER_INPUT_RESULT_PURPOSE_PLAN_CLARIFICATION,
@@ -155,6 +155,26 @@ import {
155
155
  isClientToolRequest as isClientToolRequest2
156
156
  } from "@xpert-ai/chatkit-types";
157
157
 
158
+ // src/lib/agent-runs.ts
159
+ import {
160
+ ChatMessageEventTypeEnum
161
+ } from "@xpert-ai/chatkit-types";
162
+ function isAgentEventContent(content) {
163
+ return content.type === "agent_event";
164
+ }
165
+ function readContentExecutionId(content) {
166
+ if (!content || typeof content === "string") return void 0;
167
+ return typeof content.executionId === "string" && content.executionId.trim() ? content.executionId.trim() : void 0;
168
+ }
169
+ function readContentParentExecutionId(content) {
170
+ if (!content || typeof content === "string") return void 0;
171
+ return typeof content.parentExecutionId === "string" && content.parentExecutionId.trim() ? content.parentExecutionId.trim() : void 0;
172
+ }
173
+ function readContentAgentKey(content) {
174
+ if (!content || typeof content === "string") return void 0;
175
+ return typeof content.agentKey === "string" && content.agentKey.trim() ? content.agentKey.trim() : void 0;
176
+ }
177
+
158
178
  // src/lib/api-config.ts
159
179
  function hasConfiguredValue(value) {
160
180
  return typeof value === "string" && value.trim().length > 0;
@@ -1491,6 +1511,45 @@ var en_US_default = {
1491
1511
  option: "Option",
1492
1512
  other: "Other"
1493
1513
  },
1514
+ knowledgeRetriever: {
1515
+ queryTitle: "Query",
1516
+ resultsTitle: "Retrieved results ({{count}})",
1517
+ rawDataTitle: "Raw data",
1518
+ noResults: "No knowledge results found",
1519
+ scoreLabel: "Score"
1520
+ },
1521
+ agentRun: {
1522
+ defaultTitle: "Sub-agent",
1523
+ inputLabel: "Input",
1524
+ errorLabel: "Error",
1525
+ status: {
1526
+ running: "Running",
1527
+ success: "Done",
1528
+ error: "Error",
1529
+ replied: "Replied",
1530
+ pending: "Pending",
1531
+ interrupted: "Interrupted",
1532
+ timeout: "Timed out"
1533
+ },
1534
+ counts: {
1535
+ messages: {
1536
+ one: "{{count}} message",
1537
+ other: "{{count}} messages"
1538
+ },
1539
+ tools: {
1540
+ one: "{{count}} tool",
1541
+ other: "{{count}} tools"
1542
+ },
1543
+ events: {
1544
+ one: "{{count}} event",
1545
+ other: "{{count}} events"
1546
+ },
1547
+ children: {
1548
+ one: "{{count}} child agent",
1549
+ other: "{{count}} child agents"
1550
+ }
1551
+ }
1552
+ },
1494
1553
  toolGroup: {
1495
1554
  status: {
1496
1555
  running: "Processing",
@@ -1503,6 +1562,7 @@ var en_US_default = {
1503
1562
  jsonTitle: "JSON",
1504
1563
  jsonTree: "Tree",
1505
1564
  jsonRaw: "Raw",
1565
+ sourcesTitle: "Sources",
1506
1566
  copy: "Copy",
1507
1567
  copied: "Copied",
1508
1568
  separator: ", ",
@@ -1783,6 +1843,45 @@ var zh_CN_default = {
1783
1843
  option: "\u9009\u9879",
1784
1844
  other: "\u5176\u4ED6"
1785
1845
  },
1846
+ knowledgeRetriever: {
1847
+ queryTitle: "\u67E5\u8BE2",
1848
+ resultsTitle: "\u68C0\u7D22\u7ED3\u679C\uFF08{{count}}\uFF09",
1849
+ rawDataTitle: "\u539F\u59CB\u6570\u636E",
1850
+ noResults: "\u672A\u627E\u5230\u77E5\u8BC6\u7ED3\u679C",
1851
+ scoreLabel: "\u5206\u6570"
1852
+ },
1853
+ agentRun: {
1854
+ defaultTitle: "\u5B50\u667A\u80FD\u4F53",
1855
+ inputLabel: "\u8F93\u5165",
1856
+ errorLabel: "\u9519\u8BEF",
1857
+ status: {
1858
+ running: "\u8FD0\u884C\u4E2D",
1859
+ success: "\u5DF2\u5B8C\u6210",
1860
+ error: "\u9519\u8BEF",
1861
+ replied: "\u5DF2\u56DE\u590D",
1862
+ pending: "\u7B49\u5F85\u4E2D",
1863
+ interrupted: "\u5DF2\u4E2D\u65AD",
1864
+ timeout: "\u5DF2\u8D85\u65F6"
1865
+ },
1866
+ counts: {
1867
+ messages: {
1868
+ one: "{{count}} \u6761\u6D88\u606F",
1869
+ other: "{{count}} \u6761\u6D88\u606F"
1870
+ },
1871
+ tools: {
1872
+ one: "{{count}} \u4E2A\u5DE5\u5177",
1873
+ other: "{{count}} \u4E2A\u5DE5\u5177"
1874
+ },
1875
+ events: {
1876
+ one: "{{count}} \u4E2A\u4E8B\u4EF6",
1877
+ other: "{{count}} \u4E2A\u4E8B\u4EF6"
1878
+ },
1879
+ children: {
1880
+ one: "{{count}} \u4E2A\u5B50\u667A\u80FD\u4F53",
1881
+ other: "{{count}} \u4E2A\u5B50\u667A\u80FD\u4F53"
1882
+ }
1883
+ }
1884
+ },
1786
1885
  toolGroup: {
1787
1886
  status: {
1788
1887
  running: "\u6B63\u5728\u5904\u7406",
@@ -1795,6 +1894,7 @@ var zh_CN_default = {
1795
1894
  jsonTitle: "JSON",
1796
1895
  jsonTree: "\u6811\u5F62",
1797
1896
  jsonRaw: "\u539F\u59CB",
1897
+ sourcesTitle: "\u4FE1\u606F\u6E90",
1798
1898
  copy: "\u590D\u5236",
1799
1899
  copied: "\u5DF2\u590D\u5236",
1800
1900
  separator: "\uFF0C",
@@ -3435,7 +3535,17 @@ function SlashPalette({
3435
3535
  }
3436
3536
  ),
3437
3537
  /* @__PURE__ */ jsxs6("span", { className: "flex min-w-0 flex-1 items-baseline gap-2", children: [
3438
- /* @__PURE__ */ jsx13("span", { className: "shrink-0 truncate font-medium", children: option.label }),
3538
+ /* @__PURE__ */ jsxs6("span", { className: "flex min-w-0 shrink-0 items-baseline gap-1.5", children: [
3539
+ /* @__PURE__ */ jsx13("span", { className: "truncate font-medium", children: option.label }),
3540
+ option.kind === "command" && option.capabilityType && typeof option.childCount === "number" ? /* @__PURE__ */ jsx13(
3541
+ "span",
3542
+ {
3543
+ "data-slot": "slash-palette-child-count",
3544
+ className: "inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-muted px-1 text-[10px] font-medium leading-none text-muted-foreground",
3545
+ children: option.childCount
3546
+ }
3547
+ ) : null
3548
+ ] }),
3439
3549
  option.description && /* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", children: option.description })
3440
3550
  ] }),
3441
3551
  option.kind === "command" && option.capabilityType ? /* @__PURE__ */ jsx13("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-muted-foreground", children: option.expanded ? /* @__PURE__ */ jsx13(ChevronDown, { size: 14 }) : /* @__PURE__ */ jsx13(ChevronRight2, { size: 14 }) }) : null
@@ -6107,19 +6217,22 @@ function resolveRuntimeCapabilityPalette(value, selectionStart) {
6107
6217
  return null;
6108
6218
  }
6109
6219
  const beforeCaret = value.slice(0, selectionStart);
6110
- const match = /(^|\s)\/([^\s/]*)$/.exec(beforeCaret);
6220
+ const match = /(^|\s)([/$])([^\s/]*)$/.exec(beforeCaret);
6111
6221
  if (!match) {
6112
6222
  return null;
6113
6223
  }
6114
- const query = match[2] ?? "";
6224
+ const trigger = match[2];
6225
+ const query = match[3] ?? "";
6115
6226
  const start = beforeCaret.length - query.length - 1;
6116
6227
  const beforeTrigger = beforeCaret.slice(0, start);
6117
6228
  return {
6229
+ trigger,
6118
6230
  query,
6119
6231
  start,
6120
6232
  end: selectionStart,
6121
6233
  activeIndex: 0,
6122
- atMessageStart: beforeTrigger.trim().length === 0
6234
+ atMessageStart: beforeTrigger.trim().length === 0,
6235
+ ...trigger === "$" ? { capabilityTypes: ["skill"] } : {}
6123
6236
  };
6124
6237
  }
6125
6238
  function matchesQuery(values, query) {
@@ -6156,7 +6269,11 @@ function matchesCapability(option, query, capabilityTypes) {
6156
6269
  if (capabilityTypes?.length && !capabilityTypes.includes(option.type)) {
6157
6270
  return false;
6158
6271
  }
6159
- return matchesQuery([option.label, option.description, option.type], query);
6272
+ const skillAliases = option.type === "skill" ? [`$${option.id}`, `$${option.label}`] : [];
6273
+ return matchesQuery(
6274
+ [option.id, option.label, option.description, option.type, ...skillAliases],
6275
+ query
6276
+ );
6160
6277
  }
6161
6278
  function getCommandPaletteOption(command) {
6162
6279
  const capabilityType = CAPABILITY_GROUP_COMMANDS[command.name];
@@ -6703,13 +6820,284 @@ function useSlashCommands({
6703
6820
  }
6704
6821
 
6705
6822
  // src/components/thread/messages/ai.tsx
6706
- import * as React30 from "react";
6823
+ import * as React31 from "react";
6707
6824
  import {
6708
6825
  ChevronDown as ChevronDown4,
6709
- Clock3,
6710
- Loader2 as Loader24
6826
+ Clock3 as Clock32,
6827
+ Loader2 as Loader25
6711
6828
  } from "lucide-react";
6712
6829
 
6830
+ // src/lib/agent-run-render-tree.ts
6831
+ function isTextContent(content) {
6832
+ return content.type === "text";
6833
+ }
6834
+ function isReasoningContent(content) {
6835
+ return content.type === "reasoning";
6836
+ }
6837
+ function isComponentContent(content) {
6838
+ return content.type === "component";
6839
+ }
6840
+ function parseDateValue(value) {
6841
+ if (value instanceof Date) {
6842
+ const timestamp2 = value.getTime();
6843
+ return Number.isNaN(timestamp2) ? null : timestamp2;
6844
+ }
6845
+ if (typeof value !== "string") {
6846
+ return null;
6847
+ }
6848
+ const timestamp = Date.parse(value);
6849
+ return Number.isNaN(timestamp) ? null : timestamp;
6850
+ }
6851
+ function readContentTitle(content) {
6852
+ if (typeof content === "string") return void 0;
6853
+ if (typeof content.xpertName === "string" && content.xpertName.trim()) {
6854
+ return content.xpertName.trim();
6855
+ }
6856
+ return void 0;
6857
+ }
6858
+ function readContentStringField(content, field) {
6859
+ if (typeof content === "string") return void 0;
6860
+ const value = content[field];
6861
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
6862
+ }
6863
+ function normalizeRunStatus(status) {
6864
+ return typeof status === "string" && status.trim() ? status.trim().toLowerCase() : "pending";
6865
+ }
6866
+ function isRunningRunStatus(status) {
6867
+ return normalizeRunStatus(status) === "running";
6868
+ }
6869
+ function isFailedRunStatus(status) {
6870
+ const normalized = normalizeRunStatus(status);
6871
+ return normalized === "error" || normalized === "fail" || normalized === "failed";
6872
+ }
6873
+ function hasVisibleAgentRunDetails(info) {
6874
+ return info.error !== void 0;
6875
+ }
6876
+ function getAgentRunTitle(info, fallback) {
6877
+ return info.title?.trim() || info.xpertName?.trim() || info.agentKey?.trim() || fallback || null;
6878
+ }
6879
+ function getAgentRunDuration(info) {
6880
+ if (typeof info.elapsedTime === "number" && Number.isFinite(info.elapsedTime)) {
6881
+ return info.elapsedTime;
6882
+ }
6883
+ const startedAt = parseDateValue(info.startedAt) ?? parseDateValue(info.createdAt);
6884
+ const endedAt = parseDateValue(info.endedAt) ?? parseDateValue(info.updatedAt);
6885
+ if (startedAt === null || endedAt === null) return null;
6886
+ return Math.max(0, endedAt - startedAt);
6887
+ }
6888
+ function getAgentRunCounts(node) {
6889
+ let text = 0;
6890
+ let tools = 0;
6891
+ let events = 0;
6892
+ for (const entry of node.entries) {
6893
+ const item = entry.item;
6894
+ if (typeof item === "string") {
6895
+ if (item.trim()) text += 1;
6896
+ continue;
6897
+ }
6898
+ if (isTextContent(item) || isReasoningContent(item)) {
6899
+ if (item.text?.trim()) text += 1;
6900
+ continue;
6901
+ }
6902
+ if (isComponentContent(item)) {
6903
+ tools += 1;
6904
+ continue;
6905
+ }
6906
+ if (isAgentEventContent(item)) {
6907
+ events += 1;
6908
+ }
6909
+ }
6910
+ return {
6911
+ text,
6912
+ tools,
6913
+ events,
6914
+ children: node.children.length
6915
+ };
6916
+ }
6917
+ function createAgentRunNode(nodes, id, info, order) {
6918
+ const existing = nodes.get(id);
6919
+ if (existing) {
6920
+ existing.info = {
6921
+ ...existing.info,
6922
+ ...info,
6923
+ id,
6924
+ parentId: info.parentId ?? existing.info.parentId,
6925
+ parentExecutionId: info.parentExecutionId ?? existing.info.parentExecutionId,
6926
+ agentKey: info.agentKey ?? existing.info.agentKey,
6927
+ xpertName: info.xpertName ?? existing.info.xpertName,
6928
+ title: info.title ?? existing.info.title,
6929
+ status: info.status ?? existing.info.status,
6930
+ elapsedTime: info.elapsedTime ?? existing.info.elapsedTime,
6931
+ error: info.error ?? existing.info.error,
6932
+ inputs: info.inputs ?? existing.info.inputs
6933
+ };
6934
+ existing.firstOrder = Math.min(existing.firstOrder, order);
6935
+ return existing;
6936
+ }
6937
+ const node = {
6938
+ id,
6939
+ info: { ...info, id },
6940
+ entries: [],
6941
+ children: [],
6942
+ firstOrder: order
6943
+ };
6944
+ nodes.set(id, node);
6945
+ return node;
6946
+ }
6947
+ function findFallbackRunByAgentKey(runs, agentKey, rootExecutionId) {
6948
+ if (!agentKey) return null;
6949
+ const candidates = runs.filter(
6950
+ (run) => run.agentKey === agentKey && run.id !== rootExecutionId
6951
+ );
6952
+ if (candidates.length === 0) return null;
6953
+ for (let index = candidates.length - 1; index >= 0; index -= 1) {
6954
+ if (isRunningRunStatus(candidates[index].status)) {
6955
+ return candidates[index];
6956
+ }
6957
+ }
6958
+ return candidates[candidates.length - 1];
6959
+ }
6960
+ function getEntryRunTarget(entry, runs, rootExecutionId) {
6961
+ const item = entry.item;
6962
+ const executionId = readContentExecutionId(item);
6963
+ const parentExecutionId = readContentParentExecutionId(item);
6964
+ const agentKey = readContentAgentKey(item);
6965
+ if (executionId) {
6966
+ return {
6967
+ executionId,
6968
+ parentExecutionId,
6969
+ agentKey
6970
+ };
6971
+ }
6972
+ const fallbackRun = findFallbackRunByAgentKey(
6973
+ runs,
6974
+ agentKey,
6975
+ rootExecutionId
6976
+ );
6977
+ if (!fallbackRun) return null;
6978
+ return {
6979
+ executionId: fallbackRun.id,
6980
+ parentExecutionId: fallbackRun.parentId ?? fallbackRun.parentExecutionId,
6981
+ agentKey
6982
+ };
6983
+ }
6984
+ function createInfoFromEntry(id, entry, parentExecutionId) {
6985
+ return {
6986
+ id,
6987
+ ...parentExecutionId ? { parentId: parentExecutionId, parentExecutionId } : {},
6988
+ ...readContentAgentKey(entry.item) ? { agentKey: readContentAgentKey(entry.item) } : {},
6989
+ ...readContentTitle(entry.item) ? { xpertName: readContentTitle(entry.item) } : {},
6990
+ ...readContentStringField(entry.item, "runId") ? { runId: readContentStringField(entry.item, "runId") } : {}
6991
+ };
6992
+ }
6993
+ function normalizeAssistantEntries(message) {
6994
+ const entries = [];
6995
+ if (typeof message.content === "string") {
6996
+ if (message.content.trim()) {
6997
+ entries.push({
6998
+ item: message.content,
6999
+ index: 0,
7000
+ source: "content",
7001
+ order: 0
7002
+ });
7003
+ }
7004
+ } else if (Array.isArray(message.content)) {
7005
+ message.content.forEach((item, index) => {
7006
+ entries.push({
7007
+ item,
7008
+ index,
7009
+ source: "content",
7010
+ order: index
7011
+ });
7012
+ });
7013
+ }
7014
+ const contentCount = entries.length;
7015
+ (message.reasoning ?? []).forEach((item, index) => {
7016
+ entries.push({
7017
+ item,
7018
+ index,
7019
+ source: "reasoning",
7020
+ order: contentCount + index
7021
+ });
7022
+ });
7023
+ return entries;
7024
+ }
7025
+ function refreshAgentNodeOrder(node) {
7026
+ let order = node.firstOrder;
7027
+ for (const child of node.children) {
7028
+ order = Math.min(order, refreshAgentNodeOrder(child));
7029
+ }
7030
+ node.firstOrder = order;
7031
+ node.children.sort((a, b) => a.firstOrder - b.firstOrder);
7032
+ return order;
7033
+ }
7034
+ function buildAssistantRenderTree(message) {
7035
+ const rootExecutionId = message.executionId;
7036
+ const runs = message.agentRuns ?? [];
7037
+ const entries = normalizeAssistantEntries(message);
7038
+ const nodes = /* @__PURE__ */ new Map();
7039
+ const rootEntries = [];
7040
+ const rootReasoning = [];
7041
+ const baseOrder = entries.length + 1;
7042
+ runs.forEach((run, index) => {
7043
+ createAgentRunNode(nodes, run.id, run, baseOrder + index / 1e3);
7044
+ });
7045
+ for (const entry of entries) {
7046
+ const target = getEntryRunTarget(entry, runs, rootExecutionId);
7047
+ const shouldGroup = Boolean(target?.executionId) && (target?.executionId !== rootExecutionId || Boolean(target?.parentExecutionId));
7048
+ if (!target || !shouldGroup) {
7049
+ if (entry.source === "reasoning" && typeof entry.item !== "string") {
7050
+ rootReasoning.push(entry.item);
7051
+ } else {
7052
+ rootEntries.push(entry);
7053
+ }
7054
+ continue;
7055
+ }
7056
+ const node = createAgentRunNode(
7057
+ nodes,
7058
+ target.executionId,
7059
+ createInfoFromEntry(target.executionId, entry, target.parentExecutionId),
7060
+ entry.order
7061
+ );
7062
+ node.entries.push(entry);
7063
+ node.firstOrder = Math.min(node.firstOrder, entry.order);
7064
+ }
7065
+ const roots = [];
7066
+ for (const node of nodes.values()) {
7067
+ if (node.id === rootExecutionId && !node.info.parentId) {
7068
+ continue;
7069
+ }
7070
+ const parentId = node.info.parentId ?? node.info.parentExecutionId;
7071
+ if (parentId && parentId !== rootExecutionId && parentId !== node.id) {
7072
+ const parent = nodes.get(parentId);
7073
+ if (parent) {
7074
+ parent.children.push(node);
7075
+ continue;
7076
+ }
7077
+ }
7078
+ roots.push(node);
7079
+ }
7080
+ roots.forEach(refreshAgentNodeOrder);
7081
+ roots.sort((a, b) => a.firstOrder - b.firstOrder);
7082
+ const units = [
7083
+ ...rootEntries.map((entry) => ({
7084
+ type: "entry",
7085
+ entry,
7086
+ order: entry.order
7087
+ })),
7088
+ ...roots.map((node) => ({
7089
+ type: "agent",
7090
+ node,
7091
+ order: node.firstOrder
7092
+ }))
7093
+ ].sort((a, b) => a.order - b.order);
7094
+ return {
7095
+ units,
7096
+ rootReasoning,
7097
+ hasAgentRuns: roots.length > 0
7098
+ };
7099
+ }
7100
+
6713
7101
  // src/components/ui/badge.tsx
6714
7102
  import * as React24 from "react";
6715
7103
  import { jsx as jsx24 } from "react/jsx-runtime";
@@ -7924,119 +8312,776 @@ var MarkdownTextImpl = ({ children }) => {
7924
8312
  };
7925
8313
  var MarkdownText = memo(MarkdownTextImpl);
7926
8314
 
7927
- // src/components/thread/messages/tool-component-group.tsx
8315
+ // src/components/thread/messages/agent-run-group.tsx
7928
8316
  import * as React28 from "react";
7929
8317
  import {
7930
- BookOpen,
7931
- Brain as Brain3,
7932
- Building2,
7933
- Check as Check3,
8318
+ Bot as Bot3,
8319
+ Braces,
7934
8320
  CheckCircle2 as CheckCircle22,
7935
8321
  ChevronRight as ChevronRight6,
7936
- CircleHelp,
7937
- Copy,
7938
- FileText as FileText2,
7939
- Files,
8322
+ Clock3,
8323
+ GitBranch,
8324
+ Info as Info4,
7940
8325
  Loader2 as Loader23,
7941
- ListTodo as ListTodo2,
7942
- Network,
7943
- Repeat2,
7944
- SquareTerminal,
8326
+ MessageSquareText,
7945
8327
  Wrench,
7946
8328
  XCircle
7947
8329
  } from "lucide-react";
7948
-
7949
- // src/i18n/localized-text.ts
7950
- function resolveLocalizedText(value, language) {
7951
- if (typeof value === "string") {
7952
- const trimmed = value.trim();
7953
- return trimmed || null;
8330
+ import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
8331
+ function safeJson2(value) {
8332
+ try {
8333
+ return JSON.stringify(value, null, 2);
8334
+ } catch {
8335
+ return String(value);
7954
8336
  }
7955
- if (!value || typeof value !== "object") return null;
7956
- const localized = value;
7957
- const normalizedLanguage = language.trim();
7958
- const underscoredLanguage = normalizedLanguage.replace(/-/g, "_");
7959
- const languagePrefix = normalizedLanguage.split("-")[0];
7960
- const preferredKeys = normalizedLanguage.startsWith("zh") ? [
7961
- normalizedLanguage,
7962
- underscoredLanguage,
7963
- "zh_Hans",
7964
- "zh-Hans",
7965
- "zh_CN",
7966
- "zh-CN",
7967
- "zh",
7968
- "en_US",
7969
- "en-US",
7970
- "en"
7971
- ] : [
7972
- normalizedLanguage,
7973
- underscoredLanguage,
7974
- "en_US",
7975
- "en-US",
7976
- "en",
7977
- languagePrefix,
7978
- "zh_Hans",
7979
- "zh-Hans",
7980
- "zh_CN",
7981
- "zh-CN",
7982
- "zh"
7983
- ];
7984
- for (const key of preferredKeys) {
7985
- const candidate = localized[key];
7986
- if (typeof candidate === "string" && candidate.trim()) {
7987
- return candidate.trim();
7988
- }
8337
+ }
8338
+ function formatDisplayValue2(value) {
8339
+ return typeof value === "string" ? value : safeJson2(value);
8340
+ }
8341
+ function formatStepDuration(durationMs) {
8342
+ if (durationMs < 1e3) {
8343
+ return `${durationMs}ms`;
7989
8344
  }
7990
- for (const candidate of Object.values(localized)) {
7991
- if (typeof candidate === "string" && candidate.trim()) {
7992
- return candidate.trim();
7993
- }
8345
+ if (durationMs < 1e4) {
8346
+ return `${(durationMs / 1e3).toFixed(1)}s`;
7994
8347
  }
7995
- return null;
8348
+ if (durationMs < 6e4) {
8349
+ return `${Math.round(durationMs / 1e3)}s`;
8350
+ }
8351
+ const hours = Math.floor(durationMs / 36e5);
8352
+ const minutes = Math.floor(durationMs % 36e5 / 6e4);
8353
+ const seconds = Math.floor(durationMs % 6e4 / 1e3);
8354
+ if (hours > 0) {
8355
+ return `${hours}h ${minutes}m ${seconds}s`;
8356
+ }
8357
+ return `${minutes}m ${seconds}s`;
7996
8358
  }
7997
-
7998
- // src/components/thread/messages/tool-component-group.tsx
7999
- import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
8000
- var toolStatusConfig = {
8001
- success: {
8002
- iconClass: "border-green-500 text-green-700",
8003
- icon: CheckCircle22
8004
- },
8005
- fail: {
8006
- iconClass: "border-red-500 text-red-700",
8007
- icon: XCircle
8008
- },
8009
- running: {
8010
- iconClass: "border-blue-500 text-blue-700",
8011
- icon: Loader23
8359
+ function getAgentRunStatusConfig(status, hasReply = false) {
8360
+ const normalized = normalizeRunStatus(status);
8361
+ if (normalized === "running") {
8362
+ return {
8363
+ icon: Loader23,
8364
+ iconClass: "text-blue-700",
8365
+ labelKey: "running",
8366
+ spin: true
8367
+ };
8012
8368
  }
8013
- };
8014
- var TOOL_GROUP_CATEGORY_ORDER = [
8015
- "files",
8016
- "searches",
8017
- "commands",
8018
- "lists",
8019
- "tasks",
8020
- "knowledges",
8021
- "tools"
8022
- ];
8023
- var TOOL_GROUP_TOKEN_CATEGORY = {
8024
- file: "files",
8025
- files: "files",
8026
- web_search: "searches",
8027
- search: "searches",
8028
- searches: "searches",
8029
- program: "commands",
8030
- command: "commands",
8031
- commands: "commands",
8032
- shell: "commands",
8033
- terminal: "commands",
8034
- list: "lists",
8035
- lists: "lists",
8036
- task: "tasks",
8037
- tasks: "tasks",
8038
- todo: "tasks",
8039
- todos: "tasks",
8369
+ if (normalized === "success" || normalized === "succeeded") {
8370
+ return {
8371
+ icon: CheckCircle22,
8372
+ iconClass: "text-green-700",
8373
+ labelKey: "success",
8374
+ spin: false
8375
+ };
8376
+ }
8377
+ if (isFailedRunStatus(normalized)) {
8378
+ return {
8379
+ icon: XCircle,
8380
+ iconClass: "text-red-700",
8381
+ labelKey: "error",
8382
+ spin: false
8383
+ };
8384
+ }
8385
+ if (normalized === "pending" && hasReply) {
8386
+ return {
8387
+ icon: CheckCircle22,
8388
+ iconClass: "text-green-700",
8389
+ labelKey: "replied",
8390
+ spin: false
8391
+ };
8392
+ }
8393
+ return {
8394
+ icon: Clock3,
8395
+ iconClass: "text-muted-foreground",
8396
+ labelKey: normalized,
8397
+ spin: false
8398
+ };
8399
+ }
8400
+ function AgentRunHeaderMetric({
8401
+ icon: Icon,
8402
+ label,
8403
+ value,
8404
+ children
8405
+ }) {
8406
+ return /* @__PURE__ */ jsxs19(Tooltip, { children: [
8407
+ /* @__PURE__ */ jsx31(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs19(
8408
+ "span",
8409
+ {
8410
+ "aria-label": label,
8411
+ className: "inline-flex shrink-0 items-center gap-1 rounded-sm text-[11px] text-muted-foreground/60 transition-colors group-hover/agent:text-muted-foreground",
8412
+ children: [
8413
+ /* @__PURE__ */ jsx31(Icon, { className: "h-3.5 w-3.5" }),
8414
+ value !== void 0 ? /* @__PURE__ */ jsx31("span", { children: value }) : null
8415
+ ]
8416
+ }
8417
+ ) }),
8418
+ /* @__PURE__ */ jsx31(TooltipContent, { side: "top", sideOffset: 6, className: "max-w-80 text-left", children })
8419
+ ] });
8420
+ }
8421
+ function getAgentNodeUnits(node) {
8422
+ return [
8423
+ ...node.entries.map((entry) => ({
8424
+ type: "entry",
8425
+ entry,
8426
+ order: entry.order
8427
+ })),
8428
+ ...node.children.map((child) => ({
8429
+ type: "agent",
8430
+ node: child,
8431
+ order: child.firstOrder
8432
+ }))
8433
+ ].sort((a, b) => a.order - b.order);
8434
+ }
8435
+ function AgentEventRow({ content }) {
8436
+ const label = content.title?.trim() || content.message?.trim() || content.event?.trim() || "Event";
8437
+ const detail = content.title?.trim() && content.message?.trim() ? content.message.trim() : null;
8438
+ const isError = content.error !== void 0 || isFailedRunStatus(content.status);
8439
+ return /* @__PURE__ */ jsxs19(
8440
+ "div",
8441
+ {
8442
+ className: cn(
8443
+ "flex items-start gap-2 rounded-md px-2 py-1.5 text-xs leading-5",
8444
+ isError ? "bg-destructive/10 text-destructive" : "bg-muted/40 text-muted-foreground"
8445
+ ),
8446
+ children: [
8447
+ /* @__PURE__ */ jsx31(Info4, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
8448
+ /* @__PURE__ */ jsxs19("div", { className: "min-w-0 flex-1", children: [
8449
+ /* @__PURE__ */ jsx31("div", { className: "truncate font-medium", children: label }),
8450
+ detail ? /* @__PURE__ */ jsx31("div", { className: "wrap-break-word", children: detail }) : null,
8451
+ content.error !== void 0 ? /* @__PURE__ */ jsx31("pre", { className: "mt-1 whitespace-pre-wrap wrap-break-word", children: formatDisplayValue2(content.error) }) : null
8452
+ ] })
8453
+ ]
8454
+ }
8455
+ );
8456
+ }
8457
+ function AgentRunGroup({
8458
+ node,
8459
+ hasFollowingItem,
8460
+ depth,
8461
+ renderUnits
8462
+ }) {
8463
+ const { t } = useChatkitTranslation();
8464
+ const counts = getAgentRunCounts(node);
8465
+ const statusConfig = getAgentRunStatusConfig(
8466
+ node.info.status,
8467
+ counts.text > 0
8468
+ );
8469
+ const StatusIcon = statusConfig.icon;
8470
+ const isRunning = isRunningRunStatus(node.info.status);
8471
+ const [isExpanded, setIsExpanded] = React28.useState(
8472
+ () => isRunning || !hasFollowingItem
8473
+ );
8474
+ const title = getAgentRunTitle(node.info, t("message.agentRun.defaultTitle"));
8475
+ const duration = getAgentRunDuration(node.info);
8476
+ const statusLabel = t(`message.agentRun.status.${statusConfig.labelKey}`, {
8477
+ defaultValue: node.info.status ?? statusConfig.labelKey
8478
+ });
8479
+ const detailsId = React28.useId();
8480
+ React28.useEffect(() => {
8481
+ if (isRunning) {
8482
+ setIsExpanded(true);
8483
+ return;
8484
+ }
8485
+ setIsExpanded(!hasFollowingItem);
8486
+ }, [hasFollowingItem, isRunning]);
8487
+ const countItems = [
8488
+ counts.text > 0 ? {
8489
+ icon: MessageSquareText,
8490
+ count: counts.text,
8491
+ label: t(
8492
+ `message.agentRun.counts.messages.${counts.text === 1 ? "one" : "other"}`,
8493
+ { count: counts.text }
8494
+ )
8495
+ } : null,
8496
+ counts.tools > 0 ? {
8497
+ icon: Wrench,
8498
+ count: counts.tools,
8499
+ label: t(
8500
+ `message.agentRun.counts.tools.${counts.tools === 1 ? "one" : "other"}`,
8501
+ { count: counts.tools }
8502
+ )
8503
+ } : null,
8504
+ counts.events > 0 ? {
8505
+ icon: Info4,
8506
+ count: counts.events,
8507
+ label: t(
8508
+ `message.agentRun.counts.events.${counts.events === 1 ? "one" : "other"}`,
8509
+ { count: counts.events }
8510
+ )
8511
+ } : null,
8512
+ counts.children > 0 ? {
8513
+ icon: GitBranch,
8514
+ count: counts.children,
8515
+ label: t(
8516
+ `message.agentRun.counts.children.${counts.children === 1 ? "one" : "other"}`,
8517
+ { count: counts.children }
8518
+ )
8519
+ } : null
8520
+ ].filter(
8521
+ (item) => Boolean(item)
8522
+ );
8523
+ return /* @__PURE__ */ jsxs19("div", { className: cn("border-l border-border/70 pl-2", depth > 0 ? "ml-1" : "-mx-2.5"), children: [
8524
+ /* @__PURE__ */ jsxs19(
8525
+ "button",
8526
+ {
8527
+ type: "button",
8528
+ className: "group/agent group-agent flex w-full items-start justify-between gap-2 rounded-md px-0 py-1.5 text-left",
8529
+ "aria-expanded": isExpanded,
8530
+ "aria-controls": detailsId,
8531
+ onClick: () => setIsExpanded((prev) => !prev),
8532
+ children: [
8533
+ /* @__PURE__ */ jsx31("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs19("div", { className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1", children: [
8534
+ /* @__PURE__ */ jsx31(Bot3, { className: "h-4 w-4 shrink-0 text-muted-foreground/55 transition-colors group-hover/agent:text-muted-foreground" }),
8535
+ /* @__PURE__ */ jsx31("span", { className: "min-w-0 max-w-[16rem] truncate text-sm font-medium text-foreground/65 transition-colors group-hover/agent:text-foreground", children: title }),
8536
+ /* @__PURE__ */ jsxs19("span", { className: "inline-flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground/65 transition-colors group-hover/agent:text-muted-foreground", children: [
8537
+ /* @__PURE__ */ jsx31(
8538
+ StatusIcon,
8539
+ {
8540
+ className: cn(
8541
+ "h-3.5 w-3.5",
8542
+ statusConfig.iconClass,
8543
+ statusConfig.spin && "animate-spin"
8544
+ )
8545
+ }
8546
+ ),
8547
+ statusLabel
8548
+ ] }),
8549
+ duration !== null ? /* @__PURE__ */ jsxs19("span", { className: "inline-flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground/60 tabular-nums transition-colors group-hover/agent:text-muted-foreground", children: [
8550
+ /* @__PURE__ */ jsx31(Clock3, { className: "h-3 w-3" }),
8551
+ formatStepDuration(duration)
8552
+ ] }) : null,
8553
+ node.info.inputs !== void 0 ? /* @__PURE__ */ jsx31(
8554
+ AgentRunHeaderMetric,
8555
+ {
8556
+ icon: Braces,
8557
+ label: t("message.agentRun.inputLabel"),
8558
+ children: /* @__PURE__ */ jsxs19("div", { className: "space-y-1", children: [
8559
+ /* @__PURE__ */ jsx31("div", { className: "font-medium", children: t("message.agentRun.inputLabel") }),
8560
+ /* @__PURE__ */ jsx31("pre", { className: "max-h-64 overflow-auto whitespace-pre-wrap wrap-break-word text-xs", children: formatDisplayValue2(node.info.inputs) })
8561
+ ] })
8562
+ }
8563
+ ) : null,
8564
+ countItems.map((item) => {
8565
+ const CountIcon = item.icon;
8566
+ return /* @__PURE__ */ jsx31(
8567
+ AgentRunHeaderMetric,
8568
+ {
8569
+ icon: CountIcon,
8570
+ label: item.label,
8571
+ value: item.count,
8572
+ children: /* @__PURE__ */ jsx31("span", { children: item.label })
8573
+ },
8574
+ item.label
8575
+ );
8576
+ })
8577
+ ] }) }),
8578
+ /* @__PURE__ */ jsx31(
8579
+ ChevronRight6,
8580
+ {
8581
+ "aria-hidden": "true",
8582
+ className: cn(
8583
+ "mt-0.5 h-4 w-4 shrink-0 text-muted-foreground/55 opacity-0 transition-[color,transform] group-hover/agent:text-muted-foreground group-hover/agent:opacity-100",
8584
+ isExpanded && "rotate-90"
8585
+ )
8586
+ }
8587
+ )
8588
+ ]
8589
+ }
8590
+ ),
8591
+ isExpanded ? /* @__PURE__ */ jsxs19("div", { id: detailsId, className: "mt-2 space-y-3", children: [
8592
+ hasVisibleAgentRunDetails(node.info) ? /* @__PURE__ */ jsx31("div", { className: "space-y-2 rounded-md bg-muted/30 px-2 py-2 text-xs text-muted-foreground", children: node.info.error !== void 0 ? /* @__PURE__ */ jsxs19("div", { children: [
8593
+ /* @__PURE__ */ jsx31("div", { className: "mb-1 font-medium text-destructive", children: t("message.agentRun.errorLabel") }),
8594
+ /* @__PURE__ */ jsx31("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue2(node.info.error) })
8595
+ ] }) : null }) : null,
8596
+ renderUnits(getAgentNodeUnits(node), depth + 1)
8597
+ ] }) : null
8598
+ ] });
8599
+ }
8600
+
8601
+ // src/i18n/localized-text.ts
8602
+ function resolveLocalizedText(value, language) {
8603
+ if (typeof value === "string") {
8604
+ const trimmed = value.trim();
8605
+ return trimmed || null;
8606
+ }
8607
+ if (!value || typeof value !== "object") return null;
8608
+ const localized = value;
8609
+ const normalizedLanguage = language.trim();
8610
+ const underscoredLanguage = normalizedLanguage.replace(/-/g, "_");
8611
+ const languagePrefix = normalizedLanguage.split("-")[0];
8612
+ const preferredKeys = normalizedLanguage.startsWith("zh") ? [
8613
+ normalizedLanguage,
8614
+ underscoredLanguage,
8615
+ "zh_Hans",
8616
+ "zh-Hans",
8617
+ "zh_CN",
8618
+ "zh-CN",
8619
+ "zh",
8620
+ "en_US",
8621
+ "en-US",
8622
+ "en"
8623
+ ] : [
8624
+ normalizedLanguage,
8625
+ underscoredLanguage,
8626
+ "en_US",
8627
+ "en-US",
8628
+ "en",
8629
+ languagePrefix,
8630
+ "zh_Hans",
8631
+ "zh-Hans",
8632
+ "zh_CN",
8633
+ "zh-CN",
8634
+ "zh"
8635
+ ];
8636
+ for (const key of preferredKeys) {
8637
+ const candidate = localized[key];
8638
+ if (typeof candidate === "string" && candidate.trim()) {
8639
+ return candidate.trim();
8640
+ }
8641
+ }
8642
+ for (const candidate of Object.values(localized)) {
8643
+ if (typeof candidate === "string" && candidate.trim()) {
8644
+ return candidate.trim();
8645
+ }
8646
+ }
8647
+ return null;
8648
+ }
8649
+
8650
+ // src/components/thread/messages/knowledge-retriever-component-renderer.tsx
8651
+ import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
8652
+ var KNOWLEDGE_RETRIEVER_TITLE = "Knowledge Retriever";
8653
+ var KNOWLEDGE_METADATA_SKIP_KEYS = /* @__PURE__ */ new Set([
8654
+ "assets",
8655
+ "children",
8656
+ "loc",
8657
+ "relevanceScore",
8658
+ "score"
8659
+ ]);
8660
+ var knowledgeRetrieverComponentRenderer = {
8661
+ id: "knowledge-retriever",
8662
+ presentation: "grouped-step",
8663
+ match: isKnowledgeRetrieverComponent,
8664
+ getTitle: () => KNOWLEDGE_RETRIEVER_TITLE,
8665
+ hasDetails: hasKnowledgeRetrieverDetails,
8666
+ renderDetails: KnowledgeRetrieverDetails
8667
+ };
8668
+ function normalizeToolToken(value) {
8669
+ if (typeof value !== "string") return null;
8670
+ const normalized = value.trim().toLowerCase().replace(/[\s-]+/g, "_");
8671
+ return normalized || null;
8672
+ }
8673
+ function isRecord2(value) {
8674
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
8675
+ }
8676
+ function readString(value) {
8677
+ if (typeof value !== "string") return void 0;
8678
+ const trimmed = value.trim();
8679
+ return trimmed || void 0;
8680
+ }
8681
+ function stringifyValue(value) {
8682
+ if (value === null || value === void 0) return void 0;
8683
+ if (typeof value === "string") return readString(value);
8684
+ if (typeof value === "number" || typeof value === "boolean") {
8685
+ return String(value);
8686
+ }
8687
+ try {
8688
+ const serialized = JSON.stringify(value);
8689
+ return serialized && serialized !== "{}" ? serialized : void 0;
8690
+ } catch {
8691
+ return String(value);
8692
+ }
8693
+ }
8694
+ function truncateMetadataValue(value) {
8695
+ return value.length > 90 ? `${value.slice(0, 87)}...` : value;
8696
+ }
8697
+ function formatScore(value) {
8698
+ if (typeof value === "number") {
8699
+ return Number.isFinite(value) ? value.toFixed(value < 1 ? 3 : 2) : void 0;
8700
+ }
8701
+ return readString(value);
8702
+ }
8703
+ function getLineRange(metadata) {
8704
+ const loc = metadata.loc;
8705
+ if (!isRecord2(loc)) return void 0;
8706
+ const lines = loc.lines;
8707
+ if (!isRecord2(lines)) return void 0;
8708
+ const from = stringifyValue(lines.from);
8709
+ const to = stringifyValue(lines.to);
8710
+ if (from && to) return `${from}-${to}`;
8711
+ return from ?? to;
8712
+ }
8713
+ function normalizeMetadataEntries(metadata) {
8714
+ return Object.entries(metadata).flatMap(([key, value]) => {
8715
+ if (KNOWLEDGE_METADATA_SKIP_KEYS.has(key)) return [];
8716
+ const formatted = stringifyValue(value);
8717
+ if (!formatted) return [];
8718
+ return [
8719
+ {
8720
+ key,
8721
+ value: truncateMetadataValue(formatted)
8722
+ }
8723
+ ];
8724
+ });
8725
+ }
8726
+ function normalizeKnowledgeResult(value, fallbackTitle) {
8727
+ if (!isRecord2(value)) return null;
8728
+ const metadata = isRecord2(value.metadata) ? value.metadata : {};
8729
+ const document2 = isRecord2(value.document) ? value.document : {};
8730
+ const content = readString(value.pageContent);
8731
+ const title = readString(document2.name) ?? readString(metadata.originalFileName) ?? readString(metadata.source) ?? readString(value.id) ?? readString(metadata.chunkId) ?? fallbackTitle;
8732
+ if (!content && Object.keys(metadata).length === 0 && Object.keys(document2).length === 0) {
8733
+ return null;
8734
+ }
8735
+ return {
8736
+ id: readString(value.id) ?? readString(metadata.chunkId),
8737
+ title,
8738
+ url: readString(document2.fileUrl),
8739
+ content,
8740
+ lineRange: getLineRange(metadata),
8741
+ score: formatScore(
8742
+ metadata.relevanceScore ?? metadata.score ?? value.score
8743
+ ),
8744
+ metadata: normalizeMetadataEntries(metadata)
8745
+ };
8746
+ }
8747
+ function getKnowledgeResults(data) {
8748
+ if (!Array.isArray(data.data)) return [];
8749
+ return data.data.flatMap((item, index) => {
8750
+ const result = normalizeKnowledgeResult(item, `Result ${index + 1}`);
8751
+ return result ? [result] : [];
8752
+ });
8753
+ }
8754
+ function getRawKnowledgeData(data) {
8755
+ return data.data ?? data.output ?? null;
8756
+ }
8757
+ function getRetrieverQuery(data, language) {
8758
+ const input = data.input;
8759
+ if (isRecord2(input)) {
8760
+ return readString(input.query) ?? readString(input.input) ?? readString(input.question);
8761
+ }
8762
+ return readString(resolveLocalizedText(data.message, language)) ?? readString(input);
8763
+ }
8764
+ function hasKnowledgeRetrieverDetails(_content, data) {
8765
+ return isKnowledgeRetrieverComponent(_content, data);
8766
+ }
8767
+ function isKnowledgeRetrieverComponent(_content, data) {
8768
+ return normalizeToolToken(data.type) === "knowledges";
8769
+ }
8770
+ function KnowledgeRawDataBlock({ value }) {
8771
+ const { t } = useChatkitTranslation();
8772
+ const detected = detectJsonValue(value);
8773
+ if (detected.kind === "text") {
8774
+ return /* @__PURE__ */ jsx32(PlainTextBlock, { value: detected.text });
8775
+ }
8776
+ return /* @__PURE__ */ jsxs20(Tabs, { defaultValue: "tree", className: "min-w-0", children: [
8777
+ /* @__PURE__ */ jsxs20("div", { className: "mb-2 flex min-w-0 items-center justify-between gap-2", children: [
8778
+ /* @__PURE__ */ jsxs20("span", { className: "min-w-0 truncate text-[11px] text-muted-foreground", children: [
8779
+ t("message.toolGroup.jsonTitle"),
8780
+ " \xB7",
8781
+ " ",
8782
+ getJsonValueSummary(detected.value)
8783
+ ] }),
8784
+ /* @__PURE__ */ jsxs20(TabsList, { className: "rounded-md p-0.5", children: [
8785
+ /* @__PURE__ */ jsx32(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "tree", children: t("message.toolGroup.jsonTree") }),
8786
+ /* @__PURE__ */ jsx32(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "raw", children: t("message.toolGroup.jsonRaw") })
8787
+ ] })
8788
+ ] }),
8789
+ /* @__PURE__ */ jsx32(TabsContent, { value: "tree", className: "mt-0", children: /* @__PURE__ */ jsx32(JsonTreeView, { value: detected.value }) }),
8790
+ /* @__PURE__ */ jsx32(TabsContent, { value: "raw", className: "mt-0", children: /* @__PURE__ */ jsx32(RawJsonBlock, { raw: detected.raw }) })
8791
+ ] });
8792
+ }
8793
+ function KnowledgeRetrieverDetails({
8794
+ data
8795
+ }) {
8796
+ const { i18n: i18n2, t } = useChatkitTranslation();
8797
+ const query = getRetrieverQuery(data, i18n2.language);
8798
+ const results = getKnowledgeResults(data);
8799
+ const rawData = getRawKnowledgeData(data);
8800
+ const hasArrayData = Array.isArray(data.data);
8801
+ const hasRawFallback = rawData !== null && rawData !== void 0 && (!hasArrayData || Array.isArray(data.data) && data.data.length > 0 && results.length === 0);
8802
+ const showEmptyState = results.length === 0 && !hasRawFallback && data.status !== "running";
8803
+ return /* @__PURE__ */ jsxs20("div", { className: "min-w-0 space-y-3 px-3 py-2", children: [
8804
+ query ? /* @__PURE__ */ jsxs20("div", { className: "min-w-0 space-y-1", children: [
8805
+ /* @__PURE__ */ jsx32("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.knowledgeRetriever.queryTitle") }),
8806
+ /* @__PURE__ */ jsx32("div", { className: "min-w-0 whitespace-pre-wrap wrap-break-word rounded-md bg-muted/40 px-3 py-2 font-mono text-[12px] leading-5 text-foreground/80", children: query })
8807
+ ] }) : null,
8808
+ results.length > 0 ? /* @__PURE__ */ jsxs20("div", { className: "min-w-0 space-y-2", children: [
8809
+ /* @__PURE__ */ jsx32("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.knowledgeRetriever.resultsTitle", {
8810
+ count: results.length
8811
+ }) }),
8812
+ /* @__PURE__ */ jsx32("div", { className: "space-y-2", children: results.map((result, index) => /* @__PURE__ */ jsx32(
8813
+ KnowledgeResultCard,
8814
+ {
8815
+ result,
8816
+ index
8817
+ },
8818
+ result.id ?? `${result.title}-${index}`
8819
+ )) })
8820
+ ] }) : null,
8821
+ hasRawFallback ? /* @__PURE__ */ jsxs20("div", { className: "min-w-0 space-y-1", children: [
8822
+ /* @__PURE__ */ jsx32("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.knowledgeRetriever.rawDataTitle") }),
8823
+ /* @__PURE__ */ jsx32(KnowledgeRawDataBlock, { value: rawData })
8824
+ ] }) : null,
8825
+ showEmptyState ? /* @__PURE__ */ jsx32("div", { className: "rounded-md border border-dashed border-border/70 px-3 py-4 text-center text-xs text-muted-foreground", children: t("message.knowledgeRetriever.noResults") }) : null
8826
+ ] });
8827
+ }
8828
+ function KnowledgeResultCard({
8829
+ result,
8830
+ index
8831
+ }) {
8832
+ const { t } = useChatkitTranslation();
8833
+ const titleId = `knowledge-result-${index + 1}`;
8834
+ const metadata = [
8835
+ ...result.score ? [
8836
+ {
8837
+ key: t("message.knowledgeRetriever.scoreLabel"),
8838
+ value: result.score
8839
+ }
8840
+ ] : [],
8841
+ ...result.metadata
8842
+ ];
8843
+ const titleClassName = "min-w-0 line-clamp-2 text-sm font-medium leading-5 text-foreground";
8844
+ return /* @__PURE__ */ jsx32("article", { className: "min-w-0 rounded-md border border-border/60 bg-background/80 px-3 py-2", children: /* @__PURE__ */ jsxs20("div", { className: "flex min-w-0 items-start gap-2", children: [
8845
+ /* @__PURE__ */ jsx32("span", { className: "mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-medium text-muted-foreground", children: index + 1 }),
8846
+ /* @__PURE__ */ jsxs20("div", { className: "min-w-0 flex-1", children: [
8847
+ result.url ? /* @__PURE__ */ jsxs20(
8848
+ "a",
8849
+ {
8850
+ id: titleId,
8851
+ href: result.url,
8852
+ target: "_blank",
8853
+ rel: "noreferrer",
8854
+ className: cn(titleClassName, "hover:underline"),
8855
+ children: [
8856
+ result.title,
8857
+ result.lineRange ? /* @__PURE__ */ jsxs20("span", { className: "ml-1 text-muted-foreground", children: [
8858
+ "[",
8859
+ result.lineRange,
8860
+ "]"
8861
+ ] }) : null
8862
+ ]
8863
+ }
8864
+ ) : /* @__PURE__ */ jsxs20("div", { id: titleId, className: titleClassName, children: [
8865
+ result.title,
8866
+ result.lineRange ? /* @__PURE__ */ jsxs20("span", { className: "ml-1 text-muted-foreground", children: [
8867
+ "[",
8868
+ result.lineRange,
8869
+ "]"
8870
+ ] }) : null
8871
+ ] }),
8872
+ result.content ? /* @__PURE__ */ jsx32("p", { className: "mt-1 line-clamp-3 whitespace-pre-wrap text-xs leading-5 text-muted-foreground", children: result.content }) : null,
8873
+ metadata.length > 0 ? /* @__PURE__ */ jsx32(
8874
+ "div",
8875
+ {
8876
+ className: "mt-2 flex flex-wrap gap-1.5",
8877
+ "aria-labelledby": titleId,
8878
+ children: metadata.slice(0, 10).map((item) => /* @__PURE__ */ jsxs20(
8879
+ "span",
8880
+ {
8881
+ className: "inline-flex min-w-0 max-w-full items-center gap-1 rounded-md bg-muted/50 px-1.5 py-0.5 text-[11px] leading-4 text-muted-foreground",
8882
+ children: [
8883
+ /* @__PURE__ */ jsxs20("span", { className: "shrink-0 font-medium text-foreground/70", children: [
8884
+ item.key,
8885
+ ":"
8886
+ ] }),
8887
+ /* @__PURE__ */ jsx32("span", { className: "min-w-0 truncate font-mono", children: item.value })
8888
+ ]
8889
+ },
8890
+ `${item.key}:${item.value}`
8891
+ ))
8892
+ }
8893
+ ) : null
8894
+ ] })
8895
+ ] }) });
8896
+ }
8897
+
8898
+ // src/components/thread/messages/web-search-component-renderer.tsx
8899
+ import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
8900
+ var webSearchComponentRenderer = {
8901
+ id: "computer-web-search-sources",
8902
+ presentation: "grouped-step",
8903
+ match: isComputerWebSearchComponent,
8904
+ hasDetails: hasWebSearchSources,
8905
+ renderDetails: WebSearchToolCallOutput
8906
+ };
8907
+ function normalizeToolToken2(value) {
8908
+ if (typeof value !== "string") return null;
8909
+ const normalized = value.trim().toLowerCase().replace(/[\s-]+/g, "_");
8910
+ return normalized || null;
8911
+ }
8912
+ function readOptionalString(value) {
8913
+ if (typeof value !== "string") return void 0;
8914
+ const trimmed = value.trim();
8915
+ return trimmed || void 0;
8916
+ }
8917
+ function normalizeWebSearchSource(value) {
8918
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
8919
+ return null;
8920
+ }
8921
+ const candidate = value;
8922
+ const title = readOptionalString(candidate.title);
8923
+ const url = readOptionalString(candidate.url);
8924
+ if (!title || !url) return null;
8925
+ const content = readOptionalString(candidate.content);
8926
+ const description = readOptionalString(candidate.description);
8927
+ const publishedDate = readOptionalString(
8928
+ candidate.publishedDate ?? candidate.published_date ?? candidate.publishedAt
8929
+ );
8930
+ const author = readOptionalString(candidate.author);
8931
+ return {
8932
+ title,
8933
+ url,
8934
+ ...content ? { content } : {},
8935
+ ...description ? { description } : {},
8936
+ ...publishedDate ? { publishedDate } : {},
8937
+ ...author ? { author } : {}
8938
+ };
8939
+ }
8940
+ function getWebSearchSources(data) {
8941
+ if (!Array.isArray(data.data)) return [];
8942
+ return data.data.flatMap((item) => {
8943
+ const source = normalizeWebSearchSource(item);
8944
+ return source ? [source] : [];
8945
+ });
8946
+ }
8947
+ function hasWebSearchSources(_content, data) {
8948
+ return getWebSearchSources(data).length > 0;
8949
+ }
8950
+ function isComputerWebSearchComponent(_content, data) {
8951
+ const isComputer = data.category === "Computer";
8952
+ const isWebSearch = normalizeToolToken2(data.type) === "web_search";
8953
+ if (!isComputer || !isWebSearch) return false;
8954
+ return normalizeToolToken2(data.tool) === "web_search" || getWebSearchSources(data).length > 0;
8955
+ }
8956
+ function getSourceHost(url) {
8957
+ try {
8958
+ return new URL(url).hostname.replace(/^www\./, "") || null;
8959
+ } catch {
8960
+ return null;
8961
+ }
8962
+ }
8963
+ function WebSearchToolCallOutput({
8964
+ data
8965
+ }) {
8966
+ const { t } = useChatkitTranslation();
8967
+ const sources = getWebSearchSources(data);
8968
+ if (sources.length === 0 || data.error !== void 0) return null;
8969
+ return /* @__PURE__ */ jsxs21("div", { className: "space-y-2", children: [
8970
+ /* @__PURE__ */ jsx33("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.sourcesTitle") }),
8971
+ /* @__PURE__ */ jsx33("div", { className: "space-y-2", children: sources.map((source, index) => {
8972
+ const sourceHost = getSourceHost(source.url);
8973
+ const snippet = source.content ?? source.description;
8974
+ const metaParts = [
8975
+ sourceHost,
8976
+ source.publishedDate,
8977
+ source.author
8978
+ ].filter((item) => Boolean(item));
8979
+ return /* @__PURE__ */ jsxs21(
8980
+ "div",
8981
+ {
8982
+ className: "min-w-0 rounded-md border border-border/60 bg-background/80 px-3 py-2",
8983
+ children: [
8984
+ metaParts.length > 0 ? /* @__PURE__ */ jsx33("div", { className: "mb-1 truncate text-[11px] text-muted-foreground", children: metaParts.join(" / ") }) : null,
8985
+ /* @__PURE__ */ jsx33(
8986
+ "a",
8987
+ {
8988
+ href: source.url,
8989
+ target: "_blank",
8990
+ rel: "noreferrer",
8991
+ className: "block min-w-0 line-clamp-2 text-sm font-medium leading-5 text-foreground hover:underline",
8992
+ children: source.title
8993
+ }
8994
+ ),
8995
+ snippet ? /* @__PURE__ */ jsx33("p", { className: "mt-1 line-clamp-3 text-xs leading-5 text-muted-foreground", children: snippet }) : null
8996
+ ]
8997
+ },
8998
+ `${source.url}-${index}`
8999
+ );
9000
+ }) })
9001
+ ] });
9002
+ }
9003
+
9004
+ // src/components/thread/messages/component-message-renderers.tsx
9005
+ var COMPONENT_MESSAGE_RENDERERS = [
9006
+ knowledgeRetrieverComponentRenderer,
9007
+ webSearchComponentRenderer
9008
+ ];
9009
+ function getComponentMessageRenderer(content, data) {
9010
+ return COMPONENT_MESSAGE_RENDERERS.find(
9011
+ (renderer) => renderer.match(content, data)
9012
+ ) ?? null;
9013
+ }
9014
+ function getComponentMessagePresentation(content, data) {
9015
+ return getComponentMessageRenderer(content, data)?.presentation ?? null;
9016
+ }
9017
+ function hasComponentMessageRendererDetails(renderer, content, data) {
9018
+ if (!renderer?.renderDetails) return false;
9019
+ return renderer.hasDetails?.(content, data) ?? true;
9020
+ }
9021
+
9022
+ // src/components/thread/messages/tool-component-group.tsx
9023
+ import * as React29 from "react";
9024
+ import {
9025
+ BookOpen,
9026
+ Brain as Brain3,
9027
+ Building2,
9028
+ Check as Check3,
9029
+ CheckCircle2 as CheckCircle23,
9030
+ ChevronRight as ChevronRight7,
9031
+ CircleHelp,
9032
+ Copy,
9033
+ FileText as FileText2,
9034
+ Files,
9035
+ Loader2 as Loader24,
9036
+ ListTodo as ListTodo2,
9037
+ Network,
9038
+ Repeat2,
9039
+ Search as Search2,
9040
+ SquareTerminal,
9041
+ Wrench as Wrench2,
9042
+ XCircle as XCircle2
9043
+ } from "lucide-react";
9044
+ import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
9045
+ var toolStatusConfig = {
9046
+ success: {
9047
+ iconClass: "border-green-500 text-green-700",
9048
+ icon: CheckCircle23
9049
+ },
9050
+ fail: {
9051
+ iconClass: "border-red-500 text-red-700",
9052
+ icon: XCircle2
9053
+ },
9054
+ running: {
9055
+ iconClass: "border-blue-500 text-blue-700",
9056
+ icon: Loader24
9057
+ }
9058
+ };
9059
+ var TOOL_GROUP_CATEGORY_ORDER = [
9060
+ "files",
9061
+ "searches",
9062
+ "commands",
9063
+ "lists",
9064
+ "tasks",
9065
+ "knowledges",
9066
+ "tools"
9067
+ ];
9068
+ var TOOL_GROUP_TOKEN_CATEGORY = {
9069
+ file: "files",
9070
+ files: "files",
9071
+ web_search: "searches",
9072
+ search: "searches",
9073
+ searches: "searches",
9074
+ program: "commands",
9075
+ command: "commands",
9076
+ commands: "commands",
9077
+ shell: "commands",
9078
+ terminal: "commands",
9079
+ list: "lists",
9080
+ lists: "lists",
9081
+ task: "tasks",
9082
+ tasks: "tasks",
9083
+ todo: "tasks",
9084
+ todos: "tasks",
8040
9085
  knowledge: "knowledges",
8041
9086
  knowledges: "knowledges",
8042
9087
  retriever: "knowledges",
@@ -8083,7 +9128,7 @@ function getEffectiveToolStepStatus(data, isThreadRunning) {
8083
9128
  }
8084
9129
  return data.status;
8085
9130
  }
8086
- function formatStepDuration(durationMs) {
9131
+ function formatStepDuration2(durationMs) {
8087
9132
  if (durationMs < 1e3) {
8088
9133
  return `${durationMs}ms`;
8089
9134
  }
@@ -8102,10 +9147,10 @@ function formatStepDuration(durationMs) {
8102
9147
  return `${minutes}m ${seconds}s`;
8103
9148
  }
8104
9149
  function useFrozenTimestamp(shouldFreeze) {
8105
- const [frozenAt, setFrozenAt] = React28.useState(
9150
+ const [frozenAt, setFrozenAt] = React29.useState(
8106
9151
  () => shouldFreeze ? Date.now() : null
8107
9152
  );
8108
- React28.useEffect(() => {
9153
+ React29.useEffect(() => {
8109
9154
  if (shouldFreeze) {
8110
9155
  setFrozenAt((current) => current ?? Date.now());
8111
9156
  return;
@@ -8115,12 +9160,12 @@ function useFrozenTimestamp(shouldFreeze) {
8115
9160
  return frozenAt;
8116
9161
  }
8117
9162
  function useToolStepDurationLabel(data, options) {
8118
- const [durationNow, setDurationNow] = React28.useState(() => Date.now());
9163
+ const [durationNow, setDurationNow] = React29.useState(() => Date.now());
8119
9164
  const createdAt = parseStepDate(data.created_date);
8120
9165
  const explicitEndedAt = parseStepDate(data.end_date);
8121
9166
  const status = options?.status ?? data.status;
8122
9167
  const endedAt = explicitEndedAt ?? (status !== "running" ? options?.fallbackEndedAt ?? null : null);
8123
- React28.useEffect(() => {
9168
+ React29.useEffect(() => {
8124
9169
  if (status !== "running" || createdAt === null || endedAt !== null) {
8125
9170
  return;
8126
9171
  }
@@ -8134,43 +9179,47 @@ function useToolStepDurationLabel(data, options) {
8134
9179
  }, [createdAt, endedAt, status]);
8135
9180
  if (createdAt === null) return null;
8136
9181
  const durationMs = Math.max(0, (endedAt ?? durationNow) - createdAt);
8137
- return formatStepDuration(durationMs);
9182
+ return formatStepDuration2(durationMs);
8138
9183
  }
8139
- function isComponentContent(content) {
9184
+ function isComponentContent2(content) {
8140
9185
  return content.type === "component";
8141
9186
  }
8142
- function isTextContent(content) {
9187
+ function isTextContent2(content) {
8143
9188
  return content.type === "text";
8144
9189
  }
8145
- function isReasoningContent(content) {
9190
+ function isReasoningContent2(content) {
8146
9191
  return content.type === "reasoning";
8147
9192
  }
8148
9193
  function isWidgetComponent(content) {
8149
9194
  const data = content.data;
8150
9195
  return data?.type === "Widget" && Array.isArray(data.widgets);
8151
9196
  }
8152
- function isGroupableToolComponent(content) {
9197
+ function isGroupableStepComponent(content) {
8153
9198
  if (!content || typeof content === "string") return false;
8154
- return isComponentContent(content) && !isWidgetComponent(content) && getToolStepData(content).category === "Tool";
9199
+ if (!isComponentContent2(content) || isWidgetComponent(content)) return false;
9200
+ const data = getToolStepData(content);
9201
+ const renderer = getComponentMessageRenderer(content, data);
9202
+ if (renderer) return renderer.presentation === "grouped-step";
9203
+ return data.category === "Tool";
8155
9204
  }
8156
9205
  function isSkippableToolGroupSeparator(content) {
8157
9206
  if (typeof content === "string") return !content.trim();
8158
9207
  if (!content) return true;
8159
- if (isTextContent(content)) {
9208
+ if (isTextContent2(content)) {
8160
9209
  return !content.text?.trim();
8161
9210
  }
8162
- if (isReasoningContent(content)) {
9211
+ if (isReasoningContent2(content)) {
8163
9212
  return !content.text?.trim();
8164
9213
  }
8165
9214
  return false;
8166
9215
  }
8167
- function normalizeToolToken(value) {
9216
+ function normalizeToolToken3(value) {
8168
9217
  if (typeof value !== "string") return null;
8169
9218
  const normalized = value.trim().toLowerCase().replace(/[\s-]+/g, "_");
8170
9219
  return normalized || null;
8171
9220
  }
8172
9221
  function classifyToolToken(value) {
8173
- const normalized = normalizeToolToken(
9222
+ const normalized = normalizeToolToken3(
8174
9223
  typeof value === "string" ? value : resolveLocalizedText(value, "en-US")
8175
9224
  );
8176
9225
  if (!normalized) return null;
@@ -8209,8 +9258,8 @@ function getToolActivityLabel(content, language, statusOverride) {
8209
9258
  if (status === "running") {
8210
9259
  return message ?? title ?? tool ?? type ?? "Tool";
8211
9260
  }
8212
- const titleToken = normalizeToolToken(title);
8213
- const genericTitle = titleToken !== null && [tool, type].map((candidate) => normalizeToolToken(candidate)).some((candidate) => candidate === titleToken);
9261
+ const titleToken = normalizeToolToken3(title);
9262
+ const genericTitle = titleToken !== null && [tool, type].map((candidate) => normalizeToolToken3(candidate)).some((candidate) => candidate === titleToken);
8214
9263
  if (message && (!title || genericTitle)) {
8215
9264
  return message;
8216
9265
  }
@@ -8229,7 +9278,7 @@ function buildToolComponentRenderUnits(content, options) {
8229
9278
  const units = [];
8230
9279
  const pendingTools = [];
8231
9280
  content.forEach((item, index) => {
8232
- if (isGroupableToolComponent(item) && options?.shouldGroupComponent?.(item) !== false) {
9281
+ if (isGroupableStepComponent(item) && options?.shouldGroupComponent?.(item) !== false) {
8233
9282
  pendingTools.push({ item, index });
8234
9283
  return;
8235
9284
  }
@@ -8294,13 +9343,13 @@ function createToolsetAvatarUrl(toolsetId, apiUrl) {
8294
9343
  }
8295
9344
  }
8296
9345
  function shouldUseToolsetAvatar(toolset) {
8297
- const normalized = normalizeToolToken(toolset);
9346
+ const normalized = normalizeToolToken3(toolset);
8298
9347
  return normalized === "mcp" || normalized === "openapi";
8299
9348
  }
8300
9349
  function useToolsetAvatar(toolsetId, enabled, apiUrl) {
8301
9350
  const avatarUrl = enabled ? createToolsetAvatarUrl(toolsetId, apiUrl) : null;
8302
- const [avatar, setAvatar] = React28.useState(null);
8303
- React28.useEffect(() => {
9351
+ const [avatar, setAvatar] = React29.useState(null);
9352
+ React29.useEffect(() => {
8304
9353
  if (!avatarUrl) {
8305
9354
  setAvatar(null);
8306
9355
  return;
@@ -8332,7 +9381,7 @@ function ToolAvatarIcon({
8332
9381
  className
8333
9382
  }) {
8334
9383
  if (avatar.url) {
8335
- return /* @__PURE__ */ jsx31(
9384
+ return /* @__PURE__ */ jsx34(
8336
9385
  "img",
8337
9386
  {
8338
9387
  alt: "",
@@ -8345,7 +9394,7 @@ function ToolAvatarIcon({
8345
9394
  }
8346
9395
  const emoji = unicodeFromUnified2(avatar.emoji?.unified);
8347
9396
  if (emoji) {
8348
- return /* @__PURE__ */ jsx31(
9397
+ return /* @__PURE__ */ jsx34(
8349
9398
  "span",
8350
9399
  {
8351
9400
  "aria-hidden": "true",
@@ -8360,7 +9409,7 @@ function ToolAvatarIcon({
8360
9409
  }
8361
9410
  );
8362
9411
  }
8363
- return /* @__PURE__ */ jsx31(
9412
+ return /* @__PURE__ */ jsx34(
8364
9413
  CircleHelp,
8365
9414
  {
8366
9415
  className,
@@ -8370,7 +9419,7 @@ function ToolAvatarIcon({
8370
9419
  );
8371
9420
  }
8372
9421
  function getKnownToolsetIcon(toolset) {
8373
- const normalized = normalizeToolToken(toolset);
9422
+ const normalized = normalizeToolToken3(toolset);
8374
9423
  if (!normalized) return null;
8375
9424
  switch (normalized) {
8376
9425
  case "project":
@@ -8385,7 +9434,7 @@ function getKnownToolsetIcon(toolset) {
8385
9434
  case "memories":
8386
9435
  return Brain3;
8387
9436
  case "workflow_agent_tool":
8388
- return Wrench;
9437
+ return Wrench2;
8389
9438
  case "workflow_task":
8390
9439
  return Network;
8391
9440
  default:
@@ -8393,7 +9442,7 @@ function getKnownToolsetIcon(toolset) {
8393
9442
  }
8394
9443
  }
8395
9444
  function getStepTypeIcon(type) {
8396
- const normalized = normalizeToolToken(type);
9445
+ const normalized = normalizeToolToken3(type);
8397
9446
  if (!normalized) return null;
8398
9447
  switch (normalized) {
8399
9448
  case "file":
@@ -8402,6 +9451,8 @@ function getStepTypeIcon(type) {
8402
9451
  return Files;
8403
9452
  case "program":
8404
9453
  return SquareTerminal;
9454
+ case "web_search":
9455
+ return Search2;
8405
9456
  case "knowledges":
8406
9457
  return BookOpen;
8407
9458
  default:
@@ -8421,12 +9472,12 @@ function ToolStepIcon({
8421
9472
  apiUrl
8422
9473
  );
8423
9474
  const iconUrl = createToolsetIconUrl(data.toolset, organizationId, apiUrl);
8424
- const [failedIconUrl, setFailedIconUrl] = React28.useState(null);
8425
- React28.useEffect(() => {
9475
+ const [failedIconUrl, setFailedIconUrl] = React29.useState(null);
9476
+ React29.useEffect(() => {
8426
9477
  setFailedIconUrl(null);
8427
9478
  }, [iconUrl]);
8428
9479
  if (avatar) {
8429
- return /* @__PURE__ */ jsx31(
9480
+ return /* @__PURE__ */ jsx34(
8430
9481
  ToolAvatarIcon,
8431
9482
  {
8432
9483
  avatar,
@@ -8436,7 +9487,7 @@ function ToolStepIcon({
8436
9487
  );
8437
9488
  }
8438
9489
  if (iconUrl && failedIconUrl !== iconUrl) {
8439
- return /* @__PURE__ */ jsx31(
9490
+ return /* @__PURE__ */ jsx34(
8440
9491
  "img",
8441
9492
  {
8442
9493
  alt: "",
@@ -8450,7 +9501,7 @@ function ToolStepIcon({
8450
9501
  }
8451
9502
  const TypeIcon = getStepTypeIcon(data.type);
8452
9503
  if (TypeIcon) {
8453
- return /* @__PURE__ */ jsx31(
9504
+ return /* @__PURE__ */ jsx34(
8454
9505
  TypeIcon,
8455
9506
  {
8456
9507
  className,
@@ -8461,7 +9512,7 @@ function ToolStepIcon({
8461
9512
  }
8462
9513
  const ToolsetIcon = getKnownToolsetIcon(data.toolset);
8463
9514
  if (ToolsetIcon) {
8464
- return /* @__PURE__ */ jsx31(
9515
+ return /* @__PURE__ */ jsx34(
8465
9516
  ToolsetIcon,
8466
9517
  {
8467
9518
  className,
@@ -8471,7 +9522,7 @@ function ToolStepIcon({
8471
9522
  );
8472
9523
  }
8473
9524
  if (usesToolsetAvatar) {
8474
- return /* @__PURE__ */ jsx31(
9525
+ return /* @__PURE__ */ jsx34(
8475
9526
  CircleHelp,
8476
9527
  {
8477
9528
  className,
@@ -8480,7 +9531,7 @@ function ToolStepIcon({
8480
9531
  }
8481
9532
  );
8482
9533
  }
8483
- return /* @__PURE__ */ jsx31(
9534
+ return /* @__PURE__ */ jsx34(
8484
9535
  CircleHelp,
8485
9536
  {
8486
9537
  className,
@@ -8491,15 +9542,15 @@ function ToolStepIcon({
8491
9542
  }
8492
9543
  function ToolCallCopyButton({ value }) {
8493
9544
  const { t } = useChatkitTranslation();
8494
- const [isCopied, setIsCopied] = React28.useState(false);
8495
- const resetTimeoutRef = React28.useRef(null);
8496
- const clearResetTimeout = React28.useCallback(() => {
9545
+ const [isCopied, setIsCopied] = React29.useState(false);
9546
+ const resetTimeoutRef = React29.useRef(null);
9547
+ const clearResetTimeout = React29.useCallback(() => {
8497
9548
  if (resetTimeoutRef.current === null) return;
8498
9549
  window.clearTimeout(resetTimeoutRef.current);
8499
9550
  resetTimeoutRef.current = null;
8500
9551
  }, []);
8501
- React28.useEffect(() => clearResetTimeout, [clearResetTimeout]);
8502
- const handleCopy = React28.useCallback(() => {
9552
+ React29.useEffect(() => clearResetTimeout, [clearResetTimeout]);
9553
+ const handleCopy = React29.useCallback(() => {
8503
9554
  if (typeof navigator === "undefined" || !navigator.clipboard) return;
8504
9555
  void navigator.clipboard.writeText(value).then(() => {
8505
9556
  setIsCopied(true);
@@ -8511,7 +9562,7 @@ function ToolCallCopyButton({ value }) {
8511
9562
  }).catch(() => void 0);
8512
9563
  }, [clearResetTimeout, value]);
8513
9564
  const label = isCopied ? t("message.toolGroup.copied") : t("message.toolGroup.copy");
8514
- return /* @__PURE__ */ jsx31(
9565
+ return /* @__PURE__ */ jsx34(
8515
9566
  "button",
8516
9567
  {
8517
9568
  type: "button",
@@ -8519,7 +9570,7 @@ function ToolCallCopyButton({ value }) {
8519
9570
  "aria-label": label,
8520
9571
  title: label,
8521
9572
  onClick: handleCopy,
8522
- children: isCopied ? /* @__PURE__ */ jsx31(Check3, { className: "h-3.5 w-3.5", "aria-hidden": "true" }) : /* @__PURE__ */ jsx31(Copy, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
9573
+ children: isCopied ? /* @__PURE__ */ jsx34(Check3, { className: "h-3.5 w-3.5", "aria-hidden": "true" }) : /* @__PURE__ */ jsx34(Copy, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
8523
9574
  }
8524
9575
  );
8525
9576
  }
@@ -8530,28 +9581,28 @@ function ToolCallValueBlock({
8530
9581
  const { t } = useChatkitTranslation();
8531
9582
  const detected = detectJsonValue(value);
8532
9583
  if (detected.kind === "text") {
8533
- return /* @__PURE__ */ jsxs19("div", { className: "min-w-0 space-y-1", children: [
8534
- /* @__PURE__ */ jsx31("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx31(ToolCallCopyButton, { value: detected.text }) }),
8535
- /* @__PURE__ */ jsx31(PlainTextBlock, { value: detected.text, destructive })
9584
+ return /* @__PURE__ */ jsxs22("div", { className: "min-w-0 space-y-1", children: [
9585
+ /* @__PURE__ */ jsx34("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx34(ToolCallCopyButton, { value: detected.text }) }),
9586
+ /* @__PURE__ */ jsx34(PlainTextBlock, { value: detected.text, destructive })
8536
9587
  ] });
8537
9588
  }
8538
- return /* @__PURE__ */ jsxs19(Tabs, { defaultValue: "tree", className: "min-w-0", children: [
8539
- /* @__PURE__ */ jsxs19("div", { className: "mb-2 flex min-w-0 items-center justify-between gap-2", children: [
8540
- /* @__PURE__ */ jsxs19("span", { className: "min-w-0 truncate text-[11px] text-muted-foreground", children: [
9589
+ return /* @__PURE__ */ jsxs22(Tabs, { defaultValue: "tree", className: "min-w-0", children: [
9590
+ /* @__PURE__ */ jsxs22("div", { className: "mb-2 flex min-w-0 items-center justify-between gap-2", children: [
9591
+ /* @__PURE__ */ jsxs22("span", { className: "min-w-0 truncate text-[11px] text-muted-foreground", children: [
8541
9592
  t("message.toolGroup.jsonTitle"),
8542
9593
  " \xB7 ",
8543
9594
  getJsonValueSummary(detected.value)
8544
9595
  ] }),
8545
- /* @__PURE__ */ jsxs19("div", { className: "flex shrink-0 items-center gap-1", children: [
8546
- /* @__PURE__ */ jsx31(ToolCallCopyButton, { value: detected.raw }),
8547
- /* @__PURE__ */ jsxs19(TabsList, { className: "rounded-md p-0.5", children: [
8548
- /* @__PURE__ */ jsx31(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "tree", children: t("message.toolGroup.jsonTree") }),
8549
- /* @__PURE__ */ jsx31(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "raw", children: t("message.toolGroup.jsonRaw") })
9596
+ /* @__PURE__ */ jsxs22("div", { className: "flex shrink-0 items-center gap-1", children: [
9597
+ /* @__PURE__ */ jsx34(ToolCallCopyButton, { value: detected.raw }),
9598
+ /* @__PURE__ */ jsxs22(TabsList, { className: "rounded-md p-0.5", children: [
9599
+ /* @__PURE__ */ jsx34(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "tree", children: t("message.toolGroup.jsonTree") }),
9600
+ /* @__PURE__ */ jsx34(TabsTrigger, { className: "px-2 py-0.5 text-[11px]", value: "raw", children: t("message.toolGroup.jsonRaw") })
8550
9601
  ] })
8551
9602
  ] })
8552
9603
  ] }),
8553
- /* @__PURE__ */ jsx31(TabsContent, { value: "tree", className: "mt-0", children: /* @__PURE__ */ jsx31(JsonTreeView, { value: detected.value }) }),
8554
- /* @__PURE__ */ jsx31(TabsContent, { value: "raw", className: "mt-0", children: /* @__PURE__ */ jsx31(RawJsonBlock, { raw: detected.raw }) })
9604
+ /* @__PURE__ */ jsx34(TabsContent, { value: "tree", className: "mt-0", children: /* @__PURE__ */ jsx34(JsonTreeView, { value: detected.value }) }),
9605
+ /* @__PURE__ */ jsx34(TabsContent, { value: "raw", className: "mt-0", children: /* @__PURE__ */ jsx34(RawJsonBlock, { raw: detected.raw }) })
8555
9606
  ] });
8556
9607
  }
8557
9608
  function DefaultToolCallOutput({ data }) {
@@ -8559,31 +9610,37 @@ function DefaultToolCallOutput({ data }) {
8559
9610
  const output = data.output ?? null;
8560
9611
  const error = data.error ?? null;
8561
9612
  if (error) {
8562
- return /* @__PURE__ */ jsxs19("div", { className: "space-y-1", children: [
8563
- /* @__PURE__ */ jsx31("div", { className: "text-[11px] font-medium text-destructive", children: t("message.toolGroup.errorTitle") }),
8564
- /* @__PURE__ */ jsx31(ToolCallValueBlock, { value: error, destructive: true })
9613
+ return /* @__PURE__ */ jsxs22("div", { className: "space-y-1", children: [
9614
+ /* @__PURE__ */ jsx34("div", { className: "text-[11px] font-medium text-destructive", children: t("message.toolGroup.errorTitle") }),
9615
+ /* @__PURE__ */ jsx34(ToolCallValueBlock, { value: error, destructive: true })
8565
9616
  ] });
8566
9617
  }
8567
9618
  if (output === null) return null;
8568
- return /* @__PURE__ */ jsxs19("div", { className: "space-y-1", children: [
8569
- /* @__PURE__ */ jsx31("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.outputTitle") }),
8570
- /* @__PURE__ */ jsx31(ToolCallValueBlock, { value: output })
9619
+ return /* @__PURE__ */ jsxs22("div", { className: "space-y-1", children: [
9620
+ /* @__PURE__ */ jsx34("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.outputTitle") }),
9621
+ /* @__PURE__ */ jsx34(ToolCallValueBlock, { value: output })
8571
9622
  ] });
8572
9623
  }
8573
9624
  function ToolCallDetails({ content }) {
8574
9625
  const { t } = useChatkitTranslation();
8575
9626
  const data = getToolStepData(content);
9627
+ const renderer = getComponentMessageRenderer(content, data);
9628
+ const hasCustomDetails = data.error === void 0 && hasComponentMessageRendererDetails(renderer, content, data);
9629
+ const CustomDetailsRenderer = hasCustomDetails ? renderer?.renderDetails : void 0;
9630
+ if (CustomDetailsRenderer) {
9631
+ return /* @__PURE__ */ jsx34("div", { className: "ml-6 mt-1 max-h-60 overflow-auto rounded-md bg-muted/30 text-xs text-muted-foreground", children: /* @__PURE__ */ jsx34(CustomDetailsRenderer, { content, data }) });
9632
+ }
8576
9633
  const OutputRenderer = getToolCallOutputRenderer(data);
8577
9634
  const hasInput = data.input !== void 0 && data.input !== null;
8578
9635
  const hasOutput = data.error !== void 0 || data.output !== void 0;
8579
9636
  if (!hasInput && !hasOutput) return null;
8580
- return /* @__PURE__ */ jsxs19("div", { className: "ml-6 mt-1 max-h-60 overflow-auto rounded-md bg-muted/30 px-3 py-2 text-xs text-muted-foreground", children: [
8581
- hasInput && /* @__PURE__ */ jsxs19("div", { className: "space-y-1", children: [
8582
- /* @__PURE__ */ jsx31("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.inputTitle") }),
8583
- /* @__PURE__ */ jsx31(ToolCallValueBlock, { value: data.input })
9637
+ return /* @__PURE__ */ jsxs22("div", { className: "ml-6 mt-1 max-h-60 overflow-auto rounded-md bg-muted/30 px-3 py-2 text-xs text-muted-foreground", children: [
9638
+ hasInput && /* @__PURE__ */ jsxs22("div", { className: "space-y-1", children: [
9639
+ /* @__PURE__ */ jsx34("div", { className: "text-[11px] font-medium text-muted-foreground", children: t("message.toolGroup.inputTitle") }),
9640
+ /* @__PURE__ */ jsx34(ToolCallValueBlock, { value: data.input })
8584
9641
  ] }),
8585
- hasInput && hasOutput ? /* @__PURE__ */ jsx31("div", { className: "h-2" }) : null,
8586
- hasOutput ? /* @__PURE__ */ jsx31(OutputRenderer, { content, data }) : null
9642
+ hasInput && hasOutput ? /* @__PURE__ */ jsx34("div", { className: "h-2" }) : null,
9643
+ hasOutput ? /* @__PURE__ */ jsx34(OutputRenderer, { content, data }) : null
8587
9644
  ] });
8588
9645
  }
8589
9646
  function areToolCallRowPropsEqual(previous, next) {
@@ -8599,9 +9656,11 @@ function ToolCallRowContent({
8599
9656
  const data = getToolStepData(content);
8600
9657
  const status = getEffectiveToolStepStatus(data, isThreadRunning);
8601
9658
  const hasError = status === "fail" || Boolean(data.error);
8602
- const label = getToolActivityLabel(content, i18n2.language, status);
8603
- const detailsId = React28.useId();
8604
- const hasDetails = data.input !== void 0 || data.error !== void 0 || data.output !== void 0;
9659
+ const detailsId = React29.useId();
9660
+ const renderer = getComponentMessageRenderer(content, data);
9661
+ const label = renderer?.getTitle?.(content, data, i18n2.language) ?? getToolActivityLabel(content, i18n2.language, status);
9662
+ const hasCustomDetails = data.error === void 0 && hasComponentMessageRendererDetails(renderer, content, data);
9663
+ const hasDetails = data.input !== void 0 || data.error !== void 0 || data.output !== void 0 || hasCustomDetails;
8605
9664
  const fallbackEndedAt = useFrozenTimestamp(
8606
9665
  data.status === "running" && status === "fail"
8607
9666
  );
@@ -8609,14 +9668,14 @@ function ToolCallRowContent({
8609
9668
  status,
8610
9669
  fallbackEndedAt
8611
9670
  });
8612
- const [isExpanded, setIsExpanded] = React28.useState(false);
8613
- React28.useEffect(() => {
9671
+ const [isExpanded, setIsExpanded] = React29.useState(false);
9672
+ React29.useEffect(() => {
8614
9673
  if (status === "running" && data.output !== void 0) {
8615
9674
  setIsExpanded(true);
8616
9675
  }
8617
9676
  }, [data.output, status]);
8618
- return /* @__PURE__ */ jsxs19("li", { className: "min-w-0", children: [
8619
- /* @__PURE__ */ jsxs19(
9677
+ return /* @__PURE__ */ jsxs22("li", { className: "ck-tool-call-row-enter min-w-0", children: [
9678
+ /* @__PURE__ */ jsxs22(
8620
9679
  "button",
8621
9680
  {
8622
9681
  type: "button",
@@ -8633,7 +9692,7 @@ function ToolCallRowContent({
8633
9692
  if (hasDetails) setIsExpanded((prev) => !prev);
8634
9693
  },
8635
9694
  children: [
8636
- status ? /* @__PURE__ */ jsx31(
9695
+ status ? /* @__PURE__ */ jsx34(
8637
9696
  ToolStepIcon,
8638
9697
  {
8639
9698
  data,
@@ -8644,8 +9703,8 @@ function ToolCallRowContent({
8644
9703
  hasError ? "text-destructive" : "text-muted-foreground"
8645
9704
  )
8646
9705
  }
8647
- ) : /* @__PURE__ */ jsx31("span", { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
8648
- /* @__PURE__ */ jsx31(
9706
+ ) : /* @__PURE__ */ jsx34("span", { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
9707
+ /* @__PURE__ */ jsx34(
8649
9708
  "span",
8650
9709
  {
8651
9710
  className: cn(
@@ -8656,9 +9715,9 @@ function ToolCallRowContent({
8656
9715
  children: label
8657
9716
  }
8658
9717
  ),
8659
- durationLabel ? /* @__PURE__ */ jsx31("span", { className: "shrink-0 text-[11px] tabular-nums text-muted-foreground/80", children: durationLabel }) : null,
8660
- hasDetails ? /* @__PURE__ */ jsx31(
8661
- ChevronRight6,
9718
+ durationLabel ? /* @__PURE__ */ jsx34("span", { className: "shrink-0 text-[11px] tabular-nums text-muted-foreground/80", children: durationLabel }) : null,
9719
+ hasDetails ? /* @__PURE__ */ jsx34(
9720
+ ChevronRight7,
8662
9721
  {
8663
9722
  "aria-hidden": "true",
8664
9723
  className: cn(
@@ -8670,10 +9729,10 @@ function ToolCallRowContent({
8670
9729
  ]
8671
9730
  }
8672
9731
  ),
8673
- hasDetails && isExpanded ? /* @__PURE__ */ jsx31("div", { id: detailsId, children: /* @__PURE__ */ jsx31(ToolCallDetails, { content }) }) : null
9732
+ hasDetails && isExpanded ? /* @__PURE__ */ jsx34("div", { id: detailsId, children: /* @__PURE__ */ jsx34(ToolCallDetails, { content }) }) : null
8674
9733
  ] });
8675
9734
  }
8676
- var ToolCallRow = React28.memo(ToolCallRowContent, areToolCallRowPropsEqual);
9735
+ var ToolCallRow = React29.memo(ToolCallRowContent, areToolCallRowPropsEqual);
8677
9736
  ToolCallRow.displayName = "ToolCallRow";
8678
9737
  function ToolComponentGroup({
8679
9738
  items,
@@ -8683,8 +9742,8 @@ function ToolComponentGroup({
8683
9742
  apiUrl
8684
9743
  }) {
8685
9744
  const { t } = useChatkitTranslation();
8686
- const contentId = React28.useId();
8687
- const [isExpanded, setIsExpanded] = React28.useState(!hasFollowingItem);
9745
+ const contentId = React29.useId();
9746
+ const [isExpanded, setIsExpanded] = React29.useState(!hasFollowingItem);
8688
9747
  const categoryCounts = getToolGroupCategoryCounts(items);
8689
9748
  const categorySummary = TOOL_GROUP_CATEGORY_ORDER.flatMap((category) => {
8690
9749
  const count = categoryCounts[category] ?? 0;
@@ -8699,11 +9758,11 @@ function ToolComponentGroup({
8699
9758
  const summary = `${t("message.toolGroup.status.success")} ${categorySummary}`;
8700
9759
  const config = toolStatusConfig.success;
8701
9760
  const StatusIcon = config.icon;
8702
- React28.useEffect(() => {
9761
+ React29.useEffect(() => {
8703
9762
  setIsExpanded(!hasFollowingItem);
8704
- }, [hasFollowingItem, items.length]);
8705
- return /* @__PURE__ */ jsxs19("div", { className: "px-1 py-1", children: [
8706
- /* @__PURE__ */ jsxs19(
9763
+ }, [hasFollowingItem]);
9764
+ return /* @__PURE__ */ jsxs22("div", { className: "px-1 py-1", children: [
9765
+ /* @__PURE__ */ jsxs22(
8707
9766
  "button",
8708
9767
  {
8709
9768
  type: "button",
@@ -8712,8 +9771,8 @@ function ToolComponentGroup({
8712
9771
  "aria-controls": contentId,
8713
9772
  onClick: () => setIsExpanded((prev) => !prev),
8714
9773
  children: [
8715
- /* @__PURE__ */ jsxs19("div", { className: "flex min-w-0 items-center gap-2 text-sm font-medium text-muted-foreground", children: [
8716
- /* @__PURE__ */ jsx31(
9774
+ /* @__PURE__ */ jsxs22("div", { className: "flex min-w-0 items-center gap-2 text-sm font-medium text-muted-foreground", children: [
9775
+ /* @__PURE__ */ jsx34(
8717
9776
  StatusIcon,
8718
9777
  {
8719
9778
  className: cn(
@@ -8722,10 +9781,10 @@ function ToolComponentGroup({
8722
9781
  )
8723
9782
  }
8724
9783
  ),
8725
- /* @__PURE__ */ jsx31("span", { className: "truncate", children: summary })
9784
+ /* @__PURE__ */ jsx34("span", { className: "truncate", children: summary })
8726
9785
  ] }),
8727
- /* @__PURE__ */ jsx31(
8728
- ChevronRight6,
9786
+ /* @__PURE__ */ jsx34(
9787
+ ChevronRight7,
8729
9788
  {
8730
9789
  "aria-hidden": "true",
8731
9790
  className: cn(
@@ -8737,7 +9796,7 @@ function ToolComponentGroup({
8737
9796
  ]
8738
9797
  }
8739
9798
  ),
8740
- isExpanded && /* @__PURE__ */ jsx31("ul", { id: contentId, className: "mt-2 space-y-1.5 overflow-y-auto pr-1", children: items.map((item, index) => /* @__PURE__ */ jsx31(
9799
+ isExpanded && /* @__PURE__ */ jsx34("ul", { id: contentId, className: "mt-2 space-y-1.5 overflow-y-auto pr-1", children: items.map((item, index) => /* @__PURE__ */ jsx34(
8741
9800
  ToolCallRow,
8742
9801
  {
8743
9802
  content: item,
@@ -8756,12 +9815,12 @@ import {
8756
9815
  REQUEST_USER_INPUT_RESULT_TYPE as REQUEST_USER_INPUT_RESULT_TYPE2,
8757
9816
  REQUEST_USER_INPUT_TOOL_NAME as REQUEST_USER_INPUT_TOOL_NAME2
8758
9817
  } from "@xpert-ai/chatkit-types";
8759
- import { CheckCircle2 as CheckCircle23 } from "lucide-react";
8760
- import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
8761
- function isRecord2(value) {
9818
+ import { CheckCircle2 as CheckCircle24 } from "lucide-react";
9819
+ import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
9820
+ function isRecord3(value) {
8762
9821
  return !!value && typeof value === "object" && !Array.isArray(value);
8763
9822
  }
8764
- function readString(record, keys) {
9823
+ function readString2(record, keys) {
8765
9824
  for (const key of keys) {
8766
9825
  const value = record[key];
8767
9826
  if (typeof value === "string" && value.trim()) {
@@ -8771,12 +9830,12 @@ function readString(record, keys) {
8771
9830
  return null;
8772
9831
  }
8773
9832
  function getToolCallId(value) {
8774
- if (!isRecord2(value)) return null;
8775
- return readString(value, ["id"]);
9833
+ if (!isRecord3(value)) return null;
9834
+ return readString2(value, ["id"]);
8776
9835
  }
8777
9836
  function getToolCallName(value) {
8778
- if (!isRecord2(value)) return null;
8779
- return readString(value, ["name"]);
9837
+ if (!isRecord3(value)) return null;
9838
+ return readString2(value, ["name"]);
8780
9839
  }
8781
9840
  function pushClientToolCallsFromRecord(record, calls) {
8782
9841
  const clientToolCalls = record.clientToolCalls;
@@ -8800,16 +9859,16 @@ function findRequestUserInputClientToolCallById(messages, id) {
8800
9859
  ) ?? null;
8801
9860
  }
8802
9861
  function normalizeAnswer(value) {
8803
- if (!isRecord2(value)) return null;
8804
- const id = readString(value, ["id"]);
8805
- const question = readString(value, ["question"]);
8806
- const answerValue = readString(value, ["value"]);
8807
- const type = readString(value, ["type"]);
9862
+ if (!isRecord3(value)) return null;
9863
+ const id = readString2(value, ["id"]);
9864
+ const question = readString2(value, ["question"]);
9865
+ const answerValue = readString2(value, ["value"]);
9866
+ const type = readString2(value, ["type"]);
8808
9867
  if (!id || !question || !answerValue || type !== "option" && type !== "other") {
8809
9868
  return null;
8810
9869
  }
8811
- const label = readString(value, ["label"]);
8812
- const description = readString(value, ["description"]);
9870
+ const label = readString2(value, ["label"]);
9871
+ const description = readString2(value, ["description"]);
8813
9872
  return {
8814
9873
  id,
8815
9874
  question,
@@ -8828,7 +9887,7 @@ function parseResultOutput(output) {
8828
9887
  return null;
8829
9888
  }
8830
9889
  }
8831
- if (!isRecord2(result) || !Array.isArray(result.answers)) {
9890
+ if (!isRecord3(result) || !Array.isArray(result.answers)) {
8832
9891
  return null;
8833
9892
  }
8834
9893
  const hasExplicitType = result.type === REQUEST_USER_INPUT_RESULT_TYPE2;
@@ -8842,7 +9901,7 @@ function parseResultOutput(output) {
8842
9901
  };
8843
9902
  }
8844
9903
  function getRequestUserInputResultCardData(content, messages) {
8845
- const data = isRecord2(content.data) ? content.data : null;
9904
+ const data = isRecord3(content.data) ? content.data : null;
8846
9905
  if (data?.status !== "success") {
8847
9906
  return null;
8848
9907
  }
@@ -8869,7 +9928,7 @@ function RequestUserInputResultCard({
8869
9928
  className
8870
9929
  }) {
8871
9930
  const { t } = useChatkitTranslation();
8872
- return /* @__PURE__ */ jsxs20(
9931
+ return /* @__PURE__ */ jsxs23(
8873
9932
  "section",
8874
9933
  {
8875
9934
  "aria-label": t("message.requestUserInputResult.title"),
@@ -8878,23 +9937,23 @@ function RequestUserInputResultCard({
8878
9937
  className
8879
9938
  ),
8880
9939
  children: [
8881
- /* @__PURE__ */ jsxs20("div", { className: "mb-2 flex items-center gap-2 text-sm font-semibold text-foreground", children: [
8882
- /* @__PURE__ */ jsx32(CheckCircle23, { className: "h-4 w-4 text-primary" }),
8883
- /* @__PURE__ */ jsx32("span", { children: t("message.requestUserInputResult.title") })
9940
+ /* @__PURE__ */ jsxs23("div", { className: "mb-2 flex items-center gap-2 text-sm font-semibold text-foreground", children: [
9941
+ /* @__PURE__ */ jsx35(CheckCircle24, { className: "h-4 w-4 text-primary" }),
9942
+ /* @__PURE__ */ jsx35("span", { children: t("message.requestUserInputResult.title") })
8884
9943
  ] }),
8885
- /* @__PURE__ */ jsx32("div", { className: "space-y-2", children: result.answers.map((answer, index) => /* @__PURE__ */ jsxs20(
9944
+ /* @__PURE__ */ jsx35("div", { className: "space-y-2", children: result.answers.map((answer, index) => /* @__PURE__ */ jsxs23(
8886
9945
  "div",
8887
9946
  {
8888
9947
  className: "rounded-md bg-background/70 px-2.5 py-2",
8889
9948
  children: [
8890
- /* @__PURE__ */ jsx32("div", { className: "text-xs font-medium leading-5 text-muted-foreground", children: answer.question }),
8891
- /* @__PURE__ */ jsxs20("div", { className: "mt-0.5 flex min-w-0 flex-wrap items-center gap-1.5", children: [
8892
- /* @__PURE__ */ jsx32("span", { className: "min-w-0 wrap-break-word text-sm font-semibold text-foreground", children: answer.label ?? answer.value }),
8893
- /* @__PURE__ */ jsx32("span", { className: "rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground", children: t(
9949
+ /* @__PURE__ */ jsx35("div", { className: "text-xs font-medium leading-5 text-muted-foreground", children: answer.question }),
9950
+ /* @__PURE__ */ jsxs23("div", { className: "mt-0.5 flex min-w-0 flex-wrap items-center gap-1.5", children: [
9951
+ /* @__PURE__ */ jsx35("span", { className: "min-w-0 wrap-break-word text-sm font-semibold text-foreground", children: answer.label ?? answer.value }),
9952
+ /* @__PURE__ */ jsx35("span", { className: "rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground", children: t(
8894
9953
  answer.type === "other" ? "message.requestUserInputResult.other" : "message.requestUserInputResult.option"
8895
9954
  ) })
8896
9955
  ] }),
8897
- answer.description ? /* @__PURE__ */ jsx32("div", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: answer.description }) : null
9956
+ answer.description ? /* @__PURE__ */ jsx35("div", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: answer.description }) : null
8898
9957
  ]
8899
9958
  },
8900
9959
  `${answer.id}-${index}`
@@ -8906,18 +9965,18 @@ function RequestUserInputResultCard({
8906
9965
 
8907
9966
  // src/components/thread/messages/widget.tsx
8908
9967
  import { SurfaceRenderer } from "@xpert-ai/a2ui-react";
8909
- import { jsx as jsx33 } from "react/jsx-runtime";
9968
+ import { jsx as jsx36 } from "react/jsx-runtime";
8910
9969
  function WidgetMessage({ messageId, data }) {
8911
9970
  const widgets = Array.isArray(data.widgets) ? data.widgets : [];
8912
9971
  if (widgets.length === 0) return null;
8913
9972
  const baseSurfaceId = `widget-${messageId}`;
8914
- return /* @__PURE__ */ jsx33("div", { className: "space-y-3", children: widgets.map((widget, index) => {
9973
+ return /* @__PURE__ */ jsx36("div", { className: "space-y-3", children: widgets.map((widget, index) => {
8915
9974
  const config = widget?.config;
8916
9975
  if (!config || typeof config !== "object") {
8917
9976
  return null;
8918
9977
  }
8919
9978
  const surfaceId = widgets.length > 1 ? `${baseSurfaceId}-${index}` : baseSurfaceId;
8920
- return /* @__PURE__ */ jsx33(
9979
+ return /* @__PURE__ */ jsx36(
8921
9980
  SurfaceRenderer,
8922
9981
  {
8923
9982
  surfaceId,
@@ -8929,17 +9988,18 @@ function WidgetMessage({ messageId, data }) {
8929
9988
  }
8930
9989
 
8931
9990
  // src/components/thread/messages/ai.tsx
8932
- import { jsx as jsx34, jsxs as jsxs21 } from "react/jsx-runtime";
8933
- function isTextContent2(content) {
9991
+ import { jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
9992
+ var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
9993
+ function isTextContent3(content) {
8934
9994
  return content.type === "text";
8935
9995
  }
8936
- function isReasoningContent2(content) {
9996
+ function isReasoningContent3(content) {
8937
9997
  return content.type === "reasoning";
8938
9998
  }
8939
9999
  function isImageContent(content) {
8940
10000
  return content.type === "image_url";
8941
10001
  }
8942
- function isComponentContent2(content) {
10002
+ function isComponentContent3(content) {
8943
10003
  return content.type === "component";
8944
10004
  }
8945
10005
  function isWidgetComponent2(content) {
@@ -8949,24 +10009,24 @@ function isWidgetComponent2(content) {
8949
10009
  function isMemoryContent(content) {
8950
10010
  return content.type === "memory";
8951
10011
  }
8952
- function safeJson2(value) {
10012
+ function safeJson3(value) {
8953
10013
  try {
8954
10014
  return JSON.stringify(value, null, 2);
8955
10015
  } catch {
8956
10016
  return String(value);
8957
10017
  }
8958
10018
  }
8959
- function formatDisplayValue2(value) {
8960
- return typeof value === "string" ? value : safeJson2(value);
10019
+ function formatDisplayValue3(value) {
10020
+ return typeof value === "string" ? value : safeJson3(value);
8961
10021
  }
8962
10022
  function ReasoningBlock({ reasoning }) {
8963
10023
  const blocks = reasoning.filter((item) => item.text?.trim());
8964
10024
  if (blocks.length === 0) return null;
8965
- return /* @__PURE__ */ jsx34("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ jsx34(
10025
+ return /* @__PURE__ */ jsx37("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ jsx37(
8966
10026
  "div",
8967
10027
  {
8968
10028
  className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
8969
- children: /* @__PURE__ */ jsx34("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
10029
+ children: /* @__PURE__ */ jsx37("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
8970
10030
  },
8971
10031
  item.id ?? `reasoning-${index}`
8972
10032
  )) });
@@ -8974,20 +10034,20 @@ function ReasoningBlock({ reasoning }) {
8974
10034
  function ImageBlock({ content }) {
8975
10035
  const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
8976
10036
  if (!imageUrl) {
8977
- return /* @__PURE__ */ jsxs21(Card, { children: [
8978
- /* @__PURE__ */ jsx34(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ jsx34(CardTitle, { className: "text-sm", children: "Image" }) }),
8979
- /* @__PURE__ */ jsx34(CardContent, { className: "text-xs text-muted-foreground", children: safeJson2(content) })
10037
+ return /* @__PURE__ */ jsxs24(Card, { children: [
10038
+ /* @__PURE__ */ jsx37(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ jsx37(CardTitle, { className: "text-sm", children: "Image" }) }),
10039
+ /* @__PURE__ */ jsx37(CardContent, { className: "text-xs text-muted-foreground", children: safeJson3(content) })
8980
10040
  ] });
8981
10041
  }
8982
- return /* @__PURE__ */ jsx34("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ jsx34("img", { src: imageUrl, alt: "Assistant output", className: "h-auto w-full object-cover" }) });
10042
+ return /* @__PURE__ */ jsx37("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ jsx37("img", { src: imageUrl, alt: "Assistant output", className: "h-auto w-full object-cover" }) });
8983
10043
  }
8984
10044
  function MemoryBlock({ content }) {
8985
- return /* @__PURE__ */ jsxs21(Card, { children: [
8986
- /* @__PURE__ */ jsxs21(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
8987
- /* @__PURE__ */ jsx34(CardTitle, { className: "text-sm", children: "Memory" }),
8988
- /* @__PURE__ */ jsx34(Badge, { variant: "secondary", children: "Memory" })
10045
+ return /* @__PURE__ */ jsxs24(Card, { children: [
10046
+ /* @__PURE__ */ jsxs24(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
10047
+ /* @__PURE__ */ jsx37(CardTitle, { className: "text-sm", children: "Memory" }),
10048
+ /* @__PURE__ */ jsx37(Badge, { variant: "secondary", children: "Memory" })
8989
10049
  ] }),
8990
- /* @__PURE__ */ jsx34(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx34("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson2(content.data ?? []) }) })
10050
+ /* @__PURE__ */ jsx37(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx37("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson3(content.data ?? []) }) })
8991
10051
  ] });
8992
10052
  }
8993
10053
  function parseStepDate2(value) {
@@ -9001,7 +10061,7 @@ function parseStepDate2(value) {
9001
10061
  const timestamp = Date.parse(value);
9002
10062
  return Number.isNaN(timestamp) ? null : timestamp;
9003
10063
  }
9004
- function formatStepDuration2(durationMs) {
10064
+ function formatStepDuration3(durationMs) {
9005
10065
  if (durationMs < 1e3) {
9006
10066
  return `${durationMs}ms`;
9007
10067
  }
@@ -9021,11 +10081,11 @@ function formatStepDuration2(durationMs) {
9021
10081
  }
9022
10082
  function ComponentBlock({ content }) {
9023
10083
  const { i18n: i18n2 } = useChatkitTranslation();
9024
- const [isExpanded, setIsExpanded] = React30.useState(false);
9025
- const contentRef = React30.useRef(null);
9026
- const shouldAutoScrollRef = React30.useRef(true);
9027
- const previousScrollTopRef = React30.useRef(0);
9028
- const [durationNow, setDurationNow] = React30.useState(() => Date.now());
10084
+ const [isExpanded, setIsExpanded] = React31.useState(false);
10085
+ const contentRef = React31.useRef(null);
10086
+ const shouldAutoScrollRef = React31.useRef(true);
10087
+ const previousScrollTopRef = React31.useRef(0);
10088
+ const [durationNow, setDurationNow] = React31.useState(() => Date.now());
9029
10089
  const data = getToolStepData(content);
9030
10090
  const category = data.category ?? "Component";
9031
10091
  const title = getToolActivityLabel(content, i18n2.language);
@@ -9038,11 +10098,11 @@ function ComponentBlock({ content }) {
9038
10098
  const createdAt = parseStepDate2(data.created_date);
9039
10099
  const endedAt = parseStepDate2(data.end_date);
9040
10100
  const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
9041
- const durationLabel = durationMs === null ? null : formatStepDuration2(durationMs);
9042
- React30.useEffect(() => {
10101
+ const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
10102
+ React31.useEffect(() => {
9043
10103
  if (status === "running" && output !== null) setIsExpanded(true);
9044
10104
  }, [status, output]);
9045
- React30.useEffect(() => {
10105
+ React31.useEffect(() => {
9046
10106
  if (status !== "running" || createdAt === null || endedAt !== null) {
9047
10107
  return;
9048
10108
  }
@@ -9054,7 +10114,7 @@ function ComponentBlock({ content }) {
9054
10114
  window.clearInterval(timer);
9055
10115
  };
9056
10116
  }, [createdAt, endedAt, status]);
9057
- React30.useEffect(() => {
10117
+ React31.useEffect(() => {
9058
10118
  const element = contentRef.current;
9059
10119
  if (!element) return;
9060
10120
  previousScrollTopRef.current = element.scrollTop;
@@ -9074,7 +10134,7 @@ function ComponentBlock({ content }) {
9074
10134
  element.removeEventListener("scroll", updateAutoScrollState);
9075
10135
  };
9076
10136
  }, [isExpanded]);
9077
- React30.useEffect(() => {
10137
+ React31.useEffect(() => {
9078
10138
  if (status !== "running") {
9079
10139
  shouldAutoScrollRef.current = true;
9080
10140
  return;
@@ -9087,24 +10147,24 @@ function ComponentBlock({ content }) {
9087
10147
  }, [isExpanded, output, status]);
9088
10148
  const config = status ? toolStatusConfig[status] : null;
9089
10149
  const StatusIcon = config?.icon;
9090
- return /* @__PURE__ */ jsxs21(Card, { children: [
9091
- /* @__PURE__ */ jsxs21(CardHeader, { className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
9092
- /* @__PURE__ */ jsxs21("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
9093
- status && StatusIcon && /* @__PURE__ */ jsx34(StatusIcon, { className: cn("h-4 w-4", config?.iconClass, status === "running" && "animate-spin") }),
9094
- /* @__PURE__ */ jsx34(CardTitle, { className: "text-sm truncate", children: title })
10150
+ return /* @__PURE__ */ jsxs24(Card, { children: [
10151
+ /* @__PURE__ */ jsxs24(CardHeader, { className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
10152
+ /* @__PURE__ */ jsxs24("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
10153
+ status && StatusIcon && /* @__PURE__ */ jsx37(StatusIcon, { className: cn("h-4 w-4", config?.iconClass, status === "running" && "animate-spin") }),
10154
+ /* @__PURE__ */ jsx37(CardTitle, { className: "text-sm truncate", children: title })
9095
10155
  ] }),
9096
- /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
9097
- durationLabel && /* @__PURE__ */ jsxs21("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
9098
- /* @__PURE__ */ jsx34(Clock3, { className: "h-3 w-3" }),
9099
- /* @__PURE__ */ jsx34("span", { children: durationLabel })
10156
+ /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
10157
+ durationLabel && /* @__PURE__ */ jsxs24("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
10158
+ /* @__PURE__ */ jsx37(Clock32, { className: "h-3 w-3" }),
10159
+ /* @__PURE__ */ jsx37("span", { children: durationLabel })
9100
10160
  ] }),
9101
- /* @__PURE__ */ jsx34(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
9102
- /* @__PURE__ */ jsx34(
10161
+ /* @__PURE__ */ jsx37(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
10162
+ /* @__PURE__ */ jsx37(
9103
10163
  "button",
9104
10164
  {
9105
10165
  className: "text-muted-foreground hover:text-foreground transition-colors",
9106
10166
  "aria-label": isExpanded ? "Collapse" : "Expand",
9107
- children: /* @__PURE__ */ jsx34(
10167
+ children: /* @__PURE__ */ jsx37(
9108
10168
  ChevronDown4,
9109
10169
  {
9110
10170
  className: cn("h-4 w-4 transition-transform", isExpanded && "rotate-180")
@@ -9114,85 +10174,174 @@ function ComponentBlock({ content }) {
9114
10174
  )
9115
10175
  ] })
9116
10176
  ] }),
9117
- isExpanded && /* @__PURE__ */ jsxs21(CardContent, { ref: contentRef, className: "text-xs text-muted-foreground max-h-60 overflow-auto", children: [
9118
- data.input && /* @__PURE__ */ jsx34("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue2(data.input) }),
9119
- error ? /* @__PURE__ */ jsx34("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue2(error) }) : hasOutput && /* @__PURE__ */ jsx34("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue2(fallback) })
10177
+ isExpanded && /* @__PURE__ */ jsxs24(CardContent, { ref: contentRef, className: "text-xs text-muted-foreground max-h-60 overflow-auto", children: [
10178
+ data.input && /* @__PURE__ */ jsx37("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(data.input) }),
10179
+ error ? /* @__PURE__ */ jsx37("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue3(error) }) : hasOutput && /* @__PURE__ */ jsx37("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(fallback) })
9120
10180
  ] })
9121
10181
  ] });
9122
10182
  }
9123
10183
  function UnknownBlock({ content }) {
9124
- return /* @__PURE__ */ jsxs21(Card, { children: [
9125
- /* @__PURE__ */ jsxs21(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
9126
- /* @__PURE__ */ jsx34(CardTitle, { className: "text-sm", children: "Assistant Content" }),
9127
- /* @__PURE__ */ jsx34(Badge, { variant: "outline", children: content.type ?? "unknown" })
10184
+ return /* @__PURE__ */ jsxs24(Card, { children: [
10185
+ /* @__PURE__ */ jsxs24(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
10186
+ /* @__PURE__ */ jsx37(CardTitle, { className: "text-sm", children: "Assistant Content" }),
10187
+ /* @__PURE__ */ jsx37(Badge, { variant: "outline", children: content.type ?? "unknown" })
9128
10188
  ] }),
9129
- /* @__PURE__ */ jsx34(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx34("pre", { className: "whitespace-pre-wrap break-words", children: safeJson2(content) }) })
10189
+ /* @__PURE__ */ jsx37(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx37("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
9130
10190
  ] });
9131
10191
  }
9132
- function renderContentItem(content, index, message, lookupMessages) {
10192
+ function renderContentItem(content, index, message, lookupMessages, options) {
9133
10193
  const messageId = message.id;
10194
+ const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
9134
10195
  if (typeof content === "string") {
9135
- return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(MarkdownText, { children: content }) }, `text-${index}`);
10196
+ return /* @__PURE__ */ jsx37("div", { className: textClassName, children: /* @__PURE__ */ jsx37(MarkdownText, { children: content }) }, `text-${index}`);
9136
10197
  }
9137
- if (isTextContent2(content)) {
9138
- return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
10198
+ if (isTextContent3(content)) {
10199
+ return /* @__PURE__ */ jsx37("div", { className: textClassName, children: /* @__PURE__ */ jsx37(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
9139
10200
  }
9140
- if (isReasoningContent2(content)) {
9141
- return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
10201
+ if (isReasoningContent3(content)) {
10202
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
9142
10203
  }
9143
10204
  if (isImageContent(content)) {
9144
- return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(ImageBlock, { content }) }, content.id ?? `image-${index}`);
10205
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(ImageBlock, { content }) }, content.id ?? `image-${index}`);
9145
10206
  }
9146
- if (isComponentContent2(content)) {
10207
+ if (isComponentContent3(content)) {
9147
10208
  const requestUserInputResult = getRequestUserInputResultCardData(
9148
10209
  content,
9149
10210
  lookupMessages
9150
10211
  );
9151
10212
  if (requestUserInputResult) {
9152
- return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
10213
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
9153
10214
  }
9154
10215
  if (isWidgetComponent2(content)) {
9155
- return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
10216
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
10217
+ }
10218
+ if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
10219
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(
10220
+ ToolComponentGroup,
10221
+ {
10222
+ items: [content],
10223
+ hasFollowingItem: false,
10224
+ isThreadRunning: options?.isThreadRunning,
10225
+ organizationId: options?.organizationId,
10226
+ apiUrl: options?.apiUrl
10227
+ }
10228
+ ) }, content.id ?? `component-group-${index}`);
9156
10229
  }
9157
- return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
10230
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
9158
10231
  }
9159
10232
  if (isMemoryContent(content)) {
9160
- return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
10233
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
10234
+ }
10235
+ if (isAgentEventContent(content)) {
10236
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
9161
10237
  }
9162
- return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
10238
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
9163
10239
  }
9164
10240
  function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
9165
10241
  if (unit.type === "item") {
9166
- return renderContentItem(unit.item, unit.index, message, lookupMessages);
10242
+ return renderContentItem(unit.item, unit.index, message, lookupMessages, {
10243
+ isThreadRunning: options?.isThreadRunning,
10244
+ organizationId: options?.organizationId,
10245
+ apiUrl: options?.apiUrl,
10246
+ isAgentOutput: options?.isAgentOutput
10247
+ });
9167
10248
  }
9168
- return /* @__PURE__ */ jsx34(
9169
- "div",
10249
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(
10250
+ ToolComponentGroup,
9170
10251
  {
9171
- children: /* @__PURE__ */ jsx34(
9172
- ToolComponentGroup,
10252
+ items: unit.items,
10253
+ hasFollowingItem,
10254
+ isThreadRunning: options?.isThreadRunning,
10255
+ organizationId: options?.organizationId,
10256
+ apiUrl: options?.apiUrl
10257
+ }
10258
+ ) }, `tool-group-${unit.startIndex}-${unit.items[0]?.id ?? "tool"}`);
10259
+ }
10260
+ function renderEntryBatch(entries, message, lookupMessages, hasFollowingItem, options) {
10261
+ if (entries.length === 0) return null;
10262
+ const renderUnits = buildToolComponentRenderUnits(
10263
+ entries.map((entry) => entry.item),
10264
+ {
10265
+ shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
10266
+ }
10267
+ );
10268
+ return renderUnits.map(
10269
+ (unit, index) => renderContentUnit(
10270
+ unit,
10271
+ message,
10272
+ lookupMessages,
10273
+ index < renderUnits.length - 1 || hasFollowingItem,
10274
+ options
10275
+ )
10276
+ );
10277
+ }
10278
+ function renderAssistantRenderUnits(units, message, lookupMessages, options, depth = 0) {
10279
+ const rendered = [];
10280
+ let entryBatch = [];
10281
+ const flushEntries = (hasFollowingItem) => {
10282
+ if (entryBatch.length === 0) return;
10283
+ const batch = entryBatch;
10284
+ entryBatch = [];
10285
+ rendered.push(
10286
+ /* @__PURE__ */ jsx37(React31.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
10287
+ ...options,
10288
+ isAgentOutput: depth > 0
10289
+ }) }, `entries-${batch[0]?.order ?? rendered.length}`)
10290
+ );
10291
+ };
10292
+ units.forEach((unit, index) => {
10293
+ const hasFollowingItem = index < units.length - 1;
10294
+ if (unit.type === "entry") {
10295
+ entryBatch.push(unit.entry);
10296
+ if (!hasFollowingItem) {
10297
+ flushEntries(false);
10298
+ }
10299
+ return;
10300
+ }
10301
+ flushEntries(true);
10302
+ rendered.push(
10303
+ /* @__PURE__ */ jsx37(
10304
+ AgentRunGroup,
9173
10305
  {
9174
- items: unit.items,
10306
+ node: unit.node,
9175
10307
  hasFollowingItem,
9176
- isThreadRunning: options?.isThreadRunning,
9177
- organizationId: options?.organizationId,
9178
- apiUrl: options?.apiUrl
9179
- }
10308
+ depth,
10309
+ renderUnits: (childUnits, nextDepth) => renderAssistantRenderUnits(
10310
+ childUnits,
10311
+ message,
10312
+ lookupMessages,
10313
+ options,
10314
+ nextDepth
10315
+ )
10316
+ },
10317
+ unit.node.id
9180
10318
  )
9181
- },
9182
- `tool-group-${unit.startIndex}-${unit.items[0]?.id ?? "tool"}-${unit.items.length}`
9183
- );
10319
+ );
10320
+ });
10321
+ return rendered;
9184
10322
  }
9185
10323
  function renderContent(message, lookupMessages, options) {
10324
+ const renderTree = buildAssistantRenderTree(
10325
+ message
10326
+ );
10327
+ if (renderTree.hasAgentRuns) {
10328
+ return /* @__PURE__ */ jsx37("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
10329
+ renderTree.units,
10330
+ message,
10331
+ lookupMessages,
10332
+ options
10333
+ ) });
10334
+ }
9186
10335
  const content = message.content;
9187
10336
  if (typeof content === "string") {
9188
10337
  if (!content.trim()) return null;
9189
- return /* @__PURE__ */ jsx34(MarkdownText, { children: content });
10338
+ return /* @__PURE__ */ jsx37(MarkdownText, { children: content });
9190
10339
  }
9191
10340
  if (!Array.isArray(content) || content.length === 0) return null;
9192
10341
  const renderUnits = buildToolComponentRenderUnits(content, {
9193
10342
  shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
9194
10343
  });
9195
- return /* @__PURE__ */ jsx34("div", { className: "space-y-3", children: renderUnits.map(
10344
+ return /* @__PURE__ */ jsx37("div", { className: "space-y-3", children: renderUnits.map(
9196
10345
  (unit, index) => renderContentUnit(
9197
10346
  unit,
9198
10347
  message,
@@ -9212,20 +10361,29 @@ function AssistantStreamingIndicator({
9212
10361
  thinking: t("message.thinking"),
9213
10362
  answering: t("message.answering")
9214
10363
  };
9215
- return /* @__PURE__ */ jsxs21("div", { className: cn("flex items-center gap-2 text-xs text-muted-foreground", className), children: [
9216
- status === "loading" && /* @__PURE__ */ jsx34(Loader24, { className: "h-3.5 w-3.5 animate-spin" }),
9217
- status === "thinking" && /* @__PURE__ */ jsxs21("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
9218
- /* @__PURE__ */ jsx34("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
9219
- /* @__PURE__ */ jsx34("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
9220
- /* @__PURE__ */ jsx34("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
9221
- ] }),
9222
- status === "answering" && /* @__PURE__ */ jsxs21("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
9223
- /* @__PURE__ */ jsx34("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
9224
- /* @__PURE__ */ jsx34("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
9225
- /* @__PURE__ */ jsx34("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
9226
- ] }),
9227
- /* @__PURE__ */ jsx34("span", { children: labelMap[status] })
9228
- ] });
10364
+ return /* @__PURE__ */ jsxs24(
10365
+ "div",
10366
+ {
10367
+ className: cn(
10368
+ "flex items-center gap-2 text-xs text-muted-foreground",
10369
+ className
10370
+ ),
10371
+ children: [
10372
+ status === "loading" && /* @__PURE__ */ jsx37(Loader25, { className: "h-3.5 w-3.5 animate-spin" }),
10373
+ status === "thinking" && /* @__PURE__ */ jsxs24("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
10374
+ /* @__PURE__ */ jsx37("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
10375
+ /* @__PURE__ */ jsx37("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
10376
+ /* @__PURE__ */ jsx37("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
10377
+ ] }),
10378
+ status === "answering" && /* @__PURE__ */ jsxs24("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
10379
+ /* @__PURE__ */ jsx37("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
10380
+ /* @__PURE__ */ jsx37("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
10381
+ /* @__PURE__ */ jsx37("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
10382
+ ] }),
10383
+ /* @__PURE__ */ jsx37("span", { children: labelMap[status] })
10384
+ ]
10385
+ }
10386
+ );
9229
10387
  }
9230
10388
  function AssistantMessage({
9231
10389
  message,
@@ -9238,8 +10396,12 @@ function AssistantMessage({
9238
10396
  apiUrl
9239
10397
  }) {
9240
10398
  const { t } = useChatkitTranslation();
9241
- const hasContent = hasRenderableMessageContent(message.content);
9242
- const hasReasoning = hasRenderableReasoning(message.reasoning);
10399
+ const renderTree = buildAssistantRenderTree(
10400
+ message
10401
+ );
10402
+ const rootReasoning = renderTree.hasAgentRuns ? renderTree.rootReasoning : message.reasoning;
10403
+ const hasContent = hasRenderableMessageContent(message.content) || renderTree.hasAgentRuns;
10404
+ const hasReasoning = hasRenderableReasoning(rootReasoning);
9243
10405
  const resolvedStreamingStatus = streamingStatus ?? getAssistantStreamingStatus(message, isStreaming);
9244
10406
  const lookupMessages = messages?.length ? messages : [message];
9245
10407
  const answerNode = renderContent(message, lookupMessages, {
@@ -9247,42 +10409,42 @@ function AssistantMessage({
9247
10409
  organizationId,
9248
10410
  apiUrl
9249
10411
  });
9250
- const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx34(ReasoningBlock, { reasoning: message.reasoning ?? [] }) : null;
9251
- if (!hasRenderableAssistantMessage(message) && !resolvedStreamingStatus) return null;
10412
+ const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx37(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
10413
+ if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
9252
10414
  const streamingClass = isStreaming ? "streaming-active" : "";
9253
- if (!hasRenderableAssistantMessage(message) && resolvedStreamingStatus) {
9254
- return /* @__PURE__ */ jsx34("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ jsx34(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
10415
+ if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
10416
+ return /* @__PURE__ */ jsx37("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ jsx37(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
9255
10417
  }
9256
10418
  if (hasContent && hasReasoning) {
9257
- return /* @__PURE__ */ jsxs21("div", { className: cn("space-y-3", streamingClass, className), children: [
9258
- /* @__PURE__ */ jsxs21(
10419
+ return /* @__PURE__ */ jsxs24("div", { className: cn("space-y-3", streamingClass, className), children: [
10420
+ /* @__PURE__ */ jsxs24(
9259
10421
  Tabs,
9260
10422
  {
9261
10423
  defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
9262
10424
  className: "w-full",
9263
10425
  children: [
9264
- /* @__PURE__ */ jsxs21(TabsList, { className: "", children: [
9265
- /* @__PURE__ */ jsx34(TabsTrigger, { value: "answer", children: t("message.answer") }),
9266
- /* @__PURE__ */ jsx34(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
10426
+ /* @__PURE__ */ jsxs24(TabsList, { className: "", children: [
10427
+ /* @__PURE__ */ jsx37(TabsTrigger, { value: "answer", children: t("message.answer") }),
10428
+ /* @__PURE__ */ jsx37(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
9267
10429
  ] }),
9268
- /* @__PURE__ */ jsx34(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
9269
- /* @__PURE__ */ jsx34(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
10430
+ /* @__PURE__ */ jsx37(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
10431
+ /* @__PURE__ */ jsx37(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
9270
10432
  ]
9271
10433
  }
9272
10434
  ),
9273
- resolvedStreamingStatus ? /* @__PURE__ */ jsx34(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
10435
+ resolvedStreamingStatus ? /* @__PURE__ */ jsx37(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
9274
10436
  ] });
9275
10437
  }
9276
- return /* @__PURE__ */ jsxs21("div", { className: cn("space-y-3", streamingClass, className), children: [
10438
+ return /* @__PURE__ */ jsxs24("div", { className: cn("space-y-3", streamingClass, className), children: [
9277
10439
  hasReasoning ? reasoningNode : answerNode,
9278
- resolvedStreamingStatus ? /* @__PURE__ */ jsx34(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
10440
+ resolvedStreamingStatus ? /* @__PURE__ */ jsx37(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
9279
10441
  ] });
9280
10442
  }
9281
10443
 
9282
10444
  // src/components/thread/MessageActions.tsx
9283
- import * as React31 from "react";
10445
+ import * as React32 from "react";
9284
10446
  import { Check as Check4, Copy as Copy2, RefreshCw } from "lucide-react";
9285
- import { jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
10447
+ import { jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
9286
10448
  function MessageActions({
9287
10449
  content,
9288
10450
  isAssistant = false,
@@ -9291,7 +10453,7 @@ function MessageActions({
9291
10453
  className
9292
10454
  }) {
9293
10455
  const { t } = useChatkitTranslation();
9294
- const [copied, setCopied] = React31.useState(false);
10456
+ const [copied, setCopied] = React32.useState(false);
9295
10457
  const handleCopy = async () => {
9296
10458
  try {
9297
10459
  await navigator.clipboard.writeText(content);
@@ -9304,7 +10466,7 @@ function MessageActions({
9304
10466
  if (isStreaming) {
9305
10467
  return null;
9306
10468
  }
9307
- return /* @__PURE__ */ jsxs22(
10469
+ return /* @__PURE__ */ jsxs25(
9308
10470
  "div",
9309
10471
  {
9310
10472
  className: cn(
@@ -9312,7 +10474,7 @@ function MessageActions({
9312
10474
  className
9313
10475
  ),
9314
10476
  children: [
9315
- /* @__PURE__ */ jsx35(
10477
+ /* @__PURE__ */ jsx38(
9316
10478
  "button",
9317
10479
  {
9318
10480
  type: "button",
@@ -9322,17 +10484,17 @@ function MessageActions({
9322
10484
  copied && "text-green-500"
9323
10485
  ),
9324
10486
  title: copied ? t("messageActions.copied") : t("messageActions.copy"),
9325
- children: copied ? /* @__PURE__ */ jsx35(Check4, { size: 14 }) : /* @__PURE__ */ jsx35(Copy2, { size: 14 })
10487
+ children: copied ? /* @__PURE__ */ jsx38(Check4, { size: 14 }) : /* @__PURE__ */ jsx38(Copy2, { size: 14 })
9326
10488
  }
9327
10489
  ),
9328
- isAssistant && onRetry && /* @__PURE__ */ jsx35(
10490
+ isAssistant && onRetry && /* @__PURE__ */ jsx38(
9329
10491
  "button",
9330
10492
  {
9331
10493
  type: "button",
9332
10494
  onClick: onRetry,
9333
10495
  className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
9334
10496
  title: t("messageActions.regenerate"),
9335
- children: /* @__PURE__ */ jsx35(RefreshCw, { size: 14 })
10497
+ children: /* @__PURE__ */ jsx38(RefreshCw, { size: 14 })
9336
10498
  }
9337
10499
  )
9338
10500
  ]
@@ -9349,22 +10511,22 @@ import {
9349
10511
  HelpCircle,
9350
10512
  Lightbulb as Lightbulb2,
9351
10513
  Pencil as Pencil3,
9352
- Search as Search2,
10514
+ Search as Search3,
9353
10515
  Sparkles as Sparkles3,
9354
10516
  Zap
9355
10517
  } from "lucide-react";
9356
- import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
10518
+ import { jsx as jsx39, jsxs as jsxs26 } from "react/jsx-runtime";
9357
10519
  function getIconComponent2(icon) {
9358
10520
  const iconMap = {
9359
- "circle-question": /* @__PURE__ */ jsx36(HelpCircle, { size: 20 }),
9360
- "lightbulb": /* @__PURE__ */ jsx36(Lightbulb2, { size: 20 }),
9361
- "sparkle": /* @__PURE__ */ jsx36(Sparkles3, { size: 20 }),
9362
- "write": /* @__PURE__ */ jsx36(Pencil3, { size: 20 }),
9363
- "search": /* @__PURE__ */ jsx36(Search2, { size: 20 }),
9364
- "globe": /* @__PURE__ */ jsx36(Globe2, { size: 20 }),
9365
- "book-open": /* @__PURE__ */ jsx36(BookOpen2, { size: 20 }),
9366
- "compass": /* @__PURE__ */ jsx36(Compass, { size: 20 }),
9367
- "bolt": /* @__PURE__ */ jsx36(Zap, { size: 20 })
10521
+ "circle-question": /* @__PURE__ */ jsx39(HelpCircle, { size: 20 }),
10522
+ "lightbulb": /* @__PURE__ */ jsx39(Lightbulb2, { size: 20 }),
10523
+ "sparkle": /* @__PURE__ */ jsx39(Sparkles3, { size: 20 }),
10524
+ "write": /* @__PURE__ */ jsx39(Pencil3, { size: 20 }),
10525
+ "search": /* @__PURE__ */ jsx39(Search3, { size: 20 }),
10526
+ "globe": /* @__PURE__ */ jsx39(Globe2, { size: 20 }),
10527
+ "book-open": /* @__PURE__ */ jsx39(BookOpen2, { size: 20 }),
10528
+ "compass": /* @__PURE__ */ jsx39(Compass, { size: 20 }),
10529
+ "bolt": /* @__PURE__ */ jsx39(Zap, { size: 20 })
9368
10530
  };
9369
10531
  return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
9370
10532
  }
@@ -9372,9 +10534,9 @@ function StartScreen({ startScreen, onPromptClick, className }) {
9372
10534
  const { t } = useChatkitTranslation();
9373
10535
  const greeting = startScreen?.greeting ?? t("startScreen.greeting");
9374
10536
  const prompts = startScreen?.prompts ?? [];
9375
- return /* @__PURE__ */ jsxs23("div", { className: cn("flex flex-col items-center justify-center py-12 px-4", className), children: [
9376
- /* @__PURE__ */ jsx36("div", { className: "mb-8 text-center", children: /* @__PURE__ */ jsx36("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
9377
- prompts.length > 0 && /* @__PURE__ */ jsx36("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ jsx36("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ jsxs23(
10537
+ return /* @__PURE__ */ jsxs26("div", { className: cn("flex flex-col items-center justify-center py-12 px-4", className), children: [
10538
+ /* @__PURE__ */ jsx39("div", { className: "mb-8 text-center", children: /* @__PURE__ */ jsx39("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
10539
+ prompts.length > 0 && /* @__PURE__ */ jsx39("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ jsx39("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ jsxs26(
9378
10540
  "button",
9379
10541
  {
9380
10542
  type: "button",
@@ -9385,8 +10547,8 @@ function StartScreen({ startScreen, onPromptClick, className }) {
9385
10547
  "focus:outline-none focus:ring-2 focus:ring-primary/20"
9386
10548
  ),
9387
10549
  children: [
9388
- /* @__PURE__ */ jsx36("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
9389
- /* @__PURE__ */ jsx36("span", { className: "text-sm font-medium text-foreground", children: item.label })
10550
+ /* @__PURE__ */ jsx39("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
10551
+ /* @__PURE__ */ jsx39("span", { className: "text-sm font-medium text-foreground", children: item.label })
9390
10552
  ]
9391
10553
  },
9392
10554
  `prompt-${index}`
@@ -9395,7 +10557,7 @@ function StartScreen({ startScreen, onPromptClick, className }) {
9395
10557
  }
9396
10558
 
9397
10559
  // src/hooks/useThreads.ts
9398
- import * as React33 from "react";
10560
+ import * as React34 from "react";
9399
10561
  var DEFAULT_LIMIT = 50;
9400
10562
  var getThreadTitle = (threadRecord) => {
9401
10563
  const title = threadRecord.title?.trim();
@@ -9448,16 +10610,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
9448
10610
  isLoading: isStreamLoading,
9449
10611
  error: streamError
9450
10612
  } = useStreamContext();
9451
- const [threadRecords, setThreadRecords] = React33.useState([]);
9452
- const [isLoading, setIsLoading] = React33.useState(false);
9453
- const [error, setError] = React33.useState(null);
9454
- const upsertThreadRecord = React33.useCallback((threadRecord) => {
10613
+ const [threadRecords, setThreadRecords] = React34.useState([]);
10614
+ const [isLoading, setIsLoading] = React34.useState(false);
10615
+ const [error, setError] = React34.useState(null);
10616
+ const upsertThreadRecord = React34.useCallback((threadRecord) => {
9455
10617
  setThreadRecords((prev) => {
9456
10618
  const next = prev.filter((item) => item.id !== threadRecord.id);
9457
10619
  return sortThreadRecords([threadRecord, ...next]);
9458
10620
  });
9459
10621
  }, []);
9460
- const refreshThreads = React33.useCallback(async () => {
10622
+ const refreshThreads = React34.useCallback(async () => {
9461
10623
  setIsLoading(true);
9462
10624
  setError(null);
9463
10625
  try {
@@ -9473,7 +10635,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
9473
10635
  setIsLoading(false);
9474
10636
  }
9475
10637
  }, [client, limit, assistantId]);
9476
- const createThread = React33.useCallback(
10638
+ const createThread = React34.useCallback(
9477
10639
  async (input) => {
9478
10640
  setError(null);
9479
10641
  const payload = {};
@@ -9487,7 +10649,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
9487
10649
  },
9488
10650
  [client, upsertThreadRecord]
9489
10651
  );
9490
- const updateThread = React33.useCallback(
10652
+ const updateThread = React34.useCallback(
9491
10653
  async (recordId, payload) => {
9492
10654
  setError(null);
9493
10655
  const updated = await client.conversations.update(recordId, payload);
@@ -9496,7 +10658,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
9496
10658
  },
9497
10659
  [client, upsertThreadRecord]
9498
10660
  );
9499
- const deleteThread = React33.useCallback(
10661
+ const deleteThread = React34.useCallback(
9500
10662
  async (recordId) => {
9501
10663
  setError(null);
9502
10664
  await client.conversations.delete(recordId);
@@ -9504,11 +10666,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
9504
10666
  },
9505
10667
  [client]
9506
10668
  );
9507
- React33.useEffect(() => {
10669
+ React34.useEffect(() => {
9508
10670
  if (!isReady) return;
9509
10671
  void refreshThreads();
9510
10672
  }, [refreshThreads, isReady]);
9511
- React33.useEffect(() => {
10673
+ React34.useEffect(() => {
9512
10674
  if (!threadId || !isStreamLoading) return;
9513
10675
  const now = (/* @__PURE__ */ new Date()).toISOString();
9514
10676
  const busyStatus = "busy";
@@ -9529,7 +10691,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
9529
10691
  return changed ? sortThreadRecords(next) : prev;
9530
10692
  });
9531
10693
  }, [threadId, isStreamLoading]);
9532
- React33.useEffect(() => {
10694
+ React34.useEffect(() => {
9533
10695
  const message = getErrorMessage(streamError)?.trim();
9534
10696
  if (!threadId || !message) return;
9535
10697
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -9551,7 +10713,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
9551
10713
  return changed ? sortThreadRecords(next) : prev;
9552
10714
  });
9553
10715
  }, [threadId, streamError]);
9554
- React33.useEffect(() => {
10716
+ React34.useEffect(() => {
9555
10717
  if (!isReady || !threadId || isStreamLoading) return;
9556
10718
  let cancelled = false;
9557
10719
  void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
@@ -9565,7 +10727,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
9565
10727
  cancelled = true;
9566
10728
  };
9567
10729
  }, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
9568
- const threads = React33.useMemo(
10730
+ const threads = React34.useMemo(
9569
10731
  () => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
9570
10732
  [threadRecords]
9571
10733
  );
@@ -9582,10 +10744,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
9582
10744
  }
9583
10745
 
9584
10746
  // src/components/thread/context-usage-indicator.tsx
9585
- import * as React34 from "react";
10747
+ import * as React35 from "react";
9586
10748
 
9587
10749
  // src/components/ui/progress-circle.tsx
9588
- import { jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
10750
+ import { jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
9589
10751
  function clamp2(input, a, b) {
9590
10752
  return Math.max(Math.min(input, Math.max(a, b)), Math.min(a, b));
9591
10753
  }
@@ -9608,7 +10770,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
9608
10770
  return (
9609
10771
  // biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
9610
10772
  // biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
9611
- /* @__PURE__ */ jsxs24(
10773
+ /* @__PURE__ */ jsxs27(
9612
10774
  "svg",
9613
10775
  {
9614
10776
  role: "progressbar",
@@ -9619,8 +10781,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
9619
10781
  "aria-valuemax": 100,
9620
10782
  ...restSvgProps,
9621
10783
  children: [
9622
- /* @__PURE__ */ jsx37("circle", { ...commonParams, className: "stroke-current/25" }),
9623
- /* @__PURE__ */ jsx37(
10784
+ /* @__PURE__ */ jsx40("circle", { ...commonParams, className: "stroke-current/25" }),
10785
+ /* @__PURE__ */ jsx40(
9624
10786
  "circle",
9625
10787
  {
9626
10788
  ...commonParams,
@@ -9639,7 +10801,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
9639
10801
  };
9640
10802
 
9641
10803
  // src/components/thread/context-usage-indicator.tsx
9642
- import { jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
10804
+ import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
9643
10805
  var kNumberFormatter = new Intl.NumberFormat("en-US", {
9644
10806
  minimumFractionDigits: 0,
9645
10807
  maximumFractionDigits: 1
@@ -9672,20 +10834,20 @@ function ContextUsageIndicator({
9672
10834
  }) {
9673
10835
  const { t } = useChatkitTranslation();
9674
10836
  const stream = useStreamContext();
9675
- const [maxContextSize, setMaxContextSize] = React34.useState(null);
9676
- const [usedContextSize, setUsedContextSize] = React34.useState(null);
9677
- const [assistantAgentKey, setAssistantAgentKey] = React34.useState(null);
9678
- const latestRealtimeUsageRef = React34.useRef({
10837
+ const [maxContextSize, setMaxContextSize] = React35.useState(null);
10838
+ const [usedContextSize, setUsedContextSize] = React35.useState(null);
10839
+ const [assistantAgentKey, setAssistantAgentKey] = React35.useState(null);
10840
+ const latestRealtimeUsageRef = React35.useRef({
9679
10841
  threadId: null,
9680
10842
  agentKey: null,
9681
10843
  usedTokens: null
9682
10844
  });
9683
- const realtimeUsage = React34.useMemo(
10845
+ const realtimeUsage = React35.useMemo(
9684
10846
  () => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
9685
10847
  [assistantAgentKey, stream.contextUsageByAgentKey]
9686
10848
  );
9687
10849
  const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
9688
- React34.useEffect(() => {
10850
+ React35.useEffect(() => {
9689
10851
  if (!stream.client || !stream.assistantId) {
9690
10852
  setMaxContextSize(null);
9691
10853
  setAssistantAgentKey(null);
@@ -9705,18 +10867,18 @@ function ContextUsageIndicator({
9705
10867
  cancelled = true;
9706
10868
  };
9707
10869
  }, [stream.client, stream.assistantId]);
9708
- React34.useEffect(() => {
10870
+ React35.useEffect(() => {
9709
10871
  latestRealtimeUsageRef.current = {
9710
10872
  threadId: stream.threadId ?? null,
9711
10873
  agentKey: assistantAgentKey,
9712
10874
  usedTokens: realtimeUsedContextSize
9713
10875
  };
9714
10876
  }, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
9715
- React34.useEffect(() => {
10877
+ React35.useEffect(() => {
9716
10878
  if (realtimeUsedContextSize == null) return;
9717
10879
  setUsedContextSize(realtimeUsedContextSize);
9718
10880
  }, [realtimeUsedContextSize]);
9719
- React34.useEffect(() => {
10881
+ React35.useEffect(() => {
9720
10882
  if (!stream.client) {
9721
10883
  setUsedContextSize(null);
9722
10884
  return;
@@ -9781,8 +10943,8 @@ function ContextUsageIndicator({
9781
10943
  });
9782
10944
  const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
9783
10945
  const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
9784
- return /* @__PURE__ */ jsxs25(Tooltip, { children: [
9785
- /* @__PURE__ */ jsx38(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx38(
10946
+ return /* @__PURE__ */ jsxs28(Tooltip, { children: [
10947
+ /* @__PURE__ */ jsx41(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx41(
9786
10948
  "button",
9787
10949
  {
9788
10950
  type: "button",
@@ -9791,31 +10953,31 @@ function ContextUsageIndicator({
9791
10953
  className
9792
10954
  ),
9793
10955
  "aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
9794
- children: /* @__PURE__ */ jsx38(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
10956
+ children: /* @__PURE__ */ jsx41(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
9795
10957
  }
9796
10958
  ) }),
9797
- /* @__PURE__ */ jsxs25(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
9798
- /* @__PURE__ */ jsx38("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
9799
- /* @__PURE__ */ jsx38("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
9800
- /* @__PURE__ */ jsx38("div", { className: "text-sm font-semibold", children: usageTokensLabel })
10959
+ /* @__PURE__ */ jsxs28(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
10960
+ /* @__PURE__ */ jsx41("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
10961
+ /* @__PURE__ */ jsx41("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
10962
+ /* @__PURE__ */ jsx41("div", { className: "text-sm font-semibold", children: usageTokensLabel })
9801
10963
  ] })
9802
10964
  ] });
9803
10965
  }
9804
10966
 
9805
10967
  // src/components/pet/PetBridge.tsx
9806
- import * as React35 from "react";
10968
+ import * as React36 from "react";
9807
10969
  import { normalizePetOptions } from "@xpert-ai/chatkit-types";
9808
10970
  function PetBridge({ pet, state }) {
9809
10971
  const parentMessenger = useParentMessenger();
9810
10972
  const sendEvent = parentMessenger?.sendEvent;
9811
- const options = React35.useMemo(() => normalizePetOptions(pet), [pet]);
9812
- React35.useEffect(() => {
10973
+ const options = React36.useMemo(() => normalizePetOptions(pet), [pet]);
10974
+ React36.useEffect(() => {
9813
10975
  if (!sendEvent) {
9814
10976
  return;
9815
10977
  }
9816
10978
  sendEvent("pet_options_change", { pet: pet ?? null });
9817
10979
  }, [sendEvent, pet]);
9818
- React35.useEffect(() => {
10980
+ React36.useEffect(() => {
9819
10981
  if (!sendEvent || !options) {
9820
10982
  return;
9821
10983
  }
@@ -9825,15 +10987,15 @@ function PetBridge({ pet, state }) {
9825
10987
  }
9826
10988
 
9827
10989
  // src/components/settings/SettingsSheet.tsx
9828
- import * as React42 from "react";
10990
+ import * as React43 from "react";
9829
10991
  import { PawPrint, Settings } from "lucide-react";
9830
10992
 
9831
10993
  // src/components/ui/input.tsx
9832
- import * as React36 from "react";
9833
- import { jsx as jsx39 } from "react/jsx-runtime";
9834
- var Input = React36.forwardRef(
10994
+ import * as React37 from "react";
10995
+ import { jsx as jsx42 } from "react/jsx-runtime";
10996
+ var Input = React37.forwardRef(
9835
10997
  ({ className, type, ...props }, ref) => {
9836
- return /* @__PURE__ */ jsx39(
10998
+ return /* @__PURE__ */ jsx42(
9837
10999
  "input",
9838
11000
  {
9839
11001
  ref,
@@ -9853,17 +11015,17 @@ Input.displayName = "Input";
9853
11015
  import "react";
9854
11016
  import { Select as SelectPrimitive } from "radix-ui";
9855
11017
  import { ChevronDownIcon as ChevronDownIcon2, CheckIcon as CheckIcon4, ChevronUpIcon } from "lucide-react";
9856
- import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
11018
+ import { jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
9857
11019
  function Select({
9858
11020
  ...props
9859
11021
  }) {
9860
- return /* @__PURE__ */ jsx40(SelectPrimitive.Root, { "data-slot": "select", ...props });
11022
+ return /* @__PURE__ */ jsx43(SelectPrimitive.Root, { "data-slot": "select", ...props });
9861
11023
  }
9862
11024
  function SelectGroup({
9863
11025
  className,
9864
11026
  ...props
9865
11027
  }) {
9866
- return /* @__PURE__ */ jsx40(
11028
+ return /* @__PURE__ */ jsx43(
9867
11029
  SelectPrimitive.Group,
9868
11030
  {
9869
11031
  "data-slot": "select-group",
@@ -9875,7 +11037,7 @@ function SelectGroup({
9875
11037
  function SelectValue({
9876
11038
  ...props
9877
11039
  }) {
9878
- return /* @__PURE__ */ jsx40(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
11040
+ return /* @__PURE__ */ jsx43(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
9879
11041
  }
9880
11042
  function SelectTrigger({
9881
11043
  className,
@@ -9883,7 +11045,7 @@ function SelectTrigger({
9883
11045
  children,
9884
11046
  ...props
9885
11047
  }) {
9886
- return /* @__PURE__ */ jsxs26(
11048
+ return /* @__PURE__ */ jsxs29(
9887
11049
  SelectPrimitive.Trigger,
9888
11050
  {
9889
11051
  "data-slot": "select-trigger",
@@ -9895,7 +11057,7 @@ function SelectTrigger({
9895
11057
  ...props,
9896
11058
  children: [
9897
11059
  children,
9898
- /* @__PURE__ */ jsx40(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx40(ChevronDownIcon2, { className: "pointer-events-none size-4 text-muted-foreground" }) })
11060
+ /* @__PURE__ */ jsx43(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx43(ChevronDownIcon2, { className: "pointer-events-none size-4 text-muted-foreground" }) })
9899
11061
  ]
9900
11062
  }
9901
11063
  );
@@ -9907,7 +11069,7 @@ function SelectContent({
9907
11069
  align = "center",
9908
11070
  ...props
9909
11071
  }) {
9910
- return /* @__PURE__ */ jsx40(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs26(
11072
+ return /* @__PURE__ */ jsx43(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs29(
9911
11073
  SelectPrimitive.Content,
9912
11074
  {
9913
11075
  "data-slot": "select-content",
@@ -9917,8 +11079,8 @@ function SelectContent({
9917
11079
  align,
9918
11080
  ...props,
9919
11081
  children: [
9920
- /* @__PURE__ */ jsx40(SelectScrollUpButton, {}),
9921
- /* @__PURE__ */ jsx40(
11082
+ /* @__PURE__ */ jsx43(SelectScrollUpButton, {}),
11083
+ /* @__PURE__ */ jsx43(
9922
11084
  SelectPrimitive.Viewport,
9923
11085
  {
9924
11086
  "data-position": position,
@@ -9929,7 +11091,7 @@ function SelectContent({
9929
11091
  children
9930
11092
  }
9931
11093
  ),
9932
- /* @__PURE__ */ jsx40(SelectScrollDownButton, {})
11094
+ /* @__PURE__ */ jsx43(SelectScrollDownButton, {})
9933
11095
  ]
9934
11096
  }
9935
11097
  ) });
@@ -9939,7 +11101,7 @@ function SelectItem({
9939
11101
  children,
9940
11102
  ...props
9941
11103
  }) {
9942
- return /* @__PURE__ */ jsxs26(
11104
+ return /* @__PURE__ */ jsxs29(
9943
11105
  SelectPrimitive.Item,
9944
11106
  {
9945
11107
  "data-slot": "select-item",
@@ -9949,8 +11111,8 @@ function SelectItem({
9949
11111
  ),
9950
11112
  ...props,
9951
11113
  children: [
9952
- /* @__PURE__ */ jsx40("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx40(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx40(CheckIcon4, { className: "pointer-events-none" }) }) }),
9953
- /* @__PURE__ */ jsx40(SelectPrimitive.ItemText, { children })
11114
+ /* @__PURE__ */ jsx43("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx43(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx43(CheckIcon4, { className: "pointer-events-none" }) }) }),
11115
+ /* @__PURE__ */ jsx43(SelectPrimitive.ItemText, { children })
9954
11116
  ]
9955
11117
  }
9956
11118
  );
@@ -9959,7 +11121,7 @@ function SelectScrollUpButton({
9959
11121
  className,
9960
11122
  ...props
9961
11123
  }) {
9962
- return /* @__PURE__ */ jsx40(
11124
+ return /* @__PURE__ */ jsx43(
9963
11125
  SelectPrimitive.ScrollUpButton,
9964
11126
  {
9965
11127
  "data-slot": "select-scroll-up-button",
@@ -9968,7 +11130,7 @@ function SelectScrollUpButton({
9968
11130
  className
9969
11131
  ),
9970
11132
  ...props,
9971
- children: /* @__PURE__ */ jsx40(
11133
+ children: /* @__PURE__ */ jsx43(
9972
11134
  ChevronUpIcon,
9973
11135
  {}
9974
11136
  )
@@ -9979,7 +11141,7 @@ function SelectScrollDownButton({
9979
11141
  className,
9980
11142
  ...props
9981
11143
  }) {
9982
- return /* @__PURE__ */ jsx40(
11144
+ return /* @__PURE__ */ jsx43(
9983
11145
  SelectPrimitive.ScrollDownButton,
9984
11146
  {
9985
11147
  "data-slot": "select-scroll-down-button",
@@ -9988,7 +11150,7 @@ function SelectScrollDownButton({
9988
11150
  className
9989
11151
  ),
9990
11152
  ...props,
9991
- children: /* @__PURE__ */ jsx40(
11153
+ children: /* @__PURE__ */ jsx43(
9992
11154
  ChevronDownIcon2,
9993
11155
  {}
9994
11156
  )
@@ -9997,9 +11159,9 @@ function SelectScrollDownButton({
9997
11159
  }
9998
11160
 
9999
11161
  // src/components/ui/slider.tsx
10000
- import * as React38 from "react";
11162
+ import * as React39 from "react";
10001
11163
  import { Slider as SliderPrimitive } from "radix-ui";
10002
- import { jsx as jsx41, jsxs as jsxs27 } from "react/jsx-runtime";
11164
+ import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
10003
11165
  function Slider({
10004
11166
  className,
10005
11167
  defaultValue,
@@ -10008,11 +11170,11 @@ function Slider({
10008
11170
  max = 100,
10009
11171
  ...props
10010
11172
  }) {
10011
- const _values = React38.useMemo(
11173
+ const _values = React39.useMemo(
10012
11174
  () => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
10013
11175
  [value, defaultValue, min, max]
10014
11176
  );
10015
- return /* @__PURE__ */ jsxs27(
11177
+ return /* @__PURE__ */ jsxs30(
10016
11178
  SliderPrimitive.Root,
10017
11179
  {
10018
11180
  "data-slot": "slider",
@@ -10026,12 +11188,12 @@ function Slider({
10026
11188
  ),
10027
11189
  ...props,
10028
11190
  children: [
10029
- /* @__PURE__ */ jsx41(
11191
+ /* @__PURE__ */ jsx44(
10030
11192
  SliderPrimitive.Track,
10031
11193
  {
10032
11194
  "data-slot": "slider-track",
10033
11195
  className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
10034
- children: /* @__PURE__ */ jsx41(
11196
+ children: /* @__PURE__ */ jsx44(
10035
11197
  SliderPrimitive.Range,
10036
11198
  {
10037
11199
  "data-slot": "slider-range",
@@ -10040,7 +11202,7 @@ function Slider({
10040
11202
  )
10041
11203
  }
10042
11204
  ),
10043
- Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx41(
11205
+ Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx44(
10044
11206
  SliderPrimitive.Thumb,
10045
11207
  {
10046
11208
  "data-slot": "slider-thumb",
@@ -10054,7 +11216,7 @@ function Slider({
10054
11216
  }
10055
11217
 
10056
11218
  // src/components/ui/toggle-group.tsx
10057
- import * as React40 from "react";
11219
+ import * as React41 from "react";
10058
11220
  import "class-variance-authority";
10059
11221
  import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
10060
11222
 
@@ -10062,7 +11224,7 @@ import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
10062
11224
  import "react";
10063
11225
  import { cva as cva2 } from "class-variance-authority";
10064
11226
  import { Toggle as TogglePrimitive } from "radix-ui";
10065
- import { jsx as jsx42 } from "react/jsx-runtime";
11227
+ import { jsx as jsx45 } from "react/jsx-runtime";
10066
11228
  var toggleVariants = cva2(
10067
11229
  "group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
10068
11230
  {
@@ -10085,8 +11247,8 @@ var toggleVariants = cva2(
10085
11247
  );
10086
11248
 
10087
11249
  // src/components/ui/toggle-group.tsx
10088
- import { jsx as jsx43 } from "react/jsx-runtime";
10089
- var ToggleGroupContext = React40.createContext({
11250
+ import { jsx as jsx46 } from "react/jsx-runtime";
11251
+ var ToggleGroupContext = React41.createContext({
10090
11252
  size: "default",
10091
11253
  variant: "default",
10092
11254
  spacing: 0,
@@ -10101,7 +11263,7 @@ function ToggleGroup({
10101
11263
  children,
10102
11264
  ...props
10103
11265
  }) {
10104
- return /* @__PURE__ */ jsx43(
11266
+ return /* @__PURE__ */ jsx46(
10105
11267
  ToggleGroupPrimitive.Root,
10106
11268
  {
10107
11269
  "data-slot": "toggle-group",
@@ -10115,7 +11277,7 @@ function ToggleGroup({
10115
11277
  className
10116
11278
  ),
10117
11279
  ...props,
10118
- children: /* @__PURE__ */ jsx43(
11280
+ children: /* @__PURE__ */ jsx46(
10119
11281
  ToggleGroupContext.Provider,
10120
11282
  {
10121
11283
  value: { variant, size: size2, spacing, orientation },
@@ -10132,8 +11294,8 @@ function ToggleGroupItem({
10132
11294
  size: size2 = "default",
10133
11295
  ...props
10134
11296
  }) {
10135
- const context = React40.useContext(ToggleGroupContext);
10136
- return /* @__PURE__ */ jsx43(
11297
+ const context = React41.useContext(ToggleGroupContext);
11298
+ return /* @__PURE__ */ jsx46(
10137
11299
  ToggleGroupPrimitive.Item,
10138
11300
  {
10139
11301
  "data-slot": "toggle-group-item",
@@ -10373,7 +11535,7 @@ import {
10373
11535
  } from "@xpert-ai/chatkit-types";
10374
11536
 
10375
11537
  // src/components/pet/PetPreview.tsx
10376
- import { jsx as jsx44 } from "react/jsx-runtime";
11538
+ import { jsx as jsx47 } from "react/jsx-runtime";
10377
11539
  function escapeCssUrl(value) {
10378
11540
  return value.replace(/["\\]/g, "\\$&");
10379
11541
  }
@@ -10381,7 +11543,7 @@ function PetPreview({ src, label, className }) {
10381
11543
  const scale = 0.13;
10382
11544
  const width = petSpriteAtlas.cellWidth;
10383
11545
  const height = petSpriteAtlas.cellHeight;
10384
- return /* @__PURE__ */ jsx44(
11546
+ return /* @__PURE__ */ jsx47(
10385
11547
  "span",
10386
11548
  {
10387
11549
  className: cn(
@@ -10390,7 +11552,7 @@ function PetPreview({ src, label, className }) {
10390
11552
  ),
10391
11553
  "aria-hidden": "true",
10392
11554
  title: label,
10393
- children: /* @__PURE__ */ jsx44(
11555
+ children: /* @__PURE__ */ jsx47(
10394
11556
  "span",
10395
11557
  {
10396
11558
  className: "absolute left-1/2 top-1/2 block",
@@ -10412,7 +11574,7 @@ function PetPreview({ src, label, className }) {
10412
11574
  }
10413
11575
 
10414
11576
  // src/components/settings/SettingsSheet.tsx
10415
- import { jsx as jsx45, jsxs as jsxs28 } from "react/jsx-runtime";
11577
+ import { jsx as jsx48, jsxs as jsxs31 } from "react/jsx-runtime";
10416
11578
  var CHARACTER_TYPES2 = [
10417
11579
  "builtin",
10418
11580
  "atlas"
@@ -10428,13 +11590,13 @@ function SettingsSheet({
10428
11590
  onSave
10429
11591
  }) {
10430
11592
  const { t } = useChatkitTranslation();
10431
- const [draft, setDraft] = React42.useState(settings);
10432
- React42.useEffect(() => {
11593
+ const [draft, setDraft] = React43.useState(settings);
11594
+ React43.useEffect(() => {
10433
11595
  if (open) {
10434
11596
  setDraft(petRequired ? { ...settings, enabled: true } : settings);
10435
11597
  }
10436
11598
  }, [open, petRequired, settings]);
10437
- const updateDraft = React42.useCallback(
11599
+ const updateDraft = React43.useCallback(
10438
11600
  (patch) => {
10439
11601
  setDraft((previous) => ({ ...previous, ...patch }));
10440
11602
  },
@@ -10452,23 +11614,23 @@ function SettingsSheet({
10452
11614
  defaultValue: selectedBuiltinPet.label
10453
11615
  }
10454
11616
  );
10455
- return /* @__PURE__ */ jsx45(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs28(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
10456
- /* @__PURE__ */ jsx45(SheetHeader, { children: /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2", children: [
10457
- /* @__PURE__ */ jsx45("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ jsx45(Settings, { size: 16 }) }),
10458
- /* @__PURE__ */ jsx45(SheetTitle, { children: t("settings.title") })
11617
+ return /* @__PURE__ */ jsx48(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs31(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
11618
+ /* @__PURE__ */ jsx48(SheetHeader, { children: /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
11619
+ /* @__PURE__ */ jsx48("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ jsx48(Settings, { size: 16 }) }),
11620
+ /* @__PURE__ */ jsx48(SheetTitle, { children: t("settings.title") })
10459
11621
  ] }) }),
10460
- /* @__PURE__ */ jsxs28("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
10461
- /* @__PURE__ */ jsxs28("section", { className: "space-y-5", children: [
10462
- /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2", children: [
10463
- /* @__PURE__ */ jsx45("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx45(PawPrint, { size: 15 }) }),
10464
- /* @__PURE__ */ jsx45("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
11622
+ /* @__PURE__ */ jsxs31("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
11623
+ /* @__PURE__ */ jsxs31("section", { className: "space-y-5", children: [
11624
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
11625
+ /* @__PURE__ */ jsx48("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx48(PawPrint, { size: 15 }) }),
11626
+ /* @__PURE__ */ jsx48("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
10465
11627
  ] }),
10466
- /* @__PURE__ */ jsxs28("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
10467
- /* @__PURE__ */ jsxs28("span", { className: "min-w-0", children: [
10468
- /* @__PURE__ */ jsx45("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
10469
- petRequired && /* @__PURE__ */ jsx45("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
11628
+ /* @__PURE__ */ jsxs31("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
11629
+ /* @__PURE__ */ jsxs31("span", { className: "min-w-0", children: [
11630
+ /* @__PURE__ */ jsx48("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
11631
+ petRequired && /* @__PURE__ */ jsx48("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
10470
11632
  ] }),
10471
- /* @__PURE__ */ jsx45(
11633
+ /* @__PURE__ */ jsx48(
10472
11634
  "button",
10473
11635
  {
10474
11636
  type: "button",
@@ -10481,7 +11643,7 @@ function SettingsSheet({
10481
11643
  draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
10482
11644
  petRequired ? "cursor-not-allowed opacity-70" : ""
10483
11645
  ].join(" "),
10484
- children: /* @__PURE__ */ jsx45(
11646
+ children: /* @__PURE__ */ jsx48(
10485
11647
  "span",
10486
11648
  {
10487
11649
  className: [
@@ -10494,9 +11656,9 @@ function SettingsSheet({
10494
11656
  )
10495
11657
  ] })
10496
11658
  ] }),
10497
- /* @__PURE__ */ jsxs28("div", { className: "space-y-2", children: [
10498
- /* @__PURE__ */ jsx45("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
10499
- /* @__PURE__ */ jsx45(
11659
+ /* @__PURE__ */ jsxs31("div", { className: "space-y-2", children: [
11660
+ /* @__PURE__ */ jsx48("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
11661
+ /* @__PURE__ */ jsx48(
10500
11662
  ToggleGroup,
10501
11663
  {
10502
11664
  id: "chatkit-pet-type",
@@ -10511,7 +11673,7 @@ function SettingsSheet({
10511
11673
  variant: "outline",
10512
11674
  spacing: 2,
10513
11675
  className: "!w-full",
10514
- children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ jsx45(
11676
+ children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ jsx48(
10515
11677
  ToggleGroupItem,
10516
11678
  {
10517
11679
  value: type,
@@ -10523,8 +11685,8 @@ function SettingsSheet({
10523
11685
  }
10524
11686
  )
10525
11687
  ] }),
10526
- draft.characterType === "builtin" && /* @__PURE__ */ jsxs28("div", { className: "space-y-2", children: [
10527
- /* @__PURE__ */ jsx45(
11688
+ draft.characterType === "builtin" && /* @__PURE__ */ jsxs31("div", { className: "space-y-2", children: [
11689
+ /* @__PURE__ */ jsx48(
10528
11690
  "label",
10529
11691
  {
10530
11692
  htmlFor: "chatkit-pet-builtin",
@@ -10532,7 +11694,7 @@ function SettingsSheet({
10532
11694
  children: t("pet.settings.builtin")
10533
11695
  }
10534
11696
  ),
10535
- /* @__PURE__ */ jsxs28(
11697
+ /* @__PURE__ */ jsxs31(
10536
11698
  Select,
10537
11699
  {
10538
11700
  value: selectedBuiltinPet.id,
@@ -10543,26 +11705,26 @@ function SettingsSheet({
10543
11705
  }
10544
11706
  },
10545
11707
  children: [
10546
- /* @__PURE__ */ jsx45(
11708
+ /* @__PURE__ */ jsx48(
10547
11709
  SelectTrigger,
10548
11710
  {
10549
11711
  id: "chatkit-pet-builtin",
10550
11712
  className: "min-h-12 w-full px-3 py-2",
10551
- children: /* @__PURE__ */ jsx45(SelectValue, { placeholder: selectedBuiltinPetLabel })
11713
+ children: /* @__PURE__ */ jsx48(SelectValue, { placeholder: selectedBuiltinPetLabel })
10552
11714
  }
10553
11715
  ),
10554
- /* @__PURE__ */ jsx45(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ jsx45(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
11716
+ /* @__PURE__ */ jsx48(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ jsx48(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
10555
11717
  const label = t(`pet.settings.builtins.${pet.id}`, {
10556
11718
  defaultValue: pet.label
10557
11719
  });
10558
- return /* @__PURE__ */ jsx45(
11720
+ return /* @__PURE__ */ jsx48(
10559
11721
  SelectItem,
10560
11722
  {
10561
11723
  value: pet.id,
10562
11724
  className: "min-h-10 py-1.5 pl-2 pr-8",
10563
- children: /* @__PURE__ */ jsxs28("span", { className: "flex min-w-0 items-center gap-2", children: [
10564
- /* @__PURE__ */ jsx45(PetPreview, { src: pet.previewSrc, label }),
10565
- /* @__PURE__ */ jsx45("span", { className: "min-w-0 truncate", children: label })
11725
+ children: /* @__PURE__ */ jsxs31("span", { className: "flex min-w-0 items-center gap-2", children: [
11726
+ /* @__PURE__ */ jsx48(PetPreview, { src: pet.previewSrc, label }),
11727
+ /* @__PURE__ */ jsx48("span", { className: "min-w-0 truncate", children: label })
10566
11728
  ] })
10567
11729
  },
10568
11730
  pet.id
@@ -10572,8 +11734,8 @@ function SettingsSheet({
10572
11734
  }
10573
11735
  )
10574
11736
  ] }),
10575
- draft.characterType === "atlas" && /* @__PURE__ */ jsxs28("div", { className: "space-y-2", children: [
10576
- /* @__PURE__ */ jsx45(
11737
+ draft.characterType === "atlas" && /* @__PURE__ */ jsxs31("div", { className: "space-y-2", children: [
11738
+ /* @__PURE__ */ jsx48(
10577
11739
  "label",
10578
11740
  {
10579
11741
  className: "text-sm font-medium",
@@ -10581,7 +11743,7 @@ function SettingsSheet({
10581
11743
  children: t("pet.settings.atlasUrl")
10582
11744
  }
10583
11745
  ),
10584
- /* @__PURE__ */ jsx45(
11746
+ /* @__PURE__ */ jsx48(
10585
11747
  Input,
10586
11748
  {
10587
11749
  id: "chatkit-pet-atlas",
@@ -10591,15 +11753,15 @@ function SettingsSheet({
10591
11753
  }
10592
11754
  )
10593
11755
  ] }),
10594
- /* @__PURE__ */ jsxs28("div", { className: "space-y-2", children: [
10595
- /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between gap-4", children: [
10596
- /* @__PURE__ */ jsx45("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
10597
- /* @__PURE__ */ jsxs28("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
11756
+ /* @__PURE__ */ jsxs31("div", { className: "space-y-2", children: [
11757
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between gap-4", children: [
11758
+ /* @__PURE__ */ jsx48("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
11759
+ /* @__PURE__ */ jsxs31("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
10598
11760
  draft.scale.toFixed(2),
10599
11761
  "x"
10600
11762
  ] })
10601
11763
  ] }),
10602
- /* @__PURE__ */ jsx45(
11764
+ /* @__PURE__ */ jsx48(
10603
11765
  Slider,
10604
11766
  {
10605
11767
  id: "chatkit-pet-scale",
@@ -10613,8 +11775,8 @@ function SettingsSheet({
10613
11775
  }
10614
11776
  )
10615
11777
  ] }),
10616
- /* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-2 text-sm", children: [
10617
- /* @__PURE__ */ jsx45(
11778
+ /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-2 text-sm", children: [
11779
+ /* @__PURE__ */ jsx48(
10618
11780
  "input",
10619
11781
  {
10620
11782
  type: "checkbox",
@@ -10625,8 +11787,8 @@ function SettingsSheet({
10625
11787
  ),
10626
11788
  t("pet.settings.draggable")
10627
11789
  ] }),
10628
- /* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-2 text-sm", children: [
10629
- /* @__PURE__ */ jsx45(
11790
+ /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-2 text-sm", children: [
11791
+ /* @__PURE__ */ jsx48(
10630
11792
  "input",
10631
11793
  {
10632
11794
  type: "checkbox",
@@ -10637,8 +11799,8 @@ function SettingsSheet({
10637
11799
  ),
10638
11800
  t("pet.settings.persistPosition")
10639
11801
  ] }),
10640
- /* @__PURE__ */ jsxs28("div", { className: "flex justify-end gap-2 pt-2", children: [
10641
- /* @__PURE__ */ jsx45(
11802
+ /* @__PURE__ */ jsxs31("div", { className: "flex justify-end gap-2 pt-2", children: [
11803
+ /* @__PURE__ */ jsx48(
10642
11804
  Button,
10643
11805
  {
10644
11806
  type: "button",
@@ -10647,7 +11809,7 @@ function SettingsSheet({
10647
11809
  children: t("pet.settings.cancel")
10648
11810
  }
10649
11811
  ),
10650
- /* @__PURE__ */ jsx45(Button, { type: "submit", children: t("pet.settings.save") })
11812
+ /* @__PURE__ */ jsx48(Button, { type: "submit", children: t("pet.settings.save") })
10651
11813
  ] })
10652
11814
  ] })
10653
11815
  ] }) });
@@ -11153,7 +12315,7 @@ function findDomPointForComposerOffset(root, offset) {
11153
12315
  }
11154
12316
 
11155
12317
  // src/components/chat.tsx
11156
- import { Fragment as Fragment6, jsx as jsx46, jsxs as jsxs29 } from "react/jsx-runtime";
12318
+ import { Fragment as Fragment7, jsx as jsx49, jsxs as jsxs32 } from "react/jsx-runtime";
11157
12319
  var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
11158
12320
  var COMPOSER_INPUT_MAX_HEIGHT = 128;
11159
12321
  var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
@@ -11286,7 +12448,7 @@ function ReferenceChip({
11286
12448
  const metaLine = getReferenceMetaLine(reference);
11287
12449
  const isComposer = variant === "composer";
11288
12450
  const Icon = reference.type === "quote" ? Quote : reference.type === "image" ? ImageIcon : FileText3;
11289
- return /* @__PURE__ */ jsxs29(
12451
+ return /* @__PURE__ */ jsxs32(
11290
12452
  "div",
11291
12453
  {
11292
12454
  className: cn(
@@ -11295,7 +12457,7 @@ function ReferenceChip({
11295
12457
  ),
11296
12458
  title: getReferenceTitle(reference),
11297
12459
  children: [
11298
- /* @__PURE__ */ jsx46(
12460
+ /* @__PURE__ */ jsx49(
11299
12461
  Icon,
11300
12462
  {
11301
12463
  size: isComposer ? 14 : 12,
@@ -11305,8 +12467,8 @@ function ReferenceChip({
11305
12467
  )
11306
12468
  }
11307
12469
  ),
11308
- /* @__PURE__ */ jsxs29("div", { className: "min-w-0 flex-1", children: [
11309
- /* @__PURE__ */ jsx46(
12470
+ /* @__PURE__ */ jsxs32("div", { className: "min-w-0 flex-1", children: [
12471
+ /* @__PURE__ */ jsx49(
11310
12472
  "div",
11311
12473
  {
11312
12474
  className: cn(
@@ -11316,7 +12478,7 @@ function ReferenceChip({
11316
12478
  children: getReferenceLabel(reference)
11317
12479
  }
11318
12480
  ),
11319
- metaLine && /* @__PURE__ */ jsx46(
12481
+ metaLine && /* @__PURE__ */ jsx49(
11320
12482
  "div",
11321
12483
  {
11322
12484
  className: cn(
@@ -11327,7 +12489,7 @@ function ReferenceChip({
11327
12489
  }
11328
12490
  )
11329
12491
  ] }),
11330
- onRemove && removeLabel && /* @__PURE__ */ jsx46(
12492
+ onRemove && removeLabel && /* @__PURE__ */ jsx49(
11331
12493
  "button",
11332
12494
  {
11333
12495
  type: "button",
@@ -11338,7 +12500,7 @@ function ReferenceChip({
11338
12500
  ),
11339
12501
  title: removeLabel,
11340
12502
  "aria-label": removeLabel,
11341
- children: /* @__PURE__ */ jsx46(X5, { size: 12 })
12503
+ children: /* @__PURE__ */ jsx49(X5, { size: 12 })
11342
12504
  }
11343
12505
  )
11344
12506
  ]
@@ -11362,20 +12524,20 @@ function Chat({
11362
12524
  const { setStream } = useStreamManager();
11363
12525
  const stream = useStreamContext();
11364
12526
  const { theme } = useTheme();
11365
- const [isHistoryLoading, setIsHistoryLoading] = React43.useState(false);
11366
- const [historyError, setHistoryError] = React43.useState(null);
11367
- const [assistantName, setAssistantName] = React43.useState(null);
11368
- const [assistantAvatar, setAssistantAvatar] = React43.useState(null);
12527
+ const [isHistoryLoading, setIsHistoryLoading] = React44.useState(false);
12528
+ const [historyError, setHistoryError] = React44.useState(null);
12529
+ const [assistantName, setAssistantName] = React44.useState(null);
12530
+ const [assistantAvatar, setAssistantAvatar] = React44.useState(null);
11369
12531
  const LOADING_DOTS_MIN_DURATION = 800;
11370
12532
  const STREAMING_STATUS_REFRESH_MS = 250;
11371
- const [showLoadingDots, setShowLoadingDots] = React43.useState(false);
11372
- const [streamingNow, setStreamingNow] = React43.useState(() => Date.now());
11373
- const loadingStartTimeRef = React43.useRef(null);
11374
- const lastStreamOutputAtRef = React43.useRef(null);
11375
- React43.useEffect(() => {
12533
+ const [showLoadingDots, setShowLoadingDots] = React44.useState(false);
12534
+ const [streamingNow, setStreamingNow] = React44.useState(() => Date.now());
12535
+ const loadingStartTimeRef = React44.useRef(null);
12536
+ const lastStreamOutputAtRef = React44.useRef(null);
12537
+ React44.useEffect(() => {
11376
12538
  setStream(stream);
11377
12539
  }, [setStream, stream]);
11378
- React43.useEffect(() => {
12540
+ React44.useEffect(() => {
11379
12541
  if (stream.isLoading) {
11380
12542
  if (!loadingStartTimeRef.current) {
11381
12543
  loadingStartTimeRef.current = Date.now();
@@ -11398,7 +12560,7 @@ function Chat({
11398
12560
  }
11399
12561
  }
11400
12562
  }, [stream.isLoading]);
11401
- React43.useEffect(() => {
12563
+ React44.useEffect(() => {
11402
12564
  if (!stream.isLoading) {
11403
12565
  lastStreamOutputAtRef.current = null;
11404
12566
  setStreamingNow(Date.now());
@@ -11408,7 +12570,7 @@ function Chat({
11408
12570
  lastStreamOutputAtRef.current = now;
11409
12571
  setStreamingNow(now);
11410
12572
  }, [stream.messages, stream.isLoading]);
11411
- React43.useEffect(() => {
12573
+ React44.useEffect(() => {
11412
12574
  if (!stream.isLoading) {
11413
12575
  return;
11414
12576
  }
@@ -11417,74 +12579,74 @@ function Chat({
11417
12579
  }, STREAMING_STATUS_REFRESH_MS);
11418
12580
  return () => window.clearInterval(timer);
11419
12581
  }, [stream.isLoading]);
11420
- const [composerParts, setComposerParts] = React43.useState([]);
11421
- const [renderedComposerParts, setRenderedComposerParts] = React43.useState([]);
11422
- const [composerDomVersion, setComposerDomVersion] = React43.useState(0);
11423
- const [selectedTool, setSelectedTool] = React43.useState(
12582
+ const [composerParts, setComposerParts] = React44.useState([]);
12583
+ const [renderedComposerParts, setRenderedComposerParts] = React44.useState([]);
12584
+ const [composerDomVersion, setComposerDomVersion] = React44.useState(0);
12585
+ const [selectedTool, setSelectedTool] = React44.useState(
11424
12586
  null
11425
12587
  );
11426
- const [planModeEnabled, setPlanModeEnabled] = React43.useState(false);
11427
- const [petSettingsOpen, setPetSettingsOpen] = React43.useState(false);
11428
- const [petLocalSettings, setPetLocalSettings] = React43.useState(() => readPetLocalSettings());
11429
- const [runtimeCapabilities, setRuntimeCapabilities] = React43.useState(null);
11430
- const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React43.useState(false);
11431
- const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React43.useState(
12588
+ const [planModeEnabled, setPlanModeEnabled] = React44.useState(false);
12589
+ const [petSettingsOpen, setPetSettingsOpen] = React44.useState(false);
12590
+ const [petLocalSettings, setPetLocalSettings] = React44.useState(() => readPetLocalSettings());
12591
+ const [runtimeCapabilities, setRuntimeCapabilities] = React44.useState(null);
12592
+ const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React44.useState(false);
12593
+ const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React44.useState(
11432
12594
  () => createEmptyRuntimeCapabilitiesSelection()
11433
12595
  );
11434
- const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React43.useState(
12596
+ const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React44.useState(
11435
12597
  () => createEmptyRuntimeCapabilitiesSelection()
11436
12598
  );
11437
- const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React43.useState(null);
11438
- const [attachments, setAttachments] = React43.useState([]);
11439
- const [references, setReferences] = React43.useState([]);
11440
- const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React43.useState(false);
11441
- const [quoteSelection, setQuoteSelection] = React43.useState(null);
11442
- const [isAtBottom, setIsAtBottom] = React43.useState(true);
11443
- const [hasUpdatesBelow, setHasUpdatesBelow] = React43.useState(false);
12599
+ const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React44.useState(null);
12600
+ const [attachments, setAttachments] = React44.useState([]);
12601
+ const [references, setReferences] = React44.useState([]);
12602
+ const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React44.useState(false);
12603
+ const [quoteSelection, setQuoteSelection] = React44.useState(null);
12604
+ const [isAtBottom, setIsAtBottom] = React44.useState(true);
12605
+ const [hasUpdatesBelow, setHasUpdatesBelow] = React44.useState(false);
11444
12606
  const {
11445
12607
  threads,
11446
12608
  deleteThread,
11447
12609
  refreshThreads,
11448
12610
  isLoading: isThreadsLoading
11449
12611
  } = useThreads();
11450
- const viewportRef = React43.useRef(null);
11451
- const fileInputRef = React43.useRef(null);
11452
- const composerInputRef = React43.useRef(null);
11453
- const slashPaletteRef = React43.useRef(null);
11454
- const slashPaletteOptionRefs = React43.useRef(
12612
+ const viewportRef = React44.useRef(null);
12613
+ const fileInputRef = React44.useRef(null);
12614
+ const composerInputRef = React44.useRef(null);
12615
+ const slashPaletteRef = React44.useRef(null);
12616
+ const slashPaletteOptionRefs = React44.useRef(
11455
12617
  []
11456
12618
  );
11457
- const composerPartsRef = React43.useRef([]);
11458
- const pendingComposerCaretOffsetRef = React43.useRef(null);
11459
- const shouldAutoScrollRef = React43.useRef(true);
11460
- const forceFollowRef = React43.useRef(false);
11461
- const previousMessageCountRef = React43.useRef(0);
11462
- const previousScrollTopRef = React43.useRef(0);
11463
- const autoScrollFrameRef = React43.useRef(null);
11464
- const isPointerDownRef = React43.useRef(false);
11465
- const lastTouchYRef = React43.useRef(null);
11466
- const runtimeCapabilityPreferenceLoadRef = React43.useRef(0);
12619
+ const composerPartsRef = React44.useRef([]);
12620
+ const pendingComposerCaretOffsetRef = React44.useRef(null);
12621
+ const shouldAutoScrollRef = React44.useRef(true);
12622
+ const forceFollowRef = React44.useRef(false);
12623
+ const previousMessageCountRef = React44.useRef(0);
12624
+ const previousScrollTopRef = React44.useRef(0);
12625
+ const autoScrollFrameRef = React44.useRef(null);
12626
+ const isPointerDownRef = React44.useRef(false);
12627
+ const lastTouchYRef = React44.useRef(null);
12628
+ const runtimeCapabilityPreferenceLoadRef = React44.useRef(0);
11467
12629
  const resolvedTitle = title ?? t("chat.title");
11468
12630
  const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
11469
12631
  const petRequired = options?.displayMode === "pet";
11470
- const basePetSettings = React43.useMemo(
12632
+ const basePetSettings = React44.useMemo(
11471
12633
  () => derivePetLocalSettings(options?.pet),
11472
12634
  [options?.pet]
11473
12635
  );
11474
- const displayedPetSettings = React43.useMemo(
12636
+ const displayedPetSettings = React44.useMemo(
11475
12637
  () => ({
11476
12638
  ...petLocalSettings ?? basePetSettings,
11477
12639
  ...petRequired ? { enabled: true } : {}
11478
12640
  }),
11479
12641
  [basePetSettings, petLocalSettings, petRequired]
11480
12642
  );
11481
- const effectivePet = React43.useMemo(() => {
12643
+ const effectivePet = React44.useMemo(() => {
11482
12644
  if (petRequired || petLocalSettings) {
11483
12645
  return buildPetOptionsFromLocalSettings(displayedPetSettings);
11484
12646
  }
11485
12647
  return options?.pet ?? null;
11486
12648
  }, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
11487
- const savePetLocalSettings = React43.useCallback(
12649
+ const savePetLocalSettings = React44.useCallback(
11488
12650
  (settings) => {
11489
12651
  const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
11490
12652
  setPetLocalSettings(nextSettings);
@@ -11492,7 +12654,7 @@ function Chat({
11492
12654
  },
11493
12655
  [petRequired]
11494
12656
  );
11495
- const handlePetCommand = React43.useCallback(
12657
+ const handlePetCommand = React44.useCallback(
11496
12658
  (mode) => {
11497
12659
  if (mode === "settings") {
11498
12660
  setPetSettingsOpen(true);
@@ -11514,11 +12676,11 @@ function Chat({
11514
12676
  [displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
11515
12677
  );
11516
12678
  const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
11517
- const messages = React43.useMemo(
12679
+ const messages = React44.useMemo(
11518
12680
  () => stream.messages ?? [],
11519
12681
  [stream.messages]
11520
12682
  );
11521
- const draft = React43.useMemo(
12683
+ const draft = React44.useMemo(
11522
12684
  () => getComposerPlainText(composerParts),
11523
12685
  [composerParts]
11524
12686
  );
@@ -11530,7 +12692,7 @@ function Chat({
11530
12692
  isEmpty: isComposerInputEmpty,
11531
12693
  isStacked: isComposerStacked
11532
12694
  });
11533
- const pendingFollowUps = React43.useMemo(
12695
+ const pendingFollowUps = React44.useMemo(
11534
12696
  () => [...stream.pendingFollowUps ?? []].sort(
11535
12697
  (a, b) => a.createdAt - b.createdAt
11536
12698
  ),
@@ -11541,18 +12703,18 @@ function Chat({
11541
12703
  const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
11542
12704
  const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
11543
12705
  const hasPendingTodos = Boolean(stream.todos?.items.length);
11544
- const runtimeCapabilityOptions = React43.useMemo(
12706
+ const runtimeCapabilityOptions = React44.useMemo(
11545
12707
  () => getRuntimeCapabilityOptions(runtimeCapabilities),
11546
12708
  [runtimeCapabilities]
11547
12709
  );
11548
- const effectiveSessionRuntimeCapabilities = React43.useMemo(
12710
+ const effectiveSessionRuntimeCapabilities = React44.useMemo(
11549
12711
  () => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
11550
12712
  runtimeCapabilities,
11551
12713
  sessionRuntimeCapabilities
11552
12714
  ) : null,
11553
12715
  [runtimeCapabilities, runtimeCapabilitiesReady, sessionRuntimeCapabilities]
11554
12716
  );
11555
- const runRuntimeCapabilityOptions = React43.useMemo(
12717
+ const runRuntimeCapabilityOptions = React44.useMemo(
11556
12718
  () => runtimeCapabilityOptions.filter(
11557
12719
  (option) => isRuntimeCapabilitySelected(
11558
12720
  runRuntimeCapabilities,
@@ -11562,11 +12724,11 @@ function Chat({
11562
12724
  ),
11563
12725
  [runRuntimeCapabilities, runtimeCapabilityOptions]
11564
12726
  );
11565
- const composerRuntimeCapabilitySelectionKeys = React43.useMemo(
12727
+ const composerRuntimeCapabilitySelectionKeys = React44.useMemo(
11566
12728
  () => getComposerCapabilitySelectionKeys(composerParts),
11567
12729
  [composerParts]
11568
12730
  );
11569
- const detachedRunRuntimeCapabilityOptions = React43.useMemo(
12731
+ const detachedRunRuntimeCapabilityOptions = React44.useMemo(
11570
12732
  () => runRuntimeCapabilityOptions.filter(
11571
12733
  (option) => !composerRuntimeCapabilitySelectionKeys.has(
11572
12734
  getRuntimeCapabilityOptionKey(option)
@@ -11574,7 +12736,7 @@ function Chat({
11574
12736
  ),
11575
12737
  [composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
11576
12738
  );
11577
- const persistSessionRuntimeCapabilities = React43.useCallback(
12739
+ const persistSessionRuntimeCapabilities = React44.useCallback(
11578
12740
  async (threadId, selection) => {
11579
12741
  if (!runtimeCapabilities || !selection) {
11580
12742
  return;
@@ -11599,10 +12761,10 @@ function Chat({
11599
12761
  },
11600
12762
  [runtimeCapabilities, stream.client]
11601
12763
  );
11602
- const clearQuoteSelection = React43.useCallback(() => {
12764
+ const clearQuoteSelection = React44.useCallback(() => {
11603
12765
  setQuoteSelection(null);
11604
12766
  }, []);
11605
- const commitComposerParts = React43.useCallback(
12767
+ const commitComposerParts = React44.useCallback(
11606
12768
  (nextParts, options2) => {
11607
12769
  const normalized = normalizeComposerParts(nextParts);
11608
12770
  const previous = composerPartsRef.current;
@@ -11638,7 +12800,7 @@ function Chat({
11638
12800
  },
11639
12801
  []
11640
12802
  );
11641
- const setComposerText = React43.useCallback(
12803
+ const setComposerText = React44.useCallback(
11642
12804
  (text, caretOffset = text.length) => {
11643
12805
  commitComposerParts(createComposerTextParts(text), {
11644
12806
  caretOffset,
@@ -11648,7 +12810,7 @@ function Chat({
11648
12810
  },
11649
12811
  [commitComposerParts]
11650
12812
  );
11651
- const focusComposerAt = React43.useCallback((position) => {
12813
+ const focusComposerAt = React44.useCallback((position) => {
11652
12814
  const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
11653
12815
  pendingComposerCaretOffsetRef.current = nextPosition;
11654
12816
  requestAnimationFrame(() => {
@@ -11660,7 +12822,7 @@ function Chat({
11660
12822
  });
11661
12823
  }, []);
11662
12824
  const parentMessenger = useParentMessenger({
11663
- onSetComposerValue: React43.useCallback(
12825
+ onSetComposerValue: React44.useCallback(
11664
12826
  (payload) => {
11665
12827
  if (!payload) {
11666
12828
  return;
@@ -11683,10 +12845,10 @@ function Chat({
11683
12845
  },
11684
12846
  [composer?.tools, setComposerText]
11685
12847
  ),
11686
- onFocusComposer: React43.useCallback(() => {
12848
+ onFocusComposer: React44.useCallback(() => {
11687
12849
  composerInputRef.current?.focus();
11688
12850
  }, []),
11689
- onSetPetEnabled: React43.useCallback(
12851
+ onSetPetEnabled: React44.useCallback(
11690
12852
  (enabled) => {
11691
12853
  if (petRequired) {
11692
12854
  return;
@@ -11699,7 +12861,7 @@ function Chat({
11699
12861
  [displayedPetSettings, petRequired, savePetLocalSettings]
11700
12862
  )
11701
12863
  });
11702
- const syncQuoteSelection = React43.useCallback(() => {
12864
+ const syncQuoteSelection = React44.useCallback(() => {
11703
12865
  if (typeof window === "undefined") {
11704
12866
  clearQuoteSelection();
11705
12867
  return;
@@ -11744,23 +12906,23 @@ function Chat({
11744
12906
  left
11745
12907
  });
11746
12908
  }, [clearQuoteSelection]);
11747
- const cancelPendingAutoScroll = React43.useCallback(() => {
12909
+ const cancelPendingAutoScroll = React44.useCallback(() => {
11748
12910
  if (autoScrollFrameRef.current !== null) {
11749
12911
  cancelAnimationFrame(autoScrollFrameRef.current);
11750
12912
  autoScrollFrameRef.current = null;
11751
12913
  }
11752
12914
  }, []);
11753
- const disableAutoFollow = React43.useCallback(() => {
12915
+ const disableAutoFollow = React44.useCallback(() => {
11754
12916
  forceFollowRef.current = false;
11755
12917
  shouldAutoScrollRef.current = false;
11756
12918
  cancelPendingAutoScroll();
11757
12919
  }, [cancelPendingAutoScroll]);
11758
- const enableAutoFollow = React43.useCallback(() => {
12920
+ const enableAutoFollow = React44.useCallback(() => {
11759
12921
  forceFollowRef.current = true;
11760
12922
  shouldAutoScrollRef.current = true;
11761
12923
  setHasUpdatesBelow(false);
11762
12924
  }, []);
11763
- const scrollToBottom = React43.useCallback(
12925
+ const scrollToBottom = React44.useCallback(
11764
12926
  (smooth = false, force = false) => {
11765
12927
  if (force) {
11766
12928
  enableAutoFollow();
@@ -11787,7 +12949,7 @@ function Chat({
11787
12949
  },
11788
12950
  [cancelPendingAutoScroll, enableAutoFollow]
11789
12951
  );
11790
- React43.useEffect(() => {
12952
+ React44.useEffect(() => {
11791
12953
  const viewport = viewportRef.current;
11792
12954
  if (!viewport) return;
11793
12955
  previousScrollTopRef.current = viewport.scrollTop;
@@ -11868,14 +13030,14 @@ function Chat({
11868
13030
  window.removeEventListener("pointercancel", stopPointerTracking);
11869
13031
  };
11870
13032
  }, [cancelPendingAutoScroll, disableAutoFollow]);
11871
- React43.useEffect(() => {
13033
+ React44.useEffect(() => {
11872
13034
  shouldAutoScrollRef.current = true;
11873
13035
  forceFollowRef.current = false;
11874
13036
  previousScrollTopRef.current = 0;
11875
13037
  setIsAtBottom(true);
11876
13038
  setHasUpdatesBelow(false);
11877
13039
  }, [stream.threadId]);
11878
- React43.useEffect(() => {
13040
+ React44.useEffect(() => {
11879
13041
  const messageCountChanged = messages.length !== previousMessageCountRef.current;
11880
13042
  previousMessageCountRef.current = messages.length;
11881
13043
  if (!shouldAutoScrollRef.current) {
@@ -11894,7 +13056,7 @@ function Chat({
11894
13056
  clientSecret: effectiveClientSecret
11895
13057
  });
11896
13058
  const missingConfig = Boolean(missingConfigKind);
11897
- const missingConfigShortMessage = React43.useMemo(() => {
13059
+ const missingConfigShortMessage = React44.useMemo(() => {
11898
13060
  switch (missingConfigKind) {
11899
13061
  case "apiUrl":
11900
13062
  return t("chat.missingApiUrlShort");
@@ -11906,7 +13068,7 @@ function Chat({
11906
13068
  return t("chat.missingConfigShort");
11907
13069
  }
11908
13070
  }, [missingConfigKind, t]);
11909
- const missingConfigDetailMessage = React43.useMemo(() => {
13071
+ const missingConfigDetailMessage = React44.useMemo(() => {
11910
13072
  switch (missingConfigKind) {
11911
13073
  case "apiUrl":
11912
13074
  return t("chat.missingApiUrlDetail");
@@ -11921,7 +13083,7 @@ function Chat({
11921
13083
  const showMissingConfig = !isClientSecretInitializing && missingConfig;
11922
13084
  const hasUploadingFiles = attachments.some((a) => a.status === "uploading");
11923
13085
  const isSendDisabled = !trimmedDraft && !hasReferences || hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
11924
- const resizeComposerInput = React43.useCallback(() => {
13086
+ const resizeComposerInput = React44.useCallback(() => {
11925
13087
  const input = composerInputRef.current;
11926
13088
  if (!input) {
11927
13089
  return;
@@ -11929,7 +13091,7 @@ function Chat({
11929
13091
  input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
11930
13092
  input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
11931
13093
  }, []);
11932
- React43.useLayoutEffect(() => {
13094
+ React44.useLayoutEffect(() => {
11933
13095
  composerPartsRef.current = composerParts;
11934
13096
  resizeComposerInput();
11935
13097
  const caretOffset = pendingComposerCaretOffsetRef.current;
@@ -11941,13 +13103,13 @@ function Chat({
11941
13103
  }
11942
13104
  }
11943
13105
  }, [composerDomVersion, composerParts, resizeComposerInput]);
11944
- React43.useEffect(() => {
13106
+ React44.useEffect(() => {
11945
13107
  document.addEventListener("selectionchange", syncQuoteSelection);
11946
13108
  return () => {
11947
13109
  document.removeEventListener("selectionchange", syncQuoteSelection);
11948
13110
  };
11949
13111
  }, [syncQuoteSelection]);
11950
- React43.useEffect(() => {
13112
+ React44.useEffect(() => {
11951
13113
  const viewport = viewportRef.current;
11952
13114
  if (!viewport) {
11953
13115
  return;
@@ -11964,14 +13126,14 @@ function Chat({
11964
13126
  window.removeEventListener("resize", handleViewportScroll);
11965
13127
  };
11966
13128
  }, [clearQuoteSelection]);
11967
- React43.useEffect(() => {
13129
+ React44.useEffect(() => {
11968
13130
  clearQuoteSelection();
11969
13131
  }, [messages.length, stream.threadId, clearQuoteSelection]);
11970
- React43.useEffect(() => {
13132
+ React44.useEffect(() => {
11971
13133
  if (missingConfig) return;
11972
13134
  void refreshThreads();
11973
13135
  }, [missingConfig, refreshThreads]);
11974
- React43.useEffect(() => {
13136
+ React44.useEffect(() => {
11975
13137
  if (missingConfig || !stream.client || !stream.assistantId) {
11976
13138
  setAssistantName(null);
11977
13139
  setAssistantAvatar(null);
@@ -11994,7 +13156,7 @@ function Chat({
11994
13156
  cancelled = true;
11995
13157
  };
11996
13158
  }, [missingConfig, stream.client, stream.assistantId]);
11997
- React43.useEffect(() => {
13159
+ React44.useEffect(() => {
11998
13160
  if (missingConfig || !stream.client || !stream.assistantId) {
11999
13161
  setRuntimeCapabilities(null);
12000
13162
  setRuntimeCapabilitiesReady(false);
@@ -12041,7 +13203,7 @@ function Chat({
12041
13203
  });
12042
13204
  return () => controller.abort();
12043
13205
  }, [missingConfig, stream.client, stream.assistantId]);
12044
- React43.useEffect(() => {
13206
+ React44.useEffect(() => {
12045
13207
  setRunRuntimeCapabilities(
12046
13208
  createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
12047
13209
  );
@@ -12098,7 +13260,7 @@ function Chat({
12098
13260
  mimetype: a.storageFile?.mimetype ?? a.file.type,
12099
13261
  size: a.storageFile?.size ?? a.file.size
12100
13262
  }));
12101
- const handleSessionRuntimeCapabilityToggle = React43.useCallback(
13263
+ const handleSessionRuntimeCapabilityToggle = React44.useCallback(
12102
13264
  (type, id, selected) => {
12103
13265
  setSessionRuntimeCapabilities((previous) => {
12104
13266
  const nextSelection = toggleRuntimeCapabilitySelection(
@@ -12116,7 +13278,7 @@ function Chat({
12116
13278
  },
12117
13279
  [persistSessionRuntimeCapabilities, stream.threadId]
12118
13280
  );
12119
- const updateRuntimeCapabilityPalette = React43.useCallback(
13281
+ const updateRuntimeCapabilityPalette = React44.useCallback(
12120
13282
  (parts, selectionStart) => {
12121
13283
  const input = composerInputRef.current;
12122
13284
  const editingText = getComposerEditingText(parts);
@@ -12128,7 +13290,7 @@ function Chat({
12128
13290
  },
12129
13291
  []
12130
13292
  );
12131
- const syncComposerInputFromElement = React43.useCallback(
13293
+ const syncComposerInputFromElement = React44.useCallback(
12132
13294
  (input) => {
12133
13295
  const previousCapabilities = getComposerCapabilityPartMap(
12134
13296
  composerPartsRef.current
@@ -12146,25 +13308,25 @@ function Chat({
12146
13308
  },
12147
13309
  [commitComposerParts, updateRuntimeCapabilityPalette]
12148
13310
  );
12149
- const handleComposerInput = React43.useCallback(
13311
+ const handleComposerInput = React44.useCallback(
12150
13312
  (event) => {
12151
13313
  syncComposerInputFromElement(event.currentTarget);
12152
13314
  },
12153
13315
  [syncComposerInputFromElement]
12154
13316
  );
12155
- const handleComposerCompositionEnd = React43.useCallback(
13317
+ const handleComposerCompositionEnd = React44.useCallback(
12156
13318
  (event) => {
12157
13319
  syncComposerInputFromElement(event.currentTarget);
12158
13320
  },
12159
13321
  [syncComposerInputFromElement]
12160
13322
  );
12161
- const handleComposerSelect = React43.useCallback(() => {
13323
+ const handleComposerSelect = React44.useCallback(() => {
12162
13324
  updateRuntimeCapabilityPalette(
12163
13325
  composerPartsRef.current,
12164
13326
  composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
12165
13327
  );
12166
13328
  }, [updateRuntimeCapabilityPalette]);
12167
- const removeRunRuntimeCapability = React43.useCallback(
13329
+ const removeRunRuntimeCapability = React44.useCallback(
12168
13330
  (option) => {
12169
13331
  setRunRuntimeCapabilities(
12170
13332
  (previous) => toggleRuntimeCapabilitySelection(
@@ -12184,7 +13346,7 @@ function Chat({
12184
13346
  },
12185
13347
  [commitComposerParts]
12186
13348
  );
12187
- const submitDraft = React43.useCallback(
13349
+ const submitDraft = React44.useCallback(
12188
13350
  (optionsOrFollowUp) => {
12189
13351
  if (isSendDisabled) return;
12190
13352
  const submitOptions = typeof optionsOrFollowUp === "string" ? { followUpOverride: optionsOrFollowUp } : optionsOrFollowUp ?? {};
@@ -12308,7 +13470,7 @@ function Chat({
12308
13470
  t
12309
13471
  ]
12310
13472
  );
12311
- const addRunRuntimeCapabilities = React43.useCallback(
13473
+ const addRunRuntimeCapabilities = React44.useCallback(
12312
13474
  (selection) => {
12313
13475
  setRunRuntimeCapabilities(
12314
13476
  (previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
@@ -12320,7 +13482,7 @@ function Chat({
12320
13482
  },
12321
13483
  [runtimeCapabilities]
12322
13484
  );
12323
- const insertComposerCapabilityToken = React43.useCallback(
13485
+ const insertComposerCapabilityToken = React44.useCallback(
12324
13486
  (capability, range) => {
12325
13487
  const token = createComposerCapabilityPart(capability, createMessageId());
12326
13488
  const currentParts = composerPartsRef.current;
@@ -12391,7 +13553,7 @@ function Chat({
12391
13553
  plugin: t("composer.slashCommands.empty.loadingCapabilities"),
12392
13554
  subAgent: t("composer.slashCommands.empty.loadingCapabilities")
12393
13555
  };
12394
- React43.useEffect(() => {
13556
+ React44.useEffect(() => {
12395
13557
  if (!runtimeCapabilityPalette) {
12396
13558
  return;
12397
13559
  }
@@ -12410,7 +13572,7 @@ function Chat({
12410
13572
  );
12411
13573
  }
12412
13574
  }, [slashPaletteOptions.length, runtimeCapabilityPalette]);
12413
- React43.useLayoutEffect(() => {
13575
+ React44.useLayoutEffect(() => {
12414
13576
  if (!runtimeCapabilityPalette) {
12415
13577
  return;
12416
13578
  }
@@ -12434,7 +13596,7 @@ function Chat({
12434
13596
  }
12435
13597
  submitDraft();
12436
13598
  };
12437
- const handleEditPendingFollowUp = React43.useCallback(
13599
+ const handleEditPendingFollowUp = React44.useCallback(
12438
13600
  (id) => {
12439
13601
  const item = pendingFollowUps.find(
12440
13602
  (entry) => entry.id === id && entry.mode === "queue"
@@ -12461,7 +13623,7 @@ function Chat({
12461
13623
  },
12462
13624
  [pendingFollowUps, setComposerText, stream]
12463
13625
  );
12464
- const handleQuoteSelection = React43.useCallback(() => {
13626
+ const handleQuoteSelection = React44.useCallback(() => {
12465
13627
  if (!quoteSelection) {
12466
13628
  return;
12467
13629
  }
@@ -12477,7 +13639,7 @@ function Chat({
12477
13639
  const handleAttachmentClick = () => {
12478
13640
  fileInputRef.current?.click();
12479
13641
  };
12480
- const uploadContextFile = React43.useCallback(
13642
+ const uploadContextFile = React44.useCallback(
12481
13643
  (file) => stream.client.contexts.uploadFile(file),
12482
13644
  [stream.client]
12483
13645
  );
@@ -12581,7 +13743,7 @@ function Chat({
12581
13743
  }
12582
13744
  submitDraft();
12583
13745
  };
12584
- const handleComposerPaste = React43.useCallback(
13746
+ const handleComposerPaste = React44.useCallback(
12585
13747
  (event) => {
12586
13748
  const clipboardData = event.clipboardData;
12587
13749
  if (!clipboardData) {
@@ -12680,18 +13842,18 @@ function Chat({
12680
13842
  uploadContextFile
12681
13843
  ]
12682
13844
  );
12683
- const alternateFollowUpShortcutLabel = React43.useMemo(() => {
13845
+ const alternateFollowUpShortcutLabel = React44.useMemo(() => {
12684
13846
  if (typeof navigator === "undefined") {
12685
13847
  return "\u2318Enter";
12686
13848
  }
12687
13849
  const platform = navigator.platform || navigator.userAgent;
12688
13850
  return /Mac|iPhone|iPad|iPod/i.test(platform) ? "\u2318Enter" : "Ctrl+Enter";
12689
13851
  }, []);
12690
- const followUpShortcutLabels = React43.useMemo(
13852
+ const followUpShortcutLabels = React44.useMemo(
12691
13853
  () => getComposerFollowUpShortcutLabels(alternateFollowUpShortcutLabel),
12692
13854
  [alternateFollowUpShortcutLabel]
12693
13855
  );
12694
- const uploadFile = React43.useCallback(
13856
+ const uploadFile = React44.useCallback(
12695
13857
  async (localId, file) => {
12696
13858
  try {
12697
13859
  const result = await uploadContextFile(file);
@@ -12714,7 +13876,7 @@ function Chat({
12714
13876
  },
12715
13877
  [uploadContextFile]
12716
13878
  );
12717
- const handleRetryUpload = React43.useCallback(
13879
+ const handleRetryUpload = React44.useCallback(
12718
13880
  (localId) => {
12719
13881
  const attachment = attachments.find((a) => a.localId === localId);
12720
13882
  if (!attachment || attachment.status !== "error") return;
@@ -12813,7 +13975,7 @@ function Chat({
12813
13975
  );
12814
13976
  scrollToBottom(true, true);
12815
13977
  };
12816
- const loadConversationMessages = React43.useCallback(
13978
+ const loadConversationMessages = React44.useCallback(
12817
13979
  async (recordId) => {
12818
13980
  if (missingConfig) {
12819
13981
  setHistoryError(missingConfigShortMessage);
@@ -12908,12 +14070,12 @@ function Chat({
12908
14070
  }
12909
14071
  };
12910
14072
  const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
12911
- const currentThread = React43.useMemo(
14073
+ const currentThread = React44.useMemo(
12912
14074
  () => threads.find((item) => item.id === stream.threadId),
12913
14075
  [threads, stream.threadId]
12914
14076
  );
12915
14077
  const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
12916
- const threadErrorMessage = React43.useMemo(() => {
14078
+ const threadErrorMessage = React44.useMemo(() => {
12917
14079
  if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
12918
14080
  if (currentThread?.status !== "error") return void 0;
12919
14081
  const message = currentThread.error?.trim();
@@ -12944,7 +14106,7 @@ function Chat({
12944
14106
  fallbackTitle: t("history.threadFallback")
12945
14107
  });
12946
14108
  const assistantTitle = assistantName || resolvedTitle;
12947
- return /* @__PURE__ */ jsxs29(
14109
+ return /* @__PURE__ */ jsxs32(
12948
14110
  "div",
12949
14111
  {
12950
14112
  ref: viewportRef,
@@ -12954,10 +14116,10 @@ function Chat({
12954
14116
  className
12955
14117
  ),
12956
14118
  children: [
12957
- /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
12958
- /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-3 overflow-hidden", children: [
12959
- /* @__PURE__ */ jsxs29("div", { className: "relative shrink-0", children: [
12960
- /* @__PURE__ */ jsx46(
14119
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
14120
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-3 overflow-hidden", children: [
14121
+ /* @__PURE__ */ jsxs32("div", { className: "relative shrink-0", children: [
14122
+ /* @__PURE__ */ jsx49(
12961
14123
  ChatkitAvatar,
12962
14124
  {
12963
14125
  avatar: assistantAvatar,
@@ -12965,10 +14127,10 @@ function Chat({
12965
14127
  label: assistantTitle
12966
14128
  }
12967
14129
  ),
12968
- /* @__PURE__ */ jsx46("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
14130
+ /* @__PURE__ */ jsx49("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
12969
14131
  ] }),
12970
- /* @__PURE__ */ jsxs29("div", { className: "truncate", children: [
12971
- /* @__PURE__ */ jsx46(
14132
+ /* @__PURE__ */ jsxs32("div", { className: "truncate", children: [
14133
+ /* @__PURE__ */ jsx49(
12972
14134
  "h2",
12973
14135
  {
12974
14136
  className: "text-lg font-semibold truncate",
@@ -12976,12 +14138,12 @@ function Chat({
12976
14138
  children: assistantTitle
12977
14139
  }
12978
14140
  ),
12979
- /* @__PURE__ */ jsx46("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
14141
+ /* @__PURE__ */ jsx49("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
12980
14142
  ] })
12981
14143
  ] }),
12982
- /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-1", children: [
12983
- /* @__PURE__ */ jsxs29(Tooltip, { children: [
12984
- /* @__PURE__ */ jsx46(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx46("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx46(
14144
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-1", children: [
14145
+ /* @__PURE__ */ jsxs32(Tooltip, { children: [
14146
+ /* @__PURE__ */ jsx49(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx49("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx49(
12985
14147
  "button",
12986
14148
  {
12987
14149
  type: "button",
@@ -12992,14 +14154,14 @@ function Chat({
12992
14154
  "transition-colors duration-150"
12993
14155
  ),
12994
14156
  "aria-label": t("settings.open"),
12995
- children: /* @__PURE__ */ jsx46(Settings2, { size: 16 })
14157
+ children: /* @__PURE__ */ jsx49(Settings2, { size: 16 })
12996
14158
  }
12997
14159
  ) }) }),
12998
- /* @__PURE__ */ jsx46(TooltipContent, { side: "bottom", children: t("settings.open") })
14160
+ /* @__PURE__ */ jsx49(TooltipContent, { side: "bottom", children: t("settings.open") })
12999
14161
  ] }),
13000
- history?.enabled !== false && /* @__PURE__ */ jsxs29(Fragment6, { children: [
13001
- /* @__PURE__ */ jsxs29(Tooltip, { children: [
13002
- /* @__PURE__ */ jsx46(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx46("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx46(
14162
+ history?.enabled !== false && /* @__PURE__ */ jsxs32(Fragment7, { children: [
14163
+ /* @__PURE__ */ jsxs32(Tooltip, { children: [
14164
+ /* @__PURE__ */ jsx49(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx49("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx49(
13003
14165
  "button",
13004
14166
  {
13005
14167
  type: "button",
@@ -13012,12 +14174,12 @@ function Chat({
13012
14174
  "disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
13013
14175
  ),
13014
14176
  "aria-label": t("history.newThread"),
13015
- children: /* @__PURE__ */ jsx46(Pencil4, { size: 16 })
14177
+ children: /* @__PURE__ */ jsx49(Pencil4, { size: 16 })
13016
14178
  }
13017
14179
  ) }) }),
13018
- /* @__PURE__ */ jsx46(TooltipContent, { side: "bottom", children: t("history.newThread") })
14180
+ /* @__PURE__ */ jsx49(TooltipContent, { side: "bottom", children: t("history.newThread") })
13019
14181
  ] }),
13020
- /* @__PURE__ */ jsx46(
14182
+ /* @__PURE__ */ jsx49(
13021
14183
  HistorySidebar,
13022
14184
  {
13023
14185
  threads,
@@ -13032,18 +14194,18 @@ function Chat({
13032
14194
  ] })
13033
14195
  ] })
13034
14196
  ] }),
13035
- /* @__PURE__ */ jsxs29("div", { className: "flex-1 p-4", children: [
13036
- errorMessage && /* @__PURE__ */ jsx46("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
13037
- historyError && /* @__PURE__ */ jsx46("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
13038
- showMissingConfig && /* @__PURE__ */ jsx46("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
13039
- isHistoryLoading && /* @__PURE__ */ jsx46("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
13040
- messages.length === 0 ? /* @__PURE__ */ jsx46(
14197
+ /* @__PURE__ */ jsxs32("div", { className: "flex-1 p-4", children: [
14198
+ errorMessage && /* @__PURE__ */ jsx49("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
14199
+ historyError && /* @__PURE__ */ jsx49("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
14200
+ showMissingConfig && /* @__PURE__ */ jsx49("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
14201
+ isHistoryLoading && /* @__PURE__ */ jsx49("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
14202
+ messages.length === 0 ? /* @__PURE__ */ jsx49(
13041
14203
  StartScreen,
13042
14204
  {
13043
14205
  startScreen,
13044
14206
  onPromptClick: handlePromptClick
13045
14207
  }
13046
- ) : /* @__PURE__ */ jsxs29("div", { className: "space-y-4", children: [
14208
+ ) : /* @__PURE__ */ jsxs32("div", { className: "space-y-4", children: [
13047
14209
  messages.map((message, index) => {
13048
14210
  const messageType = String(message.type);
13049
14211
  const isAssistantMessage = messageType === "assistant" || messageType === "ai";
@@ -13076,7 +14238,7 @@ function Chat({
13076
14238
  if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
13077
14239
  return null;
13078
14240
  }
13079
- return /* @__PURE__ */ jsx46(
14241
+ return /* @__PURE__ */ jsx49(
13080
14242
  "div",
13081
14243
  {
13082
14244
  className: cn(
@@ -13084,8 +14246,8 @@ function Chat({
13084
14246
  message.type === "human" ? "justify-end" : "justify-start -ml-1"
13085
14247
  // AI messages: slightly closer to left
13086
14248
  ),
13087
- children: /* @__PURE__ */ jsxs29("div", { className: "flex flex-col px-3 overflow-hidden", children: [
13088
- /* @__PURE__ */ jsx46(
14249
+ children: /* @__PURE__ */ jsxs32("div", { className: "flex flex-col px-3 overflow-hidden", children: [
14250
+ /* @__PURE__ */ jsx49(
13089
14251
  "div",
13090
14252
  {
13091
14253
  ...canQuoteMessage ? {
@@ -13097,7 +14259,7 @@ function Chat({
13097
14259
  message.type === "human" ? "bg-primary text-primary-foreground px-4 py-2.5" : message.type === "system" ? "bg-muted text-muted-foreground text-xs px-4 py-2.5" : "py-1 text-chat-foreground"
13098
14260
  // AI messages: use chat-specific foreground color
13099
14261
  ),
13100
- children: isAssistantMessage ? /* @__PURE__ */ jsx46(
14262
+ children: isAssistantMessage ? /* @__PURE__ */ jsx49(
13101
14263
  AssistantMessage,
13102
14264
  {
13103
14265
  message: {
@@ -13116,25 +14278,25 @@ function Chat({
13116
14278
  organizationId: stream.organizationId,
13117
14279
  apiUrl: stream.apiUrl
13118
14280
  }
13119
- ) : /* @__PURE__ */ jsxs29(Fragment6, { children: [
13120
- message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsx46("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ jsxs29(
14281
+ ) : /* @__PURE__ */ jsxs32(Fragment7, { children: [
14282
+ message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsx49("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ jsxs32(
13121
14283
  "span",
13122
14284
  {
13123
14285
  className: "inline-flex max-w-full items-center gap-1 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs font-medium text-primary-foreground",
13124
14286
  children: [
13125
- /* @__PURE__ */ jsx46(
14287
+ /* @__PURE__ */ jsx49(
13126
14288
  RuntimeCapabilityIcon,
13127
14289
  {
13128
14290
  option,
13129
14291
  variant: "chip"
13130
14292
  }
13131
14293
  ),
13132
- /* @__PURE__ */ jsx46("span", { className: "max-w-[9rem] truncate", children: option.label })
14294
+ /* @__PURE__ */ jsx49("span", { className: "max-w-[9rem] truncate", children: option.label })
13133
14295
  ]
13134
14296
  },
13135
14297
  `${option.type}:${option.id}`
13136
14298
  )) }),
13137
- message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ jsx46("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ jsx46(
14299
+ message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ jsx49("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ jsx49(
13138
14300
  ReferenceChip,
13139
14301
  {
13140
14302
  reference,
@@ -13142,29 +14304,29 @@ function Chat({
13142
14304
  },
13143
14305
  getReferenceKey(reference)
13144
14306
  )) }),
13145
- message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ jsx46("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ jsxs29(
14307
+ message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ jsx49("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ jsxs32(
13146
14308
  "div",
13147
14309
  {
13148
14310
  className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
13149
14311
  children: [
13150
- /* @__PURE__ */ jsx46(FileText3, { size: 12 }),
13151
- /* @__PURE__ */ jsx46("span", { className: "max-w-[100px] truncate", children: file.originalName })
14312
+ /* @__PURE__ */ jsx49(FileText3, { size: 12 }),
14313
+ /* @__PURE__ */ jsx49("span", { className: "max-w-[100px] truncate", children: file.originalName })
13152
14314
  ]
13153
14315
  },
13154
14316
  fileIndex
13155
14317
  )) }),
13156
- Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ jsx46(
14318
+ Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ jsx49(
13157
14319
  "p",
13158
14320
  {
13159
14321
  className: "wrap-break-word text-sm leading-relaxed",
13160
14322
  children: formatMessageContent(part)
13161
14323
  },
13162
14324
  `${part.type}-${partIndex}`
13163
- )) : /* @__PURE__ */ jsx46("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
14325
+ )) : /* @__PURE__ */ jsx49("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
13164
14326
  ] })
13165
14327
  }
13166
14328
  ),
13167
- /* @__PURE__ */ jsx46(
14329
+ /* @__PURE__ */ jsx49(
13168
14330
  MessageActions,
13169
14331
  {
13170
14332
  content: messageContent,
@@ -13200,7 +14362,7 @@ function Chat({
13200
14362
  stream.isLoading,
13201
14363
  { now: streamingNow }
13202
14364
  );
13203
- return /* @__PURE__ */ jsx46("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ jsx46("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ jsx46(
14365
+ return /* @__PURE__ */ jsx49("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ jsx49("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ jsx49(
13204
14366
  AssistantStreamingIndicator,
13205
14367
  {
13206
14368
  status: fallbackStreamingStatus ?? "loading"
@@ -13209,7 +14371,7 @@ function Chat({
13209
14371
  })()
13210
14372
  ] })
13211
14373
  ] }),
13212
- !isAtBottom && messages.length > 0 && /* @__PURE__ */ jsx46("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ jsx46(
14374
+ !isAtBottom && messages.length > 0 && /* @__PURE__ */ jsx49("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ jsx49(
13213
14375
  Button,
13214
14376
  {
13215
14377
  type: "button",
@@ -13222,10 +14384,10 @@ function Chat({
13222
14384
  onClick: () => scrollToBottom(true, true),
13223
14385
  "aria-label": t("chat.scrollToBottom"),
13224
14386
  title: t("chat.scrollToBottom"),
13225
- children: /* @__PURE__ */ jsx46(ArrowDown2, { size: 16 })
14387
+ children: /* @__PURE__ */ jsx49(ArrowDown2, { size: 16 })
13226
14388
  }
13227
14389
  ) }),
13228
- quoteSelection && /* @__PURE__ */ jsx46(
14390
+ quoteSelection && /* @__PURE__ */ jsx49(
13229
14391
  "div",
13230
14392
  {
13231
14393
  className: "pointer-events-none fixed z-50",
@@ -13234,7 +14396,7 @@ function Chat({
13234
14396
  left: `${quoteSelection.left}px`,
13235
14397
  transform: "translateX(-50%)"
13236
14398
  },
13237
- children: /* @__PURE__ */ jsxs29(
14399
+ children: /* @__PURE__ */ jsxs32(
13238
14400
  Button,
13239
14401
  {
13240
14402
  type: "button",
@@ -13246,16 +14408,16 @@ function Chat({
13246
14408
  "aria-label": t("composer.quoteSelection"),
13247
14409
  title: t("composer.quoteSelection"),
13248
14410
  children: [
13249
- /* @__PURE__ */ jsx46(Quote, { size: 14 }),
14411
+ /* @__PURE__ */ jsx49(Quote, { size: 14 }),
13250
14412
  t("composer.quoteSelection")
13251
14413
  ]
13252
14414
  }
13253
14415
  )
13254
14416
  }
13255
14417
  ),
13256
- /* @__PURE__ */ jsxs29("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
13257
- threadErrorMessage && /* @__PURE__ */ jsx46("div", { className: "mb-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive overflow-auto", children: threadErrorMessage }),
13258
- /* @__PURE__ */ jsx46(
14418
+ /* @__PURE__ */ jsxs32("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
14419
+ threadErrorMessage && /* @__PURE__ */ jsx49("div", { className: "mb-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive overflow-auto", children: threadErrorMessage }),
14420
+ /* @__PURE__ */ jsx49(
13259
14421
  "input",
13260
14422
  {
13261
14423
  ref: fileInputRef,
@@ -13266,7 +14428,7 @@ function Chat({
13266
14428
  className: "hidden"
13267
14429
  }
13268
14430
  ),
13269
- attachments.length > 0 && /* @__PURE__ */ jsx46("div", { className: "mb-3 flex flex-wrap gap-2", children: attachments.map((item) => /* @__PURE__ */ jsxs29(
14431
+ attachments.length > 0 && /* @__PURE__ */ jsx49("div", { className: "mb-3 flex flex-wrap gap-2", children: attachments.map((item) => /* @__PURE__ */ jsxs32(
13270
14432
  "div",
13271
14433
  {
13272
14434
  className: cn(
@@ -13274,16 +14436,16 @@ function Chat({
13274
14436
  item.status === "error" ? "bg-destructive/10 border border-destructive/30" : "bg-muted"
13275
14437
  ),
13276
14438
  children: [
13277
- item.status === "uploading" && /* @__PURE__ */ jsx46(
13278
- Loader25,
14439
+ item.status === "uploading" && /* @__PURE__ */ jsx49(
14440
+ Loader26,
13279
14441
  {
13280
14442
  size: 14,
13281
14443
  className: "animate-spin text-muted-foreground"
13282
14444
  }
13283
14445
  ),
13284
- item.status === "success" && /* @__PURE__ */ jsx46(FileText3, { size: 14, className: "text-muted-foreground" }),
13285
- item.status === "error" && /* @__PURE__ */ jsx46(FileText3, { size: 14, className: "text-destructive" }),
13286
- /* @__PURE__ */ jsx46(
14446
+ item.status === "success" && /* @__PURE__ */ jsx49(FileText3, { size: 14, className: "text-muted-foreground" }),
14447
+ item.status === "error" && /* @__PURE__ */ jsx49(FileText3, { size: 14, className: "text-destructive" }),
14448
+ /* @__PURE__ */ jsx49(
13287
14449
  "span",
13288
14450
  {
13289
14451
  className: cn(
@@ -13293,17 +14455,17 @@ function Chat({
13293
14455
  children: item.file.name
13294
14456
  }
13295
14457
  ),
13296
- item.status === "error" && /* @__PURE__ */ jsx46(
14458
+ item.status === "error" && /* @__PURE__ */ jsx49(
13297
14459
  "button",
13298
14460
  {
13299
14461
  type: "button",
13300
14462
  onClick: () => handleRetryUpload(item.localId),
13301
14463
  className: "ml-1 rounded-full p-0.5 text-destructive hover:bg-destructive/20",
13302
14464
  title: t("chat.retryUpload"),
13303
- children: /* @__PURE__ */ jsx46(RefreshCw2, { size: 12 })
14465
+ children: /* @__PURE__ */ jsx49(RefreshCw2, { size: 12 })
13304
14466
  }
13305
14467
  ),
13306
- /* @__PURE__ */ jsx46(
14468
+ /* @__PURE__ */ jsx49(
13307
14469
  "button",
13308
14470
  {
13309
14471
  type: "button",
@@ -13312,14 +14474,14 @@ function Chat({
13312
14474
  "ml-1 rounded-full p-0.5",
13313
14475
  item.status === "error" ? "text-destructive hover:bg-destructive/20" : "hover:bg-muted-foreground/20"
13314
14476
  ),
13315
- children: /* @__PURE__ */ jsx46(X5, { size: 12 })
14477
+ children: /* @__PURE__ */ jsx49(X5, { size: 12 })
13316
14478
  }
13317
14479
  )
13318
14480
  ]
13319
14481
  },
13320
14482
  item.localId
13321
14483
  )) }),
13322
- references.length > 0 && /* @__PURE__ */ jsx46("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ jsx46(
14484
+ references.length > 0 && /* @__PURE__ */ jsx49("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ jsx49(
13323
14485
  ReferenceChip,
13324
14486
  {
13325
14487
  reference,
@@ -13333,16 +14495,16 @@ function Chat({
13333
14495
  },
13334
14496
  getReferenceKey(reference)
13335
14497
  )) }),
13336
- detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsxs29("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
13337
- /* @__PURE__ */ jsx46("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
13338
- detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ jsxs29(
14498
+ detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsxs32("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
14499
+ /* @__PURE__ */ jsx49("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
14500
+ detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ jsxs32(
13339
14501
  "span",
13340
14502
  {
13341
14503
  className: "inline-flex max-w-full items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",
13342
14504
  children: [
13343
- /* @__PURE__ */ jsx46(RuntimeCapabilityIcon, { option, variant: "chip" }),
13344
- /* @__PURE__ */ jsx46("span", { className: "max-w-40 truncate", children: option.label }),
13345
- /* @__PURE__ */ jsx46(
14505
+ /* @__PURE__ */ jsx49(RuntimeCapabilityIcon, { option, variant: "chip" }),
14506
+ /* @__PURE__ */ jsx49("span", { className: "max-w-40 truncate", children: option.label }),
14507
+ /* @__PURE__ */ jsx49(
13346
14508
  "button",
13347
14509
  {
13348
14510
  type: "button",
@@ -13350,7 +14512,7 @@ function Chat({
13350
14512
  className: "rounded-full p-0.5 hover:bg-primary/15",
13351
14513
  title: t("composer.capabilities.removeRunCapability"),
13352
14514
  "aria-label": t("composer.capabilities.removeRunCapability"),
13353
- children: /* @__PURE__ */ jsx46(X5, { size: 11 })
14515
+ children: /* @__PURE__ */ jsx49(X5, { size: 11 })
13354
14516
  }
13355
14517
  )
13356
14518
  ]
@@ -13358,7 +14520,7 @@ function Chat({
13358
14520
  `${option.type}:${option.id}`
13359
14521
  ))
13360
14522
  ] }),
13361
- /* @__PURE__ */ jsx46(
14523
+ /* @__PURE__ */ jsx49(
13362
14524
  PendingRuntimeServices,
13363
14525
  {
13364
14526
  state: stream.runtimeActivities.sandboxServices,
@@ -13367,7 +14529,7 @@ function Chat({
13367
14529
  className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
13368
14530
  }
13369
14531
  ),
13370
- /* @__PURE__ */ jsx46(
14532
+ /* @__PURE__ */ jsx49(
13371
14533
  PendingTodos,
13372
14534
  {
13373
14535
  snapshot: stream.todos,
@@ -13375,7 +14537,7 @@ function Chat({
13375
14537
  className: hasPendingFollowUps ? "mb-2" : void 0
13376
14538
  }
13377
14539
  ),
13378
- /* @__PURE__ */ jsx46(
14540
+ /* @__PURE__ */ jsx49(
13379
14541
  PendingFollowUps,
13380
14542
  {
13381
14543
  items: pendingFollowUps,
@@ -13390,7 +14552,7 @@ function Chat({
13390
14552
  attachToComposer: true
13391
14553
  }
13392
14554
  ),
13393
- /* @__PURE__ */ jsx46(
14555
+ /* @__PURE__ */ jsx49(
13394
14556
  RequestUserInputPanel,
13395
14557
  {
13396
14558
  request: stream.pendingRequestUserInput,
@@ -13399,7 +14561,7 @@ function Chat({
13399
14561
  attachToComposer: true
13400
14562
  }
13401
14563
  ),
13402
- /* @__PURE__ */ jsx46(
14564
+ /* @__PURE__ */ jsx49(
13403
14565
  HITLApprovalPanel,
13404
14566
  {
13405
14567
  request: stream.pendingHITLRequest,
@@ -13408,7 +14570,7 @@ function Chat({
13408
14570
  attachToComposer: true
13409
14571
  }
13410
14572
  ),
13411
- runtimeCapabilityPalette && /* @__PURE__ */ jsx46(
14573
+ runtimeCapabilityPalette && /* @__PURE__ */ jsx49(
13412
14574
  SlashPalette,
13413
14575
  {
13414
14576
  palette: runtimeCapabilityPalette,
@@ -13422,7 +14584,7 @@ function Chat({
13422
14584
  onSelect: selectSlashPaletteOption
13423
14585
  }
13424
14586
  ),
13425
- /* @__PURE__ */ jsx46("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs29(
14587
+ /* @__PURE__ */ jsx49("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs32(
13426
14588
  "div",
13427
14589
  {
13428
14590
  "data-slot": "composer-input-shell",
@@ -13436,7 +14598,7 @@ function Chat({
13436
14598
  composerInputRoundedClass
13437
14599
  ),
13438
14600
  children: [
13439
- /* @__PURE__ */ jsx46(
14601
+ /* @__PURE__ */ jsx49(
13440
14602
  "div",
13441
14603
  {
13442
14604
  ref: composerInputRef,
@@ -13458,7 +14620,7 @@ function Chat({
13458
14620
  (missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
13459
14621
  ),
13460
14622
  children: renderedComposerParts.map(
13461
- (part, index) => part.type === "text" ? /* @__PURE__ */ jsx46(React43.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ jsxs29(
14623
+ (part, index) => part.type === "text" ? /* @__PURE__ */ jsx49(React44.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ jsxs32(
13462
14624
  "span",
13463
14625
  {
13464
14626
  "data-composer-capability-key": part.key,
@@ -13467,14 +14629,14 @@ function Chat({
13467
14629
  contentEditable: false,
13468
14630
  className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
13469
14631
  children: [
13470
- /* @__PURE__ */ jsx46(
14632
+ /* @__PURE__ */ jsx49(
13471
14633
  RuntimeCapabilityIcon,
13472
14634
  {
13473
14635
  option: part.capability,
13474
14636
  variant: "chip"
13475
14637
  }
13476
14638
  ),
13477
- /* @__PURE__ */ jsx46("span", { className: "truncate", children: part.capability.label })
14639
+ /* @__PURE__ */ jsx49("span", { className: "truncate", children: part.capability.label })
13478
14640
  ]
13479
14641
  },
13480
14642
  part.key
@@ -13483,14 +14645,14 @@ function Chat({
13483
14645
  },
13484
14646
  composerDomVersion
13485
14647
  ),
13486
- /* @__PURE__ */ jsxs29(
14648
+ /* @__PURE__ */ jsxs32(
13487
14649
  "div",
13488
14650
  {
13489
14651
  "data-slot": "composer-action-bar",
13490
14652
  className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
13491
14653
  children: [
13492
- /* @__PURE__ */ jsxs29("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
13493
- /* @__PURE__ */ jsx46("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ jsx46(
14654
+ /* @__PURE__ */ jsxs32("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
14655
+ /* @__PURE__ */ jsx49("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ jsx49(
13494
14656
  ComposerMenu,
13495
14657
  {
13496
14658
  composer,
@@ -13505,20 +14667,20 @@ function Chat({
13505
14667
  disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
13506
14668
  }
13507
14669
  ) }),
13508
- selectedTool && /* @__PURE__ */ jsxs29("span", { className: "pointer-events-auto inline-flex h-8 min-w-0 max-w-[14rem] shrink items-center gap-1.5 rounded-full bg-primary/10 px-2 text-xs font-medium text-primary transition-all duration-200", children: [
13509
- /* @__PURE__ */ jsx46("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
13510
- /* @__PURE__ */ jsx46(
14670
+ selectedTool && /* @__PURE__ */ jsxs32("span", { className: "pointer-events-auto inline-flex h-8 min-w-0 max-w-[14rem] shrink items-center gap-1.5 rounded-full bg-primary/10 px-2 text-xs font-medium text-primary transition-all duration-200", children: [
14671
+ /* @__PURE__ */ jsx49("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
14672
+ /* @__PURE__ */ jsx49(
13511
14673
  "button",
13512
14674
  {
13513
14675
  type: "button",
13514
14676
  onClick: () => setSelectedTool(null),
13515
14677
  className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
13516
- children: /* @__PURE__ */ jsx46(X5, { size: 12 })
14678
+ children: /* @__PURE__ */ jsx49(X5, { size: 12 })
13517
14679
  }
13518
14680
  )
13519
14681
  ] })
13520
14682
  ] }),
13521
- /* @__PURE__ */ jsx46("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ jsx46(
14683
+ /* @__PURE__ */ jsx49("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ jsx49(
13522
14684
  SendButton,
13523
14685
  {
13524
14686
  disabled: isSendDisabled,
@@ -13545,7 +14707,7 @@ function Chat({
13545
14707
  ]
13546
14708
  }
13547
14709
  ) }),
13548
- disclaimer?.text && /* @__PURE__ */ jsx46(
14710
+ disclaimer?.text && /* @__PURE__ */ jsx49(
13549
14711
  "p",
13550
14712
  {
13551
14713
  className: cn(
@@ -13555,12 +14717,12 @@ function Chat({
13555
14717
  children: disclaimer.text
13556
14718
  }
13557
14719
  ),
13558
- /* @__PURE__ */ jsxs29("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
13559
- /* @__PURE__ */ jsx46("span", { children: t("chat.poweredBy") }),
13560
- /* @__PURE__ */ jsx46(ContextUsageIndicator, { className: "absolute right-4" })
14720
+ /* @__PURE__ */ jsxs32("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
14721
+ /* @__PURE__ */ jsx49("span", { children: t("chat.poweredBy") }),
14722
+ /* @__PURE__ */ jsx49(ContextUsageIndicator, { className: "absolute right-4" })
13561
14723
  ] })
13562
14724
  ] }),
13563
- /* @__PURE__ */ jsx46(
14725
+ /* @__PURE__ */ jsx49(
13564
14726
  SettingsSheet,
13565
14727
  {
13566
14728
  open: petSettingsOpen,
@@ -13570,17 +14732,17 @@ function Chat({
13570
14732
  onSave: savePetLocalSettings
13571
14733
  }
13572
14734
  ),
13573
- /* @__PURE__ */ jsx46(PetBridge, { pet: effectivePet, state: petAutoState })
14735
+ /* @__PURE__ */ jsx49(PetBridge, { pet: effectivePet, state: petAutoState })
13574
14736
  ]
13575
14737
  }
13576
14738
  );
13577
14739
  }
13578
14740
 
13579
14741
  // src/components/ui/separator.tsx
13580
- import * as React44 from "react";
13581
- import { jsx as jsx47 } from "react/jsx-runtime";
13582
- var Separator = React44.forwardRef(
13583
- ({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx47(
14742
+ import * as React45 from "react";
14743
+ import { jsx as jsx50 } from "react/jsx-runtime";
14744
+ var Separator = React45.forwardRef(
14745
+ ({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx50(
13584
14746
  "div",
13585
14747
  {
13586
14748
  ref,