@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.cjs
CHANGED
|
@@ -67,8 +67,8 @@ __export(index_exports, {
|
|
|
67
67
|
module.exports = __toCommonJS(index_exports);
|
|
68
68
|
|
|
69
69
|
// src/components/chat.tsx
|
|
70
|
-
var
|
|
71
|
-
var
|
|
70
|
+
var React49 = __toESM(require("react"), 1);
|
|
71
|
+
var import_lucide_react29 = require("lucide-react");
|
|
72
72
|
|
|
73
73
|
// src/lib/utils.ts
|
|
74
74
|
var import_clsx = require("clsx");
|
|
@@ -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",
|
|
@@ -7695,8 +7701,8 @@ function useSlashCommands({
|
|
|
7695
7701
|
}
|
|
7696
7702
|
|
|
7697
7703
|
// src/components/thread/messages/ai.tsx
|
|
7698
|
-
var
|
|
7699
|
-
var
|
|
7704
|
+
var React36 = __toESM(require("react"), 1);
|
|
7705
|
+
var import_lucide_react24 = require("lucide-react");
|
|
7700
7706
|
|
|
7701
7707
|
// src/lib/agent-run-render-tree.ts
|
|
7702
7708
|
function isTextContent(content) {
|
|
@@ -11563,8 +11569,983 @@ function hasLegacySurface(surface) {
|
|
|
11563
11569
|
return !!surface?.componentTree;
|
|
11564
11570
|
}
|
|
11565
11571
|
|
|
11566
|
-
// src/components/thread/messages/
|
|
11572
|
+
// src/components/thread/messages/mcp-app.tsx
|
|
11573
|
+
var React35 = __toESM(require("react"), 1);
|
|
11574
|
+
var import_chatkit_types9 = require("@xpert-ai/chatkit-types");
|
|
11575
|
+
var import_lucide_react23 = require("lucide-react");
|
|
11567
11576
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
11577
|
+
var EMPTY_INPUT_SCHEMA = {
|
|
11578
|
+
type: "object",
|
|
11579
|
+
properties: {}
|
|
11580
|
+
};
|
|
11581
|
+
function isRecord5(value) {
|
|
11582
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
11583
|
+
}
|
|
11584
|
+
function readRecord(value) {
|
|
11585
|
+
return isRecord5(value) ? value : void 0;
|
|
11586
|
+
}
|
|
11587
|
+
function readNonEmptyRecord(value) {
|
|
11588
|
+
const record = readRecord(value);
|
|
11589
|
+
return record && Object.keys(record).length ? record : void 0;
|
|
11590
|
+
}
|
|
11591
|
+
function readString3(value) {
|
|
11592
|
+
return typeof value === "string" ? value : void 0;
|
|
11593
|
+
}
|
|
11594
|
+
function readBoolean(value) {
|
|
11595
|
+
return typeof value === "boolean" ? value : void 0;
|
|
11596
|
+
}
|
|
11597
|
+
function readLocalizedText(value) {
|
|
11598
|
+
if (typeof value === "string") return value;
|
|
11599
|
+
if (isRecord5(value)) return value;
|
|
11600
|
+
return void 0;
|
|
11601
|
+
}
|
|
11602
|
+
function readIconDefinition(value) {
|
|
11603
|
+
if (!isRecord5(value)) return void 0;
|
|
11604
|
+
return typeof value.type === "string" && typeof value.value === "string" ? value : void 0;
|
|
11605
|
+
}
|
|
11606
|
+
function readStringList(value) {
|
|
11607
|
+
if (!Array.isArray(value)) return void 0;
|
|
11608
|
+
const strings = value.filter((item) => typeof item === "string");
|
|
11609
|
+
return strings.length ? strings : void 0;
|
|
11610
|
+
}
|
|
11611
|
+
function buildXpertApiUrl(apiUrl, path) {
|
|
11612
|
+
const normalizedApiUrl = apiUrl.trim();
|
|
11613
|
+
if (!normalizedApiUrl) return path;
|
|
11614
|
+
try {
|
|
11615
|
+
const url = new URL(normalizedApiUrl);
|
|
11616
|
+
return `${url.origin}${path}`;
|
|
11617
|
+
} catch {
|
|
11618
|
+
return path;
|
|
11619
|
+
}
|
|
11620
|
+
}
|
|
11621
|
+
function appendQuery(path, params) {
|
|
11622
|
+
const query = params.toString();
|
|
11623
|
+
return query ? `${path}?${query}` : path;
|
|
11624
|
+
}
|
|
11625
|
+
function buildMcpAppReviveParams(data) {
|
|
11626
|
+
const params = new URLSearchParams();
|
|
11627
|
+
const add = (key, value) => {
|
|
11628
|
+
if (value) {
|
|
11629
|
+
params.set(key, value);
|
|
11630
|
+
}
|
|
11631
|
+
};
|
|
11632
|
+
add("toolsetId", data.toolsetId);
|
|
11633
|
+
add("serverName", data.serverName);
|
|
11634
|
+
add("toolName", data.toolName);
|
|
11635
|
+
add("toolCallId", data.toolCallId);
|
|
11636
|
+
add("resourceUri", data.resourceUri);
|
|
11637
|
+
add("title", typeof data.title === "string" ? data.title : void 0);
|
|
11638
|
+
add("token", data.appInstanceToken);
|
|
11639
|
+
return params;
|
|
11640
|
+
}
|
|
11641
|
+
function buildMcpAppEndpointPath(data, endpoint) {
|
|
11642
|
+
return appendQuery(
|
|
11643
|
+
`/api/xpert-toolset/mcp-apps/${encodeURIComponent(
|
|
11644
|
+
data.appInstanceId
|
|
11645
|
+
)}/${endpoint}`,
|
|
11646
|
+
buildMcpAppReviveParams(data)
|
|
11647
|
+
);
|
|
11648
|
+
}
|
|
11649
|
+
function escapeHtmlAttribute(value) {
|
|
11650
|
+
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">");
|
|
11651
|
+
}
|
|
11652
|
+
function domains(values) {
|
|
11653
|
+
return values?.filter((value) => value.trim()).join(" ") ?? "";
|
|
11654
|
+
}
|
|
11655
|
+
function buildCsp(csp) {
|
|
11656
|
+
const resourceDomains = domains(csp?.resourceDomains);
|
|
11657
|
+
const connectDomains = domains(csp?.connectDomains) || "'none'";
|
|
11658
|
+
const frameDomains = domains(csp?.frameDomains) || "'none'";
|
|
11659
|
+
const baseUriDomains = domains(csp?.baseUriDomains) || "'self'";
|
|
11660
|
+
return [
|
|
11661
|
+
"default-src 'none'",
|
|
11662
|
+
`script-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11663
|
+
`style-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11664
|
+
`img-src data: blob: ${resourceDomains}`.trim(),
|
|
11665
|
+
`media-src data: blob: ${resourceDomains}`.trim(),
|
|
11666
|
+
`font-src data: ${resourceDomains}`.trim(),
|
|
11667
|
+
`connect-src ${connectDomains}`,
|
|
11668
|
+
`frame-src ${frameDomains}`,
|
|
11669
|
+
`base-uri ${baseUriDomains}`
|
|
11670
|
+
].join("; ");
|
|
11671
|
+
}
|
|
11672
|
+
function injectHeadContent(html, content) {
|
|
11673
|
+
if (/<head[^>]*>/i.test(html)) {
|
|
11674
|
+
return html.replace(/<head([^>]*)>/i, `<head$1>${content}`);
|
|
11675
|
+
}
|
|
11676
|
+
return `<!doctype html><html><head>${content}</head><body>${html}</body></html>`;
|
|
11677
|
+
}
|
|
11678
|
+
function injectCsp(html, csp) {
|
|
11679
|
+
const meta = `<meta http-equiv="Content-Security-Policy" content="${escapeHtmlAttribute(
|
|
11680
|
+
buildCsp(csp)
|
|
11681
|
+
)}">`;
|
|
11682
|
+
return injectHeadContent(html, meta);
|
|
11683
|
+
}
|
|
11684
|
+
function decodeResourceHtml(resource) {
|
|
11685
|
+
if (typeof resource.text === "string") {
|
|
11686
|
+
return resource.text;
|
|
11687
|
+
}
|
|
11688
|
+
if (typeof resource.blob !== "string") {
|
|
11689
|
+
return null;
|
|
11690
|
+
}
|
|
11691
|
+
try {
|
|
11692
|
+
const decoded = window.atob(resource.blob);
|
|
11693
|
+
const escaped = Array.from(decoded).map((char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`).join("");
|
|
11694
|
+
return decodeURIComponent(escaped);
|
|
11695
|
+
} catch {
|
|
11696
|
+
try {
|
|
11697
|
+
return window.atob(resource.blob);
|
|
11698
|
+
} catch {
|
|
11699
|
+
return null;
|
|
11700
|
+
}
|
|
11701
|
+
}
|
|
11702
|
+
}
|
|
11703
|
+
function normalizeCspMetadata(value) {
|
|
11704
|
+
const raw = readRecord(value);
|
|
11705
|
+
if (!raw) return void 0;
|
|
11706
|
+
const csp = {};
|
|
11707
|
+
const connectDomains = readStringList(raw.connectDomains);
|
|
11708
|
+
const resourceDomains = readStringList(raw.resourceDomains);
|
|
11709
|
+
const frameDomains = readStringList(raw.frameDomains);
|
|
11710
|
+
const baseUriDomains = readStringList(raw.baseUriDomains);
|
|
11711
|
+
if (connectDomains) csp.connectDomains = connectDomains;
|
|
11712
|
+
if (resourceDomains) csp.resourceDomains = resourceDomains;
|
|
11713
|
+
if (frameDomains) csp.frameDomains = frameDomains;
|
|
11714
|
+
if (baseUriDomains) csp.baseUriDomains = baseUriDomains;
|
|
11715
|
+
return Object.keys(csp).length ? csp : void 0;
|
|
11716
|
+
}
|
|
11717
|
+
function normalizePermissionGrant(value) {
|
|
11718
|
+
return value === true || isRecord5(value) ? value : void 0;
|
|
11719
|
+
}
|
|
11720
|
+
function normalizePermissionsMetadata(value) {
|
|
11721
|
+
const raw = readRecord(value);
|
|
11722
|
+
if (!raw) return void 0;
|
|
11723
|
+
const permissions = {};
|
|
11724
|
+
const camera = normalizePermissionGrant(raw.camera);
|
|
11725
|
+
const microphone = normalizePermissionGrant(raw.microphone);
|
|
11726
|
+
const geolocation = normalizePermissionGrant(raw.geolocation);
|
|
11727
|
+
const clipboardWrite = normalizePermissionGrant(raw.clipboardWrite);
|
|
11728
|
+
if (camera !== void 0) permissions.camera = camera;
|
|
11729
|
+
if (microphone !== void 0) permissions.microphone = microphone;
|
|
11730
|
+
if (geolocation !== void 0) permissions.geolocation = geolocation;
|
|
11731
|
+
if (clipboardWrite !== void 0) permissions.clipboardWrite = clipboardWrite;
|
|
11732
|
+
return Object.keys(permissions).length ? permissions : void 0;
|
|
11733
|
+
}
|
|
11734
|
+
function normalizeJsonRpcMessage(value) {
|
|
11735
|
+
const data = typeof value === "string" ? (() => {
|
|
11736
|
+
try {
|
|
11737
|
+
return JSON.parse(value);
|
|
11738
|
+
} catch {
|
|
11739
|
+
return null;
|
|
11740
|
+
}
|
|
11741
|
+
})() : value;
|
|
11742
|
+
if (!isRecord5(data) || typeof data.method !== "string") {
|
|
11743
|
+
return null;
|
|
11744
|
+
}
|
|
11745
|
+
return data;
|
|
11746
|
+
}
|
|
11747
|
+
function jsonRpcResult(id, result) {
|
|
11748
|
+
return {
|
|
11749
|
+
jsonrpc: "2.0",
|
|
11750
|
+
id: id ?? null,
|
|
11751
|
+
result
|
|
11752
|
+
};
|
|
11753
|
+
}
|
|
11754
|
+
function jsonRpcError(id, message) {
|
|
11755
|
+
return {
|
|
11756
|
+
jsonrpc: "2.0",
|
|
11757
|
+
id: id ?? null,
|
|
11758
|
+
error: {
|
|
11759
|
+
code: -32e3,
|
|
11760
|
+
message
|
|
11761
|
+
}
|
|
11762
|
+
};
|
|
11763
|
+
}
|
|
11764
|
+
function getErrorMessage(error) {
|
|
11765
|
+
return error instanceof Error ? error.message : String(error);
|
|
11766
|
+
}
|
|
11767
|
+
function getContainerDimensions(element) {
|
|
11768
|
+
if (!element) return null;
|
|
11769
|
+
const rect = element.getBoundingClientRect();
|
|
11770
|
+
return {
|
|
11771
|
+
width: rect.width,
|
|
11772
|
+
height: rect.height
|
|
11773
|
+
};
|
|
11774
|
+
}
|
|
11775
|
+
function normalizeHostLocale(locale) {
|
|
11776
|
+
return locale?.trim() || navigator.language || "en-US";
|
|
11777
|
+
}
|
|
11778
|
+
function getLocaleLanguage(locale) {
|
|
11779
|
+
return locale.split(/[-_]/)[0]?.toLowerCase() || locale.toLowerCase();
|
|
11780
|
+
}
|
|
11781
|
+
function getLocaleDirection(locale) {
|
|
11782
|
+
const language = getLocaleLanguage(locale);
|
|
11783
|
+
return ["ar", "fa", "he", "ur"].includes(language) ? "rtl" : "ltr";
|
|
11784
|
+
}
|
|
11785
|
+
function setHtmlAttribute(attrs, name, value) {
|
|
11786
|
+
const escaped = escapeHtmlAttribute(value);
|
|
11787
|
+
const pattern = new RegExp(`\\s${name}=("[^"]*"|'[^']*'|[^\\s>]*)`, "i");
|
|
11788
|
+
if (pattern.test(attrs)) {
|
|
11789
|
+
return attrs.replace(pattern, ` ${name}="${escaped}"`);
|
|
11790
|
+
}
|
|
11791
|
+
return `${attrs} ${name}="${escaped}"`;
|
|
11792
|
+
}
|
|
11793
|
+
function injectMcpAppLocale(html, locale) {
|
|
11794
|
+
const normalizedLocale = normalizeHostLocale(locale);
|
|
11795
|
+
const direction = getLocaleDirection(normalizedLocale);
|
|
11796
|
+
if (/<html[\s>]/i.test(html)) {
|
|
11797
|
+
return html.replace(/<html([^>]*)>/i, (_match, attrs) => {
|
|
11798
|
+
const withLang = setHtmlAttribute(attrs, "lang", normalizedLocale);
|
|
11799
|
+
const withDirection = setHtmlAttribute(withLang, "dir", direction);
|
|
11800
|
+
return `<html${withDirection}>`;
|
|
11801
|
+
});
|
|
11802
|
+
}
|
|
11803
|
+
return `<!doctype html><html lang="${escapeHtmlAttribute(
|
|
11804
|
+
normalizedLocale
|
|
11805
|
+
)}" dir="${direction}"><head></head><body>${html}</body></html>`;
|
|
11806
|
+
}
|
|
11807
|
+
var MCP_APP_THEME_COLOR_TOKENS = [
|
|
11808
|
+
["--background", "--mcp-app-color-background", "oklch(1 0 0)"],
|
|
11809
|
+
["--foreground", "--mcp-app-color-foreground", "oklch(0.145 0 0)"],
|
|
11810
|
+
["--card", "--mcp-app-color-card", "oklch(1 0 0)"],
|
|
11811
|
+
[
|
|
11812
|
+
"--card-foreground",
|
|
11813
|
+
"--mcp-app-color-card-foreground",
|
|
11814
|
+
"oklch(0.145 0 0)"
|
|
11815
|
+
],
|
|
11816
|
+
["--popover", "--mcp-app-color-popover", "oklch(1 0 0)"],
|
|
11817
|
+
[
|
|
11818
|
+
"--popover-foreground",
|
|
11819
|
+
"--mcp-app-color-popover-foreground",
|
|
11820
|
+
"oklch(0.145 0 0)"
|
|
11821
|
+
],
|
|
11822
|
+
["--primary", "--mcp-app-color-primary", "oklch(0.205 0 0)"],
|
|
11823
|
+
[
|
|
11824
|
+
"--primary-foreground",
|
|
11825
|
+
"--mcp-app-color-primary-foreground",
|
|
11826
|
+
"oklch(0.985 0 0)"
|
|
11827
|
+
],
|
|
11828
|
+
["--secondary", "--mcp-app-color-secondary", "oklch(0.97 0 0)"],
|
|
11829
|
+
[
|
|
11830
|
+
"--secondary-foreground",
|
|
11831
|
+
"--mcp-app-color-secondary-foreground",
|
|
11832
|
+
"oklch(0.205 0 0)"
|
|
11833
|
+
],
|
|
11834
|
+
["--muted", "--mcp-app-color-muted", "oklch(0.97 0 0)"],
|
|
11835
|
+
[
|
|
11836
|
+
"--muted-foreground",
|
|
11837
|
+
"--mcp-app-color-muted-foreground",
|
|
11838
|
+
"oklch(0.556 0 0)"
|
|
11839
|
+
],
|
|
11840
|
+
["--accent", "--mcp-app-color-accent", "oklch(0.97 0 0)"],
|
|
11841
|
+
[
|
|
11842
|
+
"--accent-foreground",
|
|
11843
|
+
"--mcp-app-color-accent-foreground",
|
|
11844
|
+
"oklch(0.205 0 0)"
|
|
11845
|
+
],
|
|
11846
|
+
[
|
|
11847
|
+
"--destructive",
|
|
11848
|
+
"--mcp-app-color-destructive",
|
|
11849
|
+
"oklch(0.577 0.245 27.325)"
|
|
11850
|
+
],
|
|
11851
|
+
[
|
|
11852
|
+
"--destructive-foreground",
|
|
11853
|
+
"--mcp-app-color-destructive-foreground",
|
|
11854
|
+
"oklch(0.985 0 0)"
|
|
11855
|
+
],
|
|
11856
|
+
["--border", "--mcp-app-color-border", "oklch(0.922 0 0)"],
|
|
11857
|
+
["--input", "--mcp-app-color-input", "oklch(0.922 0 0)"],
|
|
11858
|
+
["--ring", "--mcp-app-color-ring", "oklch(0.708 0 0)"],
|
|
11859
|
+
["--chart-1", "--mcp-app-color-chart-1", "oklch(0.87 0 0)"],
|
|
11860
|
+
["--chart-2", "--mcp-app-color-chart-2", "oklch(0.556 0 0)"],
|
|
11861
|
+
["--chart-3", "--mcp-app-color-chart-3", "oklch(0.439 0 0)"],
|
|
11862
|
+
["--chart-4", "--mcp-app-color-chart-4", "oklch(0.371 0 0)"],
|
|
11863
|
+
["--chart-5", "--mcp-app-color-chart-5", "oklch(0.269 0 0)"]
|
|
11864
|
+
];
|
|
11865
|
+
function sanitizeCssValue(value) {
|
|
11866
|
+
return value.replace(/[;{}<>]/g, "").trim();
|
|
11867
|
+
}
|
|
11868
|
+
function normalizeColorCssValue(value) {
|
|
11869
|
+
const trimmed = sanitizeCssValue(value);
|
|
11870
|
+
if (!trimmed) return "";
|
|
11871
|
+
if (/^(#|rgb\(|rgba\(|hsl\(|hsla\(|oklch\(|oklab\(|color\(|var\()/i.test(
|
|
11872
|
+
trimmed
|
|
11873
|
+
)) {
|
|
11874
|
+
return trimmed;
|
|
11875
|
+
}
|
|
11876
|
+
if (/^-?\d/.test(trimmed) && /\s/.test(trimmed)) {
|
|
11877
|
+
return `hsl(${trimmed})`;
|
|
11878
|
+
}
|
|
11879
|
+
return trimmed;
|
|
11880
|
+
}
|
|
11881
|
+
function getHostThemeMode() {
|
|
11882
|
+
return document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
11883
|
+
}
|
|
11884
|
+
function readHostCssVariable(element, variableName) {
|
|
11885
|
+
const candidates = [
|
|
11886
|
+
element,
|
|
11887
|
+
element === document.documentElement ? null : document.documentElement
|
|
11888
|
+
].filter(Boolean);
|
|
11889
|
+
for (const candidate of candidates) {
|
|
11890
|
+
const value = window.getComputedStyle(candidate).getPropertyValue(variableName).trim();
|
|
11891
|
+
if (value) {
|
|
11892
|
+
return value;
|
|
11893
|
+
}
|
|
11894
|
+
}
|
|
11895
|
+
return "";
|
|
11896
|
+
}
|
|
11897
|
+
function buildMcpAppTheme(element) {
|
|
11898
|
+
const source = element ?? document.documentElement;
|
|
11899
|
+
const sourceStyles = window.getComputedStyle(source);
|
|
11900
|
+
const cssVariables = {
|
|
11901
|
+
"--mcp-app-color-scheme": getHostThemeMode(),
|
|
11902
|
+
"--mcp-app-font-sans": sanitizeCssValue(
|
|
11903
|
+
sourceStyles.fontFamily || "ui-sans-serif, system-ui, sans-serif"
|
|
11904
|
+
),
|
|
11905
|
+
"--mcp-app-font-mono": sanitizeCssValue(
|
|
11906
|
+
readHostCssVariable(source, "--font-mono") || "ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
11907
|
+
),
|
|
11908
|
+
"--mcp-app-radius": sanitizeCssValue(
|
|
11909
|
+
readHostCssVariable(source, "--radius") || "0.5rem"
|
|
11910
|
+
)
|
|
11911
|
+
};
|
|
11912
|
+
for (const [
|
|
11913
|
+
hostVariable,
|
|
11914
|
+
appVariable,
|
|
11915
|
+
fallback
|
|
11916
|
+
] of MCP_APP_THEME_COLOR_TOKENS) {
|
|
11917
|
+
cssVariables[appVariable] = normalizeColorCssValue(readHostCssVariable(source, hostVariable)) || fallback;
|
|
11918
|
+
}
|
|
11919
|
+
return {
|
|
11920
|
+
mode: getHostThemeMode(),
|
|
11921
|
+
cssVariables
|
|
11922
|
+
};
|
|
11923
|
+
}
|
|
11924
|
+
function injectMcpAppTheme(html, theme) {
|
|
11925
|
+
const declarations = Object.entries(theme.cssVariables).map(([name, value]) => `${name}: ${sanitizeCssValue(value)};`).join("");
|
|
11926
|
+
const style = `<style id="mcp-app-host-theme">:root{color-scheme:${theme.mode};${declarations}}</style>`;
|
|
11927
|
+
return injectHeadContent(html, style);
|
|
11928
|
+
}
|
|
11929
|
+
function normalizeInputSchema(value) {
|
|
11930
|
+
const raw = readRecord(value);
|
|
11931
|
+
if (!raw || raw.type !== void 0 && raw.type !== "object") {
|
|
11932
|
+
return EMPTY_INPUT_SCHEMA;
|
|
11933
|
+
}
|
|
11934
|
+
return {
|
|
11935
|
+
...raw,
|
|
11936
|
+
type: "object",
|
|
11937
|
+
properties: readRecord(raw.properties) ?? {},
|
|
11938
|
+
...Array.isArray(raw.required) && raw.required.every((item) => typeof item === "string") ? { required: raw.required } : {}
|
|
11939
|
+
};
|
|
11940
|
+
}
|
|
11941
|
+
function normalizeMcpAppToolInfo(value, data, resource = {}) {
|
|
11942
|
+
const raw = readRecord(value) ?? {};
|
|
11943
|
+
const rawTool = readRecord(raw.tool) ?? {};
|
|
11944
|
+
const rawName = readString3(raw.name);
|
|
11945
|
+
const originalName = readString3(rawTool.name) ?? readString3(raw.originalName) ?? data.toolName;
|
|
11946
|
+
const title = readLocalizedText(rawTool.title) ?? readLocalizedText(raw.title) ?? resource.title ?? data.title ?? data.toolName;
|
|
11947
|
+
const description = readLocalizedText(rawTool.description) ?? readLocalizedText(raw.description) ?? resource.description ?? data.description;
|
|
11948
|
+
const icon = readIconDefinition(rawTool.icon) ?? readIconDefinition(raw.icon) ?? resource.icon ?? data.icon;
|
|
11949
|
+
return {
|
|
11950
|
+
...raw,
|
|
11951
|
+
id: data.toolCallId,
|
|
11952
|
+
name: rawName ?? data.toolName,
|
|
11953
|
+
originalName,
|
|
11954
|
+
title,
|
|
11955
|
+
...description ? { description } : {},
|
|
11956
|
+
...icon ? { icon } : {},
|
|
11957
|
+
serverName: readString3(raw.serverName) ?? data.serverName,
|
|
11958
|
+
toolCallId: readString3(raw.toolCallId) ?? data.toolCallId,
|
|
11959
|
+
toolsetId: readString3(raw.toolsetId) ?? data.toolsetId,
|
|
11960
|
+
tool: {
|
|
11961
|
+
...rawTool,
|
|
11962
|
+
name: originalName,
|
|
11963
|
+
title: readLocalizedText(rawTool.title) ?? title,
|
|
11964
|
+
inputSchema: normalizeInputSchema(
|
|
11965
|
+
rawTool.inputSchema ?? raw.inputSchema
|
|
11966
|
+
),
|
|
11967
|
+
...description ? {
|
|
11968
|
+
description: readLocalizedText(rawTool.description) ?? description
|
|
11969
|
+
} : {},
|
|
11970
|
+
...icon ? { icon: readIconDefinition(rawTool.icon) ?? icon } : {}
|
|
11971
|
+
}
|
|
11972
|
+
};
|
|
11973
|
+
}
|
|
11974
|
+
function hasPermissionGrant(value) {
|
|
11975
|
+
return value === true || isRecord5(value);
|
|
11976
|
+
}
|
|
11977
|
+
function buildIframeAllow(permissions) {
|
|
11978
|
+
if (!permissions) return void 0;
|
|
11979
|
+
const policies = [];
|
|
11980
|
+
if (hasPermissionGrant(permissions.camera)) {
|
|
11981
|
+
policies.push("camera *");
|
|
11982
|
+
}
|
|
11983
|
+
if (hasPermissionGrant(permissions.microphone)) {
|
|
11984
|
+
policies.push("microphone *");
|
|
11985
|
+
}
|
|
11986
|
+
if (hasPermissionGrant(permissions.geolocation)) {
|
|
11987
|
+
policies.push("geolocation *");
|
|
11988
|
+
}
|
|
11989
|
+
if (hasPermissionGrant(permissions.clipboardWrite)) {
|
|
11990
|
+
policies.push("clipboard-write *");
|
|
11991
|
+
}
|
|
11992
|
+
return policies.length ? policies.join("; ") : void 0;
|
|
11993
|
+
}
|
|
11994
|
+
function buildSandboxAttribute() {
|
|
11995
|
+
return ["allow-downloads", "allow-forms", "allow-modals", "allow-scripts"].join(
|
|
11996
|
+
" "
|
|
11997
|
+
);
|
|
11998
|
+
}
|
|
11999
|
+
function stringifyToolResult(value) {
|
|
12000
|
+
if (typeof value === "string") return value;
|
|
12001
|
+
try {
|
|
12002
|
+
return JSON.stringify(value ?? null);
|
|
12003
|
+
} catch {
|
|
12004
|
+
return String(value);
|
|
12005
|
+
}
|
|
12006
|
+
}
|
|
12007
|
+
function createTextContentBlock(text) {
|
|
12008
|
+
return {
|
|
12009
|
+
type: "text",
|
|
12010
|
+
text
|
|
12011
|
+
};
|
|
12012
|
+
}
|
|
12013
|
+
function normalizeContentBlocks(value) {
|
|
12014
|
+
if (!Array.isArray(value)) return [];
|
|
12015
|
+
return value.filter(
|
|
12016
|
+
(item) => isRecord5(item) && typeof item.type === "string"
|
|
12017
|
+
);
|
|
12018
|
+
}
|
|
12019
|
+
function extractLegacyArtifactMeta(value) {
|
|
12020
|
+
const meta = readRecord(value._meta);
|
|
12021
|
+
if (meta) return meta;
|
|
12022
|
+
const entries = Object.entries(value).filter(
|
|
12023
|
+
([key]) => key !== "structuredContent" && key !== "isError"
|
|
12024
|
+
);
|
|
12025
|
+
return entries.length ? Object.fromEntries(entries) : void 0;
|
|
12026
|
+
}
|
|
12027
|
+
function normalizeToolArtifact(value) {
|
|
12028
|
+
if (isRecord5(value)) {
|
|
12029
|
+
return {
|
|
12030
|
+
...readRecord(value.structuredContent) ? { structuredContent: readRecord(value.structuredContent) } : {},
|
|
12031
|
+
...readBoolean(value.isError) !== void 0 ? { isError: readBoolean(value.isError) } : {},
|
|
12032
|
+
...extractLegacyArtifactMeta(value) ? { _meta: extractLegacyArtifactMeta(value) } : {}
|
|
12033
|
+
};
|
|
12034
|
+
}
|
|
12035
|
+
if (!Array.isArray(value)) return {};
|
|
12036
|
+
return value.reduce((result, item) => {
|
|
12037
|
+
const normalized = normalizeToolArtifact(item);
|
|
12038
|
+
return {
|
|
12039
|
+
...result,
|
|
12040
|
+
...normalized,
|
|
12041
|
+
_meta: result._meta ?? normalized._meta,
|
|
12042
|
+
structuredContent: result.structuredContent ?? normalized.structuredContent,
|
|
12043
|
+
isError: result.isError ?? normalized.isError
|
|
12044
|
+
};
|
|
12045
|
+
}, {});
|
|
12046
|
+
}
|
|
12047
|
+
function normalizeCallToolResult(value) {
|
|
12048
|
+
if (value === void 0) {
|
|
12049
|
+
return {
|
|
12050
|
+
content: []
|
|
12051
|
+
};
|
|
12052
|
+
}
|
|
12053
|
+
if (isRecord5(value)) {
|
|
12054
|
+
if (value.toolResult !== void 0 && !Array.isArray(value.content)) {
|
|
12055
|
+
return normalizeCallToolResult(value.toolResult);
|
|
12056
|
+
}
|
|
12057
|
+
const content = normalizeContentBlocks(value.content);
|
|
12058
|
+
const result = {
|
|
12059
|
+
content: content.length ? content : []
|
|
12060
|
+
};
|
|
12061
|
+
const structuredContent = readRecord(value.structuredContent);
|
|
12062
|
+
const isError = readBoolean(value.isError);
|
|
12063
|
+
const meta = readRecord(value._meta);
|
|
12064
|
+
if (structuredContent) result.structuredContent = structuredContent;
|
|
12065
|
+
if (isError !== void 0) result.isError = isError;
|
|
12066
|
+
if (meta) result._meta = meta;
|
|
12067
|
+
return result;
|
|
12068
|
+
}
|
|
12069
|
+
if (Array.isArray(value) && value.length >= 2) {
|
|
12070
|
+
const [content, artifact] = value;
|
|
12071
|
+
const artifactFields = normalizeToolArtifact(artifact);
|
|
12072
|
+
return {
|
|
12073
|
+
content: [
|
|
12074
|
+
createTextContentBlock(
|
|
12075
|
+
typeof content === "string" ? content : stringifyToolResult(content)
|
|
12076
|
+
)
|
|
12077
|
+
],
|
|
12078
|
+
...artifactFields
|
|
12079
|
+
};
|
|
12080
|
+
}
|
|
12081
|
+
return {
|
|
12082
|
+
content: [createTextContentBlock(stringifyToolResult(value))]
|
|
12083
|
+
};
|
|
12084
|
+
}
|
|
12085
|
+
function normalizeMcpAppResourceResponse(value, data) {
|
|
12086
|
+
const raw = readRecord(value);
|
|
12087
|
+
if (!raw) {
|
|
12088
|
+
throw new Error("MCP App resource response must be an object");
|
|
12089
|
+
}
|
|
12090
|
+
const html = decodeResourceHtml(raw);
|
|
12091
|
+
if (!html) {
|
|
12092
|
+
throw new Error("MCP App resource did not include HTML content");
|
|
12093
|
+
}
|
|
12094
|
+
const resourceInfo = {
|
|
12095
|
+
title: readLocalizedText(raw.title),
|
|
12096
|
+
description: readLocalizedText(raw.description),
|
|
12097
|
+
icon: readIconDefinition(raw.icon)
|
|
12098
|
+
};
|
|
12099
|
+
const toolInput = readNonEmptyRecord(raw.toolInput) ?? data.toolInput ?? readRecord(raw.toolInput) ?? {};
|
|
12100
|
+
const rawToolResult = raw.toolResult ?? data.toolResult;
|
|
12101
|
+
return {
|
|
12102
|
+
uri: readString3(raw.uri),
|
|
12103
|
+
mimeType: readString3(raw.mimeType),
|
|
12104
|
+
html,
|
|
12105
|
+
resourceUri: readString3(raw.resourceUri),
|
|
12106
|
+
title: resourceInfo.title,
|
|
12107
|
+
description: resourceInfo.description,
|
|
12108
|
+
icon: resourceInfo.icon,
|
|
12109
|
+
csp: normalizeCspMetadata(raw.csp),
|
|
12110
|
+
permissions: normalizePermissionsMetadata(raw.permissions),
|
|
12111
|
+
domain: readString3(raw.domain),
|
|
12112
|
+
prefersBorder: readBoolean(raw.prefersBorder),
|
|
12113
|
+
toolInfo: normalizeMcpAppToolInfo(raw.toolInfo, data, resourceInfo),
|
|
12114
|
+
toolInput,
|
|
12115
|
+
hasToolResult: rawToolResult !== void 0,
|
|
12116
|
+
toolResult: normalizeCallToolResult(rawToolResult),
|
|
12117
|
+
rawToolResult
|
|
12118
|
+
};
|
|
12119
|
+
}
|
|
12120
|
+
function isHttpUrl(value) {
|
|
12121
|
+
try {
|
|
12122
|
+
const url = new URL(value);
|
|
12123
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
12124
|
+
} catch {
|
|
12125
|
+
return false;
|
|
12126
|
+
}
|
|
12127
|
+
}
|
|
12128
|
+
function contentBlocksToText(content) {
|
|
12129
|
+
if (!Array.isArray(content)) return null;
|
|
12130
|
+
const parts = content.map((item) => {
|
|
12131
|
+
if (!isRecord5(item)) return "";
|
|
12132
|
+
if (item.type === "text" && typeof item.text === "string") {
|
|
12133
|
+
return item.text;
|
|
12134
|
+
}
|
|
12135
|
+
if (item.type === "resource_link" && typeof item.uri === "string") {
|
|
12136
|
+
return item.uri;
|
|
12137
|
+
}
|
|
12138
|
+
if (item.type === "image" || item.type === "audio") {
|
|
12139
|
+
return `[${item.type}]`;
|
|
12140
|
+
}
|
|
12141
|
+
return stringifyToolResult(item);
|
|
12142
|
+
}).map((part) => part.trim()).filter(Boolean);
|
|
12143
|
+
return parts.length ? parts.join("\n\n") : null;
|
|
12144
|
+
}
|
|
12145
|
+
function isMcpAppComponentData(data) {
|
|
12146
|
+
return isRecord5(data) && data.type === "McpApp" && typeof data.appInstanceId === "string" && typeof data.resourceUri === "string";
|
|
12147
|
+
}
|
|
12148
|
+
function McpAppMessage({
|
|
12149
|
+
data,
|
|
12150
|
+
className
|
|
12151
|
+
}) {
|
|
12152
|
+
const { i18n: i18n2 } = useChatkitTranslation();
|
|
12153
|
+
const {
|
|
12154
|
+
apiUrl,
|
|
12155
|
+
authenticatedFetch,
|
|
12156
|
+
isLoading: streamIsLoading,
|
|
12157
|
+
submit
|
|
12158
|
+
} = useStreamContext();
|
|
12159
|
+
const iframeRef = React35.useRef(null);
|
|
12160
|
+
const containerRef = React35.useRef(null);
|
|
12161
|
+
const initializedRef = React35.useRef(false);
|
|
12162
|
+
const sentInitialResultRef = React35.useRef(false);
|
|
12163
|
+
const modelContextRef = React35.useRef(null);
|
|
12164
|
+
const [resource, setResource] = React35.useState(null);
|
|
12165
|
+
const [srcDoc, setSrcDoc] = React35.useState(null);
|
|
12166
|
+
const [height, setHeight] = React35.useState(420);
|
|
12167
|
+
const [error, setError] = React35.useState(null);
|
|
12168
|
+
const [isLoading, setIsLoading] = React35.useState(true);
|
|
12169
|
+
const resourceUrl = React35.useMemo(
|
|
12170
|
+
() => buildXpertApiUrl(
|
|
12171
|
+
apiUrl,
|
|
12172
|
+
buildMcpAppEndpointPath(data, "resource")
|
|
12173
|
+
),
|
|
12174
|
+
[apiUrl, data]
|
|
12175
|
+
);
|
|
12176
|
+
const rpcUrl = React35.useMemo(
|
|
12177
|
+
() => buildXpertApiUrl(
|
|
12178
|
+
apiUrl,
|
|
12179
|
+
buildMcpAppEndpointPath(data, "rpc")
|
|
12180
|
+
),
|
|
12181
|
+
[apiUrl, data]
|
|
12182
|
+
);
|
|
12183
|
+
const postToApp = React35.useCallback((message) => {
|
|
12184
|
+
iframeRef.current?.contentWindow?.postMessage(message, "*");
|
|
12185
|
+
}, []);
|
|
12186
|
+
const callHostRpc = React35.useCallback(
|
|
12187
|
+
async (request) => {
|
|
12188
|
+
const response = await authenticatedFetch(rpcUrl, {
|
|
12189
|
+
method: "POST",
|
|
12190
|
+
headers: {
|
|
12191
|
+
"content-type": "application/json"
|
|
12192
|
+
},
|
|
12193
|
+
body: JSON.stringify({
|
|
12194
|
+
jsonrpc: "2.0",
|
|
12195
|
+
id: request.id ?? null,
|
|
12196
|
+
method: request.method,
|
|
12197
|
+
params: request.params
|
|
12198
|
+
})
|
|
12199
|
+
});
|
|
12200
|
+
if (!response.ok) {
|
|
12201
|
+
throw new Error(`MCP App RPC failed with ${response.status}`);
|
|
12202
|
+
}
|
|
12203
|
+
return response.json();
|
|
12204
|
+
},
|
|
12205
|
+
[authenticatedFetch, rpcUrl]
|
|
12206
|
+
);
|
|
12207
|
+
const sendInitialToolNotifications = React35.useCallback(() => {
|
|
12208
|
+
if (!initializedRef.current || sentInitialResultRef.current || !resource) {
|
|
12209
|
+
return;
|
|
12210
|
+
}
|
|
12211
|
+
sentInitialResultRef.current = true;
|
|
12212
|
+
postToApp({
|
|
12213
|
+
jsonrpc: "2.0",
|
|
12214
|
+
method: "ui/notifications/tool-input",
|
|
12215
|
+
params: {
|
|
12216
|
+
arguments: resource.toolInput
|
|
12217
|
+
}
|
|
12218
|
+
});
|
|
12219
|
+
if (!resource.hasToolResult) {
|
|
12220
|
+
return;
|
|
12221
|
+
}
|
|
12222
|
+
postToApp({
|
|
12223
|
+
jsonrpc: "2.0",
|
|
12224
|
+
method: "ui/notifications/tool-result",
|
|
12225
|
+
params: {
|
|
12226
|
+
...resource.toolResult,
|
|
12227
|
+
toolCallId: data.toolCallId,
|
|
12228
|
+
toolName: data.toolName,
|
|
12229
|
+
// Legacy compatibility for apps written before the 2026-01-26 notification shape.
|
|
12230
|
+
result: resource.rawToolResult
|
|
12231
|
+
}
|
|
12232
|
+
});
|
|
12233
|
+
}, [data.toolCallId, data.toolName, postToApp, resource]);
|
|
12234
|
+
React35.useEffect(() => {
|
|
12235
|
+
const controller = new AbortController();
|
|
12236
|
+
initializedRef.current = false;
|
|
12237
|
+
sentInitialResultRef.current = false;
|
|
12238
|
+
setIsLoading(true);
|
|
12239
|
+
setError(null);
|
|
12240
|
+
setResource(null);
|
|
12241
|
+
setSrcDoc(null);
|
|
12242
|
+
void (async () => {
|
|
12243
|
+
try {
|
|
12244
|
+
const response = await authenticatedFetch(resourceUrl, {
|
|
12245
|
+
signal: controller.signal
|
|
12246
|
+
});
|
|
12247
|
+
if (!response.ok) {
|
|
12248
|
+
throw new Error(`MCP App resource failed with ${response.status}`);
|
|
12249
|
+
}
|
|
12250
|
+
const payload = await response.json();
|
|
12251
|
+
const normalizedResource = normalizeMcpAppResourceResponse(
|
|
12252
|
+
payload,
|
|
12253
|
+
data
|
|
12254
|
+
);
|
|
12255
|
+
setResource(normalizedResource);
|
|
12256
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12257
|
+
setSrcDoc(
|
|
12258
|
+
injectMcpAppTheme(
|
|
12259
|
+
injectCsp(
|
|
12260
|
+
injectMcpAppLocale(normalizedResource.html, hostLocale),
|
|
12261
|
+
normalizedResource.csp ?? data.csp
|
|
12262
|
+
),
|
|
12263
|
+
buildMcpAppTheme(containerRef.current)
|
|
12264
|
+
)
|
|
12265
|
+
);
|
|
12266
|
+
} catch (loadError) {
|
|
12267
|
+
if (!controller.signal.aborted) {
|
|
12268
|
+
setError(getErrorMessage(loadError));
|
|
12269
|
+
}
|
|
12270
|
+
} finally {
|
|
12271
|
+
if (!controller.signal.aborted) {
|
|
12272
|
+
setIsLoading(false);
|
|
12273
|
+
}
|
|
12274
|
+
}
|
|
12275
|
+
})();
|
|
12276
|
+
return () => {
|
|
12277
|
+
controller.abort();
|
|
12278
|
+
};
|
|
12279
|
+
}, [
|
|
12280
|
+
authenticatedFetch,
|
|
12281
|
+
data,
|
|
12282
|
+
data.appInstanceId,
|
|
12283
|
+
data.csp,
|
|
12284
|
+
i18n2.language,
|
|
12285
|
+
resourceUrl
|
|
12286
|
+
]);
|
|
12287
|
+
React35.useEffect(() => {
|
|
12288
|
+
sendInitialToolNotifications();
|
|
12289
|
+
}, [sendInitialToolNotifications]);
|
|
12290
|
+
React35.useEffect(() => {
|
|
12291
|
+
const handleMessage = async (event) => {
|
|
12292
|
+
if (event.source !== iframeRef.current?.contentWindow) {
|
|
12293
|
+
return;
|
|
12294
|
+
}
|
|
12295
|
+
const request = normalizeJsonRpcMessage(event.data);
|
|
12296
|
+
if (!request?.method) {
|
|
12297
|
+
return;
|
|
12298
|
+
}
|
|
12299
|
+
if (request.method === "ui/notifications/initialized") {
|
|
12300
|
+
initializedRef.current = true;
|
|
12301
|
+
sendInitialToolNotifications();
|
|
12302
|
+
return;
|
|
12303
|
+
}
|
|
12304
|
+
if (request.method === "ui/notifications/size-changed") {
|
|
12305
|
+
const nextHeight = isRecord5(request.params) && typeof request.params.height === "number" ? request.params.height : null;
|
|
12306
|
+
if (nextHeight !== null) {
|
|
12307
|
+
setHeight(Math.min(900, Math.max(240, Math.round(nextHeight))));
|
|
12308
|
+
}
|
|
12309
|
+
return;
|
|
12310
|
+
}
|
|
12311
|
+
if (request.method === "ui/initialize") {
|
|
12312
|
+
initializedRef.current = true;
|
|
12313
|
+
const permissions = resource?.permissions ?? data.permissions;
|
|
12314
|
+
const csp = resource?.csp ?? data.csp;
|
|
12315
|
+
const toolInfo = resource?.toolInfo ?? normalizeMcpAppToolInfo(void 0, data);
|
|
12316
|
+
const theme = buildMcpAppTheme(containerRef.current);
|
|
12317
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12318
|
+
const hostLanguage = getLocaleLanguage(hostLocale);
|
|
12319
|
+
const hostDirection = getLocaleDirection(hostLocale);
|
|
12320
|
+
postToApp(
|
|
12321
|
+
jsonRpcResult(request.id, {
|
|
12322
|
+
protocolVersion: "2026-01-26",
|
|
12323
|
+
hostInfo: {
|
|
12324
|
+
name: "xpert-chatkit",
|
|
12325
|
+
version: "1.0.0",
|
|
12326
|
+
title: "Xpert ChatKit"
|
|
12327
|
+
},
|
|
12328
|
+
hostCapabilities: {
|
|
12329
|
+
serverTools: {},
|
|
12330
|
+
serverResources: {},
|
|
12331
|
+
openLinks: {},
|
|
12332
|
+
logging: {},
|
|
12333
|
+
message: {
|
|
12334
|
+
text: {}
|
|
12335
|
+
},
|
|
12336
|
+
updateModelContext: {
|
|
12337
|
+
text: {},
|
|
12338
|
+
structuredContent: {}
|
|
12339
|
+
},
|
|
12340
|
+
sandbox: {
|
|
12341
|
+
...permissions ? { permissions } : {},
|
|
12342
|
+
...csp ? { csp } : {}
|
|
12343
|
+
}
|
|
12344
|
+
},
|
|
12345
|
+
hostContext: {
|
|
12346
|
+
toolInfo,
|
|
12347
|
+
theme: theme.mode,
|
|
12348
|
+
themeCssVariables: theme.cssVariables,
|
|
12349
|
+
locale: hostLocale,
|
|
12350
|
+
language: hostLanguage,
|
|
12351
|
+
direction: hostDirection,
|
|
12352
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12353
|
+
displayMode: "inline",
|
|
12354
|
+
availableDisplayModes: ["inline"],
|
|
12355
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12356
|
+
userAgent: "xpert-chatkit",
|
|
12357
|
+
platform: "web",
|
|
12358
|
+
deviceCapabilities: {
|
|
12359
|
+
touch: navigator.maxTouchPoints > 0,
|
|
12360
|
+
hover: window.matchMedia("(hover: hover)").matches
|
|
12361
|
+
}
|
|
12362
|
+
},
|
|
12363
|
+
// Legacy compatibility for apps written before the 2026-01-26 result shape.
|
|
12364
|
+
capabilities: {
|
|
12365
|
+
displayModes: ["inline"],
|
|
12366
|
+
serverTools: true,
|
|
12367
|
+
serverResources: true,
|
|
12368
|
+
openLinks: true
|
|
12369
|
+
},
|
|
12370
|
+
context: {
|
|
12371
|
+
toolInfo,
|
|
12372
|
+
theme: theme.mode,
|
|
12373
|
+
themeCssVariables: theme.cssVariables,
|
|
12374
|
+
locale: hostLocale,
|
|
12375
|
+
language: hostLanguage,
|
|
12376
|
+
direction: hostDirection,
|
|
12377
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12378
|
+
displayMode: "inline",
|
|
12379
|
+
availableDisplayModes: ["inline"],
|
|
12380
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12381
|
+
userAgent: navigator.userAgent,
|
|
12382
|
+
platform: navigator.platform
|
|
12383
|
+
}
|
|
12384
|
+
})
|
|
12385
|
+
);
|
|
12386
|
+
sendInitialToolNotifications();
|
|
12387
|
+
return;
|
|
12388
|
+
}
|
|
12389
|
+
if (request.method === "ui/open-link") {
|
|
12390
|
+
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;
|
|
12391
|
+
if (href && isHttpUrl(href)) {
|
|
12392
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
12393
|
+
if (request.id !== void 0) {
|
|
12394
|
+
postToApp(jsonRpcResult(request.id, {}));
|
|
12395
|
+
}
|
|
12396
|
+
} else if (request.id !== void 0) {
|
|
12397
|
+
postToApp(jsonRpcResult(request.id, { isError: true }));
|
|
12398
|
+
}
|
|
12399
|
+
return;
|
|
12400
|
+
}
|
|
12401
|
+
if (request.method === "ui/update-model-context") {
|
|
12402
|
+
modelContextRef.current = request.params;
|
|
12403
|
+
try {
|
|
12404
|
+
postToApp(await callHostRpc(request));
|
|
12405
|
+
} catch (rpcError) {
|
|
12406
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12407
|
+
}
|
|
12408
|
+
return;
|
|
12409
|
+
}
|
|
12410
|
+
if (request.method === "ui/message") {
|
|
12411
|
+
try {
|
|
12412
|
+
if (!isRecord5(request.params) || request.params.role !== "user" || !Array.isArray(request.params.content)) {
|
|
12413
|
+
throw new Error(
|
|
12414
|
+
'ui/message params must include role "user" and content blocks'
|
|
12415
|
+
);
|
|
12416
|
+
}
|
|
12417
|
+
const hostResponse = await callHostRpc(request);
|
|
12418
|
+
if (isRecord5(hostResponse) && hostResponse.error) {
|
|
12419
|
+
postToApp(hostResponse);
|
|
12420
|
+
return;
|
|
12421
|
+
}
|
|
12422
|
+
const inputText = contentBlocksToText(request.params.content);
|
|
12423
|
+
if (!inputText) {
|
|
12424
|
+
throw new Error("ui/message content did not include text");
|
|
12425
|
+
}
|
|
12426
|
+
await submit(
|
|
12427
|
+
{
|
|
12428
|
+
input: {
|
|
12429
|
+
input: inputText
|
|
12430
|
+
}
|
|
12431
|
+
},
|
|
12432
|
+
{
|
|
12433
|
+
...streamIsLoading ? { followUpMode: "queue" } : {},
|
|
12434
|
+
context: {
|
|
12435
|
+
mcpApp: {
|
|
12436
|
+
appInstanceId: data.appInstanceId,
|
|
12437
|
+
resourceUri: data.resourceUri,
|
|
12438
|
+
toolName: data.toolName,
|
|
12439
|
+
toolCallId: data.toolCallId,
|
|
12440
|
+
modelContext: modelContextRef.current
|
|
12441
|
+
}
|
|
12442
|
+
}
|
|
12443
|
+
}
|
|
12444
|
+
);
|
|
12445
|
+
postToApp(hostResponse);
|
|
12446
|
+
} catch (messageError) {
|
|
12447
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(messageError)));
|
|
12448
|
+
}
|
|
12449
|
+
return;
|
|
12450
|
+
}
|
|
12451
|
+
if (request.id === void 0 && request.method.startsWith("ui/")) {
|
|
12452
|
+
return;
|
|
12453
|
+
}
|
|
12454
|
+
try {
|
|
12455
|
+
postToApp(await callHostRpc(request));
|
|
12456
|
+
} catch (rpcError) {
|
|
12457
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12458
|
+
}
|
|
12459
|
+
};
|
|
12460
|
+
window.addEventListener("message", handleMessage);
|
|
12461
|
+
return () => {
|
|
12462
|
+
window.removeEventListener("message", handleMessage);
|
|
12463
|
+
};
|
|
12464
|
+
}, [
|
|
12465
|
+
callHostRpc,
|
|
12466
|
+
data.appInstanceId,
|
|
12467
|
+
data.csp,
|
|
12468
|
+
data.permissions,
|
|
12469
|
+
data.resourceUri,
|
|
12470
|
+
data.title,
|
|
12471
|
+
data.toolCallId,
|
|
12472
|
+
data.toolName,
|
|
12473
|
+
i18n2.language,
|
|
12474
|
+
postToApp,
|
|
12475
|
+
resource?.csp,
|
|
12476
|
+
resource?.permissions,
|
|
12477
|
+
resource?.toolInfo,
|
|
12478
|
+
sendInitialToolNotifications,
|
|
12479
|
+
streamIsLoading,
|
|
12480
|
+
submit
|
|
12481
|
+
]);
|
|
12482
|
+
const iframePermissions = resource?.permissions ?? data.permissions;
|
|
12483
|
+
const iframeAllow = React35.useMemo(
|
|
12484
|
+
() => buildIframeAllow(iframePermissions),
|
|
12485
|
+
[iframePermissions]
|
|
12486
|
+
);
|
|
12487
|
+
const sandbox = React35.useMemo(() => buildSandboxAttribute(), []);
|
|
12488
|
+
const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
|
|
12489
|
+
const displayTitle = (0, import_chatkit_types9.resolveLocalizedText)(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
|
|
12490
|
+
const displayDescription = (0, import_chatkit_types9.resolveLocalizedText)(
|
|
12491
|
+
resource?.description ?? data.description,
|
|
12492
|
+
i18n2.language
|
|
12493
|
+
);
|
|
12494
|
+
const displayIcon = resource?.icon ?? data.icon;
|
|
12495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
12496
|
+
"div",
|
|
12497
|
+
{
|
|
12498
|
+
ref: containerRef,
|
|
12499
|
+
className: cn(
|
|
12500
|
+
"overflow-hidden rounded-lg border bg-background shadow-sm",
|
|
12501
|
+
!prefersBorder && "border-transparent shadow-none",
|
|
12502
|
+
className
|
|
12503
|
+
),
|
|
12504
|
+
children: [
|
|
12505
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
|
|
12506
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
12507
|
+
displayIcon ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
12508
|
+
IconDefinitionRenderer,
|
|
12509
|
+
{
|
|
12510
|
+
icon: displayIcon,
|
|
12511
|
+
size: 18,
|
|
12512
|
+
className: "shrink-0",
|
|
12513
|
+
decorative: true
|
|
12514
|
+
}
|
|
12515
|
+
) : null,
|
|
12516
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "min-w-0", children: [
|
|
12517
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "truncate text-sm font-medium", children: displayTitle }),
|
|
12518
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
|
|
12519
|
+
] })
|
|
12520
|
+
] }),
|
|
12521
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
|
|
12522
|
+
] }),
|
|
12523
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
12524
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react23.Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
12525
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: i18n2.t("message.mcpApp.loading") })
|
|
12526
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
|
|
12527
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react23.AlertCircle, { className: "h-4 w-4 shrink-0" }),
|
|
12528
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "min-w-0 break-words", children: error })
|
|
12529
|
+
] }) : srcDoc ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
12530
|
+
"iframe",
|
|
12531
|
+
{
|
|
12532
|
+
ref: iframeRef,
|
|
12533
|
+
title: displayTitle,
|
|
12534
|
+
srcDoc,
|
|
12535
|
+
className: "block w-full bg-background",
|
|
12536
|
+
style: { height },
|
|
12537
|
+
sandbox,
|
|
12538
|
+
allow: iframeAllow,
|
|
12539
|
+
referrerPolicy: "no-referrer"
|
|
12540
|
+
}
|
|
12541
|
+
) : null
|
|
12542
|
+
]
|
|
12543
|
+
}
|
|
12544
|
+
);
|
|
12545
|
+
}
|
|
12546
|
+
|
|
12547
|
+
// src/components/thread/messages/ai.tsx
|
|
12548
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
11568
12549
|
var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
|
|
11569
12550
|
function isTextContent3(content) {
|
|
11570
12551
|
return content.type === "text";
|
|
@@ -11582,6 +12563,9 @@ function isWidgetComponent2(content) {
|
|
|
11582
12563
|
const data = content.data;
|
|
11583
12564
|
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
11584
12565
|
}
|
|
12566
|
+
function isMcpAppComponent(content) {
|
|
12567
|
+
return isMcpAppComponentData(content.data);
|
|
12568
|
+
}
|
|
11585
12569
|
function isMemoryContent(content) {
|
|
11586
12570
|
return content.type === "memory";
|
|
11587
12571
|
}
|
|
@@ -11600,11 +12584,11 @@ function ReasoningBlock({
|
|
|
11600
12584
|
}) {
|
|
11601
12585
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
11602
12586
|
if (blocks.length === 0) return null;
|
|
11603
|
-
return /* @__PURE__ */ (0,
|
|
12587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11604
12588
|
"div",
|
|
11605
12589
|
{
|
|
11606
12590
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
11607
|
-
children: /* @__PURE__ */ (0,
|
|
12591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
11608
12592
|
},
|
|
11609
12593
|
item.id ?? `reasoning-${index}`
|
|
11610
12594
|
)) });
|
|
@@ -11612,12 +12596,12 @@ function ReasoningBlock({
|
|
|
11612
12596
|
function ImageBlock({ content }) {
|
|
11613
12597
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
11614
12598
|
if (!imageUrl) {
|
|
11615
|
-
return /* @__PURE__ */ (0,
|
|
11616
|
-
/* @__PURE__ */ (0,
|
|
11617
|
-
/* @__PURE__ */ (0,
|
|
12599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12600
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
12601
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: safeJson3(content) })
|
|
11618
12602
|
] });
|
|
11619
12603
|
}
|
|
11620
|
-
return /* @__PURE__ */ (0,
|
|
12604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11621
12605
|
"img",
|
|
11622
12606
|
{
|
|
11623
12607
|
src: imageUrl,
|
|
@@ -11627,12 +12611,12 @@ function ImageBlock({ content }) {
|
|
|
11627
12611
|
) });
|
|
11628
12612
|
}
|
|
11629
12613
|
function MemoryBlock({ content }) {
|
|
11630
|
-
return /* @__PURE__ */ (0,
|
|
11631
|
-
/* @__PURE__ */ (0,
|
|
11632
|
-
/* @__PURE__ */ (0,
|
|
11633
|
-
/* @__PURE__ */ (0,
|
|
12614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12615
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12616
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
12617
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Badge, { variant: "secondary", children: "Memory" })
|
|
11634
12618
|
] }),
|
|
11635
|
-
/* @__PURE__ */ (0,
|
|
12619
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson3(content.data ?? []) }) })
|
|
11636
12620
|
] });
|
|
11637
12621
|
}
|
|
11638
12622
|
function parseStepDate2(value) {
|
|
@@ -11666,11 +12650,11 @@ function formatStepDuration3(durationMs) {
|
|
|
11666
12650
|
}
|
|
11667
12651
|
function ComponentBlock({ content }) {
|
|
11668
12652
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
11669
|
-
const [isExpanded, setIsExpanded] =
|
|
11670
|
-
const contentRef =
|
|
11671
|
-
const shouldAutoScrollRef =
|
|
11672
|
-
const previousScrollTopRef =
|
|
11673
|
-
const [durationNow, setDurationNow] =
|
|
12653
|
+
const [isExpanded, setIsExpanded] = React36.useState(false);
|
|
12654
|
+
const contentRef = React36.useRef(null);
|
|
12655
|
+
const shouldAutoScrollRef = React36.useRef(true);
|
|
12656
|
+
const previousScrollTopRef = React36.useRef(0);
|
|
12657
|
+
const [durationNow, setDurationNow] = React36.useState(() => Date.now());
|
|
11674
12658
|
const data = getToolStepData(content);
|
|
11675
12659
|
const category = data.category ?? "Component";
|
|
11676
12660
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -11684,10 +12668,10 @@ function ComponentBlock({ content }) {
|
|
|
11684
12668
|
const endedAt = parseStepDate2(data.end_date);
|
|
11685
12669
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
11686
12670
|
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
11687
|
-
|
|
12671
|
+
React36.useEffect(() => {
|
|
11688
12672
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
11689
12673
|
}, [status, output]);
|
|
11690
|
-
|
|
12674
|
+
React36.useEffect(() => {
|
|
11691
12675
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
11692
12676
|
return;
|
|
11693
12677
|
}
|
|
@@ -11699,7 +12683,7 @@ function ComponentBlock({ content }) {
|
|
|
11699
12683
|
window.clearInterval(timer);
|
|
11700
12684
|
};
|
|
11701
12685
|
}, [createdAt, endedAt, status]);
|
|
11702
|
-
|
|
12686
|
+
React36.useEffect(() => {
|
|
11703
12687
|
const element = contentRef.current;
|
|
11704
12688
|
if (!element) return;
|
|
11705
12689
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -11721,7 +12705,7 @@ function ComponentBlock({ content }) {
|
|
|
11721
12705
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
11722
12706
|
};
|
|
11723
12707
|
}, [isExpanded]);
|
|
11724
|
-
|
|
12708
|
+
React36.useEffect(() => {
|
|
11725
12709
|
if (status !== "running") {
|
|
11726
12710
|
shouldAutoScrollRef.current = true;
|
|
11727
12711
|
return;
|
|
@@ -11734,15 +12718,15 @@ function ComponentBlock({ content }) {
|
|
|
11734
12718
|
}, [isExpanded, output, status]);
|
|
11735
12719
|
const config = status ? toolStatusConfig[status] : null;
|
|
11736
12720
|
const StatusIcon = config?.icon;
|
|
11737
|
-
return /* @__PURE__ */ (0,
|
|
11738
|
-
/* @__PURE__ */ (0,
|
|
12721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12722
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11739
12723
|
CardHeader,
|
|
11740
12724
|
{
|
|
11741
12725
|
className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer",
|
|
11742
12726
|
onClick: () => setIsExpanded(!isExpanded),
|
|
11743
12727
|
children: [
|
|
11744
|
-
/* @__PURE__ */ (0,
|
|
11745
|
-
status && StatusIcon && /* @__PURE__ */ (0,
|
|
12728
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
12729
|
+
status && StatusIcon && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11746
12730
|
StatusIcon,
|
|
11747
12731
|
{
|
|
11748
12732
|
className: cn(
|
|
@@ -11752,21 +12736,21 @@ function ComponentBlock({ content }) {
|
|
|
11752
12736
|
)
|
|
11753
12737
|
}
|
|
11754
12738
|
),
|
|
11755
|
-
/* @__PURE__ */ (0,
|
|
12739
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm truncate", children: title })
|
|
11756
12740
|
] }),
|
|
11757
|
-
/* @__PURE__ */ (0,
|
|
11758
|
-
durationLabel && /* @__PURE__ */ (0,
|
|
11759
|
-
/* @__PURE__ */ (0,
|
|
11760
|
-
/* @__PURE__ */ (0,
|
|
12741
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
12742
|
+
durationLabel && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
|
|
12743
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react24.Clock3, { className: "h-3 w-3" }),
|
|
12744
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: durationLabel })
|
|
11761
12745
|
] }),
|
|
11762
|
-
/* @__PURE__ */ (0,
|
|
11763
|
-
/* @__PURE__ */ (0,
|
|
12746
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
12747
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11764
12748
|
"button",
|
|
11765
12749
|
{
|
|
11766
12750
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
11767
12751
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
11768
|
-
children: /* @__PURE__ */ (0,
|
|
11769
|
-
|
|
12752
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
12753
|
+
import_lucide_react24.ChevronDown,
|
|
11770
12754
|
{
|
|
11771
12755
|
className: cn(
|
|
11772
12756
|
"h-4 w-4 transition-transform",
|
|
@@ -11780,53 +12764,53 @@ function ComponentBlock({ content }) {
|
|
|
11780
12764
|
]
|
|
11781
12765
|
}
|
|
11782
12766
|
),
|
|
11783
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
12767
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11784
12768
|
CardContent,
|
|
11785
12769
|
{
|
|
11786
12770
|
ref: contentRef,
|
|
11787
12771
|
className: "text-xs text-muted-foreground max-h-60 overflow-auto",
|
|
11788
12772
|
children: [
|
|
11789
|
-
data.input && /* @__PURE__ */ (0,
|
|
11790
|
-
error ? /* @__PURE__ */ (0,
|
|
12773
|
+
data.input && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(data.input) }),
|
|
12774
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue3(error) }) : hasOutput && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(fallback) })
|
|
11791
12775
|
]
|
|
11792
12776
|
}
|
|
11793
12777
|
)
|
|
11794
12778
|
] });
|
|
11795
12779
|
}
|
|
11796
12780
|
function UnknownBlock({ content }) {
|
|
11797
|
-
return /* @__PURE__ */ (0,
|
|
11798
|
-
/* @__PURE__ */ (0,
|
|
11799
|
-
/* @__PURE__ */ (0,
|
|
11800
|
-
/* @__PURE__ */ (0,
|
|
12781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { children: [
|
|
12782
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12783
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
12784
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
11801
12785
|
] }),
|
|
11802
|
-
/* @__PURE__ */ (0,
|
|
12786
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
|
|
11803
12787
|
] });
|
|
11804
12788
|
}
|
|
11805
12789
|
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
11806
12790
|
const messageId = message.id;
|
|
11807
12791
|
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
11808
12792
|
if (typeof content === "string") {
|
|
11809
|
-
return /* @__PURE__ */ (0,
|
|
12793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarkdownText, { children: content }) }, `text-${index}`);
|
|
11810
12794
|
}
|
|
11811
12795
|
if (isThreadContextUsageRenderArtifact(content)) {
|
|
11812
12796
|
return null;
|
|
11813
12797
|
}
|
|
11814
12798
|
if (isTextContent3(content)) {
|
|
11815
|
-
return /* @__PURE__ */ (0,
|
|
12799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: textClassName, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
11816
12800
|
}
|
|
11817
12801
|
if (isReasoningContent3(content)) {
|
|
11818
|
-
return /* @__PURE__ */ (0,
|
|
12802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
11819
12803
|
}
|
|
11820
12804
|
if (isImageContent(content)) {
|
|
11821
|
-
return /* @__PURE__ */ (0,
|
|
12805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
11822
12806
|
}
|
|
11823
12807
|
if (isComponentContent3(content)) {
|
|
11824
12808
|
if (isContextCompressionComponent(content)) {
|
|
11825
|
-
return /* @__PURE__ */ (0,
|
|
12809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11826
12810
|
"div",
|
|
11827
12811
|
{
|
|
11828
12812
|
className: "w-full",
|
|
11829
|
-
children: /* @__PURE__ */ (0,
|
|
12813
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ContextCompressionMessage, { content })
|
|
11830
12814
|
},
|
|
11831
12815
|
content.id ?? `context-compression-${index}`
|
|
11832
12816
|
);
|
|
@@ -11836,13 +12820,16 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11836
12820
|
lookupMessages
|
|
11837
12821
|
);
|
|
11838
12822
|
if (requestUserInputResult) {
|
|
11839
|
-
return /* @__PURE__ */ (0,
|
|
12823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
|
|
11840
12824
|
}
|
|
11841
12825
|
if (isWidgetComponent2(content)) {
|
|
11842
|
-
return /* @__PURE__ */ (0,
|
|
12826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
12827
|
+
}
|
|
12828
|
+
if (isMcpAppComponent(content)) {
|
|
12829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(McpAppMessage, { data: content.data }) }, content.id ?? `mcp-app-${index}`);
|
|
11843
12830
|
}
|
|
11844
12831
|
if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
|
|
11845
|
-
return /* @__PURE__ */ (0,
|
|
12832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11846
12833
|
ToolComponentGroup,
|
|
11847
12834
|
{
|
|
11848
12835
|
items: [content],
|
|
@@ -11853,15 +12840,15 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11853
12840
|
}
|
|
11854
12841
|
) }, content.id ?? `component-group-${index}`);
|
|
11855
12842
|
}
|
|
11856
|
-
return /* @__PURE__ */ (0,
|
|
12843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
11857
12844
|
}
|
|
11858
12845
|
if (isMemoryContent(content)) {
|
|
11859
|
-
return /* @__PURE__ */ (0,
|
|
12846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
11860
12847
|
}
|
|
11861
12848
|
if (isAgentEventContent(content)) {
|
|
11862
|
-
return /* @__PURE__ */ (0,
|
|
12849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
|
|
11863
12850
|
}
|
|
11864
|
-
return /* @__PURE__ */ (0,
|
|
12851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
11865
12852
|
}
|
|
11866
12853
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
11867
12854
|
if (unit.type === "item") {
|
|
@@ -11872,7 +12859,7 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
|
|
|
11872
12859
|
isAgentOutput: options?.isAgentOutput
|
|
11873
12860
|
});
|
|
11874
12861
|
}
|
|
11875
|
-
return /* @__PURE__ */ (0,
|
|
12862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11876
12863
|
ToolComponentGroup,
|
|
11877
12864
|
{
|
|
11878
12865
|
items: unit.items,
|
|
@@ -11888,7 +12875,7 @@ function renderEntryBatch(entries, message, lookupMessages, hasFollowingItem, op
|
|
|
11888
12875
|
const renderUnits = buildToolComponentRenderUnits(
|
|
11889
12876
|
entries.map((entry) => entry.item),
|
|
11890
12877
|
{
|
|
11891
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12878
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
11892
12879
|
}
|
|
11893
12880
|
);
|
|
11894
12881
|
return renderUnits.map(
|
|
@@ -11909,7 +12896,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
11909
12896
|
const batch = entryBatch;
|
|
11910
12897
|
entryBatch = [];
|
|
11911
12898
|
rendered.push(
|
|
11912
|
-
/* @__PURE__ */ (0,
|
|
12899
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(React36.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
|
|
11913
12900
|
...options,
|
|
11914
12901
|
isAgentOutput: depth > 0
|
|
11915
12902
|
}) }, `entries-${batch[0]?.order ?? rendered.length}`)
|
|
@@ -11926,7 +12913,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
11926
12913
|
}
|
|
11927
12914
|
flushEntries(true);
|
|
11928
12915
|
rendered.push(
|
|
11929
|
-
/* @__PURE__ */ (0,
|
|
12916
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11930
12917
|
AgentRunGroup,
|
|
11931
12918
|
{
|
|
11932
12919
|
node: unit.node,
|
|
@@ -11951,7 +12938,7 @@ function renderContent(message, lookupMessages, options) {
|
|
|
11951
12938
|
message
|
|
11952
12939
|
);
|
|
11953
12940
|
if (renderTree.hasAgentRuns) {
|
|
11954
|
-
return /* @__PURE__ */ (0,
|
|
12941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
|
|
11955
12942
|
renderTree.units,
|
|
11956
12943
|
message,
|
|
11957
12944
|
lookupMessages,
|
|
@@ -11961,13 +12948,13 @@ function renderContent(message, lookupMessages, options) {
|
|
|
11961
12948
|
const content = message.content;
|
|
11962
12949
|
if (typeof content === "string") {
|
|
11963
12950
|
if (!content.trim()) return null;
|
|
11964
|
-
return /* @__PURE__ */ (0,
|
|
12951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarkdownText, { children: content });
|
|
11965
12952
|
}
|
|
11966
12953
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
11967
12954
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
11968
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12955
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
11969
12956
|
});
|
|
11970
|
-
return /* @__PURE__ */ (0,
|
|
12957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "space-y-3", children: renderUnits.map(
|
|
11971
12958
|
(unit, index) => renderContentUnit(
|
|
11972
12959
|
unit,
|
|
11973
12960
|
message,
|
|
@@ -11987,7 +12974,7 @@ function AssistantStreamingIndicator({
|
|
|
11987
12974
|
thinking: t("message.thinking"),
|
|
11988
12975
|
answering: t("message.answering")
|
|
11989
12976
|
};
|
|
11990
|
-
return /* @__PURE__ */ (0,
|
|
12977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11991
12978
|
"div",
|
|
11992
12979
|
{
|
|
11993
12980
|
className: cn(
|
|
@@ -11995,18 +12982,18 @@ function AssistantStreamingIndicator({
|
|
|
11995
12982
|
className
|
|
11996
12983
|
),
|
|
11997
12984
|
children: [
|
|
11998
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
11999
|
-
status === "thinking" && /* @__PURE__ */ (0,
|
|
12000
|
-
/* @__PURE__ */ (0,
|
|
12001
|
-
/* @__PURE__ */ (0,
|
|
12002
|
-
/* @__PURE__ */ (0,
|
|
12985
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react24.Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
12986
|
+
status === "thinking" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
12987
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
12988
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
12989
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
12003
12990
|
] }),
|
|
12004
|
-
status === "answering" && /* @__PURE__ */ (0,
|
|
12005
|
-
/* @__PURE__ */ (0,
|
|
12006
|
-
/* @__PURE__ */ (0,
|
|
12007
|
-
/* @__PURE__ */ (0,
|
|
12991
|
+
status === "answering" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
12992
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
12993
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
12994
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
12008
12995
|
] }),
|
|
12009
|
-
/* @__PURE__ */ (0,
|
|
12996
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: labelMap[status] })
|
|
12010
12997
|
]
|
|
12011
12998
|
}
|
|
12012
12999
|
);
|
|
@@ -12035,42 +13022,42 @@ function AssistantMessage({
|
|
|
12035
13022
|
organizationId,
|
|
12036
13023
|
apiUrl
|
|
12037
13024
|
});
|
|
12038
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0,
|
|
13025
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
12039
13026
|
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
12040
13027
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
12041
13028
|
if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
|
|
12042
|
-
return /* @__PURE__ */ (0,
|
|
13029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
12043
13030
|
}
|
|
12044
13031
|
if (hasContent && hasReasoning) {
|
|
12045
|
-
return /* @__PURE__ */ (0,
|
|
12046
|
-
/* @__PURE__ */ (0,
|
|
13032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
13033
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
12047
13034
|
Tabs,
|
|
12048
13035
|
{
|
|
12049
13036
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
12050
13037
|
className: "w-full",
|
|
12051
13038
|
children: [
|
|
12052
|
-
/* @__PURE__ */ (0,
|
|
12053
|
-
/* @__PURE__ */ (0,
|
|
12054
|
-
/* @__PURE__ */ (0,
|
|
13039
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(TabsList, { className: "", children: [
|
|
13040
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
13041
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
12055
13042
|
] }),
|
|
12056
|
-
/* @__PURE__ */ (0,
|
|
12057
|
-
/* @__PURE__ */ (0,
|
|
13043
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
13044
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
12058
13045
|
]
|
|
12059
13046
|
}
|
|
12060
13047
|
),
|
|
12061
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
13048
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12062
13049
|
] });
|
|
12063
13050
|
}
|
|
12064
|
-
return /* @__PURE__ */ (0,
|
|
13051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12065
13052
|
hasReasoning ? reasoningNode : answerNode,
|
|
12066
|
-
resolvedStreamingStatus ? /* @__PURE__ */ (0,
|
|
13053
|
+
resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12067
13054
|
] });
|
|
12068
13055
|
}
|
|
12069
13056
|
|
|
12070
13057
|
// src/components/thread/MessageActions.tsx
|
|
12071
|
-
var
|
|
12072
|
-
var
|
|
12073
|
-
var
|
|
13058
|
+
var React37 = __toESM(require("react"), 1);
|
|
13059
|
+
var import_lucide_react25 = require("lucide-react");
|
|
13060
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
12074
13061
|
function MessageActions({
|
|
12075
13062
|
content,
|
|
12076
13063
|
isAssistant = false,
|
|
@@ -12079,7 +13066,7 @@ function MessageActions({
|
|
|
12079
13066
|
className
|
|
12080
13067
|
}) {
|
|
12081
13068
|
const { t } = useChatkitTranslation();
|
|
12082
|
-
const [copied, setCopied] =
|
|
13069
|
+
const [copied, setCopied] = React37.useState(false);
|
|
12083
13070
|
const handleCopy = async () => {
|
|
12084
13071
|
try {
|
|
12085
13072
|
await navigator.clipboard.writeText(content);
|
|
@@ -12092,7 +13079,7 @@ function MessageActions({
|
|
|
12092
13079
|
if (isStreaming) {
|
|
12093
13080
|
return null;
|
|
12094
13081
|
}
|
|
12095
|
-
return /* @__PURE__ */ (0,
|
|
13082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
12096
13083
|
"div",
|
|
12097
13084
|
{
|
|
12098
13085
|
className: cn(
|
|
@@ -12100,7 +13087,7 @@ function MessageActions({
|
|
|
12100
13087
|
className
|
|
12101
13088
|
),
|
|
12102
13089
|
children: [
|
|
12103
|
-
/* @__PURE__ */ (0,
|
|
13090
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12104
13091
|
"button",
|
|
12105
13092
|
{
|
|
12106
13093
|
type: "button",
|
|
@@ -12110,17 +13097,17 @@ function MessageActions({
|
|
|
12110
13097
|
copied && "text-green-500"
|
|
12111
13098
|
),
|
|
12112
13099
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
12113
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
13100
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react25.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react25.Copy, { size: 14 })
|
|
12114
13101
|
}
|
|
12115
13102
|
),
|
|
12116
|
-
isAssistant && onRetry && /* @__PURE__ */ (0,
|
|
13103
|
+
isAssistant && onRetry && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12117
13104
|
"button",
|
|
12118
13105
|
{
|
|
12119
13106
|
type: "button",
|
|
12120
13107
|
onClick: onRetry,
|
|
12121
13108
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
12122
13109
|
title: t("messageActions.regenerate"),
|
|
12123
|
-
children: /* @__PURE__ */ (0,
|
|
13110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react25.RefreshCw, { size: 14 })
|
|
12124
13111
|
}
|
|
12125
13112
|
)
|
|
12126
13113
|
]
|
|
@@ -12129,20 +13116,20 @@ function MessageActions({
|
|
|
12129
13116
|
}
|
|
12130
13117
|
|
|
12131
13118
|
// src/components/thread/StartScreen.tsx
|
|
12132
|
-
var
|
|
12133
|
-
var
|
|
12134
|
-
var
|
|
13119
|
+
var React38 = require("react");
|
|
13120
|
+
var import_lucide_react26 = require("lucide-react");
|
|
13121
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
12135
13122
|
function getIconComponent2(icon) {
|
|
12136
13123
|
const iconMap = {
|
|
12137
|
-
"circle-question": /* @__PURE__ */ (0,
|
|
12138
|
-
"lightbulb": /* @__PURE__ */ (0,
|
|
12139
|
-
"sparkle": /* @__PURE__ */ (0,
|
|
12140
|
-
"write": /* @__PURE__ */ (0,
|
|
12141
|
-
"search": /* @__PURE__ */ (0,
|
|
12142
|
-
"globe": /* @__PURE__ */ (0,
|
|
12143
|
-
"book-open": /* @__PURE__ */ (0,
|
|
12144
|
-
"compass": /* @__PURE__ */ (0,
|
|
12145
|
-
"bolt": /* @__PURE__ */ (0,
|
|
13124
|
+
"circle-question": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.HelpCircle, { size: 20 }),
|
|
13125
|
+
"lightbulb": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Lightbulb, { size: 20 }),
|
|
13126
|
+
"sparkle": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Sparkles, { size: 20 }),
|
|
13127
|
+
"write": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Pencil, { size: 20 }),
|
|
13128
|
+
"search": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Search, { size: 20 }),
|
|
13129
|
+
"globe": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Globe, { size: 20 }),
|
|
13130
|
+
"book-open": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.BookOpen, { size: 20 }),
|
|
13131
|
+
"compass": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Compass, { size: 20 }),
|
|
13132
|
+
"bolt": /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Zap, { size: 20 })
|
|
12146
13133
|
};
|
|
12147
13134
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
12148
13135
|
}
|
|
@@ -12158,7 +13145,7 @@ function StartScreen({
|
|
|
12158
13145
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
12159
13146
|
const prompts = startScreen?.prompts ?? [];
|
|
12160
13147
|
const editPromptLabel = t("startScreen.editPrompt");
|
|
12161
|
-
return /* @__PURE__ */ (0,
|
|
13148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12162
13149
|
"div",
|
|
12163
13150
|
{
|
|
12164
13151
|
className: cn(
|
|
@@ -12166,8 +13153,8 @@ function StartScreen({
|
|
|
12166
13153
|
className
|
|
12167
13154
|
),
|
|
12168
13155
|
children: [
|
|
12169
|
-
/* @__PURE__ */ (0,
|
|
12170
|
-
prompts.length > 0 && /* @__PURE__ */ (0,
|
|
13156
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "mb-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
13157
|
+
prompts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12171
13158
|
"div",
|
|
12172
13159
|
{
|
|
12173
13160
|
className: cn(
|
|
@@ -12176,7 +13163,7 @@ function StartScreen({
|
|
|
12176
13163
|
"focus-within:ring-2 focus-within:ring-primary/20"
|
|
12177
13164
|
),
|
|
12178
13165
|
children: [
|
|
12179
|
-
/* @__PURE__ */ (0,
|
|
13166
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12180
13167
|
"button",
|
|
12181
13168
|
{
|
|
12182
13169
|
type: "button",
|
|
@@ -12187,12 +13174,12 @@ function StartScreen({
|
|
|
12187
13174
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
12188
13175
|
),
|
|
12189
13176
|
children: [
|
|
12190
|
-
/* @__PURE__ */ (0,
|
|
12191
|
-
/* @__PURE__ */ (0,
|
|
13177
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
|
|
13178
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
12192
13179
|
]
|
|
12193
13180
|
}
|
|
12194
13181
|
),
|
|
12195
|
-
/* @__PURE__ */ (0,
|
|
13182
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
12196
13183
|
"button",
|
|
12197
13184
|
{
|
|
12198
13185
|
type: "button",
|
|
@@ -12205,7 +13192,7 @@ function StartScreen({
|
|
|
12205
13192
|
"rounded-r-xl transition-colors hover:bg-muted hover:text-foreground",
|
|
12206
13193
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
12207
13194
|
),
|
|
12208
|
-
children: /* @__PURE__ */ (0,
|
|
13195
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react26.Pencil, { size: 16 })
|
|
12209
13196
|
}
|
|
12210
13197
|
)
|
|
12211
13198
|
]
|
|
@@ -12218,7 +13205,7 @@ function StartScreen({
|
|
|
12218
13205
|
}
|
|
12219
13206
|
|
|
12220
13207
|
// src/hooks/useThreads.ts
|
|
12221
|
-
var
|
|
13208
|
+
var React39 = __toESM(require("react"), 1);
|
|
12222
13209
|
var DEFAULT_LIMIT = 50;
|
|
12223
13210
|
var getThreadTitle = (threadRecord) => {
|
|
12224
13211
|
const title = threadRecord.title?.trim();
|
|
@@ -12233,7 +13220,7 @@ var toDate = (value) => {
|
|
|
12233
13220
|
if (Number.isNaN(timestamp)) return void 0;
|
|
12234
13221
|
return new Date(timestamp);
|
|
12235
13222
|
};
|
|
12236
|
-
var
|
|
13223
|
+
var getErrorMessage2 = (error) => {
|
|
12237
13224
|
if (!error) return void 0;
|
|
12238
13225
|
if (error instanceof Error) return error.message;
|
|
12239
13226
|
if (typeof error === "string") return error;
|
|
@@ -12271,16 +13258,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12271
13258
|
isLoading: isStreamLoading,
|
|
12272
13259
|
error: streamError
|
|
12273
13260
|
} = useStreamContext();
|
|
12274
|
-
const [threadRecords, setThreadRecords] =
|
|
12275
|
-
const [isLoading, setIsLoading] =
|
|
12276
|
-
const [error, setError] =
|
|
12277
|
-
const upsertThreadRecord =
|
|
13261
|
+
const [threadRecords, setThreadRecords] = React39.useState([]);
|
|
13262
|
+
const [isLoading, setIsLoading] = React39.useState(false);
|
|
13263
|
+
const [error, setError] = React39.useState(null);
|
|
13264
|
+
const upsertThreadRecord = React39.useCallback((threadRecord) => {
|
|
12278
13265
|
setThreadRecords((prev) => {
|
|
12279
13266
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
12280
13267
|
return sortThreadRecords([threadRecord, ...next]);
|
|
12281
13268
|
});
|
|
12282
13269
|
}, []);
|
|
12283
|
-
const refreshThreads =
|
|
13270
|
+
const refreshThreads = React39.useCallback(async () => {
|
|
12284
13271
|
setIsLoading(true);
|
|
12285
13272
|
setError(null);
|
|
12286
13273
|
try {
|
|
@@ -12296,7 +13283,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12296
13283
|
setIsLoading(false);
|
|
12297
13284
|
}
|
|
12298
13285
|
}, [client, limit, assistantId]);
|
|
12299
|
-
const createThread =
|
|
13286
|
+
const createThread = React39.useCallback(
|
|
12300
13287
|
async (input) => {
|
|
12301
13288
|
setError(null);
|
|
12302
13289
|
const payload = {};
|
|
@@ -12310,7 +13297,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12310
13297
|
},
|
|
12311
13298
|
[client, upsertThreadRecord]
|
|
12312
13299
|
);
|
|
12313
|
-
const updateThread =
|
|
13300
|
+
const updateThread = React39.useCallback(
|
|
12314
13301
|
async (recordId, payload) => {
|
|
12315
13302
|
setError(null);
|
|
12316
13303
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -12319,7 +13306,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12319
13306
|
},
|
|
12320
13307
|
[client, upsertThreadRecord]
|
|
12321
13308
|
);
|
|
12322
|
-
const deleteThread =
|
|
13309
|
+
const deleteThread = React39.useCallback(
|
|
12323
13310
|
async (recordId) => {
|
|
12324
13311
|
setError(null);
|
|
12325
13312
|
await client.conversations.delete(recordId);
|
|
@@ -12327,11 +13314,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12327
13314
|
},
|
|
12328
13315
|
[client]
|
|
12329
13316
|
);
|
|
12330
|
-
|
|
13317
|
+
React39.useEffect(() => {
|
|
12331
13318
|
if (!isReady) return;
|
|
12332
13319
|
void refreshThreads();
|
|
12333
13320
|
}, [refreshThreads, isReady]);
|
|
12334
|
-
|
|
13321
|
+
React39.useEffect(() => {
|
|
12335
13322
|
if (!threadId || !isStreamLoading) return;
|
|
12336
13323
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12337
13324
|
const busyStatus = "busy";
|
|
@@ -12352,8 +13339,8 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12352
13339
|
return changed ? sortThreadRecords(next) : prev;
|
|
12353
13340
|
});
|
|
12354
13341
|
}, [threadId, isStreamLoading]);
|
|
12355
|
-
|
|
12356
|
-
const message =
|
|
13342
|
+
React39.useEffect(() => {
|
|
13343
|
+
const message = getErrorMessage2(streamError)?.trim();
|
|
12357
13344
|
if (!threadId || !message) return;
|
|
12358
13345
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12359
13346
|
const errorStatus = "error";
|
|
@@ -12374,7 +13361,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12374
13361
|
return changed ? sortThreadRecords(next) : prev;
|
|
12375
13362
|
});
|
|
12376
13363
|
}, [threadId, streamError]);
|
|
12377
|
-
|
|
13364
|
+
React39.useEffect(() => {
|
|
12378
13365
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
12379
13366
|
let cancelled = false;
|
|
12380
13367
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -12388,7 +13375,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12388
13375
|
cancelled = true;
|
|
12389
13376
|
};
|
|
12390
13377
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
12391
|
-
const threads =
|
|
13378
|
+
const threads = React39.useMemo(
|
|
12392
13379
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
12393
13380
|
[threadRecords]
|
|
12394
13381
|
);
|
|
@@ -12405,10 +13392,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12405
13392
|
}
|
|
12406
13393
|
|
|
12407
13394
|
// src/components/thread/context-usage-indicator.tsx
|
|
12408
|
-
var
|
|
13395
|
+
var React40 = __toESM(require("react"), 1);
|
|
12409
13396
|
|
|
12410
13397
|
// src/components/ui/progress-circle.tsx
|
|
12411
|
-
var
|
|
13398
|
+
var import_jsx_runtime45 = (
|
|
12412
13399
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
12413
13400
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
12414
13401
|
require("react/jsx-runtime")
|
|
@@ -12432,7 +13419,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12432
13419
|
fill: "none",
|
|
12433
13420
|
strokeWidth
|
|
12434
13421
|
};
|
|
12435
|
-
return /* @__PURE__ */ (0,
|
|
13422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
12436
13423
|
"svg",
|
|
12437
13424
|
{
|
|
12438
13425
|
role: "progressbar",
|
|
@@ -12443,8 +13430,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12443
13430
|
"aria-valuemax": 100,
|
|
12444
13431
|
...restSvgProps,
|
|
12445
13432
|
children: [
|
|
12446
|
-
/* @__PURE__ */ (0,
|
|
12447
|
-
/* @__PURE__ */ (0,
|
|
13433
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
13434
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12448
13435
|
"circle",
|
|
12449
13436
|
{
|
|
12450
13437
|
...commonParams,
|
|
@@ -12462,7 +13449,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12462
13449
|
};
|
|
12463
13450
|
|
|
12464
13451
|
// src/components/thread/context-usage-indicator.tsx
|
|
12465
|
-
var
|
|
13452
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
12466
13453
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
12467
13454
|
minimumFractionDigits: 0,
|
|
12468
13455
|
maximumFractionDigits: 1
|
|
@@ -12495,21 +13482,22 @@ function ContextUsageIndicator({
|
|
|
12495
13482
|
}) {
|
|
12496
13483
|
const { t } = useChatkitTranslation();
|
|
12497
13484
|
const stream = useStreamContext();
|
|
12498
|
-
const [maxContextSize, setMaxContextSize] =
|
|
12499
|
-
const [usedContextSize, setUsedContextSize] =
|
|
12500
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
12501
|
-
const latestRealtimeUsageRef =
|
|
13485
|
+
const [maxContextSize, setMaxContextSize] = React40.useState(null);
|
|
13486
|
+
const [usedContextSize, setUsedContextSize] = React40.useState(null);
|
|
13487
|
+
const [assistantAgentKey, setAssistantAgentKey] = React40.useState(null);
|
|
13488
|
+
const latestRealtimeUsageRef = React40.useRef({
|
|
12502
13489
|
threadId: null,
|
|
12503
13490
|
agentKey: null,
|
|
12504
13491
|
usedTokens: null
|
|
12505
13492
|
});
|
|
12506
|
-
const realtimeUsage =
|
|
13493
|
+
const realtimeUsage = React40.useMemo(
|
|
12507
13494
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
12508
13495
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
12509
13496
|
);
|
|
12510
13497
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
12511
|
-
|
|
12512
|
-
|
|
13498
|
+
const hasApiConfiguration = Boolean(stream.apiUrl?.trim() && stream.apiKey?.trim());
|
|
13499
|
+
React40.useEffect(() => {
|
|
13500
|
+
if (!hasApiConfiguration || !stream.client || !stream.assistantId) {
|
|
12513
13501
|
setMaxContextSize(null);
|
|
12514
13502
|
setAssistantAgentKey(null);
|
|
12515
13503
|
return;
|
|
@@ -12527,20 +13515,20 @@ function ContextUsageIndicator({
|
|
|
12527
13515
|
return () => {
|
|
12528
13516
|
cancelled = true;
|
|
12529
13517
|
};
|
|
12530
|
-
}, [stream.client, stream.assistantId]);
|
|
12531
|
-
|
|
13518
|
+
}, [hasApiConfiguration, stream.client, stream.assistantId]);
|
|
13519
|
+
React40.useEffect(() => {
|
|
12532
13520
|
latestRealtimeUsageRef.current = {
|
|
12533
13521
|
threadId: stream.threadId ?? null,
|
|
12534
13522
|
agentKey: assistantAgentKey,
|
|
12535
13523
|
usedTokens: realtimeUsedContextSize
|
|
12536
13524
|
};
|
|
12537
13525
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
12538
|
-
|
|
13526
|
+
React40.useEffect(() => {
|
|
12539
13527
|
if (realtimeUsedContextSize == null) return;
|
|
12540
13528
|
setUsedContextSize(realtimeUsedContextSize);
|
|
12541
13529
|
}, [realtimeUsedContextSize]);
|
|
12542
|
-
|
|
12543
|
-
if (!stream.client) {
|
|
13530
|
+
React40.useEffect(() => {
|
|
13531
|
+
if (!hasApiConfiguration || !stream.client) {
|
|
12544
13532
|
setUsedContextSize(null);
|
|
12545
13533
|
return;
|
|
12546
13534
|
}
|
|
@@ -12576,6 +13564,7 @@ function ContextUsageIndicator({
|
|
|
12576
13564
|
};
|
|
12577
13565
|
}, [
|
|
12578
13566
|
assistantAgentKey,
|
|
13567
|
+
hasApiConfiguration,
|
|
12579
13568
|
realtimeUsedContextSize,
|
|
12580
13569
|
stream.apiKey,
|
|
12581
13570
|
stream.apiUrl,
|
|
@@ -12604,8 +13593,8 @@ function ContextUsageIndicator({
|
|
|
12604
13593
|
});
|
|
12605
13594
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
12606
13595
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
12607
|
-
return /* @__PURE__ */ (0,
|
|
12608
|
-
/* @__PURE__ */ (0,
|
|
13596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Tooltip, { children: [
|
|
13597
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12609
13598
|
"button",
|
|
12610
13599
|
{
|
|
12611
13600
|
type: "button",
|
|
@@ -12614,31 +13603,31 @@ function ContextUsageIndicator({
|
|
|
12614
13603
|
className
|
|
12615
13604
|
),
|
|
12616
13605
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
12617
|
-
children: /* @__PURE__ */ (0,
|
|
13606
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
12618
13607
|
}
|
|
12619
13608
|
) }),
|
|
12620
|
-
/* @__PURE__ */ (0,
|
|
12621
|
-
/* @__PURE__ */ (0,
|
|
12622
|
-
/* @__PURE__ */ (0,
|
|
12623
|
-
/* @__PURE__ */ (0,
|
|
13609
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
13610
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
13611
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
13612
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
12624
13613
|
] })
|
|
12625
13614
|
] });
|
|
12626
13615
|
}
|
|
12627
13616
|
|
|
12628
13617
|
// src/components/pet/PetBridge.tsx
|
|
12629
|
-
var
|
|
12630
|
-
var
|
|
13618
|
+
var React41 = __toESM(require("react"), 1);
|
|
13619
|
+
var import_chatkit_types10 = require("@xpert-ai/chatkit-types");
|
|
12631
13620
|
function PetBridge({ pet, state }) {
|
|
12632
13621
|
const parentMessenger = useParentMessenger();
|
|
12633
13622
|
const sendEvent = parentMessenger?.sendEvent;
|
|
12634
|
-
const options =
|
|
12635
|
-
|
|
13623
|
+
const options = React41.useMemo(() => (0, import_chatkit_types10.normalizePetOptions)(pet), [pet]);
|
|
13624
|
+
React41.useEffect(() => {
|
|
12636
13625
|
if (!sendEvent) {
|
|
12637
13626
|
return;
|
|
12638
13627
|
}
|
|
12639
13628
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
12640
13629
|
}, [sendEvent, pet]);
|
|
12641
|
-
|
|
13630
|
+
React41.useEffect(() => {
|
|
12642
13631
|
if (!sendEvent || !options) {
|
|
12643
13632
|
return;
|
|
12644
13633
|
}
|
|
@@ -12648,15 +13637,15 @@ function PetBridge({ pet, state }) {
|
|
|
12648
13637
|
}
|
|
12649
13638
|
|
|
12650
13639
|
// src/components/settings/SettingsSheet.tsx
|
|
12651
|
-
var
|
|
12652
|
-
var
|
|
13640
|
+
var React48 = __toESM(require("react"), 1);
|
|
13641
|
+
var import_lucide_react28 = require("lucide-react");
|
|
12653
13642
|
|
|
12654
13643
|
// src/components/ui/input.tsx
|
|
12655
|
-
var
|
|
12656
|
-
var
|
|
12657
|
-
var Input =
|
|
13644
|
+
var React42 = __toESM(require("react"), 1);
|
|
13645
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
13646
|
+
var Input = React42.forwardRef(
|
|
12658
13647
|
({ className, type, ...props }, ref) => {
|
|
12659
|
-
return /* @__PURE__ */ (0,
|
|
13648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12660
13649
|
"input",
|
|
12661
13650
|
{
|
|
12662
13651
|
ref,
|
|
@@ -12673,20 +13662,20 @@ var Input = React41.forwardRef(
|
|
|
12673
13662
|
Input.displayName = "Input";
|
|
12674
13663
|
|
|
12675
13664
|
// src/components/ui/select.tsx
|
|
12676
|
-
var
|
|
13665
|
+
var React43 = require("react");
|
|
12677
13666
|
var import_radix_ui2 = require("radix-ui");
|
|
12678
|
-
var
|
|
12679
|
-
var
|
|
13667
|
+
var import_lucide_react27 = require("lucide-react");
|
|
13668
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
12680
13669
|
function Select({
|
|
12681
13670
|
...props
|
|
12682
13671
|
}) {
|
|
12683
|
-
return /* @__PURE__ */ (0,
|
|
13672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Root, { "data-slot": "select", ...props });
|
|
12684
13673
|
}
|
|
12685
13674
|
function SelectGroup({
|
|
12686
13675
|
className,
|
|
12687
13676
|
...props
|
|
12688
13677
|
}) {
|
|
12689
|
-
return /* @__PURE__ */ (0,
|
|
13678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12690
13679
|
import_radix_ui2.Select.Group,
|
|
12691
13680
|
{
|
|
12692
13681
|
"data-slot": "select-group",
|
|
@@ -12698,7 +13687,7 @@ function SelectGroup({
|
|
|
12698
13687
|
function SelectValue({
|
|
12699
13688
|
...props
|
|
12700
13689
|
}) {
|
|
12701
|
-
return /* @__PURE__ */ (0,
|
|
13690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Value, { "data-slot": "select-value", ...props });
|
|
12702
13691
|
}
|
|
12703
13692
|
function SelectTrigger({
|
|
12704
13693
|
className,
|
|
@@ -12706,7 +13695,7 @@ function SelectTrigger({
|
|
|
12706
13695
|
children,
|
|
12707
13696
|
...props
|
|
12708
13697
|
}) {
|
|
12709
|
-
return /* @__PURE__ */ (0,
|
|
13698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12710
13699
|
import_radix_ui2.Select.Trigger,
|
|
12711
13700
|
{
|
|
12712
13701
|
"data-slot": "select-trigger",
|
|
@@ -12718,7 +13707,7 @@ function SelectTrigger({
|
|
|
12718
13707
|
...props,
|
|
12719
13708
|
children: [
|
|
12720
13709
|
children,
|
|
12721
|
-
/* @__PURE__ */ (0,
|
|
13710
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react27.ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
12722
13711
|
]
|
|
12723
13712
|
}
|
|
12724
13713
|
);
|
|
@@ -12730,7 +13719,7 @@ function SelectContent({
|
|
|
12730
13719
|
align = "center",
|
|
12731
13720
|
...props
|
|
12732
13721
|
}) {
|
|
12733
|
-
return /* @__PURE__ */ (0,
|
|
13722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12734
13723
|
import_radix_ui2.Select.Content,
|
|
12735
13724
|
{
|
|
12736
13725
|
"data-slot": "select-content",
|
|
@@ -12740,8 +13729,8 @@ function SelectContent({
|
|
|
12740
13729
|
align,
|
|
12741
13730
|
...props,
|
|
12742
13731
|
children: [
|
|
12743
|
-
/* @__PURE__ */ (0,
|
|
12744
|
-
/* @__PURE__ */ (0,
|
|
13732
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectScrollUpButton, {}),
|
|
13733
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12745
13734
|
import_radix_ui2.Select.Viewport,
|
|
12746
13735
|
{
|
|
12747
13736
|
"data-position": position,
|
|
@@ -12752,7 +13741,7 @@ function SelectContent({
|
|
|
12752
13741
|
children
|
|
12753
13742
|
}
|
|
12754
13743
|
),
|
|
12755
|
-
/* @__PURE__ */ (0,
|
|
13744
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectScrollDownButton, {})
|
|
12756
13745
|
]
|
|
12757
13746
|
}
|
|
12758
13747
|
) });
|
|
@@ -12762,7 +13751,7 @@ function SelectItem({
|
|
|
12762
13751
|
children,
|
|
12763
13752
|
...props
|
|
12764
13753
|
}) {
|
|
12765
|
-
return /* @__PURE__ */ (0,
|
|
13754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
12766
13755
|
import_radix_ui2.Select.Item,
|
|
12767
13756
|
{
|
|
12768
13757
|
"data-slot": "select-item",
|
|
@@ -12772,8 +13761,8 @@ function SelectItem({
|
|
|
12772
13761
|
),
|
|
12773
13762
|
...props,
|
|
12774
13763
|
children: [
|
|
12775
|
-
/* @__PURE__ */ (0,
|
|
12776
|
-
/* @__PURE__ */ (0,
|
|
13764
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react27.CheckIcon, { className: "pointer-events-none" }) }) }),
|
|
13765
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_radix_ui2.Select.ItemText, { children })
|
|
12777
13766
|
]
|
|
12778
13767
|
}
|
|
12779
13768
|
);
|
|
@@ -12782,7 +13771,7 @@ function SelectScrollUpButton({
|
|
|
12782
13771
|
className,
|
|
12783
13772
|
...props
|
|
12784
13773
|
}) {
|
|
12785
|
-
return /* @__PURE__ */ (0,
|
|
13774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12786
13775
|
import_radix_ui2.Select.ScrollUpButton,
|
|
12787
13776
|
{
|
|
12788
13777
|
"data-slot": "select-scroll-up-button",
|
|
@@ -12791,8 +13780,8 @@ function SelectScrollUpButton({
|
|
|
12791
13780
|
className
|
|
12792
13781
|
),
|
|
12793
13782
|
...props,
|
|
12794
|
-
children: /* @__PURE__ */ (0,
|
|
12795
|
-
|
|
13783
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13784
|
+
import_lucide_react27.ChevronUpIcon,
|
|
12796
13785
|
{}
|
|
12797
13786
|
)
|
|
12798
13787
|
}
|
|
@@ -12802,7 +13791,7 @@ function SelectScrollDownButton({
|
|
|
12802
13791
|
className,
|
|
12803
13792
|
...props
|
|
12804
13793
|
}) {
|
|
12805
|
-
return /* @__PURE__ */ (0,
|
|
13794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12806
13795
|
import_radix_ui2.Select.ScrollDownButton,
|
|
12807
13796
|
{
|
|
12808
13797
|
"data-slot": "select-scroll-down-button",
|
|
@@ -12811,8 +13800,8 @@ function SelectScrollDownButton({
|
|
|
12811
13800
|
className
|
|
12812
13801
|
),
|
|
12813
13802
|
...props,
|
|
12814
|
-
children: /* @__PURE__ */ (0,
|
|
12815
|
-
|
|
13803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13804
|
+
import_lucide_react27.ChevronDownIcon,
|
|
12816
13805
|
{}
|
|
12817
13806
|
)
|
|
12818
13807
|
}
|
|
@@ -12820,9 +13809,9 @@ function SelectScrollDownButton({
|
|
|
12820
13809
|
}
|
|
12821
13810
|
|
|
12822
13811
|
// src/components/ui/slider.tsx
|
|
12823
|
-
var
|
|
13812
|
+
var React44 = __toESM(require("react"), 1);
|
|
12824
13813
|
var import_radix_ui3 = require("radix-ui");
|
|
12825
|
-
var
|
|
13814
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
12826
13815
|
function Slider({
|
|
12827
13816
|
className,
|
|
12828
13817
|
defaultValue,
|
|
@@ -12831,11 +13820,11 @@ function Slider({
|
|
|
12831
13820
|
max = 100,
|
|
12832
13821
|
...props
|
|
12833
13822
|
}) {
|
|
12834
|
-
const _values =
|
|
13823
|
+
const _values = React44.useMemo(
|
|
12835
13824
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
12836
13825
|
[value, defaultValue, min, max]
|
|
12837
13826
|
);
|
|
12838
|
-
return /* @__PURE__ */ (0,
|
|
13827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
12839
13828
|
import_radix_ui3.Slider.Root,
|
|
12840
13829
|
{
|
|
12841
13830
|
"data-slot": "slider",
|
|
@@ -12849,12 +13838,12 @@ function Slider({
|
|
|
12849
13838
|
),
|
|
12850
13839
|
...props,
|
|
12851
13840
|
children: [
|
|
12852
|
-
/* @__PURE__ */ (0,
|
|
13841
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12853
13842
|
import_radix_ui3.Slider.Track,
|
|
12854
13843
|
{
|
|
12855
13844
|
"data-slot": "slider-track",
|
|
12856
13845
|
className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
|
|
12857
|
-
children: /* @__PURE__ */ (0,
|
|
13846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12858
13847
|
import_radix_ui3.Slider.Range,
|
|
12859
13848
|
{
|
|
12860
13849
|
"data-slot": "slider-range",
|
|
@@ -12863,7 +13852,7 @@ function Slider({
|
|
|
12863
13852
|
)
|
|
12864
13853
|
}
|
|
12865
13854
|
),
|
|
12866
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0,
|
|
13855
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12867
13856
|
import_radix_ui3.Slider.Thumb,
|
|
12868
13857
|
{
|
|
12869
13858
|
"data-slot": "slider-thumb",
|
|
@@ -12877,15 +13866,15 @@ function Slider({
|
|
|
12877
13866
|
}
|
|
12878
13867
|
|
|
12879
13868
|
// src/components/ui/toggle-group.tsx
|
|
12880
|
-
var
|
|
13869
|
+
var React46 = __toESM(require("react"), 1);
|
|
12881
13870
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
12882
13871
|
var import_radix_ui5 = require("radix-ui");
|
|
12883
13872
|
|
|
12884
13873
|
// src/components/ui/toggle.tsx
|
|
12885
|
-
var
|
|
13874
|
+
var React45 = require("react");
|
|
12886
13875
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
12887
13876
|
var import_radix_ui4 = require("radix-ui");
|
|
12888
|
-
var
|
|
13877
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
12889
13878
|
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
12890
13879
|
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
12891
13880
|
{
|
|
@@ -12908,8 +13897,8 @@ var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
|
12908
13897
|
);
|
|
12909
13898
|
|
|
12910
13899
|
// src/components/ui/toggle-group.tsx
|
|
12911
|
-
var
|
|
12912
|
-
var ToggleGroupContext =
|
|
13900
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
13901
|
+
var ToggleGroupContext = React46.createContext({
|
|
12913
13902
|
size: "default",
|
|
12914
13903
|
variant: "default",
|
|
12915
13904
|
spacing: 0,
|
|
@@ -12924,7 +13913,7 @@ function ToggleGroup({
|
|
|
12924
13913
|
children,
|
|
12925
13914
|
...props
|
|
12926
13915
|
}) {
|
|
12927
|
-
return /* @__PURE__ */ (0,
|
|
13916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12928
13917
|
import_radix_ui5.ToggleGroup.Root,
|
|
12929
13918
|
{
|
|
12930
13919
|
"data-slot": "toggle-group",
|
|
@@ -12938,7 +13927,7 @@ function ToggleGroup({
|
|
|
12938
13927
|
className
|
|
12939
13928
|
),
|
|
12940
13929
|
...props,
|
|
12941
|
-
children: /* @__PURE__ */ (0,
|
|
13930
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12942
13931
|
ToggleGroupContext.Provider,
|
|
12943
13932
|
{
|
|
12944
13933
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -12955,8 +13944,8 @@ function ToggleGroupItem({
|
|
|
12955
13944
|
size: size2 = "default",
|
|
12956
13945
|
...props
|
|
12957
13946
|
}) {
|
|
12958
|
-
const context =
|
|
12959
|
-
return /* @__PURE__ */ (0,
|
|
13947
|
+
const context = React46.useContext(ToggleGroupContext);
|
|
13948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12960
13949
|
import_radix_ui5.ToggleGroup.Item,
|
|
12961
13950
|
{
|
|
12962
13951
|
"data-slot": "toggle-group-item",
|
|
@@ -12978,7 +13967,7 @@ function ToggleGroupItem({
|
|
|
12978
13967
|
}
|
|
12979
13968
|
|
|
12980
13969
|
// src/components/pet/pet-local-settings.ts
|
|
12981
|
-
var
|
|
13970
|
+
var import_chatkit_types11 = require("@xpert-ai/chatkit-types");
|
|
12982
13971
|
|
|
12983
13972
|
// src/components/pet/builtinPets.ts
|
|
12984
13973
|
var PUBLIC_PETS = [
|
|
@@ -13152,7 +14141,7 @@ function derivePetLocalSettings(pet) {
|
|
|
13152
14141
|
if (!pet) {
|
|
13153
14142
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
13154
14143
|
}
|
|
13155
|
-
const normalized = (0,
|
|
14144
|
+
const normalized = (0, import_chatkit_types11.normalizePetOptions)(pet ?? null);
|
|
13156
14145
|
if (!normalized) {
|
|
13157
14146
|
return { ...DEFAULT_PET_LOCAL_SETTINGS };
|
|
13158
14147
|
}
|
|
@@ -13182,25 +14171,25 @@ function derivePetLocalSettings(pet) {
|
|
|
13182
14171
|
return base2;
|
|
13183
14172
|
}
|
|
13184
14173
|
function isPetEnabled(pet) {
|
|
13185
|
-
return Boolean((0,
|
|
14174
|
+
return Boolean((0, import_chatkit_types11.normalizePetOptions)(pet ?? null));
|
|
13186
14175
|
}
|
|
13187
14176
|
|
|
13188
14177
|
// src/components/pet/PetPreview.tsx
|
|
13189
|
-
var
|
|
14178
|
+
var React47 = require("react");
|
|
13190
14179
|
|
|
13191
14180
|
// src/components/pet/petSpriteAtlas.ts
|
|
13192
|
-
var
|
|
14181
|
+
var import_chatkit_types12 = require("@xpert-ai/chatkit-types");
|
|
13193
14182
|
|
|
13194
14183
|
// src/components/pet/PetPreview.tsx
|
|
13195
|
-
var
|
|
14184
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
13196
14185
|
function escapeCssUrl(value) {
|
|
13197
14186
|
return value.replace(/["\\]/g, "\\$&");
|
|
13198
14187
|
}
|
|
13199
14188
|
function PetPreview({ src, label, className }) {
|
|
13200
14189
|
const scale = 0.13;
|
|
13201
|
-
const width =
|
|
13202
|
-
const height =
|
|
13203
|
-
return /* @__PURE__ */ (0,
|
|
14190
|
+
const width = import_chatkit_types12.petSpriteAtlas.cellWidth;
|
|
14191
|
+
const height = import_chatkit_types12.petSpriteAtlas.cellHeight;
|
|
14192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13204
14193
|
"span",
|
|
13205
14194
|
{
|
|
13206
14195
|
className: cn(
|
|
@@ -13209,7 +14198,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13209
14198
|
),
|
|
13210
14199
|
"aria-hidden": "true",
|
|
13211
14200
|
title: label,
|
|
13212
|
-
children: /* @__PURE__ */ (0,
|
|
14201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13213
14202
|
"span",
|
|
13214
14203
|
{
|
|
13215
14204
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -13220,7 +14209,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13220
14209
|
transformOrigin: "center",
|
|
13221
14210
|
backgroundImage: `url("${escapeCssUrl(src)}")`,
|
|
13222
14211
|
backgroundRepeat: "no-repeat",
|
|
13223
|
-
backgroundSize: `${
|
|
14212
|
+
backgroundSize: `${import_chatkit_types12.petSpriteAtlas.columns * width}px ${import_chatkit_types12.petSpriteAtlas.rows * height}px`,
|
|
13224
14213
|
backgroundPosition: "0px 0px",
|
|
13225
14214
|
imageRendering: "auto"
|
|
13226
14215
|
}
|
|
@@ -13231,7 +14220,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13231
14220
|
}
|
|
13232
14221
|
|
|
13233
14222
|
// src/components/settings/SettingsSheet.tsx
|
|
13234
|
-
var
|
|
14223
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
13235
14224
|
var CHARACTER_TYPES2 = [
|
|
13236
14225
|
"builtin",
|
|
13237
14226
|
"atlas"
|
|
@@ -13247,13 +14236,13 @@ function SettingsSheet({
|
|
|
13247
14236
|
onSave
|
|
13248
14237
|
}) {
|
|
13249
14238
|
const { t } = useChatkitTranslation();
|
|
13250
|
-
const [draft, setDraft] =
|
|
13251
|
-
|
|
14239
|
+
const [draft, setDraft] = React48.useState(settings);
|
|
14240
|
+
React48.useEffect(() => {
|
|
13252
14241
|
if (open) {
|
|
13253
14242
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
13254
14243
|
}
|
|
13255
14244
|
}, [open, petRequired, settings]);
|
|
13256
|
-
const updateDraft =
|
|
14245
|
+
const updateDraft = React48.useCallback(
|
|
13257
14246
|
(patch) => {
|
|
13258
14247
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
13259
14248
|
},
|
|
@@ -13271,23 +14260,23 @@ function SettingsSheet({
|
|
|
13271
14260
|
defaultValue: selectedBuiltinPet.label
|
|
13272
14261
|
}
|
|
13273
14262
|
);
|
|
13274
|
-
return /* @__PURE__ */ (0,
|
|
13275
|
-
/* @__PURE__ */ (0,
|
|
13276
|
-
/* @__PURE__ */ (0,
|
|
13277
|
-
/* @__PURE__ */ (0,
|
|
14263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Sheet, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
|
|
14264
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SheetHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14265
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react28.Settings, { size: 16 }) }),
|
|
14266
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SheetTitle, { children: t("settings.title") })
|
|
13278
14267
|
] }) }),
|
|
13279
|
-
/* @__PURE__ */ (0,
|
|
13280
|
-
/* @__PURE__ */ (0,
|
|
13281
|
-
/* @__PURE__ */ (0,
|
|
13282
|
-
/* @__PURE__ */ (0,
|
|
13283
|
-
/* @__PURE__ */ (0,
|
|
14268
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
|
|
14269
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("section", { className: "space-y-5", children: [
|
|
14270
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14271
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react28.PawPrint, { size: 15 }) }),
|
|
14272
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
|
|
13284
14273
|
] }),
|
|
13285
|
-
/* @__PURE__ */ (0,
|
|
13286
|
-
/* @__PURE__ */ (0,
|
|
13287
|
-
/* @__PURE__ */ (0,
|
|
13288
|
-
petRequired && /* @__PURE__ */ (0,
|
|
14274
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
|
|
14275
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "min-w-0", children: [
|
|
14276
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
|
|
14277
|
+
petRequired && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
|
|
13289
14278
|
] }),
|
|
13290
|
-
/* @__PURE__ */ (0,
|
|
14279
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13291
14280
|
"button",
|
|
13292
14281
|
{
|
|
13293
14282
|
type: "button",
|
|
@@ -13300,7 +14289,7 @@ function SettingsSheet({
|
|
|
13300
14289
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
13301
14290
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
13302
14291
|
].join(" "),
|
|
13303
|
-
children: /* @__PURE__ */ (0,
|
|
14292
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13304
14293
|
"span",
|
|
13305
14294
|
{
|
|
13306
14295
|
className: [
|
|
@@ -13313,9 +14302,9 @@ function SettingsSheet({
|
|
|
13313
14302
|
)
|
|
13314
14303
|
] })
|
|
13315
14304
|
] }),
|
|
13316
|
-
/* @__PURE__ */ (0,
|
|
13317
|
-
/* @__PURE__ */ (0,
|
|
13318
|
-
/* @__PURE__ */ (0,
|
|
14305
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14306
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
|
|
14307
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13319
14308
|
ToggleGroup,
|
|
13320
14309
|
{
|
|
13321
14310
|
id: "chatkit-pet-type",
|
|
@@ -13330,7 +14319,7 @@ function SettingsSheet({
|
|
|
13330
14319
|
variant: "outline",
|
|
13331
14320
|
spacing: 2,
|
|
13332
14321
|
className: "!w-full",
|
|
13333
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0,
|
|
14322
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13334
14323
|
ToggleGroupItem,
|
|
13335
14324
|
{
|
|
13336
14325
|
value: type,
|
|
@@ -13342,8 +14331,8 @@ function SettingsSheet({
|
|
|
13342
14331
|
}
|
|
13343
14332
|
)
|
|
13344
14333
|
] }),
|
|
13345
|
-
draft.characterType === "builtin" && /* @__PURE__ */ (0,
|
|
13346
|
-
/* @__PURE__ */ (0,
|
|
14334
|
+
draft.characterType === "builtin" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14335
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13347
14336
|
"label",
|
|
13348
14337
|
{
|
|
13349
14338
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -13351,7 +14340,7 @@ function SettingsSheet({
|
|
|
13351
14340
|
children: t("pet.settings.builtin")
|
|
13352
14341
|
}
|
|
13353
14342
|
),
|
|
13354
|
-
/* @__PURE__ */ (0,
|
|
14343
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
13355
14344
|
Select,
|
|
13356
14345
|
{
|
|
13357
14346
|
value: selectedBuiltinPet.id,
|
|
@@ -13362,26 +14351,26 @@ function SettingsSheet({
|
|
|
13362
14351
|
}
|
|
13363
14352
|
},
|
|
13364
14353
|
children: [
|
|
13365
|
-
/* @__PURE__ */ (0,
|
|
14354
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13366
14355
|
SelectTrigger,
|
|
13367
14356
|
{
|
|
13368
14357
|
id: "chatkit-pet-builtin",
|
|
13369
14358
|
className: "min-h-12 w-full px-3 py-2",
|
|
13370
|
-
children: /* @__PURE__ */ (0,
|
|
14359
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
13371
14360
|
}
|
|
13372
14361
|
),
|
|
13373
|
-
/* @__PURE__ */ (0,
|
|
14362
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
13374
14363
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
13375
14364
|
defaultValue: pet.label
|
|
13376
14365
|
});
|
|
13377
|
-
return /* @__PURE__ */ (0,
|
|
14366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13378
14367
|
SelectItem,
|
|
13379
14368
|
{
|
|
13380
14369
|
value: pet.id,
|
|
13381
14370
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
13382
|
-
children: /* @__PURE__ */ (0,
|
|
13383
|
-
/* @__PURE__ */ (0,
|
|
13384
|
-
/* @__PURE__ */ (0,
|
|
14371
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
14372
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PetPreview, { src: pet.previewSrc, label }),
|
|
14373
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "min-w-0 truncate", children: label })
|
|
13385
14374
|
] })
|
|
13386
14375
|
},
|
|
13387
14376
|
pet.id
|
|
@@ -13391,8 +14380,8 @@ function SettingsSheet({
|
|
|
13391
14380
|
}
|
|
13392
14381
|
)
|
|
13393
14382
|
] }),
|
|
13394
|
-
draft.characterType === "atlas" && /* @__PURE__ */ (0,
|
|
13395
|
-
/* @__PURE__ */ (0,
|
|
14383
|
+
draft.characterType === "atlas" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14384
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13396
14385
|
"label",
|
|
13397
14386
|
{
|
|
13398
14387
|
className: "text-sm font-medium",
|
|
@@ -13400,7 +14389,7 @@ function SettingsSheet({
|
|
|
13400
14389
|
children: t("pet.settings.atlasUrl")
|
|
13401
14390
|
}
|
|
13402
14391
|
),
|
|
13403
|
-
/* @__PURE__ */ (0,
|
|
14392
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13404
14393
|
Input,
|
|
13405
14394
|
{
|
|
13406
14395
|
id: "chatkit-pet-atlas",
|
|
@@ -13410,15 +14399,15 @@ function SettingsSheet({
|
|
|
13410
14399
|
}
|
|
13411
14400
|
)
|
|
13412
14401
|
] }),
|
|
13413
|
-
/* @__PURE__ */ (0,
|
|
13414
|
-
/* @__PURE__ */ (0,
|
|
13415
|
-
/* @__PURE__ */ (0,
|
|
13416
|
-
/* @__PURE__ */ (0,
|
|
14402
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-2", children: [
|
|
14403
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
14404
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
|
|
14405
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
13417
14406
|
draft.scale.toFixed(2),
|
|
13418
14407
|
"x"
|
|
13419
14408
|
] })
|
|
13420
14409
|
] }),
|
|
13421
|
-
/* @__PURE__ */ (0,
|
|
14410
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13422
14411
|
Slider,
|
|
13423
14412
|
{
|
|
13424
14413
|
id: "chatkit-pet-scale",
|
|
@@ -13432,8 +14421,8 @@ function SettingsSheet({
|
|
|
13432
14421
|
}
|
|
13433
14422
|
)
|
|
13434
14423
|
] }),
|
|
13435
|
-
/* @__PURE__ */ (0,
|
|
13436
|
-
/* @__PURE__ */ (0,
|
|
14424
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14425
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13437
14426
|
"input",
|
|
13438
14427
|
{
|
|
13439
14428
|
type: "checkbox",
|
|
@@ -13444,8 +14433,8 @@ function SettingsSheet({
|
|
|
13444
14433
|
),
|
|
13445
14434
|
t("pet.settings.draggable")
|
|
13446
14435
|
] }),
|
|
13447
|
-
/* @__PURE__ */ (0,
|
|
13448
|
-
/* @__PURE__ */ (0,
|
|
14436
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14437
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13449
14438
|
"input",
|
|
13450
14439
|
{
|
|
13451
14440
|
type: "checkbox",
|
|
@@ -13456,8 +14445,8 @@ function SettingsSheet({
|
|
|
13456
14445
|
),
|
|
13457
14446
|
t("pet.settings.persistPosition")
|
|
13458
14447
|
] }),
|
|
13459
|
-
/* @__PURE__ */ (0,
|
|
13460
|
-
/* @__PURE__ */ (0,
|
|
14448
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
14449
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13461
14450
|
Button,
|
|
13462
14451
|
{
|
|
13463
14452
|
type: "button",
|
|
@@ -13466,7 +14455,7 @@ function SettingsSheet({
|
|
|
13466
14455
|
children: t("pet.settings.cancel")
|
|
13467
14456
|
}
|
|
13468
14457
|
),
|
|
13469
|
-
/* @__PURE__ */ (0,
|
|
14458
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { type: "submit", children: t("pet.settings.save") })
|
|
13470
14459
|
] })
|
|
13471
14460
|
] })
|
|
13472
14461
|
] }) });
|
|
@@ -14093,7 +15082,7 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
14093
15082
|
}
|
|
14094
15083
|
|
|
14095
15084
|
// src/components/chat.tsx
|
|
14096
|
-
var
|
|
15085
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
14097
15086
|
var import_meta2 = {};
|
|
14098
15087
|
var defaultApiUrl2 = import_meta2.env.VITE_XPERTAI_API_URL;
|
|
14099
15088
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
@@ -14238,8 +15227,8 @@ function ReferenceChip({
|
|
|
14238
15227
|
}) {
|
|
14239
15228
|
const metaLine = getReferenceMetaLine(reference);
|
|
14240
15229
|
const isComposer = variant === "composer";
|
|
14241
|
-
const Icon = reference.type === "quote" ?
|
|
14242
|
-
return /* @__PURE__ */ (0,
|
|
15230
|
+
const Icon = reference.type === "quote" ? import_lucide_react29.Quote : reference.type === "image" ? import_lucide_react29.ImageIcon : import_lucide_react29.FileText;
|
|
15231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14243
15232
|
"div",
|
|
14244
15233
|
{
|
|
14245
15234
|
className: cn(
|
|
@@ -14248,7 +15237,7 @@ function ReferenceChip({
|
|
|
14248
15237
|
),
|
|
14249
15238
|
title: getReferenceTitle(reference),
|
|
14250
15239
|
children: [
|
|
14251
|
-
/* @__PURE__ */ (0,
|
|
15240
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14252
15241
|
Icon,
|
|
14253
15242
|
{
|
|
14254
15243
|
size: isComposer ? 14 : 12,
|
|
@@ -14258,8 +15247,8 @@ function ReferenceChip({
|
|
|
14258
15247
|
)
|
|
14259
15248
|
}
|
|
14260
15249
|
),
|
|
14261
|
-
/* @__PURE__ */ (0,
|
|
14262
|
-
/* @__PURE__ */ (0,
|
|
15250
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
15251
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14263
15252
|
"div",
|
|
14264
15253
|
{
|
|
14265
15254
|
className: cn(
|
|
@@ -14269,7 +15258,7 @@ function ReferenceChip({
|
|
|
14269
15258
|
children: getReferenceLabel(reference)
|
|
14270
15259
|
}
|
|
14271
15260
|
),
|
|
14272
|
-
metaLine && /* @__PURE__ */ (0,
|
|
15261
|
+
metaLine && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14273
15262
|
"div",
|
|
14274
15263
|
{
|
|
14275
15264
|
className: cn(
|
|
@@ -14280,7 +15269,7 @@ function ReferenceChip({
|
|
|
14280
15269
|
}
|
|
14281
15270
|
)
|
|
14282
15271
|
] }),
|
|
14283
|
-
onRemove && removeLabel && /* @__PURE__ */ (0,
|
|
15272
|
+
onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14284
15273
|
"button",
|
|
14285
15274
|
{
|
|
14286
15275
|
type: "button",
|
|
@@ -14291,7 +15280,7 @@ function ReferenceChip({
|
|
|
14291
15280
|
),
|
|
14292
15281
|
title: removeLabel,
|
|
14293
15282
|
"aria-label": removeLabel,
|
|
14294
|
-
children: /* @__PURE__ */ (0,
|
|
15283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 12 })
|
|
14295
15284
|
}
|
|
14296
15285
|
)
|
|
14297
15286
|
]
|
|
@@ -14315,26 +15304,26 @@ function Chat({
|
|
|
14315
15304
|
const { setStream } = useStreamManager();
|
|
14316
15305
|
const stream = useStreamContext();
|
|
14317
15306
|
const { theme } = useTheme();
|
|
14318
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
14319
|
-
const [historyError, setHistoryError] =
|
|
14320
|
-
const [assistantName, setAssistantName] =
|
|
14321
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
14322
|
-
const [threadGoal, setThreadGoal] =
|
|
14323
|
-
const [goalError, setGoalError] =
|
|
14324
|
-
const [isGoalLoading, setIsGoalLoading] =
|
|
14325
|
-
const [isGoalPanelOpen, setIsGoalPanelOpen] =
|
|
14326
|
-
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] =
|
|
14327
|
-
const [goalElapsedStartedAt, setGoalElapsedStartedAt] =
|
|
15307
|
+
const [isHistoryLoading, setIsHistoryLoading] = React49.useState(false);
|
|
15308
|
+
const [historyError, setHistoryError] = React49.useState(null);
|
|
15309
|
+
const [assistantName, setAssistantName] = React49.useState(null);
|
|
15310
|
+
const [assistantAvatar, setAssistantAvatar] = React49.useState(null);
|
|
15311
|
+
const [threadGoal, setThreadGoal] = React49.useState(null);
|
|
15312
|
+
const [goalError, setGoalError] = React49.useState(null);
|
|
15313
|
+
const [isGoalLoading, setIsGoalLoading] = React49.useState(false);
|
|
15314
|
+
const [isGoalPanelOpen, setIsGoalPanelOpen] = React49.useState(false);
|
|
15315
|
+
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] = React49.useState(false);
|
|
15316
|
+
const [goalElapsedStartedAt, setGoalElapsedStartedAt] = React49.useState(null);
|
|
14328
15317
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
14329
15318
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
14330
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
14331
|
-
const [streamingNow, setStreamingNow] =
|
|
14332
|
-
const loadingStartTimeRef =
|
|
14333
|
-
const lastStreamOutputAtRef =
|
|
14334
|
-
|
|
15319
|
+
const [showLoadingDots, setShowLoadingDots] = React49.useState(false);
|
|
15320
|
+
const [streamingNow, setStreamingNow] = React49.useState(() => Date.now());
|
|
15321
|
+
const loadingStartTimeRef = React49.useRef(null);
|
|
15322
|
+
const lastStreamOutputAtRef = React49.useRef(null);
|
|
15323
|
+
React49.useEffect(() => {
|
|
14335
15324
|
setStream(stream);
|
|
14336
15325
|
}, [setStream, stream]);
|
|
14337
|
-
|
|
15326
|
+
React49.useEffect(() => {
|
|
14338
15327
|
if (stream.isLoading) {
|
|
14339
15328
|
if (!loadingStartTimeRef.current) {
|
|
14340
15329
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -14357,7 +15346,7 @@ function Chat({
|
|
|
14357
15346
|
}
|
|
14358
15347
|
}
|
|
14359
15348
|
}, [stream.isLoading]);
|
|
14360
|
-
|
|
15349
|
+
React49.useEffect(() => {
|
|
14361
15350
|
if (!stream.isLoading) {
|
|
14362
15351
|
lastStreamOutputAtRef.current = null;
|
|
14363
15352
|
setStreamingNow(Date.now());
|
|
@@ -14367,7 +15356,7 @@ function Chat({
|
|
|
14367
15356
|
lastStreamOutputAtRef.current = now;
|
|
14368
15357
|
setStreamingNow(now);
|
|
14369
15358
|
}, [stream.messages, stream.isLoading]);
|
|
14370
|
-
|
|
15359
|
+
React49.useEffect(() => {
|
|
14371
15360
|
if (!stream.isLoading) {
|
|
14372
15361
|
return;
|
|
14373
15362
|
}
|
|
@@ -14376,7 +15365,7 @@ function Chat({
|
|
|
14376
15365
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
14377
15366
|
return () => window.clearInterval(timer);
|
|
14378
15367
|
}, [stream.isLoading]);
|
|
14379
|
-
|
|
15368
|
+
React49.useEffect(() => {
|
|
14380
15369
|
if (threadGoal?.status === "active" && stream.isLoading) {
|
|
14381
15370
|
setGoalElapsedStartedAt(Date.now());
|
|
14382
15371
|
return;
|
|
@@ -14388,82 +15377,82 @@ function Chat({
|
|
|
14388
15377
|
threadGoal?.id,
|
|
14389
15378
|
threadGoal?.status
|
|
14390
15379
|
]);
|
|
14391
|
-
|
|
15380
|
+
React49.useEffect(() => {
|
|
14392
15381
|
setIsGoalObjectiveExpanded(false);
|
|
14393
15382
|
}, [threadGoal?.id]);
|
|
14394
|
-
const [composerParts, setComposerParts] =
|
|
14395
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
14396
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
14397
|
-
const [selectedTool, setSelectedTool] =
|
|
15383
|
+
const [composerParts, setComposerParts] = React49.useState([]);
|
|
15384
|
+
const [renderedComposerParts, setRenderedComposerParts] = React49.useState([]);
|
|
15385
|
+
const [composerDomVersion, setComposerDomVersion] = React49.useState(0);
|
|
15386
|
+
const [selectedTool, setSelectedTool] = React49.useState(
|
|
14398
15387
|
null
|
|
14399
15388
|
);
|
|
14400
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
14401
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
14402
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
14403
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
14404
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
14405
|
-
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] =
|
|
15389
|
+
const [planModeEnabled, setPlanModeEnabled] = React49.useState(false);
|
|
15390
|
+
const [petSettingsOpen, setPetSettingsOpen] = React49.useState(false);
|
|
15391
|
+
const [petLocalSettings, setPetLocalSettings] = React49.useState(() => readPetLocalSettings());
|
|
15392
|
+
const [runtimeCapabilities, setRuntimeCapabilities] = React49.useState(null);
|
|
15393
|
+
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React49.useState(false);
|
|
15394
|
+
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React49.useState(
|
|
14406
15395
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14407
15396
|
);
|
|
14408
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
15397
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React49.useState(
|
|
14409
15398
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14410
15399
|
);
|
|
14411
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
14412
|
-
const [attachmentState, setAttachmentState] =
|
|
15400
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React49.useState(null);
|
|
15401
|
+
const [attachmentState, setAttachmentState] = React49.useState({
|
|
14413
15402
|
uploadedFiles: [],
|
|
14414
15403
|
hasUploadingFiles: false,
|
|
14415
15404
|
hasParsingFiles: false
|
|
14416
15405
|
});
|
|
14417
|
-
const [references, setReferences] =
|
|
14418
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
14419
|
-
const [quoteSelection, setQuoteSelection] =
|
|
14420
|
-
const [isAtBottom, setIsAtBottom] =
|
|
14421
|
-
const [hasUpdatesBelow, setHasUpdatesBelow] =
|
|
15406
|
+
const [references, setReferences] = React49.useState([]);
|
|
15407
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React49.useState(false);
|
|
15408
|
+
const [quoteSelection, setQuoteSelection] = React49.useState(null);
|
|
15409
|
+
const [isAtBottom, setIsAtBottom] = React49.useState(true);
|
|
15410
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React49.useState(false);
|
|
14422
15411
|
const {
|
|
14423
15412
|
threads,
|
|
14424
15413
|
deleteThread,
|
|
14425
15414
|
refreshThreads,
|
|
14426
15415
|
isLoading: isThreadsLoading
|
|
14427
15416
|
} = useThreads();
|
|
14428
|
-
const viewportRef =
|
|
14429
|
-
const attachmentsRef =
|
|
14430
|
-
const composerInputRef =
|
|
14431
|
-
const slashPaletteRef =
|
|
14432
|
-
const slashPaletteOptionRefs =
|
|
15417
|
+
const viewportRef = React49.useRef(null);
|
|
15418
|
+
const attachmentsRef = React49.useRef(null);
|
|
15419
|
+
const composerInputRef = React49.useRef(null);
|
|
15420
|
+
const slashPaletteRef = React49.useRef(null);
|
|
15421
|
+
const slashPaletteOptionRefs = React49.useRef(
|
|
14433
15422
|
[]
|
|
14434
15423
|
);
|
|
14435
|
-
const composerPartsRef =
|
|
14436
|
-
const pendingComposerCaretOffsetRef =
|
|
14437
|
-
const shouldAutoScrollRef =
|
|
14438
|
-
const forceFollowRef =
|
|
14439
|
-
const previousMessageCountRef =
|
|
14440
|
-
const previousScrollTopRef =
|
|
14441
|
-
const isPrependingHistoryMessagesRef =
|
|
14442
|
-
const autoScrollFrameRef =
|
|
14443
|
-
const isPointerDownRef =
|
|
14444
|
-
const lastTouchYRef =
|
|
14445
|
-
const runtimeCapabilityPreferenceLoadRef =
|
|
15424
|
+
const composerPartsRef = React49.useRef([]);
|
|
15425
|
+
const pendingComposerCaretOffsetRef = React49.useRef(null);
|
|
15426
|
+
const shouldAutoScrollRef = React49.useRef(true);
|
|
15427
|
+
const forceFollowRef = React49.useRef(false);
|
|
15428
|
+
const previousMessageCountRef = React49.useRef(0);
|
|
15429
|
+
const previousScrollTopRef = React49.useRef(0);
|
|
15430
|
+
const isPrependingHistoryMessagesRef = React49.useRef(false);
|
|
15431
|
+
const autoScrollFrameRef = React49.useRef(null);
|
|
15432
|
+
const isPointerDownRef = React49.useRef(false);
|
|
15433
|
+
const lastTouchYRef = React49.useRef(null);
|
|
15434
|
+
const runtimeCapabilityPreferenceLoadRef = React49.useRef(0);
|
|
14446
15435
|
const resolvedTitle = title ?? t("chat.title");
|
|
14447
15436
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
14448
15437
|
const petRequired = options?.displayMode === "pet";
|
|
14449
|
-
const basePetSettings =
|
|
15438
|
+
const basePetSettings = React49.useMemo(
|
|
14450
15439
|
() => derivePetLocalSettings(options?.pet),
|
|
14451
15440
|
[options?.pet]
|
|
14452
15441
|
);
|
|
14453
|
-
const displayedPetSettings =
|
|
15442
|
+
const displayedPetSettings = React49.useMemo(
|
|
14454
15443
|
() => ({
|
|
14455
15444
|
...petLocalSettings ?? basePetSettings,
|
|
14456
15445
|
...petRequired ? { enabled: true } : {}
|
|
14457
15446
|
}),
|
|
14458
15447
|
[basePetSettings, petLocalSettings, petRequired]
|
|
14459
15448
|
);
|
|
14460
|
-
const effectivePet =
|
|
15449
|
+
const effectivePet = React49.useMemo(() => {
|
|
14461
15450
|
if (petRequired || petLocalSettings) {
|
|
14462
15451
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
14463
15452
|
}
|
|
14464
15453
|
return options?.pet ?? null;
|
|
14465
15454
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
14466
|
-
const savePetLocalSettings =
|
|
15455
|
+
const savePetLocalSettings = React49.useCallback(
|
|
14467
15456
|
(settings) => {
|
|
14468
15457
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
14469
15458
|
setPetLocalSettings(nextSettings);
|
|
@@ -14471,7 +15460,7 @@ function Chat({
|
|
|
14471
15460
|
},
|
|
14472
15461
|
[petRequired]
|
|
14473
15462
|
);
|
|
14474
|
-
const handlePetCommand =
|
|
15463
|
+
const handlePetCommand = React49.useCallback(
|
|
14475
15464
|
(mode) => {
|
|
14476
15465
|
if (mode === "settings") {
|
|
14477
15466
|
setPetSettingsOpen(true);
|
|
@@ -14493,7 +15482,7 @@ function Chat({
|
|
|
14493
15482
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
14494
15483
|
);
|
|
14495
15484
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
14496
|
-
const messages =
|
|
15485
|
+
const messages = React49.useMemo(
|
|
14497
15486
|
() => stream.messages ?? [],
|
|
14498
15487
|
[stream.messages]
|
|
14499
15488
|
);
|
|
@@ -14502,7 +15491,7 @@ function Chat({
|
|
|
14502
15491
|
historyMessagePagination?.isLoadingMore
|
|
14503
15492
|
);
|
|
14504
15493
|
const canLoadMoreMessages = Boolean(historyMessagePagination?.hasMore);
|
|
14505
|
-
const draft =
|
|
15494
|
+
const draft = React49.useMemo(
|
|
14506
15495
|
() => getComposerPlainText(composerParts),
|
|
14507
15496
|
[composerParts]
|
|
14508
15497
|
);
|
|
@@ -14516,7 +15505,7 @@ function Chat({
|
|
|
14516
15505
|
isEmpty: isComposerInputEmpty,
|
|
14517
15506
|
isStacked: isComposerStacked
|
|
14518
15507
|
});
|
|
14519
|
-
const pendingFollowUps =
|
|
15508
|
+
const pendingFollowUps = React49.useMemo(
|
|
14520
15509
|
() => sortVisiblePendingFollowUps(stream.pendingFollowUps ?? []),
|
|
14521
15510
|
[stream.pendingFollowUps]
|
|
14522
15511
|
);
|
|
@@ -14525,11 +15514,11 @@ function Chat({
|
|
|
14525
15514
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
14526
15515
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
14527
15516
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
14528
|
-
const runtimeCapabilityOptions =
|
|
15517
|
+
const runtimeCapabilityOptions = React49.useMemo(
|
|
14529
15518
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
14530
15519
|
[runtimeCapabilities]
|
|
14531
15520
|
);
|
|
14532
|
-
const goalAdapter =
|
|
15521
|
+
const goalAdapter = React49.useMemo(
|
|
14533
15522
|
() => {
|
|
14534
15523
|
if (isGoalAdapter(options?.goal)) {
|
|
14535
15524
|
return options.goal;
|
|
@@ -14539,7 +15528,7 @@ function Chat({
|
|
|
14539
15528
|
[options?.goal, stream.client]
|
|
14540
15529
|
);
|
|
14541
15530
|
const displayedGoalElapsedSeconds = threadGoal ? (threadGoal.elapsedSeconds ?? 0) + (goalElapsedStartedAt ? Math.max(0, Math.floor((streamingNow - goalElapsedStartedAt) / 1e3)) : 0) : 0;
|
|
14542
|
-
const effectiveSessionRuntimeCapabilities =
|
|
15531
|
+
const effectiveSessionRuntimeCapabilities = React49.useMemo(
|
|
14543
15532
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
14544
15533
|
runtimeCapabilities,
|
|
14545
15534
|
sessionRuntimeCapabilities
|
|
@@ -14552,7 +15541,7 @@ function Chat({
|
|
|
14552
15541
|
"goal"
|
|
14553
15542
|
);
|
|
14554
15543
|
const showGoalStatus = goalCommandAvailable && !hasCompletedGoal && (Boolean(goalError) || threadGoal?.status === "active" && stream.isLoading);
|
|
14555
|
-
const runRuntimeCapabilityOptions =
|
|
15544
|
+
const runRuntimeCapabilityOptions = React49.useMemo(
|
|
14556
15545
|
() => runtimeCapabilityOptions.filter(
|
|
14557
15546
|
(option) => isRuntimeCapabilitySelected(
|
|
14558
15547
|
runRuntimeCapabilities,
|
|
@@ -14562,11 +15551,11 @@ function Chat({
|
|
|
14562
15551
|
),
|
|
14563
15552
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
14564
15553
|
);
|
|
14565
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
15554
|
+
const composerRuntimeCapabilitySelectionKeys = React49.useMemo(
|
|
14566
15555
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
14567
15556
|
[composerParts]
|
|
14568
15557
|
);
|
|
14569
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
15558
|
+
const detachedRunRuntimeCapabilityOptions = React49.useMemo(
|
|
14570
15559
|
() => runRuntimeCapabilityOptions.filter(
|
|
14571
15560
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
14572
15561
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -14574,7 +15563,7 @@ function Chat({
|
|
|
14574
15563
|
),
|
|
14575
15564
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
14576
15565
|
);
|
|
14577
|
-
const persistSessionRuntimeCapabilities =
|
|
15566
|
+
const persistSessionRuntimeCapabilities = React49.useCallback(
|
|
14578
15567
|
async (threadId, selection) => {
|
|
14579
15568
|
if (!runtimeCapabilities || !selection) {
|
|
14580
15569
|
return;
|
|
@@ -14599,10 +15588,10 @@ function Chat({
|
|
|
14599
15588
|
},
|
|
14600
15589
|
[runtimeCapabilities, stream.client]
|
|
14601
15590
|
);
|
|
14602
|
-
const clearQuoteSelection =
|
|
15591
|
+
const clearQuoteSelection = React49.useCallback(() => {
|
|
14603
15592
|
setQuoteSelection(null);
|
|
14604
15593
|
}, []);
|
|
14605
|
-
const commitComposerParts =
|
|
15594
|
+
const commitComposerParts = React49.useCallback(
|
|
14606
15595
|
(nextParts, options2) => {
|
|
14607
15596
|
const normalized = normalizeComposerParts(nextParts);
|
|
14608
15597
|
const previous = composerPartsRef.current;
|
|
@@ -14638,7 +15627,7 @@ function Chat({
|
|
|
14638
15627
|
},
|
|
14639
15628
|
[]
|
|
14640
15629
|
);
|
|
14641
|
-
const setComposerText =
|
|
15630
|
+
const setComposerText = React49.useCallback(
|
|
14642
15631
|
(text, caretOffset = text.length) => {
|
|
14643
15632
|
commitComposerParts(createComposerTextParts(text), {
|
|
14644
15633
|
caretOffset,
|
|
@@ -14648,7 +15637,7 @@ function Chat({
|
|
|
14648
15637
|
},
|
|
14649
15638
|
[commitComposerParts]
|
|
14650
15639
|
);
|
|
14651
|
-
const focusComposerAt =
|
|
15640
|
+
const focusComposerAt = React49.useCallback((position) => {
|
|
14652
15641
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
14653
15642
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
14654
15643
|
requestAnimationFrame(() => {
|
|
@@ -14660,7 +15649,7 @@ function Chat({
|
|
|
14660
15649
|
});
|
|
14661
15650
|
}, []);
|
|
14662
15651
|
const parentMessenger = useParentMessenger({
|
|
14663
|
-
onSetComposerValue:
|
|
15652
|
+
onSetComposerValue: React49.useCallback(
|
|
14664
15653
|
(payload) => {
|
|
14665
15654
|
if (!payload) {
|
|
14666
15655
|
return;
|
|
@@ -14683,10 +15672,10 @@ function Chat({
|
|
|
14683
15672
|
},
|
|
14684
15673
|
[composer?.tools, setComposerText]
|
|
14685
15674
|
),
|
|
14686
|
-
onFocusComposer:
|
|
15675
|
+
onFocusComposer: React49.useCallback(() => {
|
|
14687
15676
|
composerInputRef.current?.focus();
|
|
14688
15677
|
}, []),
|
|
14689
|
-
onSetPetEnabled:
|
|
15678
|
+
onSetPetEnabled: React49.useCallback(
|
|
14690
15679
|
(enabled) => {
|
|
14691
15680
|
if (petRequired) {
|
|
14692
15681
|
return;
|
|
@@ -14700,10 +15689,10 @@ function Chat({
|
|
|
14700
15689
|
)
|
|
14701
15690
|
});
|
|
14702
15691
|
const canMinimizeToPet = parentMessenger?.isParentAvailable === true && isPetEnabled(effectivePet);
|
|
14703
|
-
const handleMinimizeToPet =
|
|
15692
|
+
const handleMinimizeToPet = React49.useCallback(() => {
|
|
14704
15693
|
parentMessenger?.sendEvent("chat_minimize_change", { minimized: true });
|
|
14705
15694
|
}, [parentMessenger]);
|
|
14706
|
-
const syncQuoteSelection =
|
|
15695
|
+
const syncQuoteSelection = React49.useCallback(() => {
|
|
14707
15696
|
if (typeof window === "undefined") {
|
|
14708
15697
|
clearQuoteSelection();
|
|
14709
15698
|
return;
|
|
@@ -14748,23 +15737,23 @@ function Chat({
|
|
|
14748
15737
|
left
|
|
14749
15738
|
});
|
|
14750
15739
|
}, [clearQuoteSelection]);
|
|
14751
|
-
const cancelPendingAutoScroll =
|
|
15740
|
+
const cancelPendingAutoScroll = React49.useCallback(() => {
|
|
14752
15741
|
if (autoScrollFrameRef.current !== null) {
|
|
14753
15742
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
14754
15743
|
autoScrollFrameRef.current = null;
|
|
14755
15744
|
}
|
|
14756
15745
|
}, []);
|
|
14757
|
-
const disableAutoFollow =
|
|
15746
|
+
const disableAutoFollow = React49.useCallback(() => {
|
|
14758
15747
|
forceFollowRef.current = false;
|
|
14759
15748
|
shouldAutoScrollRef.current = false;
|
|
14760
15749
|
cancelPendingAutoScroll();
|
|
14761
15750
|
}, [cancelPendingAutoScroll]);
|
|
14762
|
-
const enableAutoFollow =
|
|
15751
|
+
const enableAutoFollow = React49.useCallback(() => {
|
|
14763
15752
|
forceFollowRef.current = true;
|
|
14764
15753
|
shouldAutoScrollRef.current = true;
|
|
14765
15754
|
setHasUpdatesBelow(false);
|
|
14766
15755
|
}, []);
|
|
14767
|
-
const scrollToBottom =
|
|
15756
|
+
const scrollToBottom = React49.useCallback(
|
|
14768
15757
|
(smooth = false, force = false) => {
|
|
14769
15758
|
if (force) {
|
|
14770
15759
|
enableAutoFollow();
|
|
@@ -14791,7 +15780,7 @@ function Chat({
|
|
|
14791
15780
|
},
|
|
14792
15781
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
14793
15782
|
);
|
|
14794
|
-
|
|
15783
|
+
React49.useEffect(() => {
|
|
14795
15784
|
const viewport = viewportRef.current;
|
|
14796
15785
|
if (!viewport) return;
|
|
14797
15786
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -14872,14 +15861,14 @@ function Chat({
|
|
|
14872
15861
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
14873
15862
|
};
|
|
14874
15863
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
14875
|
-
|
|
15864
|
+
React49.useEffect(() => {
|
|
14876
15865
|
shouldAutoScrollRef.current = true;
|
|
14877
15866
|
forceFollowRef.current = false;
|
|
14878
15867
|
previousScrollTopRef.current = 0;
|
|
14879
15868
|
setIsAtBottom(true);
|
|
14880
15869
|
setHasUpdatesBelow(false);
|
|
14881
15870
|
}, [stream.threadId]);
|
|
14882
|
-
|
|
15871
|
+
React49.useEffect(() => {
|
|
14883
15872
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
14884
15873
|
previousMessageCountRef.current = messages.length;
|
|
14885
15874
|
if (isPrependingHistoryMessagesRef.current) {
|
|
@@ -14902,7 +15891,7 @@ function Chat({
|
|
|
14902
15891
|
clientSecret: effectiveClientSecret
|
|
14903
15892
|
});
|
|
14904
15893
|
const missingConfig = Boolean(missingConfigKind);
|
|
14905
|
-
const missingConfigShortMessage =
|
|
15894
|
+
const missingConfigShortMessage = React49.useMemo(() => {
|
|
14906
15895
|
switch (missingConfigKind) {
|
|
14907
15896
|
case "apiUrl":
|
|
14908
15897
|
return t("chat.missingApiUrlShort");
|
|
@@ -14914,7 +15903,7 @@ function Chat({
|
|
|
14914
15903
|
return t("chat.missingConfigShort");
|
|
14915
15904
|
}
|
|
14916
15905
|
}, [missingConfigKind, t]);
|
|
14917
|
-
const missingConfigDetailMessage =
|
|
15906
|
+
const missingConfigDetailMessage = React49.useMemo(() => {
|
|
14918
15907
|
switch (missingConfigKind) {
|
|
14919
15908
|
case "apiUrl":
|
|
14920
15909
|
return t("chat.missingApiUrlDetail");
|
|
@@ -14931,7 +15920,7 @@ function Chat({
|
|
|
14931
15920
|
const isSubmissionBlocked = hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
14932
15921
|
const isSendDisabled = !trimmedDraft && !hasReferences || isSubmissionBlocked;
|
|
14933
15922
|
const isPromptEditDisabled = hasPendingInteractiveRequest || missingConfig || isHistoryLoading;
|
|
14934
|
-
const resizeComposerInput =
|
|
15923
|
+
const resizeComposerInput = React49.useCallback(() => {
|
|
14935
15924
|
const input = composerInputRef.current;
|
|
14936
15925
|
if (!input) {
|
|
14937
15926
|
return;
|
|
@@ -14939,7 +15928,7 @@ function Chat({
|
|
|
14939
15928
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
14940
15929
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
14941
15930
|
}, []);
|
|
14942
|
-
|
|
15931
|
+
React49.useLayoutEffect(() => {
|
|
14943
15932
|
composerPartsRef.current = composerParts;
|
|
14944
15933
|
resizeComposerInput();
|
|
14945
15934
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -14951,13 +15940,13 @@ function Chat({
|
|
|
14951
15940
|
}
|
|
14952
15941
|
}
|
|
14953
15942
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
14954
|
-
|
|
15943
|
+
React49.useEffect(() => {
|
|
14955
15944
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
14956
15945
|
return () => {
|
|
14957
15946
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
14958
15947
|
};
|
|
14959
15948
|
}, [syncQuoteSelection]);
|
|
14960
|
-
|
|
15949
|
+
React49.useEffect(() => {
|
|
14961
15950
|
const viewport = viewportRef.current;
|
|
14962
15951
|
if (!viewport) {
|
|
14963
15952
|
return;
|
|
@@ -14974,14 +15963,14 @@ function Chat({
|
|
|
14974
15963
|
window.removeEventListener("resize", handleViewportScroll);
|
|
14975
15964
|
};
|
|
14976
15965
|
}, [clearQuoteSelection]);
|
|
14977
|
-
|
|
15966
|
+
React49.useEffect(() => {
|
|
14978
15967
|
clearQuoteSelection();
|
|
14979
15968
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
14980
|
-
|
|
15969
|
+
React49.useEffect(() => {
|
|
14981
15970
|
if (missingConfig) return;
|
|
14982
15971
|
void refreshThreads();
|
|
14983
15972
|
}, [missingConfig, refreshThreads]);
|
|
14984
|
-
|
|
15973
|
+
React49.useEffect(() => {
|
|
14985
15974
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
14986
15975
|
setAssistantName(null);
|
|
14987
15976
|
setAssistantAvatar(null);
|
|
@@ -15004,7 +15993,7 @@ function Chat({
|
|
|
15004
15993
|
cancelled = true;
|
|
15005
15994
|
};
|
|
15006
15995
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15007
|
-
|
|
15996
|
+
React49.useEffect(() => {
|
|
15008
15997
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
15009
15998
|
setRuntimeCapabilities(null);
|
|
15010
15999
|
setRuntimeCapabilitiesReady(false);
|
|
@@ -15051,7 +16040,7 @@ function Chat({
|
|
|
15051
16040
|
});
|
|
15052
16041
|
return () => controller.abort();
|
|
15053
16042
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15054
|
-
|
|
16043
|
+
React49.useEffect(() => {
|
|
15055
16044
|
setRunRuntimeCapabilities(
|
|
15056
16045
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
15057
16046
|
);
|
|
@@ -15100,10 +16089,10 @@ function Chat({
|
|
|
15100
16089
|
stream.client,
|
|
15101
16090
|
stream.threadId
|
|
15102
16091
|
]);
|
|
15103
|
-
|
|
16092
|
+
React49.useEffect(() => {
|
|
15104
16093
|
setThreadGoal(stream.threadGoal);
|
|
15105
16094
|
}, [stream.threadGoal]);
|
|
15106
|
-
|
|
16095
|
+
React49.useEffect(() => {
|
|
15107
16096
|
const threadId = stream.threadId?.trim();
|
|
15108
16097
|
if (!threadId || !goalCommandAvailable) {
|
|
15109
16098
|
setThreadGoal(null);
|
|
@@ -15144,7 +16133,7 @@ function Chat({
|
|
|
15144
16133
|
return () => controller.abort();
|
|
15145
16134
|
}, [goalAdapter, goalCommandAvailable, stream.threadId]);
|
|
15146
16135
|
const uploadedFiles = attachmentState.uploadedFiles;
|
|
15147
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
16136
|
+
const handleSessionRuntimeCapabilityToggle = React49.useCallback(
|
|
15148
16137
|
(type, id, selected) => {
|
|
15149
16138
|
setSessionRuntimeCapabilities((previous) => {
|
|
15150
16139
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -15162,7 +16151,7 @@ function Chat({
|
|
|
15162
16151
|
},
|
|
15163
16152
|
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
15164
16153
|
);
|
|
15165
|
-
const updateRuntimeCapabilityPalette =
|
|
16154
|
+
const updateRuntimeCapabilityPalette = React49.useCallback(
|
|
15166
16155
|
(parts, selectionStart) => {
|
|
15167
16156
|
const input = composerInputRef.current;
|
|
15168
16157
|
const editingText = getComposerEditingText(parts);
|
|
@@ -15174,7 +16163,7 @@ function Chat({
|
|
|
15174
16163
|
},
|
|
15175
16164
|
[]
|
|
15176
16165
|
);
|
|
15177
|
-
const syncComposerInputFromElement =
|
|
16166
|
+
const syncComposerInputFromElement = React49.useCallback(
|
|
15178
16167
|
(input) => {
|
|
15179
16168
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
15180
16169
|
composerPartsRef.current
|
|
@@ -15192,25 +16181,25 @@ function Chat({
|
|
|
15192
16181
|
},
|
|
15193
16182
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
15194
16183
|
);
|
|
15195
|
-
const handleComposerInput =
|
|
16184
|
+
const handleComposerInput = React49.useCallback(
|
|
15196
16185
|
(event) => {
|
|
15197
16186
|
syncComposerInputFromElement(event.currentTarget);
|
|
15198
16187
|
},
|
|
15199
16188
|
[syncComposerInputFromElement]
|
|
15200
16189
|
);
|
|
15201
|
-
const handleComposerCompositionEnd =
|
|
16190
|
+
const handleComposerCompositionEnd = React49.useCallback(
|
|
15202
16191
|
(event) => {
|
|
15203
16192
|
syncComposerInputFromElement(event.currentTarget);
|
|
15204
16193
|
},
|
|
15205
16194
|
[syncComposerInputFromElement]
|
|
15206
16195
|
);
|
|
15207
|
-
const handleComposerSelect =
|
|
16196
|
+
const handleComposerSelect = React49.useCallback(() => {
|
|
15208
16197
|
updateRuntimeCapabilityPalette(
|
|
15209
16198
|
composerPartsRef.current,
|
|
15210
16199
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
15211
16200
|
);
|
|
15212
16201
|
}, [updateRuntimeCapabilityPalette]);
|
|
15213
|
-
const removeRunRuntimeCapability =
|
|
16202
|
+
const removeRunRuntimeCapability = React49.useCallback(
|
|
15214
16203
|
(option) => {
|
|
15215
16204
|
setRunRuntimeCapabilities(
|
|
15216
16205
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -15230,7 +16219,7 @@ function Chat({
|
|
|
15230
16219
|
},
|
|
15231
16220
|
[commitComposerParts]
|
|
15232
16221
|
);
|
|
15233
|
-
const submitDraft =
|
|
16222
|
+
const submitDraft = React49.useCallback(
|
|
15234
16223
|
(submitOptions = {}) => {
|
|
15235
16224
|
if (isSubmissionBlocked) return;
|
|
15236
16225
|
const contentToSubmit = (submitOptions.inputText ?? trimmedDraft).trim();
|
|
@@ -15353,7 +16342,7 @@ function Chat({
|
|
|
15353
16342
|
t
|
|
15354
16343
|
]
|
|
15355
16344
|
);
|
|
15356
|
-
const handleGoalCommand =
|
|
16345
|
+
const handleGoalCommand = React49.useCallback(
|
|
15357
16346
|
async ({
|
|
15358
16347
|
args,
|
|
15359
16348
|
commandSource,
|
|
@@ -15465,13 +16454,13 @@ function Chat({
|
|
|
15465
16454
|
t
|
|
15466
16455
|
]
|
|
15467
16456
|
);
|
|
15468
|
-
const handleGoalPanelOpenChange =
|
|
16457
|
+
const handleGoalPanelOpenChange = React49.useCallback(
|
|
15469
16458
|
(open) => {
|
|
15470
16459
|
setIsGoalPanelOpen(open);
|
|
15471
16460
|
},
|
|
15472
16461
|
[]
|
|
15473
16462
|
);
|
|
15474
|
-
const addRunRuntimeCapabilities =
|
|
16463
|
+
const addRunRuntimeCapabilities = React49.useCallback(
|
|
15475
16464
|
(selection) => {
|
|
15476
16465
|
setRunRuntimeCapabilities(
|
|
15477
16466
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -15483,7 +16472,7 @@ function Chat({
|
|
|
15483
16472
|
},
|
|
15484
16473
|
[runtimeCapabilities]
|
|
15485
16474
|
);
|
|
15486
|
-
const insertComposerCapabilityToken =
|
|
16475
|
+
const insertComposerCapabilityToken = React49.useCallback(
|
|
15487
16476
|
(capability, range) => {
|
|
15488
16477
|
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
15489
16478
|
const currentParts = composerPartsRef.current;
|
|
@@ -15556,7 +16545,7 @@ function Chat({
|
|
|
15556
16545
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
15557
16546
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
15558
16547
|
};
|
|
15559
|
-
|
|
16548
|
+
React49.useEffect(() => {
|
|
15560
16549
|
if (!runtimeCapabilityPalette) {
|
|
15561
16550
|
return;
|
|
15562
16551
|
}
|
|
@@ -15575,7 +16564,7 @@ function Chat({
|
|
|
15575
16564
|
);
|
|
15576
16565
|
}
|
|
15577
16566
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
15578
|
-
|
|
16567
|
+
React49.useLayoutEffect(() => {
|
|
15579
16568
|
if (!runtimeCapabilityPalette) {
|
|
15580
16569
|
return;
|
|
15581
16570
|
}
|
|
@@ -15592,7 +16581,7 @@ function Chat({
|
|
|
15592
16581
|
container.scrollTop += optionRect.bottom - containerRect.bottom;
|
|
15593
16582
|
}
|
|
15594
16583
|
}, [runtimeCapabilityPalette, slashPaletteOptions.length]);
|
|
15595
|
-
const submitGoalModeDraft =
|
|
16584
|
+
const submitGoalModeDraft = React49.useCallback(() => {
|
|
15596
16585
|
const objective = getComposerPlainText(composerPartsRef.current).trim();
|
|
15597
16586
|
if (!isGoalModeOpen || !goalCommandAvailable || !objective) {
|
|
15598
16587
|
return false;
|
|
@@ -15630,7 +16619,7 @@ function Chat({
|
|
|
15630
16619
|
}
|
|
15631
16620
|
submitDraft();
|
|
15632
16621
|
};
|
|
15633
|
-
const handleEditPendingFollowUp =
|
|
16622
|
+
const handleEditPendingFollowUp = React49.useCallback(
|
|
15634
16623
|
(id) => {
|
|
15635
16624
|
const item = pendingFollowUps.find(
|
|
15636
16625
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -15657,7 +16646,7 @@ function Chat({
|
|
|
15657
16646
|
},
|
|
15658
16647
|
[pendingFollowUps, setComposerText, stream]
|
|
15659
16648
|
);
|
|
15660
|
-
const handleQuoteSelection =
|
|
16649
|
+
const handleQuoteSelection = React49.useCallback(() => {
|
|
15661
16650
|
if (!quoteSelection) {
|
|
15662
16651
|
return;
|
|
15663
16652
|
}
|
|
@@ -15673,7 +16662,7 @@ function Chat({
|
|
|
15673
16662
|
const handleAttachmentClick = () => {
|
|
15674
16663
|
attachmentsRef.current?.openFilePicker();
|
|
15675
16664
|
};
|
|
15676
|
-
const uploadContextFile =
|
|
16665
|
+
const uploadContextFile = React49.useCallback(
|
|
15677
16666
|
(file) => {
|
|
15678
16667
|
const formData = new FormData();
|
|
15679
16668
|
formData.append("file", file, file.name || "upload");
|
|
@@ -15692,13 +16681,13 @@ function Chat({
|
|
|
15692
16681
|
},
|
|
15693
16682
|
[stream.assistantId, stream.client, stream.threadId]
|
|
15694
16683
|
);
|
|
15695
|
-
const getContextFileStatus =
|
|
16684
|
+
const getContextFileStatus = React49.useCallback(
|
|
15696
16685
|
(fileId) => stream.client.contexts.fetch(`/files/${fileId}/status`, {
|
|
15697
16686
|
method: "GET"
|
|
15698
16687
|
}),
|
|
15699
16688
|
[stream.client]
|
|
15700
16689
|
);
|
|
15701
|
-
const deleteContextFile =
|
|
16690
|
+
const deleteContextFile = React49.useCallback(
|
|
15702
16691
|
(storageFileId) => stream.client.contexts.deleteFile(storageFileId),
|
|
15703
16692
|
[stream.client]
|
|
15704
16693
|
);
|
|
@@ -15806,7 +16795,7 @@ function Chat({
|
|
|
15806
16795
|
}
|
|
15807
16796
|
submitDraft();
|
|
15808
16797
|
};
|
|
15809
|
-
const handleComposerPaste =
|
|
16798
|
+
const handleComposerPaste = React49.useCallback(
|
|
15810
16799
|
(event) => {
|
|
15811
16800
|
const clipboardData = event.clipboardData;
|
|
15812
16801
|
if (!clipboardData) {
|
|
@@ -15908,13 +16897,13 @@ function Chat({
|
|
|
15908
16897
|
const handleToolSelect = (tool) => {
|
|
15909
16898
|
setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
|
|
15910
16899
|
};
|
|
15911
|
-
const handlePromptClick =
|
|
16900
|
+
const handlePromptClick = React49.useCallback(
|
|
15912
16901
|
(prompt) => {
|
|
15913
16902
|
submitDraft({ inputText: prompt, displayText: prompt });
|
|
15914
16903
|
},
|
|
15915
16904
|
[submitDraft]
|
|
15916
16905
|
);
|
|
15917
|
-
const handlePromptEdit =
|
|
16906
|
+
const handlePromptEdit = React49.useCallback(
|
|
15918
16907
|
(prompt) => {
|
|
15919
16908
|
if (isPromptEditDisabled) return;
|
|
15920
16909
|
setComposerText(prompt, prompt.length);
|
|
@@ -15923,7 +16912,7 @@ function Chat({
|
|
|
15923
16912
|
},
|
|
15924
16913
|
[focusComposerAt, isPromptEditDisabled, setComposerText]
|
|
15925
16914
|
);
|
|
15926
|
-
const loadConversationMessages =
|
|
16915
|
+
const loadConversationMessages = React49.useCallback(
|
|
15927
16916
|
async (recordId) => {
|
|
15928
16917
|
if (missingConfig) {
|
|
15929
16918
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -15944,7 +16933,7 @@ function Chat({
|
|
|
15944
16933
|
},
|
|
15945
16934
|
[missingConfig, missingConfigShortMessage, stream, t]
|
|
15946
16935
|
);
|
|
15947
|
-
const handleLoadMoreMessages =
|
|
16936
|
+
const handleLoadMoreMessages = React49.useCallback(async () => {
|
|
15948
16937
|
if (!canLoadMoreMessages || isLoadingMoreMessages) {
|
|
15949
16938
|
return;
|
|
15950
16939
|
}
|
|
@@ -16053,15 +17042,15 @@ function Chat({
|
|
|
16053
17042
|
};
|
|
16054
17043
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
16055
17044
|
const canUploadDroppedFiles = composer?.attachments?.enabled === true && !missingConfig && !isHistoryLoading && !hasPendingInteractiveRequest;
|
|
16056
|
-
const handleDroppedFiles =
|
|
17045
|
+
const handleDroppedFiles = React49.useCallback((files) => {
|
|
16057
17046
|
return attachmentsRef.current?.queueFiles(files) ?? false;
|
|
16058
17047
|
}, []);
|
|
16059
|
-
const currentThread =
|
|
17048
|
+
const currentThread = React49.useMemo(
|
|
16060
17049
|
() => threads.find((item) => item.id === stream.threadId),
|
|
16061
17050
|
[threads, stream.threadId]
|
|
16062
17051
|
);
|
|
16063
17052
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
16064
|
-
const threadErrorMessage =
|
|
17053
|
+
const threadErrorMessage = React49.useMemo(() => {
|
|
16065
17054
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
16066
17055
|
if (currentThread?.status !== "error") return void 0;
|
|
16067
17056
|
const message = currentThread.error?.trim();
|
|
@@ -16092,7 +17081,7 @@ function Chat({
|
|
|
16092
17081
|
fallbackTitle: t("history.threadFallback")
|
|
16093
17082
|
});
|
|
16094
17083
|
const assistantTitle = assistantName || resolvedTitle;
|
|
16095
|
-
return /* @__PURE__ */ (0,
|
|
17084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16096
17085
|
UploadDroppedFiles,
|
|
16097
17086
|
{
|
|
16098
17087
|
ref: viewportRef,
|
|
@@ -16107,10 +17096,10 @@ function Chat({
|
|
|
16107
17096
|
className
|
|
16108
17097
|
),
|
|
16109
17098
|
children: [
|
|
16110
|
-
/* @__PURE__ */ (0,
|
|
16111
|
-
/* @__PURE__ */ (0,
|
|
16112
|
-
/* @__PURE__ */ (0,
|
|
16113
|
-
/* @__PURE__ */ (0,
|
|
17099
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
|
|
17100
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
17101
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "relative shrink-0", children: [
|
|
17102
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16114
17103
|
ChatkitAvatar,
|
|
16115
17104
|
{
|
|
16116
17105
|
avatar: assistantAvatar,
|
|
@@ -16118,10 +17107,10 @@ function Chat({
|
|
|
16118
17107
|
label: assistantTitle
|
|
16119
17108
|
}
|
|
16120
17109
|
),
|
|
16121
|
-
/* @__PURE__ */ (0,
|
|
17110
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
16122
17111
|
] }),
|
|
16123
|
-
/* @__PURE__ */ (0,
|
|
16124
|
-
/* @__PURE__ */ (0,
|
|
17112
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "truncate", children: [
|
|
17113
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16125
17114
|
"h2",
|
|
16126
17115
|
{
|
|
16127
17116
|
className: "text-lg font-semibold truncate",
|
|
@@ -16129,12 +17118,12 @@ function Chat({
|
|
|
16129
17118
|
children: assistantTitle
|
|
16130
17119
|
}
|
|
16131
17120
|
),
|
|
16132
|
-
/* @__PURE__ */ (0,
|
|
17121
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
16133
17122
|
] })
|
|
16134
17123
|
] }),
|
|
16135
|
-
/* @__PURE__ */ (0,
|
|
16136
|
-
canMinimizeToPet && /* @__PURE__ */ (0,
|
|
16137
|
-
/* @__PURE__ */ (0,
|
|
17124
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
17125
|
+
canMinimizeToPet && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17126
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16138
17127
|
"button",
|
|
16139
17128
|
{
|
|
16140
17129
|
type: "button",
|
|
@@ -16145,13 +17134,13 @@ function Chat({
|
|
|
16145
17134
|
"transition-colors duration-150"
|
|
16146
17135
|
),
|
|
16147
17136
|
"aria-label": t("chat.minimizeToPet"),
|
|
16148
|
-
children: /* @__PURE__ */ (0,
|
|
17137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Minus, { size: 16 })
|
|
16149
17138
|
}
|
|
16150
17139
|
) }) }),
|
|
16151
|
-
/* @__PURE__ */ (0,
|
|
17140
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
|
|
16152
17141
|
] }),
|
|
16153
|
-
/* @__PURE__ */ (0,
|
|
16154
|
-
/* @__PURE__ */ (0,
|
|
17142
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17143
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16155
17144
|
"button",
|
|
16156
17145
|
{
|
|
16157
17146
|
type: "button",
|
|
@@ -16162,14 +17151,14 @@ function Chat({
|
|
|
16162
17151
|
"transition-colors duration-150"
|
|
16163
17152
|
),
|
|
16164
17153
|
"aria-label": t("settings.open"),
|
|
16165
|
-
children: /* @__PURE__ */ (0,
|
|
17154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Settings, { size: 16 })
|
|
16166
17155
|
}
|
|
16167
17156
|
) }) }),
|
|
16168
|
-
/* @__PURE__ */ (0,
|
|
17157
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
16169
17158
|
] }),
|
|
16170
|
-
history?.enabled !== false && /* @__PURE__ */ (0,
|
|
16171
|
-
/* @__PURE__ */ (0,
|
|
16172
|
-
/* @__PURE__ */ (0,
|
|
17159
|
+
history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
17160
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17161
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16173
17162
|
"button",
|
|
16174
17163
|
{
|
|
16175
17164
|
type: "button",
|
|
@@ -16182,12 +17171,12 @@ function Chat({
|
|
|
16182
17171
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
16183
17172
|
),
|
|
16184
17173
|
"aria-label": t("history.newThread"),
|
|
16185
|
-
children: /* @__PURE__ */ (0,
|
|
17174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Pencil, { size: 16 })
|
|
16186
17175
|
}
|
|
16187
17176
|
) }) }),
|
|
16188
|
-
/* @__PURE__ */ (0,
|
|
17177
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
16189
17178
|
] }),
|
|
16190
|
-
/* @__PURE__ */ (0,
|
|
17179
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16191
17180
|
HistorySidebar,
|
|
16192
17181
|
{
|
|
16193
17182
|
threads,
|
|
@@ -16202,12 +17191,12 @@ function Chat({
|
|
|
16202
17191
|
] })
|
|
16203
17192
|
] })
|
|
16204
17193
|
] }),
|
|
16205
|
-
/* @__PURE__ */ (0,
|
|
16206
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
16207
|
-
historyError && /* @__PURE__ */ (0,
|
|
16208
|
-
showMissingConfig && /* @__PURE__ */ (0,
|
|
16209
|
-
isHistoryLoading && /* @__PURE__ */ (0,
|
|
16210
|
-
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0,
|
|
17194
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex-1 p-4", children: [
|
|
17195
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
17196
|
+
historyError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
|
|
17197
|
+
showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
|
|
17198
|
+
isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
17199
|
+
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16211
17200
|
StartScreen,
|
|
16212
17201
|
{
|
|
16213
17202
|
startScreen,
|
|
@@ -16216,10 +17205,10 @@ function Chat({
|
|
|
16216
17205
|
promptSendDisabled: isSubmissionBlocked,
|
|
16217
17206
|
promptEditDisabled: isPromptEditDisabled
|
|
16218
17207
|
}
|
|
16219
|
-
) : /* @__PURE__ */ (0,
|
|
16220
|
-
canLoadMoreMessages && /* @__PURE__ */ (0,
|
|
16221
|
-
/* @__PURE__ */ (0,
|
|
16222
|
-
/* @__PURE__ */ (0,
|
|
17208
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "space-y-4", children: [
|
|
17209
|
+
canLoadMoreMessages && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-3 py-1", children: [
|
|
17210
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" }),
|
|
17211
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16223
17212
|
Button,
|
|
16224
17213
|
{
|
|
16225
17214
|
type: "button",
|
|
@@ -16231,7 +17220,7 @@ function Chat({
|
|
|
16231
17220
|
children: isLoadingMoreMessages ? t("chat.loadingMoreMessages") : t("chat.loadMoreMessages")
|
|
16232
17221
|
}
|
|
16233
17222
|
),
|
|
16234
|
-
/* @__PURE__ */ (0,
|
|
17223
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-px min-w-8 flex-1 bg-border" })
|
|
16235
17224
|
] }),
|
|
16236
17225
|
messages.map((message, index) => {
|
|
16237
17226
|
const messageType = String(message.type);
|
|
@@ -16268,7 +17257,7 @@ function Chat({
|
|
|
16268
17257
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
16269
17258
|
return null;
|
|
16270
17259
|
}
|
|
16271
|
-
return /* @__PURE__ */ (0,
|
|
17260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16272
17261
|
"div",
|
|
16273
17262
|
{
|
|
16274
17263
|
className: cn(
|
|
@@ -16276,7 +17265,7 @@ function Chat({
|
|
|
16276
17265
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
16277
17266
|
// AI messages: slightly closer to left
|
|
16278
17267
|
),
|
|
16279
|
-
children: /* @__PURE__ */ (0,
|
|
17268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16280
17269
|
"div",
|
|
16281
17270
|
{
|
|
16282
17271
|
className: cn(
|
|
@@ -16284,7 +17273,7 @@ function Chat({
|
|
|
16284
17273
|
isAssistantMessage && "min-w-0 flex-1"
|
|
16285
17274
|
),
|
|
16286
17275
|
children: [
|
|
16287
|
-
/* @__PURE__ */ (0,
|
|
17276
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16288
17277
|
"div",
|
|
16289
17278
|
{
|
|
16290
17279
|
...canQuoteMessage ? {
|
|
@@ -16296,7 +17285,7 @@ function Chat({
|
|
|
16296
17285
|
message.type === "human" ? "bg-primary text-primary-foreground px-4 py-2.5" : message.type === "system" ? "bg-muted text-muted-foreground text-xs px-4 py-2.5" : "py-1 text-chat-foreground"
|
|
16297
17286
|
// AI messages: use chat-specific foreground color
|
|
16298
17287
|
),
|
|
16299
|
-
children: isAssistantMessage ? /* @__PURE__ */ (0,
|
|
17288
|
+
children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16300
17289
|
AssistantMessage,
|
|
16301
17290
|
{
|
|
16302
17291
|
message: {
|
|
@@ -16315,25 +17304,25 @@ function Chat({
|
|
|
16315
17304
|
organizationId: stream.organizationId,
|
|
16316
17305
|
apiUrl: stream.apiUrl
|
|
16317
17306
|
}
|
|
16318
|
-
) : /* @__PURE__ */ (0,
|
|
16319
|
-
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
17307
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
17308
|
+
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16320
17309
|
"span",
|
|
16321
17310
|
{
|
|
16322
17311
|
className: "inline-flex max-w-full items-center gap-1 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs font-medium text-primary-foreground",
|
|
16323
17312
|
children: [
|
|
16324
|
-
/* @__PURE__ */ (0,
|
|
17313
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16325
17314
|
RuntimeCapabilityIcon,
|
|
16326
17315
|
{
|
|
16327
17316
|
option,
|
|
16328
17317
|
variant: "chip"
|
|
16329
17318
|
}
|
|
16330
17319
|
),
|
|
16331
|
-
/* @__PURE__ */ (0,
|
|
17320
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
16332
17321
|
]
|
|
16333
17322
|
},
|
|
16334
17323
|
`${option.type}:${option.id}`
|
|
16335
17324
|
)) }),
|
|
16336
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0,
|
|
17325
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16337
17326
|
ReferenceChip,
|
|
16338
17327
|
{
|
|
16339
17328
|
reference,
|
|
@@ -16341,29 +17330,29 @@ function Chat({
|
|
|
16341
17330
|
},
|
|
16342
17331
|
getReferenceKey(reference)
|
|
16343
17332
|
)) }),
|
|
16344
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0,
|
|
17333
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16345
17334
|
"div",
|
|
16346
17335
|
{
|
|
16347
17336
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
16348
17337
|
children: [
|
|
16349
|
-
/* @__PURE__ */ (0,
|
|
16350
|
-
/* @__PURE__ */ (0,
|
|
17338
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.FileText, { size: 12 }),
|
|
17339
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
|
|
16351
17340
|
]
|
|
16352
17341
|
},
|
|
16353
17342
|
fileIndex
|
|
16354
17343
|
)) }),
|
|
16355
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0,
|
|
17344
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16356
17345
|
"p",
|
|
16357
17346
|
{
|
|
16358
17347
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
16359
17348
|
children: formatMessageContent(part)
|
|
16360
17349
|
},
|
|
16361
17350
|
`${part.type}-${partIndex}`
|
|
16362
|
-
)) : /* @__PURE__ */ (0,
|
|
17351
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
16363
17352
|
] })
|
|
16364
17353
|
}
|
|
16365
17354
|
),
|
|
16366
|
-
/* @__PURE__ */ (0,
|
|
17355
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16367
17356
|
MessageActions,
|
|
16368
17357
|
{
|
|
16369
17358
|
content: messageContent,
|
|
@@ -16401,7 +17390,7 @@ function Chat({
|
|
|
16401
17390
|
stream.isLoading,
|
|
16402
17391
|
{ now: streamingNow }
|
|
16403
17392
|
);
|
|
16404
|
-
return /* @__PURE__ */ (0,
|
|
17393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16405
17394
|
AssistantStreamingIndicator,
|
|
16406
17395
|
{
|
|
16407
17396
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -16410,7 +17399,7 @@ function Chat({
|
|
|
16410
17399
|
})()
|
|
16411
17400
|
] })
|
|
16412
17401
|
] }),
|
|
16413
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0,
|
|
17402
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16414
17403
|
Button,
|
|
16415
17404
|
{
|
|
16416
17405
|
type: "button",
|
|
@@ -16423,10 +17412,10 @@ function Chat({
|
|
|
16423
17412
|
onClick: () => scrollToBottom(true, true),
|
|
16424
17413
|
"aria-label": t("chat.scrollToBottom"),
|
|
16425
17414
|
title: t("chat.scrollToBottom"),
|
|
16426
|
-
children: /* @__PURE__ */ (0,
|
|
17415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.ArrowDown, { size: 16 })
|
|
16427
17416
|
}
|
|
16428
17417
|
) }),
|
|
16429
|
-
quoteSelection && /* @__PURE__ */ (0,
|
|
17418
|
+
quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16430
17419
|
"div",
|
|
16431
17420
|
{
|
|
16432
17421
|
className: "pointer-events-none fixed z-50",
|
|
@@ -16435,7 +17424,7 @@ function Chat({
|
|
|
16435
17424
|
left: `${quoteSelection.left}px`,
|
|
16436
17425
|
transform: "translateX(-50%)"
|
|
16437
17426
|
},
|
|
16438
|
-
children: /* @__PURE__ */ (0,
|
|
17427
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16439
17428
|
Button,
|
|
16440
17429
|
{
|
|
16441
17430
|
type: "button",
|
|
@@ -16447,16 +17436,16 @@ function Chat({
|
|
|
16447
17436
|
"aria-label": t("composer.quoteSelection"),
|
|
16448
17437
|
title: t("composer.quoteSelection"),
|
|
16449
17438
|
children: [
|
|
16450
|
-
/* @__PURE__ */ (0,
|
|
17439
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Quote, { size: 14 }),
|
|
16451
17440
|
t("composer.quoteSelection")
|
|
16452
17441
|
]
|
|
16453
17442
|
}
|
|
16454
17443
|
)
|
|
16455
17444
|
}
|
|
16456
17445
|
),
|
|
16457
|
-
/* @__PURE__ */ (0,
|
|
16458
|
-
threadErrorMessage && /* @__PURE__ */ (0,
|
|
16459
|
-
/* @__PURE__ */ (0,
|
|
17446
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
|
|
17447
|
+
threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive overflow-auto", children: threadErrorMessage }),
|
|
17448
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16460
17449
|
ChatAttachments,
|
|
16461
17450
|
{
|
|
16462
17451
|
ref: attachmentsRef,
|
|
@@ -16470,7 +17459,7 @@ function Chat({
|
|
|
16470
17459
|
onStateChange: setAttachmentState
|
|
16471
17460
|
}
|
|
16472
17461
|
),
|
|
16473
|
-
references.length > 0 && /* @__PURE__ */ (0,
|
|
17462
|
+
references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16474
17463
|
ReferenceChip,
|
|
16475
17464
|
{
|
|
16476
17465
|
reference,
|
|
@@ -16484,16 +17473,16 @@ function Chat({
|
|
|
16484
17473
|
},
|
|
16485
17474
|
getReferenceKey(reference)
|
|
16486
17475
|
)) }),
|
|
16487
|
-
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0,
|
|
16488
|
-
/* @__PURE__ */ (0,
|
|
16489
|
-
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0,
|
|
17476
|
+
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
17477
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
|
|
17478
|
+
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16490
17479
|
"span",
|
|
16491
17480
|
{
|
|
16492
17481
|
className: "inline-flex max-w-full items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",
|
|
16493
17482
|
children: [
|
|
16494
|
-
/* @__PURE__ */ (0,
|
|
16495
|
-
/* @__PURE__ */ (0,
|
|
16496
|
-
/* @__PURE__ */ (0,
|
|
17483
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
17484
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-40 truncate", children: option.label }),
|
|
17485
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16497
17486
|
"button",
|
|
16498
17487
|
{
|
|
16499
17488
|
type: "button",
|
|
@@ -16501,7 +17490,7 @@ function Chat({
|
|
|
16501
17490
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
16502
17491
|
title: t("composer.capabilities.removeRunCapability"),
|
|
16503
17492
|
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
16504
|
-
children: /* @__PURE__ */ (0,
|
|
17493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 11 })
|
|
16505
17494
|
}
|
|
16506
17495
|
)
|
|
16507
17496
|
]
|
|
@@ -16509,7 +17498,7 @@ function Chat({
|
|
|
16509
17498
|
`${option.type}:${option.id}`
|
|
16510
17499
|
))
|
|
16511
17500
|
] }),
|
|
16512
|
-
showGoalStatus && /* @__PURE__ */ (0,
|
|
17501
|
+
showGoalStatus && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16513
17502
|
"div",
|
|
16514
17503
|
{
|
|
16515
17504
|
className: cn(
|
|
@@ -16517,8 +17506,8 @@ function Chat({
|
|
|
16517
17506
|
isGoalObjectiveExpanded ? "items-start" : "items-center"
|
|
16518
17507
|
),
|
|
16519
17508
|
children: [
|
|
16520
|
-
/* @__PURE__ */ (0,
|
|
16521
|
-
|
|
17509
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
17510
|
+
import_lucide_react29.Target,
|
|
16522
17511
|
{
|
|
16523
17512
|
className: cn(
|
|
16524
17513
|
"size-4 shrink-0 text-muted-foreground",
|
|
@@ -16526,13 +17515,13 @@ function Chat({
|
|
|
16526
17515
|
)
|
|
16527
17516
|
}
|
|
16528
17517
|
),
|
|
16529
|
-
/* @__PURE__ */ (0,
|
|
16530
|
-
/* @__PURE__ */ (0,
|
|
16531
|
-
/* @__PURE__ */ (0,
|
|
16532
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
16533
|
-
isGoalLoading && /* @__PURE__ */ (0,
|
|
17518
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
17519
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
17520
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-medium", children: t("chat.goal.label") }),
|
|
17521
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground", children: t(`chat.goal.status.${threadGoal.status}`) }),
|
|
17522
|
+
isGoalLoading && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Loader2, { className: "size-3 animate-spin text-muted-foreground" })
|
|
16534
17523
|
] }),
|
|
16535
|
-
/* @__PURE__ */ (0,
|
|
17524
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16536
17525
|
"div",
|
|
16537
17526
|
{
|
|
16538
17527
|
className: cn(
|
|
@@ -16542,13 +17531,13 @@ function Chat({
|
|
|
16542
17531
|
children: goalError || threadGoal?.objective
|
|
16543
17532
|
}
|
|
16544
17533
|
),
|
|
16545
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
17534
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: t("chat.goal.elapsed", {
|
|
16546
17535
|
elapsed: formatGoalElapsed(displayedGoalElapsedSeconds)
|
|
16547
17536
|
}) }) })
|
|
16548
17537
|
] }),
|
|
16549
|
-
threadGoal && /* @__PURE__ */ (0,
|
|
16550
|
-
/* @__PURE__ */ (0,
|
|
16551
|
-
/* @__PURE__ */ (0,
|
|
17538
|
+
threadGoal && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
17539
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17540
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16552
17541
|
Button,
|
|
16553
17542
|
{
|
|
16554
17543
|
type: "button",
|
|
@@ -16559,13 +17548,13 @@ function Chat({
|
|
|
16559
17548
|
const prefix = "/goal edit ";
|
|
16560
17549
|
setComposerText(`${prefix}${threadGoal.objective}`);
|
|
16561
17550
|
},
|
|
16562
|
-
children: /* @__PURE__ */ (0,
|
|
17551
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Pencil, { className: "size-3" })
|
|
16563
17552
|
}
|
|
16564
17553
|
) }),
|
|
16565
|
-
/* @__PURE__ */ (0,
|
|
17554
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: t("chat.goal.edit") })
|
|
16566
17555
|
] }),
|
|
16567
|
-
/* @__PURE__ */ (0,
|
|
16568
|
-
/* @__PURE__ */ (0,
|
|
17556
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17557
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16569
17558
|
Button,
|
|
16570
17559
|
{
|
|
16571
17560
|
type: "button",
|
|
@@ -16581,13 +17570,13 @@ function Chat({
|
|
|
16581
17570
|
executionType: "insert_invocation"
|
|
16582
17571
|
}
|
|
16583
17572
|
}),
|
|
16584
|
-
children: threadGoal.status === "paused" ? /* @__PURE__ */ (0,
|
|
17573
|
+
children: threadGoal.status === "paused" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Play, { className: "size-3" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Pause, { className: "size-3" })
|
|
16585
17574
|
}
|
|
16586
17575
|
) }),
|
|
16587
|
-
/* @__PURE__ */ (0,
|
|
17576
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
|
|
16588
17577
|
] }),
|
|
16589
|
-
/* @__PURE__ */ (0,
|
|
16590
|
-
/* @__PURE__ */ (0,
|
|
17578
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17579
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16591
17580
|
Button,
|
|
16592
17581
|
{
|
|
16593
17582
|
type: "button",
|
|
@@ -16603,13 +17592,13 @@ function Chat({
|
|
|
16603
17592
|
executionType: "insert_invocation"
|
|
16604
17593
|
}
|
|
16605
17594
|
}),
|
|
16606
|
-
children: /* @__PURE__ */ (0,
|
|
17595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.Trash2, { className: "size-3" })
|
|
16607
17596
|
}
|
|
16608
17597
|
) }),
|
|
16609
|
-
/* @__PURE__ */ (0,
|
|
17598
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: t("chat.goal.clear") })
|
|
16610
17599
|
] }),
|
|
16611
|
-
threadGoal.objective && !goalError && /* @__PURE__ */ (0,
|
|
16612
|
-
/* @__PURE__ */ (0,
|
|
17600
|
+
threadGoal.objective && !goalError && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { children: [
|
|
17601
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16613
17602
|
Button,
|
|
16614
17603
|
{
|
|
16615
17604
|
type: "button",
|
|
@@ -16618,8 +17607,8 @@ function Chat({
|
|
|
16618
17607
|
"aria-expanded": isGoalObjectiveExpanded,
|
|
16619
17608
|
"aria-label": isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective"),
|
|
16620
17609
|
onClick: () => setIsGoalObjectiveExpanded((expanded) => !expanded),
|
|
16621
|
-
children: /* @__PURE__ */ (0,
|
|
16622
|
-
|
|
17610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
17611
|
+
import_lucide_react29.ChevronDown,
|
|
16623
17612
|
{
|
|
16624
17613
|
className: cn(
|
|
16625
17614
|
"size-3 transition-transform",
|
|
@@ -16629,13 +17618,13 @@ function Chat({
|
|
|
16629
17618
|
)
|
|
16630
17619
|
}
|
|
16631
17620
|
) }),
|
|
16632
|
-
/* @__PURE__ */ (0,
|
|
17621
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
|
|
16633
17622
|
] })
|
|
16634
17623
|
] })
|
|
16635
17624
|
]
|
|
16636
17625
|
}
|
|
16637
17626
|
),
|
|
16638
|
-
/* @__PURE__ */ (0,
|
|
17627
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16639
17628
|
PendingRuntimeServices,
|
|
16640
17629
|
{
|
|
16641
17630
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -16644,7 +17633,7 @@ function Chat({
|
|
|
16644
17633
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
16645
17634
|
}
|
|
16646
17635
|
),
|
|
16647
|
-
/* @__PURE__ */ (0,
|
|
17636
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16648
17637
|
PendingTodos,
|
|
16649
17638
|
{
|
|
16650
17639
|
snapshot: stream.todos,
|
|
@@ -16652,7 +17641,7 @@ function Chat({
|
|
|
16652
17641
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
16653
17642
|
}
|
|
16654
17643
|
),
|
|
16655
|
-
/* @__PURE__ */ (0,
|
|
17644
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16656
17645
|
PendingFollowUps,
|
|
16657
17646
|
{
|
|
16658
17647
|
items: pendingFollowUps,
|
|
@@ -16665,7 +17654,7 @@ function Chat({
|
|
|
16665
17654
|
attachToComposer: true
|
|
16666
17655
|
}
|
|
16667
17656
|
),
|
|
16668
|
-
/* @__PURE__ */ (0,
|
|
17657
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16669
17658
|
RequestUserInputPanel,
|
|
16670
17659
|
{
|
|
16671
17660
|
request: stream.pendingRequestUserInput,
|
|
@@ -16674,7 +17663,7 @@ function Chat({
|
|
|
16674
17663
|
attachToComposer: true
|
|
16675
17664
|
}
|
|
16676
17665
|
),
|
|
16677
|
-
/* @__PURE__ */ (0,
|
|
17666
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16678
17667
|
HITLApprovalPanel,
|
|
16679
17668
|
{
|
|
16680
17669
|
request: stream.pendingHITLRequest,
|
|
@@ -16683,7 +17672,7 @@ function Chat({
|
|
|
16683
17672
|
attachToComposer: true
|
|
16684
17673
|
}
|
|
16685
17674
|
),
|
|
16686
|
-
runtimeCapabilityPalette && /* @__PURE__ */ (0,
|
|
17675
|
+
runtimeCapabilityPalette && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16687
17676
|
SlashPalette,
|
|
16688
17677
|
{
|
|
16689
17678
|
palette: runtimeCapabilityPalette,
|
|
@@ -16697,7 +17686,7 @@ function Chat({
|
|
|
16697
17686
|
onSelect: selectSlashPaletteOption
|
|
16698
17687
|
}
|
|
16699
17688
|
),
|
|
16700
|
-
/* @__PURE__ */ (0,
|
|
17689
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16701
17690
|
"div",
|
|
16702
17691
|
{
|
|
16703
17692
|
"data-slot": "composer-input-shell",
|
|
@@ -16711,7 +17700,7 @@ function Chat({
|
|
|
16711
17700
|
composerInputRoundedClass
|
|
16712
17701
|
),
|
|
16713
17702
|
children: [
|
|
16714
|
-
/* @__PURE__ */ (0,
|
|
17703
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16715
17704
|
"div",
|
|
16716
17705
|
{
|
|
16717
17706
|
ref: composerInputRef,
|
|
@@ -16733,7 +17722,7 @@ function Chat({
|
|
|
16733
17722
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
16734
17723
|
),
|
|
16735
17724
|
children: renderedComposerParts.map(
|
|
16736
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */ (0,
|
|
17725
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(React49.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16737
17726
|
"span",
|
|
16738
17727
|
{
|
|
16739
17728
|
"data-composer-capability-key": part.key,
|
|
@@ -16742,14 +17731,14 @@ function Chat({
|
|
|
16742
17731
|
contentEditable: false,
|
|
16743
17732
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
16744
17733
|
children: [
|
|
16745
|
-
/* @__PURE__ */ (0,
|
|
17734
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16746
17735
|
RuntimeCapabilityIcon,
|
|
16747
17736
|
{
|
|
16748
17737
|
option: part.capability,
|
|
16749
17738
|
variant: "chip"
|
|
16750
17739
|
}
|
|
16751
17740
|
),
|
|
16752
|
-
/* @__PURE__ */ (0,
|
|
17741
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate", children: part.capability.label })
|
|
16753
17742
|
]
|
|
16754
17743
|
},
|
|
16755
17744
|
part.key
|
|
@@ -16758,14 +17747,14 @@ function Chat({
|
|
|
16758
17747
|
},
|
|
16759
17748
|
composerDomVersion
|
|
16760
17749
|
),
|
|
16761
|
-
/* @__PURE__ */ (0,
|
|
17750
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16762
17751
|
"div",
|
|
16763
17752
|
{
|
|
16764
17753
|
"data-slot": "composer-action-bar",
|
|
16765
17754
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
16766
17755
|
children: [
|
|
16767
|
-
/* @__PURE__ */ (0,
|
|
16768
|
-
/* @__PURE__ */ (0,
|
|
17756
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
17757
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16769
17758
|
ComposerMenu,
|
|
16770
17759
|
{
|
|
16771
17760
|
composer,
|
|
@@ -16783,20 +17772,20 @@ function Chat({
|
|
|
16783
17772
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
16784
17773
|
}
|
|
16785
17774
|
) }),
|
|
16786
|
-
selectedTool && /* @__PURE__ */ (0,
|
|
16787
|
-
/* @__PURE__ */ (0,
|
|
16788
|
-
/* @__PURE__ */ (0,
|
|
17775
|
+
selectedTool && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "pointer-events-auto inline-flex h-8 min-w-0 max-w-[14rem] shrink items-center gap-1.5 rounded-full bg-primary/10 px-2 text-xs font-medium text-primary transition-all duration-200", children: [
|
|
17776
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
17777
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16789
17778
|
"button",
|
|
16790
17779
|
{
|
|
16791
17780
|
type: "button",
|
|
16792
17781
|
onClick: () => setSelectedTool(null),
|
|
16793
17782
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
16794
|
-
children: /* @__PURE__ */ (0,
|
|
17783
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react29.X, { size: 12 })
|
|
16795
17784
|
}
|
|
16796
17785
|
)
|
|
16797
17786
|
] })
|
|
16798
17787
|
] }),
|
|
16799
|
-
/* @__PURE__ */ (0,
|
|
17788
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16800
17789
|
SendButton,
|
|
16801
17790
|
{
|
|
16802
17791
|
disabled: isSendDisabled,
|
|
@@ -16819,7 +17808,7 @@ function Chat({
|
|
|
16819
17808
|
]
|
|
16820
17809
|
}
|
|
16821
17810
|
) }),
|
|
16822
|
-
disclaimer?.text && /* @__PURE__ */ (0,
|
|
17811
|
+
disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16823
17812
|
"p",
|
|
16824
17813
|
{
|
|
16825
17814
|
className: cn(
|
|
@@ -16829,12 +17818,12 @@ function Chat({
|
|
|
16829
17818
|
children: disclaimer.text
|
|
16830
17819
|
}
|
|
16831
17820
|
),
|
|
16832
|
-
/* @__PURE__ */ (0,
|
|
16833
|
-
/* @__PURE__ */ (0,
|
|
16834
|
-
/* @__PURE__ */ (0,
|
|
17821
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
17822
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: t("chat.poweredBy") }),
|
|
17823
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
|
|
16835
17824
|
] })
|
|
16836
17825
|
] }),
|
|
16837
|
-
/* @__PURE__ */ (0,
|
|
17826
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16838
17827
|
SettingsSheet,
|
|
16839
17828
|
{
|
|
16840
17829
|
open: petSettingsOpen,
|
|
@@ -16844,17 +17833,17 @@ function Chat({
|
|
|
16844
17833
|
onSave: savePetLocalSettings
|
|
16845
17834
|
}
|
|
16846
17835
|
),
|
|
16847
|
-
/* @__PURE__ */ (0,
|
|
17836
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
16848
17837
|
]
|
|
16849
17838
|
}
|
|
16850
17839
|
);
|
|
16851
17840
|
}
|
|
16852
17841
|
|
|
16853
17842
|
// src/components/ui/separator.tsx
|
|
16854
|
-
var
|
|
16855
|
-
var
|
|
16856
|
-
var Separator =
|
|
16857
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0,
|
|
17843
|
+
var React50 = __toESM(require("react"), 1);
|
|
17844
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
17845
|
+
var Separator = React50.forwardRef(
|
|
17846
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
16858
17847
|
"div",
|
|
16859
17848
|
{
|
|
16860
17849
|
ref,
|