@waniwani/sdk 0.19.9 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/embed.js +1 -1
- package/dist/chat/index.d.ts +2 -28
- package/dist/chat/index.js +8 -15
- package/dist/chat/index.js.map +1 -1
- package/dist/chat/styles.css +1 -1
- package/dist/mcp/index.d.ts +18 -443
- package/dist/mcp/index.js +5 -5
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/react.d.ts +1 -645
- package/dist/mcp/react.js +1 -66
- package/dist/mcp/react.js.map +1 -1
- package/package.json +1 -41
- package/dist/abap-3IAGZ3PS.js +0 -2
- package/dist/abap-3IAGZ3PS.js.map +0 -1
- package/dist/actionscript-3-C46RIPM4.js +0 -2
- package/dist/actionscript-3-C46RIPM4.js.map +0 -1
- package/dist/ada-DNTYS66P.js +0 -2
- package/dist/ada-DNTYS66P.js.map +0 -1
- package/dist/andromeeda-XSK3JERF.js +0 -2
- package/dist/andromeeda-XSK3JERF.js.map +0 -1
- package/dist/angular-html-GK625GFM.js +0 -2
- package/dist/angular-html-GK625GFM.js.map +0 -1
- package/dist/angular-ts-BBPQXDS2.js +0 -2
- package/dist/angular-ts-BBPQXDS2.js.map +0 -1
- package/dist/apache-DU26FTNI.js +0 -2
- package/dist/apache-DU26FTNI.js.map +0 -1
- package/dist/apex-OU63AG2P.js +0 -2
- package/dist/apex-OU63AG2P.js.map +0 -1
- package/dist/apl-JGB4KP74.js +0 -2
- package/dist/apl-JGB4KP74.js.map +0 -1
- package/dist/applescript-TT4XSRXH.js +0 -2
- package/dist/applescript-TT4XSRXH.js.map +0 -1
- package/dist/ara-Q7AJDKA4.js +0 -2
- package/dist/ara-Q7AJDKA4.js.map +0 -1
- package/dist/asciidoc-WADBFJPS.js +0 -2
- package/dist/asciidoc-WADBFJPS.js.map +0 -1
- package/dist/asm-D3LJR7GV.js +0 -2
- package/dist/asm-D3LJR7GV.js.map +0 -1
- package/dist/astro-K7JGTCPV.js +0 -2
- package/dist/astro-K7JGTCPV.js.map +0 -1
- package/dist/aurora-x-CGSVHL4H.js +0 -2
- package/dist/aurora-x-CGSVHL4H.js.map +0 -1
- package/dist/awk-DCAM52A7.js +0 -2
- package/dist/awk-DCAM52A7.js.map +0 -1
- package/dist/ayu-dark-XYI57HMC.js +0 -2
- package/dist/ayu-dark-XYI57HMC.js.map +0 -1
- package/dist/ayu-light-4PSGMDIC.js +0 -2
- package/dist/ayu-light-4PSGMDIC.js.map +0 -1
- package/dist/ayu-mirage-DU5SNMZX.js +0 -2
- package/dist/ayu-mirage-DU5SNMZX.js.map +0 -1
- package/dist/ballerina-44XARFEK.js +0 -2
- package/dist/ballerina-44XARFEK.js.map +0 -1
- package/dist/bat-WM4RL2AB.js +0 -2
- package/dist/bat-WM4RL2AB.js.map +0 -1
- package/dist/beancount-5PUWGPVT.js +0 -2
- package/dist/beancount-5PUWGPVT.js.map +0 -1
- package/dist/berry-YAK4XTWX.js +0 -2
- package/dist/berry-YAK4XTWX.js.map +0 -1
- package/dist/bibtex-2ISWNMJJ.js +0 -2
- package/dist/bibtex-2ISWNMJJ.js.map +0 -1
- package/dist/bicep-EOACOM4G.js +0 -2
- package/dist/bicep-EOACOM4G.js.map +0 -1
- package/dist/blade-RWJJQSLU.js +0 -2
- package/dist/blade-RWJJQSLU.js.map +0 -1
- package/dist/bsl-TNLQPNE3.js +0 -2
- package/dist/bsl-TNLQPNE3.js.map +0 -1
- package/dist/c-G7V525MX.js +0 -2
- package/dist/c-G7V525MX.js.map +0 -1
- package/dist/c3-CDQIRWGP.js +0 -2
- package/dist/c3-CDQIRWGP.js.map +0 -1
- package/dist/cadence-U32GKKTR.js +0 -2
- package/dist/cadence-U32GKKTR.js.map +0 -1
- package/dist/cairo-26RR6N4F.js +0 -2
- package/dist/cairo-26RR6N4F.js.map +0 -1
- package/dist/catppuccin-frappe-UZ4N3Z4I.js +0 -2
- package/dist/catppuccin-frappe-UZ4N3Z4I.js.map +0 -1
- package/dist/catppuccin-latte-GCOWYLZG.js +0 -2
- package/dist/catppuccin-latte-GCOWYLZG.js.map +0 -1
- package/dist/catppuccin-macchiato-PJD7W5WJ.js +0 -2
- package/dist/catppuccin-macchiato-PJD7W5WJ.js.map +0 -1
- package/dist/catppuccin-mocha-RRH4FOBS.js +0 -2
- package/dist/catppuccin-mocha-RRH4FOBS.js.map +0 -1
- package/dist/chat/express-js/index.d.ts +0 -551
- package/dist/chat/express-js/index.js +0 -10
- package/dist/chat/express-js/index.js.map +0 -1
- package/dist/chat/next-js/index.d.ts +0 -512
- package/dist/chat/next-js/index.js +0 -10
- package/dist/chat/next-js/index.js.map +0 -1
- package/dist/chat/server/index.d.ts +0 -145
- package/dist/chat/server/index.js +0 -2
- package/dist/chat/server/index.js.map +0 -1
- package/dist/chunk-2JA3PUM5.js +0 -2
- package/dist/chunk-2JA3PUM5.js.map +0 -1
- package/dist/chunk-2NQMCQ7O.js +0 -2
- package/dist/chunk-2NQMCQ7O.js.map +0 -1
- package/dist/chunk-5336KK5F.js +0 -2
- package/dist/chunk-5336KK5F.js.map +0 -1
- package/dist/chunk-5MP5AWBX.js +0 -2
- package/dist/chunk-5MP5AWBX.js.map +0 -1
- package/dist/chunk-5XSU7WGG.js +0 -2
- package/dist/chunk-5XSU7WGG.js.map +0 -1
- package/dist/chunk-5XYD2WP7.js +0 -2
- package/dist/chunk-5XYD2WP7.js.map +0 -1
- package/dist/chunk-6HXHFO4V.js +0 -2
- package/dist/chunk-6HXHFO4V.js.map +0 -1
- package/dist/chunk-6NKC4ZWB.js +0 -2
- package/dist/chunk-6NKC4ZWB.js.map +0 -1
- package/dist/chunk-6NZAGCJE.js +0 -2
- package/dist/chunk-6NZAGCJE.js.map +0 -1
- package/dist/chunk-ATNVRAQT.js +0 -2
- package/dist/chunk-ATNVRAQT.js.map +0 -1
- package/dist/chunk-CESPFCBH.js +0 -2
- package/dist/chunk-CESPFCBH.js.map +0 -1
- package/dist/chunk-D622GSMB.js +0 -2
- package/dist/chunk-D622GSMB.js.map +0 -1
- package/dist/chunk-DP6SAQTK.js +0 -3
- package/dist/chunk-DP6SAQTK.js.map +0 -1
- package/dist/chunk-EDNJDK7E.js +0 -2
- package/dist/chunk-EDNJDK7E.js.map +0 -1
- package/dist/chunk-EIMGOVMA.js +0 -2
- package/dist/chunk-EIMGOVMA.js.map +0 -1
- package/dist/chunk-F5JZ4PC2.js +0 -2
- package/dist/chunk-F5JZ4PC2.js.map +0 -1
- package/dist/chunk-GMELQP3T.js +0 -2
- package/dist/chunk-GMELQP3T.js.map +0 -1
- package/dist/chunk-HFFYDWFN.js +0 -2
- package/dist/chunk-HFFYDWFN.js.map +0 -1
- package/dist/chunk-IL2UKTRC.js +0 -2
- package/dist/chunk-IL2UKTRC.js.map +0 -1
- package/dist/chunk-IPSY5OIT.js +0 -2
- package/dist/chunk-IPSY5OIT.js.map +0 -1
- package/dist/chunk-IRS2AGXK.js +0 -2
- package/dist/chunk-IRS2AGXK.js.map +0 -1
- package/dist/chunk-L4BGOZXV.js +0 -2
- package/dist/chunk-L4BGOZXV.js.map +0 -1
- package/dist/chunk-LAG2OMSH.js +0 -2
- package/dist/chunk-LAG2OMSH.js.map +0 -1
- package/dist/chunk-LMG77D32.js +0 -2
- package/dist/chunk-LMG77D32.js.map +0 -1
- package/dist/chunk-LPD7BHH5.js +0 -2
- package/dist/chunk-LPD7BHH5.js.map +0 -1
- package/dist/chunk-MLY24DR2.js +0 -2
- package/dist/chunk-MLY24DR2.js.map +0 -1
- package/dist/chunk-NE26G5AT.js +0 -2
- package/dist/chunk-NE26G5AT.js.map +0 -1
- package/dist/chunk-OHRY6PPX.js +0 -2
- package/dist/chunk-OHRY6PPX.js.map +0 -1
- package/dist/chunk-OJQVGZV3.js +0 -2
- package/dist/chunk-OJQVGZV3.js.map +0 -1
- package/dist/chunk-ORTYTFGK.js +0 -2
- package/dist/chunk-ORTYTFGK.js.map +0 -1
- package/dist/chunk-P7NSD3M4.js +0 -2
- package/dist/chunk-P7NSD3M4.js.map +0 -1
- package/dist/chunk-PXEOO2Q3.js +0 -2
- package/dist/chunk-PXEOO2Q3.js.map +0 -1
- package/dist/chunk-PYLRF5BB.js +0 -8
- package/dist/chunk-PYLRF5BB.js.map +0 -1
- package/dist/chunk-QP24BTOT.js +0 -2
- package/dist/chunk-QP24BTOT.js.map +0 -1
- package/dist/chunk-R6LESDWJ.js +0 -2
- package/dist/chunk-R6LESDWJ.js.map +0 -1
- package/dist/chunk-REK5PMSH.js +0 -2
- package/dist/chunk-REK5PMSH.js.map +0 -1
- package/dist/chunk-RXLAF3LU.js +0 -2
- package/dist/chunk-RXLAF3LU.js.map +0 -1
- package/dist/chunk-RZKVTH7F.js +0 -9
- package/dist/chunk-RZKVTH7F.js.map +0 -1
- package/dist/chunk-S2PPVC2B.js +0 -2
- package/dist/chunk-S2PPVC2B.js.map +0 -1
- package/dist/chunk-SREBMPDB.js +0 -2
- package/dist/chunk-SREBMPDB.js.map +0 -1
- package/dist/chunk-VDGF5EL2.js +0 -2
- package/dist/chunk-VDGF5EL2.js.map +0 -1
- package/dist/chunk-W22LK3TM.js +0 -2
- package/dist/chunk-W22LK3TM.js.map +0 -1
- package/dist/chunk-W4SPRY5O.js +0 -2
- package/dist/chunk-W4SPRY5O.js.map +0 -1
- package/dist/chunk-WJGP36CH.js +0 -2
- package/dist/chunk-WJGP36CH.js.map +0 -1
- package/dist/chunk-YGW7RGXA.js +0 -2
- package/dist/chunk-YGW7RGXA.js.map +0 -1
- package/dist/chunk-YJSOBBUY.js +0 -2
- package/dist/chunk-YJSOBBUY.js.map +0 -1
- package/dist/chunk-YP6YTC7R.js +0 -115
- package/dist/chunk-YP6YTC7R.js.map +0 -1
- package/dist/chunk-YTXGYW4C.js +0 -2
- package/dist/chunk-YTXGYW4C.js.map +0 -1
- package/dist/chunk-Z7GLL6ID.js +0 -2
- package/dist/chunk-Z7GLL6ID.js.map +0 -1
- package/dist/clarity-4JIHRN2V.js +0 -2
- package/dist/clarity-4JIHRN2V.js.map +0 -1
- package/dist/clojure-PKTTXYYS.js +0 -2
- package/dist/clojure-PKTTXYYS.js.map +0 -1
- package/dist/cmake-HXKHWGGH.js +0 -2
- package/dist/cmake-HXKHWGGH.js.map +0 -1
- package/dist/cobol-ZFZ6ZP6X.js +0 -2
- package/dist/cobol-ZFZ6ZP6X.js.map +0 -1
- package/dist/code-block-37QAKDTI-Y3BUEJRG.js +0 -3
- package/dist/code-block-37QAKDTI-Y3BUEJRG.js.map +0 -1
- package/dist/codeowners-WCXRHQ2R.js +0 -2
- package/dist/codeowners-WCXRHQ2R.js.map +0 -1
- package/dist/codeql-XZZ2USHF.js +0 -2
- package/dist/codeql-XZZ2USHF.js.map +0 -1
- package/dist/coffee-SGQWHBUL.js +0 -2
- package/dist/coffee-SGQWHBUL.js.map +0 -1
- package/dist/common-lisp-IK3DGBCK.js +0 -2
- package/dist/common-lisp-IK3DGBCK.js.map +0 -1
- package/dist/coq-UPTUVPLH.js +0 -2
- package/dist/coq-UPTUVPLH.js.map +0 -1
- package/dist/cpp-HLYUQ6RF.js +0 -2
- package/dist/cpp-HLYUQ6RF.js.map +0 -1
- package/dist/crystal-UPNOBGN4.js +0 -2
- package/dist/crystal-UPNOBGN4.js.map +0 -1
- package/dist/csharp-6EXQ7B24.js +0 -2
- package/dist/csharp-6EXQ7B24.js.map +0 -1
- package/dist/css-MH4LSMNV.js +0 -2
- package/dist/css-MH4LSMNV.js.map +0 -1
- package/dist/csv-CRTD5FOL.js +0 -2
- package/dist/csv-CRTD5FOL.js.map +0 -1
- package/dist/cue-IFMTDLM2.js +0 -2
- package/dist/cue-IFMTDLM2.js.map +0 -1
- package/dist/cypher-WH7754G7.js +0 -2
- package/dist/cypher-WH7754G7.js.map +0 -1
- package/dist/d-VFMGCSG3.js +0 -2
- package/dist/d-VFMGCSG3.js.map +0 -1
- package/dist/dark-plus-PSM5XP2I.js +0 -2
- package/dist/dark-plus-PSM5XP2I.js.map +0 -1
- package/dist/dart-CSERBUPM.js +0 -2
- package/dist/dart-CSERBUPM.js.map +0 -1
- package/dist/dax-Y4DTPR3K.js +0 -2
- package/dist/dax-Y4DTPR3K.js.map +0 -1
- package/dist/desktop-UYAYGPQT.js +0 -2
- package/dist/desktop-UYAYGPQT.js.map +0 -1
- package/dist/diff-BJDM3N45.js +0 -2
- package/dist/diff-BJDM3N45.js.map +0 -1
- package/dist/docker-UOM4Q7PD.js +0 -2
- package/dist/docker-UOM4Q7PD.js.map +0 -1
- package/dist/dotenv-LK44WBD3.js +0 -2
- package/dist/dotenv-LK44WBD3.js.map +0 -1
- package/dist/dracula-2VHT5LK5.js +0 -2
- package/dist/dracula-2VHT5LK5.js.map +0 -1
- package/dist/dracula-soft-MSCUO73T.js +0 -2
- package/dist/dracula-soft-MSCUO73T.js.map +0 -1
- package/dist/dream-maker-7RP4JRQH.js +0 -2
- package/dist/dream-maker-7RP4JRQH.js.map +0 -1
- package/dist/edge-XE5XFLFP.js +0 -2
- package/dist/edge-XE5XFLFP.js.map +0 -1
- package/dist/elixir-EXRA4QJX.js +0 -2
- package/dist/elixir-EXRA4QJX.js.map +0 -1
- package/dist/elm-THYL2NRS.js +0 -2
- package/dist/elm-THYL2NRS.js.map +0 -1
- package/dist/emacs-lisp-YHLQYGNI.js +0 -2
- package/dist/emacs-lisp-YHLQYGNI.js.map +0 -1
- package/dist/erb-LRUOJBTB.js +0 -2
- package/dist/erb-LRUOJBTB.js.map +0 -1
- package/dist/erlang-UNX5MMGA.js +0 -2
- package/dist/erlang-UNX5MMGA.js.map +0 -1
- package/dist/everforest-dark-AGVJEQ35.js +0 -2
- package/dist/everforest-dark-AGVJEQ35.js.map +0 -1
- package/dist/everforest-light-62GPFKVJ.js +0 -2
- package/dist/everforest-light-62GPFKVJ.js.map +0 -1
- package/dist/fennel-HYSSBG3N.js +0 -2
- package/dist/fennel-HYSSBG3N.js.map +0 -1
- package/dist/fish-PTKGQOJI.js +0 -2
- package/dist/fish-PTKGQOJI.js.map +0 -1
- package/dist/fluent-LEZHPPJV.js +0 -2
- package/dist/fluent-LEZHPPJV.js.map +0 -1
- package/dist/fortran-fixed-form-J5AMEFMB.js +0 -2
- package/dist/fortran-fixed-form-J5AMEFMB.js.map +0 -1
- package/dist/fortran-free-form-S3BNTBLS.js +0 -2
- package/dist/fortran-free-form-S3BNTBLS.js.map +0 -1
- package/dist/fsharp-H4OIW62Z.js +0 -2
- package/dist/fsharp-H4OIW62Z.js.map +0 -1
- package/dist/gdresource-A6NTYFLM.js +0 -2
- package/dist/gdresource-A6NTYFLM.js.map +0 -1
- package/dist/gdscript-YQUSJRNZ.js +0 -2
- package/dist/gdscript-YQUSJRNZ.js.map +0 -1
- package/dist/gdshader-S5432GFE.js +0 -2
- package/dist/gdshader-S5432GFE.js.map +0 -1
- package/dist/genie-RNVG5N7L.js +0 -2
- package/dist/genie-RNVG5N7L.js.map +0 -1
- package/dist/gherkin-E5R62T6O.js +0 -2
- package/dist/gherkin-E5R62T6O.js.map +0 -1
- package/dist/git-commit-QGH6XOBG.js +0 -2
- package/dist/git-commit-QGH6XOBG.js.map +0 -1
- package/dist/git-rebase-XTCZTXU4.js +0 -2
- package/dist/git-rebase-XTCZTXU4.js.map +0 -1
- package/dist/github-dark-5OJVMBCE.js +0 -2
- package/dist/github-dark-5OJVMBCE.js.map +0 -1
- package/dist/github-dark-default-4WERFSZW.js +0 -2
- package/dist/github-dark-default-4WERFSZW.js.map +0 -1
- package/dist/github-dark-dimmed-7VD3SZKC.js +0 -2
- package/dist/github-dark-dimmed-7VD3SZKC.js.map +0 -1
- package/dist/github-dark-high-contrast-FVMMS656.js +0 -2
- package/dist/github-dark-high-contrast-FVMMS656.js.map +0 -1
- package/dist/github-light-SE4LEKO7.js +0 -2
- package/dist/github-light-SE4LEKO7.js.map +0 -1
- package/dist/github-light-default-TV7BYQGI.js +0 -2
- package/dist/github-light-default-TV7BYQGI.js.map +0 -1
- package/dist/github-light-high-contrast-WKO4I3G7.js +0 -2
- package/dist/github-light-high-contrast-WKO4I3G7.js.map +0 -1
- package/dist/gleam-W5WZ7CST.js +0 -2
- package/dist/gleam-W5WZ7CST.js.map +0 -1
- package/dist/glimmer-js-JA25I4AE.js +0 -2
- package/dist/glimmer-js-JA25I4AE.js.map +0 -1
- package/dist/glimmer-ts-CKELYRRF.js +0 -2
- package/dist/glimmer-ts-CKELYRRF.js.map +0 -1
- package/dist/glsl-PVW2OPUD.js +0 -2
- package/dist/glsl-PVW2OPUD.js.map +0 -1
- package/dist/gn-FCAO7WI5.js +0 -2
- package/dist/gn-FCAO7WI5.js.map +0 -1
- package/dist/gnuplot-Q6SE5CHZ.js +0 -2
- package/dist/gnuplot-Q6SE5CHZ.js.map +0 -1
- package/dist/go-CPCZAAWX.js +0 -2
- package/dist/go-CPCZAAWX.js.map +0 -1
- package/dist/graphql-UN5O7U5U.js +0 -2
- package/dist/graphql-UN5O7U5U.js.map +0 -1
- package/dist/groovy-PJAEBBJY.js +0 -2
- package/dist/groovy-PJAEBBJY.js.map +0 -1
- package/dist/gruvbox-dark-hard-LOYZQIGI.js +0 -2
- package/dist/gruvbox-dark-hard-LOYZQIGI.js.map +0 -1
- package/dist/gruvbox-dark-medium-UIMSJJ6K.js +0 -2
- package/dist/gruvbox-dark-medium-UIMSJJ6K.js.map +0 -1
- package/dist/gruvbox-dark-soft-PU6RNTTO.js +0 -2
- package/dist/gruvbox-dark-soft-PU6RNTTO.js.map +0 -1
- package/dist/gruvbox-light-hard-ZQJ7XSZF.js +0 -2
- package/dist/gruvbox-light-hard-ZQJ7XSZF.js.map +0 -1
- package/dist/gruvbox-light-medium-CD3ZGYV6.js +0 -2
- package/dist/gruvbox-light-medium-CD3ZGYV6.js.map +0 -1
- package/dist/gruvbox-light-soft-S74MAGOM.js +0 -2
- package/dist/gruvbox-light-soft-S74MAGOM.js.map +0 -1
- package/dist/hack-QIUJFE3G.js +0 -2
- package/dist/hack-QIUJFE3G.js.map +0 -1
- package/dist/haml-JQIESO7E.js +0 -2
- package/dist/haml-JQIESO7E.js.map +0 -1
- package/dist/handlebars-UBV5AWUH.js +0 -2
- package/dist/handlebars-UBV5AWUH.js.map +0 -1
- package/dist/haskell-NX6XRMNO.js +0 -2
- package/dist/haskell-NX6XRMNO.js.map +0 -1
- package/dist/haxe-7YNB7FVC.js +0 -2
- package/dist/haxe-7YNB7FVC.js.map +0 -1
- package/dist/hcl-ZF75ASCX.js +0 -2
- package/dist/hcl-ZF75ASCX.js.map +0 -1
- package/dist/hjson-65TX6QOC.js +0 -2
- package/dist/hjson-65TX6QOC.js.map +0 -1
- package/dist/hlsl-U2O526MI.js +0 -2
- package/dist/hlsl-U2O526MI.js.map +0 -1
- package/dist/horizon-EAAZ4KVN.js +0 -2
- package/dist/horizon-EAAZ4KVN.js.map +0 -1
- package/dist/houston-UNRWGR67.js +0 -2
- package/dist/houston-UNRWGR67.js.map +0 -1
- package/dist/html-AWDHWPK7.js +0 -2
- package/dist/html-AWDHWPK7.js.map +0 -1
- package/dist/html-derivative-QY3ZIV7G.js +0 -2
- package/dist/html-derivative-QY3ZIV7G.js.map +0 -1
- package/dist/http-KIGXJYY6.js +0 -2
- package/dist/http-KIGXJYY6.js.map +0 -1
- package/dist/hurl-BZB5LDD5.js +0 -2
- package/dist/hurl-BZB5LDD5.js.map +0 -1
- package/dist/hxml-IGTXIURH.js +0 -2
- package/dist/hxml-IGTXIURH.js.map +0 -1
- package/dist/hy-CLDGXJYP.js +0 -2
- package/dist/hy-CLDGXJYP.js.map +0 -1
- package/dist/imba-NWHLCVE5.js +0 -2
- package/dist/imba-NWHLCVE5.js.map +0 -1
- package/dist/ini-R6WYP7NC.js +0 -2
- package/dist/ini-R6WYP7NC.js.map +0 -1
- package/dist/java-DHBXDMBM.js +0 -2
- package/dist/java-DHBXDMBM.js.map +0 -1
- package/dist/javascript-GNUEDNHO.js +0 -2
- package/dist/javascript-GNUEDNHO.js.map +0 -1
- package/dist/jinja-AEVQQKWS.js +0 -2
- package/dist/jinja-AEVQQKWS.js.map +0 -1
- package/dist/jison-64A6IJCV.js +0 -2
- package/dist/jison-64A6IJCV.js.map +0 -1
- package/dist/json-2ELCHKXT.js +0 -2
- package/dist/json-2ELCHKXT.js.map +0 -1
- package/dist/json5-QRH5UJYD.js +0 -2
- package/dist/json5-QRH5UJYD.js.map +0 -1
- package/dist/jsonc-IXPVR4NY.js +0 -2
- package/dist/jsonc-IXPVR4NY.js.map +0 -1
- package/dist/jsonl-C57GMUK5.js +0 -2
- package/dist/jsonl-C57GMUK5.js.map +0 -1
- package/dist/jsonnet-VNADFLKI.js +0 -2
- package/dist/jsonnet-VNADFLKI.js.map +0 -1
- package/dist/jssm-CW4ZYDSF.js +0 -2
- package/dist/jssm-CW4ZYDSF.js.map +0 -1
- package/dist/jsx-YTENXENT.js +0 -2
- package/dist/jsx-YTENXENT.js.map +0 -1
- package/dist/julia-75QR2XDN.js +0 -2
- package/dist/julia-75QR2XDN.js.map +0 -1
- package/dist/kanagawa-dragon-BOSCCB42.js +0 -2
- package/dist/kanagawa-dragon-BOSCCB42.js.map +0 -1
- package/dist/kanagawa-lotus-NXMB2IVI.js +0 -2
- package/dist/kanagawa-lotus-NXMB2IVI.js.map +0 -1
- package/dist/kanagawa-wave-YOHS63UF.js +0 -2
- package/dist/kanagawa-wave-YOHS63UF.js.map +0 -1
- package/dist/kdl-X3AS2HRT.js +0 -2
- package/dist/kdl-X3AS2HRT.js.map +0 -1
- package/dist/kotlin-WGITM75W.js +0 -2
- package/dist/kotlin-WGITM75W.js.map +0 -1
- package/dist/kusto-LT46F7AO.js +0 -2
- package/dist/kusto-LT46F7AO.js.map +0 -1
- package/dist/laserwave-TS4AG4VO.js +0 -2
- package/dist/laserwave-TS4AG4VO.js.map +0 -1
- package/dist/latex-R4PJ7JDY.js +0 -2
- package/dist/latex-R4PJ7JDY.js.map +0 -1
- package/dist/lean-DYWOENAS.js +0 -2
- package/dist/lean-DYWOENAS.js.map +0 -1
- package/dist/legacy/chat/express-js/index.d.ts +0 -551
- package/dist/legacy/chat/express-js/index.js +0 -10
- package/dist/legacy/chat/express-js/index.js.map +0 -1
- package/dist/legacy/chat/next-js/index.d.ts +0 -512
- package/dist/legacy/chat/next-js/index.js +0 -10
- package/dist/legacy/chat/next-js/index.js.map +0 -1
- package/dist/legacy/index.d.ts +0 -1820
- package/dist/legacy/index.js +0 -123
- package/dist/legacy/index.js.map +0 -1
- package/dist/legacy/mcp/react.d.ts +0 -645
- package/dist/legacy/mcp/react.js +0 -68
- package/dist/legacy/mcp/react.js.map +0 -1
- package/dist/less-ZYJT7MPU.js +0 -2
- package/dist/less-ZYJT7MPU.js.map +0 -1
- package/dist/light-plus-2HYW3NJ6.js +0 -2
- package/dist/light-plus-2HYW3NJ6.js.map +0 -1
- package/dist/liquid-S4LVU77Y.js +0 -2
- package/dist/liquid-S4LVU77Y.js.map +0 -1
- package/dist/llvm-WBQ7MHV7.js +0 -2
- package/dist/llvm-WBQ7MHV7.js.map +0 -1
- package/dist/log-AXKDFD3L.js +0 -2
- package/dist/log-AXKDFD3L.js.map +0 -1
- package/dist/logo-E23LAFZY.js +0 -2
- package/dist/logo-E23LAFZY.js.map +0 -1
- package/dist/lua-QQ5QEPPO.js +0 -2
- package/dist/lua-QQ5QEPPO.js.map +0 -1
- package/dist/luau-D432BEB5.js +0 -2
- package/dist/luau-D432BEB5.js.map +0 -1
- package/dist/make-QFMWQJMG.js +0 -2
- package/dist/make-QFMWQJMG.js.map +0 -1
- package/dist/markdown-D756RUOP.js +0 -2
- package/dist/markdown-D756RUOP.js.map +0 -1
- package/dist/marko-WVASNOGB.js +0 -2
- package/dist/marko-WVASNOGB.js.map +0 -1
- package/dist/material-theme-KPDVFAGV.js +0 -2
- package/dist/material-theme-KPDVFAGV.js.map +0 -1
- package/dist/material-theme-darker-GVSTMSNT.js +0 -2
- package/dist/material-theme-darker-GVSTMSNT.js.map +0 -1
- package/dist/material-theme-lighter-JWZNUXUH.js +0 -2
- package/dist/material-theme-lighter-JWZNUXUH.js.map +0 -1
- package/dist/material-theme-ocean-MU4N3XNQ.js +0 -2
- package/dist/material-theme-ocean-MU4N3XNQ.js.map +0 -1
- package/dist/material-theme-palenight-VMWD73WM.js +0 -2
- package/dist/material-theme-palenight-VMWD73WM.js.map +0 -1
- package/dist/matlab-ZKZ7YBAH.js +0 -2
- package/dist/matlab-ZKZ7YBAH.js.map +0 -1
- package/dist/mcp-apps-client-WEXKWHUI.js +0 -3
- package/dist/mcp-apps-client-WEXKWHUI.js.map +0 -1
- package/dist/mcp-apps-client-Z5ICFYSR.js +0 -2
- package/dist/mcp-apps-client-Z5ICFYSR.js.map +0 -1
- package/dist/mdc-NDTDGSIG.js +0 -2
- package/dist/mdc-NDTDGSIG.js.map +0 -1
- package/dist/mdx-34BL2O4O.js +0 -2
- package/dist/mdx-34BL2O4O.js.map +0 -1
- package/dist/mermaid-4DMBBIKO-DV4JRUY5.js +0 -2
- package/dist/mermaid-4DMBBIKO-DV4JRUY5.js.map +0 -1
- package/dist/mermaid-54Z3SAII.js +0 -2
- package/dist/mermaid-54Z3SAII.js.map +0 -1
- package/dist/min-dark-ASEVSA24.js +0 -2
- package/dist/min-dark-ASEVSA24.js.map +0 -1
- package/dist/min-light-3H54BB3D.js +0 -2
- package/dist/min-light-3H54BB3D.js.map +0 -1
- package/dist/mipsasm-NKQWJEL7.js +0 -2
- package/dist/mipsasm-NKQWJEL7.js.map +0 -1
- package/dist/mojo-KRRNBH7O.js +0 -2
- package/dist/mojo-KRRNBH7O.js.map +0 -1
- package/dist/monokai-5QWQOFN6.js +0 -2
- package/dist/monokai-5QWQOFN6.js.map +0 -1
- package/dist/moonbit-LQ7JL5LZ.js +0 -2
- package/dist/moonbit-LQ7JL5LZ.js.map +0 -1
- package/dist/move-4VWCI4YQ.js +0 -2
- package/dist/move-4VWCI4YQ.js.map +0 -1
- package/dist/narrat-4QSDQDLH.js +0 -2
- package/dist/narrat-4QSDQDLH.js.map +0 -1
- package/dist/nextflow-DPCEWQNZ.js +0 -2
- package/dist/nextflow-DPCEWQNZ.js.map +0 -1
- package/dist/nginx-DXHAXQRH.js +0 -2
- package/dist/nginx-DXHAXQRH.js.map +0 -1
- package/dist/night-owl-4QQBS2UX.js +0 -2
- package/dist/night-owl-4QQBS2UX.js.map +0 -1
- package/dist/night-owl-light-HR6A2OQO.js +0 -2
- package/dist/night-owl-light-HR6A2OQO.js.map +0 -1
- package/dist/nim-Z6EEJ7SX.js +0 -2
- package/dist/nim-Z6EEJ7SX.js.map +0 -1
- package/dist/nix-WAYR4BYU.js +0 -2
- package/dist/nix-WAYR4BYU.js.map +0 -1
- package/dist/nord-XK3AUNCF.js +0 -2
- package/dist/nord-XK3AUNCF.js.map +0 -1
- package/dist/nushell-26KZW4VL.js +0 -2
- package/dist/nushell-26KZW4VL.js.map +0 -1
- package/dist/objective-c-246HWLKT.js +0 -2
- package/dist/objective-c-246HWLKT.js.map +0 -1
- package/dist/objective-cpp-RJUXXPYQ.js +0 -2
- package/dist/objective-cpp-RJUXXPYQ.js.map +0 -1
- package/dist/ocaml-P7NGS7PR.js +0 -2
- package/dist/ocaml-P7NGS7PR.js.map +0 -1
- package/dist/odin-UPPZCJGN.js +0 -2
- package/dist/odin-UPPZCJGN.js.map +0 -1
- package/dist/one-dark-pro-ZV7CEA5M.js +0 -2
- package/dist/one-dark-pro-ZV7CEA5M.js.map +0 -1
- package/dist/one-light-FKZJCKM6.js +0 -2
- package/dist/one-light-FKZJCKM6.js.map +0 -1
- package/dist/openai-client-PUBKF5TI.js +0 -5
- package/dist/openai-client-PUBKF5TI.js.map +0 -1
- package/dist/openai-client-VRJPAPFR.js +0 -4
- package/dist/openai-client-VRJPAPFR.js.map +0 -1
- package/dist/openscad-JRK6K3FL.js +0 -2
- package/dist/openscad-JRK6K3FL.js.map +0 -1
- package/dist/pascal-RDFLUHHA.js +0 -2
- package/dist/pascal-RDFLUHHA.js.map +0 -1
- package/dist/perl-5IQEFQG3.js +0 -2
- package/dist/perl-5IQEFQG3.js.map +0 -1
- package/dist/php-UQGWKJAF.js +0 -2
- package/dist/php-UQGWKJAF.js.map +0 -1
- package/dist/pkl-PAM76VXP.js +0 -2
- package/dist/pkl-PAM76VXP.js.map +0 -1
- package/dist/plastic-SXCQPKYC.js +0 -2
- package/dist/plastic-SXCQPKYC.js.map +0 -1
- package/dist/platform-LKQFC3AJ.js +0 -3
- package/dist/platform-LKQFC3AJ.js.map +0 -1
- package/dist/platform-ZNBJH5XX.js +0 -2
- package/dist/platform-ZNBJH5XX.js.map +0 -1
- package/dist/plsql-3Y6UMFEG.js +0 -2
- package/dist/plsql-3Y6UMFEG.js.map +0 -1
- package/dist/po-GNTAKCTE.js +0 -2
- package/dist/po-GNTAKCTE.js.map +0 -1
- package/dist/poimandres-S3UYVG4O.js +0 -2
- package/dist/poimandres-S3UYVG4O.js.map +0 -1
- package/dist/polar-EVTMRLGV.js +0 -2
- package/dist/polar-EVTMRLGV.js.map +0 -1
- package/dist/postcss-42343LW7.js +0 -2
- package/dist/postcss-42343LW7.js.map +0 -1
- package/dist/powerquery-M34PNR4X.js +0 -2
- package/dist/powerquery-M34PNR4X.js.map +0 -1
- package/dist/powershell-IR7ICFQW.js +0 -2
- package/dist/powershell-IR7ICFQW.js.map +0 -1
- package/dist/prisma-RXSIFLZX.js +0 -2
- package/dist/prisma-RXSIFLZX.js.map +0 -1
- package/dist/prolog-YBBQ4UD5.js +0 -2
- package/dist/prolog-YBBQ4UD5.js.map +0 -1
- package/dist/proto-U4FF45G6.js +0 -2
- package/dist/proto-U4FF45G6.js.map +0 -1
- package/dist/pug-XHTBJJNO.js +0 -2
- package/dist/pug-XHTBJJNO.js.map +0 -1
- package/dist/puppet-HWOKIYJP.js +0 -2
- package/dist/puppet-HWOKIYJP.js.map +0 -1
- package/dist/purescript-D45AJS5J.js +0 -2
- package/dist/purescript-D45AJS5J.js.map +0 -1
- package/dist/python-QWA7UE2I.js +0 -2
- package/dist/python-QWA7UE2I.js.map +0 -1
- package/dist/qml-RHCWFR3S.js +0 -2
- package/dist/qml-RHCWFR3S.js.map +0 -1
- package/dist/qmldir-FBDC3XMZ.js +0 -2
- package/dist/qmldir-FBDC3XMZ.js.map +0 -1
- package/dist/qss-AD3WZQ45.js +0 -2
- package/dist/qss-AD3WZQ45.js.map +0 -1
- package/dist/r-NHIAHDOD.js +0 -2
- package/dist/r-NHIAHDOD.js.map +0 -1
- package/dist/racket-7G65C5N5.js +0 -2
- package/dist/racket-7G65C5N5.js.map +0 -1
- package/dist/raku-IWS7BLGD.js +0 -2
- package/dist/raku-IWS7BLGD.js.map +0 -1
- package/dist/razor-UMC4HKIF.js +0 -2
- package/dist/razor-UMC4HKIF.js.map +0 -1
- package/dist/red-A6OC2HVL.js +0 -2
- package/dist/red-A6OC2HVL.js.map +0 -1
- package/dist/reg-V4XLWESR.js +0 -2
- package/dist/reg-V4XLWESR.js.map +0 -1
- package/dist/regexp-XP4MR635.js +0 -2
- package/dist/regexp-XP4MR635.js.map +0 -1
- package/dist/rel-DE6UXATM.js +0 -2
- package/dist/rel-DE6UXATM.js.map +0 -1
- package/dist/riscv-5PDXBPPL.js +0 -2
- package/dist/riscv-5PDXBPPL.js.map +0 -1
- package/dist/ron-WD6BJFDY.js +0 -2
- package/dist/ron-WD6BJFDY.js.map +0 -1
- package/dist/rose-pine-GLWOWPBK.js +0 -2
- package/dist/rose-pine-GLWOWPBK.js.map +0 -1
- package/dist/rose-pine-dawn-HYE6T7LV.js +0 -2
- package/dist/rose-pine-dawn-HYE6T7LV.js.map +0 -1
- package/dist/rose-pine-moon-VHVTDDVO.js +0 -2
- package/dist/rose-pine-moon-VHVTDDVO.js.map +0 -1
- package/dist/rosmsg-7LDUCZRQ.js +0 -2
- package/dist/rosmsg-7LDUCZRQ.js.map +0 -1
- package/dist/rst-HCGHBPBZ.js +0 -2
- package/dist/rst-HCGHBPBZ.js.map +0 -1
- package/dist/ruby-ML25RVXY.js +0 -2
- package/dist/ruby-ML25RVXY.js.map +0 -1
- package/dist/rust-Z2NYMT2Z.js +0 -2
- package/dist/rust-Z2NYMT2Z.js.map +0 -1
- package/dist/sas-A4JCTK6H.js +0 -2
- package/dist/sas-A4JCTK6H.js.map +0 -1
- package/dist/sass-75VDP7DE.js +0 -2
- package/dist/sass-75VDP7DE.js.map +0 -1
- package/dist/scala-7TJ4N6KC.js +0 -2
- package/dist/scala-7TJ4N6KC.js.map +0 -1
- package/dist/scheme-5XARZMKT.js +0 -2
- package/dist/scheme-5XARZMKT.js.map +0 -1
- package/dist/scss-4QR2BXFS.js +0 -2
- package/dist/scss-4QR2BXFS.js.map +0 -1
- package/dist/sdbl-6M55AJVA.js +0 -2
- package/dist/sdbl-6M55AJVA.js.map +0 -1
- package/dist/shaderlab-322XNY5V.js +0 -2
- package/dist/shaderlab-322XNY5V.js.map +0 -1
- package/dist/shellscript-F23VVVTW.js +0 -2
- package/dist/shellscript-F23VVVTW.js.map +0 -1
- package/dist/shellsession-G65XJMCC.js +0 -2
- package/dist/shellsession-G65XJMCC.js.map +0 -1
- package/dist/slack-dark-OPW5CYSY.js +0 -2
- package/dist/slack-dark-OPW5CYSY.js.map +0 -1
- package/dist/slack-ochin-WTVMYBFH.js +0 -2
- package/dist/slack-ochin-WTVMYBFH.js.map +0 -1
- package/dist/smalltalk-LALIO5SC.js +0 -2
- package/dist/smalltalk-LALIO5SC.js.map +0 -1
- package/dist/snazzy-light-5UQ56PC5.js +0 -2
- package/dist/snazzy-light-5UQ56PC5.js.map +0 -1
- package/dist/solarized-dark-DSMP6D7D.js +0 -2
- package/dist/solarized-dark-DSMP6D7D.js.map +0 -1
- package/dist/solarized-light-3IZTZCIV.js +0 -2
- package/dist/solarized-light-3IZTZCIV.js.map +0 -1
- package/dist/solidity-TQUKTJZZ.js +0 -2
- package/dist/solidity-TQUKTJZZ.js.map +0 -1
- package/dist/soy-ALTWCQTO.js +0 -2
- package/dist/soy-ALTWCQTO.js.map +0 -1
- package/dist/sparql-ARI3MVK7.js +0 -2
- package/dist/sparql-ARI3MVK7.js.map +0 -1
- package/dist/splunk-QEFG3NPJ.js +0 -2
- package/dist/splunk-QEFG3NPJ.js.map +0 -1
- package/dist/sql-SBP7VV3V.js +0 -2
- package/dist/sql-SBP7VV3V.js.map +0 -1
- package/dist/ssh-config-SC6RC6IV.js +0 -2
- package/dist/ssh-config-SC6RC6IV.js.map +0 -1
- package/dist/stata-MNI5YOQU.js +0 -2
- package/dist/stata-MNI5YOQU.js.map +0 -1
- package/dist/stylus-YYWEHAK3.js +0 -2
- package/dist/stylus-YYWEHAK3.js.map +0 -1
- package/dist/surrealql-5X7LI3J6.js +0 -2
- package/dist/surrealql-5X7LI3J6.js.map +0 -1
- package/dist/svelte-6TT7H4YP.js +0 -2
- package/dist/svelte-6TT7H4YP.js.map +0 -1
- package/dist/swift-JEBLU4EM.js +0 -2
- package/dist/swift-JEBLU4EM.js.map +0 -1
- package/dist/synthwave-84-JWI6CVJZ.js +0 -2
- package/dist/synthwave-84-JWI6CVJZ.js.map +0 -1
- package/dist/system-verilog-46QRSGNM.js +0 -2
- package/dist/system-verilog-46QRSGNM.js.map +0 -1
- package/dist/systemd-3PUVCSI7.js +0 -2
- package/dist/systemd-3PUVCSI7.js.map +0 -1
- package/dist/talonscript-AK4LB3KC.js +0 -2
- package/dist/talonscript-AK4LB3KC.js.map +0 -1
- package/dist/tasl-VHTYBUVI.js +0 -2
- package/dist/tasl-VHTYBUVI.js.map +0 -1
- package/dist/tcl-UUMKHRHL.js +0 -2
- package/dist/tcl-UUMKHRHL.js.map +0 -1
- package/dist/templ-WN3SJLUV.js +0 -2
- package/dist/templ-WN3SJLUV.js.map +0 -1
- package/dist/terraform-GCGIT2RL.js +0 -2
- package/dist/terraform-GCGIT2RL.js.map +0 -1
- package/dist/tex-L55DZDKV.js +0 -2
- package/dist/tex-L55DZDKV.js.map +0 -1
- package/dist/tokyo-night-SRK4SADJ.js +0 -2
- package/dist/tokyo-night-SRK4SADJ.js.map +0 -1
- package/dist/toml-7AH4HFBN.js +0 -2
- package/dist/toml-7AH4HFBN.js.map +0 -1
- package/dist/ts-tags-NAJDOQCO.js +0 -2
- package/dist/ts-tags-NAJDOQCO.js.map +0 -1
- package/dist/tsv-EB3LRXYX.js +0 -2
- package/dist/tsv-EB3LRXYX.js.map +0 -1
- package/dist/tsx-Y5YXGNIX.js +0 -2
- package/dist/tsx-Y5YXGNIX.js.map +0 -1
- package/dist/turtle-KM6UGYIQ.js +0 -2
- package/dist/turtle-KM6UGYIQ.js.map +0 -1
- package/dist/twig-GIY7NVAA.js +0 -2
- package/dist/twig-GIY7NVAA.js.map +0 -1
- package/dist/typescript-ZF5AMNEZ.js +0 -2
- package/dist/typescript-ZF5AMNEZ.js.map +0 -1
- package/dist/typespec-6JSRRA42.js +0 -2
- package/dist/typespec-6JSRRA42.js.map +0 -1
- package/dist/typst-ZOSAUKL5.js +0 -2
- package/dist/typst-ZOSAUKL5.js.map +0 -1
- package/dist/v-HVLBO3DI.js +0 -2
- package/dist/v-HVLBO3DI.js.map +0 -1
- package/dist/vala-WWRVCJNF.js +0 -2
- package/dist/vala-WWRVCJNF.js.map +0 -1
- package/dist/vb-XFFF4O73.js +0 -2
- package/dist/vb-XFFF4O73.js.map +0 -1
- package/dist/verilog-XTDPJNP7.js +0 -2
- package/dist/verilog-XTDPJNP7.js.map +0 -1
- package/dist/vesper-WIZFPFI7.js +0 -2
- package/dist/vesper-WIZFPFI7.js.map +0 -1
- package/dist/vhdl-OCZJ2AOZ.js +0 -2
- package/dist/vhdl-OCZJ2AOZ.js.map +0 -1
- package/dist/viml-PVA3ZJ5L.js +0 -2
- package/dist/viml-PVA3ZJ5L.js.map +0 -1
- package/dist/vitesse-black-PEGI4HJX.js +0 -2
- package/dist/vitesse-black-PEGI4HJX.js.map +0 -1
- package/dist/vitesse-dark-M2ZAGPXG.js +0 -2
- package/dist/vitesse-dark-M2ZAGPXG.js.map +0 -1
- package/dist/vitesse-light-RICZI4IG.js +0 -2
- package/dist/vitesse-light-RICZI4IG.js.map +0 -1
- package/dist/vue-V6GLJNYA.js +0 -2
- package/dist/vue-V6GLJNYA.js.map +0 -1
- package/dist/vue-html-G4DE7FYD.js +0 -2
- package/dist/vue-html-G4DE7FYD.js.map +0 -1
- package/dist/vue-vine-KB45C76H.js +0 -2
- package/dist/vue-vine-KB45C76H.js.map +0 -1
- package/dist/vyper-SBDFKHRI.js +0 -2
- package/dist/vyper-SBDFKHRI.js.map +0 -1
- package/dist/wasm-ISCPKFD2.js +0 -2
- package/dist/wasm-ISCPKFD2.js.map +0 -1
- package/dist/wasm-SXNE4SKX.js +0 -2
- package/dist/wasm-SXNE4SKX.js.map +0 -1
- package/dist/wenyan-PMSCJP7P.js +0 -2
- package/dist/wenyan-PMSCJP7P.js.map +0 -1
- package/dist/wgsl-DOXQU7M4.js +0 -2
- package/dist/wgsl-DOXQU7M4.js.map +0 -1
- package/dist/wikitext-LGNEKWDX.js +0 -2
- package/dist/wikitext-LGNEKWDX.js.map +0 -1
- package/dist/wit-G62U2KBE.js +0 -2
- package/dist/wit-G62U2KBE.js.map +0 -1
- package/dist/wolfram-YTZHUYN6.js +0 -2
- package/dist/wolfram-YTZHUYN6.js.map +0 -1
- package/dist/xml-WGLM4CWK.js +0 -2
- package/dist/xml-WGLM4CWK.js.map +0 -1
- package/dist/xsl-KAAH2GEK.js +0 -2
- package/dist/xsl-KAAH2GEK.js.map +0 -1
- package/dist/yaml-JGEBDSVI.js +0 -2
- package/dist/yaml-JGEBDSVI.js.map +0 -1
- package/dist/zenscript-QQQPZNJ7.js +0 -2
- package/dist/zenscript-QQQPZNJ7.js.map +0 -1
- package/dist/zig-6LJUAPBA.js +0 -2
- package/dist/zig-6LJUAPBA.js.map +0 -1
package/dist/legacy/index.d.ts
DELETED
|
@@ -1,1820 +0,0 @@
|
|
|
1
|
-
import { McpServer, ToolCallback } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
export { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { ZodRawShapeCompat, ShapeOutput } from '@modelcontextprotocol/sdk/server/zod-compat.js';
|
|
5
|
-
export { ZodRawShapeCompat } from '@modelcontextprotocol/sdk/server/zod-compat.js';
|
|
6
|
-
import { ToolAnnotations, ContentBlock, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
|
-
import * as React$1 from 'react';
|
|
9
|
-
import React__default, { ReactNode, JSX, SetStateAction } from 'react';
|
|
10
|
-
import * as ai from 'ai';
|
|
11
|
-
import { UIMessage } from 'ai';
|
|
12
|
-
|
|
13
|
-
type WidgetCSP = {
|
|
14
|
-
/** Domains permitted for fetch/XHR network requests */
|
|
15
|
-
connect_domains?: string[];
|
|
16
|
-
/** Domains for static assets (images, fonts, scripts, styles) */
|
|
17
|
-
resource_domains?: string[];
|
|
18
|
-
/** Origins allowed for iframe embeds (triggers stricter app review) */
|
|
19
|
-
frame_domains?: string[];
|
|
20
|
-
/** Origins that can receive openExternal redirects without safe-link modal */
|
|
21
|
-
redirect_domains?: string[];
|
|
22
|
-
};
|
|
23
|
-
type ResourceConfig = {
|
|
24
|
-
/** Unique identifier for the resource */
|
|
25
|
-
id: string;
|
|
26
|
-
/** Display title */
|
|
27
|
-
title: string;
|
|
28
|
-
/** UI description (describes WHAT the resource displays) */
|
|
29
|
-
description?: string;
|
|
30
|
-
/** Base URL for fetching the HTML */
|
|
31
|
-
baseUrl: string;
|
|
32
|
-
/** Path to the HTML file (relative to baseUrl) */
|
|
33
|
-
htmlPath: string;
|
|
34
|
-
/** Domain for OpenAI security context */
|
|
35
|
-
widgetDomain: string;
|
|
36
|
-
/** Whether widget prefers border (defaults to true) */
|
|
37
|
-
prefersBorder?: boolean;
|
|
38
|
-
/** When true, the iframe height auto-adapts to its content */
|
|
39
|
-
autoHeight?: boolean;
|
|
40
|
-
/** Content Security Policy configuration */
|
|
41
|
-
widgetCSP?: WidgetCSP;
|
|
42
|
-
};
|
|
43
|
-
type RegisteredResource = {
|
|
44
|
-
readonly id: string;
|
|
45
|
-
readonly title: string;
|
|
46
|
-
readonly description: string | undefined;
|
|
47
|
-
/** OpenAI URI: ui://widgets/apps-sdk/{id}.html */
|
|
48
|
-
readonly openaiUri: string;
|
|
49
|
-
/** MCP URI: ui://widgets/ext-apps/{id}.html */
|
|
50
|
-
readonly mcpUri: string;
|
|
51
|
-
readonly autoHeight: boolean | undefined;
|
|
52
|
-
/** Register this resource on an McpServer */
|
|
53
|
-
register: (server: McpServer) => Promise<void>;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Creates a reusable UI resource (HTML template) that can be attached
|
|
58
|
-
* to tools or flow nodes.
|
|
59
|
-
*
|
|
60
|
-
* @deprecated Prefer `createFlow` with `showWidget` from `@waniwani/sdk/mcp` for new code.
|
|
61
|
-
* `createResource` is preserved for back-compat with existing customer MCPs but is no longer
|
|
62
|
-
* documented; it will move to `@waniwani/sdk/legacy` in a future minor release.
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```ts
|
|
66
|
-
* const pricingUI = createResource({
|
|
67
|
-
* id: "pricing_table",
|
|
68
|
-
* title: "Pricing Table",
|
|
69
|
-
* baseUrl: "https://my-app.com",
|
|
70
|
-
* htmlPath: "/widgets/pricing",
|
|
71
|
-
* widgetDomain: "my-app.com",
|
|
72
|
-
* });
|
|
73
|
-
*
|
|
74
|
-
* await pricingUI.register(server);
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
declare function createResource(config: ResourceConfig): RegisteredResource;
|
|
78
|
-
|
|
79
|
-
interface SearchResult {
|
|
80
|
-
source: string;
|
|
81
|
-
heading: string;
|
|
82
|
-
content: string;
|
|
83
|
-
score: number;
|
|
84
|
-
metadata?: Record<string, string>;
|
|
85
|
-
}
|
|
86
|
-
interface KbSearchTrace {
|
|
87
|
-
query: string;
|
|
88
|
-
resultCount: number;
|
|
89
|
-
results: Array<Pick<SearchResult, "source" | "heading" | "score">>;
|
|
90
|
-
}
|
|
91
|
-
/** A file to ingest into the knowledge base */
|
|
92
|
-
interface KbIngestFile {
|
|
93
|
-
/** Filename (used as chunk source identifier) */
|
|
94
|
-
filename: string;
|
|
95
|
-
/** Markdown content of the file */
|
|
96
|
-
content: string;
|
|
97
|
-
/** Arbitrary key-value metadata attached to all chunks from this file */
|
|
98
|
-
metadata?: Record<string, string>;
|
|
99
|
-
}
|
|
100
|
-
/** Response from the ingest endpoint */
|
|
101
|
-
interface KbIngestResult {
|
|
102
|
-
/** Number of chunks created from the ingested files */
|
|
103
|
-
chunksIngested: number;
|
|
104
|
-
/** Number of files successfully processed */
|
|
105
|
-
filesProcessed: number;
|
|
106
|
-
}
|
|
107
|
-
/** Options for the search method */
|
|
108
|
-
interface KbSearchOptions {
|
|
109
|
-
/** Number of results to return (1-20, default 5) */
|
|
110
|
-
topK?: number;
|
|
111
|
-
/** Minimum similarity score threshold (0-1, default 0.3) */
|
|
112
|
-
minScore?: number;
|
|
113
|
-
/** Filter results to chunks whose metadata contains all these key-value pairs (exact match) */
|
|
114
|
-
metadata?: Record<string, string>;
|
|
115
|
-
}
|
|
116
|
-
/** A source entry in the knowledge base */
|
|
117
|
-
interface KbSource {
|
|
118
|
-
/** Source filename */
|
|
119
|
-
source: string;
|
|
120
|
-
/** Number of chunks from this source */
|
|
121
|
-
chunkCount: number;
|
|
122
|
-
/** ISO timestamp of when the source was first ingested */
|
|
123
|
-
createdAt: string;
|
|
124
|
-
}
|
|
125
|
-
/** KB client for server-side knowledge base operations */
|
|
126
|
-
interface KbClient {
|
|
127
|
-
/**
|
|
128
|
-
* Ingest files into the knowledge base.
|
|
129
|
-
*
|
|
130
|
-
* **Warning**: This is destructive — it deletes ALL existing chunks
|
|
131
|
-
* for the environment before ingesting the new files.
|
|
132
|
-
*/
|
|
133
|
-
ingest(files: KbIngestFile[]): Promise<KbIngestResult>;
|
|
134
|
-
/** Search the knowledge base for relevant chunks */
|
|
135
|
-
search(query: string, options?: KbSearchOptions): Promise<SearchResult[]>;
|
|
136
|
-
/** List all sources in the knowledge base */
|
|
137
|
-
sources(): Promise<KbSource[]>;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Every event name in the typed taxonomy, as a runtime list. Single source of
|
|
142
|
-
* truth for {@link EventType} and for surfaces that need to recognize
|
|
143
|
-
* first-class names at runtime (the widget transport passes these through
|
|
144
|
-
* verbatim instead of namespacing them as custom widget events).
|
|
145
|
-
*/
|
|
146
|
-
declare const EVENT_TYPES: readonly ["session.started", "page.viewed", "tool.called", "link.clicked", "widget_render", "user.identified", "price_shown", "prices_compared", "option_selected", "lead_qualified", "converted", "session.error"];
|
|
147
|
-
type EventType = (typeof EVENT_TYPES)[number];
|
|
148
|
-
declare const SESSION_ERROR_CODES: readonly ["agent_failed", "tool_failed", "upstream_failed"];
|
|
149
|
-
type SessionErrorCodeType = (typeof SESSION_ERROR_CODES)[number];
|
|
150
|
-
declare const ERROR_CAUSES: readonly ["timeout", "rate_limited", "upstream_4xx", "upstream_5xx", "network", "invalid_output", "flow_dead_end", "flow_unknown_node", "flow_loop", "unknown"];
|
|
151
|
-
type ErrorCauseType = (typeof ERROR_CAUSES)[number];
|
|
152
|
-
/**
|
|
153
|
-
* Properties for `page.viewed` — emitted once when the chat widget initializes
|
|
154
|
-
* on a host page (the top of the funnel). Attributed to the anonymous
|
|
155
|
-
* `visitorId` (mapped to `externalUserId`), never to a session: a page view
|
|
156
|
-
* must not create a session, otherwise sessions would equal page views and the
|
|
157
|
-
* "landed → started a conversation" funnel collapses.
|
|
158
|
-
*/
|
|
159
|
-
interface PageViewedProperties {
|
|
160
|
-
/** Full URL of the host page the widget loaded on. */
|
|
161
|
-
url?: string;
|
|
162
|
-
/** Referrer of the host page, if any. */
|
|
163
|
-
referrer?: string;
|
|
164
|
-
/** Embed mode the widget initialized in. */
|
|
165
|
-
mode?: "inline" | "floating";
|
|
166
|
-
/** Resolved device type from the visitor context. */
|
|
167
|
-
deviceType?: "mobile" | "tablet" | "desktop";
|
|
168
|
-
/** Primary browser language (BCP-47). */
|
|
169
|
-
language?: string;
|
|
170
|
-
/** IANA timezone of the visitor. */
|
|
171
|
-
timezone?: string;
|
|
172
|
-
}
|
|
173
|
-
interface ToolCalledProperties {
|
|
174
|
-
name?: string;
|
|
175
|
-
type?: "pricing" | "product_info" | "availability" | "support" | "other";
|
|
176
|
-
/** Retrieval traces for kb.search() calls made inside this tool handler. */
|
|
177
|
-
kbSearch?: KbSearchTrace[];
|
|
178
|
-
cause?: ErrorCauseType;
|
|
179
|
-
}
|
|
180
|
-
interface LinkClickedProperties {
|
|
181
|
-
url?: string;
|
|
182
|
-
}
|
|
183
|
-
interface PriceShownProperties {
|
|
184
|
-
amount: number;
|
|
185
|
-
currency: string;
|
|
186
|
-
itemId?: string;
|
|
187
|
-
label?: string;
|
|
188
|
-
}
|
|
189
|
-
interface ComparedPriceOption {
|
|
190
|
-
id: string;
|
|
191
|
-
amount: number;
|
|
192
|
-
currency: string;
|
|
193
|
-
}
|
|
194
|
-
interface PricesComparedProperties {
|
|
195
|
-
options: ComparedPriceOption[];
|
|
196
|
-
}
|
|
197
|
-
interface OptionSelectedProperties {
|
|
198
|
-
id: string;
|
|
199
|
-
amount: number;
|
|
200
|
-
currency: string;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Properties for `lead_qualified` — your code declaring that a person met your
|
|
204
|
-
* qualification bar (finished the qualifying questions, requested a demo,
|
|
205
|
-
* matched your target profile). Sharing an email mid-conversation is
|
|
206
|
-
* `identify(userId, { email })`, not a qualified lead.
|
|
207
|
-
*/
|
|
208
|
-
interface LeadQualifiedProperties {
|
|
209
|
-
/**
|
|
210
|
-
* Your own lead id (e.g. the record id your lead-gen API returns). The
|
|
211
|
-
* strongest dedup key and the stable reference back to your system.
|
|
212
|
-
*/
|
|
213
|
-
externalId?: string;
|
|
214
|
-
/** The lead's email, if known. */
|
|
215
|
-
email?: string;
|
|
216
|
-
/** The lead's name, if known. */
|
|
217
|
-
name?: string;
|
|
218
|
-
}
|
|
219
|
-
interface ConvertedProperties {
|
|
220
|
-
amount: number;
|
|
221
|
-
currency: string;
|
|
222
|
-
/** When the conversion actually happened — for backdated off-platform sales. */
|
|
223
|
-
occurredAt?: string;
|
|
224
|
-
}
|
|
225
|
-
interface SessionErrorProperties {
|
|
226
|
-
code: SessionErrorCodeType;
|
|
227
|
-
cause: ErrorCauseType;
|
|
228
|
-
tool?: string;
|
|
229
|
-
node?: string;
|
|
230
|
-
}
|
|
231
|
-
interface TrackingContext {
|
|
232
|
-
/**
|
|
233
|
-
* MCP request metadata passed through to the API.
|
|
234
|
-
*
|
|
235
|
-
* Location varies by MCP library:
|
|
236
|
-
* - `@vercel/mcp-handler`: `extra._meta`
|
|
237
|
-
* - `@modelcontextprotocol/sdk`: `request.params._meta`
|
|
238
|
-
*/
|
|
239
|
-
meta?: Record<string, unknown>;
|
|
240
|
-
/** Legacy metadata field supported for backward compatibility. */
|
|
241
|
-
metadata?: Record<string, unknown>;
|
|
242
|
-
/** Optional explicit correlation fields. */
|
|
243
|
-
sessionId?: string;
|
|
244
|
-
traceId?: string;
|
|
245
|
-
requestId?: string;
|
|
246
|
-
correlationId?: string;
|
|
247
|
-
externalUserId?: string;
|
|
248
|
-
/**
|
|
249
|
-
* Anonymous visitor id (the analytics "device id"). Counts as identity on
|
|
250
|
-
* its own: the ingest API accepts `sessionId`, `externalUserId`, or
|
|
251
|
-
* `visitorId`. The chat widget uses it for pre-session events like
|
|
252
|
-
* `page.viewed`.
|
|
253
|
-
*/
|
|
254
|
-
visitorId?: string;
|
|
255
|
-
/** Optional explicit envelope fields. */
|
|
256
|
-
eventId?: string;
|
|
257
|
-
timestamp?: string | Date;
|
|
258
|
-
source?: string;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Modern tracking shape (preferred).
|
|
262
|
-
*/
|
|
263
|
-
interface BaseTrackEvent extends TrackingContext {
|
|
264
|
-
event: EventType;
|
|
265
|
-
properties?: Record<string, unknown>;
|
|
266
|
-
}
|
|
267
|
-
type TrackEvent = ({
|
|
268
|
-
event: "session.started";
|
|
269
|
-
} & BaseTrackEvent) | ({
|
|
270
|
-
event: "page.viewed";
|
|
271
|
-
properties?: PageViewedProperties;
|
|
272
|
-
} & BaseTrackEvent) | ({
|
|
273
|
-
event: "tool.called";
|
|
274
|
-
properties?: ToolCalledProperties;
|
|
275
|
-
} & BaseTrackEvent) | ({
|
|
276
|
-
event: "link.clicked";
|
|
277
|
-
properties?: LinkClickedProperties;
|
|
278
|
-
} & BaseTrackEvent) | ({
|
|
279
|
-
event: "user.identified";
|
|
280
|
-
} & BaseTrackEvent) | ({
|
|
281
|
-
event: "widget_render";
|
|
282
|
-
} & BaseTrackEvent) | ({
|
|
283
|
-
event: "price_shown";
|
|
284
|
-
properties?: PriceShownProperties;
|
|
285
|
-
} & BaseTrackEvent) | ({
|
|
286
|
-
event: "prices_compared";
|
|
287
|
-
properties?: PricesComparedProperties;
|
|
288
|
-
} & BaseTrackEvent) | ({
|
|
289
|
-
event: "option_selected";
|
|
290
|
-
properties?: OptionSelectedProperties;
|
|
291
|
-
} & BaseTrackEvent) | ({
|
|
292
|
-
event: "lead_qualified";
|
|
293
|
-
properties?: LeadQualifiedProperties;
|
|
294
|
-
} & BaseTrackEvent) | ({
|
|
295
|
-
event: "converted";
|
|
296
|
-
properties?: ConvertedProperties;
|
|
297
|
-
} & BaseTrackEvent) | ({
|
|
298
|
-
event: "session.error";
|
|
299
|
-
properties?: SessionErrorProperties;
|
|
300
|
-
} & BaseTrackEvent);
|
|
301
|
-
/**
|
|
302
|
-
* Legacy tracking shape supported for existing integrations.
|
|
303
|
-
*/
|
|
304
|
-
interface LegacyTrackEvent extends TrackingContext {
|
|
305
|
-
eventType: EventType;
|
|
306
|
-
properties?: Record<string, unknown>;
|
|
307
|
-
toolName?: string;
|
|
308
|
-
toolType?: ToolCalledProperties["type"];
|
|
309
|
-
linkUrl?: string;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Public track input accepted by `client.track()`.
|
|
313
|
-
*/
|
|
314
|
-
type TrackInput = TrackEvent | LegacyTrackEvent;
|
|
315
|
-
interface RevenuePriceShownInput extends TrackingContext, PriceShownProperties {
|
|
316
|
-
}
|
|
317
|
-
interface RevenuePricesComparedInput extends TrackingContext, PricesComparedProperties {
|
|
318
|
-
}
|
|
319
|
-
interface RevenueOptionSelectedInput extends TrackingContext, OptionSelectedProperties {
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Input for `track.leadQualified()` — identity only (`externalId`, `email`,
|
|
323
|
-
* `name`) plus the shared tracking context. There is no acquisition-source
|
|
324
|
-
* property; the envelope `source` (the origin channel) is set automatically.
|
|
325
|
-
*/
|
|
326
|
-
interface RevenueLeadQualifiedInput extends TrackingContext, LeadQualifiedProperties {
|
|
327
|
-
}
|
|
328
|
-
interface RevenueConvertedInput extends TrackingContext, ConvertedProperties {
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Revenue-oriented helpers, flat on `client.track.*` (e.g.
|
|
332
|
-
* `client.track.priceShown()`, `client.track.converted()`). Decoupled from
|
|
333
|
-
* product primitives — each maps to a typed first-class revenue event.
|
|
334
|
-
*/
|
|
335
|
-
interface RevenueTrackingApi {
|
|
336
|
-
priceShown: (input: RevenuePriceShownInput) => Promise<{
|
|
337
|
-
eventId: string;
|
|
338
|
-
}>;
|
|
339
|
-
pricesCompared: (input: RevenuePricesComparedInput) => Promise<{
|
|
340
|
-
eventId: string;
|
|
341
|
-
}>;
|
|
342
|
-
optionSelected: (input: RevenueOptionSelectedInput) => Promise<{
|
|
343
|
-
eventId: string;
|
|
344
|
-
}>;
|
|
345
|
-
leadQualified: (input?: RevenueLeadQualifiedInput) => Promise<{
|
|
346
|
-
eventId: string;
|
|
347
|
-
}>;
|
|
348
|
-
converted: (input: RevenueConvertedInput) => Promise<{
|
|
349
|
-
eventId: string;
|
|
350
|
-
}>;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* `client.track` — callable for generic events (`track(event)`), with the
|
|
354
|
-
* revenue helpers attached flat: `track.priceShown()`, `track.leadQualified()`,
|
|
355
|
-
* `track.converted()`, etc.
|
|
356
|
-
*/
|
|
357
|
-
interface TrackFn extends RevenueTrackingApi {
|
|
358
|
-
(event: TrackInput): Promise<{
|
|
359
|
-
eventId: string;
|
|
360
|
-
}>;
|
|
361
|
-
}
|
|
362
|
-
interface TrackingConfig {
|
|
363
|
-
/** Events API V2 endpoint path. */
|
|
364
|
-
endpointPath?: string;
|
|
365
|
-
/** Periodic flush interval for buffered events. */
|
|
366
|
-
flushIntervalMs?: number;
|
|
367
|
-
/** Max events per HTTP batch send. */
|
|
368
|
-
maxBatchSize?: number;
|
|
369
|
-
/** Max in-memory buffer size before oldest items are dropped. */
|
|
370
|
-
maxBufferSize?: number;
|
|
371
|
-
/** Number of retries for retryable failures. */
|
|
372
|
-
maxRetries?: number;
|
|
373
|
-
/** Retry backoff base delay. */
|
|
374
|
-
retryBaseDelayMs?: number;
|
|
375
|
-
/** Retry backoff max delay. */
|
|
376
|
-
retryMaxDelayMs?: number;
|
|
377
|
-
/** Default shutdown timeout when none is provided. */
|
|
378
|
-
shutdownTimeoutMs?: number;
|
|
379
|
-
}
|
|
380
|
-
interface TrackingShutdownOptions {
|
|
381
|
-
timeoutMs?: number;
|
|
382
|
-
}
|
|
383
|
-
interface TrackingShutdownResult {
|
|
384
|
-
timedOut: boolean;
|
|
385
|
-
pendingEvents: number;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Tracking module methods for WaniWaniClient.
|
|
389
|
-
*/
|
|
390
|
-
interface TrackingClient {
|
|
391
|
-
/**
|
|
392
|
-
* Send a one-shot identify event for a user.
|
|
393
|
-
* userId can be any string: an email, an internal ID, etc.
|
|
394
|
-
*/
|
|
395
|
-
identify: (userId: string, properties?: Record<string, unknown>, meta?: Record<string, unknown>) => Promise<{
|
|
396
|
-
eventId: string;
|
|
397
|
-
}>;
|
|
398
|
-
/**
|
|
399
|
-
* Track an event using modern or legacy input shape.
|
|
400
|
-
* Returns a deterministic event id immediately after enqueue.
|
|
401
|
-
*
|
|
402
|
-
* Also exposes the revenue helpers flat: `client.track.priceShown()`,
|
|
403
|
-
* `client.track.leadQualified()`, `client.track.converted()`, etc.
|
|
404
|
-
*/
|
|
405
|
-
track: TrackFn;
|
|
406
|
-
/**
|
|
407
|
-
* Flush all currently buffered events.
|
|
408
|
-
*/
|
|
409
|
-
flush: () => Promise<void>;
|
|
410
|
-
/**
|
|
411
|
-
* Flush and stop the transport.
|
|
412
|
-
*/
|
|
413
|
-
shutdown: (options?: TrackingShutdownOptions) => Promise<TrackingShutdownResult>;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* A request-scoped Waniwani client with meta pre-attached.
|
|
418
|
-
*
|
|
419
|
-
* Available as `context.waniwani` inside `createTool` handlers and flow nodes
|
|
420
|
-
* when the server is wrapped with `withWaniwani()`.
|
|
421
|
-
*/
|
|
422
|
-
interface ScopedWaniWaniClient {
|
|
423
|
-
/**
|
|
424
|
-
* The session id this request's events correlate to, resolved from the
|
|
425
|
-
* request meta. Read it to link the session to your own records (store it
|
|
426
|
-
* on a lead, then send an off-platform `converted` with the same
|
|
427
|
-
* `sessionId` later). `undefined` when the host provided no session id.
|
|
428
|
-
*/
|
|
429
|
-
readonly sessionId?: string;
|
|
430
|
-
/**
|
|
431
|
-
* The anonymous visitor id, resolved from the request meta. Present on the
|
|
432
|
-
* web chat surface (a persisted per-device id threaded through as
|
|
433
|
-
* `waniwani/visitorId`); `undefined` on hosts that do not supply one, such
|
|
434
|
-
* as Claude. Ingest accepts it as an identity in its own right, so use it
|
|
435
|
-
* to correlate events before a session or user id exists.
|
|
436
|
-
*/
|
|
437
|
-
readonly visitorId?: string;
|
|
438
|
-
/**
|
|
439
|
-
* The external user id, resolved from the request meta (e.g. `openai/userId`
|
|
440
|
-
* for ChatGPT's anonymous users, or a host-provided `externalUserId`). Read
|
|
441
|
-
* it alongside `sessionId`/`visitorId` — whichever the current host provides.
|
|
442
|
-
* `undefined` when the host supplied no user id.
|
|
443
|
-
*/
|
|
444
|
-
readonly externalUserId?: string;
|
|
445
|
-
/**
|
|
446
|
-
* Track an event — request meta is automatically merged. Also exposes the
|
|
447
|
-
* revenue helpers flat (`track.priceShown()`, `track.converted()`, …), which
|
|
448
|
-
* inherit the same scoped meta (so identity is carried from the request).
|
|
449
|
-
*/
|
|
450
|
-
track: TrackFn;
|
|
451
|
-
/** Identify a user — request meta is automatically merged. */
|
|
452
|
-
identify(userId: string, properties?: Record<string, unknown>): Promise<{
|
|
453
|
-
eventId: string;
|
|
454
|
-
}>;
|
|
455
|
-
/** Knowledge base client (no meta needed). */
|
|
456
|
-
readonly kb: KbClient;
|
|
457
|
-
/** @internal Resolved API config from withWaniwani(). */
|
|
458
|
-
readonly _config?: {
|
|
459
|
-
apiUrl?: string;
|
|
460
|
-
apiKey?: string;
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
type ToolHandlerContext = {
|
|
465
|
-
/** Raw MCP request extra data (includes _meta for session extraction) */
|
|
466
|
-
extra?: {
|
|
467
|
-
_meta?: Record<string, unknown>;
|
|
468
|
-
};
|
|
469
|
-
/** Session-scoped Waniwani client — available when the server is wrapped with withWaniwani() */
|
|
470
|
-
waniwani?: ScopedWaniWaniClient;
|
|
471
|
-
};
|
|
472
|
-
type ToolConfig<TInput extends ZodRawShapeCompat> = {
|
|
473
|
-
/** The resource (HTML template) this tool renders. When present, tool returns structuredContent + widget _meta. */
|
|
474
|
-
resource?: RegisteredResource;
|
|
475
|
-
/** Tool identifier. Defaults to resource.id when resource is present, required otherwise. */
|
|
476
|
-
id?: string;
|
|
477
|
-
/** Display title. Defaults to resource.title when resource is present, required otherwise. */
|
|
478
|
-
title?: string;
|
|
479
|
-
/** Action-oriented description for the tool (tells the model WHEN to use it) */
|
|
480
|
-
description: string;
|
|
481
|
-
/** UI component description (describes WHAT the widget displays). Falls back to description. Only relevant when resource is present. */
|
|
482
|
-
widgetDescription?: string;
|
|
483
|
-
/** Input schema using zod */
|
|
484
|
-
inputSchema: TInput;
|
|
485
|
-
/** Optional loading message (defaults to "Loading..."). Only relevant when resource is present. */
|
|
486
|
-
invoking?: string;
|
|
487
|
-
/** Optional loaded message (defaults to "Loaded"). Only relevant when resource is present. */
|
|
488
|
-
invoked?: string;
|
|
489
|
-
/**
|
|
490
|
-
* When a widget calls this tool via `tools/call`, should the host auto-inject
|
|
491
|
-
* the tool's text result into the next follow-up message if the widget does
|
|
492
|
-
* not send one itself. Defaults to true. Set false for helper tools whose
|
|
493
|
-
* result is consumed programmatically by the widget.
|
|
494
|
-
*/
|
|
495
|
-
autoInjectResultText?: boolean;
|
|
496
|
-
/**
|
|
497
|
-
* Annotations describe the tool's potential impact. Passed through to
|
|
498
|
-
* `registerTool` as-is.
|
|
499
|
-
*
|
|
500
|
-
* Includes MCP's `title` — a human-readable name for the tool. Claude's
|
|
501
|
-
* Connectors Directory requires it on every tool and flags the server at
|
|
502
|
-
* submission without it; the top-level `title` does not satisfy that.
|
|
503
|
-
*/
|
|
504
|
-
annotations?: ToolAnnotations;
|
|
505
|
-
};
|
|
506
|
-
type ToolHandler<TInput extends ZodRawShapeCompat> = (input: ShapeOutput<TInput>, context: ToolHandlerContext) => Promise<{
|
|
507
|
-
/** Text content to return */
|
|
508
|
-
text: string;
|
|
509
|
-
/** Structured data returned as MCP `structuredContent`. */
|
|
510
|
-
data?: Record<string, unknown>;
|
|
511
|
-
}>;
|
|
512
|
-
type ToolToolCallback<TInput extends ZodRawShapeCompat> = ToolCallback<TInput>;
|
|
513
|
-
type RegisteredTool = {
|
|
514
|
-
id: string;
|
|
515
|
-
title: string;
|
|
516
|
-
description: string;
|
|
517
|
-
/** Register the tool on the server */
|
|
518
|
-
register: (server: McpServer) => Promise<void>;
|
|
519
|
-
};
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Creates an MCP tool with minimal boilerplate.
|
|
523
|
-
*
|
|
524
|
-
* When `handler()` returns `data`, the tool includes it as MCP `structuredContent`.
|
|
525
|
-
* When `config.resource` is provided, the tool also returns widget metadata.
|
|
526
|
-
*
|
|
527
|
-
* @deprecated Prefer `createFlow` from `@waniwani/sdk/mcp` for new code. `createTool`
|
|
528
|
-
* is preserved for back-compat with existing customer MCPs but is no longer documented;
|
|
529
|
-
* it will move to `@waniwani/sdk/legacy` in a future minor release.
|
|
530
|
-
*
|
|
531
|
-
* @example
|
|
532
|
-
* ```ts
|
|
533
|
-
* // Widget tool (with resource)
|
|
534
|
-
* const pricingTool = createTool({
|
|
535
|
-
* resource: pricingUI,
|
|
536
|
-
* description: "Show pricing comparison",
|
|
537
|
-
* inputSchema: { postalCode: z.string() },
|
|
538
|
-
* }, async ({ postalCode }) => ({
|
|
539
|
-
* text: "Pricing loaded",
|
|
540
|
-
* data: { postalCode, prices: [] },
|
|
541
|
-
* }));
|
|
542
|
-
*
|
|
543
|
-
* // Plain tool (no resource)
|
|
544
|
-
* const searchTool = createTool({
|
|
545
|
-
* id: "search",
|
|
546
|
-
* title: "Search",
|
|
547
|
-
* description: "Search the knowledge base",
|
|
548
|
-
* inputSchema: { query: z.string() },
|
|
549
|
-
* }, async ({ query }) => ({
|
|
550
|
-
* text: `Results for "${query}"`,
|
|
551
|
-
* }));
|
|
552
|
-
* ```
|
|
553
|
-
*/
|
|
554
|
-
declare function createTool<TInput extends z.ZodRawShape>(config: ToolConfig<TInput>, handler: ToolHandler<TInput>): RegisteredTool;
|
|
555
|
-
/**
|
|
556
|
-
* Registers multiple tools on the server.
|
|
557
|
-
*
|
|
558
|
-
* @deprecated Prefer `createFlow` + `.register()` for new code. Preserved for back-compat
|
|
559
|
-
* with existing customer MCPs; will move to `@waniwani/sdk/legacy` in a future minor release.
|
|
560
|
-
*/
|
|
561
|
-
declare function registerTools(server: McpServer, tools: RegisteredTool[]): Promise<void>;
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Initializes & patches Next.js functionality so an app can run as a
|
|
565
|
-
* widget inside a cross-origin iframe. Used by every MCP widget host —
|
|
566
|
-
* ChatGPT's sandbox, the embed's `/api/mcp/chat/resource` proxy, and any
|
|
567
|
-
* future host that renders the widget on a domain other than its own
|
|
568
|
-
* `baseUrl`.
|
|
569
|
-
*
|
|
570
|
-
* See `applyIframePatches` for the patch behavior.
|
|
571
|
-
*
|
|
572
|
-
* More background on the ChatGPT case:
|
|
573
|
-
* https://vercel.com/blog/running-next-js-inside-chatgpt-a-deep-dive-into-native-app-integration
|
|
574
|
-
*
|
|
575
|
-
* @deprecated Legacy MCP-widget-in-host stack (used with `createResource`/`createTool`).
|
|
576
|
-
* Preserved for back-compat; will move to `@waniwani/sdk/legacy/react` in a future minor
|
|
577
|
-
* release.
|
|
578
|
-
*/
|
|
579
|
-
declare function InitializeNextJsInIframe({ baseUrl, passthroughOrigins, }: {
|
|
580
|
-
baseUrl: string;
|
|
581
|
-
/**
|
|
582
|
-
* Origins whose fetches should skip the relative same-origin → baseUrl
|
|
583
|
-
* rewrite. Only needed for relative-URL calls that resolve to an
|
|
584
|
-
* origin you do not want forwarded to `baseUrl` — absolute URLs are
|
|
585
|
-
* never rewritten regardless of this list.
|
|
586
|
-
*/
|
|
587
|
-
passthroughOrigins?: string[];
|
|
588
|
-
}): react_jsx_runtime.JSX.Element;
|
|
589
|
-
|
|
590
|
-
interface DevControlsProps {
|
|
591
|
-
defaultProps?: Record<string, unknown>;
|
|
592
|
-
widgetPaths?: string[];
|
|
593
|
-
}
|
|
594
|
-
/**
|
|
595
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
596
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
597
|
-
*/
|
|
598
|
-
declare function DevModeProvider({ defaultProps, widgetPaths, children, }: DevControlsProps & {
|
|
599
|
-
children: React.ReactNode;
|
|
600
|
-
}): react_jsx_runtime.JSX.Element | null;
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* Source: https://github.com/openai/openai-apps-sdk-examples/tree/main/src
|
|
604
|
-
*/
|
|
605
|
-
type OpenAIGlobals<ToolInput = UnknownObject, ToolOutput = UnknownObject, ToolResponseMetadata = UnknownObject, WidgetState = UnknownObject> = {
|
|
606
|
-
theme: Theme;
|
|
607
|
-
userAgent: UserAgent;
|
|
608
|
-
locale: string;
|
|
609
|
-
maxHeight: number;
|
|
610
|
-
displayMode: DisplayMode;
|
|
611
|
-
safeArea: SafeArea;
|
|
612
|
-
toolInput: ToolInput;
|
|
613
|
-
toolOutput: ToolOutput | null;
|
|
614
|
-
toolResponseMetadata: ToolResponseMetadata | null;
|
|
615
|
-
widgetState: WidgetState | null;
|
|
616
|
-
setWidgetState: (state: WidgetState) => Promise<void>;
|
|
617
|
-
};
|
|
618
|
-
type API = {
|
|
619
|
-
callTool: CallTool;
|
|
620
|
-
sendFollowUpMessage: (args: {
|
|
621
|
-
prompt: string;
|
|
622
|
-
}) => Promise<void>;
|
|
623
|
-
openExternal(payload: {
|
|
624
|
-
href: string;
|
|
625
|
-
}): void;
|
|
626
|
-
requestDisplayMode: RequestDisplayMode;
|
|
627
|
-
};
|
|
628
|
-
type UnknownObject = Record<string, unknown>;
|
|
629
|
-
type Theme = "light" | "dark";
|
|
630
|
-
type SafeAreaInsets = {
|
|
631
|
-
top: number;
|
|
632
|
-
bottom: number;
|
|
633
|
-
left: number;
|
|
634
|
-
right: number;
|
|
635
|
-
};
|
|
636
|
-
type SafeArea = {
|
|
637
|
-
insets: SafeAreaInsets;
|
|
638
|
-
};
|
|
639
|
-
type DeviceType = "mobile" | "tablet" | "desktop" | "unknown";
|
|
640
|
-
type UserAgent = {
|
|
641
|
-
device: {
|
|
642
|
-
type: DeviceType;
|
|
643
|
-
};
|
|
644
|
-
capabilities: {
|
|
645
|
-
hover: boolean;
|
|
646
|
-
touch: boolean;
|
|
647
|
-
};
|
|
648
|
-
};
|
|
649
|
-
/** Display mode */
|
|
650
|
-
type DisplayMode = "pip" | "inline" | "fullscreen";
|
|
651
|
-
type RequestDisplayMode = (args: {
|
|
652
|
-
mode: DisplayMode;
|
|
653
|
-
}) => Promise<{
|
|
654
|
-
/**
|
|
655
|
-
* The granted display mode. The host may reject the request.
|
|
656
|
-
* For mobile, PiP is always coerced to fullscreen.
|
|
657
|
-
*/
|
|
658
|
-
mode: DisplayMode;
|
|
659
|
-
}>;
|
|
660
|
-
type CallToolResponse = {
|
|
661
|
-
result: string;
|
|
662
|
-
};
|
|
663
|
-
/** Calling APIs */
|
|
664
|
-
type CallTool = (name: string, args: Record<string, unknown>) => Promise<CallToolResponse>;
|
|
665
|
-
/** Extra events */
|
|
666
|
-
declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
667
|
-
declare class SetGlobalsEvent extends CustomEvent<{
|
|
668
|
-
globals: Partial<OpenAIGlobals>;
|
|
669
|
-
}> {
|
|
670
|
-
constructor(detail: {
|
|
671
|
-
globals: Partial<OpenAIGlobals>;
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Global oai object injected by the web sandbox for communicating with chatgpt host page.
|
|
676
|
-
*/
|
|
677
|
-
declare global {
|
|
678
|
-
interface Window {
|
|
679
|
-
openai: API & OpenAIGlobals;
|
|
680
|
-
innerBaseUrl: string;
|
|
681
|
-
}
|
|
682
|
-
interface WindowEventMap {
|
|
683
|
-
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
declare let mockState: Omit<OpenAIGlobals, "setWidgetState">;
|
|
688
|
-
declare function initializeMockOpenAI(initialToolOutput?: Record<string, unknown>): void;
|
|
689
|
-
declare function updateMockGlobal<K extends keyof OpenAIGlobals>(key: K, value: OpenAIGlobals[K]): void;
|
|
690
|
-
declare function getMockState(): typeof mockState;
|
|
691
|
-
declare function updateMockToolOutput(props: Record<string, unknown>): void;
|
|
692
|
-
declare function updateMockDisplayMode(mode: DisplayMode): void;
|
|
693
|
-
declare function updateMockTheme(theme: Theme): void;
|
|
694
|
-
|
|
695
|
-
type ModelContextContentBlock = ContentBlock;
|
|
696
|
-
type ModelContextUpdate = {
|
|
697
|
-
content?: ModelContextContentBlock[];
|
|
698
|
-
structuredContent?: Record<string, unknown>;
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
interface SendFollowUpOptions {
|
|
702
|
-
modelContext?: ModelContextUpdate | null;
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
|
-
* Get a function to send follow-up messages to the AI.
|
|
706
|
-
* Works on both OpenAI widgets and MCP Apps.
|
|
707
|
-
*
|
|
708
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
709
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
710
|
-
* @returns A function that sends a follow-up message
|
|
711
|
-
*/
|
|
712
|
-
declare function useSendFollowUp(): (prompt: string, options?: SendFollowUpOptions) => void;
|
|
713
|
-
|
|
714
|
-
interface UnstableSendFollowUpWithGhostGuardResult {
|
|
715
|
-
/** Wrapped `sendFollowUp`. Same signature as the one you passed in. */
|
|
716
|
-
sendFollowUp: (prompt: string, options?: SendFollowUpOptions) => void;
|
|
717
|
-
/**
|
|
718
|
-
* Wrap your widget's root render with this so the suppression can take
|
|
719
|
-
* effect. On non-ChatGPT hosts it is a transparent pass-through.
|
|
720
|
-
*/
|
|
721
|
-
Guard: (props: {
|
|
722
|
-
children: ReactNode;
|
|
723
|
-
}) => JSX.Element | null;
|
|
724
|
-
}
|
|
725
|
-
/**
|
|
726
|
-
* ⚠️ EXPERIMENTAL — DO NOT USE UNLESS YOU UNDERSTAND THE TRADE-OFFS ⚠️
|
|
727
|
-
*
|
|
728
|
-
* Wraps an existing `sendFollowUp` with ghost-guard suppression specific
|
|
729
|
-
* to ChatGPT. ChatGPT renders the source widget a SECOND time alongside
|
|
730
|
-
* the new user message a widget emits via `sendFollowUpMessage`. The
|
|
731
|
-
* second iframe is a brand-new React tree with no link to the original;
|
|
732
|
-
* skybridge's `useViewState` persistence does not survive across them.
|
|
733
|
-
* The result is a visible duplicate widget for ~1s before ChatGPT
|
|
734
|
-
* collapses one of them.
|
|
735
|
-
*
|
|
736
|
-
* On ChatGPT the hook adds a per-`viewUUID` `localStorage` write before
|
|
737
|
-
* each `sendFollowUp` call, and the returned `Guard` checks that record
|
|
738
|
-
* on mount — if it sees a record set by a different `mountId` within
|
|
739
|
-
* `ADVANCED_WINDOW_MS`, it collapses the iframe to 0×0.
|
|
740
|
-
*
|
|
741
|
-
* On every other host (Waniwani embed, MCP Apps, etc.) the hook is a
|
|
742
|
-
* pure pass-through: `sendFollowUp` is your function unchanged and
|
|
743
|
-
* `Guard` is a transparent fragment.
|
|
744
|
-
*
|
|
745
|
-
* The hook does NOT require `WidgetProvider`. It reads the widget's
|
|
746
|
-
* `viewUUID` from `WidgetClientContext` when one is available and falls
|
|
747
|
-
* back to `window.openai.toolResponseMetadata.viewUUID` otherwise.
|
|
748
|
-
*
|
|
749
|
-
* Caveats:
|
|
750
|
-
* - Relies on ChatGPT's widget iframes sharing a single `localStorage`
|
|
751
|
-
* scope — verified at the time of writing but not guaranteed.
|
|
752
|
-
* - 10s suppression window per `viewUUID`. Two unrelated `sendFollowUp`
|
|
753
|
-
* calls inside 10s with the same viewUUID could mistakenly suppress one.
|
|
754
|
-
* - The `Guard` MUST wrap the widget's root render. If you forget it,
|
|
755
|
-
* the localStorage write happens but nothing is suppressed.
|
|
756
|
-
*
|
|
757
|
-
* @param sendFollowUp - The underlying `sendFollowUp` to wrap. On ChatGPT the
|
|
758
|
-
* hook adds the per-`viewUUID` localStorage write before delegating; on any
|
|
759
|
-
* other host the hook is a pure pass-through. Typically the value of
|
|
760
|
-
* `useSendFollowUpMessage()` from `skybridge/web` or `useSendFollowUp()`
|
|
761
|
-
* from this module.
|
|
762
|
-
*
|
|
763
|
-
* @example
|
|
764
|
-
* function MyWidget() {
|
|
765
|
-
* const sendFollowUpMessage = useSendFollowUpMessage(); // skybridge/web
|
|
766
|
-
* const { sendFollowUp, Guard } =
|
|
767
|
-
* unstable_useSendFollowUpWithGhostGuard(sendFollowUpMessage);
|
|
768
|
-
*
|
|
769
|
-
* // The Guard MUST wrap the widget's root render, otherwise the ghost
|
|
770
|
-
* // iframe will not be suppressed.
|
|
771
|
-
* return (
|
|
772
|
-
* <Guard>
|
|
773
|
-
* <div className="my-widget">
|
|
774
|
-
* <button onClick={() => sendFollowUp("I uploaded my bill")}>
|
|
775
|
-
* Continue
|
|
776
|
-
* </button>
|
|
777
|
-
* </div>
|
|
778
|
-
* </Guard>
|
|
779
|
-
* );
|
|
780
|
-
* }
|
|
781
|
-
*
|
|
782
|
-
* @experimental Subject to change or removal without notice.
|
|
783
|
-
*/
|
|
784
|
-
declare function unstable_useSendFollowUpWithGhostGuard(sendFollowUp: (prompt: string) => void | Promise<void>): UnstableSendFollowUpWithGhostGuardResult;
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
* Result from calling a tool
|
|
788
|
-
*/
|
|
789
|
-
type ToolCallResult = CallToolResult;
|
|
790
|
-
/**
|
|
791
|
-
* Tool result notification (what the host pushes to the widget)
|
|
792
|
-
*/
|
|
793
|
-
type ToolResult = CallToolResult;
|
|
794
|
-
/**
|
|
795
|
-
* Host context - all values available from the host.
|
|
796
|
-
*/
|
|
797
|
-
type HostContext = {
|
|
798
|
-
theme: Theme;
|
|
799
|
-
locale: string;
|
|
800
|
-
displayMode: DisplayMode;
|
|
801
|
-
maxHeight: number | null;
|
|
802
|
-
safeArea: SafeArea | null;
|
|
803
|
-
toolOutput: UnknownObject | null;
|
|
804
|
-
toolResponseMetadata: UnknownObject | null;
|
|
805
|
-
widgetState: UnknownObject | null;
|
|
806
|
-
};
|
|
807
|
-
/**
|
|
808
|
-
* Unified widget client interface that works on both OpenAI and MCP Apps.
|
|
809
|
-
*
|
|
810
|
-
* Platform-specific behavior:
|
|
811
|
-
* - Display mode: OpenAI-only. MCP Apps returns "inline" and requestDisplayMode is a no-op.
|
|
812
|
-
* - Follow-up messages: Unified API, different underlying implementations.
|
|
813
|
-
*/
|
|
814
|
-
interface UnifiedWidgetClient {
|
|
815
|
-
/**
|
|
816
|
-
* Connect to the host. Must be called before using other methods.
|
|
817
|
-
* On OpenAI, this is a no-op (already connected via window.openai).
|
|
818
|
-
* On MCP Apps, this establishes the postMessage connection.
|
|
819
|
-
*/
|
|
820
|
-
connect(): Promise<void>;
|
|
821
|
-
/**
|
|
822
|
-
* Close the connection to the host and clean up resources.
|
|
823
|
-
* On OpenAI, this is a no-op.
|
|
824
|
-
* On MCP Apps, this closes the transport and removes event listeners.
|
|
825
|
-
*/
|
|
826
|
-
close(): Promise<void>;
|
|
827
|
-
/**
|
|
828
|
-
* Get the tool output (structured content returned by the tool handler).
|
|
829
|
-
* This is the main data source for widget rendering.
|
|
830
|
-
*/
|
|
831
|
-
getToolOutput<T = Record<string, unknown>>(): T | null;
|
|
832
|
-
/**
|
|
833
|
-
* Register a callback for when tool results are received.
|
|
834
|
-
* On OpenAI, this subscribes to toolOutput changes.
|
|
835
|
-
* On MCP Apps, this sets app.ontoolresult.
|
|
836
|
-
*/
|
|
837
|
-
onToolResult(callback: (result: ToolResult) => void): () => void;
|
|
838
|
-
/**
|
|
839
|
-
* Call another tool on the server.
|
|
840
|
-
*/
|
|
841
|
-
callTool(name: string, args: Record<string, unknown>): Promise<ToolCallResult>;
|
|
842
|
-
/**
|
|
843
|
-
* Open an external URL.
|
|
844
|
-
* On OpenAI: openai.openExternal({ href })
|
|
845
|
-
* On MCP Apps: app.sendOpenLink(url)
|
|
846
|
-
*/
|
|
847
|
-
openExternal(url: string): void;
|
|
848
|
-
/**
|
|
849
|
-
* Send a follow-up message to the AI.
|
|
850
|
-
* On OpenAI: openai.sendFollowUpMessage({ prompt })
|
|
851
|
-
* On MCP Apps: app.sendMessages([{ role: 'user', content: { type: 'text', text: prompt } }])
|
|
852
|
-
*/
|
|
853
|
-
sendFollowUp(prompt: string): void | Promise<void>;
|
|
854
|
-
/**
|
|
855
|
-
* Update hidden model context for the next assistant turn.
|
|
856
|
-
* On MCP Apps this uses the standard `ui/update-model-context` request.
|
|
857
|
-
* On other hosts this may fall back to best-effort behavior.
|
|
858
|
-
*/
|
|
859
|
-
updateModelContext(context: ModelContextUpdate): Promise<void> | void;
|
|
860
|
-
/**
|
|
861
|
-
* Get the current theme.
|
|
862
|
-
*/
|
|
863
|
-
getTheme(): Theme;
|
|
864
|
-
/**
|
|
865
|
-
* Subscribe to theme changes.
|
|
866
|
-
*/
|
|
867
|
-
onThemeChange(callback: (theme: Theme) => void): () => void;
|
|
868
|
-
/**
|
|
869
|
-
* Get the current locale.
|
|
870
|
-
*/
|
|
871
|
-
getLocale(): string;
|
|
872
|
-
/**
|
|
873
|
-
* Get the current display mode.
|
|
874
|
-
* OpenAI-only: returns "pip" | "inline" | "fullscreen"
|
|
875
|
-
* MCP Apps: always returns "inline"
|
|
876
|
-
*/
|
|
877
|
-
getDisplayMode(): DisplayMode;
|
|
878
|
-
/**
|
|
879
|
-
* Request a display mode change.
|
|
880
|
-
* OpenAI-only: requests the mode from the host.
|
|
881
|
-
* MCP Apps: no-op (returns current mode).
|
|
882
|
-
*/
|
|
883
|
-
requestDisplayMode(mode: DisplayMode): Promise<DisplayMode>;
|
|
884
|
-
/**
|
|
885
|
-
* Subscribe to display mode changes.
|
|
886
|
-
* OpenAI-only: subscribes to displayMode changes.
|
|
887
|
-
* MCP Apps: callback is never called.
|
|
888
|
-
*/
|
|
889
|
-
onDisplayModeChange(callback: (mode: DisplayMode) => void): () => void;
|
|
890
|
-
/**
|
|
891
|
-
* Get the safe area insets.
|
|
892
|
-
* OpenAI-only: returns insets from window.openai.safeArea.
|
|
893
|
-
* MCP Apps: returns null.
|
|
894
|
-
*/
|
|
895
|
-
getSafeArea(): SafeArea | null;
|
|
896
|
-
/**
|
|
897
|
-
* Subscribe to safe area changes.
|
|
898
|
-
* OpenAI-only: subscribes to safeArea changes.
|
|
899
|
-
* MCP Apps: callback is never called.
|
|
900
|
-
*/
|
|
901
|
-
onSafeAreaChange(callback: (safeArea: SafeArea | null) => void): () => void;
|
|
902
|
-
/**
|
|
903
|
-
* Get the max height constraint.
|
|
904
|
-
* OpenAI-only: returns maxHeight from window.openai.maxHeight.
|
|
905
|
-
* MCP Apps: returns null.
|
|
906
|
-
*/
|
|
907
|
-
getMaxHeight(): number | null;
|
|
908
|
-
/**
|
|
909
|
-
* Subscribe to max height changes.
|
|
910
|
-
* OpenAI-only: subscribes to maxHeight changes.
|
|
911
|
-
* MCP Apps: callback is never called.
|
|
912
|
-
*/
|
|
913
|
-
onMaxHeightChange(callback: (maxHeight: number | null) => void): () => void;
|
|
914
|
-
/**
|
|
915
|
-
* Get the tool response metadata.
|
|
916
|
-
* OpenAI: returns metadata from window.openai.toolResponseMetadata.
|
|
917
|
-
* MCP Apps: returns `_meta` from the latest `ui/notifications/tool-result`, if provided by host.
|
|
918
|
-
*/
|
|
919
|
-
getToolResponseMetadata(): UnknownObject | null;
|
|
920
|
-
/**
|
|
921
|
-
* Subscribe to tool response metadata changes.
|
|
922
|
-
* OpenAI: subscribes to toolResponseMetadata changes.
|
|
923
|
-
* MCP Apps: fires when tool result `_meta` changes.
|
|
924
|
-
*/
|
|
925
|
-
onToolResponseMetadataChange(callback: (metadata: UnknownObject | null) => void): () => void;
|
|
926
|
-
/**
|
|
927
|
-
* Get the widget state.
|
|
928
|
-
* OpenAI-only: returns state from window.openai.widgetState.
|
|
929
|
-
* MCP Apps: returns null.
|
|
930
|
-
*/
|
|
931
|
-
getWidgetState(): UnknownObject | null;
|
|
932
|
-
/**
|
|
933
|
-
* Subscribe to widget state changes.
|
|
934
|
-
* OpenAI-only: subscribes to widgetState changes.
|
|
935
|
-
* MCP Apps: callback is never called.
|
|
936
|
-
*/
|
|
937
|
-
onWidgetStateChange(callback: (state: UnknownObject | null) => void): () => void;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
/**
|
|
941
|
-
* Get a function to call other tools.
|
|
942
|
-
* Works on both OpenAI widgets and MCP Apps.
|
|
943
|
-
*
|
|
944
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
945
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
946
|
-
* @returns A function to call tools with their name and arguments
|
|
947
|
-
*/
|
|
948
|
-
declare function useCallTool(): (name: string, args: Record<string, unknown>) => Promise<ToolCallResult>;
|
|
949
|
-
|
|
950
|
-
/**
|
|
951
|
-
* Get the current display mode.
|
|
952
|
-
* Works on both OpenAI widgets and MCP Apps.
|
|
953
|
-
*
|
|
954
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
955
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
956
|
-
* @returns The current display mode ("pip" | "inline" | "fullscreen")
|
|
957
|
-
*/
|
|
958
|
-
declare function useDisplayMode(): DisplayMode;
|
|
959
|
-
|
|
960
|
-
/** Return type of the useFlowAction hook */
|
|
961
|
-
type FlowActionResult<T> = {
|
|
962
|
-
/** Current widget data from structuredContent. */
|
|
963
|
-
data: T | null;
|
|
964
|
-
};
|
|
965
|
-
/**
|
|
966
|
-
* Hook for reading flow widget data from structuredContent.
|
|
967
|
-
* Lightweight wrapper over `useToolOutput` — will be extended
|
|
968
|
-
* with flow-specific features in the future.
|
|
969
|
-
*
|
|
970
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
971
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
972
|
-
*
|
|
973
|
-
* @example
|
|
974
|
-
* ```tsx
|
|
975
|
-
* const { data } = useFlowAction<{ plans: string[] }>();
|
|
976
|
-
* if (!data) return null;
|
|
977
|
-
* return <PricingTable plans={data.plans} />;
|
|
978
|
-
* ```
|
|
979
|
-
*/
|
|
980
|
-
declare function useFlowAction<T extends Record<string, unknown>>(): FlowActionResult<T>;
|
|
981
|
-
|
|
982
|
-
/**
|
|
983
|
-
* Check if running in ChatGPT app (OpenAI-only).
|
|
984
|
-
* Returns false on MCP Apps.
|
|
985
|
-
*
|
|
986
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
987
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
988
|
-
* @returns Whether the widget is running in ChatGPT app
|
|
989
|
-
*/
|
|
990
|
-
declare function useIsChatGptApp(): boolean;
|
|
991
|
-
|
|
992
|
-
/**
|
|
993
|
-
* Get the current locale.
|
|
994
|
-
* Works on both OpenAI widgets and MCP Apps.
|
|
995
|
-
*
|
|
996
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
997
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
998
|
-
* @returns The current locale string (e.g., "en-US")
|
|
999
|
-
*/
|
|
1000
|
-
declare function useLocale(): string;
|
|
1001
|
-
|
|
1002
|
-
/**
|
|
1003
|
-
* Get the maximum height available for the widget (OpenAI-only).
|
|
1004
|
-
* Useful for responsive layouts that need to adapt to container constraints.
|
|
1005
|
-
* Returns null on MCP Apps.
|
|
1006
|
-
*
|
|
1007
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1008
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1009
|
-
* @returns The maximum height in pixels, or null if not available
|
|
1010
|
-
*/
|
|
1011
|
-
declare function useMaxHeight(): number | null;
|
|
1012
|
-
|
|
1013
|
-
/**
|
|
1014
|
-
* Get a function to open external URLs.
|
|
1015
|
-
* Works on both OpenAI widgets and MCP Apps.
|
|
1016
|
-
*
|
|
1017
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1018
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1019
|
-
* @returns A function that opens external URLs
|
|
1020
|
-
*/
|
|
1021
|
-
declare function useOpenExternal(): (url: string) => void;
|
|
1022
|
-
|
|
1023
|
-
/**
|
|
1024
|
-
* Get a function to request display mode changes.
|
|
1025
|
-
* On MCP Apps, this may be a no-op depending on host support.
|
|
1026
|
-
*
|
|
1027
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1028
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1029
|
-
* @returns A function to request a specific display mode
|
|
1030
|
-
*/
|
|
1031
|
-
declare function useRequestDisplayMode(): (mode: DisplayMode) => Promise<DisplayMode>;
|
|
1032
|
-
|
|
1033
|
-
/**
|
|
1034
|
-
* Get safe area insets (OpenAI-only).
|
|
1035
|
-
* Useful for ensuring UI elements don't get hidden behind the chat input.
|
|
1036
|
-
* Returns null on MCP Apps.
|
|
1037
|
-
*
|
|
1038
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1039
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1040
|
-
* @returns The safe area insets, or null if not available
|
|
1041
|
-
*/
|
|
1042
|
-
declare function useSafeArea(): SafeArea | null;
|
|
1043
|
-
|
|
1044
|
-
/**
|
|
1045
|
-
* Get the current theme.
|
|
1046
|
-
* Works on both OpenAI widgets and MCP Apps.
|
|
1047
|
-
*
|
|
1048
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1049
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1050
|
-
* @returns The current theme ("light" | "dark")
|
|
1051
|
-
*/
|
|
1052
|
-
declare function useTheme(): Theme;
|
|
1053
|
-
|
|
1054
|
-
/**
|
|
1055
|
-
* Get the tool output (structured content returned by the tool handler).
|
|
1056
|
-
* Works on both OpenAI widgets and MCP Apps.
|
|
1057
|
-
*
|
|
1058
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1059
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1060
|
-
* @returns The tool output or null
|
|
1061
|
-
*/
|
|
1062
|
-
declare function useToolOutput<T extends Record<string, unknown>>(): T | null;
|
|
1063
|
-
|
|
1064
|
-
/**
|
|
1065
|
-
* Get tool response metadata.
|
|
1066
|
-
* Contains host/tool metadata (for example identifiers like
|
|
1067
|
-
* `openai/widgetSessionId` and custom tool `_meta` fields).
|
|
1068
|
-
* Returns null when the host does not provide metadata.
|
|
1069
|
-
*
|
|
1070
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1071
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1072
|
-
* @returns The tool response metadata object or null if not available
|
|
1073
|
-
*/
|
|
1074
|
-
declare function useToolResponseMetadata(): UnknownObject | null;
|
|
1075
|
-
|
|
1076
|
-
/**
|
|
1077
|
-
* Get a function to update hidden model context for the next assistant turn.
|
|
1078
|
-
* Uses the MCP Apps `ui/update-model-context` request when available.
|
|
1079
|
-
*
|
|
1080
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1081
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1082
|
-
*/
|
|
1083
|
-
declare function useUpdateModelContext(): (context: ModelContextUpdate) => Promise<void>;
|
|
1084
|
-
|
|
1085
|
-
/**
|
|
1086
|
-
* Provider props
|
|
1087
|
-
*/
|
|
1088
|
-
interface WidgetProviderProps {
|
|
1089
|
-
children: ReactNode;
|
|
1090
|
-
/** Optional loading component while connecting */
|
|
1091
|
-
loading?: ReactNode;
|
|
1092
|
-
/** Optional error component */
|
|
1093
|
-
onError?: (error: Error) => ReactNode;
|
|
1094
|
-
}
|
|
1095
|
-
/**
|
|
1096
|
-
* Provider component that initializes the correct widget client based on platform.
|
|
1097
|
-
* Wrap your widget component with this provider.
|
|
1098
|
-
*
|
|
1099
|
-
* @deprecated Part of the legacy MCP-widget-in-host stack (used with `createResource` /
|
|
1100
|
-
* `createTool`). Preserved for back-compat; will move to `@waniwani/sdk/legacy/react` in
|
|
1101
|
-
* a future minor release. For new code, use `createFlow` from `@waniwani/sdk/mcp` and
|
|
1102
|
-
* `useWaniwani` from `@waniwani/sdk/mcp/react`.
|
|
1103
|
-
*
|
|
1104
|
-
* @example
|
|
1105
|
-
* ```tsx
|
|
1106
|
-
* function App() {
|
|
1107
|
-
* return (
|
|
1108
|
-
* <WidgetProvider loading={<Spinner />}>
|
|
1109
|
-
* <MyWidget />
|
|
1110
|
-
* </WidgetProvider>
|
|
1111
|
-
* );
|
|
1112
|
-
* }
|
|
1113
|
-
* ```
|
|
1114
|
-
*/
|
|
1115
|
-
declare function WidgetProvider({ children, loading, onError, }: WidgetProviderProps): React__default.FunctionComponentElement<React__default.FragmentProps> | React__default.FunctionComponentElement<React__default.ProviderProps<UnifiedWidgetClient | null>>;
|
|
1116
|
-
/**
|
|
1117
|
-
* Keys that can be selected from the widget client.
|
|
1118
|
-
*/
|
|
1119
|
-
type WidgetKey = "toolOutput" | "theme" | "displayMode" | "locale" | "safeArea" | "maxHeight" | "toolResponseMetadata" | "widgetState";
|
|
1120
|
-
/**
|
|
1121
|
-
* Value types for each widget key.
|
|
1122
|
-
*/
|
|
1123
|
-
type WidgetKeyValues = {
|
|
1124
|
-
toolOutput: Record<string, unknown> | null;
|
|
1125
|
-
theme: Theme;
|
|
1126
|
-
displayMode: DisplayMode;
|
|
1127
|
-
locale: string;
|
|
1128
|
-
safeArea: SafeArea | null;
|
|
1129
|
-
maxHeight: number | null;
|
|
1130
|
-
toolResponseMetadata: UnknownObject | null;
|
|
1131
|
-
widgetState: UnknownObject | null;
|
|
1132
|
-
};
|
|
1133
|
-
/**
|
|
1134
|
-
* Get the unified widget client instance.
|
|
1135
|
-
* Must be used within a WidgetProvider.
|
|
1136
|
-
*
|
|
1137
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1138
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1139
|
-
*
|
|
1140
|
-
* @example
|
|
1141
|
-
* ```tsx
|
|
1142
|
-
* // Full client for actions
|
|
1143
|
-
* const client = useWidgetClient();
|
|
1144
|
-
* client.callTool("foo", {});
|
|
1145
|
-
*
|
|
1146
|
-
* // Key selector for reactive values
|
|
1147
|
-
* const toolOutput = useWidgetClient("toolOutput");
|
|
1148
|
-
* const theme = useWidgetClient("theme");
|
|
1149
|
-
* ```
|
|
1150
|
-
*/
|
|
1151
|
-
declare function useWidgetClient(): UnifiedWidgetClient;
|
|
1152
|
-
declare function useWidgetClient<K extends WidgetKey>(key: K): WidgetKeyValues[K];
|
|
1153
|
-
|
|
1154
|
-
/**
|
|
1155
|
-
* Widget state that persists across widget lifecycles (OpenAI-only).
|
|
1156
|
-
* State is synchronized with the ChatGPT parent window and survives widget minimize/restore.
|
|
1157
|
-
* On MCP Apps, returns [null, no-op].
|
|
1158
|
-
*
|
|
1159
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1160
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1161
|
-
* @param defaultState - Initial state value or function to compute it
|
|
1162
|
-
* @returns A tuple of [state, setState] similar to useState
|
|
1163
|
-
*/
|
|
1164
|
-
declare function useWidgetState<T extends UnknownObject>(defaultState?: T | (() => T | null) | null): readonly [T | null, (state: SetStateAction<T | null>) => void];
|
|
1165
|
-
|
|
1166
|
-
/**
|
|
1167
|
-
* Default loading fallback for legacy MCP widgets.
|
|
1168
|
-
*
|
|
1169
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1170
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1171
|
-
*/
|
|
1172
|
-
declare const LoadingWidget: () => react_jsx_runtime.JSX.Element;
|
|
1173
|
-
|
|
1174
|
-
/**
|
|
1175
|
-
* Widget platform types
|
|
1176
|
-
*/
|
|
1177
|
-
type WidgetPlatform = "openai" | "mcp-apps";
|
|
1178
|
-
/**
|
|
1179
|
-
* Detects which platform the widget is running on.
|
|
1180
|
-
*
|
|
1181
|
-
* OpenAI injects a global `window.openai` object.
|
|
1182
|
-
* MCP Apps runs in a sandboxed iframe and uses postMessage.
|
|
1183
|
-
*
|
|
1184
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1185
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1186
|
-
*/
|
|
1187
|
-
declare function detectPlatform(): WidgetPlatform;
|
|
1188
|
-
/**
|
|
1189
|
-
* Check if running on OpenAI platform.
|
|
1190
|
-
*
|
|
1191
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1192
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1193
|
-
*/
|
|
1194
|
-
declare function isOpenAI(): boolean;
|
|
1195
|
-
/**
|
|
1196
|
-
* Check if running on MCP Apps platform.
|
|
1197
|
-
*
|
|
1198
|
-
* @deprecated Legacy MCP-widget-in-host stack. Preserved for back-compat; will move to
|
|
1199
|
-
* `@waniwani/sdk/legacy/react` in a future minor release.
|
|
1200
|
-
*/
|
|
1201
|
-
declare function isMCPApps(): boolean;
|
|
1202
|
-
|
|
1203
|
-
/**
|
|
1204
|
-
* Waniwani SDK Client
|
|
1205
|
-
*
|
|
1206
|
-
* Extends with each module:
|
|
1207
|
-
* - TrackingClient: track(), flush(), shutdown()
|
|
1208
|
-
*
|
|
1209
|
-
* Pass this client to framework adapters:
|
|
1210
|
-
* - `toNextJsHandler(wani, { ... })` for Next.js route handlers
|
|
1211
|
-
*/
|
|
1212
|
-
interface WaniWaniClient extends TrackingClient {
|
|
1213
|
-
/** @internal Resolved config — used by framework adapters */
|
|
1214
|
-
readonly _config: InternalConfig;
|
|
1215
|
-
/** Knowledge base client for ingestion, search, and source listing */
|
|
1216
|
-
readonly kb: KbClient;
|
|
1217
|
-
}
|
|
1218
|
-
interface InternalConfig {
|
|
1219
|
-
apiUrl: string;
|
|
1220
|
-
apiKey: string | undefined;
|
|
1221
|
-
tracking: Required<TrackingConfig>;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
/**
|
|
1225
|
-
* Server-side geolocation extracted from platform headers (Vercel, Cloudflare).
|
|
1226
|
-
* All fields are optional — in local dev, no headers are present.
|
|
1227
|
-
*/
|
|
1228
|
-
interface GeoLocation {
|
|
1229
|
-
city?: string;
|
|
1230
|
-
country?: string;
|
|
1231
|
-
countryRegion?: string;
|
|
1232
|
-
latitude?: string;
|
|
1233
|
-
longitude?: string;
|
|
1234
|
-
timezone?: string;
|
|
1235
|
-
ip?: string;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
/** Client-side visitor context sent in the request body */
|
|
1239
|
-
interface ClientVisitorContext {
|
|
1240
|
-
timezone: string;
|
|
1241
|
-
language: string;
|
|
1242
|
-
languages: string[];
|
|
1243
|
-
deviceType: "mobile" | "tablet" | "desktop";
|
|
1244
|
-
referrer: string;
|
|
1245
|
-
visitorId: string;
|
|
1246
|
-
}
|
|
1247
|
-
/** Combined visitor context: server geo + client context */
|
|
1248
|
-
interface VisitorMeta {
|
|
1249
|
-
geo: GeoLocation;
|
|
1250
|
-
client: ClientVisitorContext | null;
|
|
1251
|
-
}
|
|
1252
|
-
interface BeforeRequestContext {
|
|
1253
|
-
/** The conversation messages from the client */
|
|
1254
|
-
messages: UIMessage[];
|
|
1255
|
-
/** Session identifier for conversation continuity */
|
|
1256
|
-
sessionId?: string;
|
|
1257
|
-
/** Hidden widget-provided model context for the next assistant turn */
|
|
1258
|
-
modelContext?: ModelContextUpdate;
|
|
1259
|
-
/** The original HTTP Request object */
|
|
1260
|
-
request: Request;
|
|
1261
|
-
/** Server-extracted geo location + client-provided visitor context */
|
|
1262
|
-
visitor: VisitorMeta;
|
|
1263
|
-
}
|
|
1264
|
-
type BeforeRequestResult = {
|
|
1265
|
-
/** Override messages (e.g., filtered, augmented) */
|
|
1266
|
-
messages?: UIMessage[];
|
|
1267
|
-
/** Override the system prompt for this request */
|
|
1268
|
-
systemPrompt?: string;
|
|
1269
|
-
/** Override sessionId */
|
|
1270
|
-
sessionId?: string;
|
|
1271
|
-
/** Override hidden widget-provided model context */
|
|
1272
|
-
modelContext?: ModelContextUpdate;
|
|
1273
|
-
};
|
|
1274
|
-
interface WebSearchConfig {
|
|
1275
|
-
/** Restrict web search results to these domains */
|
|
1276
|
-
includeDomains?: string[];
|
|
1277
|
-
/** Exclude these domains from web search results */
|
|
1278
|
-
excludeDomains?: string[];
|
|
1279
|
-
}
|
|
1280
|
-
interface ChatOptions {
|
|
1281
|
-
/**
|
|
1282
|
-
* System prompt for the assistant.
|
|
1283
|
-
* Can be overridden per-request via `beforeRequest`.
|
|
1284
|
-
*/
|
|
1285
|
-
systemPrompt?: string;
|
|
1286
|
-
/**
|
|
1287
|
-
* Maximum number of tool call steps. Defaults to 5.
|
|
1288
|
-
*/
|
|
1289
|
-
maxSteps?: number;
|
|
1290
|
-
/**
|
|
1291
|
-
* Hook called before each request is forwarded to the Waniwani API.
|
|
1292
|
-
* - Return void to use defaults.
|
|
1293
|
-
* - Return an object to override messages, systemPrompt, or sessionId.
|
|
1294
|
-
* - Throw to reject the request (the error message is returned as JSON).
|
|
1295
|
-
*/
|
|
1296
|
-
beforeRequest?: (context: BeforeRequestContext) => Promise<BeforeRequestResult | undefined> | BeforeRequestResult | undefined;
|
|
1297
|
-
/**
|
|
1298
|
-
* Override the MCP server URL directly, bypassing config resolution.
|
|
1299
|
-
* Useful for development/testing when pointing to a local MCP server.
|
|
1300
|
-
*/
|
|
1301
|
-
mcpServerUrl?: string;
|
|
1302
|
-
/**
|
|
1303
|
-
* Enable web search as an additional tool alongside MCP tools.
|
|
1304
|
-
* Pass `true` to enable with defaults, or a config object to restrict domains.
|
|
1305
|
-
*/
|
|
1306
|
-
webSearch?: boolean | WebSearchConfig;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
interface NextJsHandlerOptions {
|
|
1310
|
-
/** Chat handler configuration */
|
|
1311
|
-
chat?: ChatOptions;
|
|
1312
|
-
/**
|
|
1313
|
-
* Identifies this chatbar instance in analytics.
|
|
1314
|
-
* Use a descriptive name like "hamilton-support" or "pricing-page".
|
|
1315
|
-
* Shows up as `source` on tracked events.
|
|
1316
|
-
*/
|
|
1317
|
-
source: string;
|
|
1318
|
-
/**
|
|
1319
|
-
* Enable verbose debug logging for all handler steps.
|
|
1320
|
-
* Logs request details, response codes, resolved URLs, and caught errors.
|
|
1321
|
-
*/
|
|
1322
|
-
debug?: boolean;
|
|
1323
|
-
}
|
|
1324
|
-
interface NextJsHandlerResult {
|
|
1325
|
-
/** GET handler: routes sub-paths (e.g. /resource for MCP widget content) */
|
|
1326
|
-
GET: (request: Request) => Promise<Response>;
|
|
1327
|
-
/** POST handler: proxies chat messages to the Waniwani API */
|
|
1328
|
-
POST: (request: Request) => Promise<Response>;
|
|
1329
|
-
/** PATCH handler: routes updates (e.g. /scenarios/:id) */
|
|
1330
|
-
PATCH: (request: Request) => Promise<Response>;
|
|
1331
|
-
/** OPTIONS handler: CORS preflight */
|
|
1332
|
-
OPTIONS: (request: Request) => Response;
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
/**
|
|
1336
|
-
* Create Next.js route handlers from a Waniwani client.
|
|
1337
|
-
*
|
|
1338
|
-
* Returns `{ GET, POST }` for use with catch-all routes.
|
|
1339
|
-
* Mount at `app/api/waniwani/[[...path]]/route.ts`:
|
|
1340
|
-
*
|
|
1341
|
-
* - `POST /api/waniwani` → chat (proxied to Waniwani API)
|
|
1342
|
-
* - `GET /api/waniwani/resource?uri=…` → MCP resource content
|
|
1343
|
-
*
|
|
1344
|
-
* @deprecated The chat-server catch-all adapters are being phased out. The chat widget
|
|
1345
|
-
* will talk directly to `app.waniwani.ai` in a future release, removing the need for a
|
|
1346
|
-
* self-hosted BFF. This export is preserved for back-compat with existing customer MCPs
|
|
1347
|
-
* but is no longer documented; it will move to `@waniwani/sdk/legacy/next-js` in a future
|
|
1348
|
-
* minor release.
|
|
1349
|
-
*
|
|
1350
|
-
* @example
|
|
1351
|
-
* ```typescript
|
|
1352
|
-
* // app/api/waniwani/[[...path]]/route.ts
|
|
1353
|
-
* import { waniwani } from "@waniwani/sdk";
|
|
1354
|
-
* import { toNextJsHandler } from "@waniwani/sdk/next-js";
|
|
1355
|
-
*
|
|
1356
|
-
* const wani = waniwani();
|
|
1357
|
-
*
|
|
1358
|
-
* export const { GET, POST } = toNextJsHandler(wani, {
|
|
1359
|
-
* chat: {
|
|
1360
|
-
* systemPrompt: "You are a helpful assistant.",
|
|
1361
|
-
* mcpServerUrl: process.env.MCP_SERVER_URL!,
|
|
1362
|
-
* },
|
|
1363
|
-
* });
|
|
1364
|
-
* ```
|
|
1365
|
-
*/
|
|
1366
|
-
declare function toNextJsHandler(client: WaniWaniClient, options: NextJsHandlerOptions): NextJsHandlerResult;
|
|
1367
|
-
|
|
1368
|
-
/**
|
|
1369
|
-
* English catalog. Source of truth — every other locale must mirror this
|
|
1370
|
-
* shape exactly (the `Messages` type is inferred from here).
|
|
1371
|
-
*/
|
|
1372
|
-
interface Messages {
|
|
1373
|
-
promptInput: {
|
|
1374
|
-
placeholder: string;
|
|
1375
|
-
uploadFiles: string;
|
|
1376
|
-
stop: string;
|
|
1377
|
-
submit: string;
|
|
1378
|
-
removeAttachments: string;
|
|
1379
|
-
};
|
|
1380
|
-
workingIndicator: {
|
|
1381
|
-
default: string;
|
|
1382
|
-
};
|
|
1383
|
-
reasoning: {
|
|
1384
|
-
thinking: string;
|
|
1385
|
-
thoughtBrief: string;
|
|
1386
|
-
thoughtForSeconds: (count: number) => string;
|
|
1387
|
-
};
|
|
1388
|
-
/** Chain-of-thought header (no icon): a generic label per state. */
|
|
1389
|
-
chainOfThought: {
|
|
1390
|
-
working: string;
|
|
1391
|
-
done: string;
|
|
1392
|
-
};
|
|
1393
|
-
tool: {
|
|
1394
|
-
copy: string;
|
|
1395
|
-
copied: string;
|
|
1396
|
-
request: string;
|
|
1397
|
-
response: string;
|
|
1398
|
-
error: string;
|
|
1399
|
-
};
|
|
1400
|
-
attachments: {
|
|
1401
|
-
attachmentFallback: string;
|
|
1402
|
-
fileFallback: string;
|
|
1403
|
-
};
|
|
1404
|
-
threadMenu: {
|
|
1405
|
-
newChat: string;
|
|
1406
|
-
threadHistory: string;
|
|
1407
|
-
deleteThread: string;
|
|
1408
|
-
noPreviousChats: string;
|
|
1409
|
-
hiddenThreads: (count: number) => string;
|
|
1410
|
-
};
|
|
1411
|
-
chatQueue: {
|
|
1412
|
-
attachmentFallback: string;
|
|
1413
|
-
removeFromQueue: string;
|
|
1414
|
-
queued: (count: number) => string;
|
|
1415
|
-
};
|
|
1416
|
-
poweredBy: {
|
|
1417
|
-
label: string;
|
|
1418
|
-
};
|
|
1419
|
-
aiDisclaimer: {
|
|
1420
|
-
default: string;
|
|
1421
|
-
};
|
|
1422
|
-
exportSession: {
|
|
1423
|
-
saving: string;
|
|
1424
|
-
saved: string;
|
|
1425
|
-
error: string;
|
|
1426
|
-
export: string;
|
|
1427
|
-
tooltip: string;
|
|
1428
|
-
};
|
|
1429
|
-
widgetErrorBoundary: {
|
|
1430
|
-
failedToLoad: string;
|
|
1431
|
-
retry: string;
|
|
1432
|
-
};
|
|
1433
|
-
launcher: {
|
|
1434
|
-
prompt: string;
|
|
1435
|
-
open: string;
|
|
1436
|
-
close: string;
|
|
1437
|
-
minimize: string;
|
|
1438
|
-
};
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
type DeepPartial<T> = T extends (...args: never[]) => unknown ? T : T extends object ? {
|
|
1442
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
1443
|
-
} : T;
|
|
1444
|
-
type MessageOverrides = DeepPartial<Messages>;
|
|
1445
|
-
|
|
1446
|
-
/**
|
|
1447
|
-
* A visitor id to apply, or a resolver that produces one. The resolver may be
|
|
1448
|
-
* sync (`() => posthog.get_distinct_id()`) or async
|
|
1449
|
-
* (`async () => (await sdk.ready()).id`), for analytics SDKs whose id is only
|
|
1450
|
-
* available after they bootstrap.
|
|
1451
|
-
*/
|
|
1452
|
-
type VisitorIdInput = string | (() => string | undefined | null | Promise<string | undefined | null>);
|
|
1453
|
-
|
|
1454
|
-
/** One pill. `id` is null unless it came from an authored per-page prompt. */
|
|
1455
|
-
interface Suggestion {
|
|
1456
|
-
id: string | null;
|
|
1457
|
-
text: string;
|
|
1458
|
-
}
|
|
1459
|
-
/**
|
|
1460
|
-
* One field per origin. `null` means the origin has nothing to say — no entry
|
|
1461
|
-
* on this turn, or the rung no longer applies.
|
|
1462
|
-
*
|
|
1463
|
-
* `flow` alone treats `[]` as authoritative: it clears the row and suppresses
|
|
1464
|
-
* every weaker rung. Elsewhere `[]` and `null` are the same.
|
|
1465
|
-
*/
|
|
1466
|
-
interface SuggestionCandidates {
|
|
1467
|
-
flow: Suggestion[] | null;
|
|
1468
|
-
followup: Suggestion[] | null;
|
|
1469
|
-
page: Suggestion[] | null;
|
|
1470
|
-
channel: Suggestion[] | null;
|
|
1471
|
-
}
|
|
1472
|
-
/**
|
|
1473
|
-
* The rungs an embed host reads from `/config`. Grouped because they share a
|
|
1474
|
-
* source and a lifetime: both stop applying at the visitor's first message.
|
|
1475
|
-
*/
|
|
1476
|
-
type PreChatSuggestions = Pick<SuggestionCandidates, "page" | "channel">;
|
|
1477
|
-
|
|
1478
|
-
/**
|
|
1479
|
-
* Built-in theme presets. `auto` follows the host's `prefers-color-scheme`
|
|
1480
|
-
* and switches at runtime without re-rendering.
|
|
1481
|
-
*/
|
|
1482
|
-
type ThemePreset = "light" | "dark" | "auto";
|
|
1483
|
-
/**
|
|
1484
|
-
* Appearance config for the chat widget. Pick a preset and (optionally) layer
|
|
1485
|
-
* per-property `variables` on top.
|
|
1486
|
-
*
|
|
1487
|
-
* ```ts
|
|
1488
|
-
* appearance: { theme: "dark", variables: { primaryColor: "#ff6b6b" } }
|
|
1489
|
-
* ```
|
|
1490
|
-
*
|
|
1491
|
-
* The same shape is accepted by the `embed.js` script (`init({ appearance })`),
|
|
1492
|
-
* `<WaniwaniChat overrides={{ appearance }} />`, and `<ChatEmbed appearance />`.
|
|
1493
|
-
*/
|
|
1494
|
-
interface ChatAppearance {
|
|
1495
|
-
/** Base theme preset. Defaults to `"light"`. */
|
|
1496
|
-
theme?: ThemePreset;
|
|
1497
|
-
/** Per-property overrides applied on top of the preset. */
|
|
1498
|
-
variables?: ChatTheme;
|
|
1499
|
-
/**
|
|
1500
|
-
* Render assistant messages inside a filled bubble (background + padding +
|
|
1501
|
-
* radius), styled by `variables.assistantBubbleColor` /
|
|
1502
|
-
* `assistantBubbleTextColor`. Defaults to `false` — assistant messages
|
|
1503
|
-
* render as plain text. Opt in for a "both sides bubbled" chat style.
|
|
1504
|
-
*/
|
|
1505
|
-
assistantBubble?: boolean;
|
|
1506
|
-
}
|
|
1507
|
-
/**
|
|
1508
|
-
* Tool-call activity rendering mode. Steps are grouped into one collapsible
|
|
1509
|
-
* "chain of thought".
|
|
1510
|
-
*
|
|
1511
|
-
* - `true` (default) — each step expands to its request/response JSON.
|
|
1512
|
-
* - `"titles-only"` — step labels only, no JSON.
|
|
1513
|
-
* - `false` — the chain (and the reasoning trace) are hidden entirely; only
|
|
1514
|
-
* a generic working indicator shows while the agent works.
|
|
1515
|
-
*/
|
|
1516
|
-
type ShowToolCalls = boolean | "titles-only";
|
|
1517
|
-
|
|
1518
|
-
interface ChatTheme {
|
|
1519
|
-
/** Primary brand color (bubble, send button, user messages) */
|
|
1520
|
-
primaryColor?: string;
|
|
1521
|
-
/** Primary text color on primary background */
|
|
1522
|
-
primaryForeground?: string;
|
|
1523
|
-
/** Chat panel background */
|
|
1524
|
-
backgroundColor?: string;
|
|
1525
|
-
/** Default text color */
|
|
1526
|
-
textColor?: string;
|
|
1527
|
-
/** Secondary/muted text */
|
|
1528
|
-
mutedColor?: string;
|
|
1529
|
-
/** Border color */
|
|
1530
|
-
borderColor?: string;
|
|
1531
|
-
/** Border width for the panel (px). Defaults to 0 (no border). */
|
|
1532
|
-
borderWidth?: number;
|
|
1533
|
-
/** Box-shadow shorthand applied to the panel. Use any valid CSS box-shadow string (e.g. `"0 10px 25px rgba(0,0,0,0.1)"`). Defaults to `none`. */
|
|
1534
|
-
boxShadow?: string;
|
|
1535
|
-
/** Assistant message bubble background */
|
|
1536
|
-
assistantBubbleColor?: string;
|
|
1537
|
-
/** User message bubble background */
|
|
1538
|
-
userBubbleColor?: string;
|
|
1539
|
-
/** Input field background */
|
|
1540
|
-
inputBackgroundColor?: string;
|
|
1541
|
-
/** Border radius for the panel (px) */
|
|
1542
|
-
borderRadius?: number;
|
|
1543
|
-
/** Border radius for message bubbles (px) */
|
|
1544
|
-
messageBorderRadius?: number;
|
|
1545
|
-
/** Font family */
|
|
1546
|
-
fontFamily?: string;
|
|
1547
|
-
/** Header background color (card layout). Falls back to backgroundColor. */
|
|
1548
|
-
headerBackgroundColor?: string;
|
|
1549
|
-
/** Header text color. Falls back to textColor. */
|
|
1550
|
-
headerTextColor?: string;
|
|
1551
|
-
/** Status dot color. Defaults to green (#22c55e). */
|
|
1552
|
-
statusColor?: string;
|
|
1553
|
-
/** Tool call JSON section background. Defaults to light gray / #262626 in dark. */
|
|
1554
|
-
toolCardColor?: string;
|
|
1555
|
-
/** Text color inside the user message bubble. Falls back to `primaryForeground`. */
|
|
1556
|
-
userBubbleTextColor?: string;
|
|
1557
|
-
/** Text color inside the assistant message bubble (only visible when `appearance.assistantBubble` is enabled). Falls back to `textColor`. */
|
|
1558
|
-
assistantBubbleTextColor?: string;
|
|
1559
|
-
/** Horizontal padding inside message bubbles (px). Defaults to 16. */
|
|
1560
|
-
messagePaddingX?: number;
|
|
1561
|
-
/** Vertical padding inside message bubbles (px). Defaults to 12. */
|
|
1562
|
-
messagePaddingY?: number;
|
|
1563
|
-
/** Max width of a message bubble as a CSS length/percentage. Defaults to `"80%"`. */
|
|
1564
|
-
messageMaxWidth?: string;
|
|
1565
|
-
/** Base font size for message text (px). When unset, messages use the CSS default of `1rem` (16px at the standard root font size). */
|
|
1566
|
-
fontSize?: number;
|
|
1567
|
-
/** Base line height for message text (unitless string, e.g. `"1.5"`). Defaults to `"1.5"`. */
|
|
1568
|
-
lineHeight?: string;
|
|
1569
|
-
/** Frosted-glass tint color for the floating bar's suggestion card, layered
|
|
1570
|
-
* over the backdrop blur. Programmatic-only via appearance.variables.
|
|
1571
|
-
* Unset = the default neutral glass (unchanged). */
|
|
1572
|
-
glassTint?: string;
|
|
1573
|
-
/** Strength of the glass tint, 0–1 as a unitless string (e.g. "0.5").
|
|
1574
|
-
* Unset/"0" = no tint (default rendering). */
|
|
1575
|
-
glassTintStrength?: string;
|
|
1576
|
-
}
|
|
1577
|
-
interface WelcomeConfig {
|
|
1578
|
-
/** Icon displayed above the title. Accepts any React node (e.g. an SVG or img). */
|
|
1579
|
-
icon?: React.ReactNode;
|
|
1580
|
-
/** Title text shown prominently in the welcome screen. */
|
|
1581
|
-
title: string;
|
|
1582
|
-
/** Description text shown below the title. */
|
|
1583
|
-
description?: string;
|
|
1584
|
-
/** Suggestion cards shown in the welcome screen. Disappear after the first message. */
|
|
1585
|
-
suggestions?: string[];
|
|
1586
|
-
}
|
|
1587
|
-
interface SuggestionsConfig {
|
|
1588
|
-
/**
|
|
1589
|
-
* Starter prompts shown before the user sends their first message.
|
|
1590
|
-
* Defaults to an empty array.
|
|
1591
|
-
*/
|
|
1592
|
-
initial?: string[];
|
|
1593
|
-
}
|
|
1594
|
-
/**
|
|
1595
|
-
* Per-slot class name overrides for the chat widget. Each string is appended
|
|
1596
|
-
* to the slot's own classes (merged with `tailwind-merge`, `ww` prefix). Use
|
|
1597
|
-
* with your own (prefixed or plain) CSS to restyle any element. In the React
|
|
1598
|
-
* path these reach into internals directly; in the `<script>` embed, prefer
|
|
1599
|
-
* the stable `.ww-*` semantic classes with a `data-css` stylesheet.
|
|
1600
|
-
*/
|
|
1601
|
-
interface ChatClassNames {
|
|
1602
|
-
/** Root chat container. */
|
|
1603
|
-
root?: string;
|
|
1604
|
-
/** Sticky header bar. */
|
|
1605
|
-
header?: string;
|
|
1606
|
-
/** Every message wrapper (both roles). */
|
|
1607
|
-
message?: string;
|
|
1608
|
-
/** The user message bubble content. */
|
|
1609
|
-
userBubble?: string;
|
|
1610
|
-
/** The assistant message bubble content. */
|
|
1611
|
-
assistantBubble?: string;
|
|
1612
|
-
/** The input bar container. */
|
|
1613
|
-
input?: string;
|
|
1614
|
-
}
|
|
1615
|
-
interface ChatBaseProps {
|
|
1616
|
-
/** Waniwani project API key */
|
|
1617
|
-
apiKey?: string;
|
|
1618
|
-
/** Chat API endpoint URL. Defaults to Waniwani hosted endpoint */
|
|
1619
|
-
api?: string;
|
|
1620
|
-
/** Pre-loaded messages to display when the chat mounts. */
|
|
1621
|
-
initialMessages?: ai.UIMessage[];
|
|
1622
|
-
/** Initial greeting shown before user types */
|
|
1623
|
-
welcomeMessage?: string;
|
|
1624
|
-
/**
|
|
1625
|
-
* Rich welcome screen shown when the conversation is empty.
|
|
1626
|
-
* Replaces `welcomeMessage` with a centered layout featuring an icon, title,
|
|
1627
|
-
* description, and card-style suggestion prompts.
|
|
1628
|
-
* Takes precedence over `welcomeMessage` when provided.
|
|
1629
|
-
*/
|
|
1630
|
-
welcome?: WelcomeConfig;
|
|
1631
|
-
/**
|
|
1632
|
-
* Theme preset (`light`/`dark`/`auto`) plus per-property overrides.
|
|
1633
|
-
* See `ChatAppearance` for the shape.
|
|
1634
|
-
*/
|
|
1635
|
-
appearance?: ChatAppearance;
|
|
1636
|
-
/** Per-slot class name overrides. See {@link ChatClassNames}. */
|
|
1637
|
-
classNames?: ChatClassNames;
|
|
1638
|
-
/**
|
|
1639
|
-
* Override the anonymous visitor id the widget generates with one you
|
|
1640
|
-
* already track (a PostHog / Amplitude / Segment distinct id, your own
|
|
1641
|
-
* cookie, etc.). The chat sends it on every request, so Waniwani sessions
|
|
1642
|
-
* and events correlate to the same visitor, and server-side MCP tools and
|
|
1643
|
-
* flows read it back as `context.waniwani.visitorId`.
|
|
1644
|
-
*
|
|
1645
|
-
* A string, or a resolver that returns one — sync
|
|
1646
|
-
* (`() => posthog.get_distinct_id()`) or async
|
|
1647
|
-
* (`async () => (await sdk.ready()).id`), for analytics SDKs whose id is
|
|
1648
|
-
* only ready after they bootstrap. A blank / failed result is ignored, so
|
|
1649
|
-
* the auto-generated, `localStorage`-persisted id is kept. Leave unset to
|
|
1650
|
-
* always use the auto id.
|
|
1651
|
-
*/
|
|
1652
|
-
visitorId?: VisitorIdInput;
|
|
1653
|
-
/** Additional headers to send with chat API requests */
|
|
1654
|
-
headers?: Record<string, string>;
|
|
1655
|
-
/** Additional body fields to send with each chat request */
|
|
1656
|
-
body?: Record<string, unknown>;
|
|
1657
|
-
/** Enable file attachments in the input. Defaults to false. */
|
|
1658
|
-
allowAttachments?: boolean;
|
|
1659
|
-
/** Placeholder text shown in the input field. Defaults to "Ask me anything...". Animates with a typing effect. */
|
|
1660
|
-
placeholder?: string;
|
|
1661
|
-
/**
|
|
1662
|
-
* Name of a custom DOM event to listen for that triggers focus (scroll + glow) and optionally sends a message.
|
|
1663
|
-
* Dispatch via `new CustomEvent('triggerDemoRequest', { detail: { message: 'Hi!' } })`.
|
|
1664
|
-
* Set to `false` to disable. Defaults to `"triggerDemoRequest"`.
|
|
1665
|
-
*/
|
|
1666
|
-
triggerEvent?: string | false;
|
|
1667
|
-
/** Callback fired when a message is sent */
|
|
1668
|
-
onMessageSent?: (message: string) => void;
|
|
1669
|
-
/** Callback fired when a response is received */
|
|
1670
|
-
onResponseReceived?: () => void;
|
|
1671
|
-
/**
|
|
1672
|
-
* Suggestion pills. The row obeys a fixed hierarchy — flow > followup >
|
|
1673
|
-
* page > channel — and every origin is always active.
|
|
1674
|
-
*
|
|
1675
|
-
* `false` hides the row; `true` / unset is the default. `{ initial: [...] }`
|
|
1676
|
-
* sets starter prompts. Embed hosts pass the resolved
|
|
1677
|
-
* {@link PreChatSuggestions} from `useSuggestions(config)` instead, which
|
|
1678
|
-
* carries the prompt ids needed for click attribution.
|
|
1679
|
-
*/
|
|
1680
|
-
suggestions?: boolean | SuggestionsConfig | PreChatSuggestions;
|
|
1681
|
-
/**
|
|
1682
|
-
* Handler for MCP tool calls from widgets.
|
|
1683
|
-
* Called when a widget uses `callServerTool` (MCP Apps standard).
|
|
1684
|
-
* If not provided, defaults to POSTing to `${api}/tool`.
|
|
1685
|
-
*/
|
|
1686
|
-
onCallTool?: CallToolHandler;
|
|
1687
|
-
/**
|
|
1688
|
-
* Enable debug mode. When true, the `_meta` field is shown in tool call
|
|
1689
|
-
* inputs and outputs instead of being filtered out.
|
|
1690
|
-
* Tip: set to `process.env.NEXT_PUBLIC_WANIWANI_DEBUG === '1'` to mirror
|
|
1691
|
-
* the server-side `WANIWANI_DEBUG` env var.
|
|
1692
|
-
*/
|
|
1693
|
-
debug?: boolean;
|
|
1694
|
-
/**
|
|
1695
|
-
* How the agent's tool-call activity renders. Steps are grouped into a
|
|
1696
|
-
* single collapsible "chain of thought" that auto-expands while the agent
|
|
1697
|
-
* works and collapses to a summary once it settles.
|
|
1698
|
-
*
|
|
1699
|
-
* - `true` (default) — each step expands to its request/response JSON.
|
|
1700
|
-
* - `"titles-only"` — step labels only, no JSON.
|
|
1701
|
-
* - `false` — the chain is hidden entirely, along with the reasoning
|
|
1702
|
-
* trace; only the generic "On it…" indicator shows while the agent works.
|
|
1703
|
-
*
|
|
1704
|
-
* MCP App widgets attached to a tool call are always rendered.
|
|
1705
|
-
*/
|
|
1706
|
-
showToolCalls?: ShowToolCalls;
|
|
1707
|
-
/**
|
|
1708
|
-
* Skip fetching `/config` and `/tools` from the API on mount.
|
|
1709
|
-
* Use when the chat endpoint doesn't serve these routes (e.g. embed widgets
|
|
1710
|
-
* talking directly to the Waniwani app).
|
|
1711
|
-
* @internal
|
|
1712
|
-
*/
|
|
1713
|
-
skipRemoteConfig?: boolean;
|
|
1714
|
-
/**
|
|
1715
|
-
* Persist the conversation across page reloads using IndexedDB so the user
|
|
1716
|
-
* can resume previous threads. Defaults to `false` — opt in explicitly.
|
|
1717
|
-
*/
|
|
1718
|
-
enableThreadHistory?: boolean;
|
|
1719
|
-
/**
|
|
1720
|
-
* Force a specific thread to be active. When provided, the embed renders
|
|
1721
|
-
* that thread's messages and ignores the most-recently-updated default.
|
|
1722
|
-
*/
|
|
1723
|
-
activeThreadId?: string;
|
|
1724
|
-
/** Fired whenever the active thread changes (new chat, switch, delete). */
|
|
1725
|
-
onThreadChange?: (threadId: string) => void;
|
|
1726
|
-
/**
|
|
1727
|
-
* AI transparency notice rendered under the input (EU AI Act compliance).
|
|
1728
|
-
* Defaults to `"AI can make mistakes. Verify important information."`.
|
|
1729
|
-
* Pass a string to override the wording, or `false` to hide it entirely.
|
|
1730
|
-
*/
|
|
1731
|
-
disclaimer?: string | false;
|
|
1732
|
-
/**
|
|
1733
|
-
* UI language for built-in labels (buttons, placeholders, status text).
|
|
1734
|
-
* Supports `"en"`, `"fr"`, `"es"`. When omitted, the widget detects the
|
|
1735
|
-
* locale from `<html lang>` and `navigator.language(s)`, falling back
|
|
1736
|
-
* to English.
|
|
1737
|
-
*/
|
|
1738
|
-
locale?: string;
|
|
1739
|
-
/**
|
|
1740
|
-
* Per-key overrides on top of the resolved locale catalog. Use this to
|
|
1741
|
-
* tweak individual built-in strings without contributing a new locale.
|
|
1742
|
-
*
|
|
1743
|
-
* ```tsx
|
|
1744
|
-
* messages={{ promptInput: { placeholder: "Ask the agent…" } }}
|
|
1745
|
-
* ```
|
|
1746
|
-
*/
|
|
1747
|
-
messages?: MessageOverrides;
|
|
1748
|
-
}
|
|
1749
|
-
/** Handler signature for MCP tool calls from widgets. */
|
|
1750
|
-
type CallToolHandler = (params: {
|
|
1751
|
-
name: string;
|
|
1752
|
-
arguments: Record<string, unknown>;
|
|
1753
|
-
}) => Promise<{
|
|
1754
|
-
content?: Array<{
|
|
1755
|
-
type: string;
|
|
1756
|
-
text?: string;
|
|
1757
|
-
}>;
|
|
1758
|
-
structuredContent?: Record<string, unknown>;
|
|
1759
|
-
_meta?: Record<string, unknown>;
|
|
1760
|
-
}>;
|
|
1761
|
-
interface ChatHandle {
|
|
1762
|
-
/** Programmatically send a user message into the chat */
|
|
1763
|
-
sendMessage: (text: string) => void;
|
|
1764
|
-
/**
|
|
1765
|
-
* Send a user message and wait for the assistant response to complete.
|
|
1766
|
-
* Returns the final assistant message. Useful for eval/testing flows.
|
|
1767
|
-
*/
|
|
1768
|
-
sendMessageAndWait: (text: string) => Promise<unknown>;
|
|
1769
|
-
/** Clear all messages and start a fresh conversation */
|
|
1770
|
-
reset: () => void;
|
|
1771
|
-
/** Scroll to the chat input, focus it, and show a highlight glow */
|
|
1772
|
-
focus: () => void;
|
|
1773
|
-
/** Current chat messages */
|
|
1774
|
-
messages: ai.UIMessage[];
|
|
1775
|
-
/** Session ID used for event correlation. Available after the first message. */
|
|
1776
|
-
sessionId: string | undefined;
|
|
1777
|
-
/**
|
|
1778
|
-
* Track a funnel event from the host page with the chat session attached
|
|
1779
|
-
* automatically. Same surface as the server client: callable with a typed
|
|
1780
|
-
* event, plus the flat revenue helpers (`track.converted({ ... })`, ...).
|
|
1781
|
-
* Present on `WaniwaniChat` (hosted); absent on the bare `ChatEmbed`
|
|
1782
|
-
* primitive, which has no Waniwani credential to send events with.
|
|
1783
|
-
*/
|
|
1784
|
-
track?: TrackFn;
|
|
1785
|
-
/**
|
|
1786
|
-
* Tie the visitor to a stable user id (emits `user.identified`).
|
|
1787
|
-
* Present on `WaniwaniChat` only, like `track`.
|
|
1788
|
-
*/
|
|
1789
|
-
identify?: (userId: string, traits?: Record<string, unknown>) => Promise<{
|
|
1790
|
-
eventId: string;
|
|
1791
|
-
}>;
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
/** @deprecated Use `WaniwaniChat` (hosted, React) or the `<script>` embed for new code. `ChatCard` is preserved for back-compat only and lives under `@waniwani/sdk/legacy`. */
|
|
1795
|
-
interface ChatCardProps extends ChatBaseProps {
|
|
1796
|
-
/** Title shown in the card header. Defaults to "Assistant". */
|
|
1797
|
-
title?: string;
|
|
1798
|
-
/** Subtitle or status text shown under the title. */
|
|
1799
|
-
subtitle?: string;
|
|
1800
|
-
/** Show the status dot in the header. Defaults to true. */
|
|
1801
|
-
showStatus?: boolean;
|
|
1802
|
-
/** Card width. Accepts a pixel number or any CSS value (e.g. "100%", "50vw"). Defaults to 500. */
|
|
1803
|
-
width?: number | string;
|
|
1804
|
-
/** Card height. Accepts a pixel number or any CSS value (e.g. "100%", "80vh"). Defaults to 600. */
|
|
1805
|
-
height?: number | string;
|
|
1806
|
-
/** Additional class names applied to the root element (e.g. Tailwind classes). */
|
|
1807
|
-
className?: string;
|
|
1808
|
-
/** Theme overrides. Legacy API; new code should use the `appearance` field on `WaniwaniChat` / `ChatEmbed`. */
|
|
1809
|
-
theme?: ChatTheme;
|
|
1810
|
-
}
|
|
1811
|
-
/**
|
|
1812
|
-
* @deprecated Use `WaniwaniChat` from `@waniwani/sdk/chat` for new code.
|
|
1813
|
-
* `ChatCard` is preserved for back-compat with customer MCPs that pre-date
|
|
1814
|
-
* the hosted-tier React component. It is also re-exported from
|
|
1815
|
-
* `@waniwani/sdk/chat` for now; that re-export will be removed in a future
|
|
1816
|
-
* minor release — import from `@waniwani/sdk/legacy` going forward.
|
|
1817
|
-
*/
|
|
1818
|
-
declare const ChatCard: React$1.ForwardRefExoticComponent<ChatCardProps & React$1.RefAttributes<ChatHandle>>;
|
|
1819
|
-
|
|
1820
|
-
export { ChatCard, type ChatCardProps, DevModeProvider, type DeviceType, type DisplayMode, type FlowActionResult, type HostContext, InitializeNextJsInIframe, LoadingWidget, type ModelContextContentBlock, type ModelContextUpdate, type NextJsHandlerOptions, type NextJsHandlerResult, type RegisteredResource, type RegisteredTool, type ResourceConfig, type SafeArea, type SafeAreaInsets, type SendFollowUpOptions, type Theme, type ToolCallResult, type ToolConfig, type ToolHandler, type ToolHandlerContext, type ToolResult, type ToolToolCallback, type UnifiedWidgetClient, type UnknownObject, type UnstableSendFollowUpWithGhostGuardResult, type UserAgent, type WidgetCSP, type WidgetPlatform, WidgetProvider, createResource, createTool, detectPlatform, getMockState, initializeMockOpenAI, isMCPApps, isOpenAI, registerTools, toNextJsHandler, unstable_useSendFollowUpWithGhostGuard, updateMockDisplayMode, updateMockGlobal, updateMockTheme, updateMockToolOutput, useCallTool, useDisplayMode, useFlowAction, useIsChatGptApp, useLocale, useMaxHeight, useOpenExternal, useRequestDisplayMode, useSafeArea, useSendFollowUp, useTheme, useToolOutput, useToolResponseMetadata, useUpdateModelContext, useWidgetClient, useWidgetState };
|