@xpert-ai/chatkit-ui 0.4.5 → 0.4.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-Co-XCsnp.js → _baseUniq-e0n3oxgY.js} +1 -1
  2. package/dist/app/assets/{abap--D_Kn6xP.js → abap-C2m1gMh_.js} +1 -1
  3. package/dist/app/assets/{abnf-D5WYHs_l.js → abnf-DFzlHNVB.js} +1 -1
  4. package/dist/app/assets/{actionscript-DsVXzf-F.js → actionscript-Dxmvc3AF.js} +1 -1
  5. package/dist/app/assets/{ada-Cvy4GD3X.js → ada-CVO_O52N.js} +1 -1
  6. package/dist/app/assets/{agda-DsLk_pDK.js → agda-CGEI8apm.js} +1 -1
  7. package/dist/app/assets/{al-BeEwAGNu.js → al-CXBctxHE.js} +1 -1
  8. package/dist/app/assets/{antlr4-BPDPs4mt.js → antlr4-BzGyc1GG.js} +1 -1
  9. package/dist/app/assets/{apacheconf-DDa4MsSo.js → apacheconf-DhdeJg1U.js} +1 -1
  10. package/dist/app/assets/{apex-IXxIiz3T.js → apex-Dfprst0f.js} +1 -1
  11. package/dist/app/assets/{apl-_Xuh93xL.js → apl-D3zvQCsG.js} +1 -1
  12. package/dist/app/assets/{applescript-zF-7HGIh.js → applescript-DWkUa8Ap.js} +1 -1
  13. package/dist/app/assets/{aql-qapLE7vo.js → aql-DrfLox7L.js} +1 -1
  14. package/dist/app/assets/{arc-R6XS2pBf.js → arc-25X_4Lt9.js} +1 -1
  15. package/dist/app/assets/{architectureDiagram-Q4EWVU46-6z2emAH2.js → architectureDiagram-Q4EWVU46-CyF28k-b.js} +1 -1
  16. package/dist/app/assets/{arduino-2NlbDC0E.js → arduino-Qd3e6Ok1.js} +1 -1
  17. package/dist/app/assets/{arff-15Fx0kni.js → arff-CRZ9puZK.js} +1 -1
  18. package/dist/app/assets/{asciidoc-IGRk8vb3.js → asciidoc-DUiwgtuK.js} +1 -1
  19. package/dist/app/assets/{asm6502-lyM25DlO.js → asm6502-zG1dqL1m.js} +1 -1
  20. package/dist/app/assets/{asmatmel-DGRiY6RP.js → asmatmel-Cm9zpYMv.js} +1 -1
  21. package/dist/app/assets/{aspnet-DRHt5RUL.js → aspnet-CX5-L7Ct.js} +1 -1
  22. package/dist/app/assets/{autohotkey-DNI_3d2u.js → autohotkey-C4JfPrSd.js} +1 -1
  23. package/dist/app/assets/{autoit-Tn0WXTkZ.js → autoit-g5o6EGhy.js} +1 -1
  24. package/dist/app/assets/{avisynth-DZrXIifS.js → avisynth-BzCOBA3x.js} +1 -1
  25. package/dist/app/assets/{avro-idl-DvnfR4q7.js → avro-idl-e0tKOc6E.js} +1 -1
  26. package/dist/app/assets/{bash-bqRZI_pO.js → bash-CHd7M7ii.js} +1 -1
  27. package/dist/app/assets/{basic-BaebTlRT.js → basic-DvEnfVvI.js} +1 -1
  28. package/dist/app/assets/{batch-PcmijW6C.js → batch-CT5xgq8J.js} +1 -1
  29. package/dist/app/assets/{bbcode-6XIsStWc.js → bbcode-DJ7OKysr.js} +1 -1
  30. package/dist/app/assets/{bicep-CtazMCUu.js → bicep-BXw_45Yz.js} +1 -1
  31. package/dist/app/assets/{birb-Bb-Z2Uoh.js → birb-XpBgzzS8.js} +1 -1
  32. package/dist/app/assets/{bison-DMpTitx0.js → bison-D-7QCu9c.js} +1 -1
  33. package/dist/app/assets/{blockDiagram-DXYQGD6D-4zGz8PX5.js → blockDiagram-DXYQGD6D-6aWNcctV.js} +1 -1
  34. package/dist/app/assets/{bnf-BgCmtG9K.js → bnf-98JsAWJD.js} +1 -1
  35. package/dist/app/assets/{brainfuck-ZV2E8Tsx.js → brainfuck-DtvgC7Uz.js} +1 -1
  36. package/dist/app/assets/{brightscript-BcUAceb3.js → brightscript-CiZLD50k.js} +1 -1
  37. package/dist/app/assets/{bro-CJMO1xO5.js → bro-rbJDq64_.js} +1 -1
  38. package/dist/app/assets/{bsl-BUH4KORj.js → bsl-BS-cDrod.js} +1 -1
  39. package/dist/app/assets/{c-jtWYEsXA.js → c-DQDTErL9.js} +1 -1
  40. package/dist/app/assets/{c4Diagram-AHTNJAMY-BWtNBZjf.js → c4Diagram-AHTNJAMY-aTcQy0xE.js} +1 -1
  41. package/dist/app/assets/{cfscript-BRsXWjhc.js → cfscript-CkR3O7sU.js} +1 -1
  42. package/dist/app/assets/{chaiscript-Cyvk1xer.js → chaiscript-DvxvIu7v.js} +1 -1
  43. package/dist/app/assets/channel-CVWoJuYf.js +1 -0
  44. package/dist/app/assets/{chunk-4BX2VUAB-Cci3cX0w.js → chunk-4BX2VUAB-qfDhreDf.js} +1 -1
  45. package/dist/app/assets/{chunk-4TB4RGXK-Cc2Mhdt_.js → chunk-4TB4RGXK-BBVzKpce.js} +1 -1
  46. package/dist/app/assets/{chunk-55IACEB6-BCuokoIJ.js → chunk-55IACEB6-CcY9LJAj.js} +1 -1
  47. package/dist/app/assets/{chunk-EDXVE4YY-BniMDhnr.js → chunk-EDXVE4YY-B-Dzr-Dh.js} +1 -1
  48. package/dist/app/assets/{chunk-FMBD7UC4-BZgeDsZW.js → chunk-FMBD7UC4-8CUKOSAc.js} +1 -1
  49. package/dist/app/assets/{chunk-OYMX7WX6-DNtQg1UI.js → chunk-OYMX7WX6-D9Cq7hwT.js} +1 -1
  50. package/dist/app/assets/{chunk-QZHKN3VN-CYOkyP3f.js → chunk-QZHKN3VN-C2tBz9o2.js} +1 -1
  51. package/dist/app/assets/{chunk-YZCP3GAM-DrNq3DSp.js → chunk-YZCP3GAM-C4jyodPd.js} +1 -1
  52. package/dist/app/assets/{cil-xB1Wcx8v.js → cil-C5ON7F53.js} +1 -1
  53. package/dist/app/assets/classDiagram-6PBFFD2Q-CgDPDKKT.js +1 -0
  54. package/dist/app/assets/classDiagram-v2-HSJHXN6E-CgDPDKKT.js +1 -0
  55. package/dist/app/assets/{clike-Bys-F0y3.js → clike-DLdxAZKH.js} +1 -1
  56. package/dist/app/assets/{clojure-X2Ur1GCR.js → clojure-DvSYmO9X.js} +1 -1
  57. package/dist/app/assets/clone-DyTJ9PSE.js +1 -0
  58. package/dist/app/assets/{cmake-BV05wnad.js → cmake-DO0txDE3.js} +1 -1
  59. package/dist/app/assets/{cobol-DmbS5Ovj.js → cobol-BTJpVfTH.js} +1 -1
  60. package/dist/app/assets/{coffeescript-NB44yUqU.js → coffeescript-BtIXNHF3.js} +1 -1
  61. package/dist/app/assets/{concurnas-DRly0Ymz.js → concurnas-B531692C.js} +1 -1
  62. package/dist/app/assets/{coq-5BMX0a02.js → coq-Cp47Wwsa.js} +1 -1
  63. package/dist/app/assets/{core-BDQ00Bae.js → core-BoWyhl5n.js} +1 -1
  64. package/dist/app/assets/{cose-bilkent-S5V4N54A-C5sw6sBK.js → cose-bilkent-S5V4N54A-BjosQjhT.js} +1 -1
  65. package/dist/app/assets/{cpp-DGTd--nV.js → cpp-B6wt8k5c.js} +1 -1
  66. package/dist/app/assets/{crystal-04-7jCUz.js → crystal-B3XldzUm.js} +1 -1
  67. package/dist/app/assets/{csharp-BekrIY2o.js → csharp-BKQFTidP.js} +1 -1
  68. package/dist/app/assets/{cshtml-DRaoghIv.js → cshtml-BH26d1cx.js} +1 -1
  69. package/dist/app/assets/{csp-9-yRddNx.js → csp-DSghTOt2.js} +1 -1
  70. package/dist/app/assets/{css-CAtlVqs0.js → css-B5pRG057.js} +1 -1
  71. package/dist/app/assets/{css-extras-CWVDDT-t.js → css-extras-DD0ErmT4.js} +1 -1
  72. package/dist/app/assets/{csv-Dg-zB1qs.js → csv-C8WNOOiS.js} +1 -1
  73. package/dist/app/assets/{cypher-4IbDZc8Y.js → cypher-C72ppWfI.js} +1 -1
  74. package/dist/app/assets/{d-B7r6CIW_.js → d-DCkT0MnL.js} +1 -1
  75. package/dist/app/assets/{dagre-KV5264BT-Aa6ga6Tg.js → dagre-KV5264BT-Dz0XIZ_d.js} +1 -1
  76. package/dist/app/assets/{dart-33q2tN5Y.js → dart-ov_L9JbZ.js} +1 -1
  77. package/dist/app/assets/{dataweave-_KZXrqme.js → dataweave-ER8iZYvy.js} +1 -1
  78. package/dist/app/assets/{dax-bZvO9T2D.js → dax-DftfdAbZ.js} +1 -1
  79. package/dist/app/assets/{dhall-CMmS_d1I.js → dhall-B_Ag7Ugu.js} +1 -1
  80. package/dist/app/assets/{diagram-5BDNPKRD-CWOgCaWs.js → diagram-5BDNPKRD-LXVUQ6at.js} +1 -1
  81. package/dist/app/assets/{diagram-G4DWMVQ6-pXmi3PKB.js → diagram-G4DWMVQ6-DFJO-kg5.js} +1 -1
  82. package/dist/app/assets/{diagram-MMDJMWI5-D6L1aAmr.js → diagram-MMDJMWI5-BKfZyNwr.js} +1 -1
  83. package/dist/app/assets/{diagram-TYMM5635-Bnbk8hJL.js → diagram-TYMM5635-B0QF8FRs.js} +1 -1
  84. package/dist/app/assets/{diff-BMnhXRfO.js → diff-ByjoU1do.js} +1 -1
  85. package/dist/app/assets/{django-CwyRKLji.js → django-D8OuMIol.js} +1 -1
  86. package/dist/app/assets/{dns-zone-file-CH2YmErm.js → dns-zone-file-NMG4vugk.js} +1 -1
  87. package/dist/app/assets/{docker-CMu6fCBm.js → docker-D6vmqJmV.js} +1 -1
  88. package/dist/app/assets/{dot-DbQdbB35.js → dot-QLisXVDc.js} +1 -1
  89. package/dist/app/assets/{ebnf-Dv8o3Xd5.js → ebnf-BmUuiQBV.js} +1 -1
  90. package/dist/app/assets/{editorconfig-DGpNYUTF.js → editorconfig-RZmDBUFH.js} +1 -1
  91. package/dist/app/assets/{eiffel-DlwnHLpb.js → eiffel-rnFzeEWt.js} +1 -1
  92. package/dist/app/assets/{ejs-CnitBaIQ.js → ejs-DN7eCZMZ.js} +1 -1
  93. package/dist/app/assets/{elixir-BwncS48q.js → elixir-DQP09Ude.js} +1 -1
  94. package/dist/app/assets/{elm-DIeTEpXB.js → elm-DoxD8V5-.js} +1 -1
  95. package/dist/app/assets/{erDiagram-SMLLAGMA-DCVTOQcd.js → erDiagram-SMLLAGMA-PLYN-yt7.js} +1 -1
  96. package/dist/app/assets/{erb-DLShoXNV.js → erb-D7QWryDV.js} +1 -1
  97. package/dist/app/assets/{erlang-CymPR6rz.js → erlang-6MIAP3z1.js} +1 -1
  98. package/dist/app/assets/{etlua-DnGxLY3M.js → etlua-CXOpuEX0.js} +1 -1
  99. package/dist/app/assets/{excel-formula-BH7DFVmw.js → excel-formula-Bvelfqoq.js} +1 -1
  100. package/dist/app/assets/{factor-Bh-cxy91.js → factor-B_LwIu1T.js} +1 -1
  101. package/dist/app/assets/{false-Bbvyie5f.js → false-DaXIsDj9.js} +1 -1
  102. package/dist/app/assets/{firestore-security-rules-C1Z4GDy7.js → firestore-security-rules-vhtcxmz8.js} +1 -1
  103. package/dist/app/assets/{flow-CEb_LmQm.js → flow-CbnzGhcW.js} +1 -1
  104. package/dist/app/assets/{flowDiagram-DWJPFMVM-t4rWU0cl.js → flowDiagram-DWJPFMVM-D46jZeCj.js} +1 -1
  105. package/dist/app/assets/{fortran-BNasWrrZ.js → fortran-D21zPhTt.js} +1 -1
  106. package/dist/app/assets/{fsharp-BsCVJk6E.js → fsharp-CaguYUvm.js} +1 -1
  107. package/dist/app/assets/{ftl-jRCUJODD.js → ftl-DpFi23p_.js} +1 -1
  108. package/dist/app/assets/{ganttDiagram-T4ZO3ILL-CIt95e25.js → ganttDiagram-T4ZO3ILL-DiFD8eiM.js} +1 -1
  109. package/dist/app/assets/{gap-BNZC8mW7.js → gap-DTH0dhv0.js} +1 -1
  110. package/dist/app/assets/{gcode-Dm32zQCL.js → gcode-Ti0MqAbc.js} +1 -1
  111. package/dist/app/assets/{gdscript-nnhWLrN6.js → gdscript-B4c1zB7G.js} +1 -1
  112. package/dist/app/assets/{gedcom-CK-ySXEa.js → gedcom-Bm-gxba2.js} +1 -1
  113. package/dist/app/assets/{gherkin--zbB3aYH.js → gherkin-CRUiP4ua.js} +1 -1
  114. package/dist/app/assets/{git-DiWVe3eJ.js → git-DDSxUgmV.js} +1 -1
  115. package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-SzhkWrKD.js → gitGraphDiagram-UUTBAWPF-BkD66s-m.js} +1 -1
  116. package/dist/app/assets/{glsl-D1fReIPw.js → glsl-BWGO0hEu.js} +1 -1
  117. package/dist/app/assets/{gml-BDyUxEuB.js → gml-OfBxxn4Y.js} +1 -1
  118. package/dist/app/assets/{gn-y9O1wUj9.js → gn-D1i8XGRO.js} +1 -1
  119. package/dist/app/assets/{go-BluFqfDq.js → go-CQxEjXj6.js} +1 -1
  120. package/dist/app/assets/{go-module-DZRzQTXf.js → go-module-DJVIXWOE.js} +1 -1
  121. package/dist/app/assets/{graph-CqvHVXoE.js → graph-xy46XkDv.js} +1 -1
  122. package/dist/app/assets/{graphql-W2OnfZNH.js → graphql-DOWBew5y.js} +1 -1
  123. package/dist/app/assets/{groovy-CJ1kbbBa.js → groovy-D4SOqf4f.js} +1 -1
  124. package/dist/app/assets/{haml-CrhrA9XY.js → haml-Cs-NR_00.js} +1 -1
  125. package/dist/app/assets/{handlebars-EgGfXI7t.js → handlebars-L33c899L.js} +1 -1
  126. package/dist/app/assets/{haskell-Bj5MfGGI.js → haskell-jnyZSPIm.js} +1 -1
  127. package/dist/app/assets/{haxe-BdDpk8xR.js → haxe-CEcS1fRW.js} +1 -1
  128. package/dist/app/assets/{hcl-D9OwvylQ.js → hcl-CFVBh1rZ.js} +1 -1
  129. package/dist/app/assets/{hlsl-562nbzk6.js → hlsl-BGDcbOGU.js} +1 -1
  130. package/dist/app/assets/{hoon-BqdgVrcr.js → hoon-DbE0jHD1.js} +1 -1
  131. package/dist/app/assets/{hpkp-EH8H3Hom.js → hpkp-FsJh7gNB.js} +1 -1
  132. package/dist/app/assets/{hsts-QIGmRf78.js → hsts-q26NxKTf.js} +1 -1
  133. package/dist/app/assets/{http-CzfjEVlY.js → http-DG-5h-eO.js} +1 -1
  134. package/dist/app/assets/{ichigojam-D98a8BcA.js → ichigojam-CuYDdsGF.js} +1 -1
  135. package/dist/app/assets/{icon-DBD-5k6c.js → icon-B3Om0MSf.js} +1 -1
  136. package/dist/app/assets/{icu-message-format-BYT71AMs.js → icu-message-format-DN2g3klg.js} +1 -1
  137. package/dist/app/assets/{idris-B7zJwyc1.js → idris-BOt2MkOk.js} +1 -1
  138. package/dist/app/assets/{iecst-SesII_E4.js → iecst-CuBx11EN.js} +1 -1
  139. package/dist/app/assets/{ignore-B6Rk10df.js → ignore-cviNNAUS.js} +1 -1
  140. package/dist/app/assets/{index-DH__JuG8.js → index-B0wzBY_g.js} +197 -197
  141. package/dist/app/assets/{infoDiagram-42DDH7IO-B_FQWO4F.js → infoDiagram-42DDH7IO-D20xP3z-.js} +1 -1
  142. package/dist/app/assets/{inform7-h2cFjWGx.js → inform7-Ba3iGRkz.js} +1 -1
  143. package/dist/app/assets/{ini-BS51ySt6.js → ini-D1qPbzhi.js} +1 -1
  144. package/dist/app/assets/{io-B4AFlnDh.js → io-DxDg_PHG.js} +1 -1
  145. package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-1rRuzx1s.js → ishikawaDiagram-UXIWVN3A-cYl8p5Z1.js} +1 -1
  146. package/dist/app/assets/{j-Drz8g_1M.js → j-LY0FoFmS.js} +1 -1
  147. package/dist/app/assets/{java-DCpfLevZ.js → java-BqooSNxs.js} +1 -1
  148. package/dist/app/assets/{javadoc-DXIzKQcq.js → javadoc-BqcBR3v0.js} +1 -1
  149. package/dist/app/assets/{javadoclike-C8SmsTQv.js → javadoclike-C4mjzqku.js} +1 -1
  150. package/dist/app/assets/{javascript-uumTubEW.js → javascript-N5ua9HdK.js} +1 -1
  151. package/dist/app/assets/{javastacktrace-B-eU9XLD.js → javastacktrace-v7dElDBR.js} +1 -1
  152. package/dist/app/assets/{jexl-D4977EKW.js → jexl-QnOdFFuN.js} +1 -1
  153. package/dist/app/assets/{jolie-DLawqTad.js → jolie-CJ-3s01g.js} +1 -1
  154. package/dist/app/assets/{journeyDiagram-VCZTEJTY-DrQg892C.js → journeyDiagram-VCZTEJTY-BYX8q3Vt.js} +1 -1
  155. package/dist/app/assets/{jq-Cm1vS58Z.js → jq-CWSEYqle.js} +1 -1
  156. package/dist/app/assets/{js-extras-RCYpP2to.js → js-extras-BAnnOfzU.js} +1 -1
  157. package/dist/app/assets/{js-templates-767pf_M_.js → js-templates-C4pUn2It.js} +1 -1
  158. package/dist/app/assets/{jsdoc-DTvTCxfG.js → jsdoc-KAXMzacX.js} +1 -1
  159. package/dist/app/assets/{json-Dy-V79-1.js → json-D82-G59c.js} +1 -1
  160. package/dist/app/assets/{json5-BEmUoI2s.js → json5-6tkCkwy4.js} +1 -1
  161. package/dist/app/assets/{jsonp-Box0_wdw.js → jsonp-CJLh9FtV.js} +1 -1
  162. package/dist/app/assets/{jsstacktrace-D4k7LJFI.js → jsstacktrace-DtzF790j.js} +1 -1
  163. package/dist/app/assets/{jsx-UHXI_vWR.js → jsx-HBfJ0kvY.js} +1 -1
  164. package/dist/app/assets/{julia-DNluswh2.js → julia-qgsTf-aE.js} +1 -1
  165. package/dist/app/assets/{kanban-definition-6JOO6SKY-DCoBgIKn.js → kanban-definition-6JOO6SKY-lNjZrvli.js} +1 -1
  166. package/dist/app/assets/{keepalived-cL1_TOGJ.js → keepalived-CxQ8kQHh.js} +1 -1
  167. package/dist/app/assets/{keyman-CgmsT3ZD.js → keyman-QQ5F7jKU.js} +1 -1
  168. package/dist/app/assets/{kotlin-B-7C62fR.js → kotlin-CHGD50lP.js} +1 -1
  169. package/dist/app/assets/{kumir-BmZSzZs3.js → kumir-Bu9SM23C.js} +1 -1
  170. package/dist/app/assets/{kusto-Bd4bditr.js → kusto-mt_hZCSq.js} +1 -1
  171. package/dist/app/assets/{latex-B6Yn44p1.js → latex-CICDtHjj.js} +1 -1
  172. package/dist/app/assets/{latte-D_VkuuMY.js → latte-BAR0mT7a.js} +1 -1
  173. package/dist/app/assets/{layout-CuQBqeJF.js → layout-DEyJKhDK.js} +1 -1
  174. package/dist/app/assets/{less-CNL3ODIy.js → less-CHNPhcod.js} +1 -1
  175. package/dist/app/assets/{lilypond-Bvambxk4.js → lilypond-CSUOMwf6.js} +1 -1
  176. package/dist/app/assets/{linear-BFLcIrl3.js → linear-D9VvUwfa.js} +1 -1
  177. package/dist/app/assets/{liquid-B-rCvqgj.js → liquid-Cz7TW2oY.js} +1 -1
  178. package/dist/app/assets/{lisp-DAPeLOCL.js → lisp-Du6y1304.js} +1 -1
  179. package/dist/app/assets/{livescript-DhdAKU5C.js → livescript-BtG5DGcF.js} +1 -1
  180. package/dist/app/assets/{llvm-CZUCpwhn.js → llvm-BDPUo2hX.js} +1 -1
  181. package/dist/app/assets/{log-DWq76M48.js → log--N5sUe_u.js} +1 -1
  182. package/dist/app/assets/{lolcode-Cpeb2C7M.js → lolcode-ClqwJSko.js} +1 -1
  183. package/dist/app/assets/{lua-VuQhfB0e.js → lua-DbeZ1IVc.js} +1 -1
  184. package/dist/app/assets/{magma-C6-R8Pis.js → magma-Whq-4iou.js} +1 -1
  185. package/dist/app/assets/{makefile-C8sXNjev.js → makefile-pSKDqMc6.js} +1 -1
  186. package/dist/app/assets/{markdown-Dr_2eVkJ.js → markdown-B1xgmDWp.js} +1 -1
  187. package/dist/app/assets/{markup-DYRaVR0L.js → markup-DzLXw8Rh.js} +1 -1
  188. package/dist/app/assets/{markup-templating-Clq2Wdtu.js → markup-templating-DPDS9QM5.js} +1 -1
  189. package/dist/app/assets/{matlab-N7ULHzkN.js → matlab-DJRo_vuN.js} +1 -1
  190. package/dist/app/assets/{maxscript-C_UH_c0Y.js → maxscript-BvZXFCmD.js} +1 -1
  191. package/dist/app/assets/{mel-biAclKO6.js → mel-CyILQ25B.js} +1 -1
  192. package/dist/app/assets/{mermaid-cA3X8ng1.js → mermaid-CwNV2n0M.js} +1 -1
  193. package/dist/app/assets/{min-DNXX2fdQ.js → min-W152sZHe.js} +1 -1
  194. package/dist/app/assets/{mindmap-definition-QFDTVHPH-B3hDdQGV.js → mindmap-definition-QFDTVHPH-C-UOvSVV.js} +1 -1
  195. package/dist/app/assets/{mizar-DkeIuoWx.js → mizar-C0hSTRmd.js} +1 -1
  196. package/dist/app/assets/{mongodb-CZtDL2oy.js → mongodb-D_b-CoC-.js} +1 -1
  197. package/dist/app/assets/{monkey-B7rkJ-YN.js → monkey-PvQu5Vd6.js} +1 -1
  198. package/dist/app/assets/{moonscript-BrAkE7P-.js → moonscript-CoP1dq0Z.js} +1 -1
  199. package/dist/app/assets/{n1ql-CAwurqwa.js → n1ql-3QuCoAIN.js} +1 -1
  200. package/dist/app/assets/{n4js-CQMx2F8M.js → n4js-DZHeRyua.js} +1 -1
  201. package/dist/app/assets/{nand2tetris-hdl-C_WH3v-f.js → nand2tetris-hdl-dS8crO2g.js} +1 -1
  202. package/dist/app/assets/{naniscript-BIg6AoSC.js → naniscript-DwYGbK5q.js} +1 -1
  203. package/dist/app/assets/{nasm-JWQkVK3O.js → nasm-CM1zvD-3.js} +1 -1
  204. package/dist/app/assets/{neon-CCu-JZXF.js → neon-DFFyEzDC.js} +1 -1
  205. package/dist/app/assets/{nevod-DQ_tL5xo.js → nevod-D2FYTpnK.js} +1 -1
  206. package/dist/app/assets/{nginx-CE0GIB_t.js → nginx-CdY-14q6.js} +1 -1
  207. package/dist/app/assets/{nim-BQkGgHx1.js → nim-CG1iSWGV.js} +1 -1
  208. package/dist/app/assets/{nix-DjPqNtXA.js → nix-D0-Pu9rL.js} +1 -1
  209. package/dist/app/assets/{nsis-B0wDo6fc.js → nsis-dtDOvjH7.js} +1 -1
  210. package/dist/app/assets/{objectivec-BOWTft_L.js → objectivec-CptpH-1d.js} +1 -1
  211. package/dist/app/assets/{ocaml-rGGzL-J8.js → ocaml-Dv1ea-ld.js} +1 -1
  212. package/dist/app/assets/{opencl-7DwawK0u.js → opencl-BvMmG6YR.js} +1 -1
  213. package/dist/app/assets/{openqasm-BoZmVcpe.js → openqasm-CwSFop47.js} +1 -1
  214. package/dist/app/assets/{oz-k8zQh74U.js → oz-CEJrdpA7.js} +1 -1
  215. package/dist/app/assets/{parigp-DOF_5XSw.js → parigp-DViKd8pj.js} +1 -1
  216. package/dist/app/assets/{parser-Bn3oD8Fj.js → parser-DgiwG_pC.js} +1 -1
  217. package/dist/app/assets/{pascal-BMod2MBu.js → pascal-j68rLfD9.js} +1 -1
  218. package/dist/app/assets/{pascaligo-VMBK85nU.js → pascaligo-DUem4H6l.js} +1 -1
  219. package/dist/app/assets/{pcaxis-DtO95BO9.js → pcaxis-DvgzQxqD.js} +1 -1
  220. package/dist/app/assets/{peoplecode-B6669Uht.js → peoplecode-C3Bxx6ZR.js} +1 -1
  221. package/dist/app/assets/{perl-BWa2t7hE.js → perl-FujE7XeE.js} +1 -1
  222. package/dist/app/assets/{php-D1EHwdfc.js → php-CNsXpF9V.js} +1 -1
  223. package/dist/app/assets/{php-extras-BkzLJdMh.js → php-extras-C32YwHEb.js} +1 -1
  224. package/dist/app/assets/{phpdoc-Cjl8GbI3.js → phpdoc-DGWozCi2.js} +1 -1
  225. package/dist/app/assets/{pieDiagram-DEJITSTG-BOQDZEsp.js → pieDiagram-DEJITSTG-Dqtbtugf.js} +1 -1
  226. package/dist/app/assets/{plsql-C9d_4ASZ.js → plsql-C2VV-t97.js} +1 -1
  227. package/dist/app/assets/{powerquery-B8dvsoEG.js → powerquery-PRRUJzFT.js} +1 -1
  228. package/dist/app/assets/{powershell-B_E5Ls3m.js → powershell-bb1HIydt.js} +1 -1
  229. package/dist/app/assets/{processing-JtrZ9RaV.js → processing-DjcO4gZ4.js} +1 -1
  230. package/dist/app/assets/{prolog-CqFUVRIw.js → prolog-BYubkdm0.js} +1 -1
  231. package/dist/app/assets/{promql-CAbgJv1n.js → promql-C1R9989z.js} +1 -1
  232. package/dist/app/assets/{properties-BngV24FT.js → properties-6E8geRjW.js} +1 -1
  233. package/dist/app/assets/{protobuf-Bi9iRUiu.js → protobuf-NbKEUq-0.js} +1 -1
  234. package/dist/app/assets/{psl-pDjrt0B9.js → psl-CCIboIeA.js} +1 -1
  235. package/dist/app/assets/{pug-DioknANs.js → pug-B6XaxAxB.js} +1 -1
  236. package/dist/app/assets/{puppet-ML2ON0Nh.js → puppet-sYeWToAm.js} +1 -1
  237. package/dist/app/assets/{pure-DhCM2LcO.js → pure-MigBUlto.js} +1 -1
  238. package/dist/app/assets/{purebasic-BBRpNPNK.js → purebasic-CbK5sM8J.js} +1 -1
  239. package/dist/app/assets/{purescript-BCyPbnZA.js → purescript-D4syOBjO.js} +1 -1
  240. package/dist/app/assets/{q-AswilSny.js → q-BQLn2JzW.js} +1 -1
  241. package/dist/app/assets/{qml-CmAUtWqC.js → qml-Be1u_eEw.js} +1 -1
  242. package/dist/app/assets/{qore-Bv9pFdiR.js → qore-B1z7c7Yg.js} +1 -1
  243. package/dist/app/assets/{qsharp-48tPx5Mz.js → qsharp-BWsfMLkJ.js} +1 -1
  244. package/dist/app/assets/{quadrantDiagram-34T5L4WZ-xfjbVVZu.js → quadrantDiagram-34T5L4WZ-DdFjuBtK.js} +1 -1
  245. package/dist/app/assets/{r-D7-cDDS_.js → r-BER2AggK.js} +1 -1
  246. package/dist/app/assets/{racket-rfJjsp9a.js → racket-DOZRNhck.js} +1 -1
  247. package/dist/app/assets/{reason-DBC0zi5i.js → reason-1KJbYmkA.js} +1 -1
  248. package/dist/app/assets/{regex-DnBFBfKd.js → regex-SdGLwvq5.js} +1 -1
  249. package/dist/app/assets/{rego-B4yEjn-8.js → rego-D-mLsW7j.js} +1 -1
  250. package/dist/app/assets/{renpy-D_4quYLX.js → renpy-CYj4XzkD.js} +1 -1
  251. package/dist/app/assets/{requirementDiagram-MS252O5E-ykcp6OKq.js → requirementDiagram-MS252O5E-B5KgDzYF.js} +1 -1
  252. package/dist/app/assets/{rest-DE5aTQbn.js → rest-Do-kum26.js} +1 -1
  253. package/dist/app/assets/{rip-nLkeQy-_.js → rip-CZ7hy7Rc.js} +1 -1
  254. package/dist/app/assets/{roboconf-fk8WiTzj.js → roboconf-CrOlOF2e.js} +1 -1
  255. package/dist/app/assets/{robotframework-CT4iaIxT.js → robotframework-SFMU6Wwy.js} +1 -1
  256. package/dist/app/assets/{ruby-cQyytj4i.js → ruby-DSiktnDP.js} +1 -1
  257. package/dist/app/assets/{rust-CWJm_bSY.js → rust-BEq861Tj.js} +1 -1
  258. package/dist/app/assets/{sankeyDiagram-XADWPNL6-Bhogh-O-.js → sankeyDiagram-XADWPNL6-B_ju-fsT.js} +1 -1
  259. package/dist/app/assets/{sas-DoRGa1wg.js → sas-Cxt3LAYG.js} +1 -1
  260. package/dist/app/assets/{sass-LYaBIZKs.js → sass-C0QOivil.js} +1 -1
  261. package/dist/app/assets/{scala-BZjhJr8S.js → scala-CBIhwVR7.js} +1 -1
  262. package/dist/app/assets/{scheme-D01CiDze.js → scheme-BQ8vJpEk.js} +1 -1
  263. package/dist/app/assets/{scss-Da6GwvfN.js → scss-9ZztaO09.js} +1 -1
  264. package/dist/app/assets/{sequenceDiagram-FGHM5R23-ecYbruEX.js → sequenceDiagram-FGHM5R23-BNRlgM_o.js} +1 -1
  265. package/dist/app/assets/{shell-session-g6FrqTiP.js → shell-session-CEjfbC-4.js} +1 -1
  266. package/dist/app/assets/{smali-BSpX36tk.js → smali-wTZoo5Ck.js} +1 -1
  267. package/dist/app/assets/{smalltalk-Bq_Gsc0F.js → smalltalk-CtdEepu4.js} +1 -1
  268. package/dist/app/assets/{smarty-D3fU2RbY.js → smarty-DCOaiyVN.js} +1 -1
  269. package/dist/app/assets/{sml-TZkjEgtP.js → sml-CRIi_5FN.js} +1 -1
  270. package/dist/app/assets/{solidity-DLkuvBc2.js → solidity-C-sunTbM.js} +1 -1
  271. package/dist/app/assets/{solution-file-BqI5xPXQ.js → solution-file-BMcD_yBD.js} +1 -1
  272. package/dist/app/assets/{soy-BCG5CQr6.js → soy-CrHujpjx.js} +1 -1
  273. package/dist/app/assets/{sparql-DQQsm_l4.js → sparql-_nkh51Oo.js} +1 -1
  274. package/dist/app/assets/{splunk-spl-bY7_uYjh.js → splunk-spl-BV0yJuZ3.js} +1 -1
  275. package/dist/app/assets/{sqf-BZo7hu6i.js → sqf-CTR3G-sn.js} +1 -1
  276. package/dist/app/assets/{sql-DqFLgmXx.js → sql-CK8LhvZf.js} +1 -1
  277. package/dist/app/assets/{squirrel-CiX2EfEw.js → squirrel-BrWr7Sn4.js} +1 -1
  278. package/dist/app/assets/{stan-CMhpMP7k.js → stan-CEC_j0Vp.js} +1 -1
  279. package/dist/app/assets/{stateDiagram-FHFEXIEX-v9Gsby_c.js → stateDiagram-FHFEXIEX-CD5PsxTo.js} +1 -1
  280. package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-CZ_oJSeJ.js +1 -0
  281. package/dist/app/assets/{stylus-CenUxfuN.js → stylus-DAsiIRIp.js} +1 -1
  282. package/dist/app/assets/{swift-BVjGHQuG.js → swift-BAaG4GYN.js} +1 -1
  283. package/dist/app/assets/{systemd-CpOXAdLf.js → systemd-DzS1CHBe.js} +1 -1
  284. package/dist/app/assets/{t4-cs-CS9lJ-K0.js → t4-cs-ggnb3aeJ.js} +1 -1
  285. package/dist/app/assets/{t4-templating-hj-TNDsq.js → t4-templating-Bu_GLHIZ.js} +1 -1
  286. package/dist/app/assets/{t4-vb-Ck7mu1gJ.js → t4-vb-C9FmkhvR.js} +1 -1
  287. package/dist/app/assets/{tap-DaH9gaoq.js → tap-CoKAR-fO.js} +1 -1
  288. package/dist/app/assets/{tcl-DNIWr75O.js → tcl-C2ZkJvLb.js} +1 -1
  289. package/dist/app/assets/{textile-Bv4nPa6s.js → textile-DZALIJzT.js} +1 -1
  290. package/dist/app/assets/{timeline-definition-GMOUNBTQ-D6n0S-ku.js → timeline-definition-GMOUNBTQ-CDhxUnOk.js} +1 -1
  291. package/dist/app/assets/{toml-DF3HfhqH.js → toml-C2smfO8e.js} +1 -1
  292. package/dist/app/assets/{tremor-Bvh1Y6zY.js → tremor-BjkZp6il.js} +1 -1
  293. package/dist/app/assets/{tt2-Dv5tLBlM.js → tt2-CHuxOCBz.js} +1 -1
  294. package/dist/app/assets/{turtle-DkLAfnik.js → turtle-BRML1nbK.js} +1 -1
  295. package/dist/app/assets/{twig-S_GHUqZa.js → twig-BXTsXQgH.js} +1 -1
  296. package/dist/app/assets/{typescript-Cu71LnVi.js → typescript-D97Flp8j.js} +1 -1
  297. package/dist/app/assets/{typoscript-CtN4Jy8Z.js → typoscript-DSeb0eJ9.js} +1 -1
  298. package/dist/app/assets/{unrealscript-BRjPcrs6.js → unrealscript-DlHhyJiH.js} +1 -1
  299. package/dist/app/assets/{uorazor-D4ckTG59.js → uorazor-DAgFaaw5.js} +1 -1
  300. package/dist/app/assets/{uri-DQCryf4S.js → uri-DAISB2-y.js} +1 -1
  301. package/dist/app/assets/{v-Bx-_iyUf.js → v-BI1fSl4s.js} +1 -1
  302. package/dist/app/assets/{vala-C-8psoRf.js → vala-B0O9FrwQ.js} +1 -1
  303. package/dist/app/assets/{vbnet-Do4mtB7R.js → vbnet-C8BBfsv6.js} +1 -1
  304. package/dist/app/assets/{velocity-Drww5v_3.js → velocity-DxEPgCJp.js} +1 -1
  305. package/dist/app/assets/{vennDiagram-DHZGUBPP-tW8wVSRe.js → vennDiagram-DHZGUBPP-ByTJSjE_.js} +1 -1
  306. package/dist/app/assets/{verilog-B8pepi-H.js → verilog-thVOd-Xa.js} +1 -1
  307. package/dist/app/assets/{vhdl-CuO3hi8I.js → vhdl-92ZsOrFg.js} +1 -1
  308. package/dist/app/assets/{vim-DSsNung_.js → vim-WSNLk7dA.js} +1 -1
  309. package/dist/app/assets/{visual-basic-CZIqY5t6.js → visual-basic-C47_Fl8T.js} +1 -1
  310. package/dist/app/assets/{wardley-RL74JXVD-D7c8EbFm.js → wardley-RL74JXVD-wQHV1kk0.js} +1 -1
  311. package/dist/app/assets/{wardleyDiagram-NUSXRM2D-Br8nJ8eB.js → wardleyDiagram-NUSXRM2D-DDdoQZLn.js} +1 -1
  312. package/dist/app/assets/{warpscript-DxQu8-1N.js → warpscript-CauvLjrk.js} +1 -1
  313. package/dist/app/assets/{wasm-TvYG9PxF.js → wasm-DieX6uKz.js} +1 -1
  314. package/dist/app/assets/{web-idl-Cz41qHgE.js → web-idl-GqldvVwc.js} +1 -1
  315. package/dist/app/assets/{wiki-Dpvt1md3.js → wiki-D070zFKu.js} +1 -1
  316. package/dist/app/assets/{wolfram-Bg7HPXEQ.js → wolfram-COSn3nGG.js} +1 -1
  317. package/dist/app/assets/{wren-D5Yecsqj.js → wren-Cs5-Z4d-.js} +1 -1
  318. package/dist/app/assets/{xeora-Cg-n24u9.js → xeora-Dblnaflg.js} +1 -1
  319. package/dist/app/assets/{xml-doc-Eti4SXoM.js → xml-doc-Cw5SW8IO.js} +1 -1
  320. package/dist/app/assets/{xojo-DhQBW3jL.js → xojo-BOGyzB1N.js} +1 -1
  321. package/dist/app/assets/{xquery-DrnMYyrL.js → xquery-Dss_lg3A.js} +1 -1
  322. package/dist/app/assets/{xychartDiagram-5P7HB3ND-D0kV7MNO.js → xychartDiagram-5P7HB3ND-B6sz9HXS.js} +1 -1
  323. package/dist/app/assets/{yaml-DiOrjhia.js → yaml-BX2rP5GJ.js} +1 -1
  324. package/dist/app/assets/{yang-B38xE-H2.js → yang-CIW2FsLC.js} +1 -1
  325. package/dist/app/assets/{zig-C7oerdaD.js → zig-DqhZPLNT.js} +1 -1
  326. package/dist/app/index.html +1 -1
  327. package/dist/index.cjs +1218 -882
  328. package/dist/index.d.cts +22 -2
  329. package/dist/index.d.ts +22 -2
  330. package/dist/index.js +1219 -883
  331. package/package.json +3 -3
  332. package/dist/app/assets/channel-e2pCq0KM.js +0 -1
  333. package/dist/app/assets/classDiagram-6PBFFD2Q-DHVJ7GQ2.js +0 -1
  334. package/dist/app/assets/classDiagram-v2-HSJHXN6E-DHVJ7GQ2.js +0 -1
  335. package/dist/app/assets/clone-CepWRlEk.js +0 -1
  336. package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-2pX5wx_N.js +0 -1
package/dist/index.cjs CHANGED
@@ -67,8 +67,8 @@ __export(index_exports, {
67
67
  module.exports = __toCommonJS(index_exports);
68
68
 
69
69
  // src/components/chat.tsx
70
- var React50 = __toESM(require("react"), 1);
71
- var import_lucide_react29 = require("lucide-react");
70
+ var React51 = __toESM(require("react"), 1);
71
+ var import_lucide_react30 = require("lucide-react");
72
72
 
73
73
  // src/lib/utils.ts
74
74
  var import_clsx = require("clsx");
@@ -742,6 +742,9 @@ function ParentMessengerProvider({
742
742
  const onSetComposerValueHandlersRef = (0, import_react.useRef)(
743
743
  /* @__PURE__ */ new Set()
744
744
  );
745
+ const onSetRuntimeCapabilitiesHandlersRef = (0, import_react.useRef)(
746
+ /* @__PURE__ */ new Set()
747
+ );
745
748
  const onFocusComposerHandlersRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
746
749
  const latestOptionsRef = (0, import_react.useRef)(null);
747
750
  const isParentAvailable = (0, import_react.useMemo)(() => {
@@ -774,6 +777,15 @@ function ParentMessengerProvider({
774
777
  },
775
778
  []
776
779
  );
780
+ const registerOnSetRuntimeCapabilities = (0, import_react.useCallback)(
781
+ (handler) => {
782
+ onSetRuntimeCapabilitiesHandlersRef.current.add(handler);
783
+ return () => {
784
+ onSetRuntimeCapabilitiesHandlersRef.current.delete(handler);
785
+ };
786
+ },
787
+ []
788
+ );
777
789
  const registerOnFocusComposer = (0, import_react.useCallback)(
778
790
  (handler) => {
779
791
  onFocusComposerHandlersRef.current.add(handler);
@@ -898,6 +910,23 @@ function ParentMessengerProvider({
898
910
  });
899
911
  return;
900
912
  }
913
+ if (payload.type === "command" && payload.command === "onSetRuntimeCapabilities") {
914
+ const selection = isRuntimeCapabilitiesSelection(payload.data) ? payload.data : null;
915
+ void Promise.all(
916
+ [...onSetRuntimeCapabilitiesHandlersRef.current].map(
917
+ (handler2) => Promise.resolve(handler2(selection))
918
+ )
919
+ ).then(() => {
920
+ if (payload.nonce) {
921
+ sendResponse(payload.nonce, { ok: true });
922
+ }
923
+ }).catch((error) => {
924
+ if (payload.nonce) {
925
+ sendResponse(payload.nonce, void 0, error);
926
+ }
927
+ });
928
+ return;
929
+ }
901
930
  if (payload.type === "command" && payload.command === "onSetOptions") {
902
931
  latestOptionsRef.current = payload.data ?? null;
903
932
  if (onSetOptionsHandlersRef.current.size > 0) {
@@ -1019,6 +1048,7 @@ function ParentMessengerProvider({
1019
1048
  registerOnSetOptions,
1020
1049
  registerOnSetPetEnabled,
1021
1050
  registerOnSetComposerValue,
1051
+ registerOnSetRuntimeCapabilities,
1022
1052
  registerOnFocusComposer
1023
1053
  }),
1024
1054
  [
@@ -1028,6 +1058,7 @@ function ParentMessengerProvider({
1028
1058
  registerOnSetOptions,
1029
1059
  registerOnSetPetEnabled,
1030
1060
  registerOnSetComposerValue,
1061
+ registerOnSetRuntimeCapabilities,
1031
1062
  registerOnFocusComposer
1032
1063
  ]
1033
1064
  );
@@ -1039,6 +1070,7 @@ function useParentMessenger({
1039
1070
  onSetOptions,
1040
1071
  onSetPetEnabled,
1041
1072
  onSetComposerValue,
1073
+ onSetRuntimeCapabilities,
1042
1074
  onFocusComposer
1043
1075
  } = {}) {
1044
1076
  const context = (0, import_react2.useContext)(ParentMessengerContext);
@@ -1051,12 +1083,14 @@ function useParentMessenger({
1051
1083
  registerOnSetOptions,
1052
1084
  registerOnSetPetEnabled,
1053
1085
  registerOnSetComposerValue,
1086
+ registerOnSetRuntimeCapabilities,
1054
1087
  registerOnFocusComposer,
1055
1088
  ...messenger
1056
1089
  } = context;
1057
1090
  const onSetOptionsRef = (0, import_react2.useRef)(onSetOptions);
1058
1091
  const onSetPetEnabledRef = (0, import_react2.useRef)(onSetPetEnabled);
1059
1092
  const onSetComposerValueRef = (0, import_react2.useRef)(onSetComposerValue);
1093
+ const onSetRuntimeCapabilitiesRef = (0, import_react2.useRef)(onSetRuntimeCapabilities);
1060
1094
  const onFocusComposerRef = (0, import_react2.useRef)(onFocusComposer);
1061
1095
  (0, import_react2.useEffect)(() => {
1062
1096
  onSetOptionsRef.current = onSetOptions;
@@ -1067,12 +1101,16 @@ function useParentMessenger({
1067
1101
  (0, import_react2.useEffect)(() => {
1068
1102
  onSetComposerValueRef.current = onSetComposerValue;
1069
1103
  }, [onSetComposerValue]);
1104
+ (0, import_react2.useEffect)(() => {
1105
+ onSetRuntimeCapabilitiesRef.current = onSetRuntimeCapabilities;
1106
+ }, [onSetRuntimeCapabilities]);
1070
1107
  (0, import_react2.useEffect)(() => {
1071
1108
  onFocusComposerRef.current = onFocusComposer;
1072
1109
  }, [onFocusComposer]);
1073
1110
  const hasOnSetOptions = Boolean(onSetOptions);
1074
1111
  const hasOnSetPetEnabled = Boolean(onSetPetEnabled);
1075
1112
  const hasOnSetComposerValue = Boolean(onSetComposerValue);
1113
+ const hasOnSetRuntimeCapabilities = Boolean(onSetRuntimeCapabilities);
1076
1114
  const hasOnFocusComposer = Boolean(onFocusComposer);
1077
1115
  (0, import_react2.useEffect)(() => {
1078
1116
  if (!hasOnSetOptions) return;
@@ -1095,6 +1133,13 @@ function useParentMessenger({
1095
1133
  };
1096
1134
  return registerOnSetComposerValue(handler);
1097
1135
  }, [hasOnSetComposerValue, registerOnSetComposerValue]);
1136
+ (0, import_react2.useEffect)(() => {
1137
+ if (!hasOnSetRuntimeCapabilities) return;
1138
+ const handler = (selection) => {
1139
+ onSetRuntimeCapabilitiesRef.current?.(selection);
1140
+ };
1141
+ return registerOnSetRuntimeCapabilities(handler);
1142
+ }, [hasOnSetRuntimeCapabilities, registerOnSetRuntimeCapabilities]);
1098
1143
  (0, import_react2.useEffect)(() => {
1099
1144
  if (!hasOnFocusComposer) return;
1100
1145
  const handler = () => {
@@ -15351,222 +15396,836 @@ function findDomPointForComposerOffset(root, offset) {
15351
15396
  return result ?? { node: lastNode, offset: lastOffset };
15352
15397
  }
15353
15398
 
15354
- // src/lib/message-navigation.ts
15355
- var MESSAGE_NAVIGATION_MIN_ITEMS = 3;
15356
- var MAX_PREVIEW_LENGTH = 180;
15357
- var MAX_TAG_LENGTH = 40;
15358
- function isRecord6(value) {
15359
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15360
- }
15361
- function readString4(value) {
15362
- return typeof value === "string" && value.trim() ? value.trim() : null;
15363
- }
15364
- function normalizeWhitespace(value) {
15365
- return value.replace(/\s+/g, " ").trim();
15366
- }
15367
- function truncate(value, maxLength) {
15368
- const normalized = normalizeWhitespace(value);
15369
- if (normalized.length <= maxLength) return normalized;
15370
- return `${normalized.slice(0, Math.max(0, maxLength - 1)).trimEnd()}...`;
15371
- }
15372
- function pushText(draft, value) {
15373
- const text = readString4(value);
15374
- if (text) draft.text.push(text);
15375
- }
15376
- function pushTag(draft, value) {
15377
- const tag = readString4(value);
15378
- if (!tag) return;
15379
- const normalized = truncate(tag, MAX_TAG_LENGTH);
15380
- if (!draft.tags.includes(normalized)) {
15381
- draft.tags.push(normalized);
15382
- }
15383
- }
15384
- function mergeTags(...tagGroups) {
15385
- const tags = [];
15386
- for (const group of tagGroups) {
15387
- for (const tag of group) {
15388
- if (!tags.includes(tag)) tags.push(tag);
15389
- }
15390
- }
15391
- return tags;
15392
- }
15393
- function getMessageNavigationItemId(message, index) {
15394
- const messageId = readString4(message.id);
15395
- if (messageId) return messageId;
15396
- const type = readString4(message.type) ?? "message";
15397
- return `${type}-${index}`;
15398
- }
15399
- function getMessageNavigationRole(type) {
15400
- const normalized = readString4(type)?.toLowerCase();
15401
- if (normalized === "human" || normalized === "user") return "user";
15402
- if (normalized === "ai" || normalized === "assistant") return "assistant";
15403
- if (normalized === "system") return "system";
15404
- if (normalized === "tool") return "tool";
15405
- if (normalized === "event") return "event";
15406
- return "message";
15407
- }
15408
- function isTextContent4(content) {
15409
- return content.type === "text";
15410
- }
15411
- function isReasoningContent4(content) {
15412
- return content.type === "reasoning";
15413
- }
15414
- function isComponentContent4(content) {
15415
- return content.type === "component";
15416
- }
15417
- function isMemoryContent2(content) {
15418
- return content.type === "memory";
15419
- }
15420
- function isWidgetComponent3(content) {
15421
- const data = content.data;
15422
- return data?.type === "Widget" && Array.isArray(data.widgets);
15423
- }
15424
- function isMcpAppComponent2(content) {
15425
- const data = content.data;
15426
- return data?.type === "McpApp" && typeof data.appInstanceId === "string";
15427
- }
15428
- function collectWidgetContent(draft, content, labels) {
15429
- const names = content.data.widgets.map((widget) => readString4(widget.name)).filter((name) => Boolean(name));
15430
- if (names.length === 0) {
15431
- pushTag(draft, labels.widget);
15432
- return;
15433
- }
15434
- for (const name of names) {
15435
- pushTag(draft, name);
15399
+ // src/components/chat/runtime-capabilities.tsx
15400
+ var React50 = __toESM(require("react"), 1);
15401
+ var import_lucide_react29 = require("lucide-react");
15402
+ var import_jsx_runtime55 = require("react/jsx-runtime");
15403
+ function getHttpStatus(error) {
15404
+ if (!error || typeof error !== "object" || !("status" in error)) {
15405
+ return null;
15436
15406
  }
15407
+ const status = error.status;
15408
+ return typeof status === "number" ? status : null;
15437
15409
  }
15438
- function collectMcpAppContent(draft, content, labels, language) {
15439
- const title = readString4((0, import_chatkit_types6.resolveLocalizedText)(content.data.title, language)) ?? readString4(content.data.toolName) ?? labels.mcpApp;
15440
- pushTag(draft, title);
15441
- pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(content.data.description, language));
15442
- }
15443
- function collectComponentContent(draft, content, labels, language, options) {
15444
- if (isWidgetComponent3(content)) {
15445
- collectWidgetContent(draft, content, labels);
15446
- return;
15447
- }
15448
- if (isMcpAppComponent2(content)) {
15449
- collectMcpAppContent(draft, content, labels, language);
15410
+ function warnMissingRuntimeCapabilityReferences(action, missing) {
15411
+ if (!hasMissingRuntimeCapabilityReferences(missing)) {
15450
15412
  return;
15451
15413
  }
15452
- const data = getToolStepData(content);
15453
- pushTag(
15454
- draft,
15455
- (0, import_chatkit_types6.resolveLocalizedText)(data.message, language) ?? getToolActivityLabel(content, language)
15414
+ console.warn(
15415
+ `[Chat] Runtime capabilities ${action} include unavailable references:`,
15416
+ missing
15456
15417
  );
15457
- if (options.includeComponentText !== false) {
15458
- pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.message, language));
15459
- pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.title, language));
15460
- pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.tool, language));
15461
- pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.type, language));
15462
- }
15463
15418
  }
15464
- function collectContentItem(draft, item, labels, language, options) {
15465
- if (item === void 0 || isThreadContextUsageRenderArtifact(item)) return;
15466
- if (typeof item === "string") {
15467
- pushText(draft, item);
15468
- return;
15469
- }
15470
- if (isTextContent4(item) || isReasoningContent4(item)) {
15471
- pushText(draft, item.text);
15472
- if (isReasoningContent4(item)) pushTag(draft, labels.reasoning);
15473
- return;
15474
- }
15475
- if (item.type === "image_url") {
15476
- pushTag(draft, labels.image);
15477
- return;
15478
- }
15479
- if (isComponentContent4(item)) {
15480
- collectComponentContent(draft, item, labels, language, options);
15481
- return;
15482
- }
15483
- if (isMemoryContent2(item)) {
15484
- pushTag(draft, labels.memory);
15419
+ function getRuntimeCapabilityPaletteEmptyLabelKey(palette, runtimeCapabilitiesReady) {
15420
+ if (!palette.capabilityTypes || palette.capabilityTypes.length !== 1) {
15421
+ return "composer.capabilities.emptySearch";
15485
15422
  }
15486
- }
15487
- function collectContent(draft, content, labels, language, options = {}) {
15488
- if (typeof content === "string") {
15489
- pushText(draft, content);
15490
- return;
15423
+ if (!runtimeCapabilitiesReady) {
15424
+ return "composer.slashCommands.empty.loadingCapabilities";
15491
15425
  }
15492
- if (!Array.isArray(content)) {
15493
- return;
15426
+ const hasQuery = palette.query.trim().length > 0;
15427
+ const capabilityType = palette.capabilityTypes[0];
15428
+ if (capabilityType === "skill") {
15429
+ return hasQuery ? "composer.slashCommands.empty.matchingSkills" : "composer.slashCommands.empty.skills";
15494
15430
  }
15495
- for (const item of content) {
15496
- collectContentItem(
15497
- draft,
15498
- item,
15499
- labels,
15500
- language,
15501
- options
15502
- );
15431
+ if (capabilityType === "plugin") {
15432
+ return hasQuery ? "composer.slashCommands.empty.matchingPlugins" : "composer.slashCommands.empty.plugins";
15503
15433
  }
15434
+ return hasQuery ? "composer.slashCommands.empty.matchingSubAgents" : "composer.slashCommands.empty.subAgents";
15504
15435
  }
15505
- function collectReasoning(draft, reasoning, labels) {
15506
- if (!Array.isArray(reasoning)) return;
15507
- for (const item of reasoning) {
15508
- if (!isRecord6(item)) continue;
15509
- pushText(draft, item.text);
15510
- if (readString4(item.text)) pushTag(draft, labels.reasoning);
15436
+ function getRuntimeCapabilityOptionsForSelection(selection, options) {
15437
+ if (!selection) {
15438
+ return [];
15511
15439
  }
15440
+ return options.filter(
15441
+ (option) => isRuntimeCapabilitySelected(selection, option.type, option.id)
15442
+ );
15512
15443
  }
15513
- function collectFiles(draft, value, fallbackLabel) {
15514
- if (!Array.isArray(value)) return;
15515
- for (const file of value) {
15516
- if (!isRecord6(file)) continue;
15517
- pushTag(
15518
- draft,
15519
- file.originalName ?? file.name ?? file.fileName ?? file.id ?? fallbackLabel
15444
+ function removeComposerCapabilityPartsFromSelection(selection, removedCapabilities) {
15445
+ let nextSelection = selection;
15446
+ for (const part of removedCapabilities) {
15447
+ nextSelection = toggleRuntimeCapabilitySelection(
15448
+ nextSelection,
15449
+ part.capability.type,
15450
+ part.capability.id,
15451
+ false
15520
15452
  );
15521
15453
  }
15454
+ return nextSelection;
15522
15455
  }
15523
- function collectReferences(draft, value) {
15524
- for (const reference of normalizeReferences(value)) {
15525
- pushTag(draft, getReferenceLabel(reference));
15526
- }
15527
- }
15528
- function collectRuntimeCapabilities(draft, value) {
15529
- if (!Array.isArray(value)) return;
15530
- for (const option of value) {
15531
- if (!isRecord6(option)) continue;
15532
- pushTag(draft, option.label ?? option.id ?? option.type);
15533
- }
15534
- }
15535
- function getTitle(role, labels, assistantTitle) {
15536
- if (role === "assistant" && assistantTitle?.trim()) {
15537
- return assistantTitle.trim();
15538
- }
15539
- return labels[role];
15456
+ function getRemovedComposerCapabilityParts(previousParts, nextParts) {
15457
+ const nextKeys = getComposerCapabilityKeys(nextParts);
15458
+ return previousParts.filter(
15459
+ (part) => part.type === "capability" && !nextKeys.has(part.key)
15460
+ );
15540
15461
  }
15541
- function buildMessageNavigationItemSummary(message, index, options, collectOptions = {}) {
15542
- const role = getMessageNavigationRole(message.type);
15543
- const draft = {
15544
- text: [],
15545
- tags: []
15546
- };
15547
- const language = options.language ?? "en-US";
15548
- const labels = options.labels;
15549
- if (role === "user") {
15550
- pushText(draft, message.submittedInput);
15551
- }
15552
- collectContent(draft, message.content, labels, language, collectOptions);
15553
- collectReasoning(draft, message.reasoning, labels);
15554
- collectFiles(draft, message.fileAssets, labels.attachment);
15555
- collectFiles(draft, message.attachments, labels.attachment);
15556
- collectReferences(draft, message.references);
15557
- collectRuntimeCapabilities(draft, message.runtimeCapabilityOptions);
15558
- const text = draft.text.map(normalizeWhitespace).filter(Boolean).join(" ");
15559
- const preview = truncate(text, MAX_PREVIEW_LENGTH) || draft.tags.slice(0, 2).join(" \xB7 ");
15560
- if (!preview && draft.tags.length === 0) {
15561
- return null;
15562
- }
15563
- const messageId = readString4(message.id) ?? void 0;
15564
- return {
15565
- id: getMessageNavigationItemId(message, index),
15566
- ...messageId ? { messageId } : {},
15567
- index,
15568
- role,
15569
- title: getTitle(role, labels, options.assistantTitle),
15462
+ function useRuntimeCapabilitiesState({
15463
+ client,
15464
+ assistantId,
15465
+ threadId,
15466
+ disabled,
15467
+ composerParts
15468
+ }) {
15469
+ const [runtimeCapabilities, setRuntimeCapabilities] = React50.useState(null);
15470
+ const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React50.useState(false);
15471
+ const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React50.useState(
15472
+ () => createEmptyRuntimeCapabilitiesSelection()
15473
+ );
15474
+ const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React50.useState(
15475
+ () => createEmptyRuntimeCapabilitiesSelection()
15476
+ );
15477
+ const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React50.useState(null);
15478
+ const runtimeCapabilityPreferenceLoadRef = React50.useRef(0);
15479
+ const pendingExternalRuntimeCapabilitiesRef = React50.useRef(null);
15480
+ const runtimeCapabilityOptions = React50.useMemo(
15481
+ () => getRuntimeCapabilityOptions(runtimeCapabilities),
15482
+ [runtimeCapabilities]
15483
+ );
15484
+ const effectiveSessionRuntimeCapabilities = React50.useMemo(
15485
+ () => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
15486
+ runtimeCapabilities,
15487
+ sessionRuntimeCapabilities
15488
+ ) : null,
15489
+ [runtimeCapabilities, runtimeCapabilitiesReady, sessionRuntimeCapabilities]
15490
+ );
15491
+ const runRuntimeCapabilityOptions = React50.useMemo(
15492
+ () => runtimeCapabilityOptions.filter(
15493
+ (option) => isRuntimeCapabilitySelected(
15494
+ runRuntimeCapabilities,
15495
+ option.type,
15496
+ option.id
15497
+ )
15498
+ ),
15499
+ [runRuntimeCapabilities, runtimeCapabilityOptions]
15500
+ );
15501
+ const composerRuntimeCapabilitySelectionKeys = React50.useMemo(
15502
+ () => getComposerCapabilitySelectionKeys(composerParts),
15503
+ [composerParts]
15504
+ );
15505
+ const detachedRunRuntimeCapabilityOptions = React50.useMemo(
15506
+ () => runRuntimeCapabilityOptions.filter(
15507
+ (option) => !composerRuntimeCapabilitySelectionKeys.has(
15508
+ getRuntimeCapabilityOptionKey(option)
15509
+ )
15510
+ ),
15511
+ [composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
15512
+ );
15513
+ const persistSessionRuntimeCapabilities = React50.useCallback(
15514
+ async (nextThreadId, selection) => {
15515
+ if (!runtimeCapabilities || !selection || !client) {
15516
+ return;
15517
+ }
15518
+ try {
15519
+ const result = await persistConversationRuntimeCapabilities({
15520
+ client,
15521
+ threadId: nextThreadId,
15522
+ capabilities: runtimeCapabilities,
15523
+ selection
15524
+ });
15525
+ warnMissingRuntimeCapabilityReferences(
15526
+ "persisted selection",
15527
+ result.missing
15528
+ );
15529
+ } catch (error) {
15530
+ console.warn(
15531
+ "[Chat] Failed to persist runtime capabilities selection:",
15532
+ error
15533
+ );
15534
+ }
15535
+ },
15536
+ [client, runtimeCapabilities]
15537
+ );
15538
+ const applyExternalRuntimeCapabilities = React50.useCallback(
15539
+ (selection) => {
15540
+ pendingExternalRuntimeCapabilitiesRef.current = selection;
15541
+ setRunRuntimeCapabilities(() => {
15542
+ const emptySelection = createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities);
15543
+ if (!selection) {
15544
+ return emptySelection;
15545
+ }
15546
+ if (!runtimeCapabilities) {
15547
+ return selection;
15548
+ }
15549
+ pendingExternalRuntimeCapabilitiesRef.current = null;
15550
+ return mergeRuntimeCapabilitiesSelections(
15551
+ runtimeCapabilities,
15552
+ emptySelection,
15553
+ selection
15554
+ );
15555
+ });
15556
+ },
15557
+ [runtimeCapabilities]
15558
+ );
15559
+ const handleSessionRuntimeCapabilityToggle = React50.useCallback(
15560
+ (type, id, selected) => {
15561
+ setSessionRuntimeCapabilities((previous) => {
15562
+ const nextSelection = toggleRuntimeCapabilitySelection(
15563
+ previous,
15564
+ type,
15565
+ id,
15566
+ selected
15567
+ );
15568
+ const normalizedThreadId = threadId?.trim();
15569
+ if (normalizedThreadId) {
15570
+ void persistSessionRuntimeCapabilities(
15571
+ normalizedThreadId,
15572
+ nextSelection
15573
+ );
15574
+ }
15575
+ return nextSelection;
15576
+ });
15577
+ },
15578
+ [persistSessionRuntimeCapabilities, threadId]
15579
+ );
15580
+ const addRunRuntimeCapabilities = React50.useCallback(
15581
+ (selection) => {
15582
+ setRunRuntimeCapabilities(
15583
+ (previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
15584
+ runtimeCapabilities,
15585
+ previous,
15586
+ selection
15587
+ ) : previous
15588
+ );
15589
+ },
15590
+ [runtimeCapabilities]
15591
+ );
15592
+ const resetRunRuntimeCapabilities = React50.useCallback(() => {
15593
+ setRunRuntimeCapabilities(
15594
+ createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
15595
+ );
15596
+ setRuntimeCapabilityPalette(null);
15597
+ }, [runtimeCapabilities]);
15598
+ const getRuntimeCapabilitiesForSubmit = React50.useCallback(
15599
+ (recommended) => {
15600
+ const recommendedRuntimeCapabilitiesForSubmit = recommended && runtimeCapabilities && runtimeCapabilitiesReady ? mergeRuntimeCapabilitiesSelections(
15601
+ runtimeCapabilities,
15602
+ runRuntimeCapabilities,
15603
+ recommended
15604
+ ) : runRuntimeCapabilities;
15605
+ const runtimeCapabilitiesForSubmit = runtimeCapabilities && runtimeCapabilitiesReady ? createRuntimeCapabilitiesForSubmit({
15606
+ capabilities: runtimeCapabilities,
15607
+ available: effectiveSessionRuntimeCapabilities,
15608
+ recommended: recommendedRuntimeCapabilitiesForSubmit
15609
+ }) : null;
15610
+ const runtimeCapabilityOptionsForMessage = getRuntimeCapabilityOptionsForSelection(
15611
+ getRecommendedRuntimeCapabilitiesSelection(
15612
+ runtimeCapabilitiesForSubmit
15613
+ ),
15614
+ runtimeCapabilityOptions
15615
+ );
15616
+ return {
15617
+ runtimeCapabilitiesForSubmit,
15618
+ runtimeCapabilityOptionsForMessage
15619
+ };
15620
+ },
15621
+ [
15622
+ effectiveSessionRuntimeCapabilities,
15623
+ runRuntimeCapabilities,
15624
+ runtimeCapabilities,
15625
+ runtimeCapabilitiesReady,
15626
+ runtimeCapabilityOptions
15627
+ ]
15628
+ );
15629
+ const getRuntimeCapabilitiesForCommand = React50.useCallback(
15630
+ (recommended) => runtimeCapabilities && runtimeCapabilitiesReady ? createRuntimeCapabilitiesForSubmit({
15631
+ capabilities: runtimeCapabilities,
15632
+ available: effectiveSessionRuntimeCapabilities,
15633
+ recommended
15634
+ }) : recommended ?? null,
15635
+ [
15636
+ effectiveSessionRuntimeCapabilities,
15637
+ runtimeCapabilities,
15638
+ runtimeCapabilitiesReady
15639
+ ]
15640
+ );
15641
+ React50.useEffect(() => {
15642
+ if (disabled || !client || !assistantId) {
15643
+ pendingExternalRuntimeCapabilitiesRef.current = null;
15644
+ setRuntimeCapabilities(null);
15645
+ setRuntimeCapabilitiesReady(false);
15646
+ setSessionRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
15647
+ setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
15648
+ setRuntimeCapabilityPalette(null);
15649
+ return;
15650
+ }
15651
+ const controller = new AbortController();
15652
+ setRuntimeCapabilitiesReady(false);
15653
+ setRuntimeCapabilities(null);
15654
+ setRuntimeCapabilityPalette(null);
15655
+ void client.assistants.getRuntimeCapabilities(assistantId, {
15656
+ signal: controller.signal
15657
+ }).then((payload) => {
15658
+ setRuntimeCapabilities(payload);
15659
+ setRuntimeCapabilitiesReady(true);
15660
+ setSessionRuntimeCapabilities(
15661
+ createDefaultRuntimeCapabilitiesSelection(payload)
15662
+ );
15663
+ setRunRuntimeCapabilities(
15664
+ createEmptyRuntimeCapabilitiesSelection(payload)
15665
+ );
15666
+ }).catch((error) => {
15667
+ if (controller.signal.aborted) {
15668
+ return;
15669
+ }
15670
+ if (getHttpStatus(error) === 404) {
15671
+ setRuntimeCapabilities(null);
15672
+ setRuntimeCapabilitiesReady(false);
15673
+ setSessionRuntimeCapabilities(
15674
+ createEmptyRuntimeCapabilitiesSelection()
15675
+ );
15676
+ setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
15677
+ return;
15678
+ }
15679
+ console.warn("[Chat] Failed to load runtime capabilities:", error);
15680
+ setRuntimeCapabilities(null);
15681
+ setRuntimeCapabilitiesReady(false);
15682
+ setSessionRuntimeCapabilities(
15683
+ createEmptyRuntimeCapabilitiesSelection()
15684
+ );
15685
+ setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
15686
+ });
15687
+ return () => controller.abort();
15688
+ }, [assistantId, client, disabled]);
15689
+ React50.useEffect(() => {
15690
+ const emptyRunSelection = createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities);
15691
+ const pendingExternalSelection = pendingExternalRuntimeCapabilitiesRef.current;
15692
+ if (pendingExternalSelection && runtimeCapabilities) {
15693
+ setRunRuntimeCapabilities(
15694
+ mergeRuntimeCapabilitiesSelections(
15695
+ runtimeCapabilities,
15696
+ emptyRunSelection,
15697
+ pendingExternalSelection
15698
+ )
15699
+ );
15700
+ pendingExternalRuntimeCapabilitiesRef.current = null;
15701
+ } else {
15702
+ setRunRuntimeCapabilities(pendingExternalSelection ?? emptyRunSelection);
15703
+ }
15704
+ if (!runtimeCapabilitiesReady || !runtimeCapabilities || !client) {
15705
+ setSessionRuntimeCapabilities(
15706
+ createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
15707
+ );
15708
+ return;
15709
+ }
15710
+ const defaultSelection = createDefaultRuntimeCapabilitiesSelection(runtimeCapabilities);
15711
+ const normalizedThreadId = threadId?.trim();
15712
+ if (!normalizedThreadId) {
15713
+ setSessionRuntimeCapabilities(defaultSelection);
15714
+ return;
15715
+ }
15716
+ let cancelled = false;
15717
+ const requestId = runtimeCapabilityPreferenceLoadRef.current + 1;
15718
+ runtimeCapabilityPreferenceLoadRef.current = requestId;
15719
+ setSessionRuntimeCapabilities(defaultSelection);
15720
+ void loadConversationRuntimeCapabilities({
15721
+ client,
15722
+ threadId: normalizedThreadId,
15723
+ capabilities: runtimeCapabilities
15724
+ }).then(({ selection, missing }) => {
15725
+ if (cancelled || runtimeCapabilityPreferenceLoadRef.current !== requestId) {
15726
+ return;
15727
+ }
15728
+ warnMissingRuntimeCapabilityReferences("loaded selection", missing);
15729
+ setSessionRuntimeCapabilities(selection ?? defaultSelection);
15730
+ }).catch((error) => {
15731
+ if (cancelled || runtimeCapabilityPreferenceLoadRef.current !== requestId) {
15732
+ return;
15733
+ }
15734
+ console.warn(
15735
+ "[Chat] Failed to load persisted runtime capabilities selection:",
15736
+ error
15737
+ );
15738
+ setSessionRuntimeCapabilities(defaultSelection);
15739
+ });
15740
+ return () => {
15741
+ cancelled = true;
15742
+ };
15743
+ }, [
15744
+ client,
15745
+ runtimeCapabilities,
15746
+ runtimeCapabilitiesReady,
15747
+ threadId
15748
+ ]);
15749
+ return {
15750
+ runtimeCapabilities,
15751
+ runtimeCapabilitiesReady,
15752
+ runtimeCapabilityOptions,
15753
+ effectiveSessionRuntimeCapabilities,
15754
+ runRuntimeCapabilities,
15755
+ runRuntimeCapabilityOptions,
15756
+ detachedRunRuntimeCapabilityOptions,
15757
+ runtimeCapabilityPalette,
15758
+ setRunRuntimeCapabilities,
15759
+ setRuntimeCapabilityPalette,
15760
+ applyExternalRuntimeCapabilities,
15761
+ handleSessionRuntimeCapabilityToggle,
15762
+ addRunRuntimeCapabilities,
15763
+ resetRunRuntimeCapabilities,
15764
+ getRuntimeCapabilitiesForSubmit,
15765
+ getRuntimeCapabilitiesForCommand,
15766
+ persistSessionRuntimeCapabilities
15767
+ };
15768
+ }
15769
+ function useRuntimeCapabilityComposerActions({
15770
+ runtimeCapabilities,
15771
+ runtimeCapabilitiesReady,
15772
+ runtimeCapabilityOptions,
15773
+ setRunRuntimeCapabilities,
15774
+ setRuntimeCapabilityPalette,
15775
+ applyExternalRuntimeCapabilities,
15776
+ composerInputRef,
15777
+ composerPartsRef,
15778
+ commitComposerParts,
15779
+ focusComposerAt
15780
+ }) {
15781
+ const pendingExternalRuntimeCapabilityInsertRef = React50.useRef(null);
15782
+ const insertExternalRuntimeCapabilities = React50.useCallback(
15783
+ (selection) => {
15784
+ applyExternalRuntimeCapabilities(selection);
15785
+ if (!selection) {
15786
+ pendingExternalRuntimeCapabilityInsertRef.current = null;
15787
+ return;
15788
+ }
15789
+ if (!runtimeCapabilitiesReady || !runtimeCapabilities) {
15790
+ pendingExternalRuntimeCapabilityInsertRef.current = selection;
15791
+ return;
15792
+ }
15793
+ pendingExternalRuntimeCapabilityInsertRef.current = null;
15794
+ const existingKeys = getComposerCapabilitySelectionKeys(
15795
+ composerPartsRef.current
15796
+ );
15797
+ const selectedOptions = runtimeCapabilityOptions.filter(
15798
+ (option) => isRuntimeCapabilitySelected(selection, option.type, option.id) && !existingKeys.has(getRuntimeCapabilityOptionKey(option))
15799
+ );
15800
+ if (selectedOptions.length === 0) {
15801
+ focusComposerAt();
15802
+ return;
15803
+ }
15804
+ const currentParts = composerPartsRef.current;
15805
+ const insertAt = getComposerEditingLength(currentParts);
15806
+ const nextParts = replaceComposerRange(
15807
+ currentParts,
15808
+ insertAt,
15809
+ insertAt,
15810
+ selectedOptions.map(
15811
+ (option) => createComposerCapabilityPart(option, createMessageId())
15812
+ )
15813
+ );
15814
+ const nextCaretOffset = insertAt + selectedOptions.length;
15815
+ commitComposerParts(nextParts, {
15816
+ caretOffset: nextCaretOffset,
15817
+ resetDom: true,
15818
+ syncRemovedCapabilityTokens: true
15819
+ });
15820
+ setRuntimeCapabilityPalette(null);
15821
+ focusComposerAt(nextCaretOffset);
15822
+ },
15823
+ [
15824
+ applyExternalRuntimeCapabilities,
15825
+ commitComposerParts,
15826
+ composerPartsRef,
15827
+ focusComposerAt,
15828
+ runtimeCapabilities,
15829
+ runtimeCapabilitiesReady,
15830
+ runtimeCapabilityOptions,
15831
+ setRuntimeCapabilityPalette
15832
+ ]
15833
+ );
15834
+ const applyComposerValueRuntimeCapabilities = React50.useCallback(
15835
+ (payload) => {
15836
+ const runtimeCapabilitiesPayload = isRuntimeCapabilitiesSelection(payload.runtimeCapabilities) ? payload.runtimeCapabilities : payload.runtimeCapabilities === null ? null : void 0;
15837
+ if (runtimeCapabilitiesPayload === void 0) {
15838
+ return;
15839
+ }
15840
+ if (payload.insertRuntimeCapabilities === true) {
15841
+ insertExternalRuntimeCapabilities(runtimeCapabilitiesPayload);
15842
+ } else {
15843
+ applyExternalRuntimeCapabilities(runtimeCapabilitiesPayload);
15844
+ }
15845
+ },
15846
+ [applyExternalRuntimeCapabilities, insertExternalRuntimeCapabilities]
15847
+ );
15848
+ const updateRuntimeCapabilityPalette = React50.useCallback(
15849
+ (parts, selectionStart) => {
15850
+ const input = composerInputRef.current;
15851
+ const editingText = getComposerEditingText(parts);
15852
+ const nextPalette = resolveRuntimeCapabilityPalette(
15853
+ editingText,
15854
+ typeof selectionStart === "number" ? selectionStart : input ? getComposerSelectionOffset(input) : getComposerEditingLength(parts)
15855
+ );
15856
+ setRuntimeCapabilityPalette(nextPalette);
15857
+ },
15858
+ [composerInputRef, setRuntimeCapabilityPalette]
15859
+ );
15860
+ const removeRunRuntimeCapability = React50.useCallback(
15861
+ (option) => {
15862
+ setRunRuntimeCapabilities(
15863
+ (previous) => toggleRuntimeCapabilitySelection(
15864
+ previous,
15865
+ option.type,
15866
+ option.id,
15867
+ false
15868
+ )
15869
+ );
15870
+ commitComposerParts(
15871
+ removeComposerCapabilityTokens(composerPartsRef.current, option),
15872
+ {
15873
+ resetDom: true,
15874
+ syncRemovedCapabilityTokens: false
15875
+ }
15876
+ );
15877
+ },
15878
+ [commitComposerParts, composerPartsRef, setRunRuntimeCapabilities]
15879
+ );
15880
+ const insertComposerCapabilityToken = React50.useCallback(
15881
+ (capability, range) => {
15882
+ const token = createComposerCapabilityPart(capability, createMessageId());
15883
+ const currentParts = composerPartsRef.current;
15884
+ const replaceRange = range ?? {
15885
+ start: getComposerEditingLength(currentParts),
15886
+ end: getComposerEditingLength(currentParts)
15887
+ };
15888
+ const nextParts = replaceComposerRange(
15889
+ currentParts,
15890
+ replaceRange.start,
15891
+ replaceRange.end,
15892
+ [token]
15893
+ );
15894
+ commitComposerParts(nextParts, {
15895
+ caretOffset: replaceRange.start + 1,
15896
+ resetDom: true,
15897
+ syncRemovedCapabilityTokens: true
15898
+ });
15899
+ setRunRuntimeCapabilities(
15900
+ (previous) => toggleRuntimeCapabilitySelection(
15901
+ previous,
15902
+ capability.type,
15903
+ capability.id,
15904
+ true
15905
+ )
15906
+ );
15907
+ setRuntimeCapabilityPalette(null);
15908
+ focusComposerAt(replaceRange.start + 1);
15909
+ },
15910
+ [
15911
+ commitComposerParts,
15912
+ composerPartsRef,
15913
+ focusComposerAt,
15914
+ setRunRuntimeCapabilities,
15915
+ setRuntimeCapabilityPalette
15916
+ ]
15917
+ );
15918
+ React50.useEffect(() => {
15919
+ if (!runtimeCapabilitiesReady || !runtimeCapabilities) {
15920
+ return;
15921
+ }
15922
+ const pendingSelection = pendingExternalRuntimeCapabilityInsertRef.current;
15923
+ if (!pendingSelection) {
15924
+ return;
15925
+ }
15926
+ insertExternalRuntimeCapabilities(pendingSelection);
15927
+ }, [
15928
+ insertExternalRuntimeCapabilities,
15929
+ runtimeCapabilities,
15930
+ runtimeCapabilitiesReady
15931
+ ]);
15932
+ return {
15933
+ applyComposerValueRuntimeCapabilities,
15934
+ insertExternalRuntimeCapabilities,
15935
+ updateRuntimeCapabilityPalette,
15936
+ removeRunRuntimeCapability,
15937
+ insertComposerCapabilityToken
15938
+ };
15939
+ }
15940
+ function HumanRuntimeCapabilityChips({
15941
+ options
15942
+ }) {
15943
+ if (options.length === 0) {
15944
+ return null;
15945
+ }
15946
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
15947
+ "span",
15948
+ {
15949
+ 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",
15950
+ children: [
15951
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
15952
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
15953
+ ]
15954
+ },
15955
+ `${option.type}:${option.id}`
15956
+ )) });
15957
+ }
15958
+ function DetachedRunRuntimeCapabilities({
15959
+ options,
15960
+ runOnlyLabel,
15961
+ removeLabel,
15962
+ onRemove
15963
+ }) {
15964
+ if (options.length === 0) {
15965
+ return null;
15966
+ }
15967
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
15968
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-muted-foreground", children: runOnlyLabel }),
15969
+ options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
15970
+ "span",
15971
+ {
15972
+ 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",
15973
+ children: [
15974
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
15975
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "max-w-40 truncate", children: option.label }),
15976
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
15977
+ "button",
15978
+ {
15979
+ type: "button",
15980
+ onClick: () => onRemove(option),
15981
+ className: "rounded-full p-0.5 hover:bg-primary/15",
15982
+ title: removeLabel,
15983
+ "aria-label": removeLabel,
15984
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.X, { size: 11 })
15985
+ }
15986
+ )
15987
+ ]
15988
+ },
15989
+ `${option.type}:${option.id}`
15990
+ ))
15991
+ ] });
15992
+ }
15993
+ function ComposerCapabilityToken({
15994
+ part
15995
+ }) {
15996
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
15997
+ "span",
15998
+ {
15999
+ "data-composer-capability-key": part.key,
16000
+ "data-capability-type": part.capability.type,
16001
+ "data-capability-id": part.capability.id,
16002
+ contentEditable: false,
16003
+ className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
16004
+ children: [
16005
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RuntimeCapabilityIcon, { option: part.capability, variant: "chip" }),
16006
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "truncate", children: part.capability.label })
16007
+ ]
16008
+ },
16009
+ part.key
16010
+ );
16011
+ }
16012
+
16013
+ // src/lib/message-navigation.ts
16014
+ var MESSAGE_NAVIGATION_MIN_ITEMS = 3;
16015
+ var MAX_PREVIEW_LENGTH = 180;
16016
+ var MAX_TAG_LENGTH = 40;
16017
+ function isRecord6(value) {
16018
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
16019
+ }
16020
+ function readString4(value) {
16021
+ return typeof value === "string" && value.trim() ? value.trim() : null;
16022
+ }
16023
+ function normalizeWhitespace(value) {
16024
+ return value.replace(/\s+/g, " ").trim();
16025
+ }
16026
+ function truncate(value, maxLength) {
16027
+ const normalized = normalizeWhitespace(value);
16028
+ if (normalized.length <= maxLength) return normalized;
16029
+ return `${normalized.slice(0, Math.max(0, maxLength - 1)).trimEnd()}...`;
16030
+ }
16031
+ function pushText(draft, value) {
16032
+ const text = readString4(value);
16033
+ if (text) draft.text.push(text);
16034
+ }
16035
+ function pushTag(draft, value) {
16036
+ const tag = readString4(value);
16037
+ if (!tag) return;
16038
+ const normalized = truncate(tag, MAX_TAG_LENGTH);
16039
+ if (!draft.tags.includes(normalized)) {
16040
+ draft.tags.push(normalized);
16041
+ }
16042
+ }
16043
+ function mergeTags(...tagGroups) {
16044
+ const tags = [];
16045
+ for (const group of tagGroups) {
16046
+ for (const tag of group) {
16047
+ if (!tags.includes(tag)) tags.push(tag);
16048
+ }
16049
+ }
16050
+ return tags;
16051
+ }
16052
+ function getMessageNavigationItemId(message, index) {
16053
+ const messageId = readString4(message.id);
16054
+ if (messageId) return messageId;
16055
+ const type = readString4(message.type) ?? "message";
16056
+ return `${type}-${index}`;
16057
+ }
16058
+ function getMessageNavigationRole(type) {
16059
+ const normalized = readString4(type)?.toLowerCase();
16060
+ if (normalized === "human" || normalized === "user") return "user";
16061
+ if (normalized === "ai" || normalized === "assistant") return "assistant";
16062
+ if (normalized === "system") return "system";
16063
+ if (normalized === "tool") return "tool";
16064
+ if (normalized === "event") return "event";
16065
+ return "message";
16066
+ }
16067
+ function isTextContent4(content) {
16068
+ return content.type === "text";
16069
+ }
16070
+ function isReasoningContent4(content) {
16071
+ return content.type === "reasoning";
16072
+ }
16073
+ function isComponentContent4(content) {
16074
+ return content.type === "component";
16075
+ }
16076
+ function isMemoryContent2(content) {
16077
+ return content.type === "memory";
16078
+ }
16079
+ function isWidgetComponent3(content) {
16080
+ const data = content.data;
16081
+ return data?.type === "Widget" && Array.isArray(data.widgets);
16082
+ }
16083
+ function isMcpAppComponent2(content) {
16084
+ const data = content.data;
16085
+ return data?.type === "McpApp" && typeof data.appInstanceId === "string";
16086
+ }
16087
+ function collectWidgetContent(draft, content, labels) {
16088
+ const names = content.data.widgets.map((widget) => readString4(widget.name)).filter((name) => Boolean(name));
16089
+ if (names.length === 0) {
16090
+ pushTag(draft, labels.widget);
16091
+ return;
16092
+ }
16093
+ for (const name of names) {
16094
+ pushTag(draft, name);
16095
+ }
16096
+ }
16097
+ function collectMcpAppContent(draft, content, labels, language) {
16098
+ const title = readString4((0, import_chatkit_types6.resolveLocalizedText)(content.data.title, language)) ?? readString4(content.data.toolName) ?? labels.mcpApp;
16099
+ pushTag(draft, title);
16100
+ pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(content.data.description, language));
16101
+ }
16102
+ function collectComponentContent(draft, content, labels, language, options) {
16103
+ if (isWidgetComponent3(content)) {
16104
+ collectWidgetContent(draft, content, labels);
16105
+ return;
16106
+ }
16107
+ if (isMcpAppComponent2(content)) {
16108
+ collectMcpAppContent(draft, content, labels, language);
16109
+ return;
16110
+ }
16111
+ const data = getToolStepData(content);
16112
+ pushTag(
16113
+ draft,
16114
+ (0, import_chatkit_types6.resolveLocalizedText)(data.message, language) ?? getToolActivityLabel(content, language)
16115
+ );
16116
+ if (options.includeComponentText !== false) {
16117
+ pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.message, language));
16118
+ pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.title, language));
16119
+ pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.tool, language));
16120
+ pushText(draft, (0, import_chatkit_types6.resolveLocalizedText)(data.type, language));
16121
+ }
16122
+ }
16123
+ function collectContentItem(draft, item, labels, language, options) {
16124
+ if (item === void 0 || isThreadContextUsageRenderArtifact(item)) return;
16125
+ if (typeof item === "string") {
16126
+ pushText(draft, item);
16127
+ return;
16128
+ }
16129
+ if (isTextContent4(item) || isReasoningContent4(item)) {
16130
+ pushText(draft, item.text);
16131
+ if (isReasoningContent4(item)) pushTag(draft, labels.reasoning);
16132
+ return;
16133
+ }
16134
+ if (item.type === "image_url") {
16135
+ pushTag(draft, labels.image);
16136
+ return;
16137
+ }
16138
+ if (isComponentContent4(item)) {
16139
+ collectComponentContent(draft, item, labels, language, options);
16140
+ return;
16141
+ }
16142
+ if (isMemoryContent2(item)) {
16143
+ pushTag(draft, labels.memory);
16144
+ }
16145
+ }
16146
+ function collectContent(draft, content, labels, language, options = {}) {
16147
+ if (typeof content === "string") {
16148
+ pushText(draft, content);
16149
+ return;
16150
+ }
16151
+ if (!Array.isArray(content)) {
16152
+ return;
16153
+ }
16154
+ for (const item of content) {
16155
+ collectContentItem(
16156
+ draft,
16157
+ item,
16158
+ labels,
16159
+ language,
16160
+ options
16161
+ );
16162
+ }
16163
+ }
16164
+ function collectReasoning(draft, reasoning, labels) {
16165
+ if (!Array.isArray(reasoning)) return;
16166
+ for (const item of reasoning) {
16167
+ if (!isRecord6(item)) continue;
16168
+ pushText(draft, item.text);
16169
+ if (readString4(item.text)) pushTag(draft, labels.reasoning);
16170
+ }
16171
+ }
16172
+ function collectFiles(draft, value, fallbackLabel) {
16173
+ if (!Array.isArray(value)) return;
16174
+ for (const file of value) {
16175
+ if (!isRecord6(file)) continue;
16176
+ pushTag(
16177
+ draft,
16178
+ file.originalName ?? file.name ?? file.fileName ?? file.id ?? fallbackLabel
16179
+ );
16180
+ }
16181
+ }
16182
+ function collectReferences(draft, value) {
16183
+ for (const reference of normalizeReferences(value)) {
16184
+ pushTag(draft, getReferenceLabel(reference));
16185
+ }
16186
+ }
16187
+ function collectRuntimeCapabilities(draft, value) {
16188
+ if (!Array.isArray(value)) return;
16189
+ for (const option of value) {
16190
+ if (!isRecord6(option)) continue;
16191
+ pushTag(draft, option.label ?? option.id ?? option.type);
16192
+ }
16193
+ }
16194
+ function getTitle(role, labels, assistantTitle) {
16195
+ if (role === "assistant" && assistantTitle?.trim()) {
16196
+ return assistantTitle.trim();
16197
+ }
16198
+ return labels[role];
16199
+ }
16200
+ function buildMessageNavigationItemSummary(message, index, options, collectOptions = {}) {
16201
+ const role = getMessageNavigationRole(message.type);
16202
+ const draft = {
16203
+ text: [],
16204
+ tags: []
16205
+ };
16206
+ const language = options.language ?? "en-US";
16207
+ const labels = options.labels;
16208
+ if (role === "user") {
16209
+ pushText(draft, message.submittedInput);
16210
+ }
16211
+ collectContent(draft, message.content, labels, language, collectOptions);
16212
+ collectReasoning(draft, message.reasoning, labels);
16213
+ collectFiles(draft, message.fileAssets, labels.attachment);
16214
+ collectFiles(draft, message.attachments, labels.attachment);
16215
+ collectReferences(draft, message.references);
16216
+ collectRuntimeCapabilities(draft, message.runtimeCapabilityOptions);
16217
+ const text = draft.text.map(normalizeWhitespace).filter(Boolean).join(" ");
16218
+ const preview = truncate(text, MAX_PREVIEW_LENGTH) || draft.tags.slice(0, 2).join(" \xB7 ");
16219
+ if (!preview && draft.tags.length === 0) {
16220
+ return null;
16221
+ }
16222
+ const messageId = readString4(message.id) ?? void 0;
16223
+ return {
16224
+ id: getMessageNavigationItemId(message, index),
16225
+ ...messageId ? { messageId } : {},
16226
+ index,
16227
+ role,
16228
+ title: getTitle(role, labels, options.assistantTitle),
15570
16229
  preview,
15571
16230
  tags: draft.tags
15572
16231
  };
@@ -15604,7 +16263,7 @@ function buildMessageNavigationItems(messages, options) {
15604
16263
  }
15605
16264
 
15606
16265
  // src/components/chat.tsx
15607
- var import_jsx_runtime55 = require("react/jsx-runtime");
16266
+ var import_jsx_runtime56 = require("react/jsx-runtime");
15608
16267
  var import_meta2 = {};
15609
16268
  var defaultApiUrl2 = import_meta2.env.VITE_XPERTAI_API_URL;
15610
16269
  var COMPOSER_INPUT_MAX_HEIGHT = 128;
@@ -15621,47 +16280,6 @@ function formatGoalElapsed(seconds) {
15621
16280
  const remainingSeconds = seconds % 60;
15622
16281
  return remainingSeconds ? `${minutes}m ${remainingSeconds}s` : `${minutes}m`;
15623
16282
  }
15624
- function getSlashPaletteEmptyLabelKey(palette, runtimeCapabilitiesReady) {
15625
- if (!palette.capabilityTypes || palette.capabilityTypes.length !== 1) {
15626
- return "composer.capabilities.emptySearch";
15627
- }
15628
- if (!runtimeCapabilitiesReady) {
15629
- return "composer.slashCommands.empty.loadingCapabilities";
15630
- }
15631
- const hasQuery = palette.query.trim().length > 0;
15632
- const capabilityType = palette.capabilityTypes[0];
15633
- if (capabilityType === "skill") {
15634
- return hasQuery ? "composer.slashCommands.empty.matchingSkills" : "composer.slashCommands.empty.skills";
15635
- }
15636
- if (capabilityType === "plugin") {
15637
- return hasQuery ? "composer.slashCommands.empty.matchingPlugins" : "composer.slashCommands.empty.plugins";
15638
- }
15639
- return hasQuery ? "composer.slashCommands.empty.matchingSubAgents" : "composer.slashCommands.empty.subAgents";
15640
- }
15641
- function getHttpStatus(error) {
15642
- if (!error || typeof error !== "object" || !("status" in error)) {
15643
- return null;
15644
- }
15645
- const status = error.status;
15646
- return typeof status === "number" ? status : null;
15647
- }
15648
- function warnMissingRuntimeCapabilityReferences(action, missing) {
15649
- if (!hasMissingRuntimeCapabilityReferences(missing)) {
15650
- return;
15651
- }
15652
- console.warn(
15653
- `[Chat] Runtime capabilities ${action} include unavailable references:`,
15654
- missing
15655
- );
15656
- }
15657
- function getSelectedRuntimeCapabilityOptions(selection, options) {
15658
- if (!selection) {
15659
- return [];
15660
- }
15661
- return options.filter(
15662
- (option) => isRuntimeCapabilitySelected(selection, option.type, option.id)
15663
- );
15664
- }
15665
16283
  async function readImageDimensions(file) {
15666
16284
  if (typeof window === "undefined" || typeof URL === "undefined") {
15667
16285
  return {};
@@ -15749,8 +16367,8 @@ function ReferenceChip({
15749
16367
  }) {
15750
16368
  const metaLine = getReferenceMetaLine(reference);
15751
16369
  const isComposer = variant === "composer";
15752
- const Icon = reference.type === "quote" ? import_lucide_react29.Quote : reference.type === "image" ? import_lucide_react29.ImageIcon : import_lucide_react29.FileText;
15753
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
16370
+ const Icon = reference.type === "quote" ? import_lucide_react30.Quote : reference.type === "image" ? import_lucide_react30.ImageIcon : import_lucide_react30.FileText;
16371
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
15754
16372
  "div",
15755
16373
  {
15756
16374
  className: cn(
@@ -15759,7 +16377,7 @@ function ReferenceChip({
15759
16377
  ),
15760
16378
  title: getReferenceTitle(reference),
15761
16379
  children: [
15762
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
16380
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
15763
16381
  Icon,
15764
16382
  {
15765
16383
  size: isComposer ? 14 : 12,
@@ -15769,8 +16387,8 @@ function ReferenceChip({
15769
16387
  )
15770
16388
  }
15771
16389
  ),
15772
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "min-w-0 flex-1", children: [
15773
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
16390
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "min-w-0 flex-1", children: [
16391
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
15774
16392
  "div",
15775
16393
  {
15776
16394
  className: cn(
@@ -15780,7 +16398,7 @@ function ReferenceChip({
15780
16398
  children: getReferenceLabel(reference)
15781
16399
  }
15782
16400
  ),
15783
- metaLine && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
16401
+ metaLine && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
15784
16402
  "div",
15785
16403
  {
15786
16404
  className: cn(
@@ -15791,7 +16409,7 @@ function ReferenceChip({
15791
16409
  }
15792
16410
  )
15793
16411
  ] }),
15794
- onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
16412
+ onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
15795
16413
  "button",
15796
16414
  {
15797
16415
  type: "button",
@@ -15802,7 +16420,7 @@ function ReferenceChip({
15802
16420
  ),
15803
16421
  title: removeLabel,
15804
16422
  "aria-label": removeLabel,
15805
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.X, { size: 12 })
16423
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.X, { size: 12 })
15806
16424
  }
15807
16425
  )
15808
16426
  ]
@@ -15827,26 +16445,56 @@ function Chat({
15827
16445
  const { setStream } = useStreamManager();
15828
16446
  const stream = useStreamContext();
15829
16447
  const { theme } = useTheme();
15830
- const [isHistoryLoading, setIsHistoryLoading] = React50.useState(false);
15831
- const [historyError, setHistoryError] = React50.useState(null);
15832
- const [assistantName, setAssistantName] = React50.useState(null);
15833
- const [assistantAvatar, setAssistantAvatar] = React50.useState(null);
15834
- const [threadGoal, setThreadGoal] = React50.useState(null);
15835
- const [goalError, setGoalError] = React50.useState(null);
15836
- const [isGoalLoading, setIsGoalLoading] = React50.useState(false);
15837
- const [isGoalPanelOpen, setIsGoalPanelOpen] = React50.useState(false);
15838
- const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] = React50.useState(false);
15839
- const [goalElapsedStartedAt, setGoalElapsedStartedAt] = React50.useState(null);
16448
+ const effectiveClientSecret = stream.apiKey?.trim() ? stream.apiKey : clientSecret;
16449
+ const missingConfigKind = getMissingApiConfigurationKind({
16450
+ apiUrl,
16451
+ clientSecret: effectiveClientSecret
16452
+ });
16453
+ const missingConfig = Boolean(missingConfigKind);
16454
+ const missingConfigShortMessage = React51.useMemo(() => {
16455
+ switch (missingConfigKind) {
16456
+ case "apiUrl":
16457
+ return t("chat.missingApiUrlShort");
16458
+ case "clientSecret":
16459
+ return t("chat.missingClientSecretShort");
16460
+ case "apiUrlAndClientSecret":
16461
+ return t("chat.missingApiUrlAndClientSecretShort");
16462
+ default:
16463
+ return t("chat.missingConfigShort");
16464
+ }
16465
+ }, [missingConfigKind, t]);
16466
+ const missingConfigDetailMessage = React51.useMemo(() => {
16467
+ switch (missingConfigKind) {
16468
+ case "apiUrl":
16469
+ return t("chat.missingApiUrlDetail");
16470
+ case "clientSecret":
16471
+ return t("chat.missingClientSecretDetail");
16472
+ case "apiUrlAndClientSecret":
16473
+ return t("chat.missingApiUrlAndClientSecretDetail");
16474
+ default:
16475
+ return t("chat.missingConfigDetail");
16476
+ }
16477
+ }, [missingConfigKind, t]);
16478
+ const [isHistoryLoading, setIsHistoryLoading] = React51.useState(false);
16479
+ const [historyError, setHistoryError] = React51.useState(null);
16480
+ const [assistantName, setAssistantName] = React51.useState(null);
16481
+ const [assistantAvatar, setAssistantAvatar] = React51.useState(null);
16482
+ const [threadGoal, setThreadGoal] = React51.useState(null);
16483
+ const [goalError, setGoalError] = React51.useState(null);
16484
+ const [isGoalLoading, setIsGoalLoading] = React51.useState(false);
16485
+ const [isGoalPanelOpen, setIsGoalPanelOpen] = React51.useState(false);
16486
+ const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] = React51.useState(false);
16487
+ const [goalElapsedStartedAt, setGoalElapsedStartedAt] = React51.useState(null);
15840
16488
  const LOADING_DOTS_MIN_DURATION = 800;
15841
16489
  const STREAMING_STATUS_REFRESH_MS = 250;
15842
- const [showLoadingDots, setShowLoadingDots] = React50.useState(false);
15843
- const [streamingNow, setStreamingNow] = React50.useState(() => Date.now());
15844
- const loadingStartTimeRef = React50.useRef(null);
15845
- const lastStreamOutputAtRef = React50.useRef(null);
15846
- React50.useEffect(() => {
16490
+ const [showLoadingDots, setShowLoadingDots] = React51.useState(false);
16491
+ const [streamingNow, setStreamingNow] = React51.useState(() => Date.now());
16492
+ const loadingStartTimeRef = React51.useRef(null);
16493
+ const lastStreamOutputAtRef = React51.useRef(null);
16494
+ React51.useEffect(() => {
15847
16495
  setStream(stream);
15848
16496
  }, [setStream, stream]);
15849
- React50.useEffect(() => {
16497
+ React51.useEffect(() => {
15850
16498
  if (stream.isLoading) {
15851
16499
  if (!loadingStartTimeRef.current) {
15852
16500
  loadingStartTimeRef.current = Date.now();
@@ -15869,7 +16517,7 @@ function Chat({
15869
16517
  }
15870
16518
  }
15871
16519
  }, [stream.isLoading]);
15872
- React50.useEffect(() => {
16520
+ React51.useEffect(() => {
15873
16521
  if (!stream.isLoading) {
15874
16522
  lastStreamOutputAtRef.current = null;
15875
16523
  setStreamingNow(Date.now());
@@ -15879,7 +16527,7 @@ function Chat({
15879
16527
  lastStreamOutputAtRef.current = now;
15880
16528
  setStreamingNow(now);
15881
16529
  }, [stream.messages, stream.isLoading]);
15882
- React50.useEffect(() => {
16530
+ React51.useEffect(() => {
15883
16531
  if (!stream.isLoading) {
15884
16532
  return;
15885
16533
  }
@@ -15888,7 +16536,7 @@ function Chat({
15888
16536
  }, STREAMING_STATUS_REFRESH_MS);
15889
16537
  return () => window.clearInterval(timer);
15890
16538
  }, [stream.isLoading]);
15891
- React50.useEffect(() => {
16539
+ React51.useEffect(() => {
15892
16540
  if (threadGoal?.status === "active" && stream.isLoading) {
15893
16541
  setGoalElapsedStartedAt(Date.now());
15894
16542
  return;
@@ -15900,86 +16548,100 @@ function Chat({
15900
16548
  threadGoal?.id,
15901
16549
  threadGoal?.status
15902
16550
  ]);
15903
- React50.useEffect(() => {
16551
+ React51.useEffect(() => {
15904
16552
  setIsGoalObjectiveExpanded(false);
15905
16553
  }, [threadGoal?.id]);
15906
- const [composerParts, setComposerParts] = React50.useState([]);
15907
- const [renderedComposerParts, setRenderedComposerParts] = React50.useState([]);
15908
- const [composerDomVersion, setComposerDomVersion] = React50.useState(0);
15909
- const [selectedTool, setSelectedTool] = React50.useState(
16554
+ const [composerParts, setComposerParts] = React51.useState([]);
16555
+ const [renderedComposerParts, setRenderedComposerParts] = React51.useState([]);
16556
+ const [composerDomVersion, setComposerDomVersion] = React51.useState(0);
16557
+ const [selectedTool, setSelectedTool] = React51.useState(
15910
16558
  null
15911
16559
  );
15912
- const [planModeEnabled, setPlanModeEnabled] = React50.useState(false);
15913
- const [petSettingsOpen, setPetSettingsOpen] = React50.useState(false);
15914
- const [petLocalSettings, setPetLocalSettings] = React50.useState(() => readPetLocalSettings());
15915
- const [runtimeCapabilities, setRuntimeCapabilities] = React50.useState(null);
15916
- const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React50.useState(false);
15917
- const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React50.useState(
15918
- () => createEmptyRuntimeCapabilitiesSelection()
15919
- );
15920
- const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React50.useState(
15921
- () => createEmptyRuntimeCapabilitiesSelection()
15922
- );
15923
- const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React50.useState(null);
15924
- const [attachmentState, setAttachmentState] = React50.useState({
16560
+ const [planModeEnabled, setPlanModeEnabled] = React51.useState(false);
16561
+ const [petSettingsOpen, setPetSettingsOpen] = React51.useState(false);
16562
+ const [petLocalSettings, setPetLocalSettings] = React51.useState(() => readPetLocalSettings());
16563
+ const [attachmentState, setAttachmentState] = React51.useState({
15925
16564
  uploadedFiles: [],
15926
16565
  hasUploadingFiles: false,
15927
16566
  hasParsingFiles: false
15928
16567
  });
15929
- const [references, setReferences] = React50.useState([]);
15930
- const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React50.useState(false);
15931
- const [quoteSelection, setQuoteSelection] = React50.useState(null);
15932
- const [isAtBottom, setIsAtBottom] = React50.useState(true);
15933
- const [hasUpdatesBelow, setHasUpdatesBelow] = React50.useState(false);
16568
+ const [references, setReferences] = React51.useState([]);
16569
+ const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React51.useState(false);
16570
+ const [quoteSelection, setQuoteSelection] = React51.useState(null);
16571
+ const [isAtBottom, setIsAtBottom] = React51.useState(true);
16572
+ const [hasUpdatesBelow, setHasUpdatesBelow] = React51.useState(false);
15934
16573
  const {
15935
16574
  threads,
15936
16575
  deleteThread,
15937
16576
  refreshThreads,
15938
16577
  isLoading: isThreadsLoading
15939
16578
  } = useThreads();
15940
- const viewportRef = React50.useRef(null);
15941
- const messageNavigationAnchorsRef = React50.useRef(
16579
+ const viewportRef = React51.useRef(null);
16580
+ const messageNavigationAnchorsRef = React51.useRef(
15942
16581
  /* @__PURE__ */ new Map()
15943
16582
  );
15944
- const attachmentsRef = React50.useRef(null);
15945
- const composerInputRef = React50.useRef(null);
15946
- const slashPaletteRef = React50.useRef(null);
15947
- const slashPaletteOptionRefs = React50.useRef(
16583
+ const attachmentsRef = React51.useRef(null);
16584
+ const composerInputRef = React51.useRef(null);
16585
+ const slashPaletteRef = React51.useRef(null);
16586
+ const slashPaletteOptionRefs = React51.useRef(
15948
16587
  []
15949
16588
  );
15950
- const composerPartsRef = React50.useRef([]);
15951
- const pendingComposerCaretOffsetRef = React50.useRef(null);
15952
- const shouldAutoScrollRef = React50.useRef(true);
15953
- const forceFollowRef = React50.useRef(false);
15954
- const previousMessageCountRef = React50.useRef(0);
15955
- const previousScrollTopRef = React50.useRef(0);
15956
- const isPrependingHistoryMessagesRef = React50.useRef(false);
15957
- const autoScrollFrameRef = React50.useRef(null);
15958
- const isPointerDownRef = React50.useRef(false);
15959
- const lastTouchYRef = React50.useRef(null);
15960
- const runtimeCapabilityPreferenceLoadRef = React50.useRef(0);
16589
+ const composerPartsRef = React51.useRef([]);
16590
+ const pendingComposerCaretOffsetRef = React51.useRef(null);
16591
+ const shouldAutoScrollRef = React51.useRef(true);
16592
+ const forceFollowRef = React51.useRef(false);
16593
+ const previousMessageCountRef = React51.useRef(0);
16594
+ const previousScrollTopRef = React51.useRef(0);
16595
+ const isPrependingHistoryMessagesRef = React51.useRef(false);
16596
+ const autoScrollFrameRef = React51.useRef(null);
16597
+ const isPointerDownRef = React51.useRef(false);
16598
+ const lastTouchYRef = React51.useRef(null);
16599
+ const {
16600
+ runtimeCapabilities,
16601
+ runtimeCapabilitiesReady,
16602
+ runtimeCapabilityOptions,
16603
+ effectiveSessionRuntimeCapabilities,
16604
+ runRuntimeCapabilities,
16605
+ detachedRunRuntimeCapabilityOptions,
16606
+ runtimeCapabilityPalette,
16607
+ setRunRuntimeCapabilities,
16608
+ setRuntimeCapabilityPalette,
16609
+ applyExternalRuntimeCapabilities,
16610
+ handleSessionRuntimeCapabilityToggle,
16611
+ addRunRuntimeCapabilities,
16612
+ resetRunRuntimeCapabilities,
16613
+ getRuntimeCapabilitiesForSubmit,
16614
+ getRuntimeCapabilitiesForCommand,
16615
+ persistSessionRuntimeCapabilities
16616
+ } = useRuntimeCapabilitiesState({
16617
+ client: stream.client,
16618
+ assistantId: stream.assistantId,
16619
+ threadId: stream.threadId,
16620
+ disabled: missingConfig || !stream.client || !stream.assistantId,
16621
+ composerParts
16622
+ });
15961
16623
  const resolvedTitle = title ?? t("chat.title");
15962
16624
  const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
15963
16625
  const assistantTitle = assistantName || resolvedTitle;
15964
16626
  const petRequired = options?.displayMode === "pet";
15965
- const basePetSettings = React50.useMemo(
16627
+ const basePetSettings = React51.useMemo(
15966
16628
  () => derivePetLocalSettings(options?.pet),
15967
16629
  [options?.pet]
15968
16630
  );
15969
- const displayedPetSettings = React50.useMemo(
16631
+ const displayedPetSettings = React51.useMemo(
15970
16632
  () => ({
15971
16633
  ...petLocalSettings ?? basePetSettings,
15972
16634
  ...petRequired ? { enabled: true } : {}
15973
16635
  }),
15974
16636
  [basePetSettings, petLocalSettings, petRequired]
15975
16637
  );
15976
- const effectivePet = React50.useMemo(() => {
16638
+ const effectivePet = React51.useMemo(() => {
15977
16639
  if (petRequired || petLocalSettings) {
15978
16640
  return buildPetOptionsFromLocalSettings(displayedPetSettings);
15979
16641
  }
15980
16642
  return options?.pet ?? null;
15981
16643
  }, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
15982
- const savePetLocalSettings = React50.useCallback(
16644
+ const savePetLocalSettings = React51.useCallback(
15983
16645
  (settings) => {
15984
16646
  const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
15985
16647
  setPetLocalSettings(nextSettings);
@@ -15987,7 +16649,7 @@ function Chat({
15987
16649
  },
15988
16650
  [petRequired]
15989
16651
  );
15990
- const handlePetCommand = React50.useCallback(
16652
+ const handlePetCommand = React51.useCallback(
15991
16653
  (mode) => {
15992
16654
  if (mode === "settings") {
15993
16655
  setPetSettingsOpen(true);
@@ -16009,11 +16671,11 @@ function Chat({
16009
16671
  [displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
16010
16672
  );
16011
16673
  const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
16012
- const messages = React50.useMemo(
16674
+ const messages = React51.useMemo(
16013
16675
  () => stream.messages ?? [],
16014
16676
  [stream.messages]
16015
16677
  );
16016
- const messageNavigationLabels = React50.useMemo(
16678
+ const messageNavigationLabels = React51.useMemo(
16017
16679
  () => ({
16018
16680
  user: t("chat.youLabel"),
16019
16681
  assistant: assistantTitle,
@@ -16032,7 +16694,7 @@ function Chat({
16032
16694
  }),
16033
16695
  [assistantTitle, t]
16034
16696
  );
16035
- const messageNavigationItems = React50.useMemo(
16697
+ const messageNavigationItems = React51.useMemo(
16036
16698
  () => messageNavigationEnabled ? buildMessageNavigationItems(
16037
16699
  messages,
16038
16700
  {
@@ -16055,7 +16717,7 @@ function Chat({
16055
16717
  historyMessagePagination?.isLoadingMore
16056
16718
  );
16057
16719
  const canLoadMoreMessages = Boolean(historyMessagePagination?.hasMore);
16058
- const draft = React50.useMemo(
16720
+ const draft = React51.useMemo(
16059
16721
  () => getComposerPlainText(composerParts),
16060
16722
  [composerParts]
16061
16723
  );
@@ -16069,7 +16731,7 @@ function Chat({
16069
16731
  isEmpty: isComposerInputEmpty,
16070
16732
  isStacked: isComposerStacked
16071
16733
  });
16072
- const pendingFollowUps = React50.useMemo(
16734
+ const pendingFollowUps = React51.useMemo(
16073
16735
  () => sortVisiblePendingFollowUps(stream.pendingFollowUps ?? []),
16074
16736
  [stream.pendingFollowUps]
16075
16737
  );
@@ -16078,81 +16740,23 @@ function Chat({
16078
16740
  const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
16079
16741
  const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
16080
16742
  const hasPendingTodos = Boolean(stream.todos?.items.length);
16081
- const runtimeCapabilityOptions = React50.useMemo(
16082
- () => getRuntimeCapabilityOptions(runtimeCapabilities),
16083
- [runtimeCapabilities]
16084
- );
16085
- const goalAdapter = React50.useMemo(() => {
16743
+ const goalAdapter = React51.useMemo(() => {
16086
16744
  if (isGoalAdapter(options?.goal)) {
16087
16745
  return options.goal;
16088
16746
  }
16089
16747
  return supportsXpertThreadGoalAdapter(stream.client) ? createXpertThreadGoalAdapter(stream.client) : null;
16090
16748
  }, [options?.goal, stream.client]);
16091
16749
  const displayedGoalElapsedSeconds = threadGoal ? (threadGoal.elapsedSeconds ?? 0) + (goalElapsedStartedAt ? Math.max(0, Math.floor((streamingNow - goalElapsedStartedAt) / 1e3)) : 0) : 0;
16092
- const effectiveSessionRuntimeCapabilities = React50.useMemo(
16093
- () => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
16094
- runtimeCapabilities,
16095
- sessionRuntimeCapabilities
16096
- ) : null,
16097
- [runtimeCapabilities, runtimeCapabilitiesReady, sessionRuntimeCapabilities]
16098
- );
16099
16750
  const goalCommandAvailable = hasSelectedRuntimeSlashCommand(
16100
16751
  runtimeCapabilities,
16101
16752
  effectiveSessionRuntimeCapabilities,
16102
16753
  "goal"
16103
16754
  );
16104
16755
  const showGoalStatus = goalCommandAvailable && !hasCompletedGoal && (Boolean(goalError) || threadGoal?.status === "active" && stream.isLoading);
16105
- const runRuntimeCapabilityOptions = React50.useMemo(
16106
- () => runtimeCapabilityOptions.filter(
16107
- (option) => isRuntimeCapabilitySelected(
16108
- runRuntimeCapabilities,
16109
- option.type,
16110
- option.id
16111
- )
16112
- ),
16113
- [runRuntimeCapabilities, runtimeCapabilityOptions]
16114
- );
16115
- const composerRuntimeCapabilitySelectionKeys = React50.useMemo(
16116
- () => getComposerCapabilitySelectionKeys(composerParts),
16117
- [composerParts]
16118
- );
16119
- const detachedRunRuntimeCapabilityOptions = React50.useMemo(
16120
- () => runRuntimeCapabilityOptions.filter(
16121
- (option) => !composerRuntimeCapabilitySelectionKeys.has(
16122
- getRuntimeCapabilityOptionKey(option)
16123
- )
16124
- ),
16125
- [composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
16126
- );
16127
- const persistSessionRuntimeCapabilities = React50.useCallback(
16128
- async (threadId, selection) => {
16129
- if (!runtimeCapabilities || !selection) {
16130
- return;
16131
- }
16132
- try {
16133
- const result = await persistConversationRuntimeCapabilities({
16134
- client: stream.client,
16135
- threadId,
16136
- capabilities: runtimeCapabilities,
16137
- selection
16138
- });
16139
- warnMissingRuntimeCapabilityReferences(
16140
- "persisted selection",
16141
- result.missing
16142
- );
16143
- } catch (error) {
16144
- console.warn(
16145
- "[Chat] Failed to persist runtime capabilities selection:",
16146
- error
16147
- );
16148
- }
16149
- },
16150
- [runtimeCapabilities, stream.client]
16151
- );
16152
- const clearQuoteSelection = React50.useCallback(() => {
16756
+ const clearQuoteSelection = React51.useCallback(() => {
16153
16757
  setQuoteSelection(null);
16154
16758
  }, []);
16155
- const commitComposerParts = React50.useCallback(
16759
+ const commitComposerParts = React51.useCallback(
16156
16760
  (nextParts, options2) => {
16157
16761
  const normalized = normalizeComposerParts(nextParts);
16158
16762
  const previous = composerPartsRef.current;
@@ -16161,23 +16765,17 @@ function Chat({
16161
16765
  pendingComposerCaretOffsetRef.current = options2.caretOffset;
16162
16766
  }
16163
16767
  if (options2?.syncRemovedCapabilityTokens ?? true) {
16164
- const nextKeys = getComposerCapabilityKeys(normalized);
16165
- const removedCapabilities = previous.filter(
16166
- (part) => part.type === "capability" && !nextKeys.has(part.key)
16768
+ const removedCapabilities = getRemovedComposerCapabilityParts(
16769
+ previous,
16770
+ normalized
16167
16771
  );
16168
16772
  if (removedCapabilities.length > 0) {
16169
- setRunRuntimeCapabilities((selection) => {
16170
- let nextSelection = selection;
16171
- for (const part of removedCapabilities) {
16172
- nextSelection = toggleRuntimeCapabilitySelection(
16173
- nextSelection,
16174
- part.capability.type,
16175
- part.capability.id,
16176
- false
16177
- );
16178
- }
16179
- return nextSelection;
16180
- });
16773
+ setRunRuntimeCapabilities(
16774
+ (selection) => removeComposerCapabilityPartsFromSelection(
16775
+ selection,
16776
+ removedCapabilities
16777
+ )
16778
+ );
16181
16779
  }
16182
16780
  }
16183
16781
  setComposerParts(normalized);
@@ -16186,9 +16784,9 @@ function Chat({
16186
16784
  setComposerDomVersion((version) => version + 1);
16187
16785
  }
16188
16786
  },
16189
- []
16787
+ [setRunRuntimeCapabilities]
16190
16788
  );
16191
- const setComposerText = React50.useCallback(
16789
+ const setComposerText = React51.useCallback(
16192
16790
  (text, caretOffset = text.length) => {
16193
16791
  commitComposerParts(createComposerTextParts(text), {
16194
16792
  caretOffset,
@@ -16198,7 +16796,7 @@ function Chat({
16198
16796
  },
16199
16797
  [commitComposerParts]
16200
16798
  );
16201
- const focusComposerAt = React50.useCallback((position) => {
16799
+ const focusComposerAt = React51.useCallback((position) => {
16202
16800
  const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
16203
16801
  pendingComposerCaretOffsetRef.current = nextPosition;
16204
16802
  requestAnimationFrame(() => {
@@ -16209,8 +16807,25 @@ function Chat({
16209
16807
  setComposerSelectionOffset(input, nextPosition);
16210
16808
  });
16211
16809
  }, []);
16810
+ const {
16811
+ applyComposerValueRuntimeCapabilities,
16812
+ updateRuntimeCapabilityPalette,
16813
+ removeRunRuntimeCapability,
16814
+ insertComposerCapabilityToken
16815
+ } = useRuntimeCapabilityComposerActions({
16816
+ runtimeCapabilities,
16817
+ runtimeCapabilitiesReady,
16818
+ runtimeCapabilityOptions,
16819
+ setRunRuntimeCapabilities,
16820
+ setRuntimeCapabilityPalette,
16821
+ applyExternalRuntimeCapabilities,
16822
+ composerInputRef,
16823
+ composerPartsRef,
16824
+ commitComposerParts,
16825
+ focusComposerAt
16826
+ });
16212
16827
  const parentMessenger = useParentMessenger({
16213
- onSetComposerValue: React50.useCallback(
16828
+ onSetComposerValue: React51.useCallback(
16214
16829
  (payload) => {
16215
16830
  if (!payload) {
16216
16831
  return;
@@ -16230,13 +16845,24 @@ function Chat({
16230
16845
  ) ?? null;
16231
16846
  setSelectedTool(nextTool);
16232
16847
  }
16848
+ applyComposerValueRuntimeCapabilities(payload);
16849
+ },
16850
+ [
16851
+ applyComposerValueRuntimeCapabilities,
16852
+ composer?.tools,
16853
+ setComposerText
16854
+ ]
16855
+ ),
16856
+ onSetRuntimeCapabilities: React51.useCallback(
16857
+ (selection) => {
16858
+ applyExternalRuntimeCapabilities(selection);
16233
16859
  },
16234
- [composer?.tools, setComposerText]
16860
+ [applyExternalRuntimeCapabilities]
16235
16861
  ),
16236
- onFocusComposer: React50.useCallback(() => {
16862
+ onFocusComposer: React51.useCallback(() => {
16237
16863
  composerInputRef.current?.focus();
16238
16864
  }, []),
16239
- onSetPetEnabled: React50.useCallback(
16865
+ onSetPetEnabled: React51.useCallback(
16240
16866
  (enabled) => {
16241
16867
  if (petRequired) {
16242
16868
  return;
@@ -16250,10 +16876,10 @@ function Chat({
16250
16876
  )
16251
16877
  });
16252
16878
  const canMinimizeToPet = parentMessenger?.isParentAvailable === true && isPetEnabled(effectivePet);
16253
- const handleMinimizeToPet = React50.useCallback(() => {
16879
+ const handleMinimizeToPet = React51.useCallback(() => {
16254
16880
  parentMessenger?.sendEvent("chat_minimize_change", { minimized: true });
16255
16881
  }, [parentMessenger]);
16256
- const syncQuoteSelection = React50.useCallback(() => {
16882
+ const syncQuoteSelection = React51.useCallback(() => {
16257
16883
  if (typeof window === "undefined") {
16258
16884
  clearQuoteSelection();
16259
16885
  return;
@@ -16298,23 +16924,23 @@ function Chat({
16298
16924
  left
16299
16925
  });
16300
16926
  }, [clearQuoteSelection]);
16301
- const cancelPendingAutoScroll = React50.useCallback(() => {
16927
+ const cancelPendingAutoScroll = React51.useCallback(() => {
16302
16928
  if (autoScrollFrameRef.current !== null) {
16303
16929
  cancelAnimationFrame(autoScrollFrameRef.current);
16304
16930
  autoScrollFrameRef.current = null;
16305
16931
  }
16306
16932
  }, []);
16307
- const disableAutoFollow = React50.useCallback(() => {
16933
+ const disableAutoFollow = React51.useCallback(() => {
16308
16934
  forceFollowRef.current = false;
16309
16935
  shouldAutoScrollRef.current = false;
16310
16936
  cancelPendingAutoScroll();
16311
16937
  }, [cancelPendingAutoScroll]);
16312
- const enableAutoFollow = React50.useCallback(() => {
16938
+ const enableAutoFollow = React51.useCallback(() => {
16313
16939
  forceFollowRef.current = true;
16314
16940
  shouldAutoScrollRef.current = true;
16315
16941
  setHasUpdatesBelow(false);
16316
16942
  }, []);
16317
- const scrollToBottom = React50.useCallback(
16943
+ const scrollToBottom = React51.useCallback(
16318
16944
  (smooth = false, force = false) => {
16319
16945
  if (force) {
16320
16946
  enableAutoFollow();
@@ -16341,7 +16967,7 @@ function Chat({
16341
16967
  },
16342
16968
  [cancelPendingAutoScroll, enableAutoFollow]
16343
16969
  );
16344
- const setMessageNavigationAnchor = React50.useCallback(
16970
+ const setMessageNavigationAnchor = React51.useCallback(
16345
16971
  (id, node) => {
16346
16972
  if (node) {
16347
16973
  messageNavigationAnchorsRef.current.set(id, node);
@@ -16351,15 +16977,15 @@ function Chat({
16351
16977
  },
16352
16978
  []
16353
16979
  );
16354
- const getMessageNavigationAnchor = React50.useCallback(
16980
+ const getMessageNavigationAnchor = React51.useCallback(
16355
16981
  (item) => messageNavigationAnchorsRef.current.get(item.id) ?? null,
16356
16982
  []
16357
16983
  );
16358
- const handleMessageNavigationNavigate = React50.useCallback(() => {
16984
+ const handleMessageNavigationNavigate = React51.useCallback(() => {
16359
16985
  disableAutoFollow();
16360
16986
  clearQuoteSelection();
16361
16987
  }, [clearQuoteSelection, disableAutoFollow]);
16362
- React50.useEffect(() => {
16988
+ React51.useEffect(() => {
16363
16989
  const viewport = viewportRef.current;
16364
16990
  if (!viewport) return;
16365
16991
  previousScrollTopRef.current = viewport.scrollTop;
@@ -16440,14 +17066,14 @@ function Chat({
16440
17066
  window.removeEventListener("pointercancel", stopPointerTracking);
16441
17067
  };
16442
17068
  }, [cancelPendingAutoScroll, disableAutoFollow]);
16443
- React50.useEffect(() => {
17069
+ React51.useEffect(() => {
16444
17070
  shouldAutoScrollRef.current = true;
16445
17071
  forceFollowRef.current = false;
16446
17072
  previousScrollTopRef.current = 0;
16447
17073
  setIsAtBottom(true);
16448
17074
  setHasUpdatesBelow(false);
16449
17075
  }, [stream.threadId]);
16450
- React50.useEffect(() => {
17076
+ React51.useEffect(() => {
16451
17077
  const messageCountChanged = messages.length !== previousMessageCountRef.current;
16452
17078
  previousMessageCountRef.current = messages.length;
16453
17079
  if (isPrependingHistoryMessagesRef.current) {
@@ -16456,50 +17082,20 @@ function Chat({
16456
17082
  }
16457
17083
  if (!shouldAutoScrollRef.current) {
16458
17084
  if (messageCountChanged || stream.isLoading) {
16459
- setHasUpdatesBelow(true);
16460
- }
16461
- return;
16462
- }
16463
- if (messageCountChanged || stream.isLoading) {
16464
- scrollToBottom();
16465
- }
16466
- }, [stream.isLoading, messages, scrollToBottom]);
16467
- const effectiveClientSecret = stream.apiKey?.trim() ? stream.apiKey : clientSecret;
16468
- const missingConfigKind = getMissingApiConfigurationKind({
16469
- apiUrl,
16470
- clientSecret: effectiveClientSecret
16471
- });
16472
- const missingConfig = Boolean(missingConfigKind);
16473
- const missingConfigShortMessage = React50.useMemo(() => {
16474
- switch (missingConfigKind) {
16475
- case "apiUrl":
16476
- return t("chat.missingApiUrlShort");
16477
- case "clientSecret":
16478
- return t("chat.missingClientSecretShort");
16479
- case "apiUrlAndClientSecret":
16480
- return t("chat.missingApiUrlAndClientSecretShort");
16481
- default:
16482
- return t("chat.missingConfigShort");
17085
+ setHasUpdatesBelow(true);
17086
+ }
17087
+ return;
16483
17088
  }
16484
- }, [missingConfigKind, t]);
16485
- const missingConfigDetailMessage = React50.useMemo(() => {
16486
- switch (missingConfigKind) {
16487
- case "apiUrl":
16488
- return t("chat.missingApiUrlDetail");
16489
- case "clientSecret":
16490
- return t("chat.missingClientSecretDetail");
16491
- case "apiUrlAndClientSecret":
16492
- return t("chat.missingApiUrlAndClientSecretDetail");
16493
- default:
16494
- return t("chat.missingConfigDetail");
17089
+ if (messageCountChanged || stream.isLoading) {
17090
+ scrollToBottom();
16495
17091
  }
16496
- }, [missingConfigKind, t]);
17092
+ }, [stream.isLoading, messages, scrollToBottom]);
16497
17093
  const showMissingConfig = !isClientSecretInitializing && missingConfig;
16498
17094
  const hasUploadingFiles = attachmentState.hasUploadingFiles;
16499
17095
  const isSubmissionBlocked = hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
16500
17096
  const isSendDisabled = !trimmedDraft && !hasReferences || isSubmissionBlocked;
16501
17097
  const isPromptEditDisabled = hasPendingInteractiveRequest || missingConfig || isHistoryLoading;
16502
- const resizeComposerInput = React50.useCallback(() => {
17098
+ const resizeComposerInput = React51.useCallback(() => {
16503
17099
  const input = composerInputRef.current;
16504
17100
  if (!input) {
16505
17101
  return;
@@ -16507,7 +17103,7 @@ function Chat({
16507
17103
  input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
16508
17104
  input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
16509
17105
  }, []);
16510
- React50.useLayoutEffect(() => {
17106
+ React51.useLayoutEffect(() => {
16511
17107
  composerPartsRef.current = composerParts;
16512
17108
  resizeComposerInput();
16513
17109
  const caretOffset = pendingComposerCaretOffsetRef.current;
@@ -16519,13 +17115,13 @@ function Chat({
16519
17115
  }
16520
17116
  }
16521
17117
  }, [composerDomVersion, composerParts, resizeComposerInput]);
16522
- React50.useEffect(() => {
17118
+ React51.useEffect(() => {
16523
17119
  document.addEventListener("selectionchange", syncQuoteSelection);
16524
17120
  return () => {
16525
17121
  document.removeEventListener("selectionchange", syncQuoteSelection);
16526
17122
  };
16527
17123
  }, [syncQuoteSelection]);
16528
- React50.useEffect(() => {
17124
+ React51.useEffect(() => {
16529
17125
  const viewport = viewportRef.current;
16530
17126
  if (!viewport) {
16531
17127
  return;
@@ -16542,14 +17138,14 @@ function Chat({
16542
17138
  window.removeEventListener("resize", handleViewportScroll);
16543
17139
  };
16544
17140
  }, [clearQuoteSelection]);
16545
- React50.useEffect(() => {
17141
+ React51.useEffect(() => {
16546
17142
  clearQuoteSelection();
16547
17143
  }, [messages.length, stream.threadId, clearQuoteSelection]);
16548
- React50.useEffect(() => {
17144
+ React51.useEffect(() => {
16549
17145
  if (missingConfig) return;
16550
17146
  void refreshThreads();
16551
17147
  }, [missingConfig, refreshThreads]);
16552
- React50.useEffect(() => {
17148
+ React51.useEffect(() => {
16553
17149
  if (missingConfig || !stream.client || !stream.assistantId) {
16554
17150
  setAssistantName(null);
16555
17151
  setAssistantAvatar(null);
@@ -16572,106 +17168,10 @@ function Chat({
16572
17168
  cancelled = true;
16573
17169
  };
16574
17170
  }, [missingConfig, stream.client, stream.assistantId]);
16575
- React50.useEffect(() => {
16576
- if (missingConfig || !stream.client || !stream.assistantId) {
16577
- setRuntimeCapabilities(null);
16578
- setRuntimeCapabilitiesReady(false);
16579
- setSessionRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
16580
- setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
16581
- setRuntimeCapabilityPalette(null);
16582
- return;
16583
- }
16584
- const controller = new AbortController();
16585
- setRuntimeCapabilitiesReady(false);
16586
- setRuntimeCapabilities(null);
16587
- setRuntimeCapabilityPalette(null);
16588
- void stream.client.assistants.getRuntimeCapabilities(stream.assistantId, {
16589
- signal: controller.signal
16590
- }).then((payload) => {
16591
- setRuntimeCapabilities(payload);
16592
- setRuntimeCapabilitiesReady(true);
16593
- setSessionRuntimeCapabilities(
16594
- createDefaultRuntimeCapabilitiesSelection(payload)
16595
- );
16596
- setRunRuntimeCapabilities(
16597
- createEmptyRuntimeCapabilitiesSelection(payload)
16598
- );
16599
- }).catch((error) => {
16600
- if (controller.signal.aborted) {
16601
- return;
16602
- }
16603
- if (getHttpStatus(error) === 404) {
16604
- setRuntimeCapabilities(null);
16605
- setRuntimeCapabilitiesReady(false);
16606
- setSessionRuntimeCapabilities(
16607
- createEmptyRuntimeCapabilitiesSelection()
16608
- );
16609
- setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
16610
- return;
16611
- }
16612
- console.warn("[Chat] Failed to load runtime capabilities:", error);
16613
- setRuntimeCapabilities(null);
16614
- setRuntimeCapabilitiesReady(false);
16615
- setSessionRuntimeCapabilities(
16616
- createEmptyRuntimeCapabilitiesSelection()
16617
- );
16618
- setRunRuntimeCapabilities(createEmptyRuntimeCapabilitiesSelection());
16619
- });
16620
- return () => controller.abort();
16621
- }, [missingConfig, stream.client, stream.assistantId]);
16622
- React50.useEffect(() => {
16623
- setRunRuntimeCapabilities(
16624
- createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
16625
- );
16626
- if (!runtimeCapabilitiesReady || !runtimeCapabilities) {
16627
- setSessionRuntimeCapabilities(
16628
- createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
16629
- );
16630
- return;
16631
- }
16632
- const defaultSelection = createDefaultRuntimeCapabilitiesSelection(runtimeCapabilities);
16633
- const threadId = stream.threadId?.trim();
16634
- if (!threadId) {
16635
- setSessionRuntimeCapabilities(defaultSelection);
16636
- return;
16637
- }
16638
- let cancelled = false;
16639
- const requestId = runtimeCapabilityPreferenceLoadRef.current + 1;
16640
- runtimeCapabilityPreferenceLoadRef.current = requestId;
16641
- setSessionRuntimeCapabilities(defaultSelection);
16642
- void loadConversationRuntimeCapabilities({
16643
- client: stream.client,
16644
- threadId,
16645
- capabilities: runtimeCapabilities
16646
- }).then(({ selection, missing }) => {
16647
- if (cancelled || runtimeCapabilityPreferenceLoadRef.current !== requestId) {
16648
- return;
16649
- }
16650
- warnMissingRuntimeCapabilityReferences("loaded selection", missing);
16651
- setSessionRuntimeCapabilities(selection ?? defaultSelection);
16652
- }).catch((error) => {
16653
- if (cancelled || runtimeCapabilityPreferenceLoadRef.current !== requestId) {
16654
- return;
16655
- }
16656
- console.warn(
16657
- "[Chat] Failed to load persisted runtime capabilities selection:",
16658
- error
16659
- );
16660
- setSessionRuntimeCapabilities(defaultSelection);
16661
- });
16662
- return () => {
16663
- cancelled = true;
16664
- };
16665
- }, [
16666
- runtimeCapabilities,
16667
- runtimeCapabilitiesReady,
16668
- stream.client,
16669
- stream.threadId
16670
- ]);
16671
- React50.useEffect(() => {
17171
+ React51.useEffect(() => {
16672
17172
  setThreadGoal(stream.threadGoal);
16673
17173
  }, [stream.threadGoal]);
16674
- React50.useEffect(() => {
17174
+ React51.useEffect(() => {
16675
17175
  const threadId = stream.threadId?.trim();
16676
17176
  if (!threadId || !goalCommandAvailable) {
16677
17177
  setThreadGoal(null);
@@ -16712,37 +17212,7 @@ function Chat({
16712
17212
  return () => controller.abort();
16713
17213
  }, [goalAdapter, goalCommandAvailable, stream.threadId]);
16714
17214
  const uploadedFiles = attachmentState.uploadedFiles;
16715
- const handleSessionRuntimeCapabilityToggle = React50.useCallback(
16716
- (type, id, selected) => {
16717
- setSessionRuntimeCapabilities((previous) => {
16718
- const nextSelection = toggleRuntimeCapabilitySelection(
16719
- previous,
16720
- type,
16721
- id,
16722
- selected
16723
- );
16724
- const threadId = stream.threadId?.trim();
16725
- if (threadId) {
16726
- void persistSessionRuntimeCapabilities(threadId, nextSelection);
16727
- }
16728
- return nextSelection;
16729
- });
16730
- },
16731
- [persistSessionRuntimeCapabilities, stream.threadId]
16732
- );
16733
- const updateRuntimeCapabilityPalette = React50.useCallback(
16734
- (parts, selectionStart) => {
16735
- const input = composerInputRef.current;
16736
- const editingText = getComposerEditingText(parts);
16737
- const nextPalette = resolveRuntimeCapabilityPalette(
16738
- editingText,
16739
- typeof selectionStart === "number" ? selectionStart : input ? getComposerSelectionOffset(input) : getComposerEditingLength(parts)
16740
- );
16741
- setRuntimeCapabilityPalette(nextPalette);
16742
- },
16743
- []
16744
- );
16745
- const syncComposerInputFromElement = React50.useCallback(
17215
+ const syncComposerInputFromElement = React51.useCallback(
16746
17216
  (input) => {
16747
17217
  const previousCapabilities = getComposerCapabilityPartMap(
16748
17218
  composerPartsRef.current
@@ -16760,45 +17230,25 @@ function Chat({
16760
17230
  },
16761
17231
  [commitComposerParts, updateRuntimeCapabilityPalette]
16762
17232
  );
16763
- const handleComposerInput = React50.useCallback(
17233
+ const handleComposerInput = React51.useCallback(
16764
17234
  (event) => {
16765
17235
  syncComposerInputFromElement(event.currentTarget);
16766
17236
  },
16767
17237
  [syncComposerInputFromElement]
16768
17238
  );
16769
- const handleComposerCompositionEnd = React50.useCallback(
17239
+ const handleComposerCompositionEnd = React51.useCallback(
16770
17240
  (event) => {
16771
17241
  syncComposerInputFromElement(event.currentTarget);
16772
17242
  },
16773
17243
  [syncComposerInputFromElement]
16774
17244
  );
16775
- const handleComposerSelect = React50.useCallback(() => {
17245
+ const handleComposerSelect = React51.useCallback(() => {
16776
17246
  updateRuntimeCapabilityPalette(
16777
17247
  composerPartsRef.current,
16778
17248
  composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
16779
17249
  );
16780
17250
  }, [updateRuntimeCapabilityPalette]);
16781
- const removeRunRuntimeCapability = React50.useCallback(
16782
- (option) => {
16783
- setRunRuntimeCapabilities(
16784
- (previous) => toggleRuntimeCapabilitySelection(
16785
- previous,
16786
- option.type,
16787
- option.id,
16788
- false
16789
- )
16790
- );
16791
- commitComposerParts(
16792
- removeComposerCapabilityTokens(composerPartsRef.current, option),
16793
- {
16794
- resetDom: true,
16795
- syncRemovedCapabilityTokens: false
16796
- }
16797
- );
16798
- },
16799
- [commitComposerParts]
16800
- );
16801
- const submitDraft = React50.useCallback(
17251
+ const submitDraft = React51.useCallback(
16802
17252
  (submitOptions = {}) => {
16803
17253
  if (isSubmissionBlocked) return;
16804
17254
  const contentToSubmit = (submitOptions.inputText ?? trimmedDraft).trim();
@@ -16813,22 +17263,10 @@ function Chat({
16813
17263
  if (!humanInput) {
16814
17264
  return;
16815
17265
  }
16816
- const recommendedRuntimeCapabilitiesForSubmit = submitOptions.runtimeCapabilities && runtimeCapabilities && runtimeCapabilitiesReady ? mergeRuntimeCapabilitiesSelections(
16817
- runtimeCapabilities,
16818
- runRuntimeCapabilities,
16819
- submitOptions.runtimeCapabilities
16820
- ) : runRuntimeCapabilities;
16821
- const runtimeCapabilitiesForSubmit = runtimeCapabilities && runtimeCapabilitiesReady ? createRuntimeCapabilitiesForSubmit({
16822
- capabilities: runtimeCapabilities,
16823
- available: effectiveSessionRuntimeCapabilities,
16824
- recommended: recommendedRuntimeCapabilitiesForSubmit
16825
- }) : null;
16826
- const runtimeCapabilityOptionsForMessage = getSelectedRuntimeCapabilityOptions(
16827
- getRecommendedRuntimeCapabilitiesSelection(
16828
- runtimeCapabilitiesForSubmit
16829
- ),
16830
- runtimeCapabilityOptions
16831
- );
17266
+ const {
17267
+ runtimeCapabilitiesForSubmit,
17268
+ runtimeCapabilityOptionsForMessage
17269
+ } = getRuntimeCapabilitiesForSubmit(submitOptions.runtimeCapabilities);
16832
17270
  const displayContent = submitOptions.displayText || contentToSubmit || (referencesToSend ? t("chat.referencedContentOnly") : "");
16833
17271
  const newMessage = {
16834
17272
  id: createMessageId(),
@@ -16896,21 +17334,16 @@ function Chat({
16896
17334
  }
16897
17335
  attachmentsRef.current?.clear();
16898
17336
  setReferences([]);
16899
- setRunRuntimeCapabilities(
16900
- createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
16901
- );
16902
- setRuntimeCapabilityPalette(null);
17337
+ resetRunRuntimeCapabilities();
16903
17338
  },
16904
17339
  [
16905
17340
  effectiveSessionRuntimeCapabilities,
17341
+ getRuntimeCapabilitiesForSubmit,
16906
17342
  isSubmissionBlocked,
16907
17343
  options?.request,
16908
17344
  persistSessionRuntimeCapabilities,
16909
17345
  references,
16910
- runtimeCapabilities,
16911
- runtimeCapabilitiesReady,
16912
- runtimeCapabilityOptions,
16913
- runRuntimeCapabilities,
17346
+ resetRunRuntimeCapabilities,
16914
17347
  scrollToBottom,
16915
17348
  selectedTool,
16916
17349
  commitComposerParts,
@@ -16921,7 +17354,7 @@ function Chat({
16921
17354
  t
16922
17355
  ]
16923
17356
  );
16924
- const handleGoalCommand = React50.useCallback(
17357
+ const handleGoalCommand = React51.useCallback(
16925
17358
  async ({
16926
17359
  args,
16927
17360
  commandSource,
@@ -16966,11 +17399,7 @@ function Chat({
16966
17399
  }
16967
17400
  if (startsGoalRun) {
16968
17401
  const goalRunThreadId = result.threadId ?? threadId;
16969
- const runtimeCapabilitiesForGoalRun = runtimeCapabilities && runtimeCapabilitiesReady ? createRuntimeCapabilitiesForSubmit({
16970
- capabilities: runtimeCapabilities,
16971
- available: effectiveSessionRuntimeCapabilities,
16972
- recommended: commandRuntimeCapabilities
16973
- }) : commandRuntimeCapabilities ?? null;
17402
+ const runtimeCapabilitiesForGoalRun = getRuntimeCapabilitiesForCommand(commandRuntimeCapabilities);
16974
17403
  const inputPayload = {
16975
17404
  input: GOAL_RUN_INPUT,
16976
17405
  commandSource,
@@ -17023,63 +17452,17 @@ function Chat({
17023
17452
  }
17024
17453
  },
17025
17454
  [
17026
- effectiveSessionRuntimeCapabilities,
17455
+ getRuntimeCapabilitiesForCommand,
17027
17456
  goalAdapter,
17028
17457
  options?.request,
17029
17458
  refreshThreads,
17030
- runtimeCapabilities,
17031
- runtimeCapabilitiesReady,
17032
17459
  stream,
17033
17460
  t
17034
17461
  ]
17035
17462
  );
17036
- const handleGoalPanelOpenChange = React50.useCallback((open) => {
17463
+ const handleGoalPanelOpenChange = React51.useCallback((open) => {
17037
17464
  setIsGoalPanelOpen(open);
17038
17465
  }, []);
17039
- const addRunRuntimeCapabilities = React50.useCallback(
17040
- (selection) => {
17041
- setRunRuntimeCapabilities(
17042
- (previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
17043
- runtimeCapabilities,
17044
- previous,
17045
- selection
17046
- ) : previous
17047
- );
17048
- },
17049
- [runtimeCapabilities]
17050
- );
17051
- const insertComposerCapabilityToken = React50.useCallback(
17052
- (capability, range) => {
17053
- const token = createComposerCapabilityPart(capability, createMessageId());
17054
- const currentParts = composerPartsRef.current;
17055
- const replaceRange = range ?? {
17056
- start: getComposerEditingLength(currentParts),
17057
- end: getComposerEditingLength(currentParts)
17058
- };
17059
- const nextParts = replaceComposerRange(
17060
- currentParts,
17061
- replaceRange.start,
17062
- replaceRange.end,
17063
- [token]
17064
- );
17065
- commitComposerParts(nextParts, {
17066
- caretOffset: replaceRange.start + 1,
17067
- resetDom: true,
17068
- syncRemovedCapabilityTokens: true
17069
- });
17070
- setRunRuntimeCapabilities(
17071
- (previous) => toggleRuntimeCapabilitySelection(
17072
- previous,
17073
- capability.type,
17074
- capability.id,
17075
- true
17076
- )
17077
- );
17078
- setRuntimeCapabilityPalette(null);
17079
- focusComposerAt(replaceRange.start + 1);
17080
- },
17081
- [commitComposerParts, focusComposerAt]
17082
- );
17083
17466
  const {
17084
17467
  slashPaletteOptions,
17085
17468
  executeSlashCommandFromDraft,
@@ -17107,7 +17490,7 @@ function Chat({
17107
17490
  submitPrompt: submitDraft
17108
17491
  });
17109
17492
  const slashPaletteEmptyLabel = runtimeCapabilityPalette ? t(
17110
- getSlashPaletteEmptyLabelKey(
17493
+ getRuntimeCapabilityPaletteEmptyLabelKey(
17111
17494
  runtimeCapabilityPalette,
17112
17495
  runtimeCapabilitiesReady
17113
17496
  )
@@ -17121,7 +17504,7 @@ function Chat({
17121
17504
  plugin: t("composer.slashCommands.empty.loadingCapabilities"),
17122
17505
  subAgent: t("composer.slashCommands.empty.loadingCapabilities")
17123
17506
  };
17124
- React50.useEffect(() => {
17507
+ React51.useEffect(() => {
17125
17508
  if (!runtimeCapabilityPalette) {
17126
17509
  return;
17127
17510
  }
@@ -17140,7 +17523,7 @@ function Chat({
17140
17523
  );
17141
17524
  }
17142
17525
  }, [slashPaletteOptions.length, runtimeCapabilityPalette]);
17143
- React50.useLayoutEffect(() => {
17526
+ React51.useLayoutEffect(() => {
17144
17527
  if (!runtimeCapabilityPalette) {
17145
17528
  return;
17146
17529
  }
@@ -17157,7 +17540,7 @@ function Chat({
17157
17540
  container.scrollTop += optionRect.bottom - containerRect.bottom;
17158
17541
  }
17159
17542
  }, [runtimeCapabilityPalette, slashPaletteOptions.length]);
17160
- const submitGoalModeDraft = React50.useCallback(() => {
17543
+ const submitGoalModeDraft = React51.useCallback(() => {
17161
17544
  const objective = getComposerPlainText(composerPartsRef.current).trim();
17162
17545
  if (!isGoalModeOpen || !goalCommandAvailable || !objective) {
17163
17546
  return false;
@@ -17195,7 +17578,7 @@ function Chat({
17195
17578
  }
17196
17579
  submitDraft();
17197
17580
  };
17198
- const handleEditPendingFollowUp = React50.useCallback(
17581
+ const handleEditPendingFollowUp = React51.useCallback(
17199
17582
  (id) => {
17200
17583
  const item = pendingFollowUps.find(
17201
17584
  (entry) => entry.id === id && entry.mode === "queue"
@@ -17222,7 +17605,7 @@ function Chat({
17222
17605
  },
17223
17606
  [pendingFollowUps, setComposerText, stream]
17224
17607
  );
17225
- const handleQuoteSelection = React50.useCallback(() => {
17608
+ const handleQuoteSelection = React51.useCallback(() => {
17226
17609
  if (!quoteSelection) {
17227
17610
  return;
17228
17611
  }
@@ -17238,7 +17621,7 @@ function Chat({
17238
17621
  const handleAttachmentClick = () => {
17239
17622
  attachmentsRef.current?.openFilePicker();
17240
17623
  };
17241
- const uploadContextFile = React50.useCallback(
17624
+ const uploadContextFile = React51.useCallback(
17242
17625
  (file) => {
17243
17626
  const formData = new FormData();
17244
17627
  formData.append("file", file, file.name || "upload");
@@ -17257,13 +17640,13 @@ function Chat({
17257
17640
  },
17258
17641
  [stream.assistantId, stream.client, stream.threadId]
17259
17642
  );
17260
- const getContextFileStatus = React50.useCallback(
17643
+ const getContextFileStatus = React51.useCallback(
17261
17644
  (fileId) => stream.client.contexts.fetch(`/files/${fileId}/status`, {
17262
17645
  method: "GET"
17263
17646
  }),
17264
17647
  [stream.client]
17265
17648
  );
17266
- const deleteContextFile = React50.useCallback(
17649
+ const deleteContextFile = React51.useCallback(
17267
17650
  (storageFileId) => stream.client.contexts.deleteFile(storageFileId),
17268
17651
  [stream.client]
17269
17652
  );
@@ -17371,7 +17754,7 @@ function Chat({
17371
17754
  }
17372
17755
  submitDraft();
17373
17756
  };
17374
- const handleComposerPaste = React50.useCallback(
17757
+ const handleComposerPaste = React51.useCallback(
17375
17758
  (event) => {
17376
17759
  const clipboardData = event.clipboardData;
17377
17760
  if (!clipboardData) {
@@ -17473,13 +17856,13 @@ function Chat({
17473
17856
  const handleToolSelect = (tool) => {
17474
17857
  setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
17475
17858
  };
17476
- const handlePromptClick = React50.useCallback(
17859
+ const handlePromptClick = React51.useCallback(
17477
17860
  (prompt) => {
17478
17861
  submitDraft({ inputText: prompt, displayText: prompt });
17479
17862
  },
17480
17863
  [submitDraft]
17481
17864
  );
17482
- const handlePromptEdit = React50.useCallback(
17865
+ const handlePromptEdit = React51.useCallback(
17483
17866
  (prompt) => {
17484
17867
  if (isPromptEditDisabled) return;
17485
17868
  setComposerText(prompt, prompt.length);
@@ -17488,7 +17871,7 @@ function Chat({
17488
17871
  },
17489
17872
  [focusComposerAt, isPromptEditDisabled, setComposerText]
17490
17873
  );
17491
- const loadConversationMessages = React50.useCallback(
17874
+ const loadConversationMessages = React51.useCallback(
17492
17875
  async (recordId) => {
17493
17876
  if (missingConfig) {
17494
17877
  setHistoryError(missingConfigShortMessage);
@@ -17509,7 +17892,7 @@ function Chat({
17509
17892
  },
17510
17893
  [missingConfig, missingConfigShortMessage, stream, t]
17511
17894
  );
17512
- const handleLoadMoreMessages = React50.useCallback(async () => {
17895
+ const handleLoadMoreMessages = React51.useCallback(async () => {
17513
17896
  if (!canLoadMoreMessages || isLoadingMoreMessages) {
17514
17897
  return;
17515
17898
  }
@@ -17618,15 +18001,15 @@ function Chat({
17618
18001
  };
17619
18002
  const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
17620
18003
  const canUploadDroppedFiles = composer?.attachments?.enabled === true && !missingConfig && !isHistoryLoading && !hasPendingInteractiveRequest;
17621
- const handleDroppedFiles = React50.useCallback((files) => {
18004
+ const handleDroppedFiles = React51.useCallback((files) => {
17622
18005
  return attachmentsRef.current?.queueFiles(files) ?? false;
17623
18006
  }, []);
17624
- const currentThread = React50.useMemo(
18007
+ const currentThread = React51.useMemo(
17625
18008
  () => threads.find((item) => item.id === stream.threadId),
17626
18009
  [threads, stream.threadId]
17627
18010
  );
17628
18011
  const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
17629
- const threadErrorMessage = React50.useMemo(() => {
18012
+ const threadErrorMessage = React51.useMemo(() => {
17630
18013
  if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
17631
18014
  if (currentThread?.status !== "error") return void 0;
17632
18015
  const message = currentThread.error?.trim();
@@ -17657,13 +18040,13 @@ function Chat({
17657
18040
  fallbackTitle: t("history.threadFallback")
17658
18041
  });
17659
18042
  const layoutMaxWidth = options?.layout?.maxWidth;
17660
- const chatColumnStyle = React50.useMemo(() => {
18043
+ const chatColumnStyle = React51.useMemo(() => {
17661
18044
  if (layoutMaxWidth === void 0 || layoutMaxWidth === null || layoutMaxWidth === "") {
17662
18045
  return void 0;
17663
18046
  }
17664
18047
  return { maxWidth: layoutMaxWidth };
17665
18048
  }, [layoutMaxWidth]);
17666
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18049
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
17667
18050
  UploadDroppedFiles,
17668
18051
  {
17669
18052
  ref: viewportRef,
@@ -17678,16 +18061,16 @@ function Chat({
17678
18061
  className
17679
18062
  ),
17680
18063
  children: [
17681
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18064
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
17682
18065
  "div",
17683
18066
  {
17684
18067
  "data-slot": "chatkit-chat-header",
17685
18068
  className: "mx-auto flex w-full items-center justify-between border-b p-2 sticky top-0 z-10 bg-background",
17686
18069
  style: chatColumnStyle,
17687
18070
  children: [
17688
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
17689
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "relative shrink-0", children: [
17690
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18071
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
18072
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "relative shrink-0", children: [
18073
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17691
18074
  ChatkitAvatar,
17692
18075
  {
17693
18076
  avatar: assistantAvatar,
@@ -17695,10 +18078,10 @@ function Chat({
17695
18078
  label: assistantTitle
17696
18079
  }
17697
18080
  ),
17698
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
18081
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
17699
18082
  ] }),
17700
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "truncate", children: [
17701
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18083
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "truncate", children: [
18084
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17702
18085
  "h2",
17703
18086
  {
17704
18087
  className: "text-lg font-semibold truncate",
@@ -17706,12 +18089,12 @@ function Chat({
17706
18089
  children: assistantTitle
17707
18090
  }
17708
18091
  ),
17709
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
18092
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
17710
18093
  ] })
17711
18094
  ] }),
17712
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-1", children: [
17713
- canMinimizeToPet && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Tooltip, { children: [
17714
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18095
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-1", children: [
18096
+ canMinimizeToPet && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
18097
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17715
18098
  "button",
17716
18099
  {
17717
18100
  type: "button",
@@ -17722,13 +18105,13 @@ function Chat({
17722
18105
  "transition-colors duration-150"
17723
18106
  ),
17724
18107
  "aria-label": t("chat.minimizeToPet"),
17725
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.Minus, { size: 16 })
18108
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Minus, { size: 16 })
17726
18109
  }
17727
18110
  ) }) }),
17728
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
18111
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
17729
18112
  ] }),
17730
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Tooltip, { children: [
17731
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18113
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
18114
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17732
18115
  "button",
17733
18116
  {
17734
18117
  type: "button",
@@ -17739,14 +18122,14 @@ function Chat({
17739
18122
  "transition-colors duration-150"
17740
18123
  ),
17741
18124
  "aria-label": t("settings.open"),
17742
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.Settings, { size: 16 })
18125
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Settings, { size: 16 })
17743
18126
  }
17744
18127
  ) }) }),
17745
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipContent, { side: "bottom", children: t("settings.open") })
18128
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { side: "bottom", children: t("settings.open") })
17746
18129
  ] }),
17747
- history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
17748
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Tooltip, { children: [
17749
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18130
+ history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
18131
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
18132
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17750
18133
  "button",
17751
18134
  {
17752
18135
  type: "button",
@@ -17759,12 +18142,12 @@ function Chat({
17759
18142
  "disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
17760
18143
  ),
17761
18144
  "aria-label": t("history.newThread"),
17762
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.Pencil, { size: 16 })
18145
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Pencil, { size: 16 })
17763
18146
  }
17764
18147
  ) }) }),
17765
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipContent, { side: "bottom", children: t("history.newThread") })
18148
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { side: "bottom", children: t("history.newThread") })
17766
18149
  ] }),
17767
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18150
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17768
18151
  HistorySidebar,
17769
18152
  {
17770
18153
  threads,
@@ -17781,7 +18164,7 @@ function Chat({
17781
18164
  ]
17782
18165
  }
17783
18166
  ),
17784
- showMessageNavigation && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18167
+ showMessageNavigation && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17785
18168
  MessageNavigator,
17786
18169
  {
17787
18170
  items: messageNavigationItems,
@@ -17792,18 +18175,18 @@ function Chat({
17792
18175
  tagsOverflowLabel: (count) => t("message.navigation.moreTags", { count })
17793
18176
  }
17794
18177
  ),
17795
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18178
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
17796
18179
  "div",
17797
18180
  {
17798
18181
  "data-slot": "chatkit-chat-content",
17799
18182
  className: "mx-auto w-full flex-1 p-4",
17800
18183
  style: chatColumnStyle,
17801
18184
  children: [
17802
- errorMessage && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
17803
- historyError && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
17804
- showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
17805
- isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
17806
- messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18185
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
18186
+ historyError && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
18187
+ showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
18188
+ isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
18189
+ messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17807
18190
  StartScreen,
17808
18191
  {
17809
18192
  startScreen,
@@ -17812,10 +18195,10 @@ function Chat({
17812
18195
  promptSendDisabled: isSubmissionBlocked,
17813
18196
  promptEditDisabled: isPromptEditDisabled
17814
18197
  }
17815
- ) : /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "space-y-4", children: [
17816
- canLoadMoreMessages && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-3 py-1", children: [
17817
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" }),
17818
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18198
+ ) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "space-y-4", children: [
18199
+ canLoadMoreMessages && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-3 py-1", children: [
18200
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" }),
18201
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17819
18202
  Button,
17820
18203
  {
17821
18204
  type: "button",
@@ -17827,7 +18210,7 @@ function Chat({
17827
18210
  children: isLoadingMoreMessages ? t("chat.loadingMoreMessages") : t("chat.loadMoreMessages")
17828
18211
  }
17829
18212
  ),
17830
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" })
18213
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" })
17831
18214
  ] }),
17832
18215
  messages.map((message, index) => {
17833
18216
  const messageType = String(message.type);
@@ -17852,7 +18235,7 @@ function Chat({
17852
18235
  ...humanMessage.fileAssets ?? [],
17853
18236
  ...humanMessage.attachments ?? []
17854
18237
  ];
17855
- const humanRuntimeCapabilityOptions = message.type === "human" ? humanMessage.runtimeCapabilityOptions ?? getSelectedRuntimeCapabilityOptions(
18238
+ const humanRuntimeCapabilityOptions = message.type === "human" ? humanMessage.runtimeCapabilityOptions ?? getRuntimeCapabilityOptionsForSelection(
17856
18239
  getRecommendedRuntimeCapabilitiesSelection(
17857
18240
  humanMessage.runtimeCapabilities
17858
18241
  ),
@@ -17868,7 +18251,7 @@ function Chat({
17868
18251
  if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
17869
18252
  return null;
17870
18253
  }
17871
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18254
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17872
18255
  "div",
17873
18256
  {
17874
18257
  ref: (node) => setMessageNavigationAnchor(messageNavigationId, node),
@@ -17878,7 +18261,7 @@ function Chat({
17878
18261
  message.type === "human" ? "justify-end" : "justify-start -ml-1"
17879
18262
  // AI messages: slightly closer to left
17880
18263
  ),
17881
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18264
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
17882
18265
  "div",
17883
18266
  {
17884
18267
  className: cn(
@@ -17886,7 +18269,7 @@ function Chat({
17886
18269
  isAssistantMessage && "min-w-0 flex-1"
17887
18270
  ),
17888
18271
  children: [
17889
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18272
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17890
18273
  "div",
17891
18274
  {
17892
18275
  ...canQuoteMessage ? {
@@ -17898,7 +18281,7 @@ function Chat({
17898
18281
  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"
17899
18282
  // AI messages: use chat-specific foreground color
17900
18283
  ),
17901
- children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18284
+ children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17902
18285
  AssistantMessage,
17903
18286
  {
17904
18287
  message: {
@@ -17917,25 +18300,14 @@ function Chat({
17917
18300
  organizationId: stream.organizationId,
17918
18301
  apiUrl: stream.apiUrl
17919
18302
  }
17920
- ) : /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
17921
- message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
17922
- "span",
18303
+ ) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
18304
+ message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18305
+ HumanRuntimeCapabilityChips,
17923
18306
  {
17924
- 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",
17925
- children: [
17926
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
17927
- RuntimeCapabilityIcon,
17928
- {
17929
- option,
17930
- variant: "chip"
17931
- }
17932
- ),
17933
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
17934
- ]
17935
- },
17936
- `${option.type}:${option.id}`
17937
- )) }),
17938
- message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18307
+ options: humanRuntimeCapabilityOptions
18308
+ }
18309
+ ),
18310
+ message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17939
18311
  ReferenceChip,
17940
18312
  {
17941
18313
  reference,
@@ -17943,29 +18315,29 @@ function Chat({
17943
18315
  },
17944
18316
  getReferenceKey(reference)
17945
18317
  )) }),
17946
- message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18318
+ message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
17947
18319
  "div",
17948
18320
  {
17949
18321
  className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
17950
18322
  children: [
17951
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.FileText, { size: 12 }),
17952
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
18323
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.FileText, { size: 12 }),
18324
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
17953
18325
  ]
17954
18326
  },
17955
18327
  fileIndex
17956
18328
  )) }),
17957
- Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18329
+ Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17958
18330
  "p",
17959
18331
  {
17960
18332
  className: "wrap-break-word text-sm leading-relaxed",
17961
18333
  children: formatMessageContent(part)
17962
18334
  },
17963
18335
  `${part.type}-${partIndex}`
17964
- )) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
18336
+ )) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
17965
18337
  ] })
17966
18338
  }
17967
18339
  ),
17968
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18340
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17969
18341
  MessageActions,
17970
18342
  {
17971
18343
  content: messageContent,
@@ -18003,7 +18375,7 @@ function Chat({
18003
18375
  stream.isLoading,
18004
18376
  { now: streamingNow }
18005
18377
  );
18006
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18378
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18007
18379
  AssistantStreamingIndicator,
18008
18380
  {
18009
18381
  status: fallbackStreamingStatus ?? "loading"
@@ -18014,7 +18386,7 @@ function Chat({
18014
18386
  ]
18015
18387
  }
18016
18388
  ),
18017
- !isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18389
+ !isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18018
18390
  Button,
18019
18391
  {
18020
18392
  type: "button",
@@ -18027,10 +18399,10 @@ function Chat({
18027
18399
  onClick: () => scrollToBottom(true, true),
18028
18400
  "aria-label": t("chat.scrollToBottom"),
18029
18401
  title: t("chat.scrollToBottom"),
18030
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.ArrowDown, { size: 16 })
18402
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.ArrowDown, { size: 16 })
18031
18403
  }
18032
18404
  ) }),
18033
- quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18405
+ quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18034
18406
  "div",
18035
18407
  {
18036
18408
  className: "pointer-events-none fixed z-50",
@@ -18039,7 +18411,7 @@ function Chat({
18039
18411
  left: `${quoteSelection.left}px`,
18040
18412
  transform: "translateX(-50%)"
18041
18413
  },
18042
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18414
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
18043
18415
  Button,
18044
18416
  {
18045
18417
  type: "button",
@@ -18051,22 +18423,22 @@ function Chat({
18051
18423
  "aria-label": t("composer.quoteSelection"),
18052
18424
  title: t("composer.quoteSelection"),
18053
18425
  children: [
18054
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.Quote, { size: 14 }),
18426
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Quote, { size: 14 }),
18055
18427
  t("composer.quoteSelection")
18056
18428
  ]
18057
18429
  }
18058
18430
  )
18059
18431
  }
18060
18432
  ),
18061
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18433
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
18062
18434
  "div",
18063
18435
  {
18064
18436
  "data-slot": "chatkit-chat-composer",
18065
18437
  className: "mx-auto w-full p-2 sticky bottom-0 z-10 bg-background",
18066
18438
  style: chatColumnStyle,
18067
18439
  children: [
18068
- threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("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 }),
18069
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18440
+ threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("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 }),
18441
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18070
18442
  ChatAttachments,
18071
18443
  {
18072
18444
  ref: attachmentsRef,
@@ -18080,7 +18452,7 @@ function Chat({
18080
18452
  onStateChange: setAttachmentState
18081
18453
  }
18082
18454
  ),
18083
- references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18455
+ references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18084
18456
  ReferenceChip,
18085
18457
  {
18086
18458
  reference,
@@ -18094,32 +18466,16 @@ function Chat({
18094
18466
  },
18095
18467
  getReferenceKey(reference)
18096
18468
  )) }),
18097
- detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
18098
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
18099
- detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18100
- "span",
18101
- {
18102
- 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",
18103
- children: [
18104
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
18105
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "max-w-40 truncate", children: option.label }),
18106
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18107
- "button",
18108
- {
18109
- type: "button",
18110
- onClick: () => removeRunRuntimeCapability(option),
18111
- className: "rounded-full p-0.5 hover:bg-primary/15",
18112
- title: t("composer.capabilities.removeRunCapability"),
18113
- "aria-label": t("composer.capabilities.removeRunCapability"),
18114
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.X, { size: 11 })
18115
- }
18116
- )
18117
- ]
18118
- },
18119
- `${option.type}:${option.id}`
18120
- ))
18121
- ] }),
18122
- showGoalStatus && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18469
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18470
+ DetachedRunRuntimeCapabilities,
18471
+ {
18472
+ options: detachedRunRuntimeCapabilityOptions,
18473
+ runOnlyLabel: t("composer.capabilities.runOnly"),
18474
+ removeLabel: t("composer.capabilities.removeRunCapability"),
18475
+ onRemove: removeRunRuntimeCapability
18476
+ }
18477
+ ),
18478
+ showGoalStatus && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
18123
18479
  "div",
18124
18480
  {
18125
18481
  className: cn(
@@ -18127,8 +18483,8 @@ function Chat({
18127
18483
  isGoalObjectiveExpanded ? "items-start" : "items-center"
18128
18484
  ),
18129
18485
  children: [
18130
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18131
- import_lucide_react29.Target,
18486
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18487
+ import_lucide_react30.Target,
18132
18488
  {
18133
18489
  className: cn(
18134
18490
  "size-4 shrink-0 text-muted-foreground",
@@ -18136,13 +18492,13 @@ function Chat({
18136
18492
  )
18137
18493
  }
18138
18494
  ),
18139
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "min-w-0 flex-1", children: [
18140
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
18141
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-medium", children: t("chat.goal.label") }),
18142
- threadGoal && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground", children: t(`chat.goal.status.${threadGoal.status}`) }),
18143
- isGoalLoading && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.Loader2, { className: "size-3 animate-spin text-muted-foreground" })
18495
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "min-w-0 flex-1", children: [
18496
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
18497
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "font-medium", children: t("chat.goal.label") }),
18498
+ threadGoal && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground", children: t(`chat.goal.status.${threadGoal.status}`) }),
18499
+ isGoalLoading && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Loader2, { className: "size-3 animate-spin text-muted-foreground" })
18144
18500
  ] }),
18145
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18501
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18146
18502
  "div",
18147
18503
  {
18148
18504
  className: cn(
@@ -18152,13 +18508,13 @@ function Chat({
18152
18508
  children: goalError || threadGoal?.objective
18153
18509
  }
18154
18510
  ),
18155
- threadGoal && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: t("chat.goal.elapsed", {
18511
+ threadGoal && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: t("chat.goal.elapsed", {
18156
18512
  elapsed: formatGoalElapsed(displayedGoalElapsedSeconds)
18157
18513
  }) }) })
18158
18514
  ] }),
18159
- threadGoal && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
18160
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Tooltip, { children: [
18161
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18515
+ threadGoal && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
18516
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
18517
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18162
18518
  Button,
18163
18519
  {
18164
18520
  type: "button",
@@ -18169,13 +18525,13 @@ function Chat({
18169
18525
  const prefix = "/goal edit ";
18170
18526
  setComposerText(`${prefix}${threadGoal.objective}`);
18171
18527
  },
18172
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.Pencil, { className: "size-3" })
18528
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Pencil, { className: "size-3" })
18173
18529
  }
18174
18530
  ) }),
18175
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipContent, { children: t("chat.goal.edit") })
18531
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { children: t("chat.goal.edit") })
18176
18532
  ] }),
18177
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Tooltip, { children: [
18178
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18533
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
18534
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18179
18535
  Button,
18180
18536
  {
18181
18537
  type: "button",
@@ -18191,13 +18547,13 @@ function Chat({
18191
18547
  executionType: "insert_invocation"
18192
18548
  }
18193
18549
  }),
18194
- children: threadGoal.status === "paused" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.Play, { className: "size-3" }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.Pause, { className: "size-3" })
18550
+ children: threadGoal.status === "paused" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Play, { className: "size-3" }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Pause, { className: "size-3" })
18195
18551
  }
18196
18552
  ) }),
18197
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
18553
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
18198
18554
  ] }),
18199
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Tooltip, { children: [
18200
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18555
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
18556
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18201
18557
  Button,
18202
18558
  {
18203
18559
  type: "button",
@@ -18213,13 +18569,13 @@ function Chat({
18213
18569
  executionType: "insert_invocation"
18214
18570
  }
18215
18571
  }),
18216
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.Trash2, { className: "size-3" })
18572
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.Trash2, { className: "size-3" })
18217
18573
  }
18218
18574
  ) }),
18219
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipContent, { children: t("chat.goal.clear") })
18575
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { children: t("chat.goal.clear") })
18220
18576
  ] }),
18221
- threadGoal.objective && !goalError && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Tooltip, { children: [
18222
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18577
+ threadGoal.objective && !goalError && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
18578
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18223
18579
  Button,
18224
18580
  {
18225
18581
  type: "button",
@@ -18228,8 +18584,8 @@ function Chat({
18228
18584
  "aria-expanded": isGoalObjectiveExpanded,
18229
18585
  "aria-label": isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective"),
18230
18586
  onClick: () => setIsGoalObjectiveExpanded((expanded) => !expanded),
18231
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18232
- import_lucide_react29.ChevronDown,
18587
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18588
+ import_lucide_react30.ChevronDown,
18233
18589
  {
18234
18590
  className: cn(
18235
18591
  "size-3 transition-transform",
@@ -18239,13 +18595,13 @@ function Chat({
18239
18595
  )
18240
18596
  }
18241
18597
  ) }),
18242
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
18598
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
18243
18599
  ] })
18244
18600
  ] })
18245
18601
  ]
18246
18602
  }
18247
18603
  ),
18248
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18604
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18249
18605
  PendingRuntimeServices,
18250
18606
  {
18251
18607
  state: stream.runtimeActivities.sandboxServices,
@@ -18254,7 +18610,7 @@ function Chat({
18254
18610
  className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
18255
18611
  }
18256
18612
  ),
18257
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18613
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18258
18614
  PendingTodos,
18259
18615
  {
18260
18616
  snapshot: stream.todos,
@@ -18262,7 +18618,7 @@ function Chat({
18262
18618
  className: hasPendingFollowUps ? "mb-2" : void 0
18263
18619
  }
18264
18620
  ),
18265
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18621
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18266
18622
  PendingFollowUps,
18267
18623
  {
18268
18624
  items: pendingFollowUps,
@@ -18275,7 +18631,7 @@ function Chat({
18275
18631
  attachToComposer: true
18276
18632
  }
18277
18633
  ),
18278
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18634
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18279
18635
  RequestUserInputPanel,
18280
18636
  {
18281
18637
  request: stream.pendingRequestUserInput,
@@ -18284,7 +18640,7 @@ function Chat({
18284
18640
  attachToComposer: true
18285
18641
  }
18286
18642
  ),
18287
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18643
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18288
18644
  HITLApprovalPanel,
18289
18645
  {
18290
18646
  request: stream.pendingHITLRequest,
@@ -18293,7 +18649,7 @@ function Chat({
18293
18649
  attachToComposer: true
18294
18650
  }
18295
18651
  ),
18296
- runtimeCapabilityPalette && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18652
+ runtimeCapabilityPalette && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18297
18653
  SlashPalette,
18298
18654
  {
18299
18655
  palette: runtimeCapabilityPalette,
@@ -18307,7 +18663,7 @@ function Chat({
18307
18663
  onSelect: selectSlashPaletteOption
18308
18664
  }
18309
18665
  ),
18310
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18666
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
18311
18667
  "div",
18312
18668
  {
18313
18669
  "data-slot": "composer-input-shell",
@@ -18321,7 +18677,7 @@ function Chat({
18321
18677
  composerInputRoundedClass
18322
18678
  ),
18323
18679
  children: [
18324
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18680
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18325
18681
  "div",
18326
18682
  {
18327
18683
  ref: composerInputRef,
@@ -18343,39 +18699,19 @@ function Chat({
18343
18699
  (missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
18344
18700
  ),
18345
18701
  children: renderedComposerParts.map(
18346
- (part, index) => part.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(React50.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18347
- "span",
18348
- {
18349
- "data-composer-capability-key": part.key,
18350
- "data-capability-type": part.capability.type,
18351
- "data-capability-id": part.capability.id,
18352
- contentEditable: false,
18353
- className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
18354
- children: [
18355
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18356
- RuntimeCapabilityIcon,
18357
- {
18358
- option: part.capability,
18359
- variant: "chip"
18360
- }
18361
- ),
18362
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "truncate", children: part.capability.label })
18363
- ]
18364
- },
18365
- part.key
18366
- )
18702
+ (part, index) => part.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(React51.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ComposerCapabilityToken, { part }, part.key)
18367
18703
  )
18368
18704
  },
18369
18705
  composerDomVersion
18370
18706
  ),
18371
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
18707
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
18372
18708
  "div",
18373
18709
  {
18374
18710
  "data-slot": "composer-action-bar",
18375
18711
  className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
18376
18712
  children: [
18377
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
18378
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18713
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
18714
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18379
18715
  ComposerMenu,
18380
18716
  {
18381
18717
  composer,
@@ -18393,20 +18729,20 @@ function Chat({
18393
18729
  disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
18394
18730
  }
18395
18731
  ) }),
18396
- selectedTool && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("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: [
18397
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
18398
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18732
+ selectedTool && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("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: [
18733
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
18734
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18399
18735
  "button",
18400
18736
  {
18401
18737
  type: "button",
18402
18738
  onClick: () => setSelectedTool(null),
18403
18739
  className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
18404
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react29.X, { size: 12 })
18740
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.X, { size: 12 })
18405
18741
  }
18406
18742
  )
18407
18743
  ] })
18408
18744
  ] }),
18409
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18745
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18410
18746
  SendButton,
18411
18747
  {
18412
18748
  disabled: isSendDisabled,
@@ -18429,7 +18765,7 @@ function Chat({
18429
18765
  ]
18430
18766
  }
18431
18767
  ) }),
18432
- disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18768
+ disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18433
18769
  "p",
18434
18770
  {
18435
18771
  className: cn(
@@ -18439,14 +18775,14 @@ function Chat({
18439
18775
  children: disclaimer.text
18440
18776
  }
18441
18777
  ),
18442
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
18443
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: t("chat.poweredBy") }),
18444
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
18778
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
18779
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: t("chat.poweredBy") }),
18780
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
18445
18781
  ] })
18446
18782
  ]
18447
18783
  }
18448
18784
  ),
18449
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
18785
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18450
18786
  SettingsSheet,
18451
18787
  {
18452
18788
  open: petSettingsOpen,
@@ -18456,17 +18792,17 @@ function Chat({
18456
18792
  onSave: savePetLocalSettings
18457
18793
  }
18458
18794
  ),
18459
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PetBridge, { pet: effectivePet, state: petAutoState })
18795
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PetBridge, { pet: effectivePet, state: petAutoState })
18460
18796
  ]
18461
18797
  }
18462
18798
  );
18463
18799
  }
18464
18800
 
18465
18801
  // src/components/ui/separator.tsx
18466
- var React51 = __toESM(require("react"), 1);
18467
- var import_jsx_runtime56 = require("react/jsx-runtime");
18468
- var Separator = React51.forwardRef(
18469
- ({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
18802
+ var React52 = __toESM(require("react"), 1);
18803
+ var import_jsx_runtime57 = require("react/jsx-runtime");
18804
+ var Separator = React52.forwardRef(
18805
+ ({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
18470
18806
  "div",
18471
18807
  {
18472
18808
  ref,