@xpert-ai/chatkit-ui 0.3.21 → 0.4.1
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-DAi_U6eJ.js} +1 -1
- package/dist/app/assets/{abap-BM4qSIyQ.js → abap-ChIrIedY.js} +1 -1
- package/dist/app/assets/{abnf-BX4WCoML.js → abnf-BmyKeVYS.js} +1 -1
- package/dist/app/assets/{actionscript-xl_RFBNs.js → actionscript-C9wzeSLx.js} +1 -1
- package/dist/app/assets/{ada-El_ICa-x.js → ada-CnZwIcQD.js} +1 -1
- package/dist/app/assets/{agda-5bKVQpD_.js → agda-BC6tdZrt.js} +1 -1
- package/dist/app/assets/{al-B1nWlmvn.js → al-1IyjxpDM.js} +1 -1
- package/dist/app/assets/{antlr4-pBrbyzLd.js → antlr4-CHd-fyh6.js} +1 -1
- package/dist/app/assets/{apacheconf-BgknPISa.js → apacheconf-2lN3gJw-.js} +1 -1
- package/dist/app/assets/{apex-ByHs-y6y.js → apex-BlHo9TNy.js} +1 -1
- package/dist/app/assets/{apl-D93kE8hc.js → apl-LQvIBwOu.js} +1 -1
- package/dist/app/assets/{applescript-B-dVV5SQ.js → applescript-DWoMPELD.js} +1 -1
- package/dist/app/assets/{aql-BWPt2oGW.js → aql-C9S6c12M.js} +1 -1
- package/dist/app/assets/{arc-Bf6CYxcs.js → arc-Dt2ofM0k.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46--o0-uftJ.js → architectureDiagram-Q4EWVU46-Bt8nuJ35.js} +1 -1
- package/dist/app/assets/{arduino-CJ0e6EAb.js → arduino-1xWm7Tq4.js} +1 -1
- package/dist/app/assets/{arff-CjnLJtu2.js → arff-COOkNnH1.js} +1 -1
- package/dist/app/assets/{asciidoc-BEGGmE4f.js → asciidoc-DFECG2l7.js} +1 -1
- package/dist/app/assets/{asm6502-DdtsBxuW.js → asm6502-CzDAeDcX.js} +1 -1
- package/dist/app/assets/{asmatmel-C7bTA6ZK.js → asmatmel-CBtEsKji.js} +1 -1
- package/dist/app/assets/{aspnet-DybXb5RV.js → aspnet-BezxKLhu.js} +1 -1
- package/dist/app/assets/{autohotkey-B4DFJfeq.js → autohotkey-CHatwkez.js} +1 -1
- package/dist/app/assets/{autoit-BnJoVLFr.js → autoit-CI77RO6k.js} +1 -1
- package/dist/app/assets/{avisynth-adsYdF95.js → avisynth-DagCdNDY.js} +1 -1
- package/dist/app/assets/{avro-idl-BEEeDZ3T.js → avro-idl-Cy1rg8Yn.js} +1 -1
- package/dist/app/assets/{bash-HMaxYndq.js → bash-BzvlO_s6.js} +1 -1
- package/dist/app/assets/{basic-CGI_4hUJ.js → basic-MZAshZcs.js} +1 -1
- package/dist/app/assets/{batch-C3ZkiPxH.js → batch-czYKl46o.js} +1 -1
- package/dist/app/assets/{bbcode-BcKqPjJt.js → bbcode-cLlsKGAK.js} +1 -1
- package/dist/app/assets/{bicep-BiAeLXpL.js → bicep-DZ2Qthyi.js} +1 -1
- package/dist/app/assets/{birb-BUzFWx_A.js → birb-G8OGp_MU.js} +1 -1
- package/dist/app/assets/{bison--JmMkpGr.js → bison-Bskzz9x7.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-DlCLRQ6D.js → blockDiagram-DXYQGD6D-BdBXVdp9.js} +1 -1
- package/dist/app/assets/{bnf-CW9x2YuF.js → bnf-BOEOLky_.js} +1 -1
- package/dist/app/assets/{brainfuck-JE2vVBK8.js → brainfuck-h8bJ3DFC.js} +1 -1
- package/dist/app/assets/{brightscript-BFVL4OK-.js → brightscript-BIR8Gf--.js} +1 -1
- package/dist/app/assets/{bro-BFP7Vg1t.js → bro-B5XbyZQT.js} +1 -1
- package/dist/app/assets/{bsl-8KT47Ocp.js → bsl-C-sazznb.js} +1 -1
- package/dist/app/assets/{c-DjRDCv7Q.js → c-DotRXvuU.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-CxOxKAvr.js → c4Diagram-AHTNJAMY-Dd8x_6AZ.js} +1 -1
- package/dist/app/assets/{cfscript-uYdSfHi1.js → cfscript-ByuErNyc.js} +1 -1
- package/dist/app/assets/{chaiscript-BMJlJ5Yj.js → chaiscript-xSeu7-zW.js} +1 -1
- package/dist/app/assets/channel-BFsqVDof.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-BlVYV2JT.js → chunk-4BX2VUAB-DZN1JqGD.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-BVGwM0_B.js → chunk-4TB4RGXK-bBSVyHgs.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-BEUpYdGG.js → chunk-55IACEB6-Ds-SW37D.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-z870kN9i.js → chunk-EDXVE4YY-Dri8feOV.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-DfF0T4M2.js → chunk-FMBD7UC4-DJ8k-IiR.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-CG1987mG.js → chunk-OYMX7WX6-k7E98ZJe.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-JIvq2t0-.js → chunk-QZHKN3VN-DJhFI2vO.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-zf8sTeUU.js → chunk-YZCP3GAM-B1p0s5ao.js} +1 -1
- package/dist/app/assets/{cil-BB6bejx8.js → cil-BvhK6LJY.js} +1 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-Bn8c7G_r.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-Bn8c7G_r.js +1 -0
- package/dist/app/assets/{clike-D3xMhpOD.js → clike-FuCuUpd8.js} +1 -1
- package/dist/app/assets/{clojure-Chij6Ngb.js → clojure-CU75lO9p.js} +1 -1
- package/dist/app/assets/clone-IlBC1DaN.js +1 -0
- package/dist/app/assets/{cmake-CZ3QnJ3x.js → cmake-BRgcPG29.js} +1 -1
- package/dist/app/assets/{cobol-piqn3l1D.js → cobol-CTa8YX63.js} +1 -1
- package/dist/app/assets/{coffeescript-D7pJB5Sc.js → coffeescript-C1tCgHyE.js} +1 -1
- package/dist/app/assets/{concurnas-BUVBF3iU.js → concurnas-Wgt7FQyC.js} +1 -1
- package/dist/app/assets/{coq-DO12wGyQ.js → coq-CpXQQvmF.js} +1 -1
- package/dist/app/assets/{core-wZNUERI0.js → core-dcDIevRF.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-DNcJwuP_.js → cose-bilkent-S5V4N54A-AWnydwPj.js} +1 -1
- package/dist/app/assets/{cpp-Bn4NX0Y7.js → cpp-PopsO2HF.js} +1 -1
- package/dist/app/assets/{crystal-DH1SzjI0.js → crystal-Bkd2nMwS.js} +1 -1
- package/dist/app/assets/{csharp-DsRZVr1z.js → csharp-BA1kER1p.js} +1 -1
- package/dist/app/assets/{cshtml-BW39Mq-n.js → cshtml-BmNdnWsC.js} +1 -1
- package/dist/app/assets/{csp-BHap8sWo.js → csp-BV7K_LnK.js} +1 -1
- package/dist/app/assets/{css-pptVnNrc.js → css-D_do90Bs.js} +1 -1
- package/dist/app/assets/{css-extras-DNvI8BqP.js → css-extras-D0dKqzph.js} +1 -1
- package/dist/app/assets/{csv-BGNEqqUD.js → csv-Dy2-4DqS.js} +1 -1
- package/dist/app/assets/{cypher-DI9Eh2MX.js → cypher-Bbt867j9.js} +1 -1
- package/dist/app/assets/{d-Baut6dRC.js → d-BJKjKDuh.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-Bll-N0gB.js → dagre-KV5264BT-qACi6DAC.js} +1 -1
- package/dist/app/assets/{dart-DwQS8J-b.js → dart-C7zj4vyl.js} +1 -1
- package/dist/app/assets/{dataweave-Bm1DfTIi.js → dataweave-XWkmXL_n.js} +1 -1
- package/dist/app/assets/{dax-DczLQrxB.js → dax-C12CMdhM.js} +1 -1
- package/dist/app/assets/{dhall-D-rQkR7U.js → dhall-luyA3uBM.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD-BsqcOqjN.js → diagram-5BDNPKRD-D2DNhSOw.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-CanWPLYX.js → diagram-G4DWMVQ6-D2e2KRjm.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-DtTvDmLa.js → diagram-MMDJMWI5-knmYakCW.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-CqAB9YcT.js → diagram-TYMM5635-DORhYdkc.js} +1 -1
- package/dist/app/assets/{diff-DRX_aR8Q.js → diff-B8UdoaQV.js} +1 -1
- package/dist/app/assets/{django-B70oQtEy.js → django-DtYp2PYt.js} +1 -1
- package/dist/app/assets/{dns-zone-file-UDNZJdpf.js → dns-zone-file-DrtEuPTT.js} +1 -1
- package/dist/app/assets/{docker-C5WbmVoT.js → docker-2GV5UON2.js} +1 -1
- package/dist/app/assets/{dot-BgOwKJXC.js → dot-OL5v0gu4.js} +1 -1
- package/dist/app/assets/{ebnf-DcbjvJF9.js → ebnf-C9eB4mQh.js} +1 -1
- package/dist/app/assets/{editorconfig-BVQjr_5n.js → editorconfig-Bt1KhC9s.js} +1 -1
- package/dist/app/assets/{eiffel-NEJHOZNK.js → eiffel-5tZX-H1U.js} +1 -1
- package/dist/app/assets/{ejs-D-4dvILN.js → ejs-5X_EH25G.js} +1 -1
- package/dist/app/assets/{elixir-DylKEJ8m.js → elixir-B3cIfaev.js} +1 -1
- package/dist/app/assets/{elm-m8oZ9wqi.js → elm-BZzmZArh.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-B4Kokusb.js → erDiagram-SMLLAGMA-D6XJaFtW.js} +1 -1
- package/dist/app/assets/{erb-DrkAZuLY.js → erb-B3vztRAF.js} +1 -1
- package/dist/app/assets/{erlang-C009jUDM.js → erlang-ViBllQb_.js} +1 -1
- package/dist/app/assets/{etlua-BYR_P5ZO.js → etlua-CLh8MAjG.js} +1 -1
- package/dist/app/assets/{excel-formula-D49xhxI6.js → excel-formula-us8LQ5A8.js} +1 -1
- package/dist/app/assets/{factor-QpmgGoBW.js → factor-Sxzieg9m.js} +1 -1
- package/dist/app/assets/{false-sqNVea_q.js → false-CNugF9H4.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-BigXcaq8.js → firestore-security-rules-Xl5Y-ePD.js} +1 -1
- package/dist/app/assets/{flow-Ci-UXkWw.js → flow-275bTxGc.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-B3rfvjfL.js → flowDiagram-DWJPFMVM-riJvcRDk.js} +1 -1
- package/dist/app/assets/{fortran-e_w_yEL9.js → fortran-Dzu99g0z.js} +1 -1
- package/dist/app/assets/{fsharp-BquAs0nh.js → fsharp-D0oFScfK.js} +1 -1
- package/dist/app/assets/{ftl-Djb0Hj1R.js → ftl-CgLUYfhw.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-B9hQ1hJF.js → ganttDiagram-T4ZO3ILL-DD-HGvMl.js} +1 -1
- package/dist/app/assets/{gap-DLc_BCjg.js → gap-B44Er8-4.js} +1 -1
- package/dist/app/assets/{gcode-Det6n0Ho.js → gcode-DuMJg2M0.js} +1 -1
- package/dist/app/assets/{gdscript-D-g8ZK89.js → gdscript-x-7hd2Cg.js} +1 -1
- package/dist/app/assets/{gedcom-DAvnEHuX.js → gedcom-BMCTbYS6.js} +1 -1
- package/dist/app/assets/{gherkin-D38X0Yb7.js → gherkin-BcBvM988.js} +1 -1
- package/dist/app/assets/{git-DC6oOsjy.js → git-BTGg5sN4.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-DyWUrbw1.js → gitGraphDiagram-UUTBAWPF-b-kntfTC.js} +1 -1
- package/dist/app/assets/{glsl-B3tH9uG-.js → glsl-DByr37nv.js} +1 -1
- package/dist/app/assets/{gml-DARPpECj.js → gml-36I_9f_U.js} +1 -1
- package/dist/app/assets/{gn-vy9FemoP.js → gn-BLDlPwNQ.js} +1 -1
- package/dist/app/assets/{go-CNAfUJcn.js → go-Boj1uPSx.js} +1 -1
- package/dist/app/assets/{go-module-Rt8NBOyO.js → go-module-L2WDzHgB.js} +1 -1
- package/dist/app/assets/{graph-CWQVt5Hd.js → graph-BYtz-_6s.js} +1 -1
- package/dist/app/assets/{graphql-CxXfJNJ5.js → graphql-BfN-CNvc.js} +1 -1
- package/dist/app/assets/{groovy-BBN8a1rT.js → groovy-Di6yQ_XB.js} +1 -1
- package/dist/app/assets/{haml-BOc4eex8.js → haml-CJKYBDrb.js} +1 -1
- package/dist/app/assets/{handlebars-BJffDJoW.js → handlebars-C_d7SzSb.js} +1 -1
- package/dist/app/assets/{haskell-CjIMIx7I.js → haskell-DvCoQrPY.js} +1 -1
- package/dist/app/assets/{haxe-DWDpw8Qc.js → haxe-g-aQ5l_r.js} +1 -1
- package/dist/app/assets/{hcl-BZzPeJmI.js → hcl-B2sKOa6X.js} +1 -1
- package/dist/app/assets/{hlsl-DONgZjSW.js → hlsl-DWW7PgMK.js} +1 -1
- package/dist/app/assets/{hoon-BgEGZDxn.js → hoon-Cgs2pF0p.js} +1 -1
- package/dist/app/assets/{hpkp-BdhSfjgl.js → hpkp-PIZ7CodS.js} +1 -1
- package/dist/app/assets/{hsts-CzUotko0.js → hsts-Bdp-yuRT.js} +1 -1
- package/dist/app/assets/{http-DZ5siSz1.js → http-VYp76tRU.js} +1 -1
- package/dist/app/assets/{ichigojam-BA6OXXoB.js → ichigojam-DvtKARkc.js} +1 -1
- package/dist/app/assets/{icon-iUz8kW3L.js → icon-d06F6rDq.js} +1 -1
- package/dist/app/assets/{icu-message-format-CCAUs64P.js → icu-message-format-aVC9gogJ.js} +1 -1
- package/dist/app/assets/{idris-BlIDzxgn.js → idris-BQ2Vr1Lo.js} +1 -1
- package/dist/app/assets/{iecst-CMWyTEtE.js → iecst-o62IQ8Ar.js} +1 -1
- package/dist/app/assets/{ignore-CXEc0RKr.js → ignore-CXf2VZ3C.js} +1 -1
- package/dist/app/assets/index-ByruneYs.css +1 -0
- package/dist/app/assets/index-KkR7szpv.js +756 -0
- package/dist/app/assets/{infoDiagram-42DDH7IO-CvY1ChHR.js → infoDiagram-42DDH7IO-BFBpKPZd.js} +1 -1
- package/dist/app/assets/{inform7-RKf3LSDR.js → inform7-CsQNRaGw.js} +1 -1
- package/dist/app/assets/{ini-K8CLpdcD.js → ini-BlQytVce.js} +1 -1
- package/dist/app/assets/{io-DiUzEhPs.js → io-Bo6fwZ5O.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-Cp5yLHei.js → ishikawaDiagram-UXIWVN3A-D5AkPKrc.js} +1 -1
- package/dist/app/assets/{j-CU5vEBSA.js → j-Cz5UUgV-.js} +1 -1
- package/dist/app/assets/{java-DAzk8PaQ.js → java-CjUD3NXn.js} +1 -1
- package/dist/app/assets/{javadoc-AliyBIAx.js → javadoc-yF8ZVFyi.js} +1 -1
- package/dist/app/assets/{javadoclike-Dntcuir5.js → javadoclike-DnQ7gClD.js} +1 -1
- package/dist/app/assets/{javascript-BSrBoO9h.js → javascript-PRMAjM-s.js} +1 -1
- package/dist/app/assets/{javastacktrace-M0UDvHO7.js → javastacktrace-C6-F9CMW.js} +1 -1
- package/dist/app/assets/{jexl-ChBtuGhM.js → jexl-oI1gkWTn.js} +1 -1
- package/dist/app/assets/{jolie-dVzYMXzP.js → jolie-KHDj467I.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-DFUxbdY3.js → journeyDiagram-VCZTEJTY-DgMvhqym.js} +1 -1
- package/dist/app/assets/{jq-C-FHF89g.js → jq-CqB-vLgA.js} +1 -1
- package/dist/app/assets/{js-extras-CUWVDuzh.js → js-extras--LnkBZGI.js} +1 -1
- package/dist/app/assets/{js-templates-BsmT3aBE.js → js-templates-CdUH3dZg.js} +1 -1
- package/dist/app/assets/{jsdoc-DYd6bfCg.js → jsdoc-C8SPD3A9.js} +1 -1
- package/dist/app/assets/{json-9a0HiK8V.js → json-CCZ95ADF.js} +1 -1
- package/dist/app/assets/{json5-CHfH8hub.js → json5-CQoP6QWS.js} +1 -1
- package/dist/app/assets/{jsonp-C4H8aw-G.js → jsonp-BzvcroET.js} +1 -1
- package/dist/app/assets/{jsstacktrace-CWLuVaQs.js → jsstacktrace-D3CXOSM-.js} +1 -1
- package/dist/app/assets/{jsx-CKSzHPGQ.js → jsx-Bd3mMffB.js} +1 -1
- package/dist/app/assets/{julia-CKCCG6Mf.js → julia-qBdVr2Tr.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-C3XjPZMK.js → kanban-definition-6JOO6SKY-DPXkILDM.js} +1 -1
- package/dist/app/assets/{keepalived-CyUP2k6O.js → keepalived-FNAJGQz5.js} +1 -1
- package/dist/app/assets/{keyman-C4jw745i.js → keyman-B0NqoQM-.js} +1 -1
- package/dist/app/assets/{kotlin-k4KF32sW.js → kotlin-CdWWxHY0.js} +1 -1
- package/dist/app/assets/{kumir-DSXoU43i.js → kumir-bAKuoUwp.js} +1 -1
- package/dist/app/assets/{kusto-DN4PTwp5.js → kusto-D1hPCkmo.js} +1 -1
- package/dist/app/assets/{latex-DnND8Hyr.js → latex-BYk1hc9y.js} +1 -1
- package/dist/app/assets/{latte-ZczIeK8r.js → latte-BWv6hwOU.js} +1 -1
- package/dist/app/assets/{layout-Co572jdY.js → layout-2Js2q7Wp.js} +1 -1
- package/dist/app/assets/{less-Dj7UTsAS.js → less-wnHPSvJJ.js} +1 -1
- package/dist/app/assets/{lilypond-BZT4RhtW.js → lilypond-xuX4YO1U.js} +1 -1
- package/dist/app/assets/{linear-Bs8rswOH.js → linear-B6WywDat.js} +1 -1
- package/dist/app/assets/{liquid-ClZynrWa.js → liquid-xFGU1AAd.js} +1 -1
- package/dist/app/assets/{lisp-BTorhS-u.js → lisp-DjvMW89a.js} +1 -1
- package/dist/app/assets/{livescript-DoDDu5Yt.js → livescript-D5MDpvjh.js} +1 -1
- package/dist/app/assets/{llvm-CX8WmHsW.js → llvm-BTbu6b_B.js} +1 -1
- package/dist/app/assets/{log-DqX7RFDU.js → log-BXtPvqUh.js} +1 -1
- package/dist/app/assets/{lolcode-BhqlIFHf.js → lolcode-Cg2KO8Bk.js} +1 -1
- package/dist/app/assets/{lua-D2PWt_yX.js → lua-D1_Kwv1l.js} +1 -1
- package/dist/app/assets/{magma-BWcE3gZw.js → magma-DT5ABiea.js} +1 -1
- package/dist/app/assets/{makefile-Bqpj3_DO.js → makefile-B0kz2zIF.js} +1 -1
- package/dist/app/assets/{markdown-CnajnEUc.js → markdown-Ccqy3gK-.js} +1 -1
- package/dist/app/assets/{markup-Bo8fRV73.js → markup-B-Gm3D06.js} +1 -1
- package/dist/app/assets/{markup-templating-BVLTEf1q.js → markup-templating-CVIiYen0.js} +1 -1
- package/dist/app/assets/{matlab-aBhqIbY_.js → matlab-CpRokG-g.js} +1 -1
- package/dist/app/assets/{maxscript-CsHgPBx8.js → maxscript-CifzwyQN.js} +1 -1
- package/dist/app/assets/{mel-C2Q01urV.js → mel-CyTX6M-N.js} +1 -1
- package/dist/app/assets/{mermaid-BuMDBFL8.js → mermaid-DnF0NJk0.js} +1 -1
- package/dist/app/assets/{min-Byza3p1P.js → min-CeO0o-VZ.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-CEthcC4b.js → mindmap-definition-QFDTVHPH-C1GLNszO.js} +1 -1
- package/dist/app/assets/{mizar-B_i6T9OT.js → mizar-DX-L7mf3.js} +1 -1
- package/dist/app/assets/{mongodb-DvQQHyBw.js → mongodb-CrNBr4YD.js} +1 -1
- package/dist/app/assets/{monkey-znz8nJPM.js → monkey-EVsyFzXp.js} +1 -1
- package/dist/app/assets/{moonscript-CRv3oyNU.js → moonscript-Bb5VMmq0.js} +1 -1
- package/dist/app/assets/{n1ql-Ut5maFqH.js → n1ql-B8avGgLU.js} +1 -1
- package/dist/app/assets/{n4js-DhQq4607.js → n4js-BA_CeBpN.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-C7cFsm13.js → nand2tetris-hdl-BNrrwWv7.js} +1 -1
- package/dist/app/assets/{naniscript-CW4orAyd.js → naniscript-PcEQKYGG.js} +1 -1
- package/dist/app/assets/{nasm-D12WnJXs.js → nasm-BF2RPhuG.js} +1 -1
- package/dist/app/assets/{neon-CyZOMcF4.js → neon-BH4eKGLv.js} +1 -1
- package/dist/app/assets/{nevod-DPER4jE8.js → nevod-DLUuPv3n.js} +1 -1
- package/dist/app/assets/{nginx-B-pd0-Ad.js → nginx-Fnshx0R8.js} +1 -1
- package/dist/app/assets/{nim-BTKCwQU5.js → nim-D0A0og2Z.js} +1 -1
- package/dist/app/assets/{nix-_E0KYcLF.js → nix-Bon-hCg-.js} +1 -1
- package/dist/app/assets/{nsis-BV6YGEAl.js → nsis-B0Op3uDI.js} +1 -1
- package/dist/app/assets/{objectivec-D7DZtg3n.js → objectivec-CI9W2RmC.js} +1 -1
- package/dist/app/assets/{ocaml-jOwdJMGP.js → ocaml-CPuytBAo.js} +1 -1
- package/dist/app/assets/{opencl-BK8RsGvY.js → opencl-ckicWmRb.js} +1 -1
- package/dist/app/assets/{openqasm-CnTU765R.js → openqasm-DNNaR-Mb.js} +1 -1
- package/dist/app/assets/{oz-Bj9raWAN.js → oz-Cp5S2lvu.js} +1 -1
- package/dist/app/assets/{parigp-CdPTMoNi.js → parigp-BiU88-BW.js} +1 -1
- package/dist/app/assets/{parser-Cdmw5LSw.js → parser-BJoKleAv.js} +1 -1
- package/dist/app/assets/{pascal-nUYtHUHG.js → pascal-CcE4xcIX.js} +1 -1
- package/dist/app/assets/{pascaligo-Bkz6st9y.js → pascaligo-r-ZE34N3.js} +1 -1
- package/dist/app/assets/{pcaxis-iU3Ob1-f.js → pcaxis-CW4NowQv.js} +1 -1
- package/dist/app/assets/{peoplecode-B0tZE2um.js → peoplecode-Bbokkn0k.js} +1 -1
- package/dist/app/assets/{perl-CauH9Ddc.js → perl-NWBFpbg8.js} +1 -1
- package/dist/app/assets/{php-nfD6bsQv.js → php-DzJJC1FF.js} +1 -1
- package/dist/app/assets/{php-extras-LFIs5Lee.js → php-extras-DvwbSAqp.js} +1 -1
- package/dist/app/assets/{phpdoc-CIScJtQR.js → phpdoc-vc489EfZ.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-yb4urrIl.js → pieDiagram-DEJITSTG-DakoqX91.js} +1 -1
- package/dist/app/assets/{plsql-DlL_Q0z7.js → plsql-BSYYydG4.js} +1 -1
- package/dist/app/assets/{powerquery-CwJoieGU.js → powerquery-TIsxOi6u.js} +1 -1
- package/dist/app/assets/{powershell-Do5am0dD.js → powershell-Bh2wJ04E.js} +1 -1
- package/dist/app/assets/{processing-DrVT9fYT.js → processing-0Xg8ooVg.js} +1 -1
- package/dist/app/assets/{prolog-eaGBptl-.js → prolog-CxppYjwG.js} +1 -1
- package/dist/app/assets/{promql-8qqnQVxn.js → promql-M_6Fk7_i.js} +1 -1
- package/dist/app/assets/{properties-VjU6IVz6.js → properties-DaA3ENH6.js} +1 -1
- package/dist/app/assets/{protobuf-Dbtdjvmg.js → protobuf-C7yrawyt.js} +1 -1
- package/dist/app/assets/{psl-CiJuxJxC.js → psl-D7EDqlli.js} +1 -1
- package/dist/app/assets/{pug-BEtm4Ype.js → pug-CqBJblJn.js} +1 -1
- package/dist/app/assets/{puppet-C9PVG5W9.js → puppet-Z388LiOc.js} +1 -1
- package/dist/app/assets/{pure-C_BwhjmX.js → pure-CXCKqVIH.js} +1 -1
- package/dist/app/assets/{purebasic-I8MXUtAz.js → purebasic-CH-UTkQE.js} +1 -1
- package/dist/app/assets/{purescript-SjuuPi5a.js → purescript-DvOvPLcm.js} +1 -1
- package/dist/app/assets/{q-CBBhyRzW.js → q-CTsCA7pz.js} +1 -1
- package/dist/app/assets/{qml-cKrpUey0.js → qml-C2L45_tT.js} +1 -1
- package/dist/app/assets/{qore-DN78sWhO.js → qore-CgIwfQn-.js} +1 -1
- package/dist/app/assets/{qsharp-BwcPcLS6.js → qsharp-Cfohf27J.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-Bi4Wq7z-.js → quadrantDiagram-34T5L4WZ-BJHhj_jc.js} +1 -1
- package/dist/app/assets/{r-DgNabGHz.js → r-C5o21RDe.js} +1 -1
- package/dist/app/assets/{racket-DpYHN5yN.js → racket-CN9RmGia.js} +1 -1
- package/dist/app/assets/{reason-CEMPZwks.js → reason-C0TktVj3.js} +1 -1
- package/dist/app/assets/{regex-CgjjXtr_.js → regex-BlijmS7y.js} +1 -1
- package/dist/app/assets/{rego-DEAlE1Uk.js → rego-D8yKAPUb.js} +1 -1
- package/dist/app/assets/{renpy-LG8AK0je.js → renpy-HRBI32Rj.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-bxPOgxi3.js → requirementDiagram-MS252O5E-DlLBwibk.js} +1 -1
- package/dist/app/assets/{rest-BN3tMfFJ.js → rest--RXtECt5.js} +1 -1
- package/dist/app/assets/{rip-hB4F37s_.js → rip-mE2Wb308.js} +1 -1
- package/dist/app/assets/{roboconf-BqXmHAXe.js → roboconf-DRTv7VeG.js} +1 -1
- package/dist/app/assets/{robotframework-BTJ5n8fC.js → robotframework-BnkzJa4T.js} +1 -1
- package/dist/app/assets/{ruby-D6Jm6sK4.js → ruby-CbnYMgfx.js} +1 -1
- package/dist/app/assets/{rust-BonG09IB.js → rust-D9ZEey-F.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-BxYgoe8H.js → sankeyDiagram-XADWPNL6-CQ0D4FEy.js} +1 -1
- package/dist/app/assets/{sas-Cl0dGeKC.js → sas-DEOAT5T8.js} +1 -1
- package/dist/app/assets/{sass-CU1QiBFM.js → sass-CFnXYw-w.js} +1 -1
- package/dist/app/assets/{scala-DoZYPVOe.js → scala-Cdyre3LC.js} +1 -1
- package/dist/app/assets/{scheme-BgIJEt42.js → scheme-C7TzUGNb.js} +1 -1
- package/dist/app/assets/{scss-CjocpdLe.js → scss-DqOdGhXG.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-BhGC2uYj.js → sequenceDiagram-FGHM5R23-Cliyp3uP.js} +1 -1
- package/dist/app/assets/{shell-session-BHwj7Lso.js → shell-session-C18Fh-Mo.js} +1 -1
- package/dist/app/assets/{smali-BDeyq-QZ.js → smali-Ba-NYTBy.js} +1 -1
- package/dist/app/assets/{smalltalk-BeNshzwP.js → smalltalk-D4_HH51D.js} +1 -1
- package/dist/app/assets/{smarty-Bvxz2rnZ.js → smarty-ve8WueLi.js} +1 -1
- package/dist/app/assets/{sml-NCRXglP-.js → sml-B1M_nKm2.js} +1 -1
- package/dist/app/assets/{solidity-DCRKtW7U.js → solidity-CIvnWntJ.js} +1 -1
- package/dist/app/assets/{solution-file-wzmwCZ6S.js → solution-file-R2nyikO3.js} +1 -1
- package/dist/app/assets/{soy-yGw8ki1j.js → soy-C_3SFG7Z.js} +1 -1
- package/dist/app/assets/{sparql-C6HcVk-n.js → sparql-C2k3cKYf.js} +1 -1
- package/dist/app/assets/{splunk-spl-DwN8KORu.js → splunk-spl-ByIFO0Ol.js} +1 -1
- package/dist/app/assets/{sqf-Ci0DqiRT.js → sqf-Vjg8AD_x.js} +1 -1
- package/dist/app/assets/{sql-r0BAcikz.js → sql-DjDfr2VA.js} +1 -1
- package/dist/app/assets/{squirrel-egwbG0_Q.js → squirrel-BlPI0NeA.js} +1 -1
- package/dist/app/assets/{stan-BUl5jvft.js → stan-EA9jmZ4B.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-CuRECirl.js → stateDiagram-FHFEXIEX-BaG7xzbX.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-CFVaPbpw.js +1 -0
- package/dist/app/assets/{stylus-DTE1MHAZ.js → stylus-D2qHhNmV.js} +1 -1
- package/dist/app/assets/{swift-Cm0dpK0e.js → swift-CzeQnM5g.js} +1 -1
- package/dist/app/assets/{systemd-C6-mX_m2.js → systemd-BL_IyZfy.js} +1 -1
- package/dist/app/assets/{t4-cs-CbJdbn3r.js → t4-cs-BpATtOyQ.js} +1 -1
- package/dist/app/assets/{t4-templating-DUNJuP6R.js → t4-templating-DarnFlia.js} +1 -1
- package/dist/app/assets/{t4-vb-CGQiYNUq.js → t4-vb-DlsRn2Cj.js} +1 -1
- package/dist/app/assets/{tap-CcP4Ra29.js → tap-swtRUhHW.js} +1 -1
- package/dist/app/assets/{tcl-DDIFCbCY.js → tcl-C6d9gcmI.js} +1 -1
- package/dist/app/assets/{textile-BP9vCAsS.js → textile-ue6vVR7H.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-DtpMIXn5.js → timeline-definition-GMOUNBTQ-CXGgHbNE.js} +1 -1
- package/dist/app/assets/{toml-e0sn-wYl.js → toml-DzLpuKYb.js} +1 -1
- package/dist/app/assets/{tremor-rx7BwOeg.js → tremor-DVx5napI.js} +1 -1
- package/dist/app/assets/{tt2-2GtZvdz0.js → tt2-CfBoG1D5.js} +1 -1
- package/dist/app/assets/{turtle-Cyl6xYSA.js → turtle-03crZiO0.js} +1 -1
- package/dist/app/assets/{twig-DaPREJnk.js → twig-KE1rmB-l.js} +1 -1
- package/dist/app/assets/{typescript-d9uArdn6.js → typescript-BdOSmjy2.js} +1 -1
- package/dist/app/assets/{typoscript-Bz5s-Nus.js → typoscript-B28vjRk7.js} +1 -1
- package/dist/app/assets/{unrealscript--YCQVCBZ.js → unrealscript-CTh7n3tv.js} +1 -1
- package/dist/app/assets/{uorazor-BGMX0b7A.js → uorazor-QSSsUqoY.js} +1 -1
- package/dist/app/assets/{uri-IleC_XB0.js → uri-Ui2KPDFN.js} +1 -1
- package/dist/app/assets/{v-D0_WRO4z.js → v-Bbxf1ds9.js} +1 -1
- package/dist/app/assets/{vala-DjAqhwAT.js → vala-BlgZ9glv.js} +1 -1
- package/dist/app/assets/{vbnet-BtQX6etM.js → vbnet-DSInurkl.js} +1 -1
- package/dist/app/assets/{velocity-CnKSWVwR.js → velocity-CpoD6Pq0.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-DoPjGYKx.js → vennDiagram-DHZGUBPP-Db2TlePA.js} +1 -1
- package/dist/app/assets/{verilog-UtuuV-R3.js → verilog-yw--B1wx.js} +1 -1
- package/dist/app/assets/{vhdl-CLqX6Jr6.js → vhdl-CHBhtgXL.js} +1 -1
- package/dist/app/assets/{vim-C2pDFZQe.js → vim-CdXJ9W72.js} +1 -1
- package/dist/app/assets/{visual-basic-BsdNM80-.js → visual-basic-DtOe-guS.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-BS1u_sqm.js → wardley-RL74JXVD-CMqZ314T.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-BLu2tzSV.js → wardleyDiagram-NUSXRM2D-Diu9QsPH.js} +1 -1
- package/dist/app/assets/{warpscript-DS0MtVBk.js → warpscript-DwowGOOS.js} +1 -1
- package/dist/app/assets/{wasm-pdEDtE_9.js → wasm-BkLUVFyv.js} +1 -1
- package/dist/app/assets/{web-idl-C5-NgFOA.js → web-idl-C1GVfRt2.js} +1 -1
- package/dist/app/assets/{wiki-BZJV7U3Y.js → wiki-DURYVzTz.js} +1 -1
- package/dist/app/assets/{wolfram-Q3sCKVET.js → wolfram-CxvLgL5P.js} +1 -1
- package/dist/app/assets/{wren-BNOjakR4.js → wren-BIEilPFe.js} +1 -1
- package/dist/app/assets/{xeora-R3lkxRHE.js → xeora-CdxWp6rT.js} +1 -1
- package/dist/app/assets/{xml-doc-ZtMXrPfY.js → xml-doc-Cqq7E-Uw.js} +1 -1
- package/dist/app/assets/{xojo-Bgt-B00s.js → xojo-TX_aeoYq.js} +1 -1
- package/dist/app/assets/{xquery-CYusL8ky.js → xquery-CL0gFxeo.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-BVUDpF-g.js → xychartDiagram-5P7HB3ND-BYaDUge6.js} +1 -1
- package/dist/app/assets/{yaml-DQRgck-g.js → yaml-lCG0Z7vx.js} +1 -1
- package/dist/app/assets/{yang-Cs4B2bHl.js → yang-BjQjWvFO.js} +1 -1
- package/dist/app/assets/{zig-Dbk4oIaS.js → zig-DMlo7Ol7.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1515 -526
- package/dist/index.js +1495 -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.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/components/chat.tsx
|
|
2
|
-
import * as
|
|
2
|
+
import * as React49 from "react";
|
|
3
3
|
import {
|
|
4
4
|
ArrowDown as ArrowDown2,
|
|
5
5
|
ChevronDown as ChevronDown5,
|
|
6
6
|
FileText as FileText5,
|
|
7
7
|
ImageIcon,
|
|
8
|
-
Loader2 as
|
|
8
|
+
Loader2 as Loader29,
|
|
9
9
|
Minus,
|
|
10
10
|
Pause,
|
|
11
11
|
Pencil as Pencil4,
|
|
@@ -1680,6 +1680,9 @@ var en_US_default = {
|
|
|
1680
1680
|
loading: "Loading",
|
|
1681
1681
|
thinking: "Thinking",
|
|
1682
1682
|
answering: "Answering",
|
|
1683
|
+
mcpApp: {
|
|
1684
|
+
loading: "Loading MCP App"
|
|
1685
|
+
},
|
|
1683
1686
|
contextCompression: {
|
|
1684
1687
|
running: "Automatically compressing context",
|
|
1685
1688
|
success: "Context automatically compressed",
|
|
@@ -2070,6 +2073,9 @@ var zh_CN_default = {
|
|
|
2070
2073
|
loading: "\u6B63\u5728\u52A0\u8F7D",
|
|
2071
2074
|
thinking: "\u6B63\u5728\u601D\u8003",
|
|
2072
2075
|
answering: "\u6B63\u5728\u751F\u6210",
|
|
2076
|
+
mcpApp: {
|
|
2077
|
+
loading: "\u6B63\u5728\u52A0\u8F7D MCP App"
|
|
2078
|
+
},
|
|
2073
2079
|
contextCompression: {
|
|
2074
2080
|
running: "\u6B63\u5728\u81EA\u52A8\u538B\u7F29\u4E0A\u4E0B\u6587",
|
|
2075
2081
|
success: "\u4E0A\u4E0B\u6587\u5DF2\u81EA\u52A8\u538B\u7F29",
|
|
@@ -7738,8 +7744,8 @@ function useSlashCommands({
|
|
|
7738
7744
|
}
|
|
7739
7745
|
|
|
7740
7746
|
// src/components/thread/messages/ai.tsx
|
|
7741
|
-
import * as
|
|
7742
|
-
import { ChevronDown as ChevronDown4, Clock3 as Clock32, Loader2 as
|
|
7747
|
+
import * as React36 from "react";
|
|
7748
|
+
import { ChevronDown as ChevronDown4, Clock3 as Clock32, Loader2 as Loader28 } from "lucide-react";
|
|
7743
7749
|
|
|
7744
7750
|
// src/lib/agent-run-render-tree.ts
|
|
7745
7751
|
function isTextContent(content) {
|
|
@@ -11661,8 +11667,985 @@ function hasLegacySurface(surface) {
|
|
|
11661
11667
|
return !!surface?.componentTree;
|
|
11662
11668
|
}
|
|
11663
11669
|
|
|
11664
|
-
// src/components/thread/messages/
|
|
11670
|
+
// src/components/thread/messages/mcp-app.tsx
|
|
11671
|
+
import * as React35 from "react";
|
|
11672
|
+
import {
|
|
11673
|
+
resolveLocalizedText as resolveLocalizedText3
|
|
11674
|
+
} from "@xpert-ai/chatkit-types";
|
|
11675
|
+
import { AlertCircle as AlertCircle2, Loader2 as Loader27 } from "lucide-react";
|
|
11665
11676
|
import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
11677
|
+
var EMPTY_INPUT_SCHEMA = {
|
|
11678
|
+
type: "object",
|
|
11679
|
+
properties: {}
|
|
11680
|
+
};
|
|
11681
|
+
function isRecord5(value) {
|
|
11682
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
11683
|
+
}
|
|
11684
|
+
function readRecord(value) {
|
|
11685
|
+
return isRecord5(value) ? value : void 0;
|
|
11686
|
+
}
|
|
11687
|
+
function readNonEmptyRecord(value) {
|
|
11688
|
+
const record = readRecord(value);
|
|
11689
|
+
return record && Object.keys(record).length ? record : void 0;
|
|
11690
|
+
}
|
|
11691
|
+
function readString3(value) {
|
|
11692
|
+
return typeof value === "string" ? value : void 0;
|
|
11693
|
+
}
|
|
11694
|
+
function readBoolean(value) {
|
|
11695
|
+
return typeof value === "boolean" ? value : void 0;
|
|
11696
|
+
}
|
|
11697
|
+
function readLocalizedText(value) {
|
|
11698
|
+
if (typeof value === "string") return value;
|
|
11699
|
+
if (isRecord5(value)) return value;
|
|
11700
|
+
return void 0;
|
|
11701
|
+
}
|
|
11702
|
+
function readIconDefinition(value) {
|
|
11703
|
+
if (!isRecord5(value)) return void 0;
|
|
11704
|
+
return typeof value.type === "string" && typeof value.value === "string" ? value : void 0;
|
|
11705
|
+
}
|
|
11706
|
+
function readStringList(value) {
|
|
11707
|
+
if (!Array.isArray(value)) return void 0;
|
|
11708
|
+
const strings = value.filter((item) => typeof item === "string");
|
|
11709
|
+
return strings.length ? strings : void 0;
|
|
11710
|
+
}
|
|
11711
|
+
function buildXpertApiUrl(apiUrl, path) {
|
|
11712
|
+
const normalizedApiUrl = apiUrl.trim();
|
|
11713
|
+
if (!normalizedApiUrl) return path;
|
|
11714
|
+
try {
|
|
11715
|
+
const url = new URL(normalizedApiUrl);
|
|
11716
|
+
return `${url.origin}${path}`;
|
|
11717
|
+
} catch {
|
|
11718
|
+
return path;
|
|
11719
|
+
}
|
|
11720
|
+
}
|
|
11721
|
+
function appendQuery(path, params) {
|
|
11722
|
+
const query = params.toString();
|
|
11723
|
+
return query ? `${path}?${query}` : path;
|
|
11724
|
+
}
|
|
11725
|
+
function buildMcpAppReviveParams(data) {
|
|
11726
|
+
const params = new URLSearchParams();
|
|
11727
|
+
const add = (key, value) => {
|
|
11728
|
+
if (value) {
|
|
11729
|
+
params.set(key, value);
|
|
11730
|
+
}
|
|
11731
|
+
};
|
|
11732
|
+
add("toolsetId", data.toolsetId);
|
|
11733
|
+
add("serverName", data.serverName);
|
|
11734
|
+
add("toolName", data.toolName);
|
|
11735
|
+
add("toolCallId", data.toolCallId);
|
|
11736
|
+
add("resourceUri", data.resourceUri);
|
|
11737
|
+
add("title", typeof data.title === "string" ? data.title : void 0);
|
|
11738
|
+
add("token", data.appInstanceToken);
|
|
11739
|
+
return params;
|
|
11740
|
+
}
|
|
11741
|
+
function buildMcpAppEndpointPath(data, endpoint) {
|
|
11742
|
+
return appendQuery(
|
|
11743
|
+
`/api/xpert-toolset/mcp-apps/${encodeURIComponent(
|
|
11744
|
+
data.appInstanceId
|
|
11745
|
+
)}/${endpoint}`,
|
|
11746
|
+
buildMcpAppReviveParams(data)
|
|
11747
|
+
);
|
|
11748
|
+
}
|
|
11749
|
+
function escapeHtmlAttribute(value) {
|
|
11750
|
+
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">");
|
|
11751
|
+
}
|
|
11752
|
+
function domains(values) {
|
|
11753
|
+
return values?.filter((value) => value.trim()).join(" ") ?? "";
|
|
11754
|
+
}
|
|
11755
|
+
function buildCsp(csp) {
|
|
11756
|
+
const resourceDomains = domains(csp?.resourceDomains);
|
|
11757
|
+
const connectDomains = domains(csp?.connectDomains) || "'none'";
|
|
11758
|
+
const frameDomains = domains(csp?.frameDomains) || "'none'";
|
|
11759
|
+
const baseUriDomains = domains(csp?.baseUriDomains) || "'self'";
|
|
11760
|
+
return [
|
|
11761
|
+
"default-src 'none'",
|
|
11762
|
+
`script-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11763
|
+
`style-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11764
|
+
`img-src data: blob: ${resourceDomains}`.trim(),
|
|
11765
|
+
`media-src data: blob: ${resourceDomains}`.trim(),
|
|
11766
|
+
`font-src data: ${resourceDomains}`.trim(),
|
|
11767
|
+
`connect-src ${connectDomains}`,
|
|
11768
|
+
`frame-src ${frameDomains}`,
|
|
11769
|
+
`base-uri ${baseUriDomains}`
|
|
11770
|
+
].join("; ");
|
|
11771
|
+
}
|
|
11772
|
+
function injectHeadContent(html, content) {
|
|
11773
|
+
if (/<head[^>]*>/i.test(html)) {
|
|
11774
|
+
return html.replace(/<head([^>]*)>/i, `<head$1>${content}`);
|
|
11775
|
+
}
|
|
11776
|
+
return `<!doctype html><html><head>${content}</head><body>${html}</body></html>`;
|
|
11777
|
+
}
|
|
11778
|
+
function injectCsp(html, csp) {
|
|
11779
|
+
const meta = `<meta http-equiv="Content-Security-Policy" content="${escapeHtmlAttribute(
|
|
11780
|
+
buildCsp(csp)
|
|
11781
|
+
)}">`;
|
|
11782
|
+
return injectHeadContent(html, meta);
|
|
11783
|
+
}
|
|
11784
|
+
function decodeResourceHtml(resource) {
|
|
11785
|
+
if (typeof resource.text === "string") {
|
|
11786
|
+
return resource.text;
|
|
11787
|
+
}
|
|
11788
|
+
if (typeof resource.blob !== "string") {
|
|
11789
|
+
return null;
|
|
11790
|
+
}
|
|
11791
|
+
try {
|
|
11792
|
+
const decoded = window.atob(resource.blob);
|
|
11793
|
+
const escaped = Array.from(decoded).map((char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`).join("");
|
|
11794
|
+
return decodeURIComponent(escaped);
|
|
11795
|
+
} catch {
|
|
11796
|
+
try {
|
|
11797
|
+
return window.atob(resource.blob);
|
|
11798
|
+
} catch {
|
|
11799
|
+
return null;
|
|
11800
|
+
}
|
|
11801
|
+
}
|
|
11802
|
+
}
|
|
11803
|
+
function normalizeCspMetadata(value) {
|
|
11804
|
+
const raw = readRecord(value);
|
|
11805
|
+
if (!raw) return void 0;
|
|
11806
|
+
const csp = {};
|
|
11807
|
+
const connectDomains = readStringList(raw.connectDomains);
|
|
11808
|
+
const resourceDomains = readStringList(raw.resourceDomains);
|
|
11809
|
+
const frameDomains = readStringList(raw.frameDomains);
|
|
11810
|
+
const baseUriDomains = readStringList(raw.baseUriDomains);
|
|
11811
|
+
if (connectDomains) csp.connectDomains = connectDomains;
|
|
11812
|
+
if (resourceDomains) csp.resourceDomains = resourceDomains;
|
|
11813
|
+
if (frameDomains) csp.frameDomains = frameDomains;
|
|
11814
|
+
if (baseUriDomains) csp.baseUriDomains = baseUriDomains;
|
|
11815
|
+
return Object.keys(csp).length ? csp : void 0;
|
|
11816
|
+
}
|
|
11817
|
+
function normalizePermissionGrant(value) {
|
|
11818
|
+
return value === true || isRecord5(value) ? value : void 0;
|
|
11819
|
+
}
|
|
11820
|
+
function normalizePermissionsMetadata(value) {
|
|
11821
|
+
const raw = readRecord(value);
|
|
11822
|
+
if (!raw) return void 0;
|
|
11823
|
+
const permissions = {};
|
|
11824
|
+
const camera = normalizePermissionGrant(raw.camera);
|
|
11825
|
+
const microphone = normalizePermissionGrant(raw.microphone);
|
|
11826
|
+
const geolocation = normalizePermissionGrant(raw.geolocation);
|
|
11827
|
+
const clipboardWrite = normalizePermissionGrant(raw.clipboardWrite);
|
|
11828
|
+
if (camera !== void 0) permissions.camera = camera;
|
|
11829
|
+
if (microphone !== void 0) permissions.microphone = microphone;
|
|
11830
|
+
if (geolocation !== void 0) permissions.geolocation = geolocation;
|
|
11831
|
+
if (clipboardWrite !== void 0) permissions.clipboardWrite = clipboardWrite;
|
|
11832
|
+
return Object.keys(permissions).length ? permissions : void 0;
|
|
11833
|
+
}
|
|
11834
|
+
function normalizeJsonRpcMessage(value) {
|
|
11835
|
+
const data = typeof value === "string" ? (() => {
|
|
11836
|
+
try {
|
|
11837
|
+
return JSON.parse(value);
|
|
11838
|
+
} catch {
|
|
11839
|
+
return null;
|
|
11840
|
+
}
|
|
11841
|
+
})() : value;
|
|
11842
|
+
if (!isRecord5(data) || typeof data.method !== "string") {
|
|
11843
|
+
return null;
|
|
11844
|
+
}
|
|
11845
|
+
return data;
|
|
11846
|
+
}
|
|
11847
|
+
function jsonRpcResult(id, result) {
|
|
11848
|
+
return {
|
|
11849
|
+
jsonrpc: "2.0",
|
|
11850
|
+
id: id ?? null,
|
|
11851
|
+
result
|
|
11852
|
+
};
|
|
11853
|
+
}
|
|
11854
|
+
function jsonRpcError(id, message) {
|
|
11855
|
+
return {
|
|
11856
|
+
jsonrpc: "2.0",
|
|
11857
|
+
id: id ?? null,
|
|
11858
|
+
error: {
|
|
11859
|
+
code: -32e3,
|
|
11860
|
+
message
|
|
11861
|
+
}
|
|
11862
|
+
};
|
|
11863
|
+
}
|
|
11864
|
+
function getErrorMessage(error) {
|
|
11865
|
+
return error instanceof Error ? error.message : String(error);
|
|
11866
|
+
}
|
|
11867
|
+
function getContainerDimensions(element) {
|
|
11868
|
+
if (!element) return null;
|
|
11869
|
+
const rect = element.getBoundingClientRect();
|
|
11870
|
+
return {
|
|
11871
|
+
width: rect.width,
|
|
11872
|
+
height: rect.height
|
|
11873
|
+
};
|
|
11874
|
+
}
|
|
11875
|
+
function normalizeHostLocale(locale) {
|
|
11876
|
+
return locale?.trim() || navigator.language || "en-US";
|
|
11877
|
+
}
|
|
11878
|
+
function getLocaleLanguage(locale) {
|
|
11879
|
+
return locale.split(/[-_]/)[0]?.toLowerCase() || locale.toLowerCase();
|
|
11880
|
+
}
|
|
11881
|
+
function getLocaleDirection(locale) {
|
|
11882
|
+
const language = getLocaleLanguage(locale);
|
|
11883
|
+
return ["ar", "fa", "he", "ur"].includes(language) ? "rtl" : "ltr";
|
|
11884
|
+
}
|
|
11885
|
+
function setHtmlAttribute(attrs, name, value) {
|
|
11886
|
+
const escaped = escapeHtmlAttribute(value);
|
|
11887
|
+
const pattern = new RegExp(`\\s${name}=("[^"]*"|'[^']*'|[^\\s>]*)`, "i");
|
|
11888
|
+
if (pattern.test(attrs)) {
|
|
11889
|
+
return attrs.replace(pattern, ` ${name}="${escaped}"`);
|
|
11890
|
+
}
|
|
11891
|
+
return `${attrs} ${name}="${escaped}"`;
|
|
11892
|
+
}
|
|
11893
|
+
function injectMcpAppLocale(html, locale) {
|
|
11894
|
+
const normalizedLocale = normalizeHostLocale(locale);
|
|
11895
|
+
const direction = getLocaleDirection(normalizedLocale);
|
|
11896
|
+
if (/<html[\s>]/i.test(html)) {
|
|
11897
|
+
return html.replace(/<html([^>]*)>/i, (_match, attrs) => {
|
|
11898
|
+
const withLang = setHtmlAttribute(attrs, "lang", normalizedLocale);
|
|
11899
|
+
const withDirection = setHtmlAttribute(withLang, "dir", direction);
|
|
11900
|
+
return `<html${withDirection}>`;
|
|
11901
|
+
});
|
|
11902
|
+
}
|
|
11903
|
+
return `<!doctype html><html lang="${escapeHtmlAttribute(
|
|
11904
|
+
normalizedLocale
|
|
11905
|
+
)}" dir="${direction}"><head></head><body>${html}</body></html>`;
|
|
11906
|
+
}
|
|
11907
|
+
var MCP_APP_THEME_COLOR_TOKENS = [
|
|
11908
|
+
["--background", "--mcp-app-color-background", "oklch(1 0 0)"],
|
|
11909
|
+
["--foreground", "--mcp-app-color-foreground", "oklch(0.145 0 0)"],
|
|
11910
|
+
["--card", "--mcp-app-color-card", "oklch(1 0 0)"],
|
|
11911
|
+
[
|
|
11912
|
+
"--card-foreground",
|
|
11913
|
+
"--mcp-app-color-card-foreground",
|
|
11914
|
+
"oklch(0.145 0 0)"
|
|
11915
|
+
],
|
|
11916
|
+
["--popover", "--mcp-app-color-popover", "oklch(1 0 0)"],
|
|
11917
|
+
[
|
|
11918
|
+
"--popover-foreground",
|
|
11919
|
+
"--mcp-app-color-popover-foreground",
|
|
11920
|
+
"oklch(0.145 0 0)"
|
|
11921
|
+
],
|
|
11922
|
+
["--primary", "--mcp-app-color-primary", "oklch(0.205 0 0)"],
|
|
11923
|
+
[
|
|
11924
|
+
"--primary-foreground",
|
|
11925
|
+
"--mcp-app-color-primary-foreground",
|
|
11926
|
+
"oklch(0.985 0 0)"
|
|
11927
|
+
],
|
|
11928
|
+
["--secondary", "--mcp-app-color-secondary", "oklch(0.97 0 0)"],
|
|
11929
|
+
[
|
|
11930
|
+
"--secondary-foreground",
|
|
11931
|
+
"--mcp-app-color-secondary-foreground",
|
|
11932
|
+
"oklch(0.205 0 0)"
|
|
11933
|
+
],
|
|
11934
|
+
["--muted", "--mcp-app-color-muted", "oklch(0.97 0 0)"],
|
|
11935
|
+
[
|
|
11936
|
+
"--muted-foreground",
|
|
11937
|
+
"--mcp-app-color-muted-foreground",
|
|
11938
|
+
"oklch(0.556 0 0)"
|
|
11939
|
+
],
|
|
11940
|
+
["--accent", "--mcp-app-color-accent", "oklch(0.97 0 0)"],
|
|
11941
|
+
[
|
|
11942
|
+
"--accent-foreground",
|
|
11943
|
+
"--mcp-app-color-accent-foreground",
|
|
11944
|
+
"oklch(0.205 0 0)"
|
|
11945
|
+
],
|
|
11946
|
+
[
|
|
11947
|
+
"--destructive",
|
|
11948
|
+
"--mcp-app-color-destructive",
|
|
11949
|
+
"oklch(0.577 0.245 27.325)"
|
|
11950
|
+
],
|
|
11951
|
+
[
|
|
11952
|
+
"--destructive-foreground",
|
|
11953
|
+
"--mcp-app-color-destructive-foreground",
|
|
11954
|
+
"oklch(0.985 0 0)"
|
|
11955
|
+
],
|
|
11956
|
+
["--border", "--mcp-app-color-border", "oklch(0.922 0 0)"],
|
|
11957
|
+
["--input", "--mcp-app-color-input", "oklch(0.922 0 0)"],
|
|
11958
|
+
["--ring", "--mcp-app-color-ring", "oklch(0.708 0 0)"],
|
|
11959
|
+
["--chart-1", "--mcp-app-color-chart-1", "oklch(0.87 0 0)"],
|
|
11960
|
+
["--chart-2", "--mcp-app-color-chart-2", "oklch(0.556 0 0)"],
|
|
11961
|
+
["--chart-3", "--mcp-app-color-chart-3", "oklch(0.439 0 0)"],
|
|
11962
|
+
["--chart-4", "--mcp-app-color-chart-4", "oklch(0.371 0 0)"],
|
|
11963
|
+
["--chart-5", "--mcp-app-color-chart-5", "oklch(0.269 0 0)"]
|
|
11964
|
+
];
|
|
11965
|
+
function sanitizeCssValue(value) {
|
|
11966
|
+
return value.replace(/[;{}<>]/g, "").trim();
|
|
11967
|
+
}
|
|
11968
|
+
function normalizeColorCssValue(value) {
|
|
11969
|
+
const trimmed = sanitizeCssValue(value);
|
|
11970
|
+
if (!trimmed) return "";
|
|
11971
|
+
if (/^(#|rgb\(|rgba\(|hsl\(|hsla\(|oklch\(|oklab\(|color\(|var\()/i.test(
|
|
11972
|
+
trimmed
|
|
11973
|
+
)) {
|
|
11974
|
+
return trimmed;
|
|
11975
|
+
}
|
|
11976
|
+
if (/^-?\d/.test(trimmed) && /\s/.test(trimmed)) {
|
|
11977
|
+
return `hsl(${trimmed})`;
|
|
11978
|
+
}
|
|
11979
|
+
return trimmed;
|
|
11980
|
+
}
|
|
11981
|
+
function getHostThemeMode() {
|
|
11982
|
+
return document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
11983
|
+
}
|
|
11984
|
+
function readHostCssVariable(element, variableName) {
|
|
11985
|
+
const candidates = [
|
|
11986
|
+
element,
|
|
11987
|
+
element === document.documentElement ? null : document.documentElement
|
|
11988
|
+
].filter(Boolean);
|
|
11989
|
+
for (const candidate of candidates) {
|
|
11990
|
+
const value = window.getComputedStyle(candidate).getPropertyValue(variableName).trim();
|
|
11991
|
+
if (value) {
|
|
11992
|
+
return value;
|
|
11993
|
+
}
|
|
11994
|
+
}
|
|
11995
|
+
return "";
|
|
11996
|
+
}
|
|
11997
|
+
function buildMcpAppTheme(element) {
|
|
11998
|
+
const source = element ?? document.documentElement;
|
|
11999
|
+
const sourceStyles = window.getComputedStyle(source);
|
|
12000
|
+
const cssVariables = {
|
|
12001
|
+
"--mcp-app-color-scheme": getHostThemeMode(),
|
|
12002
|
+
"--mcp-app-font-sans": sanitizeCssValue(
|
|
12003
|
+
sourceStyles.fontFamily || "ui-sans-serif, system-ui, sans-serif"
|
|
12004
|
+
),
|
|
12005
|
+
"--mcp-app-font-mono": sanitizeCssValue(
|
|
12006
|
+
readHostCssVariable(source, "--font-mono") || "ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
12007
|
+
),
|
|
12008
|
+
"--mcp-app-radius": sanitizeCssValue(
|
|
12009
|
+
readHostCssVariable(source, "--radius") || "0.5rem"
|
|
12010
|
+
)
|
|
12011
|
+
};
|
|
12012
|
+
for (const [
|
|
12013
|
+
hostVariable,
|
|
12014
|
+
appVariable,
|
|
12015
|
+
fallback
|
|
12016
|
+
] of MCP_APP_THEME_COLOR_TOKENS) {
|
|
12017
|
+
cssVariables[appVariable] = normalizeColorCssValue(readHostCssVariable(source, hostVariable)) || fallback;
|
|
12018
|
+
}
|
|
12019
|
+
return {
|
|
12020
|
+
mode: getHostThemeMode(),
|
|
12021
|
+
cssVariables
|
|
12022
|
+
};
|
|
12023
|
+
}
|
|
12024
|
+
function injectMcpAppTheme(html, theme) {
|
|
12025
|
+
const declarations = Object.entries(theme.cssVariables).map(([name, value]) => `${name}: ${sanitizeCssValue(value)};`).join("");
|
|
12026
|
+
const style = `<style id="mcp-app-host-theme">:root{color-scheme:${theme.mode};${declarations}}</style>`;
|
|
12027
|
+
return injectHeadContent(html, style);
|
|
12028
|
+
}
|
|
12029
|
+
function normalizeInputSchema(value) {
|
|
12030
|
+
const raw = readRecord(value);
|
|
12031
|
+
if (!raw || raw.type !== void 0 && raw.type !== "object") {
|
|
12032
|
+
return EMPTY_INPUT_SCHEMA;
|
|
12033
|
+
}
|
|
12034
|
+
return {
|
|
12035
|
+
...raw,
|
|
12036
|
+
type: "object",
|
|
12037
|
+
properties: readRecord(raw.properties) ?? {},
|
|
12038
|
+
...Array.isArray(raw.required) && raw.required.every((item) => typeof item === "string") ? { required: raw.required } : {}
|
|
12039
|
+
};
|
|
12040
|
+
}
|
|
12041
|
+
function normalizeMcpAppToolInfo(value, data, resource = {}) {
|
|
12042
|
+
const raw = readRecord(value) ?? {};
|
|
12043
|
+
const rawTool = readRecord(raw.tool) ?? {};
|
|
12044
|
+
const rawName = readString3(raw.name);
|
|
12045
|
+
const originalName = readString3(rawTool.name) ?? readString3(raw.originalName) ?? data.toolName;
|
|
12046
|
+
const title = readLocalizedText(rawTool.title) ?? readLocalizedText(raw.title) ?? resource.title ?? data.title ?? data.toolName;
|
|
12047
|
+
const description = readLocalizedText(rawTool.description) ?? readLocalizedText(raw.description) ?? resource.description ?? data.description;
|
|
12048
|
+
const icon = readIconDefinition(rawTool.icon) ?? readIconDefinition(raw.icon) ?? resource.icon ?? data.icon;
|
|
12049
|
+
return {
|
|
12050
|
+
...raw,
|
|
12051
|
+
id: data.toolCallId,
|
|
12052
|
+
name: rawName ?? data.toolName,
|
|
12053
|
+
originalName,
|
|
12054
|
+
title,
|
|
12055
|
+
...description ? { description } : {},
|
|
12056
|
+
...icon ? { icon } : {},
|
|
12057
|
+
serverName: readString3(raw.serverName) ?? data.serverName,
|
|
12058
|
+
toolCallId: readString3(raw.toolCallId) ?? data.toolCallId,
|
|
12059
|
+
toolsetId: readString3(raw.toolsetId) ?? data.toolsetId,
|
|
12060
|
+
tool: {
|
|
12061
|
+
...rawTool,
|
|
12062
|
+
name: originalName,
|
|
12063
|
+
title: readLocalizedText(rawTool.title) ?? title,
|
|
12064
|
+
inputSchema: normalizeInputSchema(
|
|
12065
|
+
rawTool.inputSchema ?? raw.inputSchema
|
|
12066
|
+
),
|
|
12067
|
+
...description ? {
|
|
12068
|
+
description: readLocalizedText(rawTool.description) ?? description
|
|
12069
|
+
} : {},
|
|
12070
|
+
...icon ? { icon: readIconDefinition(rawTool.icon) ?? icon } : {}
|
|
12071
|
+
}
|
|
12072
|
+
};
|
|
12073
|
+
}
|
|
12074
|
+
function hasPermissionGrant(value) {
|
|
12075
|
+
return value === true || isRecord5(value);
|
|
12076
|
+
}
|
|
12077
|
+
function buildIframeAllow(permissions) {
|
|
12078
|
+
if (!permissions) return void 0;
|
|
12079
|
+
const policies = [];
|
|
12080
|
+
if (hasPermissionGrant(permissions.camera)) {
|
|
12081
|
+
policies.push("camera *");
|
|
12082
|
+
}
|
|
12083
|
+
if (hasPermissionGrant(permissions.microphone)) {
|
|
12084
|
+
policies.push("microphone *");
|
|
12085
|
+
}
|
|
12086
|
+
if (hasPermissionGrant(permissions.geolocation)) {
|
|
12087
|
+
policies.push("geolocation *");
|
|
12088
|
+
}
|
|
12089
|
+
if (hasPermissionGrant(permissions.clipboardWrite)) {
|
|
12090
|
+
policies.push("clipboard-write *");
|
|
12091
|
+
}
|
|
12092
|
+
return policies.length ? policies.join("; ") : void 0;
|
|
12093
|
+
}
|
|
12094
|
+
function buildSandboxAttribute() {
|
|
12095
|
+
return ["allow-downloads", "allow-forms", "allow-modals", "allow-scripts"].join(
|
|
12096
|
+
" "
|
|
12097
|
+
);
|
|
12098
|
+
}
|
|
12099
|
+
function stringifyToolResult(value) {
|
|
12100
|
+
if (typeof value === "string") return value;
|
|
12101
|
+
try {
|
|
12102
|
+
return JSON.stringify(value ?? null);
|
|
12103
|
+
} catch {
|
|
12104
|
+
return String(value);
|
|
12105
|
+
}
|
|
12106
|
+
}
|
|
12107
|
+
function createTextContentBlock(text) {
|
|
12108
|
+
return {
|
|
12109
|
+
type: "text",
|
|
12110
|
+
text
|
|
12111
|
+
};
|
|
12112
|
+
}
|
|
12113
|
+
function normalizeContentBlocks(value) {
|
|
12114
|
+
if (!Array.isArray(value)) return [];
|
|
12115
|
+
return value.filter(
|
|
12116
|
+
(item) => isRecord5(item) && typeof item.type === "string"
|
|
12117
|
+
);
|
|
12118
|
+
}
|
|
12119
|
+
function extractLegacyArtifactMeta(value) {
|
|
12120
|
+
const meta = readRecord(value._meta);
|
|
12121
|
+
if (meta) return meta;
|
|
12122
|
+
const entries = Object.entries(value).filter(
|
|
12123
|
+
([key]) => key !== "structuredContent" && key !== "isError"
|
|
12124
|
+
);
|
|
12125
|
+
return entries.length ? Object.fromEntries(entries) : void 0;
|
|
12126
|
+
}
|
|
12127
|
+
function normalizeToolArtifact(value) {
|
|
12128
|
+
if (isRecord5(value)) {
|
|
12129
|
+
return {
|
|
12130
|
+
...readRecord(value.structuredContent) ? { structuredContent: readRecord(value.structuredContent) } : {},
|
|
12131
|
+
...readBoolean(value.isError) !== void 0 ? { isError: readBoolean(value.isError) } : {},
|
|
12132
|
+
...extractLegacyArtifactMeta(value) ? { _meta: extractLegacyArtifactMeta(value) } : {}
|
|
12133
|
+
};
|
|
12134
|
+
}
|
|
12135
|
+
if (!Array.isArray(value)) return {};
|
|
12136
|
+
return value.reduce((result, item) => {
|
|
12137
|
+
const normalized = normalizeToolArtifact(item);
|
|
12138
|
+
return {
|
|
12139
|
+
...result,
|
|
12140
|
+
...normalized,
|
|
12141
|
+
_meta: result._meta ?? normalized._meta,
|
|
12142
|
+
structuredContent: result.structuredContent ?? normalized.structuredContent,
|
|
12143
|
+
isError: result.isError ?? normalized.isError
|
|
12144
|
+
};
|
|
12145
|
+
}, {});
|
|
12146
|
+
}
|
|
12147
|
+
function normalizeCallToolResult(value) {
|
|
12148
|
+
if (value === void 0) {
|
|
12149
|
+
return {
|
|
12150
|
+
content: []
|
|
12151
|
+
};
|
|
12152
|
+
}
|
|
12153
|
+
if (isRecord5(value)) {
|
|
12154
|
+
if (value.toolResult !== void 0 && !Array.isArray(value.content)) {
|
|
12155
|
+
return normalizeCallToolResult(value.toolResult);
|
|
12156
|
+
}
|
|
12157
|
+
const content = normalizeContentBlocks(value.content);
|
|
12158
|
+
const result = {
|
|
12159
|
+
content: content.length ? content : []
|
|
12160
|
+
};
|
|
12161
|
+
const structuredContent = readRecord(value.structuredContent);
|
|
12162
|
+
const isError = readBoolean(value.isError);
|
|
12163
|
+
const meta = readRecord(value._meta);
|
|
12164
|
+
if (structuredContent) result.structuredContent = structuredContent;
|
|
12165
|
+
if (isError !== void 0) result.isError = isError;
|
|
12166
|
+
if (meta) result._meta = meta;
|
|
12167
|
+
return result;
|
|
12168
|
+
}
|
|
12169
|
+
if (Array.isArray(value) && value.length >= 2) {
|
|
12170
|
+
const [content, artifact] = value;
|
|
12171
|
+
const artifactFields = normalizeToolArtifact(artifact);
|
|
12172
|
+
return {
|
|
12173
|
+
content: [
|
|
12174
|
+
createTextContentBlock(
|
|
12175
|
+
typeof content === "string" ? content : stringifyToolResult(content)
|
|
12176
|
+
)
|
|
12177
|
+
],
|
|
12178
|
+
...artifactFields
|
|
12179
|
+
};
|
|
12180
|
+
}
|
|
12181
|
+
return {
|
|
12182
|
+
content: [createTextContentBlock(stringifyToolResult(value))]
|
|
12183
|
+
};
|
|
12184
|
+
}
|
|
12185
|
+
function normalizeMcpAppResourceResponse(value, data) {
|
|
12186
|
+
const raw = readRecord(value);
|
|
12187
|
+
if (!raw) {
|
|
12188
|
+
throw new Error("MCP App resource response must be an object");
|
|
12189
|
+
}
|
|
12190
|
+
const html = decodeResourceHtml(raw);
|
|
12191
|
+
if (!html) {
|
|
12192
|
+
throw new Error("MCP App resource did not include HTML content");
|
|
12193
|
+
}
|
|
12194
|
+
const resourceInfo = {
|
|
12195
|
+
title: readLocalizedText(raw.title),
|
|
12196
|
+
description: readLocalizedText(raw.description),
|
|
12197
|
+
icon: readIconDefinition(raw.icon)
|
|
12198
|
+
};
|
|
12199
|
+
const toolInput = readNonEmptyRecord(raw.toolInput) ?? data.toolInput ?? readRecord(raw.toolInput) ?? {};
|
|
12200
|
+
const rawToolResult = raw.toolResult ?? data.toolResult;
|
|
12201
|
+
return {
|
|
12202
|
+
uri: readString3(raw.uri),
|
|
12203
|
+
mimeType: readString3(raw.mimeType),
|
|
12204
|
+
html,
|
|
12205
|
+
resourceUri: readString3(raw.resourceUri),
|
|
12206
|
+
title: resourceInfo.title,
|
|
12207
|
+
description: resourceInfo.description,
|
|
12208
|
+
icon: resourceInfo.icon,
|
|
12209
|
+
csp: normalizeCspMetadata(raw.csp),
|
|
12210
|
+
permissions: normalizePermissionsMetadata(raw.permissions),
|
|
12211
|
+
domain: readString3(raw.domain),
|
|
12212
|
+
prefersBorder: readBoolean(raw.prefersBorder),
|
|
12213
|
+
toolInfo: normalizeMcpAppToolInfo(raw.toolInfo, data, resourceInfo),
|
|
12214
|
+
toolInput,
|
|
12215
|
+
hasToolResult: rawToolResult !== void 0,
|
|
12216
|
+
toolResult: normalizeCallToolResult(rawToolResult),
|
|
12217
|
+
rawToolResult
|
|
12218
|
+
};
|
|
12219
|
+
}
|
|
12220
|
+
function isHttpUrl(value) {
|
|
12221
|
+
try {
|
|
12222
|
+
const url = new URL(value);
|
|
12223
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
12224
|
+
} catch {
|
|
12225
|
+
return false;
|
|
12226
|
+
}
|
|
12227
|
+
}
|
|
12228
|
+
function contentBlocksToText(content) {
|
|
12229
|
+
if (!Array.isArray(content)) return null;
|
|
12230
|
+
const parts = content.map((item) => {
|
|
12231
|
+
if (!isRecord5(item)) return "";
|
|
12232
|
+
if (item.type === "text" && typeof item.text === "string") {
|
|
12233
|
+
return item.text;
|
|
12234
|
+
}
|
|
12235
|
+
if (item.type === "resource_link" && typeof item.uri === "string") {
|
|
12236
|
+
return item.uri;
|
|
12237
|
+
}
|
|
12238
|
+
if (item.type === "image" || item.type === "audio") {
|
|
12239
|
+
return `[${item.type}]`;
|
|
12240
|
+
}
|
|
12241
|
+
return stringifyToolResult(item);
|
|
12242
|
+
}).map((part) => part.trim()).filter(Boolean);
|
|
12243
|
+
return parts.length ? parts.join("\n\n") : null;
|
|
12244
|
+
}
|
|
12245
|
+
function isMcpAppComponentData(data) {
|
|
12246
|
+
return isRecord5(data) && data.type === "McpApp" && typeof data.appInstanceId === "string" && typeof data.resourceUri === "string";
|
|
12247
|
+
}
|
|
12248
|
+
function McpAppMessage({
|
|
12249
|
+
data,
|
|
12250
|
+
className
|
|
12251
|
+
}) {
|
|
12252
|
+
const { i18n: i18n2 } = useChatkitTranslation();
|
|
12253
|
+
const {
|
|
12254
|
+
apiUrl,
|
|
12255
|
+
authenticatedFetch,
|
|
12256
|
+
isLoading: streamIsLoading,
|
|
12257
|
+
submit
|
|
12258
|
+
} = useStreamContext();
|
|
12259
|
+
const iframeRef = React35.useRef(null);
|
|
12260
|
+
const containerRef = React35.useRef(null);
|
|
12261
|
+
const initializedRef = React35.useRef(false);
|
|
12262
|
+
const sentInitialResultRef = React35.useRef(false);
|
|
12263
|
+
const modelContextRef = React35.useRef(null);
|
|
12264
|
+
const [resource, setResource] = React35.useState(null);
|
|
12265
|
+
const [srcDoc, setSrcDoc] = React35.useState(null);
|
|
12266
|
+
const [height, setHeight] = React35.useState(420);
|
|
12267
|
+
const [error, setError] = React35.useState(null);
|
|
12268
|
+
const [isLoading, setIsLoading] = React35.useState(true);
|
|
12269
|
+
const resourceUrl = React35.useMemo(
|
|
12270
|
+
() => buildXpertApiUrl(
|
|
12271
|
+
apiUrl,
|
|
12272
|
+
buildMcpAppEndpointPath(data, "resource")
|
|
12273
|
+
),
|
|
12274
|
+
[apiUrl, data]
|
|
12275
|
+
);
|
|
12276
|
+
const rpcUrl = React35.useMemo(
|
|
12277
|
+
() => buildXpertApiUrl(
|
|
12278
|
+
apiUrl,
|
|
12279
|
+
buildMcpAppEndpointPath(data, "rpc")
|
|
12280
|
+
),
|
|
12281
|
+
[apiUrl, data]
|
|
12282
|
+
);
|
|
12283
|
+
const postToApp = React35.useCallback((message) => {
|
|
12284
|
+
iframeRef.current?.contentWindow?.postMessage(message, "*");
|
|
12285
|
+
}, []);
|
|
12286
|
+
const callHostRpc = React35.useCallback(
|
|
12287
|
+
async (request) => {
|
|
12288
|
+
const response = await authenticatedFetch(rpcUrl, {
|
|
12289
|
+
method: "POST",
|
|
12290
|
+
headers: {
|
|
12291
|
+
"content-type": "application/json"
|
|
12292
|
+
},
|
|
12293
|
+
body: JSON.stringify({
|
|
12294
|
+
jsonrpc: "2.0",
|
|
12295
|
+
id: request.id ?? null,
|
|
12296
|
+
method: request.method,
|
|
12297
|
+
params: request.params
|
|
12298
|
+
})
|
|
12299
|
+
});
|
|
12300
|
+
if (!response.ok) {
|
|
12301
|
+
throw new Error(`MCP App RPC failed with ${response.status}`);
|
|
12302
|
+
}
|
|
12303
|
+
return response.json();
|
|
12304
|
+
},
|
|
12305
|
+
[authenticatedFetch, rpcUrl]
|
|
12306
|
+
);
|
|
12307
|
+
const sendInitialToolNotifications = React35.useCallback(() => {
|
|
12308
|
+
if (!initializedRef.current || sentInitialResultRef.current || !resource) {
|
|
12309
|
+
return;
|
|
12310
|
+
}
|
|
12311
|
+
sentInitialResultRef.current = true;
|
|
12312
|
+
postToApp({
|
|
12313
|
+
jsonrpc: "2.0",
|
|
12314
|
+
method: "ui/notifications/tool-input",
|
|
12315
|
+
params: {
|
|
12316
|
+
arguments: resource.toolInput
|
|
12317
|
+
}
|
|
12318
|
+
});
|
|
12319
|
+
if (!resource.hasToolResult) {
|
|
12320
|
+
return;
|
|
12321
|
+
}
|
|
12322
|
+
postToApp({
|
|
12323
|
+
jsonrpc: "2.0",
|
|
12324
|
+
method: "ui/notifications/tool-result",
|
|
12325
|
+
params: {
|
|
12326
|
+
...resource.toolResult,
|
|
12327
|
+
toolCallId: data.toolCallId,
|
|
12328
|
+
toolName: data.toolName,
|
|
12329
|
+
// Legacy compatibility for apps written before the 2026-01-26 notification shape.
|
|
12330
|
+
result: resource.rawToolResult
|
|
12331
|
+
}
|
|
12332
|
+
});
|
|
12333
|
+
}, [data.toolCallId, data.toolName, postToApp, resource]);
|
|
12334
|
+
React35.useEffect(() => {
|
|
12335
|
+
const controller = new AbortController();
|
|
12336
|
+
initializedRef.current = false;
|
|
12337
|
+
sentInitialResultRef.current = false;
|
|
12338
|
+
setIsLoading(true);
|
|
12339
|
+
setError(null);
|
|
12340
|
+
setResource(null);
|
|
12341
|
+
setSrcDoc(null);
|
|
12342
|
+
void (async () => {
|
|
12343
|
+
try {
|
|
12344
|
+
const response = await authenticatedFetch(resourceUrl, {
|
|
12345
|
+
signal: controller.signal
|
|
12346
|
+
});
|
|
12347
|
+
if (!response.ok) {
|
|
12348
|
+
throw new Error(`MCP App resource failed with ${response.status}`);
|
|
12349
|
+
}
|
|
12350
|
+
const payload = await response.json();
|
|
12351
|
+
const normalizedResource = normalizeMcpAppResourceResponse(
|
|
12352
|
+
payload,
|
|
12353
|
+
data
|
|
12354
|
+
);
|
|
12355
|
+
setResource(normalizedResource);
|
|
12356
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12357
|
+
setSrcDoc(
|
|
12358
|
+
injectMcpAppTheme(
|
|
12359
|
+
injectCsp(
|
|
12360
|
+
injectMcpAppLocale(normalizedResource.html, hostLocale),
|
|
12361
|
+
normalizedResource.csp ?? data.csp
|
|
12362
|
+
),
|
|
12363
|
+
buildMcpAppTheme(containerRef.current)
|
|
12364
|
+
)
|
|
12365
|
+
);
|
|
12366
|
+
} catch (loadError) {
|
|
12367
|
+
if (!controller.signal.aborted) {
|
|
12368
|
+
setError(getErrorMessage(loadError));
|
|
12369
|
+
}
|
|
12370
|
+
} finally {
|
|
12371
|
+
if (!controller.signal.aborted) {
|
|
12372
|
+
setIsLoading(false);
|
|
12373
|
+
}
|
|
12374
|
+
}
|
|
12375
|
+
})();
|
|
12376
|
+
return () => {
|
|
12377
|
+
controller.abort();
|
|
12378
|
+
};
|
|
12379
|
+
}, [
|
|
12380
|
+
authenticatedFetch,
|
|
12381
|
+
data,
|
|
12382
|
+
data.appInstanceId,
|
|
12383
|
+
data.csp,
|
|
12384
|
+
i18n2.language,
|
|
12385
|
+
resourceUrl
|
|
12386
|
+
]);
|
|
12387
|
+
React35.useEffect(() => {
|
|
12388
|
+
sendInitialToolNotifications();
|
|
12389
|
+
}, [sendInitialToolNotifications]);
|
|
12390
|
+
React35.useEffect(() => {
|
|
12391
|
+
const handleMessage = async (event) => {
|
|
12392
|
+
if (event.source !== iframeRef.current?.contentWindow) {
|
|
12393
|
+
return;
|
|
12394
|
+
}
|
|
12395
|
+
const request = normalizeJsonRpcMessage(event.data);
|
|
12396
|
+
if (!request?.method) {
|
|
12397
|
+
return;
|
|
12398
|
+
}
|
|
12399
|
+
if (request.method === "ui/notifications/initialized") {
|
|
12400
|
+
initializedRef.current = true;
|
|
12401
|
+
sendInitialToolNotifications();
|
|
12402
|
+
return;
|
|
12403
|
+
}
|
|
12404
|
+
if (request.method === "ui/notifications/size-changed") {
|
|
12405
|
+
const nextHeight = isRecord5(request.params) && typeof request.params.height === "number" ? request.params.height : null;
|
|
12406
|
+
if (nextHeight !== null) {
|
|
12407
|
+
setHeight(Math.min(900, Math.max(240, Math.round(nextHeight))));
|
|
12408
|
+
}
|
|
12409
|
+
return;
|
|
12410
|
+
}
|
|
12411
|
+
if (request.method === "ui/initialize") {
|
|
12412
|
+
initializedRef.current = true;
|
|
12413
|
+
const permissions = resource?.permissions ?? data.permissions;
|
|
12414
|
+
const csp = resource?.csp ?? data.csp;
|
|
12415
|
+
const toolInfo = resource?.toolInfo ?? normalizeMcpAppToolInfo(void 0, data);
|
|
12416
|
+
const theme = buildMcpAppTheme(containerRef.current);
|
|
12417
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12418
|
+
const hostLanguage = getLocaleLanguage(hostLocale);
|
|
12419
|
+
const hostDirection = getLocaleDirection(hostLocale);
|
|
12420
|
+
postToApp(
|
|
12421
|
+
jsonRpcResult(request.id, {
|
|
12422
|
+
protocolVersion: "2026-01-26",
|
|
12423
|
+
hostInfo: {
|
|
12424
|
+
name: "xpert-chatkit",
|
|
12425
|
+
version: "1.0.0",
|
|
12426
|
+
title: "Xpert ChatKit"
|
|
12427
|
+
},
|
|
12428
|
+
hostCapabilities: {
|
|
12429
|
+
serverTools: {},
|
|
12430
|
+
serverResources: {},
|
|
12431
|
+
openLinks: {},
|
|
12432
|
+
logging: {},
|
|
12433
|
+
message: {
|
|
12434
|
+
text: {}
|
|
12435
|
+
},
|
|
12436
|
+
updateModelContext: {
|
|
12437
|
+
text: {},
|
|
12438
|
+
structuredContent: {}
|
|
12439
|
+
},
|
|
12440
|
+
sandbox: {
|
|
12441
|
+
...permissions ? { permissions } : {},
|
|
12442
|
+
...csp ? { csp } : {}
|
|
12443
|
+
}
|
|
12444
|
+
},
|
|
12445
|
+
hostContext: {
|
|
12446
|
+
toolInfo,
|
|
12447
|
+
theme: theme.mode,
|
|
12448
|
+
themeCssVariables: theme.cssVariables,
|
|
12449
|
+
locale: hostLocale,
|
|
12450
|
+
language: hostLanguage,
|
|
12451
|
+
direction: hostDirection,
|
|
12452
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12453
|
+
displayMode: "inline",
|
|
12454
|
+
availableDisplayModes: ["inline"],
|
|
12455
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12456
|
+
userAgent: "xpert-chatkit",
|
|
12457
|
+
platform: "web",
|
|
12458
|
+
deviceCapabilities: {
|
|
12459
|
+
touch: navigator.maxTouchPoints > 0,
|
|
12460
|
+
hover: window.matchMedia("(hover: hover)").matches
|
|
12461
|
+
}
|
|
12462
|
+
},
|
|
12463
|
+
// Legacy compatibility for apps written before the 2026-01-26 result shape.
|
|
12464
|
+
capabilities: {
|
|
12465
|
+
displayModes: ["inline"],
|
|
12466
|
+
serverTools: true,
|
|
12467
|
+
serverResources: true,
|
|
12468
|
+
openLinks: true
|
|
12469
|
+
},
|
|
12470
|
+
context: {
|
|
12471
|
+
toolInfo,
|
|
12472
|
+
theme: theme.mode,
|
|
12473
|
+
themeCssVariables: theme.cssVariables,
|
|
12474
|
+
locale: hostLocale,
|
|
12475
|
+
language: hostLanguage,
|
|
12476
|
+
direction: hostDirection,
|
|
12477
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12478
|
+
displayMode: "inline",
|
|
12479
|
+
availableDisplayModes: ["inline"],
|
|
12480
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12481
|
+
userAgent: navigator.userAgent,
|
|
12482
|
+
platform: navigator.platform
|
|
12483
|
+
}
|
|
12484
|
+
})
|
|
12485
|
+
);
|
|
12486
|
+
sendInitialToolNotifications();
|
|
12487
|
+
return;
|
|
12488
|
+
}
|
|
12489
|
+
if (request.method === "ui/open-link") {
|
|
12490
|
+
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;
|
|
12491
|
+
if (href && isHttpUrl(href)) {
|
|
12492
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
12493
|
+
if (request.id !== void 0) {
|
|
12494
|
+
postToApp(jsonRpcResult(request.id, {}));
|
|
12495
|
+
}
|
|
12496
|
+
} else if (request.id !== void 0) {
|
|
12497
|
+
postToApp(jsonRpcResult(request.id, { isError: true }));
|
|
12498
|
+
}
|
|
12499
|
+
return;
|
|
12500
|
+
}
|
|
12501
|
+
if (request.method === "ui/update-model-context") {
|
|
12502
|
+
modelContextRef.current = request.params;
|
|
12503
|
+
try {
|
|
12504
|
+
postToApp(await callHostRpc(request));
|
|
12505
|
+
} catch (rpcError) {
|
|
12506
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12507
|
+
}
|
|
12508
|
+
return;
|
|
12509
|
+
}
|
|
12510
|
+
if (request.method === "ui/message") {
|
|
12511
|
+
try {
|
|
12512
|
+
if (!isRecord5(request.params) || request.params.role !== "user" || !Array.isArray(request.params.content)) {
|
|
12513
|
+
throw new Error(
|
|
12514
|
+
'ui/message params must include role "user" and content blocks'
|
|
12515
|
+
);
|
|
12516
|
+
}
|
|
12517
|
+
const hostResponse = await callHostRpc(request);
|
|
12518
|
+
if (isRecord5(hostResponse) && hostResponse.error) {
|
|
12519
|
+
postToApp(hostResponse);
|
|
12520
|
+
return;
|
|
12521
|
+
}
|
|
12522
|
+
const inputText = contentBlocksToText(request.params.content);
|
|
12523
|
+
if (!inputText) {
|
|
12524
|
+
throw new Error("ui/message content did not include text");
|
|
12525
|
+
}
|
|
12526
|
+
await submit(
|
|
12527
|
+
{
|
|
12528
|
+
input: {
|
|
12529
|
+
input: inputText
|
|
12530
|
+
}
|
|
12531
|
+
},
|
|
12532
|
+
{
|
|
12533
|
+
...streamIsLoading ? { followUpMode: "queue" } : {},
|
|
12534
|
+
context: {
|
|
12535
|
+
mcpApp: {
|
|
12536
|
+
appInstanceId: data.appInstanceId,
|
|
12537
|
+
resourceUri: data.resourceUri,
|
|
12538
|
+
toolName: data.toolName,
|
|
12539
|
+
toolCallId: data.toolCallId,
|
|
12540
|
+
modelContext: modelContextRef.current
|
|
12541
|
+
}
|
|
12542
|
+
}
|
|
12543
|
+
}
|
|
12544
|
+
);
|
|
12545
|
+
postToApp(hostResponse);
|
|
12546
|
+
} catch (messageError) {
|
|
12547
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(messageError)));
|
|
12548
|
+
}
|
|
12549
|
+
return;
|
|
12550
|
+
}
|
|
12551
|
+
if (request.id === void 0 && request.method.startsWith("ui/")) {
|
|
12552
|
+
return;
|
|
12553
|
+
}
|
|
12554
|
+
try {
|
|
12555
|
+
postToApp(await callHostRpc(request));
|
|
12556
|
+
} catch (rpcError) {
|
|
12557
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12558
|
+
}
|
|
12559
|
+
};
|
|
12560
|
+
window.addEventListener("message", handleMessage);
|
|
12561
|
+
return () => {
|
|
12562
|
+
window.removeEventListener("message", handleMessage);
|
|
12563
|
+
};
|
|
12564
|
+
}, [
|
|
12565
|
+
callHostRpc,
|
|
12566
|
+
data.appInstanceId,
|
|
12567
|
+
data.csp,
|
|
12568
|
+
data.permissions,
|
|
12569
|
+
data.resourceUri,
|
|
12570
|
+
data.title,
|
|
12571
|
+
data.toolCallId,
|
|
12572
|
+
data.toolName,
|
|
12573
|
+
i18n2.language,
|
|
12574
|
+
postToApp,
|
|
12575
|
+
resource?.csp,
|
|
12576
|
+
resource?.permissions,
|
|
12577
|
+
resource?.toolInfo,
|
|
12578
|
+
sendInitialToolNotifications,
|
|
12579
|
+
streamIsLoading,
|
|
12580
|
+
submit
|
|
12581
|
+
]);
|
|
12582
|
+
const iframePermissions = resource?.permissions ?? data.permissions;
|
|
12583
|
+
const iframeAllow = React35.useMemo(
|
|
12584
|
+
() => buildIframeAllow(iframePermissions),
|
|
12585
|
+
[iframePermissions]
|
|
12586
|
+
);
|
|
12587
|
+
const sandbox = React35.useMemo(() => buildSandboxAttribute(), []);
|
|
12588
|
+
const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
|
|
12589
|
+
const displayTitle = resolveLocalizedText3(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
|
|
12590
|
+
const displayDescription = resolveLocalizedText3(
|
|
12591
|
+
resource?.description ?? data.description,
|
|
12592
|
+
i18n2.language
|
|
12593
|
+
);
|
|
12594
|
+
const displayIcon = resource?.icon ?? data.icon;
|
|
12595
|
+
return /* @__PURE__ */ jsxs28(
|
|
12596
|
+
"div",
|
|
12597
|
+
{
|
|
12598
|
+
ref: containerRef,
|
|
12599
|
+
className: cn(
|
|
12600
|
+
"overflow-hidden rounded-lg border bg-background shadow-sm",
|
|
12601
|
+
!prefersBorder && "border-transparent shadow-none",
|
|
12602
|
+
className
|
|
12603
|
+
),
|
|
12604
|
+
children: [
|
|
12605
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
|
|
12606
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
12607
|
+
displayIcon ? /* @__PURE__ */ jsx41(
|
|
12608
|
+
IconDefinitionRenderer,
|
|
12609
|
+
{
|
|
12610
|
+
icon: displayIcon,
|
|
12611
|
+
size: 18,
|
|
12612
|
+
className: "shrink-0",
|
|
12613
|
+
decorative: true
|
|
12614
|
+
}
|
|
12615
|
+
) : null,
|
|
12616
|
+
/* @__PURE__ */ jsxs28("div", { className: "min-w-0", children: [
|
|
12617
|
+
/* @__PURE__ */ jsx41("div", { className: "truncate text-sm font-medium", children: displayTitle }),
|
|
12618
|
+
/* @__PURE__ */ jsx41("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
|
|
12619
|
+
] })
|
|
12620
|
+
] }),
|
|
12621
|
+
/* @__PURE__ */ jsx41(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
|
|
12622
|
+
] }),
|
|
12623
|
+
isLoading ? /* @__PURE__ */ jsxs28("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
12624
|
+
/* @__PURE__ */ jsx41(Loader27, { className: "h-4 w-4 animate-spin" }),
|
|
12625
|
+
/* @__PURE__ */ jsx41("span", { children: i18n2.t("message.mcpApp.loading") })
|
|
12626
|
+
] }) : error ? /* @__PURE__ */ jsxs28("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
|
|
12627
|
+
/* @__PURE__ */ jsx41(AlertCircle2, { className: "h-4 w-4 shrink-0" }),
|
|
12628
|
+
/* @__PURE__ */ jsx41("span", { className: "min-w-0 break-words", children: error })
|
|
12629
|
+
] }) : srcDoc ? /* @__PURE__ */ jsx41(
|
|
12630
|
+
"iframe",
|
|
12631
|
+
{
|
|
12632
|
+
ref: iframeRef,
|
|
12633
|
+
title: displayTitle,
|
|
12634
|
+
srcDoc,
|
|
12635
|
+
className: "block w-full bg-background",
|
|
12636
|
+
style: { height },
|
|
12637
|
+
sandbox,
|
|
12638
|
+
allow: iframeAllow,
|
|
12639
|
+
referrerPolicy: "no-referrer"
|
|
12640
|
+
}
|
|
12641
|
+
) : null
|
|
12642
|
+
]
|
|
12643
|
+
}
|
|
12644
|
+
);
|
|
12645
|
+
}
|
|
12646
|
+
|
|
12647
|
+
// src/components/thread/messages/ai.tsx
|
|
12648
|
+
import { jsx as jsx42, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
11666
12649
|
var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
|
|
11667
12650
|
function isTextContent3(content) {
|
|
11668
12651
|
return content.type === "text";
|
|
@@ -11680,6 +12663,9 @@ function isWidgetComponent2(content) {
|
|
|
11680
12663
|
const data = content.data;
|
|
11681
12664
|
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
11682
12665
|
}
|
|
12666
|
+
function isMcpAppComponent(content) {
|
|
12667
|
+
return isMcpAppComponentData(content.data);
|
|
12668
|
+
}
|
|
11683
12669
|
function isMemoryContent(content) {
|
|
11684
12670
|
return content.type === "memory";
|
|
11685
12671
|
}
|
|
@@ -11698,11 +12684,11 @@ function ReasoningBlock({
|
|
|
11698
12684
|
}) {
|
|
11699
12685
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
11700
12686
|
if (blocks.length === 0) return null;
|
|
11701
|
-
return /* @__PURE__ */
|
|
12687
|
+
return /* @__PURE__ */ jsx42("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ jsx42(
|
|
11702
12688
|
"div",
|
|
11703
12689
|
{
|
|
11704
12690
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
11705
|
-
children: /* @__PURE__ */
|
|
12691
|
+
children: /* @__PURE__ */ jsx42("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
11706
12692
|
},
|
|
11707
12693
|
item.id ?? `reasoning-${index}`
|
|
11708
12694
|
)) });
|
|
@@ -11710,12 +12696,12 @@ function ReasoningBlock({
|
|
|
11710
12696
|
function ImageBlock({ content }) {
|
|
11711
12697
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
11712
12698
|
if (!imageUrl) {
|
|
11713
|
-
return /* @__PURE__ */
|
|
11714
|
-
/* @__PURE__ */
|
|
11715
|
-
/* @__PURE__ */
|
|
12699
|
+
return /* @__PURE__ */ jsxs29(Card, { children: [
|
|
12700
|
+
/* @__PURE__ */ jsx42(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ jsx42(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
12701
|
+
/* @__PURE__ */ jsx42(CardContent, { className: "text-xs text-muted-foreground", children: safeJson3(content) })
|
|
11716
12702
|
] });
|
|
11717
12703
|
}
|
|
11718
|
-
return /* @__PURE__ */
|
|
12704
|
+
return /* @__PURE__ */ jsx42("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ jsx42(
|
|
11719
12705
|
"img",
|
|
11720
12706
|
{
|
|
11721
12707
|
src: imageUrl,
|
|
@@ -11725,12 +12711,12 @@ function ImageBlock({ content }) {
|
|
|
11725
12711
|
) });
|
|
11726
12712
|
}
|
|
11727
12713
|
function MemoryBlock({ content }) {
|
|
11728
|
-
return /* @__PURE__ */
|
|
11729
|
-
/* @__PURE__ */
|
|
11730
|
-
/* @__PURE__ */
|
|
11731
|
-
/* @__PURE__ */
|
|
12714
|
+
return /* @__PURE__ */ jsxs29(Card, { children: [
|
|
12715
|
+
/* @__PURE__ */ jsxs29(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12716
|
+
/* @__PURE__ */ jsx42(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
12717
|
+
/* @__PURE__ */ jsx42(Badge, { variant: "secondary", children: "Memory" })
|
|
11732
12718
|
] }),
|
|
11733
|
-
/* @__PURE__ */
|
|
12719
|
+
/* @__PURE__ */ jsx42(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson3(content.data ?? []) }) })
|
|
11734
12720
|
] });
|
|
11735
12721
|
}
|
|
11736
12722
|
function parseStepDate2(value) {
|
|
@@ -11764,11 +12750,11 @@ function formatStepDuration3(durationMs) {
|
|
|
11764
12750
|
}
|
|
11765
12751
|
function ComponentBlock({ content }) {
|
|
11766
12752
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
11767
|
-
const [isExpanded, setIsExpanded] =
|
|
11768
|
-
const contentRef =
|
|
11769
|
-
const shouldAutoScrollRef =
|
|
11770
|
-
const previousScrollTopRef =
|
|
11771
|
-
const [durationNow, setDurationNow] =
|
|
12753
|
+
const [isExpanded, setIsExpanded] = React36.useState(false);
|
|
12754
|
+
const contentRef = React36.useRef(null);
|
|
12755
|
+
const shouldAutoScrollRef = React36.useRef(true);
|
|
12756
|
+
const previousScrollTopRef = React36.useRef(0);
|
|
12757
|
+
const [durationNow, setDurationNow] = React36.useState(() => Date.now());
|
|
11772
12758
|
const data = getToolStepData(content);
|
|
11773
12759
|
const category = data.category ?? "Component";
|
|
11774
12760
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -11782,10 +12768,10 @@ function ComponentBlock({ content }) {
|
|
|
11782
12768
|
const endedAt = parseStepDate2(data.end_date);
|
|
11783
12769
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
11784
12770
|
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
11785
|
-
|
|
12771
|
+
React36.useEffect(() => {
|
|
11786
12772
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
11787
12773
|
}, [status, output]);
|
|
11788
|
-
|
|
12774
|
+
React36.useEffect(() => {
|
|
11789
12775
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
11790
12776
|
return;
|
|
11791
12777
|
}
|
|
@@ -11797,7 +12783,7 @@ function ComponentBlock({ content }) {
|
|
|
11797
12783
|
window.clearInterval(timer);
|
|
11798
12784
|
};
|
|
11799
12785
|
}, [createdAt, endedAt, status]);
|
|
11800
|
-
|
|
12786
|
+
React36.useEffect(() => {
|
|
11801
12787
|
const element = contentRef.current;
|
|
11802
12788
|
if (!element) return;
|
|
11803
12789
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -11819,7 +12805,7 @@ function ComponentBlock({ content }) {
|
|
|
11819
12805
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
11820
12806
|
};
|
|
11821
12807
|
}, [isExpanded]);
|
|
11822
|
-
|
|
12808
|
+
React36.useEffect(() => {
|
|
11823
12809
|
if (status !== "running") {
|
|
11824
12810
|
shouldAutoScrollRef.current = true;
|
|
11825
12811
|
return;
|
|
@@ -11832,15 +12818,15 @@ function ComponentBlock({ content }) {
|
|
|
11832
12818
|
}, [isExpanded, output, status]);
|
|
11833
12819
|
const config = status ? toolStatusConfig[status] : null;
|
|
11834
12820
|
const StatusIcon = config?.icon;
|
|
11835
|
-
return /* @__PURE__ */
|
|
11836
|
-
/* @__PURE__ */
|
|
12821
|
+
return /* @__PURE__ */ jsxs29(Card, { children: [
|
|
12822
|
+
/* @__PURE__ */ jsxs29(
|
|
11837
12823
|
CardHeader,
|
|
11838
12824
|
{
|
|
11839
12825
|
className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer",
|
|
11840
12826
|
onClick: () => setIsExpanded(!isExpanded),
|
|
11841
12827
|
children: [
|
|
11842
|
-
/* @__PURE__ */
|
|
11843
|
-
status && StatusIcon && /* @__PURE__ */
|
|
12828
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
12829
|
+
status && StatusIcon && /* @__PURE__ */ jsx42(
|
|
11844
12830
|
StatusIcon,
|
|
11845
12831
|
{
|
|
11846
12832
|
className: cn(
|
|
@@ -11850,20 +12836,20 @@ function ComponentBlock({ content }) {
|
|
|
11850
12836
|
)
|
|
11851
12837
|
}
|
|
11852
12838
|
),
|
|
11853
|
-
/* @__PURE__ */
|
|
12839
|
+
/* @__PURE__ */ jsx42(CardTitle, { className: "text-sm truncate", children: title })
|
|
11854
12840
|
] }),
|
|
11855
|
-
/* @__PURE__ */
|
|
11856
|
-
durationLabel && /* @__PURE__ */
|
|
11857
|
-
/* @__PURE__ */
|
|
11858
|
-
/* @__PURE__ */
|
|
12841
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
12842
|
+
durationLabel && /* @__PURE__ */ jsxs29("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
|
|
12843
|
+
/* @__PURE__ */ jsx42(Clock32, { className: "h-3 w-3" }),
|
|
12844
|
+
/* @__PURE__ */ jsx42("span", { children: durationLabel })
|
|
11859
12845
|
] }),
|
|
11860
|
-
/* @__PURE__ */
|
|
11861
|
-
/* @__PURE__ */
|
|
12846
|
+
/* @__PURE__ */ jsx42(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
12847
|
+
/* @__PURE__ */ jsx42(
|
|
11862
12848
|
"button",
|
|
11863
12849
|
{
|
|
11864
12850
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
11865
12851
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
11866
|
-
children: /* @__PURE__ */
|
|
12852
|
+
children: /* @__PURE__ */ jsx42(
|
|
11867
12853
|
ChevronDown4,
|
|
11868
12854
|
{
|
|
11869
12855
|
className: cn(
|
|
@@ -11878,53 +12864,53 @@ function ComponentBlock({ content }) {
|
|
|
11878
12864
|
]
|
|
11879
12865
|
}
|
|
11880
12866
|
),
|
|
11881
|
-
isExpanded && /* @__PURE__ */
|
|
12867
|
+
isExpanded && /* @__PURE__ */ jsxs29(
|
|
11882
12868
|
CardContent,
|
|
11883
12869
|
{
|
|
11884
12870
|
ref: contentRef,
|
|
11885
12871
|
className: "text-xs text-muted-foreground max-h-60 overflow-auto",
|
|
11886
12872
|
children: [
|
|
11887
|
-
data.input && /* @__PURE__ */
|
|
11888
|
-
error ? /* @__PURE__ */
|
|
12873
|
+
data.input && /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(data.input) }),
|
|
12874
|
+
error ? /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue3(error) }) : hasOutput && /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(fallback) })
|
|
11889
12875
|
]
|
|
11890
12876
|
}
|
|
11891
12877
|
)
|
|
11892
12878
|
] });
|
|
11893
12879
|
}
|
|
11894
12880
|
function UnknownBlock({ content }) {
|
|
11895
|
-
return /* @__PURE__ */
|
|
11896
|
-
/* @__PURE__ */
|
|
11897
|
-
/* @__PURE__ */
|
|
11898
|
-
/* @__PURE__ */
|
|
12881
|
+
return /* @__PURE__ */ jsxs29(Card, { children: [
|
|
12882
|
+
/* @__PURE__ */ jsxs29(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12883
|
+
/* @__PURE__ */ jsx42(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
12884
|
+
/* @__PURE__ */ jsx42(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
11899
12885
|
] }),
|
|
11900
|
-
/* @__PURE__ */
|
|
12886
|
+
/* @__PURE__ */ jsx42(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
|
|
11901
12887
|
] });
|
|
11902
12888
|
}
|
|
11903
12889
|
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
11904
12890
|
const messageId = message.id;
|
|
11905
12891
|
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
11906
12892
|
if (typeof content === "string") {
|
|
11907
|
-
return /* @__PURE__ */
|
|
12893
|
+
return /* @__PURE__ */ jsx42("div", { className: textClassName, children: /* @__PURE__ */ jsx42(MarkdownText, { children: content }) }, `text-${index}`);
|
|
11908
12894
|
}
|
|
11909
12895
|
if (isThreadContextUsageRenderArtifact(content)) {
|
|
11910
12896
|
return null;
|
|
11911
12897
|
}
|
|
11912
12898
|
if (isTextContent3(content)) {
|
|
11913
|
-
return /* @__PURE__ */
|
|
12899
|
+
return /* @__PURE__ */ jsx42("div", { className: textClassName, children: /* @__PURE__ */ jsx42(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
11914
12900
|
}
|
|
11915
12901
|
if (isReasoningContent3(content)) {
|
|
11916
|
-
return /* @__PURE__ */
|
|
12902
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
11917
12903
|
}
|
|
11918
12904
|
if (isImageContent(content)) {
|
|
11919
|
-
return /* @__PURE__ */
|
|
12905
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
11920
12906
|
}
|
|
11921
12907
|
if (isComponentContent3(content)) {
|
|
11922
12908
|
if (isContextCompressionComponent(content)) {
|
|
11923
|
-
return /* @__PURE__ */
|
|
12909
|
+
return /* @__PURE__ */ jsx42(
|
|
11924
12910
|
"div",
|
|
11925
12911
|
{
|
|
11926
12912
|
className: "w-full",
|
|
11927
|
-
children: /* @__PURE__ */
|
|
12913
|
+
children: /* @__PURE__ */ jsx42(ContextCompressionMessage, { content })
|
|
11928
12914
|
},
|
|
11929
12915
|
content.id ?? `context-compression-${index}`
|
|
11930
12916
|
);
|
|
@@ -11934,13 +12920,16 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11934
12920
|
lookupMessages
|
|
11935
12921
|
);
|
|
11936
12922
|
if (requestUserInputResult) {
|
|
11937
|
-
return /* @__PURE__ */
|
|
12923
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
|
|
11938
12924
|
}
|
|
11939
12925
|
if (isWidgetComponent2(content)) {
|
|
11940
|
-
return /* @__PURE__ */
|
|
12926
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
12927
|
+
}
|
|
12928
|
+
if (isMcpAppComponent(content)) {
|
|
12929
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(McpAppMessage, { data: content.data }) }, content.id ?? `mcp-app-${index}`);
|
|
11941
12930
|
}
|
|
11942
12931
|
if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
|
|
11943
|
-
return /* @__PURE__ */
|
|
12932
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(
|
|
11944
12933
|
ToolComponentGroup,
|
|
11945
12934
|
{
|
|
11946
12935
|
items: [content],
|
|
@@ -11951,15 +12940,15 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11951
12940
|
}
|
|
11952
12941
|
) }, content.id ?? `component-group-${index}`);
|
|
11953
12942
|
}
|
|
11954
|
-
return /* @__PURE__ */
|
|
12943
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
11955
12944
|
}
|
|
11956
12945
|
if (isMemoryContent(content)) {
|
|
11957
|
-
return /* @__PURE__ */
|
|
12946
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
11958
12947
|
}
|
|
11959
12948
|
if (isAgentEventContent(content)) {
|
|
11960
|
-
return /* @__PURE__ */
|
|
12949
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
|
|
11961
12950
|
}
|
|
11962
|
-
return /* @__PURE__ */
|
|
12951
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
11963
12952
|
}
|
|
11964
12953
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
11965
12954
|
if (unit.type === "item") {
|
|
@@ -11970,7 +12959,7 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
|
|
|
11970
12959
|
isAgentOutput: options?.isAgentOutput
|
|
11971
12960
|
});
|
|
11972
12961
|
}
|
|
11973
|
-
return /* @__PURE__ */
|
|
12962
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(
|
|
11974
12963
|
ToolComponentGroup,
|
|
11975
12964
|
{
|
|
11976
12965
|
items: unit.items,
|
|
@@ -11986,7 +12975,7 @@ function renderEntryBatch(entries, message, lookupMessages, hasFollowingItem, op
|
|
|
11986
12975
|
const renderUnits = buildToolComponentRenderUnits(
|
|
11987
12976
|
entries.map((entry) => entry.item),
|
|
11988
12977
|
{
|
|
11989
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12978
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
11990
12979
|
}
|
|
11991
12980
|
);
|
|
11992
12981
|
return renderUnits.map(
|
|
@@ -12007,7 +12996,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
12007
12996
|
const batch = entryBatch;
|
|
12008
12997
|
entryBatch = [];
|
|
12009
12998
|
rendered.push(
|
|
12010
|
-
/* @__PURE__ */
|
|
12999
|
+
/* @__PURE__ */ jsx42(React36.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
|
|
12011
13000
|
...options,
|
|
12012
13001
|
isAgentOutput: depth > 0
|
|
12013
13002
|
}) }, `entries-${batch[0]?.order ?? rendered.length}`)
|
|
@@ -12024,7 +13013,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
12024
13013
|
}
|
|
12025
13014
|
flushEntries(true);
|
|
12026
13015
|
rendered.push(
|
|
12027
|
-
/* @__PURE__ */
|
|
13016
|
+
/* @__PURE__ */ jsx42(
|
|
12028
13017
|
AgentRunGroup,
|
|
12029
13018
|
{
|
|
12030
13019
|
node: unit.node,
|
|
@@ -12049,7 +13038,7 @@ function renderContent(message, lookupMessages, options) {
|
|
|
12049
13038
|
message
|
|
12050
13039
|
);
|
|
12051
13040
|
if (renderTree.hasAgentRuns) {
|
|
12052
|
-
return /* @__PURE__ */
|
|
13041
|
+
return /* @__PURE__ */ jsx42("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
|
|
12053
13042
|
renderTree.units,
|
|
12054
13043
|
message,
|
|
12055
13044
|
lookupMessages,
|
|
@@ -12059,13 +13048,13 @@ function renderContent(message, lookupMessages, options) {
|
|
|
12059
13048
|
const content = message.content;
|
|
12060
13049
|
if (typeof content === "string") {
|
|
12061
13050
|
if (!content.trim()) return null;
|
|
12062
|
-
return /* @__PURE__ */
|
|
13051
|
+
return /* @__PURE__ */ jsx42(MarkdownText, { children: content });
|
|
12063
13052
|
}
|
|
12064
13053
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
12065
13054
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
12066
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
13055
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
12067
13056
|
});
|
|
12068
|
-
return /* @__PURE__ */
|
|
13057
|
+
return /* @__PURE__ */ jsx42("div", { className: "space-y-3", children: renderUnits.map(
|
|
12069
13058
|
(unit, index) => renderContentUnit(
|
|
12070
13059
|
unit,
|
|
12071
13060
|
message,
|
|
@@ -12085,7 +13074,7 @@ function AssistantStreamingIndicator({
|
|
|
12085
13074
|
thinking: t("message.thinking"),
|
|
12086
13075
|
answering: t("message.answering")
|
|
12087
13076
|
};
|
|
12088
|
-
return /* @__PURE__ */
|
|
13077
|
+
return /* @__PURE__ */ jsxs29(
|
|
12089
13078
|
"div",
|
|
12090
13079
|
{
|
|
12091
13080
|
className: cn(
|
|
@@ -12093,18 +13082,18 @@ function AssistantStreamingIndicator({
|
|
|
12093
13082
|
className
|
|
12094
13083
|
),
|
|
12095
13084
|
children: [
|
|
12096
|
-
status === "loading" && /* @__PURE__ */
|
|
12097
|
-
status === "thinking" && /* @__PURE__ */
|
|
12098
|
-
/* @__PURE__ */
|
|
12099
|
-
/* @__PURE__ */
|
|
12100
|
-
/* @__PURE__ */
|
|
13085
|
+
status === "loading" && /* @__PURE__ */ jsx42(Loader28, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
13086
|
+
status === "thinking" && /* @__PURE__ */ jsxs29("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
13087
|
+
/* @__PURE__ */ jsx42("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
13088
|
+
/* @__PURE__ */ jsx42("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
13089
|
+
/* @__PURE__ */ jsx42("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
12101
13090
|
] }),
|
|
12102
|
-
status === "answering" && /* @__PURE__ */
|
|
12103
|
-
/* @__PURE__ */
|
|
12104
|
-
/* @__PURE__ */
|
|
12105
|
-
/* @__PURE__ */
|
|
13091
|
+
status === "answering" && /* @__PURE__ */ jsxs29("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
13092
|
+
/* @__PURE__ */ jsx42("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
13093
|
+
/* @__PURE__ */ jsx42("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
13094
|
+
/* @__PURE__ */ jsx42("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
12106
13095
|
] }),
|
|
12107
|
-
/* @__PURE__ */
|
|
13096
|
+
/* @__PURE__ */ jsx42("span", { children: labelMap[status] })
|
|
12108
13097
|
]
|
|
12109
13098
|
}
|
|
12110
13099
|
);
|
|
@@ -12133,42 +13122,42 @@ function AssistantMessage({
|
|
|
12133
13122
|
organizationId,
|
|
12134
13123
|
apiUrl
|
|
12135
13124
|
});
|
|
12136
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */
|
|
13125
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx42(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
12137
13126
|
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
12138
13127
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
12139
13128
|
if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
|
|
12140
|
-
return /* @__PURE__ */
|
|
13129
|
+
return /* @__PURE__ */ jsx42("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ jsx42(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
12141
13130
|
}
|
|
12142
13131
|
if (hasContent && hasReasoning) {
|
|
12143
|
-
return /* @__PURE__ */
|
|
12144
|
-
/* @__PURE__ */
|
|
13132
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
13133
|
+
/* @__PURE__ */ jsxs29(
|
|
12145
13134
|
Tabs,
|
|
12146
13135
|
{
|
|
12147
13136
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
12148
13137
|
className: "w-full",
|
|
12149
13138
|
children: [
|
|
12150
|
-
/* @__PURE__ */
|
|
12151
|
-
/* @__PURE__ */
|
|
12152
|
-
/* @__PURE__ */
|
|
13139
|
+
/* @__PURE__ */ jsxs29(TabsList, { className: "", children: [
|
|
13140
|
+
/* @__PURE__ */ jsx42(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
13141
|
+
/* @__PURE__ */ jsx42(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
12153
13142
|
] }),
|
|
12154
|
-
/* @__PURE__ */
|
|
12155
|
-
/* @__PURE__ */
|
|
13143
|
+
/* @__PURE__ */ jsx42(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
13144
|
+
/* @__PURE__ */ jsx42(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
12156
13145
|
]
|
|
12157
13146
|
}
|
|
12158
13147
|
),
|
|
12159
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
13148
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx42(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12160
13149
|
] });
|
|
12161
13150
|
}
|
|
12162
|
-
return /* @__PURE__ */
|
|
13151
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12163
13152
|
hasReasoning ? reasoningNode : answerNode,
|
|
12164
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
13153
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx42(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12165
13154
|
] });
|
|
12166
13155
|
}
|
|
12167
13156
|
|
|
12168
13157
|
// src/components/thread/MessageActions.tsx
|
|
12169
|
-
import * as
|
|
13158
|
+
import * as React37 from "react";
|
|
12170
13159
|
import { Check as Check5, Copy as Copy3, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
12171
|
-
import { jsx as
|
|
13160
|
+
import { jsx as jsx43, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
12172
13161
|
function MessageActions({
|
|
12173
13162
|
content,
|
|
12174
13163
|
isAssistant = false,
|
|
@@ -12177,7 +13166,7 @@ function MessageActions({
|
|
|
12177
13166
|
className
|
|
12178
13167
|
}) {
|
|
12179
13168
|
const { t } = useChatkitTranslation();
|
|
12180
|
-
const [copied, setCopied] =
|
|
13169
|
+
const [copied, setCopied] = React37.useState(false);
|
|
12181
13170
|
const handleCopy = async () => {
|
|
12182
13171
|
try {
|
|
12183
13172
|
await navigator.clipboard.writeText(content);
|
|
@@ -12190,7 +13179,7 @@ function MessageActions({
|
|
|
12190
13179
|
if (isStreaming) {
|
|
12191
13180
|
return null;
|
|
12192
13181
|
}
|
|
12193
|
-
return /* @__PURE__ */
|
|
13182
|
+
return /* @__PURE__ */ jsxs30(
|
|
12194
13183
|
"div",
|
|
12195
13184
|
{
|
|
12196
13185
|
className: cn(
|
|
@@ -12198,7 +13187,7 @@ function MessageActions({
|
|
|
12198
13187
|
className
|
|
12199
13188
|
),
|
|
12200
13189
|
children: [
|
|
12201
|
-
/* @__PURE__ */
|
|
13190
|
+
/* @__PURE__ */ jsx43(
|
|
12202
13191
|
"button",
|
|
12203
13192
|
{
|
|
12204
13193
|
type: "button",
|
|
@@ -12208,17 +13197,17 @@ function MessageActions({
|
|
|
12208
13197
|
copied && "text-green-500"
|
|
12209
13198
|
),
|
|
12210
13199
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
12211
|
-
children: copied ? /* @__PURE__ */
|
|
13200
|
+
children: copied ? /* @__PURE__ */ jsx43(Check5, { size: 14 }) : /* @__PURE__ */ jsx43(Copy3, { size: 14 })
|
|
12212
13201
|
}
|
|
12213
13202
|
),
|
|
12214
|
-
isAssistant && onRetry && /* @__PURE__ */
|
|
13203
|
+
isAssistant && onRetry && /* @__PURE__ */ jsx43(
|
|
12215
13204
|
"button",
|
|
12216
13205
|
{
|
|
12217
13206
|
type: "button",
|
|
12218
13207
|
onClick: onRetry,
|
|
12219
13208
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
12220
13209
|
title: t("messageActions.regenerate"),
|
|
12221
|
-
children: /* @__PURE__ */
|
|
13210
|
+
children: /* @__PURE__ */ jsx43(RefreshCw2, { size: 14 })
|
|
12222
13211
|
}
|
|
12223
13212
|
)
|
|
12224
13213
|
]
|
|
@@ -12239,18 +13228,18 @@ import {
|
|
|
12239
13228
|
Sparkles as Sparkles3,
|
|
12240
13229
|
Zap
|
|
12241
13230
|
} from "lucide-react";
|
|
12242
|
-
import { jsx as
|
|
13231
|
+
import { jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
12243
13232
|
function getIconComponent2(icon) {
|
|
12244
13233
|
const iconMap = {
|
|
12245
|
-
"circle-question": /* @__PURE__ */
|
|
12246
|
-
"lightbulb": /* @__PURE__ */
|
|
12247
|
-
"sparkle": /* @__PURE__ */
|
|
12248
|
-
"write": /* @__PURE__ */
|
|
12249
|
-
"search": /* @__PURE__ */
|
|
12250
|
-
"globe": /* @__PURE__ */
|
|
12251
|
-
"book-open": /* @__PURE__ */
|
|
12252
|
-
"compass": /* @__PURE__ */
|
|
12253
|
-
"bolt": /* @__PURE__ */
|
|
13234
|
+
"circle-question": /* @__PURE__ */ jsx44(HelpCircle, { size: 20 }),
|
|
13235
|
+
"lightbulb": /* @__PURE__ */ jsx44(Lightbulb2, { size: 20 }),
|
|
13236
|
+
"sparkle": /* @__PURE__ */ jsx44(Sparkles3, { size: 20 }),
|
|
13237
|
+
"write": /* @__PURE__ */ jsx44(Pencil3, { size: 20 }),
|
|
13238
|
+
"search": /* @__PURE__ */ jsx44(Search3, { size: 20 }),
|
|
13239
|
+
"globe": /* @__PURE__ */ jsx44(Globe2, { size: 20 }),
|
|
13240
|
+
"book-open": /* @__PURE__ */ jsx44(BookOpen2, { size: 20 }),
|
|
13241
|
+
"compass": /* @__PURE__ */ jsx44(Compass, { size: 20 }),
|
|
13242
|
+
"bolt": /* @__PURE__ */ jsx44(Zap, { size: 20 })
|
|
12254
13243
|
};
|
|
12255
13244
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
12256
13245
|
}
|
|
@@ -12266,7 +13255,7 @@ function StartScreen({
|
|
|
12266
13255
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
12267
13256
|
const prompts = startScreen?.prompts ?? [];
|
|
12268
13257
|
const editPromptLabel = t("startScreen.editPrompt");
|
|
12269
|
-
return /* @__PURE__ */
|
|
13258
|
+
return /* @__PURE__ */ jsxs31(
|
|
12270
13259
|
"div",
|
|
12271
13260
|
{
|
|
12272
13261
|
className: cn(
|
|
@@ -12274,8 +13263,8 @@ function StartScreen({
|
|
|
12274
13263
|
className
|
|
12275
13264
|
),
|
|
12276
13265
|
children: [
|
|
12277
|
-
/* @__PURE__ */
|
|
12278
|
-
prompts.length > 0 && /* @__PURE__ */
|
|
13266
|
+
/* @__PURE__ */ jsx44("div", { className: "mb-8 text-center", children: /* @__PURE__ */ jsx44("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
13267
|
+
prompts.length > 0 && /* @__PURE__ */ jsx44("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ jsx44("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ jsxs31(
|
|
12279
13268
|
"div",
|
|
12280
13269
|
{
|
|
12281
13270
|
className: cn(
|
|
@@ -12284,7 +13273,7 @@ function StartScreen({
|
|
|
12284
13273
|
"focus-within:ring-2 focus-within:ring-primary/20"
|
|
12285
13274
|
),
|
|
12286
13275
|
children: [
|
|
12287
|
-
/* @__PURE__ */
|
|
13276
|
+
/* @__PURE__ */ jsxs31(
|
|
12288
13277
|
"button",
|
|
12289
13278
|
{
|
|
12290
13279
|
type: "button",
|
|
@@ -12295,12 +13284,12 @@ function StartScreen({
|
|
|
12295
13284
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
12296
13285
|
),
|
|
12297
13286
|
children: [
|
|
12298
|
-
/* @__PURE__ */
|
|
12299
|
-
/* @__PURE__ */
|
|
13287
|
+
/* @__PURE__ */ jsx44("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
|
|
13288
|
+
/* @__PURE__ */ jsx44("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
12300
13289
|
]
|
|
12301
13290
|
}
|
|
12302
13291
|
),
|
|
12303
|
-
/* @__PURE__ */
|
|
13292
|
+
/* @__PURE__ */ jsx44(
|
|
12304
13293
|
"button",
|
|
12305
13294
|
{
|
|
12306
13295
|
type: "button",
|
|
@@ -12313,7 +13302,7 @@ function StartScreen({
|
|
|
12313
13302
|
"rounded-r-xl transition-colors hover:bg-muted hover:text-foreground",
|
|
12314
13303
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
12315
13304
|
),
|
|
12316
|
-
children: /* @__PURE__ */
|
|
13305
|
+
children: /* @__PURE__ */ jsx44(Pencil3, { size: 16 })
|
|
12317
13306
|
}
|
|
12318
13307
|
)
|
|
12319
13308
|
]
|
|
@@ -12326,7 +13315,7 @@ function StartScreen({
|
|
|
12326
13315
|
}
|
|
12327
13316
|
|
|
12328
13317
|
// src/hooks/useThreads.ts
|
|
12329
|
-
import * as
|
|
13318
|
+
import * as React39 from "react";
|
|
12330
13319
|
var DEFAULT_LIMIT = 50;
|
|
12331
13320
|
var getThreadTitle = (threadRecord) => {
|
|
12332
13321
|
const title = threadRecord.title?.trim();
|
|
@@ -12341,7 +13330,7 @@ var toDate = (value) => {
|
|
|
12341
13330
|
if (Number.isNaN(timestamp)) return void 0;
|
|
12342
13331
|
return new Date(timestamp);
|
|
12343
13332
|
};
|
|
12344
|
-
var
|
|
13333
|
+
var getErrorMessage2 = (error) => {
|
|
12345
13334
|
if (!error) return void 0;
|
|
12346
13335
|
if (error instanceof Error) return error.message;
|
|
12347
13336
|
if (typeof error === "string") return error;
|
|
@@ -12379,16 +13368,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12379
13368
|
isLoading: isStreamLoading,
|
|
12380
13369
|
error: streamError
|
|
12381
13370
|
} = useStreamContext();
|
|
12382
|
-
const [threadRecords, setThreadRecords] =
|
|
12383
|
-
const [isLoading, setIsLoading] =
|
|
12384
|
-
const [error, setError] =
|
|
12385
|
-
const upsertThreadRecord =
|
|
13371
|
+
const [threadRecords, setThreadRecords] = React39.useState([]);
|
|
13372
|
+
const [isLoading, setIsLoading] = React39.useState(false);
|
|
13373
|
+
const [error, setError] = React39.useState(null);
|
|
13374
|
+
const upsertThreadRecord = React39.useCallback((threadRecord) => {
|
|
12386
13375
|
setThreadRecords((prev) => {
|
|
12387
13376
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
12388
13377
|
return sortThreadRecords([threadRecord, ...next]);
|
|
12389
13378
|
});
|
|
12390
13379
|
}, []);
|
|
12391
|
-
const refreshThreads =
|
|
13380
|
+
const refreshThreads = React39.useCallback(async () => {
|
|
12392
13381
|
setIsLoading(true);
|
|
12393
13382
|
setError(null);
|
|
12394
13383
|
try {
|
|
@@ -12404,7 +13393,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12404
13393
|
setIsLoading(false);
|
|
12405
13394
|
}
|
|
12406
13395
|
}, [client, limit, assistantId]);
|
|
12407
|
-
const createThread =
|
|
13396
|
+
const createThread = React39.useCallback(
|
|
12408
13397
|
async (input) => {
|
|
12409
13398
|
setError(null);
|
|
12410
13399
|
const payload = {};
|
|
@@ -12418,7 +13407,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12418
13407
|
},
|
|
12419
13408
|
[client, upsertThreadRecord]
|
|
12420
13409
|
);
|
|
12421
|
-
const updateThread =
|
|
13410
|
+
const updateThread = React39.useCallback(
|
|
12422
13411
|
async (recordId, payload) => {
|
|
12423
13412
|
setError(null);
|
|
12424
13413
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -12427,7 +13416,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12427
13416
|
},
|
|
12428
13417
|
[client, upsertThreadRecord]
|
|
12429
13418
|
);
|
|
12430
|
-
const deleteThread =
|
|
13419
|
+
const deleteThread = React39.useCallback(
|
|
12431
13420
|
async (recordId) => {
|
|
12432
13421
|
setError(null);
|
|
12433
13422
|
await client.conversations.delete(recordId);
|
|
@@ -12435,11 +13424,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12435
13424
|
},
|
|
12436
13425
|
[client]
|
|
12437
13426
|
);
|
|
12438
|
-
|
|
13427
|
+
React39.useEffect(() => {
|
|
12439
13428
|
if (!isReady) return;
|
|
12440
13429
|
void refreshThreads();
|
|
12441
13430
|
}, [refreshThreads, isReady]);
|
|
12442
|
-
|
|
13431
|
+
React39.useEffect(() => {
|
|
12443
13432
|
if (!threadId || !isStreamLoading) return;
|
|
12444
13433
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12445
13434
|
const busyStatus = "busy";
|
|
@@ -12460,8 +13449,8 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12460
13449
|
return changed ? sortThreadRecords(next) : prev;
|
|
12461
13450
|
});
|
|
12462
13451
|
}, [threadId, isStreamLoading]);
|
|
12463
|
-
|
|
12464
|
-
const message =
|
|
13452
|
+
React39.useEffect(() => {
|
|
13453
|
+
const message = getErrorMessage2(streamError)?.trim();
|
|
12465
13454
|
if (!threadId || !message) return;
|
|
12466
13455
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12467
13456
|
const errorStatus = "error";
|
|
@@ -12482,7 +13471,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12482
13471
|
return changed ? sortThreadRecords(next) : prev;
|
|
12483
13472
|
});
|
|
12484
13473
|
}, [threadId, streamError]);
|
|
12485
|
-
|
|
13474
|
+
React39.useEffect(() => {
|
|
12486
13475
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
12487
13476
|
let cancelled = false;
|
|
12488
13477
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -12496,7 +13485,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12496
13485
|
cancelled = true;
|
|
12497
13486
|
};
|
|
12498
13487
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
12499
|
-
const threads =
|
|
13488
|
+
const threads = React39.useMemo(
|
|
12500
13489
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
12501
13490
|
[threadRecords]
|
|
12502
13491
|
);
|
|
@@ -12513,10 +13502,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12513
13502
|
}
|
|
12514
13503
|
|
|
12515
13504
|
// src/components/thread/context-usage-indicator.tsx
|
|
12516
|
-
import * as
|
|
13505
|
+
import * as React40 from "react";
|
|
12517
13506
|
|
|
12518
13507
|
// src/components/ui/progress-circle.tsx
|
|
12519
|
-
import { jsx as
|
|
13508
|
+
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
12520
13509
|
function clamp2(input, a, b) {
|
|
12521
13510
|
return Math.max(Math.min(input, Math.max(a, b)), Math.min(a, b));
|
|
12522
13511
|
}
|
|
@@ -12539,7 +13528,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12539
13528
|
return (
|
|
12540
13529
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
12541
13530
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
12542
|
-
/* @__PURE__ */
|
|
13531
|
+
/* @__PURE__ */ jsxs32(
|
|
12543
13532
|
"svg",
|
|
12544
13533
|
{
|
|
12545
13534
|
role: "progressbar",
|
|
@@ -12550,8 +13539,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12550
13539
|
"aria-valuemax": 100,
|
|
12551
13540
|
...restSvgProps,
|
|
12552
13541
|
children: [
|
|
12553
|
-
/* @__PURE__ */
|
|
12554
|
-
/* @__PURE__ */
|
|
13542
|
+
/* @__PURE__ */ jsx45("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
13543
|
+
/* @__PURE__ */ jsx45(
|
|
12555
13544
|
"circle",
|
|
12556
13545
|
{
|
|
12557
13546
|
...commonParams,
|
|
@@ -12570,7 +13559,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12570
13559
|
};
|
|
12571
13560
|
|
|
12572
13561
|
// src/components/thread/context-usage-indicator.tsx
|
|
12573
|
-
import { jsx as
|
|
13562
|
+
import { jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
12574
13563
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
12575
13564
|
minimumFractionDigits: 0,
|
|
12576
13565
|
maximumFractionDigits: 1
|
|
@@ -12603,21 +13592,22 @@ function ContextUsageIndicator({
|
|
|
12603
13592
|
}) {
|
|
12604
13593
|
const { t } = useChatkitTranslation();
|
|
12605
13594
|
const stream = useStreamContext();
|
|
12606
|
-
const [maxContextSize, setMaxContextSize] =
|
|
12607
|
-
const [usedContextSize, setUsedContextSize] =
|
|
12608
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
12609
|
-
const latestRealtimeUsageRef =
|
|
13595
|
+
const [maxContextSize, setMaxContextSize] = React40.useState(null);
|
|
13596
|
+
const [usedContextSize, setUsedContextSize] = React40.useState(null);
|
|
13597
|
+
const [assistantAgentKey, setAssistantAgentKey] = React40.useState(null);
|
|
13598
|
+
const latestRealtimeUsageRef = React40.useRef({
|
|
12610
13599
|
threadId: null,
|
|
12611
13600
|
agentKey: null,
|
|
12612
13601
|
usedTokens: null
|
|
12613
13602
|
});
|
|
12614
|
-
const realtimeUsage =
|
|
13603
|
+
const realtimeUsage = React40.useMemo(
|
|
12615
13604
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
12616
13605
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
12617
13606
|
);
|
|
12618
13607
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
12619
|
-
|
|
12620
|
-
|
|
13608
|
+
const hasApiConfiguration = Boolean(stream.apiUrl?.trim() && stream.apiKey?.trim());
|
|
13609
|
+
React40.useEffect(() => {
|
|
13610
|
+
if (!hasApiConfiguration || !stream.client || !stream.assistantId) {
|
|
12621
13611
|
setMaxContextSize(null);
|
|
12622
13612
|
setAssistantAgentKey(null);
|
|
12623
13613
|
return;
|
|
@@ -12635,20 +13625,20 @@ function ContextUsageIndicator({
|
|
|
12635
13625
|
return () => {
|
|
12636
13626
|
cancelled = true;
|
|
12637
13627
|
};
|
|
12638
|
-
}, [stream.client, stream.assistantId]);
|
|
12639
|
-
|
|
13628
|
+
}, [hasApiConfiguration, stream.client, stream.assistantId]);
|
|
13629
|
+
React40.useEffect(() => {
|
|
12640
13630
|
latestRealtimeUsageRef.current = {
|
|
12641
13631
|
threadId: stream.threadId ?? null,
|
|
12642
13632
|
agentKey: assistantAgentKey,
|
|
12643
13633
|
usedTokens: realtimeUsedContextSize
|
|
12644
13634
|
};
|
|
12645
13635
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
12646
|
-
|
|
13636
|
+
React40.useEffect(() => {
|
|
12647
13637
|
if (realtimeUsedContextSize == null) return;
|
|
12648
13638
|
setUsedContextSize(realtimeUsedContextSize);
|
|
12649
13639
|
}, [realtimeUsedContextSize]);
|
|
12650
|
-
|
|
12651
|
-
if (!stream.client) {
|
|
13640
|
+
React40.useEffect(() => {
|
|
13641
|
+
if (!hasApiConfiguration || !stream.client) {
|
|
12652
13642
|
setUsedContextSize(null);
|
|
12653
13643
|
return;
|
|
12654
13644
|
}
|
|
@@ -12684,6 +13674,7 @@ function ContextUsageIndicator({
|
|
|
12684
13674
|
};
|
|
12685
13675
|
}, [
|
|
12686
13676
|
assistantAgentKey,
|
|
13677
|
+
hasApiConfiguration,
|
|
12687
13678
|
realtimeUsedContextSize,
|
|
12688
13679
|
stream.apiKey,
|
|
12689
13680
|
stream.apiUrl,
|
|
@@ -12712,8 +13703,8 @@ function ContextUsageIndicator({
|
|
|
12712
13703
|
});
|
|
12713
13704
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
12714
13705
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
12715
|
-
return /* @__PURE__ */
|
|
12716
|
-
/* @__PURE__ */
|
|
13706
|
+
return /* @__PURE__ */ jsxs33(Tooltip, { children: [
|
|
13707
|
+
/* @__PURE__ */ jsx46(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx46(
|
|
12717
13708
|
"button",
|
|
12718
13709
|
{
|
|
12719
13710
|
type: "button",
|
|
@@ -12722,31 +13713,31 @@ function ContextUsageIndicator({
|
|
|
12722
13713
|
className
|
|
12723
13714
|
),
|
|
12724
13715
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
12725
|
-
children: /* @__PURE__ */
|
|
13716
|
+
children: /* @__PURE__ */ jsx46(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
12726
13717
|
}
|
|
12727
13718
|
) }),
|
|
12728
|
-
/* @__PURE__ */
|
|
12729
|
-
/* @__PURE__ */
|
|
12730
|
-
/* @__PURE__ */
|
|
12731
|
-
/* @__PURE__ */
|
|
13719
|
+
/* @__PURE__ */ jsxs33(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
13720
|
+
/* @__PURE__ */ jsx46("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
13721
|
+
/* @__PURE__ */ jsx46("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
13722
|
+
/* @__PURE__ */ jsx46("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
12732
13723
|
] })
|
|
12733
13724
|
] });
|
|
12734
13725
|
}
|
|
12735
13726
|
|
|
12736
13727
|
// src/components/pet/PetBridge.tsx
|
|
12737
|
-
import * as
|
|
13728
|
+
import * as React41 from "react";
|
|
12738
13729
|
import { normalizePetOptions } from "@xpert-ai/chatkit-types";
|
|
12739
13730
|
function PetBridge({ pet, state }) {
|
|
12740
13731
|
const parentMessenger = useParentMessenger();
|
|
12741
13732
|
const sendEvent = parentMessenger?.sendEvent;
|
|
12742
|
-
const options =
|
|
12743
|
-
|
|
13733
|
+
const options = React41.useMemo(() => normalizePetOptions(pet), [pet]);
|
|
13734
|
+
React41.useEffect(() => {
|
|
12744
13735
|
if (!sendEvent) {
|
|
12745
13736
|
return;
|
|
12746
13737
|
}
|
|
12747
13738
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
12748
13739
|
}, [sendEvent, pet]);
|
|
12749
|
-
|
|
13740
|
+
React41.useEffect(() => {
|
|
12750
13741
|
if (!sendEvent || !options) {
|
|
12751
13742
|
return;
|
|
12752
13743
|
}
|
|
@@ -12756,15 +13747,15 @@ function PetBridge({ pet, state }) {
|
|
|
12756
13747
|
}
|
|
12757
13748
|
|
|
12758
13749
|
// src/components/settings/SettingsSheet.tsx
|
|
12759
|
-
import * as
|
|
13750
|
+
import * as React48 from "react";
|
|
12760
13751
|
import { PawPrint, Settings } from "lucide-react";
|
|
12761
13752
|
|
|
12762
13753
|
// src/components/ui/input.tsx
|
|
12763
|
-
import * as
|
|
12764
|
-
import { jsx as
|
|
12765
|
-
var Input =
|
|
13754
|
+
import * as React42 from "react";
|
|
13755
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
13756
|
+
var Input = React42.forwardRef(
|
|
12766
13757
|
({ className, type, ...props }, ref) => {
|
|
12767
|
-
return /* @__PURE__ */
|
|
13758
|
+
return /* @__PURE__ */ jsx47(
|
|
12768
13759
|
"input",
|
|
12769
13760
|
{
|
|
12770
13761
|
ref,
|
|
@@ -12784,17 +13775,17 @@ Input.displayName = "Input";
|
|
|
12784
13775
|
import "react";
|
|
12785
13776
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
12786
13777
|
import { ChevronDownIcon as ChevronDownIcon2, CheckIcon as CheckIcon4, ChevronUpIcon } from "lucide-react";
|
|
12787
|
-
import { jsx as
|
|
13778
|
+
import { jsx as jsx48, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
12788
13779
|
function Select({
|
|
12789
13780
|
...props
|
|
12790
13781
|
}) {
|
|
12791
|
-
return /* @__PURE__ */
|
|
13782
|
+
return /* @__PURE__ */ jsx48(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
12792
13783
|
}
|
|
12793
13784
|
function SelectGroup({
|
|
12794
13785
|
className,
|
|
12795
13786
|
...props
|
|
12796
13787
|
}) {
|
|
12797
|
-
return /* @__PURE__ */
|
|
13788
|
+
return /* @__PURE__ */ jsx48(
|
|
12798
13789
|
SelectPrimitive.Group,
|
|
12799
13790
|
{
|
|
12800
13791
|
"data-slot": "select-group",
|
|
@@ -12806,7 +13797,7 @@ function SelectGroup({
|
|
|
12806
13797
|
function SelectValue({
|
|
12807
13798
|
...props
|
|
12808
13799
|
}) {
|
|
12809
|
-
return /* @__PURE__ */
|
|
13800
|
+
return /* @__PURE__ */ jsx48(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
12810
13801
|
}
|
|
12811
13802
|
function SelectTrigger({
|
|
12812
13803
|
className,
|
|
@@ -12814,7 +13805,7 @@ function SelectTrigger({
|
|
|
12814
13805
|
children,
|
|
12815
13806
|
...props
|
|
12816
13807
|
}) {
|
|
12817
|
-
return /* @__PURE__ */
|
|
13808
|
+
return /* @__PURE__ */ jsxs34(
|
|
12818
13809
|
SelectPrimitive.Trigger,
|
|
12819
13810
|
{
|
|
12820
13811
|
"data-slot": "select-trigger",
|
|
@@ -12826,7 +13817,7 @@ function SelectTrigger({
|
|
|
12826
13817
|
...props,
|
|
12827
13818
|
children: [
|
|
12828
13819
|
children,
|
|
12829
|
-
/* @__PURE__ */
|
|
13820
|
+
/* @__PURE__ */ jsx48(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx48(ChevronDownIcon2, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
12830
13821
|
]
|
|
12831
13822
|
}
|
|
12832
13823
|
);
|
|
@@ -12838,7 +13829,7 @@ function SelectContent({
|
|
|
12838
13829
|
align = "center",
|
|
12839
13830
|
...props
|
|
12840
13831
|
}) {
|
|
12841
|
-
return /* @__PURE__ */
|
|
13832
|
+
return /* @__PURE__ */ jsx48(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs34(
|
|
12842
13833
|
SelectPrimitive.Content,
|
|
12843
13834
|
{
|
|
12844
13835
|
"data-slot": "select-content",
|
|
@@ -12848,8 +13839,8 @@ function SelectContent({
|
|
|
12848
13839
|
align,
|
|
12849
13840
|
...props,
|
|
12850
13841
|
children: [
|
|
12851
|
-
/* @__PURE__ */
|
|
12852
|
-
/* @__PURE__ */
|
|
13842
|
+
/* @__PURE__ */ jsx48(SelectScrollUpButton, {}),
|
|
13843
|
+
/* @__PURE__ */ jsx48(
|
|
12853
13844
|
SelectPrimitive.Viewport,
|
|
12854
13845
|
{
|
|
12855
13846
|
"data-position": position,
|
|
@@ -12860,7 +13851,7 @@ function SelectContent({
|
|
|
12860
13851
|
children
|
|
12861
13852
|
}
|
|
12862
13853
|
),
|
|
12863
|
-
/* @__PURE__ */
|
|
13854
|
+
/* @__PURE__ */ jsx48(SelectScrollDownButton, {})
|
|
12864
13855
|
]
|
|
12865
13856
|
}
|
|
12866
13857
|
) });
|
|
@@ -12870,7 +13861,7 @@ function SelectItem({
|
|
|
12870
13861
|
children,
|
|
12871
13862
|
...props
|
|
12872
13863
|
}) {
|
|
12873
|
-
return /* @__PURE__ */
|
|
13864
|
+
return /* @__PURE__ */ jsxs34(
|
|
12874
13865
|
SelectPrimitive.Item,
|
|
12875
13866
|
{
|
|
12876
13867
|
"data-slot": "select-item",
|
|
@@ -12880,8 +13871,8 @@ function SelectItem({
|
|
|
12880
13871
|
),
|
|
12881
13872
|
...props,
|
|
12882
13873
|
children: [
|
|
12883
|
-
/* @__PURE__ */
|
|
12884
|
-
/* @__PURE__ */
|
|
13874
|
+
/* @__PURE__ */ jsx48("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx48(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx48(CheckIcon4, { className: "pointer-events-none" }) }) }),
|
|
13875
|
+
/* @__PURE__ */ jsx48(SelectPrimitive.ItemText, { children })
|
|
12885
13876
|
]
|
|
12886
13877
|
}
|
|
12887
13878
|
);
|
|
@@ -12890,7 +13881,7 @@ function SelectScrollUpButton({
|
|
|
12890
13881
|
className,
|
|
12891
13882
|
...props
|
|
12892
13883
|
}) {
|
|
12893
|
-
return /* @__PURE__ */
|
|
13884
|
+
return /* @__PURE__ */ jsx48(
|
|
12894
13885
|
SelectPrimitive.ScrollUpButton,
|
|
12895
13886
|
{
|
|
12896
13887
|
"data-slot": "select-scroll-up-button",
|
|
@@ -12899,7 +13890,7 @@ function SelectScrollUpButton({
|
|
|
12899
13890
|
className
|
|
12900
13891
|
),
|
|
12901
13892
|
...props,
|
|
12902
|
-
children: /* @__PURE__ */
|
|
13893
|
+
children: /* @__PURE__ */ jsx48(
|
|
12903
13894
|
ChevronUpIcon,
|
|
12904
13895
|
{}
|
|
12905
13896
|
)
|
|
@@ -12910,7 +13901,7 @@ function SelectScrollDownButton({
|
|
|
12910
13901
|
className,
|
|
12911
13902
|
...props
|
|
12912
13903
|
}) {
|
|
12913
|
-
return /* @__PURE__ */
|
|
13904
|
+
return /* @__PURE__ */ jsx48(
|
|
12914
13905
|
SelectPrimitive.ScrollDownButton,
|
|
12915
13906
|
{
|
|
12916
13907
|
"data-slot": "select-scroll-down-button",
|
|
@@ -12919,7 +13910,7 @@ function SelectScrollDownButton({
|
|
|
12919
13910
|
className
|
|
12920
13911
|
),
|
|
12921
13912
|
...props,
|
|
12922
|
-
children: /* @__PURE__ */
|
|
13913
|
+
children: /* @__PURE__ */ jsx48(
|
|
12923
13914
|
ChevronDownIcon2,
|
|
12924
13915
|
{}
|
|
12925
13916
|
)
|
|
@@ -12928,9 +13919,9 @@ function SelectScrollDownButton({
|
|
|
12928
13919
|
}
|
|
12929
13920
|
|
|
12930
13921
|
// src/components/ui/slider.tsx
|
|
12931
|
-
import * as
|
|
13922
|
+
import * as React44 from "react";
|
|
12932
13923
|
import { Slider as SliderPrimitive } from "radix-ui";
|
|
12933
|
-
import { jsx as
|
|
13924
|
+
import { jsx as jsx49, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
12934
13925
|
function Slider({
|
|
12935
13926
|
className,
|
|
12936
13927
|
defaultValue,
|
|
@@ -12939,11 +13930,11 @@ function Slider({
|
|
|
12939
13930
|
max = 100,
|
|
12940
13931
|
...props
|
|
12941
13932
|
}) {
|
|
12942
|
-
const _values =
|
|
13933
|
+
const _values = React44.useMemo(
|
|
12943
13934
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
12944
13935
|
[value, defaultValue, min, max]
|
|
12945
13936
|
);
|
|
12946
|
-
return /* @__PURE__ */
|
|
13937
|
+
return /* @__PURE__ */ jsxs35(
|
|
12947
13938
|
SliderPrimitive.Root,
|
|
12948
13939
|
{
|
|
12949
13940
|
"data-slot": "slider",
|
|
@@ -12957,12 +13948,12 @@ function Slider({
|
|
|
12957
13948
|
),
|
|
12958
13949
|
...props,
|
|
12959
13950
|
children: [
|
|
12960
|
-
/* @__PURE__ */
|
|
13951
|
+
/* @__PURE__ */ jsx49(
|
|
12961
13952
|
SliderPrimitive.Track,
|
|
12962
13953
|
{
|
|
12963
13954
|
"data-slot": "slider-track",
|
|
12964
13955
|
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",
|
|
12965
|
-
children: /* @__PURE__ */
|
|
13956
|
+
children: /* @__PURE__ */ jsx49(
|
|
12966
13957
|
SliderPrimitive.Range,
|
|
12967
13958
|
{
|
|
12968
13959
|
"data-slot": "slider-range",
|
|
@@ -12971,7 +13962,7 @@ function Slider({
|
|
|
12971
13962
|
)
|
|
12972
13963
|
}
|
|
12973
13964
|
),
|
|
12974
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */
|
|
13965
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx49(
|
|
12975
13966
|
SliderPrimitive.Thumb,
|
|
12976
13967
|
{
|
|
12977
13968
|
"data-slot": "slider-thumb",
|
|
@@ -12985,7 +13976,7 @@ function Slider({
|
|
|
12985
13976
|
}
|
|
12986
13977
|
|
|
12987
13978
|
// src/components/ui/toggle-group.tsx
|
|
12988
|
-
import * as
|
|
13979
|
+
import * as React46 from "react";
|
|
12989
13980
|
import "class-variance-authority";
|
|
12990
13981
|
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
12991
13982
|
|
|
@@ -12993,7 +13984,7 @@ import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
|
12993
13984
|
import "react";
|
|
12994
13985
|
import { cva as cva2 } from "class-variance-authority";
|
|
12995
13986
|
import { Toggle as TogglePrimitive } from "radix-ui";
|
|
12996
|
-
import { jsx as
|
|
13987
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
12997
13988
|
var toggleVariants = cva2(
|
|
12998
13989
|
"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",
|
|
12999
13990
|
{
|
|
@@ -13016,8 +14007,8 @@ var toggleVariants = cva2(
|
|
|
13016
14007
|
);
|
|
13017
14008
|
|
|
13018
14009
|
// src/components/ui/toggle-group.tsx
|
|
13019
|
-
import { jsx as
|
|
13020
|
-
var ToggleGroupContext =
|
|
14010
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
14011
|
+
var ToggleGroupContext = React46.createContext({
|
|
13021
14012
|
size: "default",
|
|
13022
14013
|
variant: "default",
|
|
13023
14014
|
spacing: 0,
|
|
@@ -13032,7 +14023,7 @@ function ToggleGroup({
|
|
|
13032
14023
|
children,
|
|
13033
14024
|
...props
|
|
13034
14025
|
}) {
|
|
13035
|
-
return /* @__PURE__ */
|
|
14026
|
+
return /* @__PURE__ */ jsx51(
|
|
13036
14027
|
ToggleGroupPrimitive.Root,
|
|
13037
14028
|
{
|
|
13038
14029
|
"data-slot": "toggle-group",
|
|
@@ -13046,7 +14037,7 @@ function ToggleGroup({
|
|
|
13046
14037
|
className
|
|
13047
14038
|
),
|
|
13048
14039
|
...props,
|
|
13049
|
-
children: /* @__PURE__ */
|
|
14040
|
+
children: /* @__PURE__ */ jsx51(
|
|
13050
14041
|
ToggleGroupContext.Provider,
|
|
13051
14042
|
{
|
|
13052
14043
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -13063,8 +14054,8 @@ function ToggleGroupItem({
|
|
|
13063
14054
|
size: size2 = "default",
|
|
13064
14055
|
...props
|
|
13065
14056
|
}) {
|
|
13066
|
-
const context =
|
|
13067
|
-
return /* @__PURE__ */
|
|
14057
|
+
const context = React46.useContext(ToggleGroupContext);
|
|
14058
|
+
return /* @__PURE__ */ jsx51(
|
|
13068
14059
|
ToggleGroupPrimitive.Item,
|
|
13069
14060
|
{
|
|
13070
14061
|
"data-slot": "toggle-group-item",
|
|
@@ -13304,7 +14295,7 @@ import {
|
|
|
13304
14295
|
} from "@xpert-ai/chatkit-types";
|
|
13305
14296
|
|
|
13306
14297
|
// src/components/pet/PetPreview.tsx
|
|
13307
|
-
import { jsx as
|
|
14298
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
13308
14299
|
function escapeCssUrl(value) {
|
|
13309
14300
|
return value.replace(/["\\]/g, "\\$&");
|
|
13310
14301
|
}
|
|
@@ -13312,7 +14303,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13312
14303
|
const scale = 0.13;
|
|
13313
14304
|
const width = petSpriteAtlas.cellWidth;
|
|
13314
14305
|
const height = petSpriteAtlas.cellHeight;
|
|
13315
|
-
return /* @__PURE__ */
|
|
14306
|
+
return /* @__PURE__ */ jsx52(
|
|
13316
14307
|
"span",
|
|
13317
14308
|
{
|
|
13318
14309
|
className: cn(
|
|
@@ -13321,7 +14312,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13321
14312
|
),
|
|
13322
14313
|
"aria-hidden": "true",
|
|
13323
14314
|
title: label,
|
|
13324
|
-
children: /* @__PURE__ */
|
|
14315
|
+
children: /* @__PURE__ */ jsx52(
|
|
13325
14316
|
"span",
|
|
13326
14317
|
{
|
|
13327
14318
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -13343,7 +14334,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13343
14334
|
}
|
|
13344
14335
|
|
|
13345
14336
|
// src/components/settings/SettingsSheet.tsx
|
|
13346
|
-
import { jsx as
|
|
14337
|
+
import { jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
13347
14338
|
var CHARACTER_TYPES2 = [
|
|
13348
14339
|
"builtin",
|
|
13349
14340
|
"atlas"
|
|
@@ -13359,13 +14350,13 @@ function SettingsSheet({
|
|
|
13359
14350
|
onSave
|
|
13360
14351
|
}) {
|
|
13361
14352
|
const { t } = useChatkitTranslation();
|
|
13362
|
-
const [draft, setDraft] =
|
|
13363
|
-
|
|
14353
|
+
const [draft, setDraft] = React48.useState(settings);
|
|
14354
|
+
React48.useEffect(() => {
|
|
13364
14355
|
if (open) {
|
|
13365
14356
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
13366
14357
|
}
|
|
13367
14358
|
}, [open, petRequired, settings]);
|
|
13368
|
-
const updateDraft =
|
|
14359
|
+
const updateDraft = React48.useCallback(
|
|
13369
14360
|
(patch) => {
|
|
13370
14361
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
13371
14362
|
},
|
|
@@ -13383,23 +14374,23 @@ function SettingsSheet({
|
|
|
13383
14374
|
defaultValue: selectedBuiltinPet.label
|
|
13384
14375
|
}
|
|
13385
14376
|
);
|
|
13386
|
-
return /* @__PURE__ */
|
|
13387
|
-
/* @__PURE__ */
|
|
13388
|
-
/* @__PURE__ */
|
|
13389
|
-
/* @__PURE__ */
|
|
14377
|
+
return /* @__PURE__ */ jsx53(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs36(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
|
|
14378
|
+
/* @__PURE__ */ jsx53(SheetHeader, { children: /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
|
|
14379
|
+
/* @__PURE__ */ jsx53("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ jsx53(Settings, { size: 16 }) }),
|
|
14380
|
+
/* @__PURE__ */ jsx53(SheetTitle, { children: t("settings.title") })
|
|
13390
14381
|
] }) }),
|
|
13391
|
-
/* @__PURE__ */
|
|
13392
|
-
/* @__PURE__ */
|
|
13393
|
-
/* @__PURE__ */
|
|
13394
|
-
/* @__PURE__ */
|
|
13395
|
-
/* @__PURE__ */
|
|
14382
|
+
/* @__PURE__ */ jsxs36("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
|
|
14383
|
+
/* @__PURE__ */ jsxs36("section", { className: "space-y-5", children: [
|
|
14384
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
|
|
14385
|
+
/* @__PURE__ */ jsx53("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx53(PawPrint, { size: 15 }) }),
|
|
14386
|
+
/* @__PURE__ */ jsx53("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
|
|
13396
14387
|
] }),
|
|
13397
|
-
/* @__PURE__ */
|
|
13398
|
-
/* @__PURE__ */
|
|
13399
|
-
/* @__PURE__ */
|
|
13400
|
-
petRequired && /* @__PURE__ */
|
|
14388
|
+
/* @__PURE__ */ jsxs36("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
|
|
14389
|
+
/* @__PURE__ */ jsxs36("span", { className: "min-w-0", children: [
|
|
14390
|
+
/* @__PURE__ */ jsx53("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
|
|
14391
|
+
petRequired && /* @__PURE__ */ jsx53("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
|
|
13401
14392
|
] }),
|
|
13402
|
-
/* @__PURE__ */
|
|
14393
|
+
/* @__PURE__ */ jsx53(
|
|
13403
14394
|
"button",
|
|
13404
14395
|
{
|
|
13405
14396
|
type: "button",
|
|
@@ -13412,7 +14403,7 @@ function SettingsSheet({
|
|
|
13412
14403
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
13413
14404
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
13414
14405
|
].join(" "),
|
|
13415
|
-
children: /* @__PURE__ */
|
|
14406
|
+
children: /* @__PURE__ */ jsx53(
|
|
13416
14407
|
"span",
|
|
13417
14408
|
{
|
|
13418
14409
|
className: [
|
|
@@ -13425,9 +14416,9 @@ function SettingsSheet({
|
|
|
13425
14416
|
)
|
|
13426
14417
|
] })
|
|
13427
14418
|
] }),
|
|
13428
|
-
/* @__PURE__ */
|
|
13429
|
-
/* @__PURE__ */
|
|
13430
|
-
/* @__PURE__ */
|
|
14419
|
+
/* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14420
|
+
/* @__PURE__ */ jsx53("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
|
|
14421
|
+
/* @__PURE__ */ jsx53(
|
|
13431
14422
|
ToggleGroup,
|
|
13432
14423
|
{
|
|
13433
14424
|
id: "chatkit-pet-type",
|
|
@@ -13442,7 +14433,7 @@ function SettingsSheet({
|
|
|
13442
14433
|
variant: "outline",
|
|
13443
14434
|
spacing: 2,
|
|
13444
14435
|
className: "!w-full",
|
|
13445
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */
|
|
14436
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ jsx53(
|
|
13446
14437
|
ToggleGroupItem,
|
|
13447
14438
|
{
|
|
13448
14439
|
value: type,
|
|
@@ -13454,8 +14445,8 @@ function SettingsSheet({
|
|
|
13454
14445
|
}
|
|
13455
14446
|
)
|
|
13456
14447
|
] }),
|
|
13457
|
-
draft.characterType === "builtin" && /* @__PURE__ */
|
|
13458
|
-
/* @__PURE__ */
|
|
14448
|
+
draft.characterType === "builtin" && /* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14449
|
+
/* @__PURE__ */ jsx53(
|
|
13459
14450
|
"label",
|
|
13460
14451
|
{
|
|
13461
14452
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -13463,7 +14454,7 @@ function SettingsSheet({
|
|
|
13463
14454
|
children: t("pet.settings.builtin")
|
|
13464
14455
|
}
|
|
13465
14456
|
),
|
|
13466
|
-
/* @__PURE__ */
|
|
14457
|
+
/* @__PURE__ */ jsxs36(
|
|
13467
14458
|
Select,
|
|
13468
14459
|
{
|
|
13469
14460
|
value: selectedBuiltinPet.id,
|
|
@@ -13474,26 +14465,26 @@ function SettingsSheet({
|
|
|
13474
14465
|
}
|
|
13475
14466
|
},
|
|
13476
14467
|
children: [
|
|
13477
|
-
/* @__PURE__ */
|
|
14468
|
+
/* @__PURE__ */ jsx53(
|
|
13478
14469
|
SelectTrigger,
|
|
13479
14470
|
{
|
|
13480
14471
|
id: "chatkit-pet-builtin",
|
|
13481
14472
|
className: "min-h-12 w-full px-3 py-2",
|
|
13482
|
-
children: /* @__PURE__ */
|
|
14473
|
+
children: /* @__PURE__ */ jsx53(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
13483
14474
|
}
|
|
13484
14475
|
),
|
|
13485
|
-
/* @__PURE__ */
|
|
14476
|
+
/* @__PURE__ */ jsx53(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ jsx53(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
13486
14477
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
13487
14478
|
defaultValue: pet.label
|
|
13488
14479
|
});
|
|
13489
|
-
return /* @__PURE__ */
|
|
14480
|
+
return /* @__PURE__ */ jsx53(
|
|
13490
14481
|
SelectItem,
|
|
13491
14482
|
{
|
|
13492
14483
|
value: pet.id,
|
|
13493
14484
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
13494
|
-
children: /* @__PURE__ */
|
|
13495
|
-
/* @__PURE__ */
|
|
13496
|
-
/* @__PURE__ */
|
|
14485
|
+
children: /* @__PURE__ */ jsxs36("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
14486
|
+
/* @__PURE__ */ jsx53(PetPreview, { src: pet.previewSrc, label }),
|
|
14487
|
+
/* @__PURE__ */ jsx53("span", { className: "min-w-0 truncate", children: label })
|
|
13497
14488
|
] })
|
|
13498
14489
|
},
|
|
13499
14490
|
pet.id
|
|
@@ -13503,8 +14494,8 @@ function SettingsSheet({
|
|
|
13503
14494
|
}
|
|
13504
14495
|
)
|
|
13505
14496
|
] }),
|
|
13506
|
-
draft.characterType === "atlas" && /* @__PURE__ */
|
|
13507
|
-
/* @__PURE__ */
|
|
14497
|
+
draft.characterType === "atlas" && /* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14498
|
+
/* @__PURE__ */ jsx53(
|
|
13508
14499
|
"label",
|
|
13509
14500
|
{
|
|
13510
14501
|
className: "text-sm font-medium",
|
|
@@ -13512,7 +14503,7 @@ function SettingsSheet({
|
|
|
13512
14503
|
children: t("pet.settings.atlasUrl")
|
|
13513
14504
|
}
|
|
13514
14505
|
),
|
|
13515
|
-
/* @__PURE__ */
|
|
14506
|
+
/* @__PURE__ */ jsx53(
|
|
13516
14507
|
Input,
|
|
13517
14508
|
{
|
|
13518
14509
|
id: "chatkit-pet-atlas",
|
|
@@ -13522,15 +14513,15 @@ function SettingsSheet({
|
|
|
13522
14513
|
}
|
|
13523
14514
|
)
|
|
13524
14515
|
] }),
|
|
13525
|
-
/* @__PURE__ */
|
|
13526
|
-
/* @__PURE__ */
|
|
13527
|
-
/* @__PURE__ */
|
|
13528
|
-
/* @__PURE__ */
|
|
14516
|
+
/* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14517
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-between gap-4", children: [
|
|
14518
|
+
/* @__PURE__ */ jsx53("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
|
|
14519
|
+
/* @__PURE__ */ jsxs36("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
13529
14520
|
draft.scale.toFixed(2),
|
|
13530
14521
|
"x"
|
|
13531
14522
|
] })
|
|
13532
14523
|
] }),
|
|
13533
|
-
/* @__PURE__ */
|
|
14524
|
+
/* @__PURE__ */ jsx53(
|
|
13534
14525
|
Slider,
|
|
13535
14526
|
{
|
|
13536
14527
|
id: "chatkit-pet-scale",
|
|
@@ -13544,8 +14535,8 @@ function SettingsSheet({
|
|
|
13544
14535
|
}
|
|
13545
14536
|
)
|
|
13546
14537
|
] }),
|
|
13547
|
-
/* @__PURE__ */
|
|
13548
|
-
/* @__PURE__ */
|
|
14538
|
+
/* @__PURE__ */ jsxs36("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14539
|
+
/* @__PURE__ */ jsx53(
|
|
13549
14540
|
"input",
|
|
13550
14541
|
{
|
|
13551
14542
|
type: "checkbox",
|
|
@@ -13556,8 +14547,8 @@ function SettingsSheet({
|
|
|
13556
14547
|
),
|
|
13557
14548
|
t("pet.settings.draggable")
|
|
13558
14549
|
] }),
|
|
13559
|
-
/* @__PURE__ */
|
|
13560
|
-
/* @__PURE__ */
|
|
14550
|
+
/* @__PURE__ */ jsxs36("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14551
|
+
/* @__PURE__ */ jsx53(
|
|
13561
14552
|
"input",
|
|
13562
14553
|
{
|
|
13563
14554
|
type: "checkbox",
|
|
@@ -13568,8 +14559,8 @@ function SettingsSheet({
|
|
|
13568
14559
|
),
|
|
13569
14560
|
t("pet.settings.persistPosition")
|
|
13570
14561
|
] }),
|
|
13571
|
-
/* @__PURE__ */
|
|
13572
|
-
/* @__PURE__ */
|
|
14562
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
14563
|
+
/* @__PURE__ */ jsx53(
|
|
13573
14564
|
Button,
|
|
13574
14565
|
{
|
|
13575
14566
|
type: "button",
|
|
@@ -13578,7 +14569,7 @@ function SettingsSheet({
|
|
|
13578
14569
|
children: t("pet.settings.cancel")
|
|
13579
14570
|
}
|
|
13580
14571
|
),
|
|
13581
|
-
/* @__PURE__ */
|
|
14572
|
+
/* @__PURE__ */ jsx53(Button, { type: "submit", children: t("pet.settings.save") })
|
|
13582
14573
|
] })
|
|
13583
14574
|
] })
|
|
13584
14575
|
] }) });
|
|
@@ -14205,7 +15196,7 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
14205
15196
|
}
|
|
14206
15197
|
|
|
14207
15198
|
// src/components/chat.tsx
|
|
14208
|
-
import { Fragment as Fragment9, jsx as
|
|
15199
|
+
import { Fragment as Fragment9, jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
14209
15200
|
var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
|
|
14210
15201
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
14211
15202
|
var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
|
|
@@ -14350,7 +15341,7 @@ function ReferenceChip({
|
|
|
14350
15341
|
const metaLine = getReferenceMetaLine(reference);
|
|
14351
15342
|
const isComposer = variant === "composer";
|
|
14352
15343
|
const Icon = reference.type === "quote" ? Quote : reference.type === "image" ? ImageIcon : FileText5;
|
|
14353
|
-
return /* @__PURE__ */
|
|
15344
|
+
return /* @__PURE__ */ jsxs37(
|
|
14354
15345
|
"div",
|
|
14355
15346
|
{
|
|
14356
15347
|
className: cn(
|
|
@@ -14359,7 +15350,7 @@ function ReferenceChip({
|
|
|
14359
15350
|
),
|
|
14360
15351
|
title: getReferenceTitle(reference),
|
|
14361
15352
|
children: [
|
|
14362
|
-
/* @__PURE__ */
|
|
15353
|
+
/* @__PURE__ */ jsx54(
|
|
14363
15354
|
Icon,
|
|
14364
15355
|
{
|
|
14365
15356
|
size: isComposer ? 14 : 12,
|
|
@@ -14369,8 +15360,8 @@ function ReferenceChip({
|
|
|
14369
15360
|
)
|
|
14370
15361
|
}
|
|
14371
15362
|
),
|
|
14372
|
-
/* @__PURE__ */
|
|
14373
|
-
/* @__PURE__ */
|
|
15363
|
+
/* @__PURE__ */ jsxs37("div", { className: "min-w-0 flex-1", children: [
|
|
15364
|
+
/* @__PURE__ */ jsx54(
|
|
14374
15365
|
"div",
|
|
14375
15366
|
{
|
|
14376
15367
|
className: cn(
|
|
@@ -14380,7 +15371,7 @@ function ReferenceChip({
|
|
|
14380
15371
|
children: getReferenceLabel(reference)
|
|
14381
15372
|
}
|
|
14382
15373
|
),
|
|
14383
|
-
metaLine && /* @__PURE__ */
|
|
15374
|
+
metaLine && /* @__PURE__ */ jsx54(
|
|
14384
15375
|
"div",
|
|
14385
15376
|
{
|
|
14386
15377
|
className: cn(
|
|
@@ -14391,7 +15382,7 @@ function ReferenceChip({
|
|
|
14391
15382
|
}
|
|
14392
15383
|
)
|
|
14393
15384
|
] }),
|
|
14394
|
-
onRemove && removeLabel && /* @__PURE__ */
|
|
15385
|
+
onRemove && removeLabel && /* @__PURE__ */ jsx54(
|
|
14395
15386
|
"button",
|
|
14396
15387
|
{
|
|
14397
15388
|
type: "button",
|
|
@@ -14402,7 +15393,7 @@ function ReferenceChip({
|
|
|
14402
15393
|
),
|
|
14403
15394
|
title: removeLabel,
|
|
14404
15395
|
"aria-label": removeLabel,
|
|
14405
|
-
children: /* @__PURE__ */
|
|
15396
|
+
children: /* @__PURE__ */ jsx54(X6, { size: 12 })
|
|
14406
15397
|
}
|
|
14407
15398
|
)
|
|
14408
15399
|
]
|
|
@@ -14426,26 +15417,26 @@ function Chat({
|
|
|
14426
15417
|
const { setStream } = useStreamManager();
|
|
14427
15418
|
const stream = useStreamContext();
|
|
14428
15419
|
const { theme } = useTheme();
|
|
14429
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
14430
|
-
const [historyError, setHistoryError] =
|
|
14431
|
-
const [assistantName, setAssistantName] =
|
|
14432
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
14433
|
-
const [threadGoal, setThreadGoal] =
|
|
14434
|
-
const [goalError, setGoalError] =
|
|
14435
|
-
const [isGoalLoading, setIsGoalLoading] =
|
|
14436
|
-
const [isGoalPanelOpen, setIsGoalPanelOpen] =
|
|
14437
|
-
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] =
|
|
14438
|
-
const [goalElapsedStartedAt, setGoalElapsedStartedAt] =
|
|
15420
|
+
const [isHistoryLoading, setIsHistoryLoading] = React49.useState(false);
|
|
15421
|
+
const [historyError, setHistoryError] = React49.useState(null);
|
|
15422
|
+
const [assistantName, setAssistantName] = React49.useState(null);
|
|
15423
|
+
const [assistantAvatar, setAssistantAvatar] = React49.useState(null);
|
|
15424
|
+
const [threadGoal, setThreadGoal] = React49.useState(null);
|
|
15425
|
+
const [goalError, setGoalError] = React49.useState(null);
|
|
15426
|
+
const [isGoalLoading, setIsGoalLoading] = React49.useState(false);
|
|
15427
|
+
const [isGoalPanelOpen, setIsGoalPanelOpen] = React49.useState(false);
|
|
15428
|
+
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] = React49.useState(false);
|
|
15429
|
+
const [goalElapsedStartedAt, setGoalElapsedStartedAt] = React49.useState(null);
|
|
14439
15430
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
14440
15431
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
14441
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
14442
|
-
const [streamingNow, setStreamingNow] =
|
|
14443
|
-
const loadingStartTimeRef =
|
|
14444
|
-
const lastStreamOutputAtRef =
|
|
14445
|
-
|
|
15432
|
+
const [showLoadingDots, setShowLoadingDots] = React49.useState(false);
|
|
15433
|
+
const [streamingNow, setStreamingNow] = React49.useState(() => Date.now());
|
|
15434
|
+
const loadingStartTimeRef = React49.useRef(null);
|
|
15435
|
+
const lastStreamOutputAtRef = React49.useRef(null);
|
|
15436
|
+
React49.useEffect(() => {
|
|
14446
15437
|
setStream(stream);
|
|
14447
15438
|
}, [setStream, stream]);
|
|
14448
|
-
|
|
15439
|
+
React49.useEffect(() => {
|
|
14449
15440
|
if (stream.isLoading) {
|
|
14450
15441
|
if (!loadingStartTimeRef.current) {
|
|
14451
15442
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -14468,7 +15459,7 @@ function Chat({
|
|
|
14468
15459
|
}
|
|
14469
15460
|
}
|
|
14470
15461
|
}, [stream.isLoading]);
|
|
14471
|
-
|
|
15462
|
+
React49.useEffect(() => {
|
|
14472
15463
|
if (!stream.isLoading) {
|
|
14473
15464
|
lastStreamOutputAtRef.current = null;
|
|
14474
15465
|
setStreamingNow(Date.now());
|
|
@@ -14478,7 +15469,7 @@ function Chat({
|
|
|
14478
15469
|
lastStreamOutputAtRef.current = now;
|
|
14479
15470
|
setStreamingNow(now);
|
|
14480
15471
|
}, [stream.messages, stream.isLoading]);
|
|
14481
|
-
|
|
15472
|
+
React49.useEffect(() => {
|
|
14482
15473
|
if (!stream.isLoading) {
|
|
14483
15474
|
return;
|
|
14484
15475
|
}
|
|
@@ -14487,7 +15478,7 @@ function Chat({
|
|
|
14487
15478
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
14488
15479
|
return () => window.clearInterval(timer);
|
|
14489
15480
|
}, [stream.isLoading]);
|
|
14490
|
-
|
|
15481
|
+
React49.useEffect(() => {
|
|
14491
15482
|
if (threadGoal?.status === "active" && stream.isLoading) {
|
|
14492
15483
|
setGoalElapsedStartedAt(Date.now());
|
|
14493
15484
|
return;
|
|
@@ -14499,82 +15490,82 @@ function Chat({
|
|
|
14499
15490
|
threadGoal?.id,
|
|
14500
15491
|
threadGoal?.status
|
|
14501
15492
|
]);
|
|
14502
|
-
|
|
15493
|
+
React49.useEffect(() => {
|
|
14503
15494
|
setIsGoalObjectiveExpanded(false);
|
|
14504
15495
|
}, [threadGoal?.id]);
|
|
14505
|
-
const [composerParts, setComposerParts] =
|
|
14506
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
14507
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
14508
|
-
const [selectedTool, setSelectedTool] =
|
|
15496
|
+
const [composerParts, setComposerParts] = React49.useState([]);
|
|
15497
|
+
const [renderedComposerParts, setRenderedComposerParts] = React49.useState([]);
|
|
15498
|
+
const [composerDomVersion, setComposerDomVersion] = React49.useState(0);
|
|
15499
|
+
const [selectedTool, setSelectedTool] = React49.useState(
|
|
14509
15500
|
null
|
|
14510
15501
|
);
|
|
14511
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
14512
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
14513
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
14514
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
14515
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
14516
|
-
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] =
|
|
15502
|
+
const [planModeEnabled, setPlanModeEnabled] = React49.useState(false);
|
|
15503
|
+
const [petSettingsOpen, setPetSettingsOpen] = React49.useState(false);
|
|
15504
|
+
const [petLocalSettings, setPetLocalSettings] = React49.useState(() => readPetLocalSettings());
|
|
15505
|
+
const [runtimeCapabilities, setRuntimeCapabilities] = React49.useState(null);
|
|
15506
|
+
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React49.useState(false);
|
|
15507
|
+
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React49.useState(
|
|
14517
15508
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14518
15509
|
);
|
|
14519
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
15510
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React49.useState(
|
|
14520
15511
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14521
15512
|
);
|
|
14522
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
14523
|
-
const [attachmentState, setAttachmentState] =
|
|
15513
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React49.useState(null);
|
|
15514
|
+
const [attachmentState, setAttachmentState] = React49.useState({
|
|
14524
15515
|
uploadedFiles: [],
|
|
14525
15516
|
hasUploadingFiles: false,
|
|
14526
15517
|
hasParsingFiles: false
|
|
14527
15518
|
});
|
|
14528
|
-
const [references, setReferences] =
|
|
14529
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
14530
|
-
const [quoteSelection, setQuoteSelection] =
|
|
14531
|
-
const [isAtBottom, setIsAtBottom] =
|
|
14532
|
-
const [hasUpdatesBelow, setHasUpdatesBelow] =
|
|
15519
|
+
const [references, setReferences] = React49.useState([]);
|
|
15520
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React49.useState(false);
|
|
15521
|
+
const [quoteSelection, setQuoteSelection] = React49.useState(null);
|
|
15522
|
+
const [isAtBottom, setIsAtBottom] = React49.useState(true);
|
|
15523
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React49.useState(false);
|
|
14533
15524
|
const {
|
|
14534
15525
|
threads,
|
|
14535
15526
|
deleteThread,
|
|
14536
15527
|
refreshThreads,
|
|
14537
15528
|
isLoading: isThreadsLoading
|
|
14538
15529
|
} = useThreads();
|
|
14539
|
-
const viewportRef =
|
|
14540
|
-
const attachmentsRef =
|
|
14541
|
-
const composerInputRef =
|
|
14542
|
-
const slashPaletteRef =
|
|
14543
|
-
const slashPaletteOptionRefs =
|
|
15530
|
+
const viewportRef = React49.useRef(null);
|
|
15531
|
+
const attachmentsRef = React49.useRef(null);
|
|
15532
|
+
const composerInputRef = React49.useRef(null);
|
|
15533
|
+
const slashPaletteRef = React49.useRef(null);
|
|
15534
|
+
const slashPaletteOptionRefs = React49.useRef(
|
|
14544
15535
|
[]
|
|
14545
15536
|
);
|
|
14546
|
-
const composerPartsRef =
|
|
14547
|
-
const pendingComposerCaretOffsetRef =
|
|
14548
|
-
const shouldAutoScrollRef =
|
|
14549
|
-
const forceFollowRef =
|
|
14550
|
-
const previousMessageCountRef =
|
|
14551
|
-
const previousScrollTopRef =
|
|
14552
|
-
const isPrependingHistoryMessagesRef =
|
|
14553
|
-
const autoScrollFrameRef =
|
|
14554
|
-
const isPointerDownRef =
|
|
14555
|
-
const lastTouchYRef =
|
|
14556
|
-
const runtimeCapabilityPreferenceLoadRef =
|
|
15537
|
+
const composerPartsRef = React49.useRef([]);
|
|
15538
|
+
const pendingComposerCaretOffsetRef = React49.useRef(null);
|
|
15539
|
+
const shouldAutoScrollRef = React49.useRef(true);
|
|
15540
|
+
const forceFollowRef = React49.useRef(false);
|
|
15541
|
+
const previousMessageCountRef = React49.useRef(0);
|
|
15542
|
+
const previousScrollTopRef = React49.useRef(0);
|
|
15543
|
+
const isPrependingHistoryMessagesRef = React49.useRef(false);
|
|
15544
|
+
const autoScrollFrameRef = React49.useRef(null);
|
|
15545
|
+
const isPointerDownRef = React49.useRef(false);
|
|
15546
|
+
const lastTouchYRef = React49.useRef(null);
|
|
15547
|
+
const runtimeCapabilityPreferenceLoadRef = React49.useRef(0);
|
|
14557
15548
|
const resolvedTitle = title ?? t("chat.title");
|
|
14558
15549
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
14559
15550
|
const petRequired = options?.displayMode === "pet";
|
|
14560
|
-
const basePetSettings =
|
|
15551
|
+
const basePetSettings = React49.useMemo(
|
|
14561
15552
|
() => derivePetLocalSettings(options?.pet),
|
|
14562
15553
|
[options?.pet]
|
|
14563
15554
|
);
|
|
14564
|
-
const displayedPetSettings =
|
|
15555
|
+
const displayedPetSettings = React49.useMemo(
|
|
14565
15556
|
() => ({
|
|
14566
15557
|
...petLocalSettings ?? basePetSettings,
|
|
14567
15558
|
...petRequired ? { enabled: true } : {}
|
|
14568
15559
|
}),
|
|
14569
15560
|
[basePetSettings, petLocalSettings, petRequired]
|
|
14570
15561
|
);
|
|
14571
|
-
const effectivePet =
|
|
15562
|
+
const effectivePet = React49.useMemo(() => {
|
|
14572
15563
|
if (petRequired || petLocalSettings) {
|
|
14573
15564
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
14574
15565
|
}
|
|
14575
15566
|
return options?.pet ?? null;
|
|
14576
15567
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
14577
|
-
const savePetLocalSettings =
|
|
15568
|
+
const savePetLocalSettings = React49.useCallback(
|
|
14578
15569
|
(settings) => {
|
|
14579
15570
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
14580
15571
|
setPetLocalSettings(nextSettings);
|
|
@@ -14582,7 +15573,7 @@ function Chat({
|
|
|
14582
15573
|
},
|
|
14583
15574
|
[petRequired]
|
|
14584
15575
|
);
|
|
14585
|
-
const handlePetCommand =
|
|
15576
|
+
const handlePetCommand = React49.useCallback(
|
|
14586
15577
|
(mode) => {
|
|
14587
15578
|
if (mode === "settings") {
|
|
14588
15579
|
setPetSettingsOpen(true);
|
|
@@ -14604,7 +15595,7 @@ function Chat({
|
|
|
14604
15595
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
14605
15596
|
);
|
|
14606
15597
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
14607
|
-
const messages =
|
|
15598
|
+
const messages = React49.useMemo(
|
|
14608
15599
|
() => stream.messages ?? [],
|
|
14609
15600
|
[stream.messages]
|
|
14610
15601
|
);
|
|
@@ -14613,7 +15604,7 @@ function Chat({
|
|
|
14613
15604
|
historyMessagePagination?.isLoadingMore
|
|
14614
15605
|
);
|
|
14615
15606
|
const canLoadMoreMessages = Boolean(historyMessagePagination?.hasMore);
|
|
14616
|
-
const draft =
|
|
15607
|
+
const draft = React49.useMemo(
|
|
14617
15608
|
() => getComposerPlainText(composerParts),
|
|
14618
15609
|
[composerParts]
|
|
14619
15610
|
);
|
|
@@ -14627,7 +15618,7 @@ function Chat({
|
|
|
14627
15618
|
isEmpty: isComposerInputEmpty,
|
|
14628
15619
|
isStacked: isComposerStacked
|
|
14629
15620
|
});
|
|
14630
|
-
const pendingFollowUps =
|
|
15621
|
+
const pendingFollowUps = React49.useMemo(
|
|
14631
15622
|
() => sortVisiblePendingFollowUps(stream.pendingFollowUps ?? []),
|
|
14632
15623
|
[stream.pendingFollowUps]
|
|
14633
15624
|
);
|
|
@@ -14636,11 +15627,11 @@ function Chat({
|
|
|
14636
15627
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
14637
15628
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
14638
15629
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
14639
|
-
const runtimeCapabilityOptions =
|
|
15630
|
+
const runtimeCapabilityOptions = React49.useMemo(
|
|
14640
15631
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
14641
15632
|
[runtimeCapabilities]
|
|
14642
15633
|
);
|
|
14643
|
-
const goalAdapter =
|
|
15634
|
+
const goalAdapter = React49.useMemo(
|
|
14644
15635
|
() => {
|
|
14645
15636
|
if (isGoalAdapter(options?.goal)) {
|
|
14646
15637
|
return options.goal;
|
|
@@ -14650,7 +15641,7 @@ function Chat({
|
|
|
14650
15641
|
[options?.goal, stream.client]
|
|
14651
15642
|
);
|
|
14652
15643
|
const displayedGoalElapsedSeconds = threadGoal ? (threadGoal.elapsedSeconds ?? 0) + (goalElapsedStartedAt ? Math.max(0, Math.floor((streamingNow - goalElapsedStartedAt) / 1e3)) : 0) : 0;
|
|
14653
|
-
const effectiveSessionRuntimeCapabilities =
|
|
15644
|
+
const effectiveSessionRuntimeCapabilities = React49.useMemo(
|
|
14654
15645
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
14655
15646
|
runtimeCapabilities,
|
|
14656
15647
|
sessionRuntimeCapabilities
|
|
@@ -14663,7 +15654,7 @@ function Chat({
|
|
|
14663
15654
|
"goal"
|
|
14664
15655
|
);
|
|
14665
15656
|
const showGoalStatus = goalCommandAvailable && !hasCompletedGoal && (Boolean(goalError) || threadGoal?.status === "active" && stream.isLoading);
|
|
14666
|
-
const runRuntimeCapabilityOptions =
|
|
15657
|
+
const runRuntimeCapabilityOptions = React49.useMemo(
|
|
14667
15658
|
() => runtimeCapabilityOptions.filter(
|
|
14668
15659
|
(option) => isRuntimeCapabilitySelected(
|
|
14669
15660
|
runRuntimeCapabilities,
|
|
@@ -14673,11 +15664,11 @@ function Chat({
|
|
|
14673
15664
|
),
|
|
14674
15665
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
14675
15666
|
);
|
|
14676
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
15667
|
+
const composerRuntimeCapabilitySelectionKeys = React49.useMemo(
|
|
14677
15668
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
14678
15669
|
[composerParts]
|
|
14679
15670
|
);
|
|
14680
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
15671
|
+
const detachedRunRuntimeCapabilityOptions = React49.useMemo(
|
|
14681
15672
|
() => runRuntimeCapabilityOptions.filter(
|
|
14682
15673
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
14683
15674
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -14685,7 +15676,7 @@ function Chat({
|
|
|
14685
15676
|
),
|
|
14686
15677
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
14687
15678
|
);
|
|
14688
|
-
const persistSessionRuntimeCapabilities =
|
|
15679
|
+
const persistSessionRuntimeCapabilities = React49.useCallback(
|
|
14689
15680
|
async (threadId, selection) => {
|
|
14690
15681
|
if (!runtimeCapabilities || !selection) {
|
|
14691
15682
|
return;
|
|
@@ -14710,10 +15701,10 @@ function Chat({
|
|
|
14710
15701
|
},
|
|
14711
15702
|
[runtimeCapabilities, stream.client]
|
|
14712
15703
|
);
|
|
14713
|
-
const clearQuoteSelection =
|
|
15704
|
+
const clearQuoteSelection = React49.useCallback(() => {
|
|
14714
15705
|
setQuoteSelection(null);
|
|
14715
15706
|
}, []);
|
|
14716
|
-
const commitComposerParts =
|
|
15707
|
+
const commitComposerParts = React49.useCallback(
|
|
14717
15708
|
(nextParts, options2) => {
|
|
14718
15709
|
const normalized = normalizeComposerParts(nextParts);
|
|
14719
15710
|
const previous = composerPartsRef.current;
|
|
@@ -14749,7 +15740,7 @@ function Chat({
|
|
|
14749
15740
|
},
|
|
14750
15741
|
[]
|
|
14751
15742
|
);
|
|
14752
|
-
const setComposerText =
|
|
15743
|
+
const setComposerText = React49.useCallback(
|
|
14753
15744
|
(text, caretOffset = text.length) => {
|
|
14754
15745
|
commitComposerParts(createComposerTextParts(text), {
|
|
14755
15746
|
caretOffset,
|
|
@@ -14759,7 +15750,7 @@ function Chat({
|
|
|
14759
15750
|
},
|
|
14760
15751
|
[commitComposerParts]
|
|
14761
15752
|
);
|
|
14762
|
-
const focusComposerAt =
|
|
15753
|
+
const focusComposerAt = React49.useCallback((position) => {
|
|
14763
15754
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
14764
15755
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
14765
15756
|
requestAnimationFrame(() => {
|
|
@@ -14771,7 +15762,7 @@ function Chat({
|
|
|
14771
15762
|
});
|
|
14772
15763
|
}, []);
|
|
14773
15764
|
const parentMessenger = useParentMessenger({
|
|
14774
|
-
onSetComposerValue:
|
|
15765
|
+
onSetComposerValue: React49.useCallback(
|
|
14775
15766
|
(payload) => {
|
|
14776
15767
|
if (!payload) {
|
|
14777
15768
|
return;
|
|
@@ -14794,10 +15785,10 @@ function Chat({
|
|
|
14794
15785
|
},
|
|
14795
15786
|
[composer?.tools, setComposerText]
|
|
14796
15787
|
),
|
|
14797
|
-
onFocusComposer:
|
|
15788
|
+
onFocusComposer: React49.useCallback(() => {
|
|
14798
15789
|
composerInputRef.current?.focus();
|
|
14799
15790
|
}, []),
|
|
14800
|
-
onSetPetEnabled:
|
|
15791
|
+
onSetPetEnabled: React49.useCallback(
|
|
14801
15792
|
(enabled) => {
|
|
14802
15793
|
if (petRequired) {
|
|
14803
15794
|
return;
|
|
@@ -14811,10 +15802,10 @@ function Chat({
|
|
|
14811
15802
|
)
|
|
14812
15803
|
});
|
|
14813
15804
|
const canMinimizeToPet = parentMessenger?.isParentAvailable === true && isPetEnabled(effectivePet);
|
|
14814
|
-
const handleMinimizeToPet =
|
|
15805
|
+
const handleMinimizeToPet = React49.useCallback(() => {
|
|
14815
15806
|
parentMessenger?.sendEvent("chat_minimize_change", { minimized: true });
|
|
14816
15807
|
}, [parentMessenger]);
|
|
14817
|
-
const syncQuoteSelection =
|
|
15808
|
+
const syncQuoteSelection = React49.useCallback(() => {
|
|
14818
15809
|
if (typeof window === "undefined") {
|
|
14819
15810
|
clearQuoteSelection();
|
|
14820
15811
|
return;
|
|
@@ -14859,23 +15850,23 @@ function Chat({
|
|
|
14859
15850
|
left
|
|
14860
15851
|
});
|
|
14861
15852
|
}, [clearQuoteSelection]);
|
|
14862
|
-
const cancelPendingAutoScroll =
|
|
15853
|
+
const cancelPendingAutoScroll = React49.useCallback(() => {
|
|
14863
15854
|
if (autoScrollFrameRef.current !== null) {
|
|
14864
15855
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
14865
15856
|
autoScrollFrameRef.current = null;
|
|
14866
15857
|
}
|
|
14867
15858
|
}, []);
|
|
14868
|
-
const disableAutoFollow =
|
|
15859
|
+
const disableAutoFollow = React49.useCallback(() => {
|
|
14869
15860
|
forceFollowRef.current = false;
|
|
14870
15861
|
shouldAutoScrollRef.current = false;
|
|
14871
15862
|
cancelPendingAutoScroll();
|
|
14872
15863
|
}, [cancelPendingAutoScroll]);
|
|
14873
|
-
const enableAutoFollow =
|
|
15864
|
+
const enableAutoFollow = React49.useCallback(() => {
|
|
14874
15865
|
forceFollowRef.current = true;
|
|
14875
15866
|
shouldAutoScrollRef.current = true;
|
|
14876
15867
|
setHasUpdatesBelow(false);
|
|
14877
15868
|
}, []);
|
|
14878
|
-
const scrollToBottom =
|
|
15869
|
+
const scrollToBottom = React49.useCallback(
|
|
14879
15870
|
(smooth = false, force = false) => {
|
|
14880
15871
|
if (force) {
|
|
14881
15872
|
enableAutoFollow();
|
|
@@ -14902,7 +15893,7 @@ function Chat({
|
|
|
14902
15893
|
},
|
|
14903
15894
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
14904
15895
|
);
|
|
14905
|
-
|
|
15896
|
+
React49.useEffect(() => {
|
|
14906
15897
|
const viewport = viewportRef.current;
|
|
14907
15898
|
if (!viewport) return;
|
|
14908
15899
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -14983,14 +15974,14 @@ function Chat({
|
|
|
14983
15974
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
14984
15975
|
};
|
|
14985
15976
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
14986
|
-
|
|
15977
|
+
React49.useEffect(() => {
|
|
14987
15978
|
shouldAutoScrollRef.current = true;
|
|
14988
15979
|
forceFollowRef.current = false;
|
|
14989
15980
|
previousScrollTopRef.current = 0;
|
|
14990
15981
|
setIsAtBottom(true);
|
|
14991
15982
|
setHasUpdatesBelow(false);
|
|
14992
15983
|
}, [stream.threadId]);
|
|
14993
|
-
|
|
15984
|
+
React49.useEffect(() => {
|
|
14994
15985
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
14995
15986
|
previousMessageCountRef.current = messages.length;
|
|
14996
15987
|
if (isPrependingHistoryMessagesRef.current) {
|
|
@@ -15013,7 +16004,7 @@ function Chat({
|
|
|
15013
16004
|
clientSecret: effectiveClientSecret
|
|
15014
16005
|
});
|
|
15015
16006
|
const missingConfig = Boolean(missingConfigKind);
|
|
15016
|
-
const missingConfigShortMessage =
|
|
16007
|
+
const missingConfigShortMessage = React49.useMemo(() => {
|
|
15017
16008
|
switch (missingConfigKind) {
|
|
15018
16009
|
case "apiUrl":
|
|
15019
16010
|
return t("chat.missingApiUrlShort");
|
|
@@ -15025,7 +16016,7 @@ function Chat({
|
|
|
15025
16016
|
return t("chat.missingConfigShort");
|
|
15026
16017
|
}
|
|
15027
16018
|
}, [missingConfigKind, t]);
|
|
15028
|
-
const missingConfigDetailMessage =
|
|
16019
|
+
const missingConfigDetailMessage = React49.useMemo(() => {
|
|
15029
16020
|
switch (missingConfigKind) {
|
|
15030
16021
|
case "apiUrl":
|
|
15031
16022
|
return t("chat.missingApiUrlDetail");
|
|
@@ -15042,7 +16033,7 @@ function Chat({
|
|
|
15042
16033
|
const isSubmissionBlocked = hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
15043
16034
|
const isSendDisabled = !trimmedDraft && !hasReferences || isSubmissionBlocked;
|
|
15044
16035
|
const isPromptEditDisabled = hasPendingInteractiveRequest || missingConfig || isHistoryLoading;
|
|
15045
|
-
const resizeComposerInput =
|
|
16036
|
+
const resizeComposerInput = React49.useCallback(() => {
|
|
15046
16037
|
const input = composerInputRef.current;
|
|
15047
16038
|
if (!input) {
|
|
15048
16039
|
return;
|
|
@@ -15050,7 +16041,7 @@ function Chat({
|
|
|
15050
16041
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
15051
16042
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
15052
16043
|
}, []);
|
|
15053
|
-
|
|
16044
|
+
React49.useLayoutEffect(() => {
|
|
15054
16045
|
composerPartsRef.current = composerParts;
|
|
15055
16046
|
resizeComposerInput();
|
|
15056
16047
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -15062,13 +16053,13 @@ function Chat({
|
|
|
15062
16053
|
}
|
|
15063
16054
|
}
|
|
15064
16055
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
15065
|
-
|
|
16056
|
+
React49.useEffect(() => {
|
|
15066
16057
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
15067
16058
|
return () => {
|
|
15068
16059
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
15069
16060
|
};
|
|
15070
16061
|
}, [syncQuoteSelection]);
|
|
15071
|
-
|
|
16062
|
+
React49.useEffect(() => {
|
|
15072
16063
|
const viewport = viewportRef.current;
|
|
15073
16064
|
if (!viewport) {
|
|
15074
16065
|
return;
|
|
@@ -15085,14 +16076,14 @@ function Chat({
|
|
|
15085
16076
|
window.removeEventListener("resize", handleViewportScroll);
|
|
15086
16077
|
};
|
|
15087
16078
|
}, [clearQuoteSelection]);
|
|
15088
|
-
|
|
16079
|
+
React49.useEffect(() => {
|
|
15089
16080
|
clearQuoteSelection();
|
|
15090
16081
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
15091
|
-
|
|
16082
|
+
React49.useEffect(() => {
|
|
15092
16083
|
if (missingConfig) return;
|
|
15093
16084
|
void refreshThreads();
|
|
15094
16085
|
}, [missingConfig, refreshThreads]);
|
|
15095
|
-
|
|
16086
|
+
React49.useEffect(() => {
|
|
15096
16087
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
15097
16088
|
setAssistantName(null);
|
|
15098
16089
|
setAssistantAvatar(null);
|
|
@@ -15115,7 +16106,7 @@ function Chat({
|
|
|
15115
16106
|
cancelled = true;
|
|
15116
16107
|
};
|
|
15117
16108
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15118
|
-
|
|
16109
|
+
React49.useEffect(() => {
|
|
15119
16110
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
15120
16111
|
setRuntimeCapabilities(null);
|
|
15121
16112
|
setRuntimeCapabilitiesReady(false);
|
|
@@ -15162,7 +16153,7 @@ function Chat({
|
|
|
15162
16153
|
});
|
|
15163
16154
|
return () => controller.abort();
|
|
15164
16155
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15165
|
-
|
|
16156
|
+
React49.useEffect(() => {
|
|
15166
16157
|
setRunRuntimeCapabilities(
|
|
15167
16158
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
15168
16159
|
);
|
|
@@ -15211,10 +16202,10 @@ function Chat({
|
|
|
15211
16202
|
stream.client,
|
|
15212
16203
|
stream.threadId
|
|
15213
16204
|
]);
|
|
15214
|
-
|
|
16205
|
+
React49.useEffect(() => {
|
|
15215
16206
|
setThreadGoal(stream.threadGoal);
|
|
15216
16207
|
}, [stream.threadGoal]);
|
|
15217
|
-
|
|
16208
|
+
React49.useEffect(() => {
|
|
15218
16209
|
const threadId = stream.threadId?.trim();
|
|
15219
16210
|
if (!threadId || !goalCommandAvailable) {
|
|
15220
16211
|
setThreadGoal(null);
|
|
@@ -15255,7 +16246,7 @@ function Chat({
|
|
|
15255
16246
|
return () => controller.abort();
|
|
15256
16247
|
}, [goalAdapter, goalCommandAvailable, stream.threadId]);
|
|
15257
16248
|
const uploadedFiles = attachmentState.uploadedFiles;
|
|
15258
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
16249
|
+
const handleSessionRuntimeCapabilityToggle = React49.useCallback(
|
|
15259
16250
|
(type, id, selected) => {
|
|
15260
16251
|
setSessionRuntimeCapabilities((previous) => {
|
|
15261
16252
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -15273,7 +16264,7 @@ function Chat({
|
|
|
15273
16264
|
},
|
|
15274
16265
|
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
15275
16266
|
);
|
|
15276
|
-
const updateRuntimeCapabilityPalette =
|
|
16267
|
+
const updateRuntimeCapabilityPalette = React49.useCallback(
|
|
15277
16268
|
(parts, selectionStart) => {
|
|
15278
16269
|
const input = composerInputRef.current;
|
|
15279
16270
|
const editingText = getComposerEditingText(parts);
|
|
@@ -15285,7 +16276,7 @@ function Chat({
|
|
|
15285
16276
|
},
|
|
15286
16277
|
[]
|
|
15287
16278
|
);
|
|
15288
|
-
const syncComposerInputFromElement =
|
|
16279
|
+
const syncComposerInputFromElement = React49.useCallback(
|
|
15289
16280
|
(input) => {
|
|
15290
16281
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
15291
16282
|
composerPartsRef.current
|
|
@@ -15303,25 +16294,25 @@ function Chat({
|
|
|
15303
16294
|
},
|
|
15304
16295
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
15305
16296
|
);
|
|
15306
|
-
const handleComposerInput =
|
|
16297
|
+
const handleComposerInput = React49.useCallback(
|
|
15307
16298
|
(event) => {
|
|
15308
16299
|
syncComposerInputFromElement(event.currentTarget);
|
|
15309
16300
|
},
|
|
15310
16301
|
[syncComposerInputFromElement]
|
|
15311
16302
|
);
|
|
15312
|
-
const handleComposerCompositionEnd =
|
|
16303
|
+
const handleComposerCompositionEnd = React49.useCallback(
|
|
15313
16304
|
(event) => {
|
|
15314
16305
|
syncComposerInputFromElement(event.currentTarget);
|
|
15315
16306
|
},
|
|
15316
16307
|
[syncComposerInputFromElement]
|
|
15317
16308
|
);
|
|
15318
|
-
const handleComposerSelect =
|
|
16309
|
+
const handleComposerSelect = React49.useCallback(() => {
|
|
15319
16310
|
updateRuntimeCapabilityPalette(
|
|
15320
16311
|
composerPartsRef.current,
|
|
15321
16312
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
15322
16313
|
);
|
|
15323
16314
|
}, [updateRuntimeCapabilityPalette]);
|
|
15324
|
-
const removeRunRuntimeCapability =
|
|
16315
|
+
const removeRunRuntimeCapability = React49.useCallback(
|
|
15325
16316
|
(option) => {
|
|
15326
16317
|
setRunRuntimeCapabilities(
|
|
15327
16318
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -15341,7 +16332,7 @@ function Chat({
|
|
|
15341
16332
|
},
|
|
15342
16333
|
[commitComposerParts]
|
|
15343
16334
|
);
|
|
15344
|
-
const submitDraft =
|
|
16335
|
+
const submitDraft = React49.useCallback(
|
|
15345
16336
|
(submitOptions = {}) => {
|
|
15346
16337
|
if (isSubmissionBlocked) return;
|
|
15347
16338
|
const contentToSubmit = (submitOptions.inputText ?? trimmedDraft).trim();
|
|
@@ -15464,7 +16455,7 @@ function Chat({
|
|
|
15464
16455
|
t
|
|
15465
16456
|
]
|
|
15466
16457
|
);
|
|
15467
|
-
const handleGoalCommand =
|
|
16458
|
+
const handleGoalCommand = React49.useCallback(
|
|
15468
16459
|
async ({
|
|
15469
16460
|
args,
|
|
15470
16461
|
commandSource,
|
|
@@ -15576,13 +16567,13 @@ function Chat({
|
|
|
15576
16567
|
t
|
|
15577
16568
|
]
|
|
15578
16569
|
);
|
|
15579
|
-
const handleGoalPanelOpenChange =
|
|
16570
|
+
const handleGoalPanelOpenChange = React49.useCallback(
|
|
15580
16571
|
(open) => {
|
|
15581
16572
|
setIsGoalPanelOpen(open);
|
|
15582
16573
|
},
|
|
15583
16574
|
[]
|
|
15584
16575
|
);
|
|
15585
|
-
const addRunRuntimeCapabilities =
|
|
16576
|
+
const addRunRuntimeCapabilities = React49.useCallback(
|
|
15586
16577
|
(selection) => {
|
|
15587
16578
|
setRunRuntimeCapabilities(
|
|
15588
16579
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -15594,7 +16585,7 @@ function Chat({
|
|
|
15594
16585
|
},
|
|
15595
16586
|
[runtimeCapabilities]
|
|
15596
16587
|
);
|
|
15597
|
-
const insertComposerCapabilityToken =
|
|
16588
|
+
const insertComposerCapabilityToken = React49.useCallback(
|
|
15598
16589
|
(capability, range) => {
|
|
15599
16590
|
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
15600
16591
|
const currentParts = composerPartsRef.current;
|
|
@@ -15667,7 +16658,7 @@ function Chat({
|
|
|
15667
16658
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
15668
16659
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
15669
16660
|
};
|
|
15670
|
-
|
|
16661
|
+
React49.useEffect(() => {
|
|
15671
16662
|
if (!runtimeCapabilityPalette) {
|
|
15672
16663
|
return;
|
|
15673
16664
|
}
|
|
@@ -15686,7 +16677,7 @@ function Chat({
|
|
|
15686
16677
|
);
|
|
15687
16678
|
}
|
|
15688
16679
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
15689
|
-
|
|
16680
|
+
React49.useLayoutEffect(() => {
|
|
15690
16681
|
if (!runtimeCapabilityPalette) {
|
|
15691
16682
|
return;
|
|
15692
16683
|
}
|
|
@@ -15703,7 +16694,7 @@ function Chat({
|
|
|
15703
16694
|
container.scrollTop += optionRect.bottom - containerRect.bottom;
|
|
15704
16695
|
}
|
|
15705
16696
|
}, [runtimeCapabilityPalette, slashPaletteOptions.length]);
|
|
15706
|
-
const submitGoalModeDraft =
|
|
16697
|
+
const submitGoalModeDraft = React49.useCallback(() => {
|
|
15707
16698
|
const objective = getComposerPlainText(composerPartsRef.current).trim();
|
|
15708
16699
|
if (!isGoalModeOpen || !goalCommandAvailable || !objective) {
|
|
15709
16700
|
return false;
|
|
@@ -15741,7 +16732,7 @@ function Chat({
|
|
|
15741
16732
|
}
|
|
15742
16733
|
submitDraft();
|
|
15743
16734
|
};
|
|
15744
|
-
const handleEditPendingFollowUp =
|
|
16735
|
+
const handleEditPendingFollowUp = React49.useCallback(
|
|
15745
16736
|
(id) => {
|
|
15746
16737
|
const item = pendingFollowUps.find(
|
|
15747
16738
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -15768,7 +16759,7 @@ function Chat({
|
|
|
15768
16759
|
},
|
|
15769
16760
|
[pendingFollowUps, setComposerText, stream]
|
|
15770
16761
|
);
|
|
15771
|
-
const handleQuoteSelection =
|
|
16762
|
+
const handleQuoteSelection = React49.useCallback(() => {
|
|
15772
16763
|
if (!quoteSelection) {
|
|
15773
16764
|
return;
|
|
15774
16765
|
}
|
|
@@ -15784,7 +16775,7 @@ function Chat({
|
|
|
15784
16775
|
const handleAttachmentClick = () => {
|
|
15785
16776
|
attachmentsRef.current?.openFilePicker();
|
|
15786
16777
|
};
|
|
15787
|
-
const uploadContextFile =
|
|
16778
|
+
const uploadContextFile = React49.useCallback(
|
|
15788
16779
|
(file) => {
|
|
15789
16780
|
const formData = new FormData();
|
|
15790
16781
|
formData.append("file", file, file.name || "upload");
|
|
@@ -15803,13 +16794,13 @@ function Chat({
|
|
|
15803
16794
|
},
|
|
15804
16795
|
[stream.assistantId, stream.client, stream.threadId]
|
|
15805
16796
|
);
|
|
15806
|
-
const getContextFileStatus =
|
|
16797
|
+
const getContextFileStatus = React49.useCallback(
|
|
15807
16798
|
(fileId) => stream.client.contexts.fetch(`/files/${fileId}/status`, {
|
|
15808
16799
|
method: "GET"
|
|
15809
16800
|
}),
|
|
15810
16801
|
[stream.client]
|
|
15811
16802
|
);
|
|
15812
|
-
const deleteContextFile =
|
|
16803
|
+
const deleteContextFile = React49.useCallback(
|
|
15813
16804
|
(storageFileId) => stream.client.contexts.deleteFile(storageFileId),
|
|
15814
16805
|
[stream.client]
|
|
15815
16806
|
);
|
|
@@ -15917,7 +16908,7 @@ function Chat({
|
|
|
15917
16908
|
}
|
|
15918
16909
|
submitDraft();
|
|
15919
16910
|
};
|
|
15920
|
-
const handleComposerPaste =
|
|
16911
|
+
const handleComposerPaste = React49.useCallback(
|
|
15921
16912
|
(event) => {
|
|
15922
16913
|
const clipboardData = event.clipboardData;
|
|
15923
16914
|
if (!clipboardData) {
|
|
@@ -16019,13 +17010,13 @@ function Chat({
|
|
|
16019
17010
|
const handleToolSelect = (tool) => {
|
|
16020
17011
|
setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
|
|
16021
17012
|
};
|
|
16022
|
-
const handlePromptClick =
|
|
17013
|
+
const handlePromptClick = React49.useCallback(
|
|
16023
17014
|
(prompt) => {
|
|
16024
17015
|
submitDraft({ inputText: prompt, displayText: prompt });
|
|
16025
17016
|
},
|
|
16026
17017
|
[submitDraft]
|
|
16027
17018
|
);
|
|
16028
|
-
const handlePromptEdit =
|
|
17019
|
+
const handlePromptEdit = React49.useCallback(
|
|
16029
17020
|
(prompt) => {
|
|
16030
17021
|
if (isPromptEditDisabled) return;
|
|
16031
17022
|
setComposerText(prompt, prompt.length);
|
|
@@ -16034,7 +17025,7 @@ function Chat({
|
|
|
16034
17025
|
},
|
|
16035
17026
|
[focusComposerAt, isPromptEditDisabled, setComposerText]
|
|
16036
17027
|
);
|
|
16037
|
-
const loadConversationMessages =
|
|
17028
|
+
const loadConversationMessages = React49.useCallback(
|
|
16038
17029
|
async (recordId) => {
|
|
16039
17030
|
if (missingConfig) {
|
|
16040
17031
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -16055,7 +17046,7 @@ function Chat({
|
|
|
16055
17046
|
},
|
|
16056
17047
|
[missingConfig, missingConfigShortMessage, stream, t]
|
|
16057
17048
|
);
|
|
16058
|
-
const handleLoadMoreMessages =
|
|
17049
|
+
const handleLoadMoreMessages = React49.useCallback(async () => {
|
|
16059
17050
|
if (!canLoadMoreMessages || isLoadingMoreMessages) {
|
|
16060
17051
|
return;
|
|
16061
17052
|
}
|
|
@@ -16164,15 +17155,15 @@ function Chat({
|
|
|
16164
17155
|
};
|
|
16165
17156
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
16166
17157
|
const canUploadDroppedFiles = composer?.attachments?.enabled === true && !missingConfig && !isHistoryLoading && !hasPendingInteractiveRequest;
|
|
16167
|
-
const handleDroppedFiles =
|
|
17158
|
+
const handleDroppedFiles = React49.useCallback((files) => {
|
|
16168
17159
|
return attachmentsRef.current?.queueFiles(files) ?? false;
|
|
16169
17160
|
}, []);
|
|
16170
|
-
const currentThread =
|
|
17161
|
+
const currentThread = React49.useMemo(
|
|
16171
17162
|
() => threads.find((item) => item.id === stream.threadId),
|
|
16172
17163
|
[threads, stream.threadId]
|
|
16173
17164
|
);
|
|
16174
17165
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
16175
|
-
const threadErrorMessage =
|
|
17166
|
+
const threadErrorMessage = React49.useMemo(() => {
|
|
16176
17167
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
16177
17168
|
if (currentThread?.status !== "error") return void 0;
|
|
16178
17169
|
const message = currentThread.error?.trim();
|
|
@@ -16203,7 +17194,7 @@ function Chat({
|
|
|
16203
17194
|
fallbackTitle: t("history.threadFallback")
|
|
16204
17195
|
});
|
|
16205
17196
|
const assistantTitle = assistantName || resolvedTitle;
|
|
16206
|
-
return /* @__PURE__ */
|
|
17197
|
+
return /* @__PURE__ */ jsxs37(
|
|
16207
17198
|
UploadDroppedFiles,
|
|
16208
17199
|
{
|
|
16209
17200
|
ref: viewportRef,
|
|
@@ -16218,10 +17209,10 @@ function Chat({
|
|
|
16218
17209
|
className
|
|
16219
17210
|
),
|
|
16220
17211
|
children: [
|
|
16221
|
-
/* @__PURE__ */
|
|
16222
|
-
/* @__PURE__ */
|
|
16223
|
-
/* @__PURE__ */
|
|
16224
|
-
/* @__PURE__ */
|
|
17212
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
|
|
17213
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
17214
|
+
/* @__PURE__ */ jsxs37("div", { className: "relative shrink-0", children: [
|
|
17215
|
+
/* @__PURE__ */ jsx54(
|
|
16225
17216
|
ChatkitAvatar,
|
|
16226
17217
|
{
|
|
16227
17218
|
avatar: assistantAvatar,
|
|
@@ -16229,10 +17220,10 @@ function Chat({
|
|
|
16229
17220
|
label: assistantTitle
|
|
16230
17221
|
}
|
|
16231
17222
|
),
|
|
16232
|
-
/* @__PURE__ */
|
|
17223
|
+
/* @__PURE__ */ jsx54("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
16233
17224
|
] }),
|
|
16234
|
-
/* @__PURE__ */
|
|
16235
|
-
/* @__PURE__ */
|
|
17225
|
+
/* @__PURE__ */ jsxs37("div", { className: "truncate", children: [
|
|
17226
|
+
/* @__PURE__ */ jsx54(
|
|
16236
17227
|
"h2",
|
|
16237
17228
|
{
|
|
16238
17229
|
className: "text-lg font-semibold truncate",
|
|
@@ -16240,12 +17231,12 @@ function Chat({
|
|
|
16240
17231
|
children: assistantTitle
|
|
16241
17232
|
}
|
|
16242
17233
|
),
|
|
16243
|
-
/* @__PURE__ */
|
|
17234
|
+
/* @__PURE__ */ jsx54("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
16244
17235
|
] })
|
|
16245
17236
|
] }),
|
|
16246
|
-
/* @__PURE__ */
|
|
16247
|
-
canMinimizeToPet && /* @__PURE__ */
|
|
16248
|
-
/* @__PURE__ */
|
|
17237
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-1", children: [
|
|
17238
|
+
canMinimizeToPet && /* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17239
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx54(
|
|
16249
17240
|
"button",
|
|
16250
17241
|
{
|
|
16251
17242
|
type: "button",
|
|
@@ -16256,13 +17247,13 @@ function Chat({
|
|
|
16256
17247
|
"transition-colors duration-150"
|
|
16257
17248
|
),
|
|
16258
17249
|
"aria-label": t("chat.minimizeToPet"),
|
|
16259
|
-
children: /* @__PURE__ */
|
|
17250
|
+
children: /* @__PURE__ */ jsx54(Minus, { size: 16 })
|
|
16260
17251
|
}
|
|
16261
17252
|
) }) }),
|
|
16262
|
-
/* @__PURE__ */
|
|
17253
|
+
/* @__PURE__ */ jsx54(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
|
|
16263
17254
|
] }),
|
|
16264
|
-
/* @__PURE__ */
|
|
16265
|
-
/* @__PURE__ */
|
|
17255
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17256
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx54(
|
|
16266
17257
|
"button",
|
|
16267
17258
|
{
|
|
16268
17259
|
type: "button",
|
|
@@ -16273,14 +17264,14 @@ function Chat({
|
|
|
16273
17264
|
"transition-colors duration-150"
|
|
16274
17265
|
),
|
|
16275
17266
|
"aria-label": t("settings.open"),
|
|
16276
|
-
children: /* @__PURE__ */
|
|
17267
|
+
children: /* @__PURE__ */ jsx54(Settings2, { size: 16 })
|
|
16277
17268
|
}
|
|
16278
17269
|
) }) }),
|
|
16279
|
-
/* @__PURE__ */
|
|
17270
|
+
/* @__PURE__ */ jsx54(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
16280
17271
|
] }),
|
|
16281
|
-
history?.enabled !== false && /* @__PURE__ */
|
|
16282
|
-
/* @__PURE__ */
|
|
16283
|
-
/* @__PURE__ */
|
|
17272
|
+
history?.enabled !== false && /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
17273
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17274
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx54(
|
|
16284
17275
|
"button",
|
|
16285
17276
|
{
|
|
16286
17277
|
type: "button",
|
|
@@ -16293,12 +17284,12 @@ function Chat({
|
|
|
16293
17284
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
16294
17285
|
),
|
|
16295
17286
|
"aria-label": t("history.newThread"),
|
|
16296
|
-
children: /* @__PURE__ */
|
|
17287
|
+
children: /* @__PURE__ */ jsx54(Pencil4, { size: 16 })
|
|
16297
17288
|
}
|
|
16298
17289
|
) }) }),
|
|
16299
|
-
/* @__PURE__ */
|
|
17290
|
+
/* @__PURE__ */ jsx54(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
16300
17291
|
] }),
|
|
16301
|
-
/* @__PURE__ */
|
|
17292
|
+
/* @__PURE__ */ jsx54(
|
|
16302
17293
|
HistorySidebar,
|
|
16303
17294
|
{
|
|
16304
17295
|
threads,
|
|
@@ -16313,12 +17304,12 @@ function Chat({
|
|
|
16313
17304
|
] })
|
|
16314
17305
|
] })
|
|
16315
17306
|
] }),
|
|
16316
|
-
/* @__PURE__ */
|
|
16317
|
-
errorMessage && /* @__PURE__ */
|
|
16318
|
-
historyError && /* @__PURE__ */
|
|
16319
|
-
showMissingConfig && /* @__PURE__ */
|
|
16320
|
-
isHistoryLoading && /* @__PURE__ */
|
|
16321
|
-
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */
|
|
17307
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex-1 p-4", children: [
|
|
17308
|
+
errorMessage && /* @__PURE__ */ jsx54("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
17309
|
+
historyError && /* @__PURE__ */ jsx54("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
|
|
17310
|
+
showMissingConfig && /* @__PURE__ */ jsx54("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
|
|
17311
|
+
isHistoryLoading && /* @__PURE__ */ jsx54("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
17312
|
+
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ jsx54(
|
|
16322
17313
|
StartScreen,
|
|
16323
17314
|
{
|
|
16324
17315
|
startScreen,
|
|
@@ -16327,10 +17318,10 @@ function Chat({
|
|
|
16327
17318
|
promptSendDisabled: isSubmissionBlocked,
|
|
16328
17319
|
promptEditDisabled: isPromptEditDisabled
|
|
16329
17320
|
}
|
|
16330
|
-
) : /* @__PURE__ */
|
|
16331
|
-
canLoadMoreMessages && /* @__PURE__ */
|
|
16332
|
-
/* @__PURE__ */
|
|
16333
|
-
/* @__PURE__ */
|
|
17321
|
+
) : /* @__PURE__ */ jsxs37("div", { className: "space-y-4", children: [
|
|
17322
|
+
canLoadMoreMessages && /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3 py-1", children: [
|
|
17323
|
+
/* @__PURE__ */ jsx54("div", { className: "h-px min-w-8 flex-1 bg-border" }),
|
|
17324
|
+
/* @__PURE__ */ jsx54(
|
|
16334
17325
|
Button,
|
|
16335
17326
|
{
|
|
16336
17327
|
type: "button",
|
|
@@ -16342,7 +17333,7 @@ function Chat({
|
|
|
16342
17333
|
children: isLoadingMoreMessages ? t("chat.loadingMoreMessages") : t("chat.loadMoreMessages")
|
|
16343
17334
|
}
|
|
16344
17335
|
),
|
|
16345
|
-
/* @__PURE__ */
|
|
17336
|
+
/* @__PURE__ */ jsx54("div", { className: "h-px min-w-8 flex-1 bg-border" })
|
|
16346
17337
|
] }),
|
|
16347
17338
|
messages.map((message, index) => {
|
|
16348
17339
|
const messageType = String(message.type);
|
|
@@ -16379,7 +17370,7 @@ function Chat({
|
|
|
16379
17370
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
16380
17371
|
return null;
|
|
16381
17372
|
}
|
|
16382
|
-
return /* @__PURE__ */
|
|
17373
|
+
return /* @__PURE__ */ jsx54(
|
|
16383
17374
|
"div",
|
|
16384
17375
|
{
|
|
16385
17376
|
className: cn(
|
|
@@ -16387,7 +17378,7 @@ function Chat({
|
|
|
16387
17378
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
16388
17379
|
// AI messages: slightly closer to left
|
|
16389
17380
|
),
|
|
16390
|
-
children: /* @__PURE__ */
|
|
17381
|
+
children: /* @__PURE__ */ jsxs37(
|
|
16391
17382
|
"div",
|
|
16392
17383
|
{
|
|
16393
17384
|
className: cn(
|
|
@@ -16395,7 +17386,7 @@ function Chat({
|
|
|
16395
17386
|
isAssistantMessage && "min-w-0 flex-1"
|
|
16396
17387
|
),
|
|
16397
17388
|
children: [
|
|
16398
|
-
/* @__PURE__ */
|
|
17389
|
+
/* @__PURE__ */ jsx54(
|
|
16399
17390
|
"div",
|
|
16400
17391
|
{
|
|
16401
17392
|
...canQuoteMessage ? {
|
|
@@ -16407,7 +17398,7 @@ function Chat({
|
|
|
16407
17398
|
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"
|
|
16408
17399
|
// AI messages: use chat-specific foreground color
|
|
16409
17400
|
),
|
|
16410
|
-
children: isAssistantMessage ? /* @__PURE__ */
|
|
17401
|
+
children: isAssistantMessage ? /* @__PURE__ */ jsx54(
|
|
16411
17402
|
AssistantMessage,
|
|
16412
17403
|
{
|
|
16413
17404
|
message: {
|
|
@@ -16426,25 +17417,25 @@ function Chat({
|
|
|
16426
17417
|
organizationId: stream.organizationId,
|
|
16427
17418
|
apiUrl: stream.apiUrl
|
|
16428
17419
|
}
|
|
16429
|
-
) : /* @__PURE__ */
|
|
16430
|
-
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */
|
|
17420
|
+
) : /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
17421
|
+
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsx54("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ jsxs37(
|
|
16431
17422
|
"span",
|
|
16432
17423
|
{
|
|
16433
17424
|
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",
|
|
16434
17425
|
children: [
|
|
16435
|
-
/* @__PURE__ */
|
|
17426
|
+
/* @__PURE__ */ jsx54(
|
|
16436
17427
|
RuntimeCapabilityIcon,
|
|
16437
17428
|
{
|
|
16438
17429
|
option,
|
|
16439
17430
|
variant: "chip"
|
|
16440
17431
|
}
|
|
16441
17432
|
),
|
|
16442
|
-
/* @__PURE__ */
|
|
17433
|
+
/* @__PURE__ */ jsx54("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
16443
17434
|
]
|
|
16444
17435
|
},
|
|
16445
17436
|
`${option.type}:${option.id}`
|
|
16446
17437
|
)) }),
|
|
16447
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */
|
|
17438
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ jsx54("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ jsx54(
|
|
16448
17439
|
ReferenceChip,
|
|
16449
17440
|
{
|
|
16450
17441
|
reference,
|
|
@@ -16452,29 +17443,29 @@ function Chat({
|
|
|
16452
17443
|
},
|
|
16453
17444
|
getReferenceKey(reference)
|
|
16454
17445
|
)) }),
|
|
16455
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */
|
|
17446
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ jsx54("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ jsxs37(
|
|
16456
17447
|
"div",
|
|
16457
17448
|
{
|
|
16458
17449
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
16459
17450
|
children: [
|
|
16460
|
-
/* @__PURE__ */
|
|
16461
|
-
/* @__PURE__ */
|
|
17451
|
+
/* @__PURE__ */ jsx54(FileText5, { size: 12 }),
|
|
17452
|
+
/* @__PURE__ */ jsx54("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
|
|
16462
17453
|
]
|
|
16463
17454
|
},
|
|
16464
17455
|
fileIndex
|
|
16465
17456
|
)) }),
|
|
16466
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */
|
|
17457
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ jsx54(
|
|
16467
17458
|
"p",
|
|
16468
17459
|
{
|
|
16469
17460
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
16470
17461
|
children: formatMessageContent(part)
|
|
16471
17462
|
},
|
|
16472
17463
|
`${part.type}-${partIndex}`
|
|
16473
|
-
)) : /* @__PURE__ */
|
|
17464
|
+
)) : /* @__PURE__ */ jsx54("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
16474
17465
|
] })
|
|
16475
17466
|
}
|
|
16476
17467
|
),
|
|
16477
|
-
/* @__PURE__ */
|
|
17468
|
+
/* @__PURE__ */ jsx54(
|
|
16478
17469
|
MessageActions,
|
|
16479
17470
|
{
|
|
16480
17471
|
content: messageContent,
|
|
@@ -16512,7 +17503,7 @@ function Chat({
|
|
|
16512
17503
|
stream.isLoading,
|
|
16513
17504
|
{ now: streamingNow }
|
|
16514
17505
|
);
|
|
16515
|
-
return /* @__PURE__ */
|
|
17506
|
+
return /* @__PURE__ */ jsx54("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ jsx54("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ jsx54(
|
|
16516
17507
|
AssistantStreamingIndicator,
|
|
16517
17508
|
{
|
|
16518
17509
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -16521,7 +17512,7 @@ function Chat({
|
|
|
16521
17512
|
})()
|
|
16522
17513
|
] })
|
|
16523
17514
|
] }),
|
|
16524
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */
|
|
17515
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ jsx54("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ jsx54(
|
|
16525
17516
|
Button,
|
|
16526
17517
|
{
|
|
16527
17518
|
type: "button",
|
|
@@ -16534,10 +17525,10 @@ function Chat({
|
|
|
16534
17525
|
onClick: () => scrollToBottom(true, true),
|
|
16535
17526
|
"aria-label": t("chat.scrollToBottom"),
|
|
16536
17527
|
title: t("chat.scrollToBottom"),
|
|
16537
|
-
children: /* @__PURE__ */
|
|
17528
|
+
children: /* @__PURE__ */ jsx54(ArrowDown2, { size: 16 })
|
|
16538
17529
|
}
|
|
16539
17530
|
) }),
|
|
16540
|
-
quoteSelection && /* @__PURE__ */
|
|
17531
|
+
quoteSelection && /* @__PURE__ */ jsx54(
|
|
16541
17532
|
"div",
|
|
16542
17533
|
{
|
|
16543
17534
|
className: "pointer-events-none fixed z-50",
|
|
@@ -16546,7 +17537,7 @@ function Chat({
|
|
|
16546
17537
|
left: `${quoteSelection.left}px`,
|
|
16547
17538
|
transform: "translateX(-50%)"
|
|
16548
17539
|
},
|
|
16549
|
-
children: /* @__PURE__ */
|
|
17540
|
+
children: /* @__PURE__ */ jsxs37(
|
|
16550
17541
|
Button,
|
|
16551
17542
|
{
|
|
16552
17543
|
type: "button",
|
|
@@ -16558,16 +17549,16 @@ function Chat({
|
|
|
16558
17549
|
"aria-label": t("composer.quoteSelection"),
|
|
16559
17550
|
title: t("composer.quoteSelection"),
|
|
16560
17551
|
children: [
|
|
16561
|
-
/* @__PURE__ */
|
|
17552
|
+
/* @__PURE__ */ jsx54(Quote, { size: 14 }),
|
|
16562
17553
|
t("composer.quoteSelection")
|
|
16563
17554
|
]
|
|
16564
17555
|
}
|
|
16565
17556
|
)
|
|
16566
17557
|
}
|
|
16567
17558
|
),
|
|
16568
|
-
/* @__PURE__ */
|
|
16569
|
-
threadErrorMessage && /* @__PURE__ */
|
|
16570
|
-
/* @__PURE__ */
|
|
17559
|
+
/* @__PURE__ */ jsxs37("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
|
|
17560
|
+
threadErrorMessage && /* @__PURE__ */ jsx54("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 }),
|
|
17561
|
+
/* @__PURE__ */ jsx54(
|
|
16571
17562
|
ChatAttachments,
|
|
16572
17563
|
{
|
|
16573
17564
|
ref: attachmentsRef,
|
|
@@ -16581,7 +17572,7 @@ function Chat({
|
|
|
16581
17572
|
onStateChange: setAttachmentState
|
|
16582
17573
|
}
|
|
16583
17574
|
),
|
|
16584
|
-
references.length > 0 && /* @__PURE__ */
|
|
17575
|
+
references.length > 0 && /* @__PURE__ */ jsx54("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ jsx54(
|
|
16585
17576
|
ReferenceChip,
|
|
16586
17577
|
{
|
|
16587
17578
|
reference,
|
|
@@ -16595,16 +17586,16 @@ function Chat({
|
|
|
16595
17586
|
},
|
|
16596
17587
|
getReferenceKey(reference)
|
|
16597
17588
|
)) }),
|
|
16598
|
-
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */
|
|
16599
|
-
/* @__PURE__ */
|
|
16600
|
-
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */
|
|
17589
|
+
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsxs37("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
17590
|
+
/* @__PURE__ */ jsx54("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
|
|
17591
|
+
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ jsxs37(
|
|
16601
17592
|
"span",
|
|
16602
17593
|
{
|
|
16603
17594
|
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",
|
|
16604
17595
|
children: [
|
|
16605
|
-
/* @__PURE__ */
|
|
16606
|
-
/* @__PURE__ */
|
|
16607
|
-
/* @__PURE__ */
|
|
17596
|
+
/* @__PURE__ */ jsx54(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
17597
|
+
/* @__PURE__ */ jsx54("span", { className: "max-w-40 truncate", children: option.label }),
|
|
17598
|
+
/* @__PURE__ */ jsx54(
|
|
16608
17599
|
"button",
|
|
16609
17600
|
{
|
|
16610
17601
|
type: "button",
|
|
@@ -16612,7 +17603,7 @@ function Chat({
|
|
|
16612
17603
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
16613
17604
|
title: t("composer.capabilities.removeRunCapability"),
|
|
16614
17605
|
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
16615
|
-
children: /* @__PURE__ */
|
|
17606
|
+
children: /* @__PURE__ */ jsx54(X6, { size: 11 })
|
|
16616
17607
|
}
|
|
16617
17608
|
)
|
|
16618
17609
|
]
|
|
@@ -16620,7 +17611,7 @@ function Chat({
|
|
|
16620
17611
|
`${option.type}:${option.id}`
|
|
16621
17612
|
))
|
|
16622
17613
|
] }),
|
|
16623
|
-
showGoalStatus && /* @__PURE__ */
|
|
17614
|
+
showGoalStatus && /* @__PURE__ */ jsxs37(
|
|
16624
17615
|
"div",
|
|
16625
17616
|
{
|
|
16626
17617
|
className: cn(
|
|
@@ -16628,7 +17619,7 @@ function Chat({
|
|
|
16628
17619
|
isGoalObjectiveExpanded ? "items-start" : "items-center"
|
|
16629
17620
|
),
|
|
16630
17621
|
children: [
|
|
16631
|
-
/* @__PURE__ */
|
|
17622
|
+
/* @__PURE__ */ jsx54(
|
|
16632
17623
|
Target2,
|
|
16633
17624
|
{
|
|
16634
17625
|
className: cn(
|
|
@@ -16637,13 +17628,13 @@ function Chat({
|
|
|
16637
17628
|
)
|
|
16638
17629
|
}
|
|
16639
17630
|
),
|
|
16640
|
-
/* @__PURE__ */
|
|
16641
|
-
/* @__PURE__ */
|
|
16642
|
-
/* @__PURE__ */
|
|
16643
|
-
threadGoal && /* @__PURE__ */
|
|
16644
|
-
isGoalLoading && /* @__PURE__ */
|
|
17631
|
+
/* @__PURE__ */ jsxs37("div", { className: "min-w-0 flex-1", children: [
|
|
17632
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
17633
|
+
/* @__PURE__ */ jsx54("span", { className: "font-medium", children: t("chat.goal.label") }),
|
|
17634
|
+
threadGoal && /* @__PURE__ */ jsx54("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}`) }),
|
|
17635
|
+
isGoalLoading && /* @__PURE__ */ jsx54(Loader29, { className: "size-3 animate-spin text-muted-foreground" })
|
|
16645
17636
|
] }),
|
|
16646
|
-
/* @__PURE__ */
|
|
17637
|
+
/* @__PURE__ */ jsx54(
|
|
16647
17638
|
"div",
|
|
16648
17639
|
{
|
|
16649
17640
|
className: cn(
|
|
@@ -16653,13 +17644,13 @@ function Chat({
|
|
|
16653
17644
|
children: goalError || threadGoal?.objective
|
|
16654
17645
|
}
|
|
16655
17646
|
),
|
|
16656
|
-
threadGoal && /* @__PURE__ */
|
|
17647
|
+
threadGoal && /* @__PURE__ */ jsx54("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: /* @__PURE__ */ jsx54("span", { children: t("chat.goal.elapsed", {
|
|
16657
17648
|
elapsed: formatGoalElapsed(displayedGoalElapsedSeconds)
|
|
16658
17649
|
}) }) })
|
|
16659
17650
|
] }),
|
|
16660
|
-
threadGoal && /* @__PURE__ */
|
|
16661
|
-
/* @__PURE__ */
|
|
16662
|
-
/* @__PURE__ */
|
|
17651
|
+
threadGoal && /* @__PURE__ */ jsxs37("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
17652
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17653
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16663
17654
|
Button,
|
|
16664
17655
|
{
|
|
16665
17656
|
type: "button",
|
|
@@ -16670,13 +17661,13 @@ function Chat({
|
|
|
16670
17661
|
const prefix = "/goal edit ";
|
|
16671
17662
|
setComposerText(`${prefix}${threadGoal.objective}`);
|
|
16672
17663
|
},
|
|
16673
|
-
children: /* @__PURE__ */
|
|
17664
|
+
children: /* @__PURE__ */ jsx54(Pencil4, { className: "size-3" })
|
|
16674
17665
|
}
|
|
16675
17666
|
) }),
|
|
16676
|
-
/* @__PURE__ */
|
|
17667
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: t("chat.goal.edit") })
|
|
16677
17668
|
] }),
|
|
16678
|
-
/* @__PURE__ */
|
|
16679
|
-
/* @__PURE__ */
|
|
17669
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17670
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16680
17671
|
Button,
|
|
16681
17672
|
{
|
|
16682
17673
|
type: "button",
|
|
@@ -16692,13 +17683,13 @@ function Chat({
|
|
|
16692
17683
|
executionType: "insert_invocation"
|
|
16693
17684
|
}
|
|
16694
17685
|
}),
|
|
16695
|
-
children: threadGoal.status === "paused" ? /* @__PURE__ */
|
|
17686
|
+
children: threadGoal.status === "paused" ? /* @__PURE__ */ jsx54(Play, { className: "size-3" }) : /* @__PURE__ */ jsx54(Pause, { className: "size-3" })
|
|
16696
17687
|
}
|
|
16697
17688
|
) }),
|
|
16698
|
-
/* @__PURE__ */
|
|
17689
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
|
|
16699
17690
|
] }),
|
|
16700
|
-
/* @__PURE__ */
|
|
16701
|
-
/* @__PURE__ */
|
|
17691
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17692
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16702
17693
|
Button,
|
|
16703
17694
|
{
|
|
16704
17695
|
type: "button",
|
|
@@ -16714,13 +17705,13 @@ function Chat({
|
|
|
16714
17705
|
executionType: "insert_invocation"
|
|
16715
17706
|
}
|
|
16716
17707
|
}),
|
|
16717
|
-
children: /* @__PURE__ */
|
|
17708
|
+
children: /* @__PURE__ */ jsx54(Trash23, { className: "size-3" })
|
|
16718
17709
|
}
|
|
16719
17710
|
) }),
|
|
16720
|
-
/* @__PURE__ */
|
|
17711
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: t("chat.goal.clear") })
|
|
16721
17712
|
] }),
|
|
16722
|
-
threadGoal.objective && !goalError && /* @__PURE__ */
|
|
16723
|
-
/* @__PURE__ */
|
|
17713
|
+
threadGoal.objective && !goalError && /* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17714
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16724
17715
|
Button,
|
|
16725
17716
|
{
|
|
16726
17717
|
type: "button",
|
|
@@ -16729,7 +17720,7 @@ function Chat({
|
|
|
16729
17720
|
"aria-expanded": isGoalObjectiveExpanded,
|
|
16730
17721
|
"aria-label": isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective"),
|
|
16731
17722
|
onClick: () => setIsGoalObjectiveExpanded((expanded) => !expanded),
|
|
16732
|
-
children: /* @__PURE__ */
|
|
17723
|
+
children: /* @__PURE__ */ jsx54(
|
|
16733
17724
|
ChevronDown5,
|
|
16734
17725
|
{
|
|
16735
17726
|
className: cn(
|
|
@@ -16740,13 +17731,13 @@ function Chat({
|
|
|
16740
17731
|
)
|
|
16741
17732
|
}
|
|
16742
17733
|
) }),
|
|
16743
|
-
/* @__PURE__ */
|
|
17734
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
|
|
16744
17735
|
] })
|
|
16745
17736
|
] })
|
|
16746
17737
|
]
|
|
16747
17738
|
}
|
|
16748
17739
|
),
|
|
16749
|
-
/* @__PURE__ */
|
|
17740
|
+
/* @__PURE__ */ jsx54(
|
|
16750
17741
|
PendingRuntimeServices,
|
|
16751
17742
|
{
|
|
16752
17743
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -16755,7 +17746,7 @@ function Chat({
|
|
|
16755
17746
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
16756
17747
|
}
|
|
16757
17748
|
),
|
|
16758
|
-
/* @__PURE__ */
|
|
17749
|
+
/* @__PURE__ */ jsx54(
|
|
16759
17750
|
PendingTodos,
|
|
16760
17751
|
{
|
|
16761
17752
|
snapshot: stream.todos,
|
|
@@ -16763,7 +17754,7 @@ function Chat({
|
|
|
16763
17754
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
16764
17755
|
}
|
|
16765
17756
|
),
|
|
16766
|
-
/* @__PURE__ */
|
|
17757
|
+
/* @__PURE__ */ jsx54(
|
|
16767
17758
|
PendingFollowUps,
|
|
16768
17759
|
{
|
|
16769
17760
|
items: pendingFollowUps,
|
|
@@ -16776,7 +17767,7 @@ function Chat({
|
|
|
16776
17767
|
attachToComposer: true
|
|
16777
17768
|
}
|
|
16778
17769
|
),
|
|
16779
|
-
/* @__PURE__ */
|
|
17770
|
+
/* @__PURE__ */ jsx54(
|
|
16780
17771
|
RequestUserInputPanel,
|
|
16781
17772
|
{
|
|
16782
17773
|
request: stream.pendingRequestUserInput,
|
|
@@ -16785,7 +17776,7 @@ function Chat({
|
|
|
16785
17776
|
attachToComposer: true
|
|
16786
17777
|
}
|
|
16787
17778
|
),
|
|
16788
|
-
/* @__PURE__ */
|
|
17779
|
+
/* @__PURE__ */ jsx54(
|
|
16789
17780
|
HITLApprovalPanel,
|
|
16790
17781
|
{
|
|
16791
17782
|
request: stream.pendingHITLRequest,
|
|
@@ -16794,7 +17785,7 @@ function Chat({
|
|
|
16794
17785
|
attachToComposer: true
|
|
16795
17786
|
}
|
|
16796
17787
|
),
|
|
16797
|
-
runtimeCapabilityPalette && /* @__PURE__ */
|
|
17788
|
+
runtimeCapabilityPalette && /* @__PURE__ */ jsx54(
|
|
16798
17789
|
SlashPalette,
|
|
16799
17790
|
{
|
|
16800
17791
|
palette: runtimeCapabilityPalette,
|
|
@@ -16808,7 +17799,7 @@ function Chat({
|
|
|
16808
17799
|
onSelect: selectSlashPaletteOption
|
|
16809
17800
|
}
|
|
16810
17801
|
),
|
|
16811
|
-
/* @__PURE__ */
|
|
17802
|
+
/* @__PURE__ */ jsx54("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs37(
|
|
16812
17803
|
"div",
|
|
16813
17804
|
{
|
|
16814
17805
|
"data-slot": "composer-input-shell",
|
|
@@ -16822,7 +17813,7 @@ function Chat({
|
|
|
16822
17813
|
composerInputRoundedClass
|
|
16823
17814
|
),
|
|
16824
17815
|
children: [
|
|
16825
|
-
/* @__PURE__ */
|
|
17816
|
+
/* @__PURE__ */ jsx54(
|
|
16826
17817
|
"div",
|
|
16827
17818
|
{
|
|
16828
17819
|
ref: composerInputRef,
|
|
@@ -16844,7 +17835,7 @@ function Chat({
|
|
|
16844
17835
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
16845
17836
|
),
|
|
16846
17837
|
children: renderedComposerParts.map(
|
|
16847
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */
|
|
17838
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ jsx54(React49.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ jsxs37(
|
|
16848
17839
|
"span",
|
|
16849
17840
|
{
|
|
16850
17841
|
"data-composer-capability-key": part.key,
|
|
@@ -16853,14 +17844,14 @@ function Chat({
|
|
|
16853
17844
|
contentEditable: false,
|
|
16854
17845
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
16855
17846
|
children: [
|
|
16856
|
-
/* @__PURE__ */
|
|
17847
|
+
/* @__PURE__ */ jsx54(
|
|
16857
17848
|
RuntimeCapabilityIcon,
|
|
16858
17849
|
{
|
|
16859
17850
|
option: part.capability,
|
|
16860
17851
|
variant: "chip"
|
|
16861
17852
|
}
|
|
16862
17853
|
),
|
|
16863
|
-
/* @__PURE__ */
|
|
17854
|
+
/* @__PURE__ */ jsx54("span", { className: "truncate", children: part.capability.label })
|
|
16864
17855
|
]
|
|
16865
17856
|
},
|
|
16866
17857
|
part.key
|
|
@@ -16869,14 +17860,14 @@ function Chat({
|
|
|
16869
17860
|
},
|
|
16870
17861
|
composerDomVersion
|
|
16871
17862
|
),
|
|
16872
|
-
/* @__PURE__ */
|
|
17863
|
+
/* @__PURE__ */ jsxs37(
|
|
16873
17864
|
"div",
|
|
16874
17865
|
{
|
|
16875
17866
|
"data-slot": "composer-action-bar",
|
|
16876
17867
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
16877
17868
|
children: [
|
|
16878
|
-
/* @__PURE__ */
|
|
16879
|
-
/* @__PURE__ */
|
|
17869
|
+
/* @__PURE__ */ jsxs37("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
17870
|
+
/* @__PURE__ */ jsx54("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ jsx54(
|
|
16880
17871
|
ComposerMenu,
|
|
16881
17872
|
{
|
|
16882
17873
|
composer,
|
|
@@ -16894,20 +17885,20 @@ function Chat({
|
|
|
16894
17885
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
16895
17886
|
}
|
|
16896
17887
|
) }),
|
|
16897
|
-
selectedTool && /* @__PURE__ */
|
|
16898
|
-
/* @__PURE__ */
|
|
16899
|
-
/* @__PURE__ */
|
|
17888
|
+
selectedTool && /* @__PURE__ */ jsxs37("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: [
|
|
17889
|
+
/* @__PURE__ */ jsx54("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
17890
|
+
/* @__PURE__ */ jsx54(
|
|
16900
17891
|
"button",
|
|
16901
17892
|
{
|
|
16902
17893
|
type: "button",
|
|
16903
17894
|
onClick: () => setSelectedTool(null),
|
|
16904
17895
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
16905
|
-
children: /* @__PURE__ */
|
|
17896
|
+
children: /* @__PURE__ */ jsx54(X6, { size: 12 })
|
|
16906
17897
|
}
|
|
16907
17898
|
)
|
|
16908
17899
|
] })
|
|
16909
17900
|
] }),
|
|
16910
|
-
/* @__PURE__ */
|
|
17901
|
+
/* @__PURE__ */ jsx54("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ jsx54(
|
|
16911
17902
|
SendButton,
|
|
16912
17903
|
{
|
|
16913
17904
|
disabled: isSendDisabled,
|
|
@@ -16930,7 +17921,7 @@ function Chat({
|
|
|
16930
17921
|
]
|
|
16931
17922
|
}
|
|
16932
17923
|
) }),
|
|
16933
|
-
disclaimer?.text && /* @__PURE__ */
|
|
17924
|
+
disclaimer?.text && /* @__PURE__ */ jsx54(
|
|
16934
17925
|
"p",
|
|
16935
17926
|
{
|
|
16936
17927
|
className: cn(
|
|
@@ -16940,12 +17931,12 @@ function Chat({
|
|
|
16940
17931
|
children: disclaimer.text
|
|
16941
17932
|
}
|
|
16942
17933
|
),
|
|
16943
|
-
/* @__PURE__ */
|
|
16944
|
-
/* @__PURE__ */
|
|
16945
|
-
/* @__PURE__ */
|
|
17934
|
+
/* @__PURE__ */ jsxs37("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
17935
|
+
/* @__PURE__ */ jsx54("span", { children: t("chat.poweredBy") }),
|
|
17936
|
+
/* @__PURE__ */ jsx54(ContextUsageIndicator, { className: "absolute right-4" })
|
|
16946
17937
|
] })
|
|
16947
17938
|
] }),
|
|
16948
|
-
/* @__PURE__ */
|
|
17939
|
+
/* @__PURE__ */ jsx54(
|
|
16949
17940
|
SettingsSheet,
|
|
16950
17941
|
{
|
|
16951
17942
|
open: petSettingsOpen,
|
|
@@ -16955,17 +17946,17 @@ function Chat({
|
|
|
16955
17946
|
onSave: savePetLocalSettings
|
|
16956
17947
|
}
|
|
16957
17948
|
),
|
|
16958
|
-
/* @__PURE__ */
|
|
17949
|
+
/* @__PURE__ */ jsx54(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
16959
17950
|
]
|
|
16960
17951
|
}
|
|
16961
17952
|
);
|
|
16962
17953
|
}
|
|
16963
17954
|
|
|
16964
17955
|
// src/components/ui/separator.tsx
|
|
16965
|
-
import * as
|
|
16966
|
-
import { jsx as
|
|
16967
|
-
var Separator =
|
|
16968
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */
|
|
17956
|
+
import * as React50 from "react";
|
|
17957
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
17958
|
+
var Separator = React50.forwardRef(
|
|
17959
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
16969
17960
|
"div",
|
|
16970
17961
|
{
|
|
16971
17962
|
ref,
|