@xpert-ai/chatkit-ui 0.3.21 → 0.4.0
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.
- package/dist/app/assets/{_baseUniq-DQYPehQ-.js → _baseUniq-DgIHlkQm.js} +1 -1
- package/dist/app/assets/{abap-BM4qSIyQ.js → abap-lB8VLppN.js} +1 -1
- package/dist/app/assets/{abnf-BX4WCoML.js → abnf-CMm-FA7V.js} +1 -1
- package/dist/app/assets/{actionscript-xl_RFBNs.js → actionscript-C44LZKx4.js} +1 -1
- package/dist/app/assets/{ada-El_ICa-x.js → ada-BL4d2yHl.js} +1 -1
- package/dist/app/assets/{agda-5bKVQpD_.js → agda-DUeBOfao.js} +1 -1
- package/dist/app/assets/{al-B1nWlmvn.js → al-r379MYUc.js} +1 -1
- package/dist/app/assets/{antlr4-pBrbyzLd.js → antlr4-BhepIW3H.js} +1 -1
- package/dist/app/assets/{apacheconf-BgknPISa.js → apacheconf-ZblTvauv.js} +1 -1
- package/dist/app/assets/{apex-ByHs-y6y.js → apex-DXCjRfej.js} +1 -1
- package/dist/app/assets/{apl-D93kE8hc.js → apl-0mvw9LXG.js} +1 -1
- package/dist/app/assets/{applescript-B-dVV5SQ.js → applescript-s8Oxmrfz.js} +1 -1
- package/dist/app/assets/{aql-BWPt2oGW.js → aql-BMN4x1O3.js} +1 -1
- package/dist/app/assets/{arc-Bf6CYxcs.js → arc-xNYJT0Sf.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46--o0-uftJ.js → architectureDiagram-Q4EWVU46-B3lvRgUo.js} +1 -1
- package/dist/app/assets/{arduino-CJ0e6EAb.js → arduino-daTjF253.js} +1 -1
- package/dist/app/assets/{arff-CjnLJtu2.js → arff-DxxxOwyy.js} +1 -1
- package/dist/app/assets/{asciidoc-BEGGmE4f.js → asciidoc-B0aClqCc.js} +1 -1
- package/dist/app/assets/{asm6502-DdtsBxuW.js → asm6502-BsfejLyD.js} +1 -1
- package/dist/app/assets/{asmatmel-C7bTA6ZK.js → asmatmel-BQPOdk6m.js} +1 -1
- package/dist/app/assets/{aspnet-DybXb5RV.js → aspnet-CI7Ah4u1.js} +1 -1
- package/dist/app/assets/{autohotkey-B4DFJfeq.js → autohotkey-IQAyKsEZ.js} +1 -1
- package/dist/app/assets/{autoit-BnJoVLFr.js → autoit-Cc50euDJ.js} +1 -1
- package/dist/app/assets/{avisynth-adsYdF95.js → avisynth-D_3k61Mh.js} +1 -1
- package/dist/app/assets/{avro-idl-BEEeDZ3T.js → avro-idl-Dakyv0EK.js} +1 -1
- package/dist/app/assets/{bash-HMaxYndq.js → bash-CK4ls-uk.js} +1 -1
- package/dist/app/assets/{basic-CGI_4hUJ.js → basic-sAy-3U_-.js} +1 -1
- package/dist/app/assets/{batch-C3ZkiPxH.js → batch-BULEa0VP.js} +1 -1
- package/dist/app/assets/{bbcode-BcKqPjJt.js → bbcode-mxGKgZDu.js} +1 -1
- package/dist/app/assets/{bicep-BiAeLXpL.js → bicep-DxUd9L5w.js} +1 -1
- package/dist/app/assets/{birb-BUzFWx_A.js → birb-CT9d0Hfg.js} +1 -1
- package/dist/app/assets/{bison--JmMkpGr.js → bison-CJWctWOI.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-DlCLRQ6D.js → blockDiagram-DXYQGD6D-D-AjcpQ4.js} +1 -1
- package/dist/app/assets/{bnf-CW9x2YuF.js → bnf-BfiH5qUl.js} +1 -1
- package/dist/app/assets/{brainfuck-JE2vVBK8.js → brainfuck-BXCfmtpc.js} +1 -1
- package/dist/app/assets/{brightscript-BFVL4OK-.js → brightscript-B8Se3L7d.js} +1 -1
- package/dist/app/assets/{bro-BFP7Vg1t.js → bro-BYNaGskD.js} +1 -1
- package/dist/app/assets/{bsl-8KT47Ocp.js → bsl-rAkCQZce.js} +1 -1
- package/dist/app/assets/{c-DjRDCv7Q.js → c-BLwhDOSO.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-CxOxKAvr.js → c4Diagram-AHTNJAMY-CqDIUKeo.js} +1 -1
- package/dist/app/assets/{cfscript-uYdSfHi1.js → cfscript-BEVtIJMz.js} +1 -1
- package/dist/app/assets/{chaiscript-BMJlJ5Yj.js → chaiscript-DcH2srx5.js} +1 -1
- package/dist/app/assets/channel-CI-ehimI.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-BlVYV2JT.js → chunk-4BX2VUAB-m_kyuUbe.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-BVGwM0_B.js → chunk-4TB4RGXK-BjqYS6Yy.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-BEUpYdGG.js → chunk-55IACEB6-oWAL2kJR.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-z870kN9i.js → chunk-EDXVE4YY-BR40heM4.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-DfF0T4M2.js → chunk-FMBD7UC4-Bv7-5Ls-.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-CG1987mG.js → chunk-OYMX7WX6-CIKeB20i.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-JIvq2t0-.js → chunk-QZHKN3VN-CBk_nqgS.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-zf8sTeUU.js → chunk-YZCP3GAM-DbrAyIeM.js} +1 -1
- package/dist/app/assets/{cil-BB6bejx8.js → cil-HIWN64iA.js} +1 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-kNq98FtJ.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-kNq98FtJ.js +1 -0
- package/dist/app/assets/{clike-D3xMhpOD.js → clike-DWwvlcID.js} +1 -1
- package/dist/app/assets/{clojure-Chij6Ngb.js → clojure-m5aYwMVY.js} +1 -1
- package/dist/app/assets/clone-70-rkKhs.js +1 -0
- package/dist/app/assets/{cmake-CZ3QnJ3x.js → cmake-D1AphalP.js} +1 -1
- package/dist/app/assets/{cobol-piqn3l1D.js → cobol-DfRj-gRZ.js} +1 -1
- package/dist/app/assets/{coffeescript-D7pJB5Sc.js → coffeescript-DBVw6hft.js} +1 -1
- package/dist/app/assets/{concurnas-BUVBF3iU.js → concurnas-p-HBsubn.js} +1 -1
- package/dist/app/assets/{coq-DO12wGyQ.js → coq-DpEsabSd.js} +1 -1
- package/dist/app/assets/{core-wZNUERI0.js → core-Bu1sMhBI.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-DNcJwuP_.js → cose-bilkent-S5V4N54A-Bu1oc34k.js} +1 -1
- package/dist/app/assets/{cpp-Bn4NX0Y7.js → cpp-DWOjniRs.js} +1 -1
- package/dist/app/assets/{crystal-DH1SzjI0.js → crystal-CQJ7kmd6.js} +1 -1
- package/dist/app/assets/{csharp-DsRZVr1z.js → csharp-D7MPpOcK.js} +1 -1
- package/dist/app/assets/{cshtml-BW39Mq-n.js → cshtml-DKqAFWTy.js} +1 -1
- package/dist/app/assets/{csp-BHap8sWo.js → csp-CdccqHH0.js} +1 -1
- package/dist/app/assets/{css-pptVnNrc.js → css-CF8Mhm8t.js} +1 -1
- package/dist/app/assets/{css-extras-DNvI8BqP.js → css-extras-BzYoJo_2.js} +1 -1
- package/dist/app/assets/{csv-BGNEqqUD.js → csv-BkNUxNGN.js} +1 -1
- package/dist/app/assets/{cypher-DI9Eh2MX.js → cypher-B6Ago4_f.js} +1 -1
- package/dist/app/assets/{d-Baut6dRC.js → d-0OD8he-p.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-Bll-N0gB.js → dagre-KV5264BT-CtnwN-Dh.js} +1 -1
- package/dist/app/assets/{dart-DwQS8J-b.js → dart-CRBezsEJ.js} +1 -1
- package/dist/app/assets/{dataweave-Bm1DfTIi.js → dataweave-C5NSsb9T.js} +1 -1
- package/dist/app/assets/{dax-DczLQrxB.js → dax-DA_08-S-.js} +1 -1
- package/dist/app/assets/{dhall-D-rQkR7U.js → dhall-B5eyKfIX.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD-BsqcOqjN.js → diagram-5BDNPKRD-BWMmYkfv.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-CanWPLYX.js → diagram-G4DWMVQ6-BZqIfTTc.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-DtTvDmLa.js → diagram-MMDJMWI5--lVSAtvL.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-CqAB9YcT.js → diagram-TYMM5635-CAdX-pMH.js} +1 -1
- package/dist/app/assets/{diff-DRX_aR8Q.js → diff-BcQ3lgLg.js} +1 -1
- package/dist/app/assets/{django-B70oQtEy.js → django-C_tw_AYj.js} +1 -1
- package/dist/app/assets/{dns-zone-file-UDNZJdpf.js → dns-zone-file-CyqP1EvD.js} +1 -1
- package/dist/app/assets/{docker-C5WbmVoT.js → docker-wz3Lj9Db.js} +1 -1
- package/dist/app/assets/{dot-BgOwKJXC.js → dot-B-DDY2H8.js} +1 -1
- package/dist/app/assets/{ebnf-DcbjvJF9.js → ebnf-X2ewhLUy.js} +1 -1
- package/dist/app/assets/{editorconfig-BVQjr_5n.js → editorconfig-qcUVBPkT.js} +1 -1
- package/dist/app/assets/{eiffel-NEJHOZNK.js → eiffel-BAqW7pbE.js} +1 -1
- package/dist/app/assets/{ejs-D-4dvILN.js → ejs-61WKLTYk.js} +1 -1
- package/dist/app/assets/{elixir-DylKEJ8m.js → elixir-EzFqXZk2.js} +1 -1
- package/dist/app/assets/{elm-m8oZ9wqi.js → elm-DmnpDBDa.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-B4Kokusb.js → erDiagram-SMLLAGMA-D-t806Qt.js} +1 -1
- package/dist/app/assets/{erb-DrkAZuLY.js → erb-CcQKm2oQ.js} +1 -1
- package/dist/app/assets/{erlang-C009jUDM.js → erlang-DW-WXopd.js} +1 -1
- package/dist/app/assets/{etlua-BYR_P5ZO.js → etlua-BJxhJpxy.js} +1 -1
- package/dist/app/assets/{excel-formula-D49xhxI6.js → excel-formula-7oXshpg3.js} +1 -1
- package/dist/app/assets/{factor-QpmgGoBW.js → factor-BC8WW8Od.js} +1 -1
- package/dist/app/assets/{false-sqNVea_q.js → false-C6lXY4VC.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-BigXcaq8.js → firestore-security-rules-B4dcnH7G.js} +1 -1
- package/dist/app/assets/{flow-Ci-UXkWw.js → flow-CFpX3faq.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-B3rfvjfL.js → flowDiagram-DWJPFMVM-BjTXVIWo.js} +1 -1
- package/dist/app/assets/{fortran-e_w_yEL9.js → fortran-RwIGxqZ9.js} +1 -1
- package/dist/app/assets/{fsharp-BquAs0nh.js → fsharp-C5S6wt_8.js} +1 -1
- package/dist/app/assets/{ftl-Djb0Hj1R.js → ftl-DXTedmzK.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-B9hQ1hJF.js → ganttDiagram-T4ZO3ILL-DPqZs20S.js} +1 -1
- package/dist/app/assets/{gap-DLc_BCjg.js → gap-C0KFM8Sn.js} +1 -1
- package/dist/app/assets/{gcode-Det6n0Ho.js → gcode-Ck54RmDV.js} +1 -1
- package/dist/app/assets/{gdscript-D-g8ZK89.js → gdscript-DX_Bezt8.js} +1 -1
- package/dist/app/assets/{gedcom-DAvnEHuX.js → gedcom-54x_GC3_.js} +1 -1
- package/dist/app/assets/{gherkin-D38X0Yb7.js → gherkin-DpY70MhW.js} +1 -1
- package/dist/app/assets/{git-DC6oOsjy.js → git-Bg40h27U.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-DyWUrbw1.js → gitGraphDiagram-UUTBAWPF-CMuB9NDh.js} +1 -1
- package/dist/app/assets/{glsl-B3tH9uG-.js → glsl-BcqYx_6I.js} +1 -1
- package/dist/app/assets/{gml-DARPpECj.js → gml-DJePf9E6.js} +1 -1
- package/dist/app/assets/{gn-vy9FemoP.js → gn-hOkcYKt5.js} +1 -1
- package/dist/app/assets/{go-CNAfUJcn.js → go-CBdX4RKq.js} +1 -1
- package/dist/app/assets/{go-module-Rt8NBOyO.js → go-module-8CqpJAjn.js} +1 -1
- package/dist/app/assets/{graph-CWQVt5Hd.js → graph-DiXdxCpd.js} +1 -1
- package/dist/app/assets/{graphql-CxXfJNJ5.js → graphql-DzkHa_Lt.js} +1 -1
- package/dist/app/assets/{groovy-BBN8a1rT.js → groovy-CuKAytl9.js} +1 -1
- package/dist/app/assets/{haml-BOc4eex8.js → haml-BHlOO4D-.js} +1 -1
- package/dist/app/assets/{handlebars-BJffDJoW.js → handlebars-DgTuPlRj.js} +1 -1
- package/dist/app/assets/{haskell-CjIMIx7I.js → haskell-BYOS6zzQ.js} +1 -1
- package/dist/app/assets/{haxe-DWDpw8Qc.js → haxe-QCi0Miq5.js} +1 -1
- package/dist/app/assets/{hcl-BZzPeJmI.js → hcl-DCUWHECM.js} +1 -1
- package/dist/app/assets/{hlsl-DONgZjSW.js → hlsl-Bp2hwiJd.js} +1 -1
- package/dist/app/assets/{hoon-BgEGZDxn.js → hoon-BzW-9-xp.js} +1 -1
- package/dist/app/assets/{hpkp-BdhSfjgl.js → hpkp-BWPv-cBm.js} +1 -1
- package/dist/app/assets/{hsts-CzUotko0.js → hsts-CJiK6uQM.js} +1 -1
- package/dist/app/assets/{http-DZ5siSz1.js → http-DQlaEk07.js} +1 -1
- package/dist/app/assets/{ichigojam-BA6OXXoB.js → ichigojam-K2-54W_i.js} +1 -1
- package/dist/app/assets/{icon-iUz8kW3L.js → icon-DtDq4nwU.js} +1 -1
- package/dist/app/assets/{icu-message-format-CCAUs64P.js → icu-message-format-CzUzfEvD.js} +1 -1
- package/dist/app/assets/{idris-BlIDzxgn.js → idris-CZStDvUu.js} +1 -1
- package/dist/app/assets/{iecst-CMWyTEtE.js → iecst-BJn6mRZC.js} +1 -1
- package/dist/app/assets/{ignore-CXEc0RKr.js → ignore-BZ9E9rMx.js} +1 -1
- package/dist/app/assets/index-BCZfU1mO.js +756 -0
- package/dist/app/assets/index-ByruneYs.css +1 -0
- package/dist/app/assets/{infoDiagram-42DDH7IO-CvY1ChHR.js → infoDiagram-42DDH7IO-BVqN5Cf-.js} +1 -1
- package/dist/app/assets/{inform7-RKf3LSDR.js → inform7-C64PxE5P.js} +1 -1
- package/dist/app/assets/{ini-K8CLpdcD.js → ini-D6uyClxM.js} +1 -1
- package/dist/app/assets/{io-DiUzEhPs.js → io-BEddoOXw.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-Cp5yLHei.js → ishikawaDiagram-UXIWVN3A-DMCnYQDL.js} +1 -1
- package/dist/app/assets/{j-CU5vEBSA.js → j-BZjnLaoD.js} +1 -1
- package/dist/app/assets/{java-DAzk8PaQ.js → java-C16BQXmJ.js} +1 -1
- package/dist/app/assets/{javadoc-AliyBIAx.js → javadoc-Bp_K_1w9.js} +1 -1
- package/dist/app/assets/{javadoclike-Dntcuir5.js → javadoclike-CCL57XT3.js} +1 -1
- package/dist/app/assets/{javascript-BSrBoO9h.js → javascript-UKmanPpI.js} +1 -1
- package/dist/app/assets/{javastacktrace-M0UDvHO7.js → javastacktrace-Bt6MmvHK.js} +1 -1
- package/dist/app/assets/{jexl-ChBtuGhM.js → jexl-BSIE3NAS.js} +1 -1
- package/dist/app/assets/{jolie-dVzYMXzP.js → jolie-DwAozljt.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-DFUxbdY3.js → journeyDiagram-VCZTEJTY-hfkm8x7F.js} +1 -1
- package/dist/app/assets/{jq-C-FHF89g.js → jq-B6HQblEc.js} +1 -1
- package/dist/app/assets/{js-extras-CUWVDuzh.js → js-extras-C4kJ0q_P.js} +1 -1
- package/dist/app/assets/{js-templates-BsmT3aBE.js → js-templates-BF0RGSgj.js} +1 -1
- package/dist/app/assets/{jsdoc-DYd6bfCg.js → jsdoc-BaH_CjIP.js} +1 -1
- package/dist/app/assets/{json-9a0HiK8V.js → json-JpTWEtLR.js} +1 -1
- package/dist/app/assets/{json5-CHfH8hub.js → json5-DJHj-rXR.js} +1 -1
- package/dist/app/assets/{jsonp-C4H8aw-G.js → jsonp-DpjTc_na.js} +1 -1
- package/dist/app/assets/{jsstacktrace-CWLuVaQs.js → jsstacktrace-DnLa9vhb.js} +1 -1
- package/dist/app/assets/{jsx-CKSzHPGQ.js → jsx-BRHrY2BL.js} +1 -1
- package/dist/app/assets/{julia-CKCCG6Mf.js → julia-9zZ-iwP_.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-C3XjPZMK.js → kanban-definition-6JOO6SKY-DE3YihJJ.js} +1 -1
- package/dist/app/assets/{keepalived-CyUP2k6O.js → keepalived-Uu89aoXa.js} +1 -1
- package/dist/app/assets/{keyman-C4jw745i.js → keyman-DFGcwqDK.js} +1 -1
- package/dist/app/assets/{kotlin-k4KF32sW.js → kotlin-LTPAm-Va.js} +1 -1
- package/dist/app/assets/{kumir-DSXoU43i.js → kumir-BcPP82e-.js} +1 -1
- package/dist/app/assets/{kusto-DN4PTwp5.js → kusto-CxK7uEBf.js} +1 -1
- package/dist/app/assets/{latex-DnND8Hyr.js → latex-CJOru6Xl.js} +1 -1
- package/dist/app/assets/{latte-ZczIeK8r.js → latte-yocJ797x.js} +1 -1
- package/dist/app/assets/{layout-Co572jdY.js → layout-CXEXCcrp.js} +1 -1
- package/dist/app/assets/{less-Dj7UTsAS.js → less-BmacGfdt.js} +1 -1
- package/dist/app/assets/{lilypond-BZT4RhtW.js → lilypond-XADZqv26.js} +1 -1
- package/dist/app/assets/{linear-Bs8rswOH.js → linear-BoHhQExU.js} +1 -1
- package/dist/app/assets/{liquid-ClZynrWa.js → liquid-DrXu3I4o.js} +1 -1
- package/dist/app/assets/{lisp-BTorhS-u.js → lisp-D7GBOEAq.js} +1 -1
- package/dist/app/assets/{livescript-DoDDu5Yt.js → livescript-CYEGDtxo.js} +1 -1
- package/dist/app/assets/{llvm-CX8WmHsW.js → llvm-Cg59OFV5.js} +1 -1
- package/dist/app/assets/{log-DqX7RFDU.js → log-Dgz6RJ76.js} +1 -1
- package/dist/app/assets/{lolcode-BhqlIFHf.js → lolcode-BiaQuLMI.js} +1 -1
- package/dist/app/assets/{lua-D2PWt_yX.js → lua-A_5_hnzN.js} +1 -1
- package/dist/app/assets/{magma-BWcE3gZw.js → magma-vL3dHSsW.js} +1 -1
- package/dist/app/assets/{makefile-Bqpj3_DO.js → makefile-C1iS0HiM.js} +1 -1
- package/dist/app/assets/{markdown-CnajnEUc.js → markdown-B2oYsnLL.js} +1 -1
- package/dist/app/assets/{markup-Bo8fRV73.js → markup-DfTA_BVw.js} +1 -1
- package/dist/app/assets/{markup-templating-BVLTEf1q.js → markup-templating-Cuy4LPLx.js} +1 -1
- package/dist/app/assets/{matlab-aBhqIbY_.js → matlab-D6BnQC4u.js} +1 -1
- package/dist/app/assets/{maxscript-CsHgPBx8.js → maxscript-C6TABA1u.js} +1 -1
- package/dist/app/assets/{mel-C2Q01urV.js → mel-4rfx7Bfv.js} +1 -1
- package/dist/app/assets/{mermaid-BuMDBFL8.js → mermaid-C9zerIka.js} +1 -1
- package/dist/app/assets/{min-Byza3p1P.js → min-CYeWfD_S.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-CEthcC4b.js → mindmap-definition-QFDTVHPH-DEJyZ1TS.js} +1 -1
- package/dist/app/assets/{mizar-B_i6T9OT.js → mizar-DRgDOhTN.js} +1 -1
- package/dist/app/assets/{mongodb-DvQQHyBw.js → mongodb-Bz5t1Kri.js} +1 -1
- package/dist/app/assets/{monkey-znz8nJPM.js → monkey-DmpKIE8A.js} +1 -1
- package/dist/app/assets/{moonscript-CRv3oyNU.js → moonscript-Detay_Aq.js} +1 -1
- package/dist/app/assets/{n1ql-Ut5maFqH.js → n1ql-BmgXbS-M.js} +1 -1
- package/dist/app/assets/{n4js-DhQq4607.js → n4js-DmTPdCqi.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-C7cFsm13.js → nand2tetris-hdl-DXraXq65.js} +1 -1
- package/dist/app/assets/{naniscript-CW4orAyd.js → naniscript-B261gwHF.js} +1 -1
- package/dist/app/assets/{nasm-D12WnJXs.js → nasm-DjgP63mx.js} +1 -1
- package/dist/app/assets/{neon-CyZOMcF4.js → neon-BkyLss_j.js} +1 -1
- package/dist/app/assets/{nevod-DPER4jE8.js → nevod-D3AIDy_-.js} +1 -1
- package/dist/app/assets/{nginx-B-pd0-Ad.js → nginx-x6qaHbn6.js} +1 -1
- package/dist/app/assets/{nim-BTKCwQU5.js → nim-DEkLs6r2.js} +1 -1
- package/dist/app/assets/{nix-_E0KYcLF.js → nix-DKfH6GYJ.js} +1 -1
- package/dist/app/assets/{nsis-BV6YGEAl.js → nsis-DdaElZTp.js} +1 -1
- package/dist/app/assets/{objectivec-D7DZtg3n.js → objectivec-D-GvlelH.js} +1 -1
- package/dist/app/assets/{ocaml-jOwdJMGP.js → ocaml-Bh8mdwPO.js} +1 -1
- package/dist/app/assets/{opencl-BK8RsGvY.js → opencl-DqbqQpJ8.js} +1 -1
- package/dist/app/assets/{openqasm-CnTU765R.js → openqasm-BzHZ1geL.js} +1 -1
- package/dist/app/assets/{oz-Bj9raWAN.js → oz-CAffbl5h.js} +1 -1
- package/dist/app/assets/{parigp-CdPTMoNi.js → parigp-CKqiqq8G.js} +1 -1
- package/dist/app/assets/{parser-Cdmw5LSw.js → parser-Cg00t7Mb.js} +1 -1
- package/dist/app/assets/{pascal-nUYtHUHG.js → pascal--toS4iGX.js} +1 -1
- package/dist/app/assets/{pascaligo-Bkz6st9y.js → pascaligo-DkkGDPuY.js} +1 -1
- package/dist/app/assets/{pcaxis-iU3Ob1-f.js → pcaxis-YW2drt9P.js} +1 -1
- package/dist/app/assets/{peoplecode-B0tZE2um.js → peoplecode-DcSxF5p-.js} +1 -1
- package/dist/app/assets/{perl-CauH9Ddc.js → perl-YKp_XolM.js} +1 -1
- package/dist/app/assets/{php-nfD6bsQv.js → php-IihSyd58.js} +1 -1
- package/dist/app/assets/{php-extras-LFIs5Lee.js → php-extras-CiYXDTjg.js} +1 -1
- package/dist/app/assets/{phpdoc-CIScJtQR.js → phpdoc-CTwGmVuh.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-yb4urrIl.js → pieDiagram-DEJITSTG-CYgrtYQD.js} +1 -1
- package/dist/app/assets/{plsql-DlL_Q0z7.js → plsql-BLbbnpCf.js} +1 -1
- package/dist/app/assets/{powerquery-CwJoieGU.js → powerquery-CW3t8EHf.js} +1 -1
- package/dist/app/assets/{powershell-Do5am0dD.js → powershell-Dy-20mWQ.js} +1 -1
- package/dist/app/assets/{processing-DrVT9fYT.js → processing-DfOUJsGU.js} +1 -1
- package/dist/app/assets/{prolog-eaGBptl-.js → prolog-Bt7umQZ_.js} +1 -1
- package/dist/app/assets/{promql-8qqnQVxn.js → promql-BsbEgNrg.js} +1 -1
- package/dist/app/assets/{properties-VjU6IVz6.js → properties-0VtNy_J8.js} +1 -1
- package/dist/app/assets/{protobuf-Dbtdjvmg.js → protobuf-CnepKVtX.js} +1 -1
- package/dist/app/assets/{psl-CiJuxJxC.js → psl-OGz4CFKI.js} +1 -1
- package/dist/app/assets/{pug-BEtm4Ype.js → pug-BUMiCGsa.js} +1 -1
- package/dist/app/assets/{puppet-C9PVG5W9.js → puppet-BpwvYCrA.js} +1 -1
- package/dist/app/assets/{pure-C_BwhjmX.js → pure-u9lIjKsQ.js} +1 -1
- package/dist/app/assets/{purebasic-I8MXUtAz.js → purebasic-BsE8kKSG.js} +1 -1
- package/dist/app/assets/{purescript-SjuuPi5a.js → purescript-D4DGIRwN.js} +1 -1
- package/dist/app/assets/{q-CBBhyRzW.js → q-Dd4Y9jTu.js} +1 -1
- package/dist/app/assets/{qml-cKrpUey0.js → qml-IZqRvexj.js} +1 -1
- package/dist/app/assets/{qore-DN78sWhO.js → qore-CVgOeY5j.js} +1 -1
- package/dist/app/assets/{qsharp-BwcPcLS6.js → qsharp-C1ibrSjI.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-Bi4Wq7z-.js → quadrantDiagram-34T5L4WZ-Hy_efLgq.js} +1 -1
- package/dist/app/assets/{r-DgNabGHz.js → r-CO3iHGES.js} +1 -1
- package/dist/app/assets/{racket-DpYHN5yN.js → racket-CDsoIwWb.js} +1 -1
- package/dist/app/assets/{reason-CEMPZwks.js → reason-BXp7TkTV.js} +1 -1
- package/dist/app/assets/{regex-CgjjXtr_.js → regex-C8d4nMD-.js} +1 -1
- package/dist/app/assets/{rego-DEAlE1Uk.js → rego-CnCdTWPv.js} +1 -1
- package/dist/app/assets/{renpy-LG8AK0je.js → renpy-BCpztAT2.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-bxPOgxi3.js → requirementDiagram-MS252O5E-BI0Kue_K.js} +1 -1
- package/dist/app/assets/{rest-BN3tMfFJ.js → rest-DRU6Mo0N.js} +1 -1
- package/dist/app/assets/{rip-hB4F37s_.js → rip-DGcSsuJR.js} +1 -1
- package/dist/app/assets/{roboconf-BqXmHAXe.js → roboconf-D84u_D2h.js} +1 -1
- package/dist/app/assets/{robotframework-BTJ5n8fC.js → robotframework-B55NHCrN.js} +1 -1
- package/dist/app/assets/{ruby-D6Jm6sK4.js → ruby-byKCK-dY.js} +1 -1
- package/dist/app/assets/{rust-BonG09IB.js → rust-DafX95DJ.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-BxYgoe8H.js → sankeyDiagram-XADWPNL6-D6MJ50Pq.js} +1 -1
- package/dist/app/assets/{sas-Cl0dGeKC.js → sas-DTVLhrey.js} +1 -1
- package/dist/app/assets/{sass-CU1QiBFM.js → sass-rDhfj9yl.js} +1 -1
- package/dist/app/assets/{scala-DoZYPVOe.js → scala-BrKTyUsE.js} +1 -1
- package/dist/app/assets/{scheme-BgIJEt42.js → scheme-B_eu29xA.js} +1 -1
- package/dist/app/assets/{scss-CjocpdLe.js → scss-kgRahDzu.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-BhGC2uYj.js → sequenceDiagram-FGHM5R23-BtFJlKLA.js} +1 -1
- package/dist/app/assets/{shell-session-BHwj7Lso.js → shell-session-CF0mJgux.js} +1 -1
- package/dist/app/assets/{smali-BDeyq-QZ.js → smali-cYYyD8tY.js} +1 -1
- package/dist/app/assets/{smalltalk-BeNshzwP.js → smalltalk-C0P2MRK9.js} +1 -1
- package/dist/app/assets/{smarty-Bvxz2rnZ.js → smarty-bSAEKlze.js} +1 -1
- package/dist/app/assets/{sml-NCRXglP-.js → sml-CVkWiohq.js} +1 -1
- package/dist/app/assets/{solidity-DCRKtW7U.js → solidity-DBmi5l50.js} +1 -1
- package/dist/app/assets/{solution-file-wzmwCZ6S.js → solution-file-CnTT-bB0.js} +1 -1
- package/dist/app/assets/{soy-yGw8ki1j.js → soy-D6Pv-4-M.js} +1 -1
- package/dist/app/assets/{sparql-C6HcVk-n.js → sparql-C_FSzEBv.js} +1 -1
- package/dist/app/assets/{splunk-spl-DwN8KORu.js → splunk-spl-BY7Iqglg.js} +1 -1
- package/dist/app/assets/{sqf-Ci0DqiRT.js → sqf-CPktPAhH.js} +1 -1
- package/dist/app/assets/{sql-r0BAcikz.js → sql-o4K_-hAR.js} +1 -1
- package/dist/app/assets/{squirrel-egwbG0_Q.js → squirrel-C7nc0I9a.js} +1 -1
- package/dist/app/assets/{stan-BUl5jvft.js → stan-BaHsDAPv.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-CuRECirl.js → stateDiagram-FHFEXIEX-Jt84X8Km.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-2fuYX60f.js +1 -0
- package/dist/app/assets/{stylus-DTE1MHAZ.js → stylus-LrKOfqx1.js} +1 -1
- package/dist/app/assets/{swift-Cm0dpK0e.js → swift-Du5HvL9Z.js} +1 -1
- package/dist/app/assets/{systemd-C6-mX_m2.js → systemd-B9G8EDGS.js} +1 -1
- package/dist/app/assets/{t4-cs-CbJdbn3r.js → t4-cs-Cx16HVWP.js} +1 -1
- package/dist/app/assets/{t4-templating-DUNJuP6R.js → t4-templating-8EFI9hGP.js} +1 -1
- package/dist/app/assets/{t4-vb-CGQiYNUq.js → t4-vb-DY4dRQ0Y.js} +1 -1
- package/dist/app/assets/{tap-CcP4Ra29.js → tap-CnPjcybx.js} +1 -1
- package/dist/app/assets/{tcl-DDIFCbCY.js → tcl-CyN53FjG.js} +1 -1
- package/dist/app/assets/{textile-BP9vCAsS.js → textile-CcaFbMIR.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-DtpMIXn5.js → timeline-definition-GMOUNBTQ-BIX9PrwR.js} +1 -1
- package/dist/app/assets/{toml-e0sn-wYl.js → toml-Dsv-Gf-x.js} +1 -1
- package/dist/app/assets/{tremor-rx7BwOeg.js → tremor-CFgQf23a.js} +1 -1
- package/dist/app/assets/{tt2-2GtZvdz0.js → tt2-C35x8-ln.js} +1 -1
- package/dist/app/assets/{turtle-Cyl6xYSA.js → turtle-mi4wNaqz.js} +1 -1
- package/dist/app/assets/{twig-DaPREJnk.js → twig--0LWYrgK.js} +1 -1
- package/dist/app/assets/{typescript-d9uArdn6.js → typescript-TITb6K2H.js} +1 -1
- package/dist/app/assets/{typoscript-Bz5s-Nus.js → typoscript-D9-RVwIo.js} +1 -1
- package/dist/app/assets/{unrealscript--YCQVCBZ.js → unrealscript-CEl7HM5o.js} +1 -1
- package/dist/app/assets/{uorazor-BGMX0b7A.js → uorazor-D_Rffmzi.js} +1 -1
- package/dist/app/assets/{uri-IleC_XB0.js → uri-BrG_tFHQ.js} +1 -1
- package/dist/app/assets/{v-D0_WRO4z.js → v-CSrNrMZT.js} +1 -1
- package/dist/app/assets/{vala-DjAqhwAT.js → vala-lXeoxFEf.js} +1 -1
- package/dist/app/assets/{vbnet-BtQX6etM.js → vbnet-CDvW0IYg.js} +1 -1
- package/dist/app/assets/{velocity-CnKSWVwR.js → velocity-CsuMf7zZ.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-DoPjGYKx.js → vennDiagram-DHZGUBPP-Bd1_DGNK.js} +1 -1
- package/dist/app/assets/{verilog-UtuuV-R3.js → verilog-Ba1kXwcH.js} +1 -1
- package/dist/app/assets/{vhdl-CLqX6Jr6.js → vhdl-DC7iDUsg.js} +1 -1
- package/dist/app/assets/{vim-C2pDFZQe.js → vim-m5sIDmbL.js} +1 -1
- package/dist/app/assets/{visual-basic-BsdNM80-.js → visual-basic-CZAxZhXd.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-BS1u_sqm.js → wardley-RL74JXVD-Bi7eSfh4.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-BLu2tzSV.js → wardleyDiagram-NUSXRM2D-C5W1iA0y.js} +1 -1
- package/dist/app/assets/{warpscript-DS0MtVBk.js → warpscript-YqE12jpR.js} +1 -1
- package/dist/app/assets/{wasm-pdEDtE_9.js → wasm-Cqk0NwrL.js} +1 -1
- package/dist/app/assets/{web-idl-C5-NgFOA.js → web-idl-BBz8nwvE.js} +1 -1
- package/dist/app/assets/{wiki-BZJV7U3Y.js → wiki-DTaDNr2a.js} +1 -1
- package/dist/app/assets/{wolfram-Q3sCKVET.js → wolfram-D_dyKsVO.js} +1 -1
- package/dist/app/assets/{wren-BNOjakR4.js → wren-VhlSRnur.js} +1 -1
- package/dist/app/assets/{xeora-R3lkxRHE.js → xeora-C3d3uHWl.js} +1 -1
- package/dist/app/assets/{xml-doc-ZtMXrPfY.js → xml-doc-Dn8dXLkg.js} +1 -1
- package/dist/app/assets/{xojo-Bgt-B00s.js → xojo-D7cO_F-x.js} +1 -1
- package/dist/app/assets/{xquery-CYusL8ky.js → xquery-C1brqcan.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-BVUDpF-g.js → xychartDiagram-5P7HB3ND-CPn62Rvn.js} +1 -1
- package/dist/app/assets/{yaml-DQRgck-g.js → yaml-CucHvpnq.js} +1 -1
- package/dist/app/assets/{yang-Cs4B2bHl.js → yang-BwF0d5Qn.js} +1 -1
- package/dist/app/assets/{zig-Dbk4oIaS.js → zig-Bi_ZcakP.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1353 -526
- package/dist/index.js +1333 -504
- package/package.json +3 -3
- package/dist/app/assets/channel-CUlFcidM.js +0 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-BM4dEt05.js +0 -1
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-BM4dEt05.js +0 -1
- package/dist/app/assets/clone-uIoilXjM.js +0 -1
- package/dist/app/assets/index-D4cxmXCP.css +0 -1
- package/dist/app/assets/index-DW63cdbq.js +0 -754
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-Bw3r7wEs.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
|
|
71
|
-
var
|
|
70
|
+
var React49 = __toESM(require("react"), 1);
|
|
71
|
+
var import_lucide_react29 = require("lucide-react");
|
|
72
72
|
|
|
73
73
|
// src/lib/utils.ts
|
|
74
74
|
var import_clsx = require("clsx");
|
|
@@ -7695,8 +7695,8 @@ function useSlashCommands({
|
|
|
7695
7695
|
}
|
|
7696
7696
|
|
|
7697
7697
|
// src/components/thread/messages/ai.tsx
|
|
7698
|
-
var
|
|
7699
|
-
var
|
|
7698
|
+
var React36 = __toESM(require("react"), 1);
|
|
7699
|
+
var import_lucide_react24 = require("lucide-react");
|
|
7700
7700
|
|
|
7701
7701
|
// src/lib/agent-run-render-tree.ts
|
|
7702
7702
|
function isTextContent(content) {
|
|
@@ -11563,8 +11563,827 @@ function hasLegacySurface(surface) {
|
|
|
11563
11563
|
return !!surface?.componentTree;
|
|
11564
11564
|
}
|
|
11565
11565
|
|
|
11566
|
-
// src/components/thread/messages/
|
|
11566
|
+
// src/components/thread/messages/mcp-app.tsx
|
|
11567
|
+
var React35 = __toESM(require("react"), 1);
|
|
11568
|
+
var import_chatkit_types9 = require("@xpert-ai/chatkit-types");
|
|
11569
|
+
var import_lucide_react23 = require("lucide-react");
|
|
11567
11570
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
11571
|
+
function isRecord5(value) {
|
|
11572
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
11573
|
+
}
|
|
11574
|
+
function buildXpertApiUrl(apiUrl, path) {
|
|
11575
|
+
const normalizedApiUrl = apiUrl.trim();
|
|
11576
|
+
if (!normalizedApiUrl) return path;
|
|
11577
|
+
try {
|
|
11578
|
+
const url = new URL(normalizedApiUrl);
|
|
11579
|
+
return `${url.origin}${path}`;
|
|
11580
|
+
} catch {
|
|
11581
|
+
return path;
|
|
11582
|
+
}
|
|
11583
|
+
}
|
|
11584
|
+
function appendQuery(path, params) {
|
|
11585
|
+
const query = params.toString();
|
|
11586
|
+
return query ? `${path}?${query}` : path;
|
|
11587
|
+
}
|
|
11588
|
+
function buildMcpAppReviveParams(data) {
|
|
11589
|
+
const params = new URLSearchParams();
|
|
11590
|
+
const add = (key, value) => {
|
|
11591
|
+
if (value) {
|
|
11592
|
+
params.set(key, value);
|
|
11593
|
+
}
|
|
11594
|
+
};
|
|
11595
|
+
add("toolsetId", data.toolsetId);
|
|
11596
|
+
add("serverName", data.serverName);
|
|
11597
|
+
add("toolName", data.toolName);
|
|
11598
|
+
add("toolCallId", data.toolCallId);
|
|
11599
|
+
add("resourceUri", data.resourceUri);
|
|
11600
|
+
add("title", typeof data.title === "string" ? data.title : void 0);
|
|
11601
|
+
add("token", data.appInstanceToken);
|
|
11602
|
+
return params;
|
|
11603
|
+
}
|
|
11604
|
+
function buildMcpAppEndpointPath(data, endpoint) {
|
|
11605
|
+
return appendQuery(
|
|
11606
|
+
`/api/xpert-toolset/mcp-apps/${encodeURIComponent(
|
|
11607
|
+
data.appInstanceId
|
|
11608
|
+
)}/${endpoint}`,
|
|
11609
|
+
buildMcpAppReviveParams(data)
|
|
11610
|
+
);
|
|
11611
|
+
}
|
|
11612
|
+
function escapeHtmlAttribute(value) {
|
|
11613
|
+
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">");
|
|
11614
|
+
}
|
|
11615
|
+
function domains(values) {
|
|
11616
|
+
return values?.filter((value) => value.trim()).join(" ") ?? "";
|
|
11617
|
+
}
|
|
11618
|
+
function buildCsp(csp) {
|
|
11619
|
+
const resourceDomains = domains(csp?.resourceDomains);
|
|
11620
|
+
const connectDomains = domains(csp?.connectDomains) || "'none'";
|
|
11621
|
+
const frameDomains = domains(csp?.frameDomains) || "'none'";
|
|
11622
|
+
const baseUriDomains = domains(csp?.baseUriDomains) || "'self'";
|
|
11623
|
+
return [
|
|
11624
|
+
"default-src 'none'",
|
|
11625
|
+
`script-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11626
|
+
`style-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11627
|
+
`img-src data: blob: ${resourceDomains}`.trim(),
|
|
11628
|
+
`media-src data: blob: ${resourceDomains}`.trim(),
|
|
11629
|
+
`font-src data: ${resourceDomains}`.trim(),
|
|
11630
|
+
`connect-src ${connectDomains}`,
|
|
11631
|
+
`frame-src ${frameDomains}`,
|
|
11632
|
+
`base-uri ${baseUriDomains}`
|
|
11633
|
+
].join("; ");
|
|
11634
|
+
}
|
|
11635
|
+
function injectHeadContent(html, content) {
|
|
11636
|
+
if (/<head[^>]*>/i.test(html)) {
|
|
11637
|
+
return html.replace(/<head([^>]*)>/i, `<head$1>${content}`);
|
|
11638
|
+
}
|
|
11639
|
+
return `<!doctype html><html><head>${content}</head><body>${html}</body></html>`;
|
|
11640
|
+
}
|
|
11641
|
+
function injectCsp(html, csp) {
|
|
11642
|
+
const meta = `<meta http-equiv="Content-Security-Policy" content="${escapeHtmlAttribute(
|
|
11643
|
+
buildCsp(csp)
|
|
11644
|
+
)}">`;
|
|
11645
|
+
return injectHeadContent(html, meta);
|
|
11646
|
+
}
|
|
11647
|
+
function decodeResourceHtml(resource) {
|
|
11648
|
+
if (typeof resource.text === "string") {
|
|
11649
|
+
return resource.text;
|
|
11650
|
+
}
|
|
11651
|
+
if (typeof resource.blob !== "string") {
|
|
11652
|
+
return null;
|
|
11653
|
+
}
|
|
11654
|
+
try {
|
|
11655
|
+
const decoded = window.atob(resource.blob);
|
|
11656
|
+
const escaped = Array.from(decoded).map((char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`).join("");
|
|
11657
|
+
return decodeURIComponent(escaped);
|
|
11658
|
+
} catch {
|
|
11659
|
+
try {
|
|
11660
|
+
return window.atob(resource.blob);
|
|
11661
|
+
} catch {
|
|
11662
|
+
return null;
|
|
11663
|
+
}
|
|
11664
|
+
}
|
|
11665
|
+
}
|
|
11666
|
+
function normalizeJsonRpcMessage(value) {
|
|
11667
|
+
const data = typeof value === "string" ? (() => {
|
|
11668
|
+
try {
|
|
11669
|
+
return JSON.parse(value);
|
|
11670
|
+
} catch {
|
|
11671
|
+
return null;
|
|
11672
|
+
}
|
|
11673
|
+
})() : value;
|
|
11674
|
+
if (!isRecord5(data) || typeof data.method !== "string") {
|
|
11675
|
+
return null;
|
|
11676
|
+
}
|
|
11677
|
+
return data;
|
|
11678
|
+
}
|
|
11679
|
+
function jsonRpcResult(id, result) {
|
|
11680
|
+
return {
|
|
11681
|
+
jsonrpc: "2.0",
|
|
11682
|
+
id: id ?? null,
|
|
11683
|
+
result
|
|
11684
|
+
};
|
|
11685
|
+
}
|
|
11686
|
+
function jsonRpcError(id, message) {
|
|
11687
|
+
return {
|
|
11688
|
+
jsonrpc: "2.0",
|
|
11689
|
+
id: id ?? null,
|
|
11690
|
+
error: {
|
|
11691
|
+
code: -32e3,
|
|
11692
|
+
message
|
|
11693
|
+
}
|
|
11694
|
+
};
|
|
11695
|
+
}
|
|
11696
|
+
function getErrorMessage(error) {
|
|
11697
|
+
return error instanceof Error ? error.message : String(error);
|
|
11698
|
+
}
|
|
11699
|
+
function getContainerDimensions(element) {
|
|
11700
|
+
if (!element) return null;
|
|
11701
|
+
const rect = element.getBoundingClientRect();
|
|
11702
|
+
return {
|
|
11703
|
+
width: rect.width,
|
|
11704
|
+
height: rect.height
|
|
11705
|
+
};
|
|
11706
|
+
}
|
|
11707
|
+
function normalizeHostLocale(locale) {
|
|
11708
|
+
return locale?.trim() || navigator.language || "en-US";
|
|
11709
|
+
}
|
|
11710
|
+
function getLocaleLanguage(locale) {
|
|
11711
|
+
return locale.split(/[-_]/)[0]?.toLowerCase() || locale.toLowerCase();
|
|
11712
|
+
}
|
|
11713
|
+
function getLocaleDirection(locale) {
|
|
11714
|
+
const language = getLocaleLanguage(locale);
|
|
11715
|
+
return ["ar", "fa", "he", "ur"].includes(language) ? "rtl" : "ltr";
|
|
11716
|
+
}
|
|
11717
|
+
function setHtmlAttribute(attrs, name, value) {
|
|
11718
|
+
const escaped = escapeHtmlAttribute(value);
|
|
11719
|
+
const pattern = new RegExp(`\\s${name}=("[^"]*"|'[^']*'|[^\\s>]*)`, "i");
|
|
11720
|
+
if (pattern.test(attrs)) {
|
|
11721
|
+
return attrs.replace(pattern, ` ${name}="${escaped}"`);
|
|
11722
|
+
}
|
|
11723
|
+
return `${attrs} ${name}="${escaped}"`;
|
|
11724
|
+
}
|
|
11725
|
+
function injectMcpAppLocale(html, locale) {
|
|
11726
|
+
const normalizedLocale = normalizeHostLocale(locale);
|
|
11727
|
+
const direction = getLocaleDirection(normalizedLocale);
|
|
11728
|
+
if (/<html[\s>]/i.test(html)) {
|
|
11729
|
+
return html.replace(/<html([^>]*)>/i, (_match, attrs) => {
|
|
11730
|
+
const withLang = setHtmlAttribute(attrs, "lang", normalizedLocale);
|
|
11731
|
+
const withDirection = setHtmlAttribute(withLang, "dir", direction);
|
|
11732
|
+
return `<html${withDirection}>`;
|
|
11733
|
+
});
|
|
11734
|
+
}
|
|
11735
|
+
return `<!doctype html><html lang="${escapeHtmlAttribute(
|
|
11736
|
+
normalizedLocale
|
|
11737
|
+
)}" dir="${direction}"><head></head><body>${html}</body></html>`;
|
|
11738
|
+
}
|
|
11739
|
+
var MCP_APP_THEME_COLOR_TOKENS = [
|
|
11740
|
+
["--background", "--mcp-app-color-background", "oklch(1 0 0)"],
|
|
11741
|
+
["--foreground", "--mcp-app-color-foreground", "oklch(0.145 0 0)"],
|
|
11742
|
+
["--card", "--mcp-app-color-card", "oklch(1 0 0)"],
|
|
11743
|
+
[
|
|
11744
|
+
"--card-foreground",
|
|
11745
|
+
"--mcp-app-color-card-foreground",
|
|
11746
|
+
"oklch(0.145 0 0)"
|
|
11747
|
+
],
|
|
11748
|
+
["--popover", "--mcp-app-color-popover", "oklch(1 0 0)"],
|
|
11749
|
+
[
|
|
11750
|
+
"--popover-foreground",
|
|
11751
|
+
"--mcp-app-color-popover-foreground",
|
|
11752
|
+
"oklch(0.145 0 0)"
|
|
11753
|
+
],
|
|
11754
|
+
["--primary", "--mcp-app-color-primary", "oklch(0.205 0 0)"],
|
|
11755
|
+
[
|
|
11756
|
+
"--primary-foreground",
|
|
11757
|
+
"--mcp-app-color-primary-foreground",
|
|
11758
|
+
"oklch(0.985 0 0)"
|
|
11759
|
+
],
|
|
11760
|
+
["--secondary", "--mcp-app-color-secondary", "oklch(0.97 0 0)"],
|
|
11761
|
+
[
|
|
11762
|
+
"--secondary-foreground",
|
|
11763
|
+
"--mcp-app-color-secondary-foreground",
|
|
11764
|
+
"oklch(0.205 0 0)"
|
|
11765
|
+
],
|
|
11766
|
+
["--muted", "--mcp-app-color-muted", "oklch(0.97 0 0)"],
|
|
11767
|
+
[
|
|
11768
|
+
"--muted-foreground",
|
|
11769
|
+
"--mcp-app-color-muted-foreground",
|
|
11770
|
+
"oklch(0.556 0 0)"
|
|
11771
|
+
],
|
|
11772
|
+
["--accent", "--mcp-app-color-accent", "oklch(0.97 0 0)"],
|
|
11773
|
+
[
|
|
11774
|
+
"--accent-foreground",
|
|
11775
|
+
"--mcp-app-color-accent-foreground",
|
|
11776
|
+
"oklch(0.205 0 0)"
|
|
11777
|
+
],
|
|
11778
|
+
[
|
|
11779
|
+
"--destructive",
|
|
11780
|
+
"--mcp-app-color-destructive",
|
|
11781
|
+
"oklch(0.577 0.245 27.325)"
|
|
11782
|
+
],
|
|
11783
|
+
[
|
|
11784
|
+
"--destructive-foreground",
|
|
11785
|
+
"--mcp-app-color-destructive-foreground",
|
|
11786
|
+
"oklch(0.985 0 0)"
|
|
11787
|
+
],
|
|
11788
|
+
["--border", "--mcp-app-color-border", "oklch(0.922 0 0)"],
|
|
11789
|
+
["--input", "--mcp-app-color-input", "oklch(0.922 0 0)"],
|
|
11790
|
+
["--ring", "--mcp-app-color-ring", "oklch(0.708 0 0)"],
|
|
11791
|
+
["--chart-1", "--mcp-app-color-chart-1", "oklch(0.87 0 0)"],
|
|
11792
|
+
["--chart-2", "--mcp-app-color-chart-2", "oklch(0.556 0 0)"],
|
|
11793
|
+
["--chart-3", "--mcp-app-color-chart-3", "oklch(0.439 0 0)"],
|
|
11794
|
+
["--chart-4", "--mcp-app-color-chart-4", "oklch(0.371 0 0)"],
|
|
11795
|
+
["--chart-5", "--mcp-app-color-chart-5", "oklch(0.269 0 0)"]
|
|
11796
|
+
];
|
|
11797
|
+
function sanitizeCssValue(value) {
|
|
11798
|
+
return value.replace(/[;{}<>]/g, "").trim();
|
|
11799
|
+
}
|
|
11800
|
+
function normalizeColorCssValue(value) {
|
|
11801
|
+
const trimmed = sanitizeCssValue(value);
|
|
11802
|
+
if (!trimmed) return "";
|
|
11803
|
+
if (/^(#|rgb\(|rgba\(|hsl\(|hsla\(|oklch\(|oklab\(|color\(|var\()/i.test(
|
|
11804
|
+
trimmed
|
|
11805
|
+
)) {
|
|
11806
|
+
return trimmed;
|
|
11807
|
+
}
|
|
11808
|
+
if (/^-?\d/.test(trimmed) && /\s/.test(trimmed)) {
|
|
11809
|
+
return `hsl(${trimmed})`;
|
|
11810
|
+
}
|
|
11811
|
+
return trimmed;
|
|
11812
|
+
}
|
|
11813
|
+
function getHostThemeMode() {
|
|
11814
|
+
return document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
11815
|
+
}
|
|
11816
|
+
function readHostCssVariable(element, variableName) {
|
|
11817
|
+
const candidates = [
|
|
11818
|
+
element,
|
|
11819
|
+
element === document.documentElement ? null : document.documentElement
|
|
11820
|
+
].filter(Boolean);
|
|
11821
|
+
for (const candidate of candidates) {
|
|
11822
|
+
const value = window.getComputedStyle(candidate).getPropertyValue(variableName).trim();
|
|
11823
|
+
if (value) {
|
|
11824
|
+
return value;
|
|
11825
|
+
}
|
|
11826
|
+
}
|
|
11827
|
+
return "";
|
|
11828
|
+
}
|
|
11829
|
+
function buildMcpAppTheme(element) {
|
|
11830
|
+
const source = element ?? document.documentElement;
|
|
11831
|
+
const sourceStyles = window.getComputedStyle(source);
|
|
11832
|
+
const cssVariables = {
|
|
11833
|
+
"--mcp-app-color-scheme": getHostThemeMode(),
|
|
11834
|
+
"--mcp-app-font-sans": sanitizeCssValue(
|
|
11835
|
+
sourceStyles.fontFamily || "ui-sans-serif, system-ui, sans-serif"
|
|
11836
|
+
),
|
|
11837
|
+
"--mcp-app-font-mono": sanitizeCssValue(
|
|
11838
|
+
readHostCssVariable(source, "--font-mono") || "ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
11839
|
+
),
|
|
11840
|
+
"--mcp-app-radius": sanitizeCssValue(
|
|
11841
|
+
readHostCssVariable(source, "--radius") || "0.5rem"
|
|
11842
|
+
)
|
|
11843
|
+
};
|
|
11844
|
+
for (const [
|
|
11845
|
+
hostVariable,
|
|
11846
|
+
appVariable,
|
|
11847
|
+
fallback
|
|
11848
|
+
] of MCP_APP_THEME_COLOR_TOKENS) {
|
|
11849
|
+
cssVariables[appVariable] = normalizeColorCssValue(readHostCssVariable(source, hostVariable)) || fallback;
|
|
11850
|
+
}
|
|
11851
|
+
return {
|
|
11852
|
+
mode: getHostThemeMode(),
|
|
11853
|
+
cssVariables
|
|
11854
|
+
};
|
|
11855
|
+
}
|
|
11856
|
+
function injectMcpAppTheme(html, theme) {
|
|
11857
|
+
const declarations = Object.entries(theme.cssVariables).map(([name, value]) => `${name}: ${sanitizeCssValue(value)};`).join("");
|
|
11858
|
+
const style = `<style id="mcp-app-host-theme">:root{color-scheme:${theme.mode};${declarations}}</style>`;
|
|
11859
|
+
return injectHeadContent(html, style);
|
|
11860
|
+
}
|
|
11861
|
+
function buildStandardToolInfo(data, resource) {
|
|
11862
|
+
const raw = resource?.toolInfo ?? {};
|
|
11863
|
+
const rawTitle = isRecord5(raw) && (raw.title !== void 0 || raw.name !== void 0) ? raw.title ?? raw.name : void 0;
|
|
11864
|
+
const rawDescription = isRecord5(raw) && raw.description !== void 0 ? raw.description : void 0;
|
|
11865
|
+
const rawIcon = isRecord5(raw) && raw.icon !== void 0 ? raw.icon : void 0;
|
|
11866
|
+
const originalName = isRecord5(raw) && typeof raw.originalName === "string" ? raw.originalName : data.toolName;
|
|
11867
|
+
const title = rawTitle ?? resource?.title ?? data.title ?? data.toolName;
|
|
11868
|
+
const description = rawDescription ?? resource?.description ?? data.description;
|
|
11869
|
+
const icon = rawIcon ?? resource?.icon ?? data.icon;
|
|
11870
|
+
return {
|
|
11871
|
+
...raw,
|
|
11872
|
+
id: data.toolCallId,
|
|
11873
|
+
tool: {
|
|
11874
|
+
name: originalName,
|
|
11875
|
+
title,
|
|
11876
|
+
...description ? { description } : {},
|
|
11877
|
+
...icon ? { icon } : {}
|
|
11878
|
+
}
|
|
11879
|
+
};
|
|
11880
|
+
}
|
|
11881
|
+
function hasPermissionGrant(value) {
|
|
11882
|
+
return value === true || isRecord5(value);
|
|
11883
|
+
}
|
|
11884
|
+
function buildIframeAllow(permissions) {
|
|
11885
|
+
if (!permissions) return void 0;
|
|
11886
|
+
const policies = [];
|
|
11887
|
+
if (hasPermissionGrant(permissions.camera)) {
|
|
11888
|
+
policies.push("camera *");
|
|
11889
|
+
}
|
|
11890
|
+
if (hasPermissionGrant(permissions.microphone)) {
|
|
11891
|
+
policies.push("microphone *");
|
|
11892
|
+
}
|
|
11893
|
+
if (hasPermissionGrant(permissions.geolocation)) {
|
|
11894
|
+
policies.push("geolocation *");
|
|
11895
|
+
}
|
|
11896
|
+
if (hasPermissionGrant(permissions.clipboardWrite)) {
|
|
11897
|
+
policies.push("clipboard-write *");
|
|
11898
|
+
}
|
|
11899
|
+
return policies.length ? policies.join("; ") : void 0;
|
|
11900
|
+
}
|
|
11901
|
+
function buildSandboxAttribute() {
|
|
11902
|
+
return ["allow-downloads", "allow-forms", "allow-modals", "allow-scripts"].join(
|
|
11903
|
+
" "
|
|
11904
|
+
);
|
|
11905
|
+
}
|
|
11906
|
+
function stringifyToolResult(value) {
|
|
11907
|
+
if (typeof value === "string") return value;
|
|
11908
|
+
try {
|
|
11909
|
+
return JSON.stringify(value ?? null);
|
|
11910
|
+
} catch {
|
|
11911
|
+
return String(value);
|
|
11912
|
+
}
|
|
11913
|
+
}
|
|
11914
|
+
function normalizeCallToolResult(value) {
|
|
11915
|
+
if (isRecord5(value) && Array.isArray(value.content)) {
|
|
11916
|
+
return value;
|
|
11917
|
+
}
|
|
11918
|
+
if (Array.isArray(value) && value.length >= 2) {
|
|
11919
|
+
const [content, artifact] = value;
|
|
11920
|
+
const text = typeof content === "string" ? content : stringifyToolResult(content);
|
|
11921
|
+
const normalized = {
|
|
11922
|
+
content: [
|
|
11923
|
+
{
|
|
11924
|
+
type: "text",
|
|
11925
|
+
text
|
|
11926
|
+
}
|
|
11927
|
+
]
|
|
11928
|
+
};
|
|
11929
|
+
if (isRecord5(artifact)) {
|
|
11930
|
+
normalized._meta = artifact;
|
|
11931
|
+
if (isRecord5(artifact.structuredContent)) {
|
|
11932
|
+
normalized.structuredContent = artifact.structuredContent;
|
|
11933
|
+
}
|
|
11934
|
+
} else if (Array.isArray(artifact)) {
|
|
11935
|
+
const structured = artifact.find(
|
|
11936
|
+
(item) => isRecord5(item) && isRecord5(item.structuredContent)
|
|
11937
|
+
);
|
|
11938
|
+
const meta = artifact.find(isRecord5);
|
|
11939
|
+
if (structured?.structuredContent) {
|
|
11940
|
+
normalized.structuredContent = structured.structuredContent;
|
|
11941
|
+
}
|
|
11942
|
+
if (meta) {
|
|
11943
|
+
normalized._meta = meta;
|
|
11944
|
+
}
|
|
11945
|
+
}
|
|
11946
|
+
return normalized;
|
|
11947
|
+
}
|
|
11948
|
+
return {
|
|
11949
|
+
content: [
|
|
11950
|
+
{
|
|
11951
|
+
type: "text",
|
|
11952
|
+
text: stringifyToolResult(value)
|
|
11953
|
+
}
|
|
11954
|
+
]
|
|
11955
|
+
};
|
|
11956
|
+
}
|
|
11957
|
+
function isHttpUrl(value) {
|
|
11958
|
+
try {
|
|
11959
|
+
const url = new URL(value);
|
|
11960
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
11961
|
+
} catch {
|
|
11962
|
+
return false;
|
|
11963
|
+
}
|
|
11964
|
+
}
|
|
11965
|
+
function contentBlocksToText(content) {
|
|
11966
|
+
if (!Array.isArray(content)) return null;
|
|
11967
|
+
const parts = content.map((item) => {
|
|
11968
|
+
if (!isRecord5(item)) return "";
|
|
11969
|
+
if (item.type === "text" && typeof item.text === "string") {
|
|
11970
|
+
return item.text;
|
|
11971
|
+
}
|
|
11972
|
+
if (item.type === "resource_link" && typeof item.uri === "string") {
|
|
11973
|
+
return item.uri;
|
|
11974
|
+
}
|
|
11975
|
+
if (item.type === "image" || item.type === "audio") {
|
|
11976
|
+
return `[${item.type}]`;
|
|
11977
|
+
}
|
|
11978
|
+
return stringifyToolResult(item);
|
|
11979
|
+
}).map((part) => part.trim()).filter(Boolean);
|
|
11980
|
+
return parts.length ? parts.join("\n\n") : null;
|
|
11981
|
+
}
|
|
11982
|
+
function isMcpAppComponentData(data) {
|
|
11983
|
+
return isRecord5(data) && data.type === "McpApp" && typeof data.appInstanceId === "string" && typeof data.resourceUri === "string";
|
|
11984
|
+
}
|
|
11985
|
+
function McpAppMessage({
|
|
11986
|
+
data,
|
|
11987
|
+
className
|
|
11988
|
+
}) {
|
|
11989
|
+
const { i18n: i18n2 } = useChatkitTranslation();
|
|
11990
|
+
const {
|
|
11991
|
+
apiUrl,
|
|
11992
|
+
authenticatedFetch,
|
|
11993
|
+
isLoading: streamIsLoading,
|
|
11994
|
+
submit
|
|
11995
|
+
} = useStreamContext();
|
|
11996
|
+
const iframeRef = React35.useRef(null);
|
|
11997
|
+
const containerRef = React35.useRef(null);
|
|
11998
|
+
const initializedRef = React35.useRef(false);
|
|
11999
|
+
const sentInitialResultRef = React35.useRef(false);
|
|
12000
|
+
const modelContextRef = React35.useRef(null);
|
|
12001
|
+
const [resource, setResource] = React35.useState(
|
|
12002
|
+
null
|
|
12003
|
+
);
|
|
12004
|
+
const [srcDoc, setSrcDoc] = React35.useState(null);
|
|
12005
|
+
const [height, setHeight] = React35.useState(420);
|
|
12006
|
+
const [error, setError] = React35.useState(null);
|
|
12007
|
+
const [isLoading, setIsLoading] = React35.useState(true);
|
|
12008
|
+
const resourceUrl = React35.useMemo(
|
|
12009
|
+
() => buildXpertApiUrl(
|
|
12010
|
+
apiUrl,
|
|
12011
|
+
buildMcpAppEndpointPath(data, "resource")
|
|
12012
|
+
),
|
|
12013
|
+
[apiUrl, data]
|
|
12014
|
+
);
|
|
12015
|
+
const rpcUrl = React35.useMemo(
|
|
12016
|
+
() => buildXpertApiUrl(
|
|
12017
|
+
apiUrl,
|
|
12018
|
+
buildMcpAppEndpointPath(data, "rpc")
|
|
12019
|
+
),
|
|
12020
|
+
[apiUrl, data]
|
|
12021
|
+
);
|
|
12022
|
+
const postToApp = React35.useCallback((message) => {
|
|
12023
|
+
iframeRef.current?.contentWindow?.postMessage(message, "*");
|
|
12024
|
+
}, []);
|
|
12025
|
+
const callHostRpc = React35.useCallback(
|
|
12026
|
+
async (request) => {
|
|
12027
|
+
const response = await authenticatedFetch(rpcUrl, {
|
|
12028
|
+
method: "POST",
|
|
12029
|
+
headers: {
|
|
12030
|
+
"content-type": "application/json"
|
|
12031
|
+
},
|
|
12032
|
+
body: JSON.stringify({
|
|
12033
|
+
jsonrpc: "2.0",
|
|
12034
|
+
id: request.id ?? null,
|
|
12035
|
+
method: request.method,
|
|
12036
|
+
params: request.params
|
|
12037
|
+
})
|
|
12038
|
+
});
|
|
12039
|
+
if (!response.ok) {
|
|
12040
|
+
throw new Error(`MCP App RPC failed with ${response.status}`);
|
|
12041
|
+
}
|
|
12042
|
+
return response.json();
|
|
12043
|
+
},
|
|
12044
|
+
[authenticatedFetch, rpcUrl]
|
|
12045
|
+
);
|
|
12046
|
+
const sendInitialToolNotifications = React35.useCallback(() => {
|
|
12047
|
+
if (!initializedRef.current || sentInitialResultRef.current || !resource) {
|
|
12048
|
+
return;
|
|
12049
|
+
}
|
|
12050
|
+
sentInitialResultRef.current = true;
|
|
12051
|
+
postToApp({
|
|
12052
|
+
jsonrpc: "2.0",
|
|
12053
|
+
method: "ui/notifications/tool-input",
|
|
12054
|
+
params: {
|
|
12055
|
+
arguments: resource.toolInput ?? data.toolInput ?? {}
|
|
12056
|
+
}
|
|
12057
|
+
});
|
|
12058
|
+
postToApp({
|
|
12059
|
+
jsonrpc: "2.0",
|
|
12060
|
+
method: "ui/notifications/tool-result",
|
|
12061
|
+
params: {
|
|
12062
|
+
...normalizeCallToolResult(resource.toolResult),
|
|
12063
|
+
toolCallId: data.toolCallId,
|
|
12064
|
+
toolName: data.toolName,
|
|
12065
|
+
// Legacy compatibility for apps written before the 2026-01-26 notification shape.
|
|
12066
|
+
result: resource.toolResult
|
|
12067
|
+
}
|
|
12068
|
+
});
|
|
12069
|
+
}, [data.toolCallId, data.toolInput, data.toolName, postToApp, resource]);
|
|
12070
|
+
React35.useEffect(() => {
|
|
12071
|
+
const controller = new AbortController();
|
|
12072
|
+
initializedRef.current = false;
|
|
12073
|
+
sentInitialResultRef.current = false;
|
|
12074
|
+
setIsLoading(true);
|
|
12075
|
+
setError(null);
|
|
12076
|
+
setResource(null);
|
|
12077
|
+
setSrcDoc(null);
|
|
12078
|
+
void (async () => {
|
|
12079
|
+
try {
|
|
12080
|
+
const response = await authenticatedFetch(resourceUrl, {
|
|
12081
|
+
signal: controller.signal
|
|
12082
|
+
});
|
|
12083
|
+
if (!response.ok) {
|
|
12084
|
+
throw new Error(`MCP App resource failed with ${response.status}`);
|
|
12085
|
+
}
|
|
12086
|
+
const payload = await response.json();
|
|
12087
|
+
const html = decodeResourceHtml(payload);
|
|
12088
|
+
if (!html) {
|
|
12089
|
+
throw new Error("MCP App resource did not include HTML content");
|
|
12090
|
+
}
|
|
12091
|
+
setResource(payload);
|
|
12092
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12093
|
+
setSrcDoc(
|
|
12094
|
+
injectMcpAppTheme(
|
|
12095
|
+
injectCsp(
|
|
12096
|
+
injectMcpAppLocale(html, hostLocale),
|
|
12097
|
+
payload.csp ?? data.csp
|
|
12098
|
+
),
|
|
12099
|
+
buildMcpAppTheme(containerRef.current)
|
|
12100
|
+
)
|
|
12101
|
+
);
|
|
12102
|
+
} catch (loadError) {
|
|
12103
|
+
if (!controller.signal.aborted) {
|
|
12104
|
+
setError(getErrorMessage(loadError));
|
|
12105
|
+
}
|
|
12106
|
+
} finally {
|
|
12107
|
+
if (!controller.signal.aborted) {
|
|
12108
|
+
setIsLoading(false);
|
|
12109
|
+
}
|
|
12110
|
+
}
|
|
12111
|
+
})();
|
|
12112
|
+
return () => {
|
|
12113
|
+
controller.abort();
|
|
12114
|
+
};
|
|
12115
|
+
}, [
|
|
12116
|
+
authenticatedFetch,
|
|
12117
|
+
data.appInstanceId,
|
|
12118
|
+
data.csp,
|
|
12119
|
+
i18n2.language,
|
|
12120
|
+
resourceUrl
|
|
12121
|
+
]);
|
|
12122
|
+
React35.useEffect(() => {
|
|
12123
|
+
sendInitialToolNotifications();
|
|
12124
|
+
}, [sendInitialToolNotifications]);
|
|
12125
|
+
React35.useEffect(() => {
|
|
12126
|
+
const handleMessage = async (event) => {
|
|
12127
|
+
if (event.source !== iframeRef.current?.contentWindow) {
|
|
12128
|
+
return;
|
|
12129
|
+
}
|
|
12130
|
+
const request = normalizeJsonRpcMessage(event.data);
|
|
12131
|
+
if (!request?.method) {
|
|
12132
|
+
return;
|
|
12133
|
+
}
|
|
12134
|
+
if (request.method === "ui/notifications/initialized") {
|
|
12135
|
+
initializedRef.current = true;
|
|
12136
|
+
sendInitialToolNotifications();
|
|
12137
|
+
return;
|
|
12138
|
+
}
|
|
12139
|
+
if (request.method === "ui/notifications/size-changed") {
|
|
12140
|
+
const nextHeight = isRecord5(request.params) && typeof request.params.height === "number" ? request.params.height : null;
|
|
12141
|
+
if (nextHeight !== null) {
|
|
12142
|
+
setHeight(Math.min(900, Math.max(240, Math.round(nextHeight))));
|
|
12143
|
+
}
|
|
12144
|
+
return;
|
|
12145
|
+
}
|
|
12146
|
+
if (request.method === "ui/initialize") {
|
|
12147
|
+
initializedRef.current = true;
|
|
12148
|
+
const permissions = resource?.permissions ?? data.permissions;
|
|
12149
|
+
const csp = resource?.csp ?? data.csp;
|
|
12150
|
+
const toolInfo = buildStandardToolInfo(data, resource);
|
|
12151
|
+
const theme = buildMcpAppTheme(containerRef.current);
|
|
12152
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12153
|
+
const hostLanguage = getLocaleLanguage(hostLocale);
|
|
12154
|
+
const hostDirection = getLocaleDirection(hostLocale);
|
|
12155
|
+
postToApp(
|
|
12156
|
+
jsonRpcResult(request.id, {
|
|
12157
|
+
protocolVersion: "2026-01-26",
|
|
12158
|
+
hostInfo: {
|
|
12159
|
+
name: "xpert-chatkit",
|
|
12160
|
+
version: "1.0.0",
|
|
12161
|
+
title: "Xpert ChatKit"
|
|
12162
|
+
},
|
|
12163
|
+
hostCapabilities: {
|
|
12164
|
+
serverTools: {},
|
|
12165
|
+
serverResources: {},
|
|
12166
|
+
openLinks: {},
|
|
12167
|
+
logging: {},
|
|
12168
|
+
message: {
|
|
12169
|
+
text: {}
|
|
12170
|
+
},
|
|
12171
|
+
updateModelContext: {
|
|
12172
|
+
text: {},
|
|
12173
|
+
structuredContent: {}
|
|
12174
|
+
},
|
|
12175
|
+
sandbox: {
|
|
12176
|
+
...permissions ? { permissions } : {},
|
|
12177
|
+
...csp ? { csp } : {}
|
|
12178
|
+
}
|
|
12179
|
+
},
|
|
12180
|
+
hostContext: {
|
|
12181
|
+
toolInfo,
|
|
12182
|
+
theme: theme.mode,
|
|
12183
|
+
themeCssVariables: theme.cssVariables,
|
|
12184
|
+
locale: hostLocale,
|
|
12185
|
+
language: hostLanguage,
|
|
12186
|
+
direction: hostDirection,
|
|
12187
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12188
|
+
displayMode: "inline",
|
|
12189
|
+
availableDisplayModes: ["inline"],
|
|
12190
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12191
|
+
userAgent: "xpert-chatkit",
|
|
12192
|
+
platform: "web",
|
|
12193
|
+
deviceCapabilities: {
|
|
12194
|
+
touch: navigator.maxTouchPoints > 0,
|
|
12195
|
+
hover: window.matchMedia("(hover: hover)").matches
|
|
12196
|
+
}
|
|
12197
|
+
},
|
|
12198
|
+
// Legacy compatibility for apps written before the 2026-01-26 result shape.
|
|
12199
|
+
capabilities: {
|
|
12200
|
+
displayModes: ["inline"],
|
|
12201
|
+
serverTools: true,
|
|
12202
|
+
serverResources: true,
|
|
12203
|
+
openLinks: true
|
|
12204
|
+
},
|
|
12205
|
+
context: {
|
|
12206
|
+
toolInfo: resource?.toolInfo ?? {
|
|
12207
|
+
name: data.toolName,
|
|
12208
|
+
toolCallId: data.toolCallId
|
|
12209
|
+
},
|
|
12210
|
+
theme: theme.mode,
|
|
12211
|
+
themeCssVariables: theme.cssVariables,
|
|
12212
|
+
locale: hostLocale,
|
|
12213
|
+
language: hostLanguage,
|
|
12214
|
+
direction: hostDirection,
|
|
12215
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12216
|
+
displayMode: "inline",
|
|
12217
|
+
availableDisplayModes: ["inline"],
|
|
12218
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12219
|
+
userAgent: navigator.userAgent,
|
|
12220
|
+
platform: navigator.platform
|
|
12221
|
+
}
|
|
12222
|
+
})
|
|
12223
|
+
);
|
|
12224
|
+
sendInitialToolNotifications();
|
|
12225
|
+
return;
|
|
12226
|
+
}
|
|
12227
|
+
if (request.method === "ui/open-link") {
|
|
12228
|
+
const href = isRecord5(request.params) && typeof request.params.url === "string" ? request.params.url : isRecord5(request.params) && typeof request.params.href === "string" ? request.params.href : null;
|
|
12229
|
+
if (href && isHttpUrl(href)) {
|
|
12230
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
12231
|
+
if (request.id !== void 0) {
|
|
12232
|
+
postToApp(jsonRpcResult(request.id, {}));
|
|
12233
|
+
}
|
|
12234
|
+
} else if (request.id !== void 0) {
|
|
12235
|
+
postToApp(jsonRpcResult(request.id, { isError: true }));
|
|
12236
|
+
}
|
|
12237
|
+
return;
|
|
12238
|
+
}
|
|
12239
|
+
if (request.method === "ui/update-model-context") {
|
|
12240
|
+
modelContextRef.current = request.params;
|
|
12241
|
+
try {
|
|
12242
|
+
postToApp(await callHostRpc(request));
|
|
12243
|
+
} catch (rpcError) {
|
|
12244
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12245
|
+
}
|
|
12246
|
+
return;
|
|
12247
|
+
}
|
|
12248
|
+
if (request.method === "ui/message") {
|
|
12249
|
+
try {
|
|
12250
|
+
if (!isRecord5(request.params) || request.params.role !== "user" || !Array.isArray(request.params.content)) {
|
|
12251
|
+
throw new Error(
|
|
12252
|
+
'ui/message params must include role "user" and content blocks'
|
|
12253
|
+
);
|
|
12254
|
+
}
|
|
12255
|
+
const hostResponse = await callHostRpc(request);
|
|
12256
|
+
if (isRecord5(hostResponse) && hostResponse.error) {
|
|
12257
|
+
postToApp(hostResponse);
|
|
12258
|
+
return;
|
|
12259
|
+
}
|
|
12260
|
+
const inputText = contentBlocksToText(request.params.content);
|
|
12261
|
+
if (!inputText) {
|
|
12262
|
+
throw new Error("ui/message content did not include text");
|
|
12263
|
+
}
|
|
12264
|
+
await submit(
|
|
12265
|
+
{
|
|
12266
|
+
input: {
|
|
12267
|
+
input: inputText
|
|
12268
|
+
}
|
|
12269
|
+
},
|
|
12270
|
+
{
|
|
12271
|
+
...streamIsLoading ? { followUpMode: "queue" } : {},
|
|
12272
|
+
context: {
|
|
12273
|
+
mcpApp: {
|
|
12274
|
+
appInstanceId: data.appInstanceId,
|
|
12275
|
+
resourceUri: data.resourceUri,
|
|
12276
|
+
toolName: data.toolName,
|
|
12277
|
+
toolCallId: data.toolCallId,
|
|
12278
|
+
modelContext: modelContextRef.current
|
|
12279
|
+
}
|
|
12280
|
+
}
|
|
12281
|
+
}
|
|
12282
|
+
);
|
|
12283
|
+
postToApp(hostResponse);
|
|
12284
|
+
} catch (messageError) {
|
|
12285
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(messageError)));
|
|
12286
|
+
}
|
|
12287
|
+
return;
|
|
12288
|
+
}
|
|
12289
|
+
if (request.id === void 0 && request.method.startsWith("ui/")) {
|
|
12290
|
+
return;
|
|
12291
|
+
}
|
|
12292
|
+
try {
|
|
12293
|
+
postToApp(await callHostRpc(request));
|
|
12294
|
+
} catch (rpcError) {
|
|
12295
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12296
|
+
}
|
|
12297
|
+
};
|
|
12298
|
+
window.addEventListener("message", handleMessage);
|
|
12299
|
+
return () => {
|
|
12300
|
+
window.removeEventListener("message", handleMessage);
|
|
12301
|
+
};
|
|
12302
|
+
}, [
|
|
12303
|
+
callHostRpc,
|
|
12304
|
+
data.appInstanceId,
|
|
12305
|
+
data.csp,
|
|
12306
|
+
data.permissions,
|
|
12307
|
+
data.resourceUri,
|
|
12308
|
+
data.title,
|
|
12309
|
+
data.toolCallId,
|
|
12310
|
+
data.toolName,
|
|
12311
|
+
i18n2.language,
|
|
12312
|
+
postToApp,
|
|
12313
|
+
resource?.csp,
|
|
12314
|
+
resource?.permissions,
|
|
12315
|
+
resource?.toolInfo,
|
|
12316
|
+
sendInitialToolNotifications,
|
|
12317
|
+
streamIsLoading,
|
|
12318
|
+
submit
|
|
12319
|
+
]);
|
|
12320
|
+
const iframePermissions = resource?.permissions ?? data.permissions;
|
|
12321
|
+
const iframeAllow = React35.useMemo(
|
|
12322
|
+
() => buildIframeAllow(iframePermissions),
|
|
12323
|
+
[iframePermissions]
|
|
12324
|
+
);
|
|
12325
|
+
const sandbox = React35.useMemo(() => buildSandboxAttribute(), []);
|
|
12326
|
+
const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
|
|
12327
|
+
const displayTitle = (0, import_chatkit_types9.resolveLocalizedText)(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
|
|
12328
|
+
const displayDescription = (0, import_chatkit_types9.resolveLocalizedText)(
|
|
12329
|
+
resource?.description ?? data.description,
|
|
12330
|
+
i18n2.language
|
|
12331
|
+
);
|
|
12332
|
+
const displayIcon = resource?.icon ?? data.icon;
|
|
12333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
12334
|
+
"div",
|
|
12335
|
+
{
|
|
12336
|
+
ref: containerRef,
|
|
12337
|
+
className: cn(
|
|
12338
|
+
"overflow-hidden rounded-lg border bg-background shadow-sm",
|
|
12339
|
+
!prefersBorder && "border-transparent shadow-none",
|
|
12340
|
+
className
|
|
12341
|
+
),
|
|
12342
|
+
children: [
|
|
12343
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
|
|
12344
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
12345
|
+
displayIcon ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
12346
|
+
IconDefinitionRenderer,
|
|
12347
|
+
{
|
|
12348
|
+
icon: displayIcon,
|
|
12349
|
+
size: 18,
|
|
12350
|
+
className: "shrink-0",
|
|
12351
|
+
decorative: true
|
|
12352
|
+
}
|
|
12353
|
+
) : null,
|
|
12354
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "min-w-0", children: [
|
|
12355
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "truncate text-sm font-medium", children: displayTitle }),
|
|
12356
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
|
|
12357
|
+
] })
|
|
12358
|
+
] }),
|
|
12359
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
|
|
12360
|
+
] }),
|
|
12361
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
12362
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react23.Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
12363
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Loading MCP App" })
|
|
12364
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
|
|
12365
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react23.AlertCircle, { className: "h-4 w-4 shrink-0" }),
|
|
12366
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "min-w-0 break-words", children: error })
|
|
12367
|
+
] }) : srcDoc ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
12368
|
+
"iframe",
|
|
12369
|
+
{
|
|
12370
|
+
ref: iframeRef,
|
|
12371
|
+
title: displayTitle,
|
|
12372
|
+
srcDoc,
|
|
12373
|
+
className: "block w-full bg-background",
|
|
12374
|
+
style: { height },
|
|
12375
|
+
sandbox,
|
|
12376
|
+
allow: iframeAllow,
|
|
12377
|
+
referrerPolicy: "no-referrer"
|
|
12378
|
+
}
|
|
12379
|
+
) : null
|
|
12380
|
+
]
|
|
12381
|
+
}
|
|
12382
|
+
);
|
|
12383
|
+
}
|
|
12384
|
+
|
|
12385
|
+
// src/components/thread/messages/ai.tsx
|
|
12386
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
11568
12387
|
var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
|
|
11569
12388
|
function isTextContent3(content) {
|
|
11570
12389
|
return content.type === "text";
|
|
@@ -11582,6 +12401,9 @@ function isWidgetComponent2(content) {
|
|
|
11582
12401
|
const data = content.data;
|
|
11583
12402
|
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
11584
12403
|
}
|
|
12404
|
+
function isMcpAppComponent(content) {
|
|
12405
|
+
return isMcpAppComponentData(content.data);
|
|
12406
|
+
}
|
|
11585
12407
|
function isMemoryContent(content) {
|
|
11586
12408
|
return content.type === "memory";
|
|
11587
12409
|
}
|
|
@@ -11600,11 +12422,11 @@ function ReasoningBlock({
|
|
|
11600
12422
|
}) {
|
|
11601
12423
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
11602
12424
|
if (blocks.length === 0) return null;
|
|
11603
|
-
return /* @__PURE__ */ (0,
|
|
12425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11604
12426
|
"div",
|
|
11605
12427
|
{
|
|
11606
12428
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
11607
|
-
children: /* @__PURE__ */ (0,
|
|
12429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
11608
12430
|
},
|
|
11609
12431
|
item.id ?? `reasoning-${index}`
|
|
11610
12432
|
)) });
|
|
@@ -11612,12 +12434,12 @@ function ReasoningBlock({
|
|
|
11612
12434
|
function ImageBlock({ content }) {
|
|
11613
12435
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
11614
12436
|
if (!imageUrl) {
|
|
11615
|
-
return /* @__PURE__ */ (0,
|
|
11616
|
-
/* @__PURE__ */ (0,
|
|
11617
|
-
/* @__PURE__ */ (0,
|
|
12437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12438
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
12439
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: safeJson3(content) })
|
|
11618
12440
|
] });
|
|
11619
12441
|
}
|
|
11620
|
-
return /* @__PURE__ */ (0,
|
|
12442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11621
12443
|
"img",
|
|
11622
12444
|
{
|
|
11623
12445
|
src: imageUrl,
|
|
@@ -11627,12 +12449,12 @@ function ImageBlock({ content }) {
|
|
|
11627
12449
|
) });
|
|
11628
12450
|
}
|
|
11629
12451
|
function MemoryBlock({ content }) {
|
|
11630
|
-
return /* @__PURE__ */ (0,
|
|
11631
|
-
/* @__PURE__ */ (0,
|
|
11632
|
-
/* @__PURE__ */ (0,
|
|
11633
|
-
/* @__PURE__ */ (0,
|
|
12452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12453
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12454
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
12455
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Badge, { variant: "secondary", children: "Memory" })
|
|
11634
12456
|
] }),
|
|
11635
|
-
/* @__PURE__ */ (0,
|
|
12457
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson3(content.data ?? []) }) })
|
|
11636
12458
|
] });
|
|
11637
12459
|
}
|
|
11638
12460
|
function parseStepDate2(value) {
|
|
@@ -11666,11 +12488,11 @@ function formatStepDuration3(durationMs) {
|
|
|
11666
12488
|
}
|
|
11667
12489
|
function ComponentBlock({ content }) {
|
|
11668
12490
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
11669
|
-
const [isExpanded, setIsExpanded] =
|
|
11670
|
-
const contentRef =
|
|
11671
|
-
const shouldAutoScrollRef =
|
|
11672
|
-
const previousScrollTopRef =
|
|
11673
|
-
const [durationNow, setDurationNow] =
|
|
12491
|
+
const [isExpanded, setIsExpanded] = React36.useState(false);
|
|
12492
|
+
const contentRef = React36.useRef(null);
|
|
12493
|
+
const shouldAutoScrollRef = React36.useRef(true);
|
|
12494
|
+
const previousScrollTopRef = React36.useRef(0);
|
|
12495
|
+
const [durationNow, setDurationNow] = React36.useState(() => Date.now());
|
|
11674
12496
|
const data = getToolStepData(content);
|
|
11675
12497
|
const category = data.category ?? "Component";
|
|
11676
12498
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -11684,10 +12506,10 @@ function ComponentBlock({ content }) {
|
|
|
11684
12506
|
const endedAt = parseStepDate2(data.end_date);
|
|
11685
12507
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
11686
12508
|
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
11687
|
-
|
|
12509
|
+
React36.useEffect(() => {
|
|
11688
12510
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
11689
12511
|
}, [status, output]);
|
|
11690
|
-
|
|
12512
|
+
React36.useEffect(() => {
|
|
11691
12513
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
11692
12514
|
return;
|
|
11693
12515
|
}
|
|
@@ -11699,7 +12521,7 @@ function ComponentBlock({ content }) {
|
|
|
11699
12521
|
window.clearInterval(timer);
|
|
11700
12522
|
};
|
|
11701
12523
|
}, [createdAt, endedAt, status]);
|
|
11702
|
-
|
|
12524
|
+
React36.useEffect(() => {
|
|
11703
12525
|
const element = contentRef.current;
|
|
11704
12526
|
if (!element) return;
|
|
11705
12527
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -11721,7 +12543,7 @@ function ComponentBlock({ content }) {
|
|
|
11721
12543
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
11722
12544
|
};
|
|
11723
12545
|
}, [isExpanded]);
|
|
11724
|
-
|
|
12546
|
+
React36.useEffect(() => {
|
|
11725
12547
|
if (status !== "running") {
|
|
11726
12548
|
shouldAutoScrollRef.current = true;
|
|
11727
12549
|
return;
|
|
@@ -11734,15 +12556,15 @@ function ComponentBlock({ content }) {
|
|
|
11734
12556
|
}, [isExpanded, output, status]);
|
|
11735
12557
|
const config = status ? toolStatusConfig[status] : null;
|
|
11736
12558
|
const StatusIcon = config?.icon;
|
|
11737
|
-
return /* @__PURE__ */ (0,
|
|
11738
|
-
/* @__PURE__ */ (0,
|
|
12559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12560
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11739
12561
|
CardHeader,
|
|
11740
12562
|
{
|
|
11741
12563
|
className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer",
|
|
11742
12564
|
onClick: () => setIsExpanded(!isExpanded),
|
|
11743
12565
|
children: [
|
|
11744
|
-
/* @__PURE__ */ (0,
|
|
11745
|
-
status && StatusIcon && /* @__PURE__ */ (0,
|
|
12566
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
12567
|
+
status && StatusIcon && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11746
12568
|
StatusIcon,
|
|
11747
12569
|
{
|
|
11748
12570
|
className: cn(
|
|
@@ -11752,21 +12574,21 @@ function ComponentBlock({ content }) {
|
|
|
11752
12574
|
)
|
|
11753
12575
|
}
|
|
11754
12576
|
),
|
|
11755
|
-
/* @__PURE__ */ (0,
|
|
12577
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm truncate", children: title })
|
|
11756
12578
|
] }),
|
|
11757
|
-
/* @__PURE__ */ (0,
|
|
11758
|
-
durationLabel && /* @__PURE__ */ (0,
|
|
11759
|
-
/* @__PURE__ */ (0,
|
|
11760
|
-
/* @__PURE__ */ (0,
|
|
12579
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
12580
|
+
durationLabel && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
|
|
12581
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react24.Clock3, { className: "h-3 w-3" }),
|
|
12582
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: durationLabel })
|
|
11761
12583
|
] }),
|
|
11762
|
-
/* @__PURE__ */ (0,
|
|
11763
|
-
/* @__PURE__ */ (0,
|
|
12584
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
12585
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11764
12586
|
"button",
|
|
11765
12587
|
{
|
|
11766
12588
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
11767
12589
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
11768
|
-
children: /* @__PURE__ */ (0,
|
|
11769
|
-
|
|
12590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
12591
|
+
import_lucide_react24.ChevronDown,
|
|
11770
12592
|
{
|
|
11771
12593
|
className: cn(
|
|
11772
12594
|
"h-4 w-4 transition-transform",
|
|
@@ -11780,53 +12602,53 @@ function ComponentBlock({ content }) {
|
|
|
11780
12602
|
]
|
|
11781
12603
|
}
|
|
11782
12604
|
),
|
|
11783
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
12605
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11784
12606
|
CardContent,
|
|
11785
12607
|
{
|
|
11786
12608
|
ref: contentRef,
|
|
11787
12609
|
className: "text-xs text-muted-foreground max-h-60 overflow-auto",
|
|
11788
12610
|
children: [
|
|
11789
|
-
data.input && /* @__PURE__ */ (0,
|
|
11790
|
-
error ? /* @__PURE__ */ (0,
|
|
12611
|
+
data.input && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(data.input) }),
|
|
12612
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue3(error) }) : hasOutput && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(fallback) })
|
|
11791
12613
|
]
|
|
11792
12614
|
}
|
|
11793
12615
|
)
|
|
11794
12616
|
] });
|
|
11795
12617
|
}
|
|
11796
12618
|
function UnknownBlock({ content }) {
|
|
11797
|
-
return /* @__PURE__ */ (0,
|
|
11798
|
-
/* @__PURE__ */ (0,
|
|
11799
|
-
/* @__PURE__ */ (0,
|
|
11800
|
-
/* @__PURE__ */ (0,
|
|
12619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12620
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12621
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
12622
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
11801
12623
|
] }),
|
|
11802
|
-
/* @__PURE__ */ (0,
|
|
12624
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
|
|
11803
12625
|
] });
|
|
11804
12626
|
}
|
|
11805
12627
|
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
11806
12628
|
const messageId = message.id;
|
|
11807
12629
|
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
11808
12630
|
if (typeof content === "string") {
|
|
11809
|
-
return /* @__PURE__ */ (0,
|
|
12631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarkdownText, { children: content }) }, `text-${index}`);
|
|
11810
12632
|
}
|
|
11811
12633
|
if (isThreadContextUsageRenderArtifact(content)) {
|
|
11812
12634
|
return null;
|
|
11813
12635
|
}
|
|
11814
12636
|
if (isTextContent3(content)) {
|
|
11815
|
-
return /* @__PURE__ */ (0,
|
|
12637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
11816
12638
|
}
|
|
11817
12639
|
if (isReasoningContent3(content)) {
|
|
11818
|
-
return /* @__PURE__ */ (0,
|
|
12640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
11819
12641
|
}
|
|
11820
12642
|
if (isImageContent(content)) {
|
|
11821
|
-
return /* @__PURE__ */ (0,
|
|
12643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
11822
12644
|
}
|
|
11823
12645
|
if (isComponentContent3(content)) {
|
|
11824
12646
|
if (isContextCompressionComponent(content)) {
|
|
11825
|
-
return /* @__PURE__ */ (0,
|
|
12647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11826
12648
|
"div",
|
|
11827
12649
|
{
|
|
11828
12650
|
className: "w-full",
|
|
11829
|
-
children: /* @__PURE__ */ (0,
|
|
12651
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ContextCompressionMessage, { content })
|
|
11830
12652
|
},
|
|
11831
12653
|
content.id ?? `context-compression-${index}`
|
|
11832
12654
|
);
|
|
@@ -11836,13 +12658,16 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11836
12658
|
lookupMessages
|
|
11837
12659
|
);
|
|
11838
12660
|
if (requestUserInputResult) {
|
|
11839
|
-
return /* @__PURE__ */ (0,
|
|
12661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
|
|
11840
12662
|
}
|
|
11841
12663
|
if (isWidgetComponent2(content)) {
|
|
11842
|
-
return /* @__PURE__ */ (0,
|
|
12664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
12665
|
+
}
|
|
12666
|
+
if (isMcpAppComponent(content)) {
|
|
12667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(McpAppMessage, { data: content.data }) }, content.id ?? `mcp-app-${index}`);
|
|
11843
12668
|
}
|
|
11844
12669
|
if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
|
|
11845
|
-
return /* @__PURE__ */ (0,
|
|
12670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11846
12671
|
ToolComponentGroup,
|
|
11847
12672
|
{
|
|
11848
12673
|
items: [content],
|
|
@@ -11853,15 +12678,15 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11853
12678
|
}
|
|
11854
12679
|
) }, content.id ?? `component-group-${index}`);
|
|
11855
12680
|
}
|
|
11856
|
-
return /* @__PURE__ */ (0,
|
|
12681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
11857
12682
|
}
|
|
11858
12683
|
if (isMemoryContent(content)) {
|
|
11859
|
-
return /* @__PURE__ */ (0,
|
|
12684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
11860
12685
|
}
|
|
11861
12686
|
if (isAgentEventContent(content)) {
|
|
11862
|
-
return /* @__PURE__ */ (0,
|
|
12687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
|
|
11863
12688
|
}
|
|
11864
|
-
return /* @__PURE__ */ (0,
|
|
12689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
11865
12690
|
}
|
|
11866
12691
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
11867
12692
|
if (unit.type === "item") {
|
|
@@ -11872,7 +12697,7 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
|
|
|
11872
12697
|
isAgentOutput: options?.isAgentOutput
|
|
11873
12698
|
});
|
|
11874
12699
|
}
|
|
11875
|
-
return /* @__PURE__ */ (0,
|
|
12700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11876
12701
|
ToolComponentGroup,
|
|
11877
12702
|
{
|
|
11878
12703
|
items: unit.items,
|
|
@@ -11888,7 +12713,7 @@ function renderEntryBatch(entries, message, lookupMessages, hasFollowingItem, op
|
|
|
11888
12713
|
const renderUnits = buildToolComponentRenderUnits(
|
|
11889
12714
|
entries.map((entry) => entry.item),
|
|
11890
12715
|
{
|
|
11891
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12716
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
11892
12717
|
}
|
|
11893
12718
|
);
|
|
11894
12719
|
return renderUnits.map(
|
|
@@ -11909,7 +12734,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
11909
12734
|
const batch = entryBatch;
|
|
11910
12735
|
entryBatch = [];
|
|
11911
12736
|
rendered.push(
|
|
11912
|
-
/* @__PURE__ */ (0,
|
|
12737
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(React36.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
|
|
11913
12738
|
...options,
|
|
11914
12739
|
isAgentOutput: depth > 0
|
|
11915
12740
|
}) }, `entries-${batch[0]?.order ?? rendered.length}`)
|
|
@@ -11926,7 +12751,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
11926
12751
|
}
|
|
11927
12752
|
flushEntries(true);
|
|
11928
12753
|
rendered.push(
|
|
11929
|
-
/* @__PURE__ */ (0,
|
|
12754
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11930
12755
|
AgentRunGroup,
|
|
11931
12756
|
{
|
|
11932
12757
|
node: unit.node,
|
|
@@ -11951,7 +12776,7 @@ function renderContent(message, lookupMessages, options) {
|
|
|
11951
12776
|
message
|
|
11952
12777
|
);
|
|
11953
12778
|
if (renderTree.hasAgentRuns) {
|
|
11954
|
-
return /* @__PURE__ */ (0,
|
|
12779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
|
|
11955
12780
|
renderTree.units,
|
|
11956
12781
|
message,
|
|
11957
12782
|
lookupMessages,
|
|
@@ -11961,13 +12786,13 @@ function renderContent(message, lookupMessages, options) {
|
|
|
11961
12786
|
const content = message.content;
|
|
11962
12787
|
if (typeof content === "string") {
|
|
11963
12788
|
if (!content.trim()) return null;
|
|
11964
|
-
return /* @__PURE__ */ (0,
|
|
12789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarkdownText, { children: content });
|
|
11965
12790
|
}
|
|
11966
12791
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
11967
12792
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
11968
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12793
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
11969
12794
|
});
|
|
11970
|
-
return /* @__PURE__ */ (0,
|
|
12795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "space-y-3", children: renderUnits.map(
|
|
11971
12796
|
(unit, index) => renderContentUnit(
|
|
11972
12797
|
unit,
|
|
11973
12798
|
message,
|
|
@@ -11987,7 +12812,7 @@ function AssistantStreamingIndicator({
|
|
|
11987
12812
|
thinking: t("message.thinking"),
|
|
11988
12813
|
answering: t("message.answering")
|
|
11989
12814
|
};
|
|
11990
|
-
return /* @__PURE__ */ (0,
|
|
12815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11991
12816
|
"div",
|
|
11992
12817
|
{
|
|
11993
12818
|
className: cn(
|
|
@@ -11995,18 +12820,18 @@ function AssistantStreamingIndicator({
|
|
|
11995
12820
|
className
|
|
11996
12821
|
),
|
|
11997
12822
|
children: [
|
|
11998
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
11999
|
-
status === "thinking" && /* @__PURE__ */ (0,
|
|
12000
|
-
/* @__PURE__ */ (0,
|
|
12001
|
-
/* @__PURE__ */ (0,
|
|
12002
|
-
/* @__PURE__ */ (0,
|
|
12823
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react24.Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
12824
|
+
status === "thinking" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
12825
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
12826
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
12827
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
12003
12828
|
] }),
|
|
12004
|
-
status === "answering" && /* @__PURE__ */ (0,
|
|
12005
|
-
/* @__PURE__ */ (0,
|
|
12006
|
-
/* @__PURE__ */ (0,
|
|
12007
|
-
/* @__PURE__ */ (0,
|
|
12829
|
+
status === "answering" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
12830
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
12831
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
12832
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
12008
12833
|
] }),
|
|
12009
|
-
/* @__PURE__ */ (0,
|
|
12834
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: labelMap[status] })
|
|
12010
12835
|
]
|
|
12011
12836
|
}
|
|
12012
12837
|
);
|
|
@@ -12035,42 +12860,42 @@ function AssistantMessage({
|
|
|
12035
12860
|
organizationId,
|
|
12036
12861
|
apiUrl
|
|
12037
12862
|
});
|
|
12038
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0,
|
|
12863
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
12039
12864
|
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
12040
12865
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
12041
12866
|
if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
|
|
12042
|
-
return /* @__PURE__ */ (0,
|
|
12867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
12043
12868
|
}
|
|
12044
12869
|
if (hasContent && hasReasoning) {
|
|
12045
|
-
return /* @__PURE__ */ (0,
|
|
12046
|
-
/* @__PURE__ */ (0,
|
|
12870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12871
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
12047
12872
|
Tabs,
|
|
12048
12873
|
{
|
|
12049
12874
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
12050
12875
|
className: "w-full",
|
|
12051
12876
|
children: [
|
|
12052
|
-
/* @__PURE__ */ (0,
|
|
12053
|
-
/* @__PURE__ */ (0,
|
|
12054
|
-
/* @__PURE__ */ (0,
|
|
12877
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(TabsList, { className: "", children: [
|
|
12878
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
12879
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
12055
12880
|
] }),
|
|
12056
|
-
/* @__PURE__ */ (0,
|
|
12057
|
-
/* @__PURE__ */ (0,
|
|
12881
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
12882
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
12058
12883
|
]
|
|
12059
12884
|
}
|
|
12060
12885
|
),
|
|
12061
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
12886
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12062
12887
|
] });
|
|
12063
12888
|
}
|
|
12064
|
-
return /* @__PURE__ */ (0,
|
|
12889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12065
12890
|
hasReasoning ? reasoningNode : answerNode,
|
|
12066
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
12891
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12067
12892
|
] });
|
|
12068
12893
|
}
|
|
12069
12894
|
|
|
12070
12895
|
// src/components/thread/MessageActions.tsx
|
|
12071
|
-
var
|
|
12072
|
-
var
|
|
12073
|
-
var
|
|
12896
|
+
var React37 = __toESM(require("react"), 1);
|
|
12897
|
+
var import_lucide_react25 = require("lucide-react");
|
|
12898
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
12074
12899
|
function MessageActions({
|
|
12075
12900
|
content,
|
|
12076
12901
|
isAssistant = false,
|
|
@@ -12079,7 +12904,7 @@ function MessageActions({
|
|
|
12079
12904
|
className
|
|
12080
12905
|
}) {
|
|
12081
12906
|
const { t } = useChatkitTranslation();
|
|
12082
|
-
const [copied, setCopied] =
|
|
12907
|
+
const [copied, setCopied] = React37.useState(false);
|
|
12083
12908
|
const handleCopy = async () => {
|
|
12084
12909
|
try {
|
|
12085
12910
|
await navigator.clipboard.writeText(content);
|
|
@@ -12092,7 +12917,7 @@ function MessageActions({
|
|
|
12092
12917
|
if (isStreaming) {
|
|
12093
12918
|
return null;
|
|
12094
12919
|
}
|
|
12095
|
-
return /* @__PURE__ */ (0,
|
|
12920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
12096
12921
|
"div",
|
|
12097
12922
|
{
|
|
12098
12923
|
className: cn(
|
|
@@ -12100,7 +12925,7 @@ function MessageActions({
|
|
|
12100
12925
|
className
|
|
12101
12926
|
),
|
|
12102
12927
|
children: [
|
|
12103
|
-
/* @__PURE__ */ (0,
|
|
12928
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12104
12929
|
"button",
|
|
12105
12930
|
{
|
|
12106
12931
|
type: "button",
|
|
@@ -12110,17 +12935,17 @@ function MessageActions({
|
|
|
12110
12935
|
copied && "text-green-500"
|
|
12111
12936
|
),
|
|
12112
12937
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
12113
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
12938
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react25.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react25.Copy, { size: 14 })
|
|
12114
12939
|
}
|
|
12115
12940
|
),
|
|
12116
|
-
isAssistant && onRetry && /* @__PURE__ */ (0,
|
|
12941
|
+
isAssistant && onRetry && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12117
12942
|
"button",
|
|
12118
12943
|
{
|
|
12119
12944
|
type: "button",
|
|
12120
12945
|
onClick: onRetry,
|
|
12121
12946
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
12122
12947
|
title: t("messageActions.regenerate"),
|
|
12123
|
-
children: /* @__PURE__ */ (0,
|
|
12948
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react25.RefreshCw, { size: 14 })
|
|
12124
12949
|
}
|
|
12125
12950
|
)
|
|
12126
12951
|
]
|
|
@@ -12129,20 +12954,20 @@ function MessageActions({
|
|
|
12129
12954
|
}
|
|
12130
12955
|
|
|
12131
12956
|
// src/components/thread/StartScreen.tsx
|
|
12132
|
-
var
|
|
12133
|
-
var
|
|
12134
|
-
var
|
|
12957
|
+
var React38 = require("react");
|
|
12958
|
+
var import_lucide_react26 = require("lucide-react");
|
|
12959
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
12135
12960
|
function getIconComponent2(icon) {
|
|
12136
12961
|
const iconMap = {
|
|
12137
|
-
"circle-question": /* @__PURE__ */ (0,
|
|
12138
|
-
"lightbulb": /* @__PURE__ */ (0,
|
|
12139
|
-
"sparkle": /* @__PURE__ */ (0,
|
|
12140
|
-
"write": /* @__PURE__ */ (0,
|
|
12141
|
-
"search": /* @__PURE__ */ (0,
|
|
12142
|
-
"globe": /* @__PURE__ */ (0,
|
|
12143
|
-
"book-open": /* @__PURE__ */ (0,
|
|
12144
|
-
"compass": /* @__PURE__ */ (0,
|
|
12145
|
-
"bolt": /* @__PURE__ */ (0,
|
|
12962
|
+
"circle-question": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.HelpCircle, { size: 20 }),
|
|
12963
|
+
"lightbulb": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Lightbulb, { size: 20 }),
|
|
12964
|
+
"sparkle": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Sparkles, { size: 20 }),
|
|
12965
|
+
"write": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Pencil, { size: 20 }),
|
|
12966
|
+
"search": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Search, { size: 20 }),
|
|
12967
|
+
"globe": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Globe, { size: 20 }),
|
|
12968
|
+
"book-open": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.BookOpen, { size: 20 }),
|
|
12969
|
+
"compass": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Compass, { size: 20 }),
|
|
12970
|
+
"bolt": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Zap, { size: 20 })
|
|
12146
12971
|
};
|
|
12147
12972
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
12148
12973
|
}
|
|
@@ -12158,7 +12983,7 @@ function StartScreen({
|
|
|
12158
12983
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
12159
12984
|
const prompts = startScreen?.prompts ?? [];
|
|
12160
12985
|
const editPromptLabel = t("startScreen.editPrompt");
|
|
12161
|
-
return /* @__PURE__ */ (0,
|
|
12986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12162
12987
|
"div",
|
|
12163
12988
|
{
|
|
12164
12989
|
className: cn(
|
|
@@ -12166,8 +12991,8 @@ function StartScreen({
|
|
|
12166
12991
|
className
|
|
12167
12992
|
),
|
|
12168
12993
|
children: [
|
|
12169
|
-
/* @__PURE__ */ (0,
|
|
12170
|
-
prompts.length > 0 && /* @__PURE__ */ (0,
|
|
12994
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "mb-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
12995
|
+
prompts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12171
12996
|
"div",
|
|
12172
12997
|
{
|
|
12173
12998
|
className: cn(
|
|
@@ -12176,7 +13001,7 @@ function StartScreen({
|
|
|
12176
13001
|
"focus-within:ring-2 focus-within:ring-primary/20"
|
|
12177
13002
|
),
|
|
12178
13003
|
children: [
|
|
12179
|
-
/* @__PURE__ */ (0,
|
|
13004
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12180
13005
|
"button",
|
|
12181
13006
|
{
|
|
12182
13007
|
type: "button",
|
|
@@ -12187,12 +13012,12 @@ function StartScreen({
|
|
|
12187
13012
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
12188
13013
|
),
|
|
12189
13014
|
children: [
|
|
12190
|
-
/* @__PURE__ */ (0,
|
|
12191
|
-
/* @__PURE__ */ (0,
|
|
13015
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
|
|
13016
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
12192
13017
|
]
|
|
12193
13018
|
}
|
|
12194
13019
|
),
|
|
12195
|
-
/* @__PURE__ */ (0,
|
|
13020
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
12196
13021
|
"button",
|
|
12197
13022
|
{
|
|
12198
13023
|
type: "button",
|
|
@@ -12205,7 +13030,7 @@ function StartScreen({
|
|
|
12205
13030
|
"rounded-r-xl transition-colors hover:bg-muted hover:text-foreground",
|
|
12206
13031
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
12207
13032
|
),
|
|
12208
|
-
children: /* @__PURE__ */ (0,
|
|
13033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Pencil, { size: 16 })
|
|
12209
13034
|
}
|
|
12210
13035
|
)
|
|
12211
13036
|
]
|
|
@@ -12218,7 +13043,7 @@ function StartScreen({
|
|
|
12218
13043
|
}
|
|
12219
13044
|
|
|
12220
13045
|
// src/hooks/useThreads.ts
|
|
12221
|
-
var
|
|
13046
|
+
var React39 = __toESM(require("react"), 1);
|
|
12222
13047
|
var DEFAULT_LIMIT = 50;
|
|
12223
13048
|
var getThreadTitle = (threadRecord) => {
|
|
12224
13049
|
const title = threadRecord.title?.trim();
|
|
@@ -12233,7 +13058,7 @@ var toDate = (value) => {
|
|
|
12233
13058
|
if (Number.isNaN(timestamp)) return void 0;
|
|
12234
13059
|
return new Date(timestamp);
|
|
12235
13060
|
};
|
|
12236
|
-
var
|
|
13061
|
+
var getErrorMessage2 = (error) => {
|
|
12237
13062
|
if (!error) return void 0;
|
|
12238
13063
|
if (error instanceof Error) return error.message;
|
|
12239
13064
|
if (typeof error === "string") return error;
|
|
@@ -12271,16 +13096,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12271
13096
|
isLoading: isStreamLoading,
|
|
12272
13097
|
error: streamError
|
|
12273
13098
|
} = useStreamContext();
|
|
12274
|
-
const [threadRecords, setThreadRecords] =
|
|
12275
|
-
const [isLoading, setIsLoading] =
|
|
12276
|
-
const [error, setError] =
|
|
12277
|
-
const upsertThreadRecord =
|
|
13099
|
+
const [threadRecords, setThreadRecords] = React39.useState([]);
|
|
13100
|
+
const [isLoading, setIsLoading] = React39.useState(false);
|
|
13101
|
+
const [error, setError] = React39.useState(null);
|
|
13102
|
+
const upsertThreadRecord = React39.useCallback((threadRecord) => {
|
|
12278
13103
|
setThreadRecords((prev) => {
|
|
12279
13104
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
12280
13105
|
return sortThreadRecords([threadRecord, ...next]);
|
|
12281
13106
|
});
|
|
12282
13107
|
}, []);
|
|
12283
|
-
const refreshThreads =
|
|
13108
|
+
const refreshThreads = React39.useCallback(async () => {
|
|
12284
13109
|
setIsLoading(true);
|
|
12285
13110
|
setError(null);
|
|
12286
13111
|
try {
|
|
@@ -12296,7 +13121,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12296
13121
|
setIsLoading(false);
|
|
12297
13122
|
}
|
|
12298
13123
|
}, [client, limit, assistantId]);
|
|
12299
|
-
const createThread =
|
|
13124
|
+
const createThread = React39.useCallback(
|
|
12300
13125
|
async (input) => {
|
|
12301
13126
|
setError(null);
|
|
12302
13127
|
const payload = {};
|
|
@@ -12310,7 +13135,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12310
13135
|
},
|
|
12311
13136
|
[client, upsertThreadRecord]
|
|
12312
13137
|
);
|
|
12313
|
-
const updateThread =
|
|
13138
|
+
const updateThread = React39.useCallback(
|
|
12314
13139
|
async (recordId, payload) => {
|
|
12315
13140
|
setError(null);
|
|
12316
13141
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -12319,7 +13144,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12319
13144
|
},
|
|
12320
13145
|
[client, upsertThreadRecord]
|
|
12321
13146
|
);
|
|
12322
|
-
const deleteThread =
|
|
13147
|
+
const deleteThread = React39.useCallback(
|
|
12323
13148
|
async (recordId) => {
|
|
12324
13149
|
setError(null);
|
|
12325
13150
|
await client.conversations.delete(recordId);
|
|
@@ -12327,11 +13152,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12327
13152
|
},
|
|
12328
13153
|
[client]
|
|
12329
13154
|
);
|
|
12330
|
-
|
|
13155
|
+
React39.useEffect(() => {
|
|
12331
13156
|
if (!isReady) return;
|
|
12332
13157
|
void refreshThreads();
|
|
12333
13158
|
}, [refreshThreads, isReady]);
|
|
12334
|
-
|
|
13159
|
+
React39.useEffect(() => {
|
|
12335
13160
|
if (!threadId || !isStreamLoading) return;
|
|
12336
13161
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12337
13162
|
const busyStatus = "busy";
|
|
@@ -12352,8 +13177,8 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12352
13177
|
return changed ? sortThreadRecords(next) : prev;
|
|
12353
13178
|
});
|
|
12354
13179
|
}, [threadId, isStreamLoading]);
|
|
12355
|
-
|
|
12356
|
-
const message =
|
|
13180
|
+
React39.useEffect(() => {
|
|
13181
|
+
const message = getErrorMessage2(streamError)?.trim();
|
|
12357
13182
|
if (!threadId || !message) return;
|
|
12358
13183
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12359
13184
|
const errorStatus = "error";
|
|
@@ -12374,7 +13199,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12374
13199
|
return changed ? sortThreadRecords(next) : prev;
|
|
12375
13200
|
});
|
|
12376
13201
|
}, [threadId, streamError]);
|
|
12377
|
-
|
|
13202
|
+
React39.useEffect(() => {
|
|
12378
13203
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
12379
13204
|
let cancelled = false;
|
|
12380
13205
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -12388,7 +13213,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12388
13213
|
cancelled = true;
|
|
12389
13214
|
};
|
|
12390
13215
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
12391
|
-
const threads =
|
|
13216
|
+
const threads = React39.useMemo(
|
|
12392
13217
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
12393
13218
|
[threadRecords]
|
|
12394
13219
|
);
|
|
@@ -12405,10 +13230,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12405
13230
|
}
|
|
12406
13231
|
|
|
12407
13232
|
// src/components/thread/context-usage-indicator.tsx
|
|
12408
|
-
var
|
|
13233
|
+
var React40 = __toESM(require("react"), 1);
|
|
12409
13234
|
|
|
12410
13235
|
// src/components/ui/progress-circle.tsx
|
|
12411
|
-
var
|
|
13236
|
+
var import_jsx_runtime45 = (
|
|
12412
13237
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
12413
13238
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
12414
13239
|
require("react/jsx-runtime")
|
|
@@ -12432,7 +13257,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12432
13257
|
fill: "none",
|
|
12433
13258
|
strokeWidth
|
|
12434
13259
|
};
|
|
12435
|
-
return /* @__PURE__ */ (0,
|
|
13260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
12436
13261
|
"svg",
|
|
12437
13262
|
{
|
|
12438
13263
|
role: "progressbar",
|
|
@@ -12443,8 +13268,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12443
13268
|
"aria-valuemax": 100,
|
|
12444
13269
|
...restSvgProps,
|
|
12445
13270
|
children: [
|
|
12446
|
-
/* @__PURE__ */ (0,
|
|
12447
|
-
/* @__PURE__ */ (0,
|
|
13271
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
13272
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12448
13273
|
"circle",
|
|
12449
13274
|
{
|
|
12450
13275
|
...commonParams,
|
|
@@ -12462,7 +13287,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12462
13287
|
};
|
|
12463
13288
|
|
|
12464
13289
|
// src/components/thread/context-usage-indicator.tsx
|
|
12465
|
-
var
|
|
13290
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
12466
13291
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
12467
13292
|
minimumFractionDigits: 0,
|
|
12468
13293
|
maximumFractionDigits: 1
|
|
@@ -12495,21 +13320,22 @@ function ContextUsageIndicator({
|
|
|
12495
13320
|
}) {
|
|
12496
13321
|
const { t } = useChatkitTranslation();
|
|
12497
13322
|
const stream = useStreamContext();
|
|
12498
|
-
const [maxContextSize, setMaxContextSize] =
|
|
12499
|
-
const [usedContextSize, setUsedContextSize] =
|
|
12500
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
12501
|
-
const latestRealtimeUsageRef =
|
|
13323
|
+
const [maxContextSize, setMaxContextSize] = React40.useState(null);
|
|
13324
|
+
const [usedContextSize, setUsedContextSize] = React40.useState(null);
|
|
13325
|
+
const [assistantAgentKey, setAssistantAgentKey] = React40.useState(null);
|
|
13326
|
+
const latestRealtimeUsageRef = React40.useRef({
|
|
12502
13327
|
threadId: null,
|
|
12503
13328
|
agentKey: null,
|
|
12504
13329
|
usedTokens: null
|
|
12505
13330
|
});
|
|
12506
|
-
const realtimeUsage =
|
|
13331
|
+
const realtimeUsage = React40.useMemo(
|
|
12507
13332
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
12508
13333
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
12509
13334
|
);
|
|
12510
13335
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
12511
|
-
|
|
12512
|
-
|
|
13336
|
+
const hasApiConfiguration = Boolean(stream.apiUrl?.trim() && stream.apiKey?.trim());
|
|
13337
|
+
React40.useEffect(() => {
|
|
13338
|
+
if (!hasApiConfiguration || !stream.client || !stream.assistantId) {
|
|
12513
13339
|
setMaxContextSize(null);
|
|
12514
13340
|
setAssistantAgentKey(null);
|
|
12515
13341
|
return;
|
|
@@ -12527,20 +13353,20 @@ function ContextUsageIndicator({
|
|
|
12527
13353
|
return () => {
|
|
12528
13354
|
cancelled = true;
|
|
12529
13355
|
};
|
|
12530
|
-
}, [stream.client, stream.assistantId]);
|
|
12531
|
-
|
|
13356
|
+
}, [hasApiConfiguration, stream.client, stream.assistantId]);
|
|
13357
|
+
React40.useEffect(() => {
|
|
12532
13358
|
latestRealtimeUsageRef.current = {
|
|
12533
13359
|
threadId: stream.threadId ?? null,
|
|
12534
13360
|
agentKey: assistantAgentKey,
|
|
12535
13361
|
usedTokens: realtimeUsedContextSize
|
|
12536
13362
|
};
|
|
12537
13363
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
12538
|
-
|
|
13364
|
+
React40.useEffect(() => {
|
|
12539
13365
|
if (realtimeUsedContextSize == null) return;
|
|
12540
13366
|
setUsedContextSize(realtimeUsedContextSize);
|
|
12541
13367
|
}, [realtimeUsedContextSize]);
|
|
12542
|
-
|
|
12543
|
-
if (!stream.client) {
|
|
13368
|
+
React40.useEffect(() => {
|
|
13369
|
+
if (!hasApiConfiguration || !stream.client) {
|
|
12544
13370
|
setUsedContextSize(null);
|
|
12545
13371
|
return;
|
|
12546
13372
|
}
|
|
@@ -12576,6 +13402,7 @@ function ContextUsageIndicator({
|
|
|
12576
13402
|
};
|
|
12577
13403
|
}, [
|
|
12578
13404
|
assistantAgentKey,
|
|
13405
|
+
hasApiConfiguration,
|
|
12579
13406
|
realtimeUsedContextSize,
|
|
12580
13407
|
stream.apiKey,
|
|
12581
13408
|
stream.apiUrl,
|
|
@@ -12604,8 +13431,8 @@ function ContextUsageIndicator({
|
|
|
12604
13431
|
});
|
|
12605
13432
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
12606
13433
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
12607
|
-
return /* @__PURE__ */ (0,
|
|
12608
|
-
/* @__PURE__ */ (0,
|
|
13434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Tooltip, { children: [
|
|
13435
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12609
13436
|
"button",
|
|
12610
13437
|
{
|
|
12611
13438
|
type: "button",
|
|
@@ -12614,31 +13441,31 @@ function ContextUsageIndicator({
|
|
|
12614
13441
|
className
|
|
12615
13442
|
),
|
|
12616
13443
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
12617
|
-
children: /* @__PURE__ */ (0,
|
|
13444
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
12618
13445
|
}
|
|
12619
13446
|
) }),
|
|
12620
|
-
/* @__PURE__ */ (0,
|
|
12621
|
-
/* @__PURE__ */ (0,
|
|
12622
|
-
/* @__PURE__ */ (0,
|
|
12623
|
-
/* @__PURE__ */ (0,
|
|
13447
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
13448
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
13449
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
13450
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
12624
13451
|
] })
|
|
12625
13452
|
] });
|
|
12626
13453
|
}
|
|
12627
13454
|
|
|
12628
13455
|
// src/components/pet/PetBridge.tsx
|
|
12629
|
-
var
|
|
12630
|
-
var
|
|
13456
|
+
var React41 = __toESM(require("react"), 1);
|
|
13457
|
+
var import_chatkit_types10 = require("@xpert-ai/chatkit-types");
|
|
12631
13458
|
function PetBridge({ pet, state }) {
|
|
12632
13459
|
const parentMessenger = useParentMessenger();
|
|
12633
13460
|
const sendEvent = parentMessenger?.sendEvent;
|
|
12634
|
-
const options =
|
|
12635
|
-
|
|
13461
|
+
const options = React41.useMemo(() => (0, import_chatkit_types10.normalizePetOptions)(pet), [pet]);
|
|
13462
|
+
React41.useEffect(() => {
|
|
12636
13463
|
if (!sendEvent) {
|
|
12637
13464
|
return;
|
|
12638
13465
|
}
|
|
12639
13466
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
12640
13467
|
}, [sendEvent, pet]);
|
|
12641
|
-
|
|
13468
|
+
React41.useEffect(() => {
|
|
12642
13469
|
if (!sendEvent || !options) {
|
|
12643
13470
|
return;
|
|
12644
13471
|
}
|
|
@@ -12648,15 +13475,15 @@ function PetBridge({ pet, state }) {
|
|
|
12648
13475
|
}
|
|
12649
13476
|
|
|
12650
13477
|
// src/components/settings/SettingsSheet.tsx
|
|
12651
|
-
var
|
|
12652
|
-
var
|
|
13478
|
+
var React48 = __toESM(require("react"), 1);
|
|
13479
|
+
var import_lucide_react28 = require("lucide-react");
|
|
12653
13480
|
|
|
12654
13481
|
// src/components/ui/input.tsx
|
|
12655
|
-
var
|
|
12656
|
-
var
|
|
12657
|
-
var Input =
|
|
13482
|
+
var React42 = __toESM(require("react"), 1);
|
|
13483
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
13484
|
+
var Input = React42.forwardRef(
|
|
12658
13485
|
({ className, type, ...props }, ref) => {
|
|
12659
|
-
return /* @__PURE__ */ (0,
|
|
13486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12660
13487
|
"input",
|
|
12661
13488
|
{
|
|
12662
13489
|
ref,
|
|
@@ -12673,20 +13500,20 @@ var Input = React41.forwardRef(
|
|
|
12673
13500
|
Input.displayName = "Input";
|
|
12674
13501
|
|
|
12675
13502
|
// src/components/ui/select.tsx
|
|
12676
|
-
var
|
|
13503
|
+
var React43 = require("react");
|
|
12677
13504
|
var import_radix_ui2 = require("radix-ui");
|
|
12678
|
-
var
|
|
12679
|
-
var
|
|
13505
|
+
var import_lucide_react27 = require("lucide-react");
|
|
13506
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
12680
13507
|
function Select({
|
|
12681
13508
|
...props
|
|
12682
13509
|
}) {
|
|
12683
|
-
return /* @__PURE__ */ (0,
|
|
13510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Root, { "data-slot": "select", ...props });
|
|
12684
13511
|
}
|
|
12685
13512
|
function SelectGroup({
|
|
12686
13513
|
className,
|
|
12687
13514
|
...props
|
|
12688
13515
|
}) {
|
|
12689
|
-
return /* @__PURE__ */ (0,
|
|
13516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12690
13517
|
import_radix_ui2.Select.Group,
|
|
12691
13518
|
{
|
|
12692
13519
|
"data-slot": "select-group",
|
|
@@ -12698,7 +13525,7 @@ function SelectGroup({
|
|
|
12698
13525
|
function SelectValue({
|
|
12699
13526
|
...props
|
|
12700
13527
|
}) {
|
|
12701
|
-
return /* @__PURE__ */ (0,
|
|
13528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Value, { "data-slot": "select-value", ...props });
|
|
12702
13529
|
}
|
|
12703
13530
|
function SelectTrigger({
|
|
12704
13531
|
className,
|
|
@@ -12706,7 +13533,7 @@ function SelectTrigger({
|
|
|
12706
13533
|
children,
|
|
12707
13534
|
...props
|
|
12708
13535
|
}) {
|
|
12709
|
-
return /* @__PURE__ */ (0,
|
|
13536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12710
13537
|
import_radix_ui2.Select.Trigger,
|
|
12711
13538
|
{
|
|
12712
13539
|
"data-slot": "select-trigger",
|
|
@@ -12718,7 +13545,7 @@ function SelectTrigger({
|
|
|
12718
13545
|
...props,
|
|
12719
13546
|
children: [
|
|
12720
13547
|
children,
|
|
12721
|
-
/* @__PURE__ */ (0,
|
|
13548
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react27.ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
12722
13549
|
]
|
|
12723
13550
|
}
|
|
12724
13551
|
);
|
|
@@ -12730,7 +13557,7 @@ function SelectContent({
|
|
|
12730
13557
|
align = "center",
|
|
12731
13558
|
...props
|
|
12732
13559
|
}) {
|
|
12733
|
-
return /* @__PURE__ */ (0,
|
|
13560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12734
13561
|
import_radix_ui2.Select.Content,
|
|
12735
13562
|
{
|
|
12736
13563
|
"data-slot": "select-content",
|
|
@@ -12740,8 +13567,8 @@ function SelectContent({
|
|
|
12740
13567
|
align,
|
|
12741
13568
|
...props,
|
|
12742
13569
|
children: [
|
|
12743
|
-
/* @__PURE__ */ (0,
|
|
12744
|
-
/* @__PURE__ */ (0,
|
|
13570
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectScrollUpButton, {}),
|
|
13571
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12745
13572
|
import_radix_ui2.Select.Viewport,
|
|
12746
13573
|
{
|
|
12747
13574
|
"data-position": position,
|
|
@@ -12752,7 +13579,7 @@ function SelectContent({
|
|
|
12752
13579
|
children
|
|
12753
13580
|
}
|
|
12754
13581
|
),
|
|
12755
|
-
/* @__PURE__ */ (0,
|
|
13582
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectScrollDownButton, {})
|
|
12756
13583
|
]
|
|
12757
13584
|
}
|
|
12758
13585
|
) });
|
|
@@ -12762,7 +13589,7 @@ function SelectItem({
|
|
|
12762
13589
|
children,
|
|
12763
13590
|
...props
|
|
12764
13591
|
}) {
|
|
12765
|
-
return /* @__PURE__ */ (0,
|
|
13592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12766
13593
|
import_radix_ui2.Select.Item,
|
|
12767
13594
|
{
|
|
12768
13595
|
"data-slot": "select-item",
|
|
@@ -12772,8 +13599,8 @@ function SelectItem({
|
|
|
12772
13599
|
),
|
|
12773
13600
|
...props,
|
|
12774
13601
|
children: [
|
|
12775
|
-
/* @__PURE__ */ (0,
|
|
12776
|
-
/* @__PURE__ */ (0,
|
|
13602
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react27.CheckIcon, { className: "pointer-events-none" }) }) }),
|
|
13603
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.ItemText, { children })
|
|
12777
13604
|
]
|
|
12778
13605
|
}
|
|
12779
13606
|
);
|
|
@@ -12782,7 +13609,7 @@ function SelectScrollUpButton({
|
|
|
12782
13609
|
className,
|
|
12783
13610
|
...props
|
|
12784
13611
|
}) {
|
|
12785
|
-
return /* @__PURE__ */ (0,
|
|
13612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12786
13613
|
import_radix_ui2.Select.ScrollUpButton,
|
|
12787
13614
|
{
|
|
12788
13615
|
"data-slot": "select-scroll-up-button",
|
|
@@ -12791,8 +13618,8 @@ function SelectScrollUpButton({
|
|
|
12791
13618
|
className
|
|
12792
13619
|
),
|
|
12793
13620
|
...props,
|
|
12794
|
-
children: /* @__PURE__ */ (0,
|
|
12795
|
-
|
|
13621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13622
|
+
import_lucide_react27.ChevronUpIcon,
|
|
12796
13623
|
{}
|
|
12797
13624
|
)
|
|
12798
13625
|
}
|
|
@@ -12802,7 +13629,7 @@ function SelectScrollDownButton({
|
|
|
12802
13629
|
className,
|
|
12803
13630
|
...props
|
|
12804
13631
|
}) {
|
|
12805
|
-
return /* @__PURE__ */ (0,
|
|
13632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12806
13633
|
import_radix_ui2.Select.ScrollDownButton,
|
|
12807
13634
|
{
|
|
12808
13635
|
"data-slot": "select-scroll-down-button",
|
|
@@ -12811,8 +13638,8 @@ function SelectScrollDownButton({
|
|
|
12811
13638
|
className
|
|
12812
13639
|
),
|
|
12813
13640
|
...props,
|
|
12814
|
-
children: /* @__PURE__ */ (0,
|
|
12815
|
-
|
|
13641
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13642
|
+
import_lucide_react27.ChevronDownIcon,
|
|
12816
13643
|
{}
|
|
12817
13644
|
)
|
|
12818
13645
|
}
|
|
@@ -12820,9 +13647,9 @@ function SelectScrollDownButton({
|
|
|
12820
13647
|
}
|
|
12821
13648
|
|
|
12822
13649
|
// src/components/ui/slider.tsx
|
|
12823
|
-
var
|
|
13650
|
+
var React44 = __toESM(require("react"), 1);
|
|
12824
13651
|
var import_radix_ui3 = require("radix-ui");
|
|
12825
|
-
var
|
|
13652
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
12826
13653
|
function Slider({
|
|
12827
13654
|
className,
|
|
12828
13655
|
defaultValue,
|
|
@@ -12831,11 +13658,11 @@ function Slider({
|
|
|
12831
13658
|
max = 100,
|
|
12832
13659
|
...props
|
|
12833
13660
|
}) {
|
|
12834
|
-
const _values =
|
|
13661
|
+
const _values = React44.useMemo(
|
|
12835
13662
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
12836
13663
|
[value, defaultValue, min, max]
|
|
12837
13664
|
);
|
|
12838
|
-
return /* @__PURE__ */ (0,
|
|
13665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
12839
13666
|
import_radix_ui3.Slider.Root,
|
|
12840
13667
|
{
|
|
12841
13668
|
"data-slot": "slider",
|
|
@@ -12849,12 +13676,12 @@ function Slider({
|
|
|
12849
13676
|
),
|
|
12850
13677
|
...props,
|
|
12851
13678
|
children: [
|
|
12852
|
-
/* @__PURE__ */ (0,
|
|
13679
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12853
13680
|
import_radix_ui3.Slider.Track,
|
|
12854
13681
|
{
|
|
12855
13682
|
"data-slot": "slider-track",
|
|
12856
13683
|
className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
|
|
12857
|
-
children: /* @__PURE__ */ (0,
|
|
13684
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12858
13685
|
import_radix_ui3.Slider.Range,
|
|
12859
13686
|
{
|
|
12860
13687
|
"data-slot": "slider-range",
|
|
@@ -12863,7 +13690,7 @@ function Slider({
|
|
|
12863
13690
|
)
|
|
12864
13691
|
}
|
|
12865
13692
|
),
|
|
12866
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0,
|
|
13693
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12867
13694
|
import_radix_ui3.Slider.Thumb,
|
|
12868
13695
|
{
|
|
12869
13696
|
"data-slot": "slider-thumb",
|
|
@@ -12877,15 +13704,15 @@ function Slider({
|
|
|
12877
13704
|
}
|
|
12878
13705
|
|
|
12879
13706
|
// src/components/ui/toggle-group.tsx
|
|
12880
|
-
var
|
|
13707
|
+
var React46 = __toESM(require("react"), 1);
|
|
12881
13708
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
12882
13709
|
var import_radix_ui5 = require("radix-ui");
|
|
12883
13710
|
|
|
12884
13711
|
// src/components/ui/toggle.tsx
|
|
12885
|
-
var
|
|
13712
|
+
var React45 = require("react");
|
|
12886
13713
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
12887
13714
|
var import_radix_ui4 = require("radix-ui");
|
|
12888
|
-
var
|
|
13715
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
12889
13716
|
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
12890
13717
|
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
12891
13718
|
{
|
|
@@ -12908,8 +13735,8 @@ var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
|
12908
13735
|
);
|
|
12909
13736
|
|
|
12910
13737
|
// src/components/ui/toggle-group.tsx
|
|
12911
|
-
var
|
|
12912
|
-
var ToggleGroupContext =
|
|
13738
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
13739
|
+
var ToggleGroupContext = React46.createContext({
|
|
12913
13740
|
size: "default",
|
|
12914
13741
|
variant: "default",
|
|
12915
13742
|
spacing: 0,
|
|
@@ -12924,7 +13751,7 @@ function ToggleGroup({
|
|
|
12924
13751
|
children,
|
|
12925
13752
|
...props
|
|
12926
13753
|
}) {
|
|
12927
|
-
return /* @__PURE__ */ (0,
|
|
13754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12928
13755
|
import_radix_ui5.ToggleGroup.Root,
|
|
12929
13756
|
{
|
|
12930
13757
|
"data-slot": "toggle-group",
|
|
@@ -12938,7 +13765,7 @@ function ToggleGroup({
|
|
|
12938
13765
|
className
|
|
12939
13766
|
),
|
|
12940
13767
|
...props,
|
|
12941
|
-
children: /* @__PURE__ */ (0,
|
|
13768
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12942
13769
|
ToggleGroupContext.Provider,
|
|
12943
13770
|
{
|
|
12944
13771
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -12955,8 +13782,8 @@ function ToggleGroupItem({
|
|
|
12955
13782
|
size: size2 = "default",
|
|
12956
13783
|
...props
|
|
12957
13784
|
}) {
|
|
12958
|
-
const context =
|
|
12959
|
-
return /* @__PURE__ */ (0,
|
|
13785
|
+
const context = React46.useContext(ToggleGroupContext);
|
|
13786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12960
13787
|
import_radix_ui5.ToggleGroup.Item,
|
|
12961
13788
|
{
|
|
12962
13789
|
"data-slot": "toggle-group-item",
|
|
@@ -12978,7 +13805,7 @@ function ToggleGroupItem({
|
|
|
12978
13805
|
}
|
|
12979
13806
|
|
|
12980
13807
|
// src/components/pet/pet-local-settings.ts
|
|
12981
|
-
var
|
|
13808
|
+
var import_chatkit_types11 = require("@xpert-ai/chatkit-types");
|
|
12982
13809
|
|
|
12983
13810
|
// src/components/pet/builtinPets.ts
|
|
12984
13811
|
var PUBLIC_PETS = [
|
|
@@ -13152,7 +13979,7 @@ function derivePetLocalSettings(pet) {
|
|
|
13152
13979
|
if (!pet) {
|
|
13153
13980
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
13154
13981
|
}
|
|
13155
|
-
const normalized = (0,
|
|
13982
|
+
const normalized = (0, import_chatkit_types11.normalizePetOptions)(pet ?? null);
|
|
13156
13983
|
if (!normalized) {
|
|
13157
13984
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
13158
13985
|
}
|
|
@@ -13182,25 +14009,25 @@ function derivePetLocalSettings(pet) {
|
|
|
13182
14009
|
return base2;
|
|
13183
14010
|
}
|
|
13184
14011
|
function isPetEnabled(pet) {
|
|
13185
|
-
return Boolean((0,
|
|
14012
|
+
return Boolean((0, import_chatkit_types11.normalizePetOptions)(pet ?? null));
|
|
13186
14013
|
}
|
|
13187
14014
|
|
|
13188
14015
|
// src/components/pet/PetPreview.tsx
|
|
13189
|
-
var
|
|
14016
|
+
var React47 = require("react");
|
|
13190
14017
|
|
|
13191
14018
|
// src/components/pet/petSpriteAtlas.ts
|
|
13192
|
-
var
|
|
14019
|
+
var import_chatkit_types12 = require("@xpert-ai/chatkit-types");
|
|
13193
14020
|
|
|
13194
14021
|
// src/components/pet/PetPreview.tsx
|
|
13195
|
-
var
|
|
14022
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
13196
14023
|
function escapeCssUrl(value) {
|
|
13197
14024
|
return value.replace(/["\\]/g, "\\$&");
|
|
13198
14025
|
}
|
|
13199
14026
|
function PetPreview({ src, label, className }) {
|
|
13200
14027
|
const scale = 0.13;
|
|
13201
|
-
const width =
|
|
13202
|
-
const height =
|
|
13203
|
-
return /* @__PURE__ */ (0,
|
|
14028
|
+
const width = import_chatkit_types12.petSpriteAtlas.cellWidth;
|
|
14029
|
+
const height = import_chatkit_types12.petSpriteAtlas.cellHeight;
|
|
14030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13204
14031
|
"span",
|
|
13205
14032
|
{
|
|
13206
14033
|
className: cn(
|
|
@@ -13209,7 +14036,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13209
14036
|
),
|
|
13210
14037
|
"aria-hidden": "true",
|
|
13211
14038
|
title: label,
|
|
13212
|
-
children: /* @__PURE__ */ (0,
|
|
14039
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13213
14040
|
"span",
|
|
13214
14041
|
{
|
|
13215
14042
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -13220,7 +14047,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13220
14047
|
transformOrigin: "center",
|
|
13221
14048
|
backgroundImage: `url("${escapeCssUrl(src)}")`,
|
|
13222
14049
|
backgroundRepeat: "no-repeat",
|
|
13223
|
-
backgroundSize: `${
|
|
14050
|
+
backgroundSize: `${import_chatkit_types12.petSpriteAtlas.columns * width}px ${import_chatkit_types12.petSpriteAtlas.rows * height}px`,
|
|
13224
14051
|
backgroundPosition: "0px 0px",
|
|
13225
14052
|
imageRendering: "auto"
|
|
13226
14053
|
}
|
|
@@ -13231,7 +14058,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13231
14058
|
}
|
|
13232
14059
|
|
|
13233
14060
|
// src/components/settings/SettingsSheet.tsx
|
|
13234
|
-
var
|
|
14061
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
13235
14062
|
var CHARACTER_TYPES2 = [
|
|
13236
14063
|
"builtin",
|
|
13237
14064
|
"atlas"
|
|
@@ -13247,13 +14074,13 @@ function SettingsSheet({
|
|
|
13247
14074
|
onSave
|
|
13248
14075
|
}) {
|
|
13249
14076
|
const { t } = useChatkitTranslation();
|
|
13250
|
-
const [draft, setDraft] =
|
|
13251
|
-
|
|
14077
|
+
const [draft, setDraft] = React48.useState(settings);
|
|
14078
|
+
React48.useEffect(() => {
|
|
13252
14079
|
if (open) {
|
|
13253
14080
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
13254
14081
|
}
|
|
13255
14082
|
}, [open, petRequired, settings]);
|
|
13256
|
-
const updateDraft =
|
|
14083
|
+
const updateDraft = React48.useCallback(
|
|
13257
14084
|
(patch) => {
|
|
13258
14085
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
13259
14086
|
},
|
|
@@ -13271,23 +14098,23 @@ function SettingsSheet({
|
|
|
13271
14098
|
defaultValue: selectedBuiltinPet.label
|
|
13272
14099
|
}
|
|
13273
14100
|
);
|
|
13274
|
-
return /* @__PURE__ */ (0,
|
|
13275
|
-
/* @__PURE__ */ (0,
|
|
13276
|
-
/* @__PURE__ */ (0,
|
|
13277
|
-
/* @__PURE__ */ (0,
|
|
14101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Sheet, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
|
|
14102
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SheetHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14103
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react28.Settings, { size: 16 }) }),
|
|
14104
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SheetTitle, { children: t("settings.title") })
|
|
13278
14105
|
] }) }),
|
|
13279
|
-
/* @__PURE__ */ (0,
|
|
13280
|
-
/* @__PURE__ */ (0,
|
|
13281
|
-
/* @__PURE__ */ (0,
|
|
13282
|
-
/* @__PURE__ */ (0,
|
|
13283
|
-
/* @__PURE__ */ (0,
|
|
14106
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
|
|
14107
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("section", { className: "space-y-5", children: [
|
|
14108
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14109
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react28.PawPrint, { size: 15 }) }),
|
|
14110
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
|
|
13284
14111
|
] }),
|
|
13285
|
-
/* @__PURE__ */ (0,
|
|
13286
|
-
/* @__PURE__ */ (0,
|
|
13287
|
-
/* @__PURE__ */ (0,
|
|
13288
|
-
petRequired && /* @__PURE__ */ (0,
|
|
14112
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
|
|
14113
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "min-w-0", children: [
|
|
14114
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
|
|
14115
|
+
petRequired && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
|
|
13289
14116
|
] }),
|
|
13290
|
-
/* @__PURE__ */ (0,
|
|
14117
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13291
14118
|
"button",
|
|
13292
14119
|
{
|
|
13293
14120
|
type: "button",
|
|
@@ -13300,7 +14127,7 @@ function SettingsSheet({
|
|
|
13300
14127
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
13301
14128
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
13302
14129
|
].join(" "),
|
|
13303
|
-
children: /* @__PURE__ */ (0,
|
|
14130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13304
14131
|
"span",
|
|
13305
14132
|
{
|
|
13306
14133
|
className: [
|
|
@@ -13313,9 +14140,9 @@ function SettingsSheet({
|
|
|
13313
14140
|
)
|
|
13314
14141
|
] })
|
|
13315
14142
|
] }),
|
|
13316
|
-
/* @__PURE__ */ (0,
|
|
13317
|
-
/* @__PURE__ */ (0,
|
|
13318
|
-
/* @__PURE__ */ (0,
|
|
14143
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14144
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
|
|
14145
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13319
14146
|
ToggleGroup,
|
|
13320
14147
|
{
|
|
13321
14148
|
id: "chatkit-pet-type",
|
|
@@ -13330,7 +14157,7 @@ function SettingsSheet({
|
|
|
13330
14157
|
variant: "outline",
|
|
13331
14158
|
spacing: 2,
|
|
13332
14159
|
className: "!w-full",
|
|
13333
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0,
|
|
14160
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13334
14161
|
ToggleGroupItem,
|
|
13335
14162
|
{
|
|
13336
14163
|
value: type,
|
|
@@ -13342,8 +14169,8 @@ function SettingsSheet({
|
|
|
13342
14169
|
}
|
|
13343
14170
|
)
|
|
13344
14171
|
] }),
|
|
13345
|
-
draft.characterType === "builtin" && /* @__PURE__ */ (0,
|
|
13346
|
-
/* @__PURE__ */ (0,
|
|
14172
|
+
draft.characterType === "builtin" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14173
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13347
14174
|
"label",
|
|
13348
14175
|
{
|
|
13349
14176
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -13351,7 +14178,7 @@ function SettingsSheet({
|
|
|
13351
14178
|
children: t("pet.settings.builtin")
|
|
13352
14179
|
}
|
|
13353
14180
|
),
|
|
13354
|
-
/* @__PURE__ */ (0,
|
|
14181
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
13355
14182
|
Select,
|
|
13356
14183
|
{
|
|
13357
14184
|
value: selectedBuiltinPet.id,
|
|
@@ -13362,26 +14189,26 @@ function SettingsSheet({
|
|
|
13362
14189
|
}
|
|
13363
14190
|
},
|
|
13364
14191
|
children: [
|
|
13365
|
-
/* @__PURE__ */ (0,
|
|
14192
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13366
14193
|
SelectTrigger,
|
|
13367
14194
|
{
|
|
13368
14195
|
id: "chatkit-pet-builtin",
|
|
13369
14196
|
className: "min-h-12 w-full px-3 py-2",
|
|
13370
|
-
children: /* @__PURE__ */ (0,
|
|
14197
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
13371
14198
|
}
|
|
13372
14199
|
),
|
|
13373
|
-
/* @__PURE__ */ (0,
|
|
14200
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
13374
14201
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
13375
14202
|
defaultValue: pet.label
|
|
13376
14203
|
});
|
|
13377
|
-
return /* @__PURE__ */ (0,
|
|
14204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13378
14205
|
SelectItem,
|
|
13379
14206
|
{
|
|
13380
14207
|
value: pet.id,
|
|
13381
14208
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
13382
|
-
children: /* @__PURE__ */ (0,
|
|
13383
|
-
/* @__PURE__ */ (0,
|
|
13384
|
-
/* @__PURE__ */ (0,
|
|
14209
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
14210
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PetPreview, { src: pet.previewSrc, label }),
|
|
14211
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "min-w-0 truncate", children: label })
|
|
13385
14212
|
] })
|
|
13386
14213
|
},
|
|
13387
14214
|
pet.id
|
|
@@ -13391,8 +14218,8 @@ function SettingsSheet({
|
|
|
13391
14218
|
}
|
|
13392
14219
|
)
|
|
13393
14220
|
] }),
|
|
13394
|
-
draft.characterType === "atlas" && /* @__PURE__ */ (0,
|
|
13395
|
-
/* @__PURE__ */ (0,
|
|
14221
|
+
draft.characterType === "atlas" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14222
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13396
14223
|
"label",
|
|
13397
14224
|
{
|
|
13398
14225
|
className: "text-sm font-medium",
|
|
@@ -13400,7 +14227,7 @@ function SettingsSheet({
|
|
|
13400
14227
|
children: t("pet.settings.atlasUrl")
|
|
13401
14228
|
}
|
|
13402
14229
|
),
|
|
13403
|
-
/* @__PURE__ */ (0,
|
|
14230
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13404
14231
|
Input,
|
|
13405
14232
|
{
|
|
13406
14233
|
id: "chatkit-pet-atlas",
|
|
@@ -13410,15 +14237,15 @@ function SettingsSheet({
|
|
|
13410
14237
|
}
|
|
13411
14238
|
)
|
|
13412
14239
|
] }),
|
|
13413
|
-
/* @__PURE__ */ (0,
|
|
13414
|
-
/* @__PURE__ */ (0,
|
|
13415
|
-
/* @__PURE__ */ (0,
|
|
13416
|
-
/* @__PURE__ */ (0,
|
|
14240
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14241
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
14242
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
|
|
14243
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
13417
14244
|
draft.scale.toFixed(2),
|
|
13418
14245
|
"x"
|
|
13419
14246
|
] })
|
|
13420
14247
|
] }),
|
|
13421
|
-
/* @__PURE__ */ (0,
|
|
14248
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13422
14249
|
Slider,
|
|
13423
14250
|
{
|
|
13424
14251
|
id: "chatkit-pet-scale",
|
|
@@ -13432,8 +14259,8 @@ function SettingsSheet({
|
|
|
13432
14259
|
}
|
|
13433
14260
|
)
|
|
13434
14261
|
] }),
|
|
13435
|
-
/* @__PURE__ */ (0,
|
|
13436
|
-
/* @__PURE__ */ (0,
|
|
14262
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14263
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13437
14264
|
"input",
|
|
13438
14265
|
{
|
|
13439
14266
|
type: "checkbox",
|
|
@@ -13444,8 +14271,8 @@ function SettingsSheet({
|
|
|
13444
14271
|
),
|
|
13445
14272
|
t("pet.settings.draggable")
|
|
13446
14273
|
] }),
|
|
13447
|
-
/* @__PURE__ */ (0,
|
|
13448
|
-
/* @__PURE__ */ (0,
|
|
14274
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14275
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13449
14276
|
"input",
|
|
13450
14277
|
{
|
|
13451
14278
|
type: "checkbox",
|
|
@@ -13456,8 +14283,8 @@ function SettingsSheet({
|
|
|
13456
14283
|
),
|
|
13457
14284
|
t("pet.settings.persistPosition")
|
|
13458
14285
|
] }),
|
|
13459
|
-
/* @__PURE__ */ (0,
|
|
13460
|
-
/* @__PURE__ */ (0,
|
|
14286
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
14287
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13461
14288
|
Button,
|
|
13462
14289
|
{
|
|
13463
14290
|
type: "button",
|
|
@@ -13466,7 +14293,7 @@ function SettingsSheet({
|
|
|
13466
14293
|
children: t("pet.settings.cancel")
|
|
13467
14294
|
}
|
|
13468
14295
|
),
|
|
13469
|
-
/* @__PURE__ */ (0,
|
|
14296
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { type: "submit", children: t("pet.settings.save") })
|
|
13470
14297
|
] })
|
|
13471
14298
|
] })
|
|
13472
14299
|
] }) });
|
|
@@ -14093,7 +14920,7 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
14093
14920
|
}
|
|
14094
14921
|
|
|
14095
14922
|
// src/components/chat.tsx
|
|
14096
|
-
var
|
|
14923
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
14097
14924
|
var import_meta2 = {};
|
|
14098
14925
|
var defaultApiUrl2 = import_meta2.env.VITE_XPERTAI_API_URL;
|
|
14099
14926
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
@@ -14238,8 +15065,8 @@ function ReferenceChip({
|
|
|
14238
15065
|
}) {
|
|
14239
15066
|
const metaLine = getReferenceMetaLine(reference);
|
|
14240
15067
|
const isComposer = variant === "composer";
|
|
14241
|
-
const Icon = reference.type === "quote" ?
|
|
14242
|
-
return /* @__PURE__ */ (0,
|
|
15068
|
+
const Icon = reference.type === "quote" ? import_lucide_react29.Quote : reference.type === "image" ? import_lucide_react29.ImageIcon : import_lucide_react29.FileText;
|
|
15069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14243
15070
|
"div",
|
|
14244
15071
|
{
|
|
14245
15072
|
className: cn(
|
|
@@ -14248,7 +15075,7 @@ function ReferenceChip({
|
|
|
14248
15075
|
),
|
|
14249
15076
|
title: getReferenceTitle(reference),
|
|
14250
15077
|
children: [
|
|
14251
|
-
/* @__PURE__ */ (0,
|
|
15078
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14252
15079
|
Icon,
|
|
14253
15080
|
{
|
|
14254
15081
|
size: isComposer ? 14 : 12,
|
|
@@ -14258,8 +15085,8 @@ function ReferenceChip({
|
|
|
14258
15085
|
)
|
|
14259
15086
|
}
|
|
14260
15087
|
),
|
|
14261
|
-
/* @__PURE__ */ (0,
|
|
14262
|
-
/* @__PURE__ */ (0,
|
|
15088
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
15089
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14263
15090
|
"div",
|
|
14264
15091
|
{
|
|
14265
15092
|
className: cn(
|
|
@@ -14269,7 +15096,7 @@ function ReferenceChip({
|
|
|
14269
15096
|
children: getReferenceLabel(reference)
|
|
14270
15097
|
}
|
|
14271
15098
|
),
|
|
14272
|
-
metaLine && /* @__PURE__ */ (0,
|
|
15099
|
+
metaLine && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14273
15100
|
"div",
|
|
14274
15101
|
{
|
|
14275
15102
|
className: cn(
|
|
@@ -14280,7 +15107,7 @@ function ReferenceChip({
|
|
|
14280
15107
|
}
|
|
14281
15108
|
)
|
|
14282
15109
|
] }),
|
|
14283
|
-
onRemove && removeLabel && /* @__PURE__ */ (0,
|
|
15110
|
+
onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14284
15111
|
"button",
|
|
14285
15112
|
{
|
|
14286
15113
|
type: "button",
|
|
@@ -14291,7 +15118,7 @@ function ReferenceChip({
|
|
|
14291
15118
|
),
|
|
14292
15119
|
title: removeLabel,
|
|
14293
15120
|
"aria-label": removeLabel,
|
|
14294
|
-
children: /* @__PURE__ */ (0,
|
|
15121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 12 })
|
|
14295
15122
|
}
|
|
14296
15123
|
)
|
|
14297
15124
|
]
|
|
@@ -14315,26 +15142,26 @@ function Chat({
|
|
|
14315
15142
|
const { setStream } = useStreamManager();
|
|
14316
15143
|
const stream = useStreamContext();
|
|
14317
15144
|
const { theme } = useTheme();
|
|
14318
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
14319
|
-
const [historyError, setHistoryError] =
|
|
14320
|
-
const [assistantName, setAssistantName] =
|
|
14321
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
14322
|
-
const [threadGoal, setThreadGoal] =
|
|
14323
|
-
const [goalError, setGoalError] =
|
|
14324
|
-
const [isGoalLoading, setIsGoalLoading] =
|
|
14325
|
-
const [isGoalPanelOpen, setIsGoalPanelOpen] =
|
|
14326
|
-
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] =
|
|
14327
|
-
const [goalElapsedStartedAt, setGoalElapsedStartedAt] =
|
|
15145
|
+
const [isHistoryLoading, setIsHistoryLoading] = React49.useState(false);
|
|
15146
|
+
const [historyError, setHistoryError] = React49.useState(null);
|
|
15147
|
+
const [assistantName, setAssistantName] = React49.useState(null);
|
|
15148
|
+
const [assistantAvatar, setAssistantAvatar] = React49.useState(null);
|
|
15149
|
+
const [threadGoal, setThreadGoal] = React49.useState(null);
|
|
15150
|
+
const [goalError, setGoalError] = React49.useState(null);
|
|
15151
|
+
const [isGoalLoading, setIsGoalLoading] = React49.useState(false);
|
|
15152
|
+
const [isGoalPanelOpen, setIsGoalPanelOpen] = React49.useState(false);
|
|
15153
|
+
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] = React49.useState(false);
|
|
15154
|
+
const [goalElapsedStartedAt, setGoalElapsedStartedAt] = React49.useState(null);
|
|
14328
15155
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
14329
15156
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
14330
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
14331
|
-
const [streamingNow, setStreamingNow] =
|
|
14332
|
-
const loadingStartTimeRef =
|
|
14333
|
-
const lastStreamOutputAtRef =
|
|
14334
|
-
|
|
15157
|
+
const [showLoadingDots, setShowLoadingDots] = React49.useState(false);
|
|
15158
|
+
const [streamingNow, setStreamingNow] = React49.useState(() => Date.now());
|
|
15159
|
+
const loadingStartTimeRef = React49.useRef(null);
|
|
15160
|
+
const lastStreamOutputAtRef = React49.useRef(null);
|
|
15161
|
+
React49.useEffect(() => {
|
|
14335
15162
|
setStream(stream);
|
|
14336
15163
|
}, [setStream, stream]);
|
|
14337
|
-
|
|
15164
|
+
React49.useEffect(() => {
|
|
14338
15165
|
if (stream.isLoading) {
|
|
14339
15166
|
if (!loadingStartTimeRef.current) {
|
|
14340
15167
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -14357,7 +15184,7 @@ function Chat({
|
|
|
14357
15184
|
}
|
|
14358
15185
|
}
|
|
14359
15186
|
}, [stream.isLoading]);
|
|
14360
|
-
|
|
15187
|
+
React49.useEffect(() => {
|
|
14361
15188
|
if (!stream.isLoading) {
|
|
14362
15189
|
lastStreamOutputAtRef.current = null;
|
|
14363
15190
|
setStreamingNow(Date.now());
|
|
@@ -14367,7 +15194,7 @@ function Chat({
|
|
|
14367
15194
|
lastStreamOutputAtRef.current = now;
|
|
14368
15195
|
setStreamingNow(now);
|
|
14369
15196
|
}, [stream.messages, stream.isLoading]);
|
|
14370
|
-
|
|
15197
|
+
React49.useEffect(() => {
|
|
14371
15198
|
if (!stream.isLoading) {
|
|
14372
15199
|
return;
|
|
14373
15200
|
}
|
|
@@ -14376,7 +15203,7 @@ function Chat({
|
|
|
14376
15203
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
14377
15204
|
return () => window.clearInterval(timer);
|
|
14378
15205
|
}, [stream.isLoading]);
|
|
14379
|
-
|
|
15206
|
+
React49.useEffect(() => {
|
|
14380
15207
|
if (threadGoal?.status === "active" && stream.isLoading) {
|
|
14381
15208
|
setGoalElapsedStartedAt(Date.now());
|
|
14382
15209
|
return;
|
|
@@ -14388,82 +15215,82 @@ function Chat({
|
|
|
14388
15215
|
threadGoal?.id,
|
|
14389
15216
|
threadGoal?.status
|
|
14390
15217
|
]);
|
|
14391
|
-
|
|
15218
|
+
React49.useEffect(() => {
|
|
14392
15219
|
setIsGoalObjectiveExpanded(false);
|
|
14393
15220
|
}, [threadGoal?.id]);
|
|
14394
|
-
const [composerParts, setComposerParts] =
|
|
14395
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
14396
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
14397
|
-
const [selectedTool, setSelectedTool] =
|
|
15221
|
+
const [composerParts, setComposerParts] = React49.useState([]);
|
|
15222
|
+
const [renderedComposerParts, setRenderedComposerParts] = React49.useState([]);
|
|
15223
|
+
const [composerDomVersion, setComposerDomVersion] = React49.useState(0);
|
|
15224
|
+
const [selectedTool, setSelectedTool] = React49.useState(
|
|
14398
15225
|
null
|
|
14399
15226
|
);
|
|
14400
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
14401
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
14402
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
14403
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
14404
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
14405
|
-
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] =
|
|
15227
|
+
const [planModeEnabled, setPlanModeEnabled] = React49.useState(false);
|
|
15228
|
+
const [petSettingsOpen, setPetSettingsOpen] = React49.useState(false);
|
|
15229
|
+
const [petLocalSettings, setPetLocalSettings] = React49.useState(() => readPetLocalSettings());
|
|
15230
|
+
const [runtimeCapabilities, setRuntimeCapabilities] = React49.useState(null);
|
|
15231
|
+
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React49.useState(false);
|
|
15232
|
+
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React49.useState(
|
|
14406
15233
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14407
15234
|
);
|
|
14408
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
15235
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React49.useState(
|
|
14409
15236
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14410
15237
|
);
|
|
14411
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
14412
|
-
const [attachmentState, setAttachmentState] =
|
|
15238
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React49.useState(null);
|
|
15239
|
+
const [attachmentState, setAttachmentState] = React49.useState({
|
|
14413
15240
|
uploadedFiles: [],
|
|
14414
15241
|
hasUploadingFiles: false,
|
|
14415
15242
|
hasParsingFiles: false
|
|
14416
15243
|
});
|
|
14417
|
-
const [references, setReferences] =
|
|
14418
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
14419
|
-
const [quoteSelection, setQuoteSelection] =
|
|
14420
|
-
const [isAtBottom, setIsAtBottom] =
|
|
14421
|
-
const [hasUpdatesBelow, setHasUpdatesBelow] =
|
|
15244
|
+
const [references, setReferences] = React49.useState([]);
|
|
15245
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React49.useState(false);
|
|
15246
|
+
const [quoteSelection, setQuoteSelection] = React49.useState(null);
|
|
15247
|
+
const [isAtBottom, setIsAtBottom] = React49.useState(true);
|
|
15248
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React49.useState(false);
|
|
14422
15249
|
const {
|
|
14423
15250
|
threads,
|
|
14424
15251
|
deleteThread,
|
|
14425
15252
|
refreshThreads,
|
|
14426
15253
|
isLoading: isThreadsLoading
|
|
14427
15254
|
} = useThreads();
|
|
14428
|
-
const viewportRef =
|
|
14429
|
-
const attachmentsRef =
|
|
14430
|
-
const composerInputRef =
|
|
14431
|
-
const slashPaletteRef =
|
|
14432
|
-
const slashPaletteOptionRefs =
|
|
15255
|
+
const viewportRef = React49.useRef(null);
|
|
15256
|
+
const attachmentsRef = React49.useRef(null);
|
|
15257
|
+
const composerInputRef = React49.useRef(null);
|
|
15258
|
+
const slashPaletteRef = React49.useRef(null);
|
|
15259
|
+
const slashPaletteOptionRefs = React49.useRef(
|
|
14433
15260
|
[]
|
|
14434
15261
|
);
|
|
14435
|
-
const composerPartsRef =
|
|
14436
|
-
const pendingComposerCaretOffsetRef =
|
|
14437
|
-
const shouldAutoScrollRef =
|
|
14438
|
-
const forceFollowRef =
|
|
14439
|
-
const previousMessageCountRef =
|
|
14440
|
-
const previousScrollTopRef =
|
|
14441
|
-
const isPrependingHistoryMessagesRef =
|
|
14442
|
-
const autoScrollFrameRef =
|
|
14443
|
-
const isPointerDownRef =
|
|
14444
|
-
const lastTouchYRef =
|
|
14445
|
-
const runtimeCapabilityPreferenceLoadRef =
|
|
15262
|
+
const composerPartsRef = React49.useRef([]);
|
|
15263
|
+
const pendingComposerCaretOffsetRef = React49.useRef(null);
|
|
15264
|
+
const shouldAutoScrollRef = React49.useRef(true);
|
|
15265
|
+
const forceFollowRef = React49.useRef(false);
|
|
15266
|
+
const previousMessageCountRef = React49.useRef(0);
|
|
15267
|
+
const previousScrollTopRef = React49.useRef(0);
|
|
15268
|
+
const isPrependingHistoryMessagesRef = React49.useRef(false);
|
|
15269
|
+
const autoScrollFrameRef = React49.useRef(null);
|
|
15270
|
+
const isPointerDownRef = React49.useRef(false);
|
|
15271
|
+
const lastTouchYRef = React49.useRef(null);
|
|
15272
|
+
const runtimeCapabilityPreferenceLoadRef = React49.useRef(0);
|
|
14446
15273
|
const resolvedTitle = title ?? t("chat.title");
|
|
14447
15274
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
14448
15275
|
const petRequired = options?.displayMode === "pet";
|
|
14449
|
-
const basePetSettings =
|
|
15276
|
+
const basePetSettings = React49.useMemo(
|
|
14450
15277
|
() => derivePetLocalSettings(options?.pet),
|
|
14451
15278
|
[options?.pet]
|
|
14452
15279
|
);
|
|
14453
|
-
const displayedPetSettings =
|
|
15280
|
+
const displayedPetSettings = React49.useMemo(
|
|
14454
15281
|
() => ({
|
|
14455
15282
|
...petLocalSettings ?? basePetSettings,
|
|
14456
15283
|
...petRequired ? { enabled: true } : {}
|
|
14457
15284
|
}),
|
|
14458
15285
|
[basePetSettings, petLocalSettings, petRequired]
|
|
14459
15286
|
);
|
|
14460
|
-
const effectivePet =
|
|
15287
|
+
const effectivePet = React49.useMemo(() => {
|
|
14461
15288
|
if (petRequired || petLocalSettings) {
|
|
14462
15289
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
14463
15290
|
}
|
|
14464
15291
|
return options?.pet ?? null;
|
|
14465
15292
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
14466
|
-
const savePetLocalSettings =
|
|
15293
|
+
const savePetLocalSettings = React49.useCallback(
|
|
14467
15294
|
(settings) => {
|
|
14468
15295
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
14469
15296
|
setPetLocalSettings(nextSettings);
|
|
@@ -14471,7 +15298,7 @@ function Chat({
|
|
|
14471
15298
|
},
|
|
14472
15299
|
[petRequired]
|
|
14473
15300
|
);
|
|
14474
|
-
const handlePetCommand =
|
|
15301
|
+
const handlePetCommand = React49.useCallback(
|
|
14475
15302
|
(mode) => {
|
|
14476
15303
|
if (mode === "settings") {
|
|
14477
15304
|
setPetSettingsOpen(true);
|
|
@@ -14493,7 +15320,7 @@ function Chat({
|
|
|
14493
15320
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
14494
15321
|
);
|
|
14495
15322
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
14496
|
-
const messages =
|
|
15323
|
+
const messages = React49.useMemo(
|
|
14497
15324
|
() => stream.messages ?? [],
|
|
14498
15325
|
[stream.messages]
|
|
14499
15326
|
);
|
|
@@ -14502,7 +15329,7 @@ function Chat({
|
|
|
14502
15329
|
historyMessagePagination?.isLoadingMore
|
|
14503
15330
|
);
|
|
14504
15331
|
const canLoadMoreMessages = Boolean(historyMessagePagination?.hasMore);
|
|
14505
|
-
const draft =
|
|
15332
|
+
const draft = React49.useMemo(
|
|
14506
15333
|
() => getComposerPlainText(composerParts),
|
|
14507
15334
|
[composerParts]
|
|
14508
15335
|
);
|
|
@@ -14516,7 +15343,7 @@ function Chat({
|
|
|
14516
15343
|
isEmpty: isComposerInputEmpty,
|
|
14517
15344
|
isStacked: isComposerStacked
|
|
14518
15345
|
});
|
|
14519
|
-
const pendingFollowUps =
|
|
15346
|
+
const pendingFollowUps = React49.useMemo(
|
|
14520
15347
|
() => sortVisiblePendingFollowUps(stream.pendingFollowUps ?? []),
|
|
14521
15348
|
[stream.pendingFollowUps]
|
|
14522
15349
|
);
|
|
@@ -14525,11 +15352,11 @@ function Chat({
|
|
|
14525
15352
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
14526
15353
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
14527
15354
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
14528
|
-
const runtimeCapabilityOptions =
|
|
15355
|
+
const runtimeCapabilityOptions = React49.useMemo(
|
|
14529
15356
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
14530
15357
|
[runtimeCapabilities]
|
|
14531
15358
|
);
|
|
14532
|
-
const goalAdapter =
|
|
15359
|
+
const goalAdapter = React49.useMemo(
|
|
14533
15360
|
() => {
|
|
14534
15361
|
if (isGoalAdapter(options?.goal)) {
|
|
14535
15362
|
return options.goal;
|
|
@@ -14539,7 +15366,7 @@ function Chat({
|
|
|
14539
15366
|
[options?.goal, stream.client]
|
|
14540
15367
|
);
|
|
14541
15368
|
const displayedGoalElapsedSeconds = threadGoal ? (threadGoal.elapsedSeconds ?? 0) + (goalElapsedStartedAt ? Math.max(0, Math.floor((streamingNow - goalElapsedStartedAt) / 1e3)) : 0) : 0;
|
|
14542
|
-
const effectiveSessionRuntimeCapabilities =
|
|
15369
|
+
const effectiveSessionRuntimeCapabilities = React49.useMemo(
|
|
14543
15370
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
14544
15371
|
runtimeCapabilities,
|
|
14545
15372
|
sessionRuntimeCapabilities
|
|
@@ -14552,7 +15379,7 @@ function Chat({
|
|
|
14552
15379
|
"goal"
|
|
14553
15380
|
);
|
|
14554
15381
|
const showGoalStatus = goalCommandAvailable && !hasCompletedGoal && (Boolean(goalError) || threadGoal?.status === "active" && stream.isLoading);
|
|
14555
|
-
const runRuntimeCapabilityOptions =
|
|
15382
|
+
const runRuntimeCapabilityOptions = React49.useMemo(
|
|
14556
15383
|
() => runtimeCapabilityOptions.filter(
|
|
14557
15384
|
(option) => isRuntimeCapabilitySelected(
|
|
14558
15385
|
runRuntimeCapabilities,
|
|
@@ -14562,11 +15389,11 @@ function Chat({
|
|
|
14562
15389
|
),
|
|
14563
15390
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
14564
15391
|
);
|
|
14565
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
15392
|
+
const composerRuntimeCapabilitySelectionKeys = React49.useMemo(
|
|
14566
15393
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
14567
15394
|
[composerParts]
|
|
14568
15395
|
);
|
|
14569
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
15396
|
+
const detachedRunRuntimeCapabilityOptions = React49.useMemo(
|
|
14570
15397
|
() => runRuntimeCapabilityOptions.filter(
|
|
14571
15398
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
14572
15399
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -14574,7 +15401,7 @@ function Chat({
|
|
|
14574
15401
|
),
|
|
14575
15402
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
14576
15403
|
);
|
|
14577
|
-
const persistSessionRuntimeCapabilities =
|
|
15404
|
+
const persistSessionRuntimeCapabilities = React49.useCallback(
|
|
14578
15405
|
async (threadId, selection) => {
|
|
14579
15406
|
if (!runtimeCapabilities || !selection) {
|
|
14580
15407
|
return;
|
|
@@ -14599,10 +15426,10 @@ function Chat({
|
|
|
14599
15426
|
},
|
|
14600
15427
|
[runtimeCapabilities, stream.client]
|
|
14601
15428
|
);
|
|
14602
|
-
const clearQuoteSelection =
|
|
15429
|
+
const clearQuoteSelection = React49.useCallback(() => {
|
|
14603
15430
|
setQuoteSelection(null);
|
|
14604
15431
|
}, []);
|
|
14605
|
-
const commitComposerParts =
|
|
15432
|
+
const commitComposerParts = React49.useCallback(
|
|
14606
15433
|
(nextParts, options2) => {
|
|
14607
15434
|
const normalized = normalizeComposerParts(nextParts);
|
|
14608
15435
|
const previous = composerPartsRef.current;
|
|
@@ -14638,7 +15465,7 @@ function Chat({
|
|
|
14638
15465
|
},
|
|
14639
15466
|
[]
|
|
14640
15467
|
);
|
|
14641
|
-
const setComposerText =
|
|
15468
|
+
const setComposerText = React49.useCallback(
|
|
14642
15469
|
(text, caretOffset = text.length) => {
|
|
14643
15470
|
commitComposerParts(createComposerTextParts(text), {
|
|
14644
15471
|
caretOffset,
|
|
@@ -14648,7 +15475,7 @@ function Chat({
|
|
|
14648
15475
|
},
|
|
14649
15476
|
[commitComposerParts]
|
|
14650
15477
|
);
|
|
14651
|
-
const focusComposerAt =
|
|
15478
|
+
const focusComposerAt = React49.useCallback((position) => {
|
|
14652
15479
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
14653
15480
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
14654
15481
|
requestAnimationFrame(() => {
|
|
@@ -14660,7 +15487,7 @@ function Chat({
|
|
|
14660
15487
|
});
|
|
14661
15488
|
}, []);
|
|
14662
15489
|
const parentMessenger = useParentMessenger({
|
|
14663
|
-
onSetComposerValue:
|
|
15490
|
+
onSetComposerValue: React49.useCallback(
|
|
14664
15491
|
(payload) => {
|
|
14665
15492
|
if (!payload) {
|
|
14666
15493
|
return;
|
|
@@ -14683,10 +15510,10 @@ function Chat({
|
|
|
14683
15510
|
},
|
|
14684
15511
|
[composer?.tools, setComposerText]
|
|
14685
15512
|
),
|
|
14686
|
-
onFocusComposer:
|
|
15513
|
+
onFocusComposer: React49.useCallback(() => {
|
|
14687
15514
|
composerInputRef.current?.focus();
|
|
14688
15515
|
}, []),
|
|
14689
|
-
onSetPetEnabled:
|
|
15516
|
+
onSetPetEnabled: React49.useCallback(
|
|
14690
15517
|
(enabled) => {
|
|
14691
15518
|
if (petRequired) {
|
|
14692
15519
|
return;
|
|
@@ -14700,10 +15527,10 @@ function Chat({
|
|
|
14700
15527
|
)
|
|
14701
15528
|
});
|
|
14702
15529
|
const canMinimizeToPet = parentMessenger?.isParentAvailable === true && isPetEnabled(effectivePet);
|
|
14703
|
-
const handleMinimizeToPet =
|
|
15530
|
+
const handleMinimizeToPet = React49.useCallback(() => {
|
|
14704
15531
|
parentMessenger?.sendEvent("chat_minimize_change", { minimized: true });
|
|
14705
15532
|
}, [parentMessenger]);
|
|
14706
|
-
const syncQuoteSelection =
|
|
15533
|
+
const syncQuoteSelection = React49.useCallback(() => {
|
|
14707
15534
|
if (typeof window === "undefined") {
|
|
14708
15535
|
clearQuoteSelection();
|
|
14709
15536
|
return;
|
|
@@ -14748,23 +15575,23 @@ function Chat({
|
|
|
14748
15575
|
left
|
|
14749
15576
|
});
|
|
14750
15577
|
}, [clearQuoteSelection]);
|
|
14751
|
-
const cancelPendingAutoScroll =
|
|
15578
|
+
const cancelPendingAutoScroll = React49.useCallback(() => {
|
|
14752
15579
|
if (autoScrollFrameRef.current !== null) {
|
|
14753
15580
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
14754
15581
|
autoScrollFrameRef.current = null;
|
|
14755
15582
|
}
|
|
14756
15583
|
}, []);
|
|
14757
|
-
const disableAutoFollow =
|
|
15584
|
+
const disableAutoFollow = React49.useCallback(() => {
|
|
14758
15585
|
forceFollowRef.current = false;
|
|
14759
15586
|
shouldAutoScrollRef.current = false;
|
|
14760
15587
|
cancelPendingAutoScroll();
|
|
14761
15588
|
}, [cancelPendingAutoScroll]);
|
|
14762
|
-
const enableAutoFollow =
|
|
15589
|
+
const enableAutoFollow = React49.useCallback(() => {
|
|
14763
15590
|
forceFollowRef.current = true;
|
|
14764
15591
|
shouldAutoScrollRef.current = true;
|
|
14765
15592
|
setHasUpdatesBelow(false);
|
|
14766
15593
|
}, []);
|
|
14767
|
-
const scrollToBottom =
|
|
15594
|
+
const scrollToBottom = React49.useCallback(
|
|
14768
15595
|
(smooth = false, force = false) => {
|
|
14769
15596
|
if (force) {
|
|
14770
15597
|
enableAutoFollow();
|
|
@@ -14791,7 +15618,7 @@ function Chat({
|
|
|
14791
15618
|
},
|
|
14792
15619
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
14793
15620
|
);
|
|
14794
|
-
|
|
15621
|
+
React49.useEffect(() => {
|
|
14795
15622
|
const viewport = viewportRef.current;
|
|
14796
15623
|
if (!viewport) return;
|
|
14797
15624
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -14872,14 +15699,14 @@ function Chat({
|
|
|
14872
15699
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
14873
15700
|
};
|
|
14874
15701
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
14875
|
-
|
|
15702
|
+
React49.useEffect(() => {
|
|
14876
15703
|
shouldAutoScrollRef.current = true;
|
|
14877
15704
|
forceFollowRef.current = false;
|
|
14878
15705
|
previousScrollTopRef.current = 0;
|
|
14879
15706
|
setIsAtBottom(true);
|
|
14880
15707
|
setHasUpdatesBelow(false);
|
|
14881
15708
|
}, [stream.threadId]);
|
|
14882
|
-
|
|
15709
|
+
React49.useEffect(() => {
|
|
14883
15710
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
14884
15711
|
previousMessageCountRef.current = messages.length;
|
|
14885
15712
|
if (isPrependingHistoryMessagesRef.current) {
|
|
@@ -14902,7 +15729,7 @@ function Chat({
|
|
|
14902
15729
|
clientSecret: effectiveClientSecret
|
|
14903
15730
|
});
|
|
14904
15731
|
const missingConfig = Boolean(missingConfigKind);
|
|
14905
|
-
const missingConfigShortMessage =
|
|
15732
|
+
const missingConfigShortMessage = React49.useMemo(() => {
|
|
14906
15733
|
switch (missingConfigKind) {
|
|
14907
15734
|
case "apiUrl":
|
|
14908
15735
|
return t("chat.missingApiUrlShort");
|
|
@@ -14914,7 +15741,7 @@ function Chat({
|
|
|
14914
15741
|
return t("chat.missingConfigShort");
|
|
14915
15742
|
}
|
|
14916
15743
|
}, [missingConfigKind, t]);
|
|
14917
|
-
const missingConfigDetailMessage =
|
|
15744
|
+
const missingConfigDetailMessage = React49.useMemo(() => {
|
|
14918
15745
|
switch (missingConfigKind) {
|
|
14919
15746
|
case "apiUrl":
|
|
14920
15747
|
return t("chat.missingApiUrlDetail");
|
|
@@ -14931,7 +15758,7 @@ function Chat({
|
|
|
14931
15758
|
const isSubmissionBlocked = hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
14932
15759
|
const isSendDisabled = !trimmedDraft && !hasReferences || isSubmissionBlocked;
|
|
14933
15760
|
const isPromptEditDisabled = hasPendingInteractiveRequest || missingConfig || isHistoryLoading;
|
|
14934
|
-
const resizeComposerInput =
|
|
15761
|
+
const resizeComposerInput = React49.useCallback(() => {
|
|
14935
15762
|
const input = composerInputRef.current;
|
|
14936
15763
|
if (!input) {
|
|
14937
15764
|
return;
|
|
@@ -14939,7 +15766,7 @@ function Chat({
|
|
|
14939
15766
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
14940
15767
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
14941
15768
|
}, []);
|
|
14942
|
-
|
|
15769
|
+
React49.useLayoutEffect(() => {
|
|
14943
15770
|
composerPartsRef.current = composerParts;
|
|
14944
15771
|
resizeComposerInput();
|
|
14945
15772
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -14951,13 +15778,13 @@ function Chat({
|
|
|
14951
15778
|
}
|
|
14952
15779
|
}
|
|
14953
15780
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
14954
|
-
|
|
15781
|
+
React49.useEffect(() => {
|
|
14955
15782
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
14956
15783
|
return () => {
|
|
14957
15784
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
14958
15785
|
};
|
|
14959
15786
|
}, [syncQuoteSelection]);
|
|
14960
|
-
|
|
15787
|
+
React49.useEffect(() => {
|
|
14961
15788
|
const viewport = viewportRef.current;
|
|
14962
15789
|
if (!viewport) {
|
|
14963
15790
|
return;
|
|
@@ -14974,14 +15801,14 @@ function Chat({
|
|
|
14974
15801
|
window.removeEventListener("resize", handleViewportScroll);
|
|
14975
15802
|
};
|
|
14976
15803
|
}, [clearQuoteSelection]);
|
|
14977
|
-
|
|
15804
|
+
React49.useEffect(() => {
|
|
14978
15805
|
clearQuoteSelection();
|
|
14979
15806
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
14980
|
-
|
|
15807
|
+
React49.useEffect(() => {
|
|
14981
15808
|
if (missingConfig) return;
|
|
14982
15809
|
void refreshThreads();
|
|
14983
15810
|
}, [missingConfig, refreshThreads]);
|
|
14984
|
-
|
|
15811
|
+
React49.useEffect(() => {
|
|
14985
15812
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
14986
15813
|
setAssistantName(null);
|
|
14987
15814
|
setAssistantAvatar(null);
|
|
@@ -15004,7 +15831,7 @@ function Chat({
|
|
|
15004
15831
|
cancelled = true;
|
|
15005
15832
|
};
|
|
15006
15833
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15007
|
-
|
|
15834
|
+
React49.useEffect(() => {
|
|
15008
15835
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
15009
15836
|
setRuntimeCapabilities(null);
|
|
15010
15837
|
setRuntimeCapabilitiesReady(false);
|
|
@@ -15051,7 +15878,7 @@ function Chat({
|
|
|
15051
15878
|
});
|
|
15052
15879
|
return () => controller.abort();
|
|
15053
15880
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15054
|
-
|
|
15881
|
+
React49.useEffect(() => {
|
|
15055
15882
|
setRunRuntimeCapabilities(
|
|
15056
15883
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
15057
15884
|
);
|
|
@@ -15100,10 +15927,10 @@ function Chat({
|
|
|
15100
15927
|
stream.client,
|
|
15101
15928
|
stream.threadId
|
|
15102
15929
|
]);
|
|
15103
|
-
|
|
15930
|
+
React49.useEffect(() => {
|
|
15104
15931
|
setThreadGoal(stream.threadGoal);
|
|
15105
15932
|
}, [stream.threadGoal]);
|
|
15106
|
-
|
|
15933
|
+
React49.useEffect(() => {
|
|
15107
15934
|
const threadId = stream.threadId?.trim();
|
|
15108
15935
|
if (!threadId || !goalCommandAvailable) {
|
|
15109
15936
|
setThreadGoal(null);
|
|
@@ -15144,7 +15971,7 @@ function Chat({
|
|
|
15144
15971
|
return () => controller.abort();
|
|
15145
15972
|
}, [goalAdapter, goalCommandAvailable, stream.threadId]);
|
|
15146
15973
|
const uploadedFiles = attachmentState.uploadedFiles;
|
|
15147
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
15974
|
+
const handleSessionRuntimeCapabilityToggle = React49.useCallback(
|
|
15148
15975
|
(type, id, selected) => {
|
|
15149
15976
|
setSessionRuntimeCapabilities((previous) => {
|
|
15150
15977
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -15162,7 +15989,7 @@ function Chat({
|
|
|
15162
15989
|
},
|
|
15163
15990
|
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
15164
15991
|
);
|
|
15165
|
-
const updateRuntimeCapabilityPalette =
|
|
15992
|
+
const updateRuntimeCapabilityPalette = React49.useCallback(
|
|
15166
15993
|
(parts, selectionStart) => {
|
|
15167
15994
|
const input = composerInputRef.current;
|
|
15168
15995
|
const editingText = getComposerEditingText(parts);
|
|
@@ -15174,7 +16001,7 @@ function Chat({
|
|
|
15174
16001
|
},
|
|
15175
16002
|
[]
|
|
15176
16003
|
);
|
|
15177
|
-
const syncComposerInputFromElement =
|
|
16004
|
+
const syncComposerInputFromElement = React49.useCallback(
|
|
15178
16005
|
(input) => {
|
|
15179
16006
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
15180
16007
|
composerPartsRef.current
|
|
@@ -15192,25 +16019,25 @@ function Chat({
|
|
|
15192
16019
|
},
|
|
15193
16020
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
15194
16021
|
);
|
|
15195
|
-
const handleComposerInput =
|
|
16022
|
+
const handleComposerInput = React49.useCallback(
|
|
15196
16023
|
(event) => {
|
|
15197
16024
|
syncComposerInputFromElement(event.currentTarget);
|
|
15198
16025
|
},
|
|
15199
16026
|
[syncComposerInputFromElement]
|
|
15200
16027
|
);
|
|
15201
|
-
const handleComposerCompositionEnd =
|
|
16028
|
+
const handleComposerCompositionEnd = React49.useCallback(
|
|
15202
16029
|
(event) => {
|
|
15203
16030
|
syncComposerInputFromElement(event.currentTarget);
|
|
15204
16031
|
},
|
|
15205
16032
|
[syncComposerInputFromElement]
|
|
15206
16033
|
);
|
|
15207
|
-
const handleComposerSelect =
|
|
16034
|
+
const handleComposerSelect = React49.useCallback(() => {
|
|
15208
16035
|
updateRuntimeCapabilityPalette(
|
|
15209
16036
|
composerPartsRef.current,
|
|
15210
16037
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
15211
16038
|
);
|
|
15212
16039
|
}, [updateRuntimeCapabilityPalette]);
|
|
15213
|
-
const removeRunRuntimeCapability =
|
|
16040
|
+
const removeRunRuntimeCapability = React49.useCallback(
|
|
15214
16041
|
(option) => {
|
|
15215
16042
|
setRunRuntimeCapabilities(
|
|
15216
16043
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -15230,7 +16057,7 @@ function Chat({
|
|
|
15230
16057
|
},
|
|
15231
16058
|
[commitComposerParts]
|
|
15232
16059
|
);
|
|
15233
|
-
const submitDraft =
|
|
16060
|
+
const submitDraft = React49.useCallback(
|
|
15234
16061
|
(submitOptions = {}) => {
|
|
15235
16062
|
if (isSubmissionBlocked) return;
|
|
15236
16063
|
const contentToSubmit = (submitOptions.inputText ?? trimmedDraft).trim();
|
|
@@ -15353,7 +16180,7 @@ function Chat({
|
|
|
15353
16180
|
t
|
|
15354
16181
|
]
|
|
15355
16182
|
);
|
|
15356
|
-
const handleGoalCommand =
|
|
16183
|
+
const handleGoalCommand = React49.useCallback(
|
|
15357
16184
|
async ({
|
|
15358
16185
|
args,
|
|
15359
16186
|
commandSource,
|
|
@@ -15465,13 +16292,13 @@ function Chat({
|
|
|
15465
16292
|
t
|
|
15466
16293
|
]
|
|
15467
16294
|
);
|
|
15468
|
-
const handleGoalPanelOpenChange =
|
|
16295
|
+
const handleGoalPanelOpenChange = React49.useCallback(
|
|
15469
16296
|
(open) => {
|
|
15470
16297
|
setIsGoalPanelOpen(open);
|
|
15471
16298
|
},
|
|
15472
16299
|
[]
|
|
15473
16300
|
);
|
|
15474
|
-
const addRunRuntimeCapabilities =
|
|
16301
|
+
const addRunRuntimeCapabilities = React49.useCallback(
|
|
15475
16302
|
(selection) => {
|
|
15476
16303
|
setRunRuntimeCapabilities(
|
|
15477
16304
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -15483,7 +16310,7 @@ function Chat({
|
|
|
15483
16310
|
},
|
|
15484
16311
|
[runtimeCapabilities]
|
|
15485
16312
|
);
|
|
15486
|
-
const insertComposerCapabilityToken =
|
|
16313
|
+
const insertComposerCapabilityToken = React49.useCallback(
|
|
15487
16314
|
(capability, range) => {
|
|
15488
16315
|
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
15489
16316
|
const currentParts = composerPartsRef.current;
|
|
@@ -15556,7 +16383,7 @@ function Chat({
|
|
|
15556
16383
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
15557
16384
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
15558
16385
|
};
|
|
15559
|
-
|
|
16386
|
+
React49.useEffect(() => {
|
|
15560
16387
|
if (!runtimeCapabilityPalette) {
|
|
15561
16388
|
return;
|
|
15562
16389
|
}
|
|
@@ -15575,7 +16402,7 @@ function Chat({
|
|
|
15575
16402
|
);
|
|
15576
16403
|
}
|
|
15577
16404
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
15578
|
-
|
|
16405
|
+
React49.useLayoutEffect(() => {
|
|
15579
16406
|
if (!runtimeCapabilityPalette) {
|
|
15580
16407
|
return;
|
|
15581
16408
|
}
|
|
@@ -15592,7 +16419,7 @@ function Chat({
|
|
|
15592
16419
|
container.scrollTop += optionRect.bottom - containerRect.bottom;
|
|
15593
16420
|
}
|
|
15594
16421
|
}, [runtimeCapabilityPalette, slashPaletteOptions.length]);
|
|
15595
|
-
const submitGoalModeDraft =
|
|
16422
|
+
const submitGoalModeDraft = React49.useCallback(() => {
|
|
15596
16423
|
const objective = getComposerPlainText(composerPartsRef.current).trim();
|
|
15597
16424
|
if (!isGoalModeOpen || !goalCommandAvailable || !objective) {
|
|
15598
16425
|
return false;
|
|
@@ -15630,7 +16457,7 @@ function Chat({
|
|
|
15630
16457
|
}
|
|
15631
16458
|
submitDraft();
|
|
15632
16459
|
};
|
|
15633
|
-
const handleEditPendingFollowUp =
|
|
16460
|
+
const handleEditPendingFollowUp = React49.useCallback(
|
|
15634
16461
|
(id) => {
|
|
15635
16462
|
const item = pendingFollowUps.find(
|
|
15636
16463
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -15657,7 +16484,7 @@ function Chat({
|
|
|
15657
16484
|
},
|
|
15658
16485
|
[pendingFollowUps, setComposerText, stream]
|
|
15659
16486
|
);
|
|
15660
|
-
const handleQuoteSelection =
|
|
16487
|
+
const handleQuoteSelection = React49.useCallback(() => {
|
|
15661
16488
|
if (!quoteSelection) {
|
|
15662
16489
|
return;
|
|
15663
16490
|
}
|
|
@@ -15673,7 +16500,7 @@ function Chat({
|
|
|
15673
16500
|
const handleAttachmentClick = () => {
|
|
15674
16501
|
attachmentsRef.current?.openFilePicker();
|
|
15675
16502
|
};
|
|
15676
|
-
const uploadContextFile =
|
|
16503
|
+
const uploadContextFile = React49.useCallback(
|
|
15677
16504
|
(file) => {
|
|
15678
16505
|
const formData = new FormData();
|
|
15679
16506
|
formData.append("file", file, file.name || "upload");
|
|
@@ -15692,13 +16519,13 @@ function Chat({
|
|
|
15692
16519
|
},
|
|
15693
16520
|
[stream.assistantId, stream.client, stream.threadId]
|
|
15694
16521
|
);
|
|
15695
|
-
const getContextFileStatus =
|
|
16522
|
+
const getContextFileStatus = React49.useCallback(
|
|
15696
16523
|
(fileId) => stream.client.contexts.fetch(`/files/${fileId}/status`, {
|
|
15697
16524
|
method: "GET"
|
|
15698
16525
|
}),
|
|
15699
16526
|
[stream.client]
|
|
15700
16527
|
);
|
|
15701
|
-
const deleteContextFile =
|
|
16528
|
+
const deleteContextFile = React49.useCallback(
|
|
15702
16529
|
(storageFileId) => stream.client.contexts.deleteFile(storageFileId),
|
|
15703
16530
|
[stream.client]
|
|
15704
16531
|
);
|
|
@@ -15806,7 +16633,7 @@ function Chat({
|
|
|
15806
16633
|
}
|
|
15807
16634
|
submitDraft();
|
|
15808
16635
|
};
|
|
15809
|
-
const handleComposerPaste =
|
|
16636
|
+
const handleComposerPaste = React49.useCallback(
|
|
15810
16637
|
(event) => {
|
|
15811
16638
|
const clipboardData = event.clipboardData;
|
|
15812
16639
|
if (!clipboardData) {
|
|
@@ -15908,13 +16735,13 @@ function Chat({
|
|
|
15908
16735
|
const handleToolSelect = (tool) => {
|
|
15909
16736
|
setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
|
|
15910
16737
|
};
|
|
15911
|
-
const handlePromptClick =
|
|
16738
|
+
const handlePromptClick = React49.useCallback(
|
|
15912
16739
|
(prompt) => {
|
|
15913
16740
|
submitDraft({ inputText: prompt, displayText: prompt });
|
|
15914
16741
|
},
|
|
15915
16742
|
[submitDraft]
|
|
15916
16743
|
);
|
|
15917
|
-
const handlePromptEdit =
|
|
16744
|
+
const handlePromptEdit = React49.useCallback(
|
|
15918
16745
|
(prompt) => {
|
|
15919
16746
|
if (isPromptEditDisabled) return;
|
|
15920
16747
|
setComposerText(prompt, prompt.length);
|
|
@@ -15923,7 +16750,7 @@ function Chat({
|
|
|
15923
16750
|
},
|
|
15924
16751
|
[focusComposerAt, isPromptEditDisabled, setComposerText]
|
|
15925
16752
|
);
|
|
15926
|
-
const loadConversationMessages =
|
|
16753
|
+
const loadConversationMessages = React49.useCallback(
|
|
15927
16754
|
async (recordId) => {
|
|
15928
16755
|
if (missingConfig) {
|
|
15929
16756
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -15944,7 +16771,7 @@ function Chat({
|
|
|
15944
16771
|
},
|
|
15945
16772
|
[missingConfig, missingConfigShortMessage, stream, t]
|
|
15946
16773
|
);
|
|
15947
|
-
const handleLoadMoreMessages =
|
|
16774
|
+
const handleLoadMoreMessages = React49.useCallback(async () => {
|
|
15948
16775
|
if (!canLoadMoreMessages || isLoadingMoreMessages) {
|
|
15949
16776
|
return;
|
|
15950
16777
|
}
|
|
@@ -16053,15 +16880,15 @@ function Chat({
|
|
|
16053
16880
|
};
|
|
16054
16881
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
16055
16882
|
const canUploadDroppedFiles = composer?.attachments?.enabled === true && !missingConfig && !isHistoryLoading && !hasPendingInteractiveRequest;
|
|
16056
|
-
const handleDroppedFiles =
|
|
16883
|
+
const handleDroppedFiles = React49.useCallback((files) => {
|
|
16057
16884
|
return attachmentsRef.current?.queueFiles(files) ?? false;
|
|
16058
16885
|
}, []);
|
|
16059
|
-
const currentThread =
|
|
16886
|
+
const currentThread = React49.useMemo(
|
|
16060
16887
|
() => threads.find((item) => item.id === stream.threadId),
|
|
16061
16888
|
[threads, stream.threadId]
|
|
16062
16889
|
);
|
|
16063
16890
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
16064
|
-
const threadErrorMessage =
|
|
16891
|
+
const threadErrorMessage = React49.useMemo(() => {
|
|
16065
16892
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
16066
16893
|
if (currentThread?.status !== "error") return void 0;
|
|
16067
16894
|
const message = currentThread.error?.trim();
|
|
@@ -16092,7 +16919,7 @@ function Chat({
|
|
|
16092
16919
|
fallbackTitle: t("history.threadFallback")
|
|
16093
16920
|
});
|
|
16094
16921
|
const assistantTitle = assistantName || resolvedTitle;
|
|
16095
|
-
return /* @__PURE__ */ (0,
|
|
16922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16096
16923
|
UploadDroppedFiles,
|
|
16097
16924
|
{
|
|
16098
16925
|
ref: viewportRef,
|
|
@@ -16107,10 +16934,10 @@ function Chat({
|
|
|
16107
16934
|
className
|
|
16108
16935
|
),
|
|
16109
16936
|
children: [
|
|
16110
|
-
/* @__PURE__ */ (0,
|
|
16111
|
-
/* @__PURE__ */ (0,
|
|
16112
|
-
/* @__PURE__ */ (0,
|
|
16113
|
-
/* @__PURE__ */ (0,
|
|
16937
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
|
|
16938
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
16939
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "relative shrink-0", children: [
|
|
16940
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16114
16941
|
ChatkitAvatar,
|
|
16115
16942
|
{
|
|
16116
16943
|
avatar: assistantAvatar,
|
|
@@ -16118,10 +16945,10 @@ function Chat({
|
|
|
16118
16945
|
label: assistantTitle
|
|
16119
16946
|
}
|
|
16120
16947
|
),
|
|
16121
|
-
/* @__PURE__ */ (0,
|
|
16948
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
16122
16949
|
] }),
|
|
16123
|
-
/* @__PURE__ */ (0,
|
|
16124
|
-
/* @__PURE__ */ (0,
|
|
16950
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "truncate", children: [
|
|
16951
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16125
16952
|
"h2",
|
|
16126
16953
|
{
|
|
16127
16954
|
className: "text-lg font-semibold truncate",
|
|
@@ -16129,12 +16956,12 @@ function Chat({
|
|
|
16129
16956
|
children: assistantTitle
|
|
16130
16957
|
}
|
|
16131
16958
|
),
|
|
16132
|
-
/* @__PURE__ */ (0,
|
|
16959
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
16133
16960
|
] })
|
|
16134
16961
|
] }),
|
|
16135
|
-
/* @__PURE__ */ (0,
|
|
16136
|
-
canMinimizeToPet && /* @__PURE__ */ (0,
|
|
16137
|
-
/* @__PURE__ */ (0,
|
|
16962
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
16963
|
+
canMinimizeToPet && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
16964
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16138
16965
|
"button",
|
|
16139
16966
|
{
|
|
16140
16967
|
type: "button",
|
|
@@ -16145,13 +16972,13 @@ function Chat({
|
|
|
16145
16972
|
"transition-colors duration-150"
|
|
16146
16973
|
),
|
|
16147
16974
|
"aria-label": t("chat.minimizeToPet"),
|
|
16148
|
-
children: /* @__PURE__ */ (0,
|
|
16975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Minus, { size: 16 })
|
|
16149
16976
|
}
|
|
16150
16977
|
) }) }),
|
|
16151
|
-
/* @__PURE__ */ (0,
|
|
16978
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
|
|
16152
16979
|
] }),
|
|
16153
|
-
/* @__PURE__ */ (0,
|
|
16154
|
-
/* @__PURE__ */ (0,
|
|
16980
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
16981
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16155
16982
|
"button",
|
|
16156
16983
|
{
|
|
16157
16984
|
type: "button",
|
|
@@ -16162,14 +16989,14 @@ function Chat({
|
|
|
16162
16989
|
"transition-colors duration-150"
|
|
16163
16990
|
),
|
|
16164
16991
|
"aria-label": t("settings.open"),
|
|
16165
|
-
children: /* @__PURE__ */ (0,
|
|
16992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Settings, { size: 16 })
|
|
16166
16993
|
}
|
|
16167
16994
|
) }) }),
|
|
16168
|
-
/* @__PURE__ */ (0,
|
|
16995
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
16169
16996
|
] }),
|
|
16170
|
-
history?.enabled !== false && /* @__PURE__ */ (0,
|
|
16171
|
-
/* @__PURE__ */ (0,
|
|
16172
|
-
/* @__PURE__ */ (0,
|
|
16997
|
+
history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
16998
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
16999
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16173
17000
|
"button",
|
|
16174
17001
|
{
|
|
16175
17002
|
type: "button",
|
|
@@ -16182,12 +17009,12 @@ function Chat({
|
|
|
16182
17009
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
16183
17010
|
),
|
|
16184
17011
|
"aria-label": t("history.newThread"),
|
|
16185
|
-
children: /* @__PURE__ */ (0,
|
|
17012
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Pencil, { size: 16 })
|
|
16186
17013
|
}
|
|
16187
17014
|
) }) }),
|
|
16188
|
-
/* @__PURE__ */ (0,
|
|
17015
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
16189
17016
|
] }),
|
|
16190
|
-
/* @__PURE__ */ (0,
|
|
17017
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16191
17018
|
HistorySidebar,
|
|
16192
17019
|
{
|
|
16193
17020
|
threads,
|
|
@@ -16202,12 +17029,12 @@ function Chat({
|
|
|
16202
17029
|
] })
|
|
16203
17030
|
] })
|
|
16204
17031
|
] }),
|
|
16205
|
-
/* @__PURE__ */ (0,
|
|
16206
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
16207
|
-
historyError && /* @__PURE__ */ (0,
|
|
16208
|
-
showMissingConfig && /* @__PURE__ */ (0,
|
|
16209
|
-
isHistoryLoading && /* @__PURE__ */ (0,
|
|
16210
|
-
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0,
|
|
17032
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex-1 p-4", children: [
|
|
17033
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
17034
|
+
historyError && /* @__PURE__ */ (0, import_jsx_runtime54.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 }),
|
|
17035
|
+
showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime54.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 }),
|
|
17036
|
+
isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
17037
|
+
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16211
17038
|
StartScreen,
|
|
16212
17039
|
{
|
|
16213
17040
|
startScreen,
|
|
@@ -16216,10 +17043,10 @@ function Chat({
|
|
|
16216
17043
|
promptSendDisabled: isSubmissionBlocked,
|
|
16217
17044
|
promptEditDisabled: isPromptEditDisabled
|
|
16218
17045
|
}
|
|
16219
|
-
) : /* @__PURE__ */ (0,
|
|
16220
|
-
canLoadMoreMessages && /* @__PURE__ */ (0,
|
|
16221
|
-
/* @__PURE__ */ (0,
|
|
16222
|
-
/* @__PURE__ */ (0,
|
|
17046
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "space-y-4", children: [
|
|
17047
|
+
canLoadMoreMessages && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-3 py-1", children: [
|
|
17048
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" }),
|
|
17049
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16223
17050
|
Button,
|
|
16224
17051
|
{
|
|
16225
17052
|
type: "button",
|
|
@@ -16231,7 +17058,7 @@ function Chat({
|
|
|
16231
17058
|
children: isLoadingMoreMessages ? t("chat.loadingMoreMessages") : t("chat.loadMoreMessages")
|
|
16232
17059
|
}
|
|
16233
17060
|
),
|
|
16234
|
-
/* @__PURE__ */ (0,
|
|
17061
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" })
|
|
16235
17062
|
] }),
|
|
16236
17063
|
messages.map((message, index) => {
|
|
16237
17064
|
const messageType = String(message.type);
|
|
@@ -16268,7 +17095,7 @@ function Chat({
|
|
|
16268
17095
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
16269
17096
|
return null;
|
|
16270
17097
|
}
|
|
16271
|
-
return /* @__PURE__ */ (0,
|
|
17098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16272
17099
|
"div",
|
|
16273
17100
|
{
|
|
16274
17101
|
className: cn(
|
|
@@ -16276,7 +17103,7 @@ function Chat({
|
|
|
16276
17103
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
16277
17104
|
// AI messages: slightly closer to left
|
|
16278
17105
|
),
|
|
16279
|
-
children: /* @__PURE__ */ (0,
|
|
17106
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16280
17107
|
"div",
|
|
16281
17108
|
{
|
|
16282
17109
|
className: cn(
|
|
@@ -16284,7 +17111,7 @@ function Chat({
|
|
|
16284
17111
|
isAssistantMessage && "min-w-0 flex-1"
|
|
16285
17112
|
),
|
|
16286
17113
|
children: [
|
|
16287
|
-
/* @__PURE__ */ (0,
|
|
17114
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16288
17115
|
"div",
|
|
16289
17116
|
{
|
|
16290
17117
|
...canQuoteMessage ? {
|
|
@@ -16296,7 +17123,7 @@ function Chat({
|
|
|
16296
17123
|
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"
|
|
16297
17124
|
// AI messages: use chat-specific foreground color
|
|
16298
17125
|
),
|
|
16299
|
-
children: isAssistantMessage ? /* @__PURE__ */ (0,
|
|
17126
|
+
children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16300
17127
|
AssistantMessage,
|
|
16301
17128
|
{
|
|
16302
17129
|
message: {
|
|
@@ -16315,25 +17142,25 @@ function Chat({
|
|
|
16315
17142
|
organizationId: stream.organizationId,
|
|
16316
17143
|
apiUrl: stream.apiUrl
|
|
16317
17144
|
}
|
|
16318
|
-
) : /* @__PURE__ */ (0,
|
|
16319
|
-
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
17145
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
17146
|
+
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16320
17147
|
"span",
|
|
16321
17148
|
{
|
|
16322
17149
|
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",
|
|
16323
17150
|
children: [
|
|
16324
|
-
/* @__PURE__ */ (0,
|
|
17151
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16325
17152
|
RuntimeCapabilityIcon,
|
|
16326
17153
|
{
|
|
16327
17154
|
option,
|
|
16328
17155
|
variant: "chip"
|
|
16329
17156
|
}
|
|
16330
17157
|
),
|
|
16331
|
-
/* @__PURE__ */ (0,
|
|
17158
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
16332
17159
|
]
|
|
16333
17160
|
},
|
|
16334
17161
|
`${option.type}:${option.id}`
|
|
16335
17162
|
)) }),
|
|
16336
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0,
|
|
17163
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16337
17164
|
ReferenceChip,
|
|
16338
17165
|
{
|
|
16339
17166
|
reference,
|
|
@@ -16341,29 +17168,29 @@ function Chat({
|
|
|
16341
17168
|
},
|
|
16342
17169
|
getReferenceKey(reference)
|
|
16343
17170
|
)) }),
|
|
16344
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0,
|
|
17171
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16345
17172
|
"div",
|
|
16346
17173
|
{
|
|
16347
17174
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
16348
17175
|
children: [
|
|
16349
|
-
/* @__PURE__ */ (0,
|
|
16350
|
-
/* @__PURE__ */ (0,
|
|
17176
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.FileText, { size: 12 }),
|
|
17177
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
|
|
16351
17178
|
]
|
|
16352
17179
|
},
|
|
16353
17180
|
fileIndex
|
|
16354
17181
|
)) }),
|
|
16355
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0,
|
|
17182
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16356
17183
|
"p",
|
|
16357
17184
|
{
|
|
16358
17185
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
16359
17186
|
children: formatMessageContent(part)
|
|
16360
17187
|
},
|
|
16361
17188
|
`${part.type}-${partIndex}`
|
|
16362
|
-
)) : /* @__PURE__ */ (0,
|
|
17189
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
16363
17190
|
] })
|
|
16364
17191
|
}
|
|
16365
17192
|
),
|
|
16366
|
-
/* @__PURE__ */ (0,
|
|
17193
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16367
17194
|
MessageActions,
|
|
16368
17195
|
{
|
|
16369
17196
|
content: messageContent,
|
|
@@ -16401,7 +17228,7 @@ function Chat({
|
|
|
16401
17228
|
stream.isLoading,
|
|
16402
17229
|
{ now: streamingNow }
|
|
16403
17230
|
);
|
|
16404
|
-
return /* @__PURE__ */ (0,
|
|
17231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16405
17232
|
AssistantStreamingIndicator,
|
|
16406
17233
|
{
|
|
16407
17234
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -16410,7 +17237,7 @@ function Chat({
|
|
|
16410
17237
|
})()
|
|
16411
17238
|
] })
|
|
16412
17239
|
] }),
|
|
16413
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0,
|
|
17240
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16414
17241
|
Button,
|
|
16415
17242
|
{
|
|
16416
17243
|
type: "button",
|
|
@@ -16423,10 +17250,10 @@ function Chat({
|
|
|
16423
17250
|
onClick: () => scrollToBottom(true, true),
|
|
16424
17251
|
"aria-label": t("chat.scrollToBottom"),
|
|
16425
17252
|
title: t("chat.scrollToBottom"),
|
|
16426
|
-
children: /* @__PURE__ */ (0,
|
|
17253
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.ArrowDown, { size: 16 })
|
|
16427
17254
|
}
|
|
16428
17255
|
) }),
|
|
16429
|
-
quoteSelection && /* @__PURE__ */ (0,
|
|
17256
|
+
quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16430
17257
|
"div",
|
|
16431
17258
|
{
|
|
16432
17259
|
className: "pointer-events-none fixed z-50",
|
|
@@ -16435,7 +17262,7 @@ function Chat({
|
|
|
16435
17262
|
left: `${quoteSelection.left}px`,
|
|
16436
17263
|
transform: "translateX(-50%)"
|
|
16437
17264
|
},
|
|
16438
|
-
children: /* @__PURE__ */ (0,
|
|
17265
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16439
17266
|
Button,
|
|
16440
17267
|
{
|
|
16441
17268
|
type: "button",
|
|
@@ -16447,16 +17274,16 @@ function Chat({
|
|
|
16447
17274
|
"aria-label": t("composer.quoteSelection"),
|
|
16448
17275
|
title: t("composer.quoteSelection"),
|
|
16449
17276
|
children: [
|
|
16450
|
-
/* @__PURE__ */ (0,
|
|
17277
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Quote, { size: 14 }),
|
|
16451
17278
|
t("composer.quoteSelection")
|
|
16452
17279
|
]
|
|
16453
17280
|
}
|
|
16454
17281
|
)
|
|
16455
17282
|
}
|
|
16456
17283
|
),
|
|
16457
|
-
/* @__PURE__ */ (0,
|
|
16458
|
-
threadErrorMessage && /* @__PURE__ */ (0,
|
|
16459
|
-
/* @__PURE__ */ (0,
|
|
17284
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
|
|
17285
|
+
threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.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 }),
|
|
17286
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16460
17287
|
ChatAttachments,
|
|
16461
17288
|
{
|
|
16462
17289
|
ref: attachmentsRef,
|
|
@@ -16470,7 +17297,7 @@ function Chat({
|
|
|
16470
17297
|
onStateChange: setAttachmentState
|
|
16471
17298
|
}
|
|
16472
17299
|
),
|
|
16473
|
-
references.length > 0 && /* @__PURE__ */ (0,
|
|
17300
|
+
references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16474
17301
|
ReferenceChip,
|
|
16475
17302
|
{
|
|
16476
17303
|
reference,
|
|
@@ -16484,16 +17311,16 @@ function Chat({
|
|
|
16484
17311
|
},
|
|
16485
17312
|
getReferenceKey(reference)
|
|
16486
17313
|
)) }),
|
|
16487
|
-
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
16488
|
-
/* @__PURE__ */ (0,
|
|
16489
|
-
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0,
|
|
17314
|
+
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
17315
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
|
|
17316
|
+
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16490
17317
|
"span",
|
|
16491
17318
|
{
|
|
16492
17319
|
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",
|
|
16493
17320
|
children: [
|
|
16494
|
-
/* @__PURE__ */ (0,
|
|
16495
|
-
/* @__PURE__ */ (0,
|
|
16496
|
-
/* @__PURE__ */ (0,
|
|
17321
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
17322
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-40 truncate", children: option.label }),
|
|
17323
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16497
17324
|
"button",
|
|
16498
17325
|
{
|
|
16499
17326
|
type: "button",
|
|
@@ -16501,7 +17328,7 @@ function Chat({
|
|
|
16501
17328
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
16502
17329
|
title: t("composer.capabilities.removeRunCapability"),
|
|
16503
17330
|
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
16504
|
-
children: /* @__PURE__ */ (0,
|
|
17331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 11 })
|
|
16505
17332
|
}
|
|
16506
17333
|
)
|
|
16507
17334
|
]
|
|
@@ -16509,7 +17336,7 @@ function Chat({
|
|
|
16509
17336
|
`${option.type}:${option.id}`
|
|
16510
17337
|
))
|
|
16511
17338
|
] }),
|
|
16512
|
-
showGoalStatus && /* @__PURE__ */ (0,
|
|
17339
|
+
showGoalStatus && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16513
17340
|
"div",
|
|
16514
17341
|
{
|
|
16515
17342
|
className: cn(
|
|
@@ -16517,8 +17344,8 @@ function Chat({
|
|
|
16517
17344
|
isGoalObjectiveExpanded ? "items-start" : "items-center"
|
|
16518
17345
|
),
|
|
16519
17346
|
children: [
|
|
16520
|
-
/* @__PURE__ */ (0,
|
|
16521
|
-
|
|
17347
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
17348
|
+
import_lucide_react29.Target,
|
|
16522
17349
|
{
|
|
16523
17350
|
className: cn(
|
|
16524
17351
|
"size-4 shrink-0 text-muted-foreground",
|
|
@@ -16526,13 +17353,13 @@ function Chat({
|
|
|
16526
17353
|
)
|
|
16527
17354
|
}
|
|
16528
17355
|
),
|
|
16529
|
-
/* @__PURE__ */ (0,
|
|
16530
|
-
/* @__PURE__ */ (0,
|
|
16531
|
-
/* @__PURE__ */ (0,
|
|
16532
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
16533
|
-
isGoalLoading && /* @__PURE__ */ (0,
|
|
17356
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
17357
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
17358
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-medium", children: t("chat.goal.label") }),
|
|
17359
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime54.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}`) }),
|
|
17360
|
+
isGoalLoading && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Loader2, { className: "size-3 animate-spin text-muted-foreground" })
|
|
16534
17361
|
] }),
|
|
16535
|
-
/* @__PURE__ */ (0,
|
|
17362
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16536
17363
|
"div",
|
|
16537
17364
|
{
|
|
16538
17365
|
className: cn(
|
|
@@ -16542,13 +17369,13 @@ function Chat({
|
|
|
16542
17369
|
children: goalError || threadGoal?.objective
|
|
16543
17370
|
}
|
|
16544
17371
|
),
|
|
16545
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
17372
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: t("chat.goal.elapsed", {
|
|
16546
17373
|
elapsed: formatGoalElapsed(displayedGoalElapsedSeconds)
|
|
16547
17374
|
}) }) })
|
|
16548
17375
|
] }),
|
|
16549
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
16550
|
-
/* @__PURE__ */ (0,
|
|
16551
|
-
/* @__PURE__ */ (0,
|
|
17376
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
17377
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17378
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16552
17379
|
Button,
|
|
16553
17380
|
{
|
|
16554
17381
|
type: "button",
|
|
@@ -16559,13 +17386,13 @@ function Chat({
|
|
|
16559
17386
|
const prefix = "/goal edit ";
|
|
16560
17387
|
setComposerText(`${prefix}${threadGoal.objective}`);
|
|
16561
17388
|
},
|
|
16562
|
-
children: /* @__PURE__ */ (0,
|
|
17389
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Pencil, { className: "size-3" })
|
|
16563
17390
|
}
|
|
16564
17391
|
) }),
|
|
16565
|
-
/* @__PURE__ */ (0,
|
|
17392
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: t("chat.goal.edit") })
|
|
16566
17393
|
] }),
|
|
16567
|
-
/* @__PURE__ */ (0,
|
|
16568
|
-
/* @__PURE__ */ (0,
|
|
17394
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17395
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16569
17396
|
Button,
|
|
16570
17397
|
{
|
|
16571
17398
|
type: "button",
|
|
@@ -16581,13 +17408,13 @@ function Chat({
|
|
|
16581
17408
|
executionType: "insert_invocation"
|
|
16582
17409
|
}
|
|
16583
17410
|
}),
|
|
16584
|
-
children: threadGoal.status === "paused" ? /* @__PURE__ */ (0,
|
|
17411
|
+
children: threadGoal.status === "paused" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Play, { className: "size-3" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Pause, { className: "size-3" })
|
|
16585
17412
|
}
|
|
16586
17413
|
) }),
|
|
16587
|
-
/* @__PURE__ */ (0,
|
|
17414
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
|
|
16588
17415
|
] }),
|
|
16589
|
-
/* @__PURE__ */ (0,
|
|
16590
|
-
/* @__PURE__ */ (0,
|
|
17416
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17417
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16591
17418
|
Button,
|
|
16592
17419
|
{
|
|
16593
17420
|
type: "button",
|
|
@@ -16603,13 +17430,13 @@ function Chat({
|
|
|
16603
17430
|
executionType: "insert_invocation"
|
|
16604
17431
|
}
|
|
16605
17432
|
}),
|
|
16606
|
-
children: /* @__PURE__ */ (0,
|
|
17433
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Trash2, { className: "size-3" })
|
|
16607
17434
|
}
|
|
16608
17435
|
) }),
|
|
16609
|
-
/* @__PURE__ */ (0,
|
|
17436
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: t("chat.goal.clear") })
|
|
16610
17437
|
] }),
|
|
16611
|
-
threadGoal.objective && !goalError && /* @__PURE__ */ (0,
|
|
16612
|
-
/* @__PURE__ */ (0,
|
|
17438
|
+
threadGoal.objective && !goalError && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17439
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16613
17440
|
Button,
|
|
16614
17441
|
{
|
|
16615
17442
|
type: "button",
|
|
@@ -16618,8 +17445,8 @@ function Chat({
|
|
|
16618
17445
|
"aria-expanded": isGoalObjectiveExpanded,
|
|
16619
17446
|
"aria-label": isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective"),
|
|
16620
17447
|
onClick: () => setIsGoalObjectiveExpanded((expanded) => !expanded),
|
|
16621
|
-
children: /* @__PURE__ */ (0,
|
|
16622
|
-
|
|
17448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
17449
|
+
import_lucide_react29.ChevronDown,
|
|
16623
17450
|
{
|
|
16624
17451
|
className: cn(
|
|
16625
17452
|
"size-3 transition-transform",
|
|
@@ -16629,13 +17456,13 @@ function Chat({
|
|
|
16629
17456
|
)
|
|
16630
17457
|
}
|
|
16631
17458
|
) }),
|
|
16632
|
-
/* @__PURE__ */ (0,
|
|
17459
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
|
|
16633
17460
|
] })
|
|
16634
17461
|
] })
|
|
16635
17462
|
]
|
|
16636
17463
|
}
|
|
16637
17464
|
),
|
|
16638
|
-
/* @__PURE__ */ (0,
|
|
17465
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16639
17466
|
PendingRuntimeServices,
|
|
16640
17467
|
{
|
|
16641
17468
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -16644,7 +17471,7 @@ function Chat({
|
|
|
16644
17471
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
16645
17472
|
}
|
|
16646
17473
|
),
|
|
16647
|
-
/* @__PURE__ */ (0,
|
|
17474
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16648
17475
|
PendingTodos,
|
|
16649
17476
|
{
|
|
16650
17477
|
snapshot: stream.todos,
|
|
@@ -16652,7 +17479,7 @@ function Chat({
|
|
|
16652
17479
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
16653
17480
|
}
|
|
16654
17481
|
),
|
|
16655
|
-
/* @__PURE__ */ (0,
|
|
17482
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16656
17483
|
PendingFollowUps,
|
|
16657
17484
|
{
|
|
16658
17485
|
items: pendingFollowUps,
|
|
@@ -16665,7 +17492,7 @@ function Chat({
|
|
|
16665
17492
|
attachToComposer: true
|
|
16666
17493
|
}
|
|
16667
17494
|
),
|
|
16668
|
-
/* @__PURE__ */ (0,
|
|
17495
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16669
17496
|
RequestUserInputPanel,
|
|
16670
17497
|
{
|
|
16671
17498
|
request: stream.pendingRequestUserInput,
|
|
@@ -16674,7 +17501,7 @@ function Chat({
|
|
|
16674
17501
|
attachToComposer: true
|
|
16675
17502
|
}
|
|
16676
17503
|
),
|
|
16677
|
-
/* @__PURE__ */ (0,
|
|
17504
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16678
17505
|
HITLApprovalPanel,
|
|
16679
17506
|
{
|
|
16680
17507
|
request: stream.pendingHITLRequest,
|
|
@@ -16683,7 +17510,7 @@ function Chat({
|
|
|
16683
17510
|
attachToComposer: true
|
|
16684
17511
|
}
|
|
16685
17512
|
),
|
|
16686
|
-
runtimeCapabilityPalette && /* @__PURE__ */ (0,
|
|
17513
|
+
runtimeCapabilityPalette && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16687
17514
|
SlashPalette,
|
|
16688
17515
|
{
|
|
16689
17516
|
palette: runtimeCapabilityPalette,
|
|
@@ -16697,7 +17524,7 @@ function Chat({
|
|
|
16697
17524
|
onSelect: selectSlashPaletteOption
|
|
16698
17525
|
}
|
|
16699
17526
|
),
|
|
16700
|
-
/* @__PURE__ */ (0,
|
|
17527
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16701
17528
|
"div",
|
|
16702
17529
|
{
|
|
16703
17530
|
"data-slot": "composer-input-shell",
|
|
@@ -16711,7 +17538,7 @@ function Chat({
|
|
|
16711
17538
|
composerInputRoundedClass
|
|
16712
17539
|
),
|
|
16713
17540
|
children: [
|
|
16714
|
-
/* @__PURE__ */ (0,
|
|
17541
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16715
17542
|
"div",
|
|
16716
17543
|
{
|
|
16717
17544
|
ref: composerInputRef,
|
|
@@ -16733,7 +17560,7 @@ function Chat({
|
|
|
16733
17560
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
16734
17561
|
),
|
|
16735
17562
|
children: renderedComposerParts.map(
|
|
16736
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */ (0,
|
|
17563
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(React49.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16737
17564
|
"span",
|
|
16738
17565
|
{
|
|
16739
17566
|
"data-composer-capability-key": part.key,
|
|
@@ -16742,14 +17569,14 @@ function Chat({
|
|
|
16742
17569
|
contentEditable: false,
|
|
16743
17570
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
16744
17571
|
children: [
|
|
16745
|
-
/* @__PURE__ */ (0,
|
|
17572
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16746
17573
|
RuntimeCapabilityIcon,
|
|
16747
17574
|
{
|
|
16748
17575
|
option: part.capability,
|
|
16749
17576
|
variant: "chip"
|
|
16750
17577
|
}
|
|
16751
17578
|
),
|
|
16752
|
-
/* @__PURE__ */ (0,
|
|
17579
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate", children: part.capability.label })
|
|
16753
17580
|
]
|
|
16754
17581
|
},
|
|
16755
17582
|
part.key
|
|
@@ -16758,14 +17585,14 @@ function Chat({
|
|
|
16758
17585
|
},
|
|
16759
17586
|
composerDomVersion
|
|
16760
17587
|
),
|
|
16761
|
-
/* @__PURE__ */ (0,
|
|
17588
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16762
17589
|
"div",
|
|
16763
17590
|
{
|
|
16764
17591
|
"data-slot": "composer-action-bar",
|
|
16765
17592
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
16766
17593
|
children: [
|
|
16767
|
-
/* @__PURE__ */ (0,
|
|
16768
|
-
/* @__PURE__ */ (0,
|
|
17594
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
17595
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16769
17596
|
ComposerMenu,
|
|
16770
17597
|
{
|
|
16771
17598
|
composer,
|
|
@@ -16783,20 +17610,20 @@ function Chat({
|
|
|
16783
17610
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
16784
17611
|
}
|
|
16785
17612
|
) }),
|
|
16786
|
-
selectedTool && /* @__PURE__ */ (0,
|
|
16787
|
-
/* @__PURE__ */ (0,
|
|
16788
|
-
/* @__PURE__ */ (0,
|
|
17613
|
+
selectedTool && /* @__PURE__ */ (0, import_jsx_runtime54.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: [
|
|
17614
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
17615
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16789
17616
|
"button",
|
|
16790
17617
|
{
|
|
16791
17618
|
type: "button",
|
|
16792
17619
|
onClick: () => setSelectedTool(null),
|
|
16793
17620
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
16794
|
-
children: /* @__PURE__ */ (0,
|
|
17621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 12 })
|
|
16795
17622
|
}
|
|
16796
17623
|
)
|
|
16797
17624
|
] })
|
|
16798
17625
|
] }),
|
|
16799
|
-
/* @__PURE__ */ (0,
|
|
17626
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16800
17627
|
SendButton,
|
|
16801
17628
|
{
|
|
16802
17629
|
disabled: isSendDisabled,
|
|
@@ -16819,7 +17646,7 @@ function Chat({
|
|
|
16819
17646
|
]
|
|
16820
17647
|
}
|
|
16821
17648
|
) }),
|
|
16822
|
-
disclaimer?.text && /* @__PURE__ */ (0,
|
|
17649
|
+
disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16823
17650
|
"p",
|
|
16824
17651
|
{
|
|
16825
17652
|
className: cn(
|
|
@@ -16829,12 +17656,12 @@ function Chat({
|
|
|
16829
17656
|
children: disclaimer.text
|
|
16830
17657
|
}
|
|
16831
17658
|
),
|
|
16832
|
-
/* @__PURE__ */ (0,
|
|
16833
|
-
/* @__PURE__ */ (0,
|
|
16834
|
-
/* @__PURE__ */ (0,
|
|
17659
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
17660
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: t("chat.poweredBy") }),
|
|
17661
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
|
|
16835
17662
|
] })
|
|
16836
17663
|
] }),
|
|
16837
|
-
/* @__PURE__ */ (0,
|
|
17664
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16838
17665
|
SettingsSheet,
|
|
16839
17666
|
{
|
|
16840
17667
|
open: petSettingsOpen,
|
|
@@ -16844,17 +17671,17 @@ function Chat({
|
|
|
16844
17671
|
onSave: savePetLocalSettings
|
|
16845
17672
|
}
|
|
16846
17673
|
),
|
|
16847
|
-
/* @__PURE__ */ (0,
|
|
17674
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
16848
17675
|
]
|
|
16849
17676
|
}
|
|
16850
17677
|
);
|
|
16851
17678
|
}
|
|
16852
17679
|
|
|
16853
17680
|
// src/components/ui/separator.tsx
|
|
16854
|
-
var
|
|
16855
|
-
var
|
|
16856
|
-
var Separator =
|
|
16857
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0,
|
|
17681
|
+
var React50 = __toESM(require("react"), 1);
|
|
17682
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
17683
|
+
var Separator = React50.forwardRef(
|
|
17684
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
16858
17685
|
"div",
|
|
16859
17686
|
{
|
|
16860
17687
|
ref,
|