@cloudflare/think 0.15.0 → 0.16.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/README.md +47 -40
- package/dist/{chat-sdk-iuBa-CGM.js → chat-sdk-C8BvREXn.js} +16 -9
- package/dist/chat-sdk-C8BvREXn.js.map +1 -0
- package/dist/{index-s3Pl812H.d.ts → index-BZKPlFcA.d.ts} +125 -113
- package/dist/messengers/index.d.ts +15 -17
- package/dist/messengers/index.js +2 -2
- package/dist/messengers/telegram.d.ts +1 -1
- package/dist/messengers/telegram.js +1 -1
- package/dist/think.d.ts +1 -1
- package/dist/think.js +11 -16
- package/dist/think.js.map +1 -1
- package/dist/tools/workspace.js +13 -1
- package/dist/tools/workspace.js.map +1 -1
- package/dist/workflows.d.ts +1 -1
- package/docs/index.md +23 -464
- package/docs/lifecycle-hooks.md +24 -0
- package/docs/tools.md +3 -3
- package/package.json +7 -40
- package/dist/chat-sdk-iuBa-CGM.js.map +0 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +0 -1304
- package/dist/cli/index.js.map +0 -1
- package/dist/codegen-DlA2QQuU.js +0 -109
- package/dist/codegen-DlA2QQuU.js.map +0 -1
- package/dist/config-CD7hqncK.d.ts +0 -71
- package/dist/framework/index.d.ts +0 -170
- package/dist/framework/index.js +0 -4
- package/dist/manifest-DK5HuGga.d.ts +0 -141
- package/dist/project-BHurFdu4.js +0 -685
- package/dist/project-BHurFdu4.js.map +0 -1
- package/dist/server-entry.d.ts +0 -120
- package/dist/server-entry.js +0 -266
- package/dist/server-entry.js.map +0 -1
- package/dist/studio/assets/abap-CLvhMVsD.js +0 -1
- package/dist/studio/assets/actionscript-3--17pq3dv.js +0 -1
- package/dist/studio/assets/ada-C5qYipkI.js +0 -1
- package/dist/studio/assets/andromeeda-vGVdxbeo.js +0 -1
- package/dist/studio/assets/angular-html-B26lsrRw.js +0 -1
- package/dist/studio/assets/angular-ts-B0BTTyHo.js +0 -1
- package/dist/studio/assets/apache-U0d_L8uA.js +0 -1
- package/dist/studio/assets/apex-CGTLDQj6.js +0 -1
- package/dist/studio/assets/apl-W5hJk0fj.js +0 -1
- package/dist/studio/assets/applescript-CCn79oCD.js +0 -1
- package/dist/studio/assets/ara-4CJ0cIlV.js +0 -1
- package/dist/studio/assets/asciidoc-DE70LPWp.js +0 -1
- package/dist/studio/assets/asm-Cmm7eHzH.js +0 -1
- package/dist/studio/assets/astro-ChkXCqsA.js +0 -1
- package/dist/studio/assets/aurora-x-CDeNXAV0.js +0 -1
- package/dist/studio/assets/awk-BWXHIvNe.js +0 -1
- package/dist/studio/assets/ayu-dark-DluEY0Gj.js +0 -1
- package/dist/studio/assets/ayu-light-C3h-C4tm.js +0 -1
- package/dist/studio/assets/ayu-mirage-Bqwy1Gya.js +0 -1
- package/dist/studio/assets/ballerina-B7ZEbQpA.js +0 -1
- package/dist/studio/assets/bat-Bo4NYOV-.js +0 -1
- package/dist/studio/assets/beancount-D-usSTwE.js +0 -1
- package/dist/studio/assets/berry-DKpUyyne.js +0 -1
- package/dist/studio/assets/bibtex-Ci_nEsc7.js +0 -1
- package/dist/studio/assets/bicep-CUHmPFLl.js +0 -1
- package/dist/studio/assets/bird2-C2hNVINV.js +0 -1
- package/dist/studio/assets/blade-Dy0zTtr6.js +0 -1
- package/dist/studio/assets/bsl-BkkzgIyY.js +0 -1
- package/dist/studio/assets/c-DOHYbsuN.js +0 -1
- package/dist/studio/assets/c3-CnJL0r0V.js +0 -1
- package/dist/studio/assets/cadence-CQ2zXKGN.js +0 -1
- package/dist/studio/assets/cairo-DLTphjLi.js +0 -1
- package/dist/studio/assets/catppuccin-frappe-3VR1Za6u.js +0 -1
- package/dist/studio/assets/catppuccin-latte-DwIHMF0Q.js +0 -1
- package/dist/studio/assets/catppuccin-macchiato-DYnBP6_5.js +0 -1
- package/dist/studio/assets/catppuccin-mocha-DYhrFGRu.js +0 -1
- package/dist/studio/assets/clarity-SemFz856.js +0 -1
- package/dist/studio/assets/clojure-DqKBuwfJ.js +0 -1
- package/dist/studio/assets/cmake-Bj61d0ZC.js +0 -1
- package/dist/studio/assets/cobol-DtGo7U_-.js +0 -1
- package/dist/studio/assets/codeowners-C8r90Shi.js +0 -1
- package/dist/studio/assets/codeql-oeQT6MSM.js +0 -1
- package/dist/studio/assets/coffee-Uf9fkZqI.js +0 -1
- package/dist/studio/assets/common-lisp-Cv5bFMCO.js +0 -1
- package/dist/studio/assets/coq-BrsZFFmf.js +0 -1
- package/dist/studio/assets/cpp-CVwmol0l.js +0 -1
- package/dist/studio/assets/crystal-ChHObCtF.js +0 -1
- package/dist/studio/assets/csharp-Ct8U2NOr.js +0 -1
- package/dist/studio/assets/css-DYjZAj5w.js +0 -1
- package/dist/studio/assets/csv-Dx-8-gkx.js +0 -1
- package/dist/studio/assets/cue-CE9AQfxI.js +0 -1
- package/dist/studio/assets/cypher-ClKdZ_lG.js +0 -1
- package/dist/studio/assets/d-qD-0Kul2.js +0 -1
- package/dist/studio/assets/dark-plus-Cs2F2srj.js +0 -1
- package/dist/studio/assets/dart-DkHntEIa.js +0 -1
- package/dist/studio/assets/dax-BkyTk9wS.js +0 -1
- package/dist/studio/assets/desktop-Dlh5hvp9.js +0 -1
- package/dist/studio/assets/diff-woXpYk--.js +0 -1
- package/dist/studio/assets/docker-IyjqRm3v.js +0 -1
- package/dist/studio/assets/dotenv-_5a1GRtc.js +0 -1
- package/dist/studio/assets/dracula-BHWKrbxM.js +0 -1
- package/dist/studio/assets/dracula-soft-5eyTD99u.js +0 -1
- package/dist/studio/assets/dream-maker-DW3nJb8Q.js +0 -1
- package/dist/studio/assets/edge-C2J43zbu.js +0 -1
- package/dist/studio/assets/elixir-B7WZ8XhB.js +0 -1
- package/dist/studio/assets/elm-PN4qGuR2.js +0 -1
- package/dist/studio/assets/emacs-lisp-C9PiwqqW.js +0 -1
- package/dist/studio/assets/erb-CkbjE2OZ.js +0 -1
- package/dist/studio/assets/erlang-Cphh6RMH.js +0 -1
- package/dist/studio/assets/everforest-dark-sB-x3p7T.js +0 -1
- package/dist/studio/assets/everforest-light-Df2xbC6M.js +0 -1
- package/dist/studio/assets/fennel-DQxkIbk2.js +0 -1
- package/dist/studio/assets/fish-BJitypiv.js +0 -1
- package/dist/studio/assets/fluent-C03EYrpw.js +0 -1
- package/dist/studio/assets/fortran-fixed-form-DEKoE2YW.js +0 -1
- package/dist/studio/assets/fortran-free-form-CYNrtFtB.js +0 -1
- package/dist/studio/assets/fsharp-D13ZGOAj.js +0 -1
- package/dist/studio/assets/gdresource-C0sCabJj.js +0 -1
- package/dist/studio/assets/gdscript-Cp2uCuqX.js +0 -1
- package/dist/studio/assets/gdshader-CBce3t8t.js +0 -1
- package/dist/studio/assets/genie-CV2tkWYe.js +0 -1
- package/dist/studio/assets/gherkin-DExj1W_8.js +0 -1
- package/dist/studio/assets/git-commit-BSykSTBG.js +0 -1
- package/dist/studio/assets/git-rebase-CsGmQhFO.js +0 -1
- package/dist/studio/assets/github-dark-C-LZuMrd.js +0 -1
- package/dist/studio/assets/github-dark-default-DXG-b-1a.js +0 -1
- package/dist/studio/assets/github-dark-dimmed-Bx1FflLF.js +0 -1
- package/dist/studio/assets/github-dark-high-contrast-B_tTalzw.js +0 -1
- package/dist/studio/assets/github-light-EUqPIrTm.js +0 -1
- package/dist/studio/assets/github-light-default-BXViO-2h.js +0 -1
- package/dist/studio/assets/github-light-high-contrast-B68TUdTA.js +0 -1
- package/dist/studio/assets/gleam-CSRkHgEL.js +0 -1
- package/dist/studio/assets/glimmer-js-D85-ZYXa.js +0 -1
- package/dist/studio/assets/glimmer-ts-B_0SLVPe.js +0 -1
- package/dist/studio/assets/glsl-BE5n0T0t.js +0 -1
- package/dist/studio/assets/gn-ilITqXS6.js +0 -1
- package/dist/studio/assets/gnuplot-7GGW24-e.js +0 -1
- package/dist/studio/assets/go-BJwz_mda.js +0 -1
- package/dist/studio/assets/graphql-BVcCJEBO.js +0 -1
- package/dist/studio/assets/groovy-CacY0gHj.js +0 -1
- package/dist/studio/assets/gruvbox-dark-hard-C820rvS2.js +0 -1
- package/dist/studio/assets/gruvbox-dark-medium-BPjhmG05.js +0 -1
- package/dist/studio/assets/gruvbox-dark-soft-MrdJrrXF.js +0 -1
- package/dist/studio/assets/gruvbox-light-hard-BC_s9l72.js +0 -1
- package/dist/studio/assets/gruvbox-light-medium-BAWPOn9u.js +0 -1
- package/dist/studio/assets/gruvbox-light-soft-BSMLrYjP.js +0 -1
- package/dist/studio/assets/hack-CyUu15_C.js +0 -1
- package/dist/studio/assets/haml-Dj54pugT.js +0 -1
- package/dist/studio/assets/handlebars-l3llPaCT.js +0 -1
- package/dist/studio/assets/haskell-D8IpX4py.js +0 -1
- package/dist/studio/assets/haxe-OTjmBuCE.js +0 -1
- package/dist/studio/assets/hcl-Dh228itO.js +0 -1
- package/dist/studio/assets/highlighted-body-OFNGDK62-D_z62he-.js +0 -1
- package/dist/studio/assets/hjson-CxZEssPk.js +0 -1
- package/dist/studio/assets/hlsl-Cvrh5tZx.js +0 -1
- package/dist/studio/assets/horizon-CE9ld1lL.js +0 -1
- package/dist/studio/assets/horizon-bright-Br1oVSNq.js +0 -1
- package/dist/studio/assets/houston-CsvMBhTu.js +0 -1
- package/dist/studio/assets/html--Tmh4628.js +0 -1
- package/dist/studio/assets/html-derivative-B0Q_m8BM.js +0 -1
- package/dist/studio/assets/http-BXKW9YQL.js +0 -1
- package/dist/studio/assets/hurl-C60QjgUE.js +0 -1
- package/dist/studio/assets/hxml-B0Qn7Nwc.js +0 -1
- package/dist/studio/assets/hy-CZbG8q4J.js +0 -1
- package/dist/studio/assets/imba-DsUTQ-LC.js +0 -1
- package/dist/studio/assets/index-Cd4PgOFu.js +0 -390
- package/dist/studio/assets/index-DkGWw6ES.css +0 -2
- package/dist/studio/assets/ini-B5eOa1yu.js +0 -1
- package/dist/studio/assets/java-aXeLcVht.js +0 -1
- package/dist/studio/assets/javascript-BQcRH4fE.js +0 -1
- package/dist/studio/assets/jinja-DGNUkEt-.js +0 -1
- package/dist/studio/assets/jison-DwfSvoKv.js +0 -1
- package/dist/studio/assets/json-B0ukOVyl.js +0 -1
- package/dist/studio/assets/json5-BR5RXkoi.js +0 -1
- package/dist/studio/assets/jsonc-CYpm1nAK.js +0 -1
- package/dist/studio/assets/jsonl-CmCQp5Yx.js +0 -1
- package/dist/studio/assets/jsonnet-CJTPZ8u_.js +0 -1
- package/dist/studio/assets/jssm-DXw9l8Rf.js +0 -1
- package/dist/studio/assets/jsx-CzJUnsSO.js +0 -1
- package/dist/studio/assets/julia-D8zt_FEP.js +0 -1
- package/dist/studio/assets/just-nn4e9Gpd.js +0 -1
- package/dist/studio/assets/kanagawa-dragon-CXtmUGW6.js +0 -1
- package/dist/studio/assets/kanagawa-lotus-BN08jTvb.js +0 -1
- package/dist/studio/assets/kanagawa-wave-CTweb8Dz.js +0 -1
- package/dist/studio/assets/kdl-CsD5j6eV.js +0 -1
- package/dist/studio/assets/kotlin-DhhofPvG.js +0 -1
- package/dist/studio/assets/kusto-BUv0MjJC.js +0 -1
- package/dist/studio/assets/laserwave-C_8bwKvT.js +0 -1
- package/dist/studio/assets/latex-OBwqlec5.js +0 -1
- package/dist/studio/assets/lean-CewbzKMR.js +0 -1
- package/dist/studio/assets/less-DVTAwKKz.js +0 -1
- package/dist/studio/assets/light-plus-DVQuIRkW.js +0 -1
- package/dist/studio/assets/liquid-CktG-Iuw.js +0 -1
- package/dist/studio/assets/llvm-Cm23YOpf.js +0 -1
- package/dist/studio/assets/log-BNLmms1o.js +0 -1
- package/dist/studio/assets/logo-Cluzi2Zq.js +0 -1
- package/dist/studio/assets/lua-ZqavSetL.js +0 -1
- package/dist/studio/assets/luau-CNKltnaQ.js +0 -1
- package/dist/studio/assets/make-Dixweg8N.js +0 -1
- package/dist/studio/assets/markdown-BYOwaDjH.js +0 -1
- package/dist/studio/assets/marko-CxDLRfNz.js +0 -1
- package/dist/studio/assets/material-theme-Bm3Qr25_.js +0 -1
- package/dist/studio/assets/material-theme-darker-2IIEA8gg.js +0 -1
- package/dist/studio/assets/material-theme-lighter-uhdI0v04.js +0 -1
- package/dist/studio/assets/material-theme-ocean-CHQ94UKr.js +0 -1
- package/dist/studio/assets/material-theme-palenight-B5W6OYN7.js +0 -1
- package/dist/studio/assets/matlab-D7qyCx1q.js +0 -1
- package/dist/studio/assets/mdc-COZbBQqS.js +0 -1
- package/dist/studio/assets/mdx-DQZ5AkYe.js +0 -1
- package/dist/studio/assets/mermaid-Bk4SNUv9.js +0 -1
- package/dist/studio/assets/mermaid-GHXKKRXX-ChY6AJ7l.js +0 -1
- package/dist/studio/assets/min-dark-BSWPekZh.js +0 -1
- package/dist/studio/assets/min-light-DDpmG2fV.js +0 -1
- package/dist/studio/assets/mipsasm-BMqwQI7S.js +0 -1
- package/dist/studio/assets/mojo-BgCJLMeH.js +0 -1
- package/dist/studio/assets/monokai-CdkpiU2Y.js +0 -1
- package/dist/studio/assets/moonbit-CaWjb8XO.js +0 -1
- package/dist/studio/assets/move-B1IS1UjX.js +0 -1
- package/dist/studio/assets/narrat-_X_XdTYD.js +0 -1
- package/dist/studio/assets/nextflow-Bbiyy34d.js +0 -1
- package/dist/studio/assets/nextflow-groovy-Dc_ddanL.js +0 -1
- package/dist/studio/assets/nginx-DB8A8-iZ.js +0 -1
- package/dist/studio/assets/night-owl-DhmEMT88.js +0 -1
- package/dist/studio/assets/night-owl-light-eJ-hLW7d.js +0 -1
- package/dist/studio/assets/nim-Cs5VB9QZ.js +0 -1
- package/dist/studio/assets/nix-IvuFDN5E.js +0 -1
- package/dist/studio/assets/nord-Cb4Vim4T.js +0 -1
- package/dist/studio/assets/nushell-DcLAeLz5.js +0 -1
- package/dist/studio/assets/objective-c-D1A_Heim.js +0 -1
- package/dist/studio/assets/objective-cpp-BsSzOQcm.js +0 -1
- package/dist/studio/assets/ocaml-O90oeIOV.js +0 -1
- package/dist/studio/assets/odin-B1RWQWA5.js +0 -1
- package/dist/studio/assets/one-dark-pro-CLwyXe_n.js +0 -1
- package/dist/studio/assets/one-light-D7Lr4KcI.js +0 -1
- package/dist/studio/assets/openscad-BUDT5pXO.js +0 -1
- package/dist/studio/assets/pascal-4ZHwLPI5.js +0 -1
- package/dist/studio/assets/perl-pV-3Dli_.js +0 -1
- package/dist/studio/assets/php-CFSq0mhc.js +0 -1
- package/dist/studio/assets/pkl-ot-7Btpt.js +0 -1
- package/dist/studio/assets/plastic-DQwYfKfQ.js +0 -1
- package/dist/studio/assets/plsql-DGHpHOYJ.js +0 -1
- package/dist/studio/assets/po-BiJDBrnU.js +0 -1
- package/dist/studio/assets/poimandres-DRFjx7u4.js +0 -1
- package/dist/studio/assets/polar-C7UOKdEL.js +0 -1
- package/dist/studio/assets/postcss-BXeXVLqQ.js +0 -1
- package/dist/studio/assets/powerquery-DNMTfnFr.js +0 -1
- package/dist/studio/assets/powershell-DshXNtvi.js +0 -1
- package/dist/studio/assets/prisma-BsRQq5mF.js +0 -1
- package/dist/studio/assets/prolog-iXnhIJG7.js +0 -1
- package/dist/studio/assets/proto-DB4EqR-F.js +0 -1
- package/dist/studio/assets/pug-DuCfu-AK.js +0 -1
- package/dist/studio/assets/puppet-CDv2pdJW.js +0 -1
- package/dist/studio/assets/purescript-9MfHhQsQ.js +0 -1
- package/dist/studio/assets/python-gzcpVVnB.js +0 -1
- package/dist/studio/assets/qml-Gqte1OeW.js +0 -1
- package/dist/studio/assets/qmldir-DCQb3MpD.js +0 -1
- package/dist/studio/assets/qss-Fe1Jh2GI.js +0 -1
- package/dist/studio/assets/r-B8XqafmU.js +0 -1
- package/dist/studio/assets/racket-DcIDlBhZ.js +0 -1
- package/dist/studio/assets/raku-B3gFvitq.js +0 -1
- package/dist/studio/assets/razor-HyK7qWun.js +0 -1
- package/dist/studio/assets/red-CJ3rzSJv.js +0 -1
- package/dist/studio/assets/reg-CRGYupPL.js +0 -1
- package/dist/studio/assets/regexp-Bdipf9Ks.js +0 -1
- package/dist/studio/assets/rel-BtDbiS_P.js +0 -1
- package/dist/studio/assets/riscv-Ckw8ddFX.js +0 -1
- package/dist/studio/assets/ron-VUp2lXgN.js +0 -1
- package/dist/studio/assets/rose-pine-BthvhNj6.js +0 -1
- package/dist/studio/assets/rose-pine-dawn-Dg85fqjY.js +0 -1
- package/dist/studio/assets/rose-pine-moon-hon4tzzS.js +0 -1
- package/dist/studio/assets/rosmsg-CAekHB0j.js +0 -1
- package/dist/studio/assets/rst-DtdOQB-0.js +0 -1
- package/dist/studio/assets/ruby-DOExsDws.js +0 -1
- package/dist/studio/assets/rust-Cfkwpbl8.js +0 -1
- package/dist/studio/assets/sas-BLRRJVWF.js +0 -1
- package/dist/studio/assets/sass-DXrisJhu.js +0 -1
- package/dist/studio/assets/scala-DKOlJaKm.js +0 -1
- package/dist/studio/assets/scheme-DQCgrYNe.js +0 -1
- package/dist/studio/assets/scss-BILH_sWZ.js +0 -1
- package/dist/studio/assets/sdbl-bTVj8UrX.js +0 -1
- package/dist/studio/assets/shaderlab-TOUzSsQk.js +0 -1
- package/dist/studio/assets/shellscript-CC2KTOv4.js +0 -1
- package/dist/studio/assets/shellsession-CiGs-_qT.js +0 -1
- package/dist/studio/assets/slack-dark-DnToyrRv.js +0 -1
- package/dist/studio/assets/slack-ochin-B2OO5cIa.js +0 -1
- package/dist/studio/assets/smalltalk-B16xEiuN.js +0 -1
- package/dist/studio/assets/snazzy-light-4G7pJPwS.js +0 -1
- package/dist/studio/assets/solarized-dark-DV17i1UV.js +0 -1
- package/dist/studio/assets/solarized-light-DSh2HLQt.js +0 -1
- package/dist/studio/assets/solidity-CKzVLygQ.js +0 -1
- package/dist/studio/assets/soy-QSSlYQhf.js +0 -1
- package/dist/studio/assets/sparql-D_iOobhT.js +0 -1
- package/dist/studio/assets/splunk-BC2Px7Mm.js +0 -1
- package/dist/studio/assets/sql-CPD_IP3i.js +0 -1
- package/dist/studio/assets/ssh-config-BgfXC-Er.js +0 -1
- package/dist/studio/assets/stata-jhUDP248.js +0 -1
- package/dist/studio/assets/stylus-B6D30XZt.js +0 -1
- package/dist/studio/assets/surrealql-CEI1vHaO.js +0 -1
- package/dist/studio/assets/svelte-BqMghnvQ.js +0 -1
- package/dist/studio/assets/swift-DonLKvLd.js +0 -1
- package/dist/studio/assets/synthwave-84-nFMaYfgc.js +0 -1
- package/dist/studio/assets/system-verilog-DJ5XKQeo.js +0 -1
- package/dist/studio/assets/systemd-BxMlprV5.js +0 -1
- package/dist/studio/assets/talonscript-CohzipZa.js +0 -1
- package/dist/studio/assets/tasl-DMoTqEGO.js +0 -1
- package/dist/studio/assets/tcl-CZd0xW_V.js +0 -1
- package/dist/studio/assets/templ-DhMt3Gd_.js +0 -1
- package/dist/studio/assets/terraform-DswuEJGm.js +0 -1
- package/dist/studio/assets/tex-B2oLGu4M.js +0 -1
- package/dist/studio/assets/tokyo-night-oM2G3aXe.js +0 -1
- package/dist/studio/assets/toml-CcmNWLt0.js +0 -1
- package/dist/studio/assets/ts-tags-DbXbAuWo.js +0 -1
- package/dist/studio/assets/tsv-sltzmVWM.js +0 -1
- package/dist/studio/assets/tsx-BWdjt-eB.js +0 -1
- package/dist/studio/assets/turtle-ByJddavk.js +0 -1
- package/dist/studio/assets/twig-b7sZE9-Z.js +0 -1
- package/dist/studio/assets/typescript-B5gQukXY.js +0 -1
- package/dist/studio/assets/typespec-B88KGewJ.js +0 -1
- package/dist/studio/assets/typst-DI99ib-x.js +0 -1
- package/dist/studio/assets/v-DETTlOr0.js +0 -1
- package/dist/studio/assets/vala-zf12oZj6.js +0 -1
- package/dist/studio/assets/vb-Djn5o6TS.js +0 -1
- package/dist/studio/assets/verilog-CiiDBU1e.js +0 -1
- package/dist/studio/assets/vesper-D5bVUKB1.js +0 -1
- package/dist/studio/assets/vhdl-BroJfC0k.js +0 -1
- package/dist/studio/assets/viml-DvXPmvsu.js +0 -1
- package/dist/studio/assets/vitesse-black-fwtXNY1n.js +0 -1
- package/dist/studio/assets/vitesse-dark-BZCL-v6S.js +0 -1
- package/dist/studio/assets/vitesse-light-VbXTXTou.js +0 -1
- package/dist/studio/assets/vue-DGv3yRD9.js +0 -1
- package/dist/studio/assets/vue-html-Cx5Ph-Io.js +0 -1
- package/dist/studio/assets/vue-vine-G05O51ag.js +0 -1
- package/dist/studio/assets/vyper-CgoNMtux.js +0 -1
- package/dist/studio/assets/wasm-BnjxR4X6.js +0 -1
- package/dist/studio/assets/wasm-ByWQv1Qj.js +0 -1
- package/dist/studio/assets/wenyan-C8pVoKbM.js +0 -1
- package/dist/studio/assets/wgsl-BsKzXJz4.js +0 -1
- package/dist/studio/assets/wikitext-ClFFjSW2.js +0 -1
- package/dist/studio/assets/wit-DdvCle-K.js +0 -1
- package/dist/studio/assets/wolfram-DLL8P-h_.js +0 -1
- package/dist/studio/assets/xml-Bd8eSLdt.js +0 -1
- package/dist/studio/assets/xsl-DVLXYJQL.js +0 -1
- package/dist/studio/assets/yaml-CO0sPwby.js +0 -1
- package/dist/studio/assets/zenscript-BnlCZFoB.js +0 -1
- package/dist/studio/assets/zig-CMLA9XwU.js +0 -1
- package/dist/studio/index.html +0 -23
- package/dist/types-codegen-C-9yeFao.js +0 -101
- package/dist/types-codegen-C-9yeFao.js.map +0 -1
- package/dist/vite.d.ts +0 -46
- package/dist/vite.js +0 -193
- package/dist/vite.js.map +0 -1
package/docs/index.md
CHANGED
|
@@ -13,7 +13,6 @@ Think builds on packages that are installed alongside it:
|
|
|
13
13
|
- `agents/docs/index.md` — Durable Objects, state, routing, sessions, scheduling, MCP, and shared agent primitives
|
|
14
14
|
- `@cloudflare/codemode/docs/index.md` — sandboxed execution, tool providers, connectors, approvals, and snippets
|
|
15
15
|
- `@cloudflare/shell/docs/index.md` — Workspace, filesystem operations, and the `state.*` and `git.*` providers used by Think's tools
|
|
16
|
-
- `create-think/README.md` — CLI commands, templates, and generated project structure
|
|
17
16
|
|
|
18
17
|
## Why Think
|
|
19
18
|
|
|
@@ -64,451 +63,6 @@ export default {
|
|
|
64
63
|
|
|
65
64
|
That is it. Think handles the WebSocket chat protocol, message persistence, the agentic loop, message sanitization, stream resumption, client tool support, and workspace file tools. The built-in `read` tool reads text with line numbers and passes images/PDFs through to multimodal-capable models.
|
|
66
65
|
|
|
67
|
-
## Think Framework
|
|
68
|
-
|
|
69
|
-
The Think Vite plugin can wire agents from an `agents/` directory into a
|
|
70
|
-
generated Worker entry. This removes the hand-written routing boilerplate while
|
|
71
|
-
keeping stable Durable Object class names for production deployments.
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
// vite.config.ts
|
|
75
|
-
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
76
|
-
import { think } from "@cloudflare/think/vite";
|
|
77
|
-
import { defineConfig } from "vite";
|
|
78
|
-
|
|
79
|
-
export default defineConfig({
|
|
80
|
-
plugins: [think(), cloudflare()]
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Agent Conventions
|
|
85
|
-
|
|
86
|
-
Put top-level agents under the root `agents/` directory:
|
|
87
|
-
|
|
88
|
-
```text
|
|
89
|
-
agents/support.ts
|
|
90
|
-
agents/assistant/agent.ts
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Put sub-agents under a nested `agents/` directory owned by the parent:
|
|
94
|
-
|
|
95
|
-
```text
|
|
96
|
-
agents/assistant/agent.ts
|
|
97
|
-
agents/assistant/agents/researcher.ts
|
|
98
|
-
agents/assistant/agents/code-reviewer/agent.ts
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Each convention file should export one Agent-compatible class. If a module
|
|
102
|
-
exports multiple Agent-compatible classes, Think fails with a focused diagnostic
|
|
103
|
-
so the generated Durable Object export stays unambiguous.
|
|
104
|
-
|
|
105
|
-
The framework derives stable generated class names from this topology:
|
|
106
|
-
|
|
107
|
-
| Convention path | Generated class |
|
|
108
|
-
| ------------------------------------------------ | -------------------------------------- |
|
|
109
|
-
| `agents/support.ts` | `ThinkAgent_Support` |
|
|
110
|
-
| `agents/assistant/agent.ts` | `ThinkAgent_Assistant` |
|
|
111
|
-
| `agents/assistant/agents/researcher.ts` | `ThinkSubAgent_Assistant_Researcher` |
|
|
112
|
-
| `agents/assistant/agents/code-reviewer/agent.ts` | `ThinkSubAgent_Assistant_CodeReviewer` |
|
|
113
|
-
|
|
114
|
-
Top-level agents need Durable Object bindings and migrations. The binding
|
|
115
|
-
`class_name` must be the generated class, but the binding `name` can stay
|
|
116
|
-
app-owned, such as `AssistantDirectory`. Sub-agents are facets: the generated
|
|
117
|
-
Worker entry exports their classes so parent agents can use `ctx.exports`, but
|
|
118
|
-
production `wrangler.jsonc` does not need facet-only Durable Object bindings,
|
|
119
|
-
migrations, or public routes.
|
|
120
|
-
|
|
121
|
-
Think currently supports top-level agents and one layer of sub-agents. Nested
|
|
122
|
-
sub-agent conventions, such as
|
|
123
|
-
`agents/assistant/agents/researcher/agents/coder.ts`, are intentionally not
|
|
124
|
-
supported yet. If your app needs deeper nesting, please reach out with the use
|
|
125
|
-
case so we can design the routing and lifecycle model deliberately.
|
|
126
|
-
|
|
127
|
-
### Friendly Routes
|
|
128
|
-
|
|
129
|
-
Generated class names are stable, but URLs stay friendly. A request can use:
|
|
130
|
-
|
|
131
|
-
```text
|
|
132
|
-
/agents/assistant/alice/sub/researcher/chat-1
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Internally, the Think router resolves `assistant` and `researcher` through the
|
|
136
|
-
manifest and adapts the request to the lower-level Agents facet router, which
|
|
137
|
-
still expects generated class segments. Repeated child names under different
|
|
138
|
-
parents are safe because sub-agent aliases are scoped by parent. Treat this as a
|
|
139
|
-
routing helper contract rather than a URL-rewriting API.
|
|
140
|
-
|
|
141
|
-
Use a custom route prefix when you want agents under another path:
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
think({ routePrefix: "/api/agents" });
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
The generated config and routing diagnostics use that prefix, so direct routes
|
|
148
|
-
become:
|
|
149
|
-
|
|
150
|
-
```text
|
|
151
|
-
/api/agents/assistant/alice
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Custom App Server
|
|
155
|
-
|
|
156
|
-
If `src/server.ts` exists, the generated entry calls it first. If it returns
|
|
157
|
-
`null` or `undefined`, Think handles the request. Any `Response` stops
|
|
158
|
-
fallthrough, including an intentional `404`; auth-gated apps can use that to
|
|
159
|
-
prevent direct `/agents/*` access.
|
|
160
|
-
|
|
161
|
-
```typescript
|
|
162
|
-
export default {
|
|
163
|
-
async fetch(request: Request) {
|
|
164
|
-
if (new URL(request.url).pathname === "/health") {
|
|
165
|
-
return new Response("ok");
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
For auth-gated or app-owned routes, use the injected Think router. The generated
|
|
174
|
-
entry passes it as the fourth argument to your `fetch()` handler:
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
import { getAgentByName } from "agents";
|
|
178
|
-
|
|
179
|
-
type ThinkContext = {
|
|
180
|
-
router: {
|
|
181
|
-
routeSubAgent(
|
|
182
|
-
request: Request,
|
|
183
|
-
parent: { fetch(request: Request): Promise<Response> },
|
|
184
|
-
options: { parent: string }
|
|
185
|
-
): Promise<Response>;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export default {
|
|
190
|
-
async fetch(
|
|
191
|
-
request: Request,
|
|
192
|
-
env: Env,
|
|
193
|
-
ctx: ExecutionContext,
|
|
194
|
-
think?: ThinkContext
|
|
195
|
-
) {
|
|
196
|
-
const url = new URL(request.url);
|
|
197
|
-
|
|
198
|
-
if (url.pathname === "/chat" || url.pathname.startsWith("/chat/")) {
|
|
199
|
-
const user = await requireUser(request);
|
|
200
|
-
const directory = await getAgentByName(
|
|
201
|
-
env.AssistantDirectory,
|
|
202
|
-
user.login
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
if (!think?.router) {
|
|
206
|
-
return new Response(
|
|
207
|
-
'Assistant chat routing requires "main": "virtual:think/entry".',
|
|
208
|
-
{ status: 500 }
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
return think.router.routeSubAgent(request, directory, {
|
|
213
|
-
parent: "assistant"
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
This keeps authentication and tenancy in your app code while still letting Think
|
|
223
|
-
resolve friendly sub-agent URLs such as `/chat/sub/researcher/chat-1`. If a
|
|
224
|
-
request has a `/sub/...` segment that cannot be resolved for the declared parent,
|
|
225
|
-
`routeSubAgent()` returns `404`; paths without a `/sub/...` segment continue to
|
|
226
|
-
the parent agent.
|
|
227
|
-
|
|
228
|
-
### React Router Hosts
|
|
229
|
-
|
|
230
|
-
React Router framework apps can use Think as an additive Vite plugin while
|
|
231
|
-
React Router owns the app routes, loaders, and SSR.
|
|
232
|
-
|
|
233
|
-
See `examples/think-react-router` for a complete runnable example.
|
|
234
|
-
|
|
235
|
-
```typescript
|
|
236
|
-
// vite.config.ts
|
|
237
|
-
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
238
|
-
import { reactRouter } from "@react-router/dev/vite";
|
|
239
|
-
import { think } from "@cloudflare/think/vite";
|
|
240
|
-
import { defineConfig } from "vite";
|
|
241
|
-
|
|
242
|
-
export default defineConfig({
|
|
243
|
-
plugins: [
|
|
244
|
-
cloudflare({ viteEnvironment: { name: "ssr" } }),
|
|
245
|
-
reactRouter(),
|
|
246
|
-
think({ routePrefix: "/api/agents", allowNonVirtualMain: true })
|
|
247
|
-
]
|
|
248
|
-
});
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
```typescript
|
|
252
|
-
// react-router.config.ts
|
|
253
|
-
import type { Config } from "@react-router/dev/config";
|
|
254
|
-
|
|
255
|
-
export default {
|
|
256
|
-
appDirectory: "app",
|
|
257
|
-
ssr: true,
|
|
258
|
-
future: {
|
|
259
|
-
v8_viteEnvironmentApi: true
|
|
260
|
-
}
|
|
261
|
-
} satisfies Config;
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
Point `wrangler.jsonc.main` at a normal Worker entry file and make that file a
|
|
265
|
-
tiny Think shim:
|
|
266
|
-
|
|
267
|
-
```typescript
|
|
268
|
-
// src/worker.ts
|
|
269
|
-
export { default } from "virtual:think/entry";
|
|
270
|
-
export * from "virtual:think/entry";
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
Then delegate ordinary app requests to React Router from `src/server.ts` and
|
|
274
|
-
return `null` for Think-owned paths:
|
|
275
|
-
|
|
276
|
-
```typescript
|
|
277
|
-
// src/server.ts
|
|
278
|
-
import { createRequestHandler } from "react-router";
|
|
279
|
-
import type { ThinkAppContext } from "@cloudflare/think/server-entry";
|
|
280
|
-
import type { ServerBuild } from "react-router";
|
|
281
|
-
|
|
282
|
-
const reactRouterHandler = createRequestHandler(
|
|
283
|
-
() =>
|
|
284
|
-
import("virtual:react-router/server-build").then(
|
|
285
|
-
(mod) => (mod.default ?? mod) as ServerBuild
|
|
286
|
-
),
|
|
287
|
-
import.meta.env.MODE
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
export default {
|
|
291
|
-
async fetch(
|
|
292
|
-
request: Request,
|
|
293
|
-
env: Env,
|
|
294
|
-
ctx: ExecutionContext,
|
|
295
|
-
_think?: ThinkAppContext
|
|
296
|
-
) {
|
|
297
|
-
const url = new URL(request.url);
|
|
298
|
-
if (url.pathname.startsWith("/api/agents/")) {
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
return reactRouterHandler(request, {
|
|
303
|
-
cloudflare: {
|
|
304
|
-
env,
|
|
305
|
-
ctx
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
This is still a normal React Router app: `app/routes.ts`, `app/root.tsx`, and
|
|
313
|
-
route modules stay under React Router's conventions. The Worker shim exists so
|
|
314
|
-
Think can keep exporting generated Durable Object classes while the host
|
|
315
|
-
framework owns app rendering.
|
|
316
|
-
|
|
317
|
-
### TanStack Start Hosts
|
|
318
|
-
|
|
319
|
-
TanStack Start apps use the same host-framework shape: the Cloudflare Vite plugin
|
|
320
|
-
creates the `ssr` workerd environment, TanStack owns document routing, and Think
|
|
321
|
-
handles its route prefix after the app server returns `null`.
|
|
322
|
-
|
|
323
|
-
See `examples/think-tanstack-start` for a complete runnable example.
|
|
324
|
-
|
|
325
|
-
```typescript
|
|
326
|
-
// vite.config.ts
|
|
327
|
-
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
328
|
-
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
|
329
|
-
import react from "@vitejs/plugin-react";
|
|
330
|
-
import { think } from "@cloudflare/think/vite";
|
|
331
|
-
import { defineConfig } from "vite";
|
|
332
|
-
|
|
333
|
-
export default defineConfig({
|
|
334
|
-
plugins: [
|
|
335
|
-
cloudflare({ viteEnvironment: { name: "ssr" } }),
|
|
336
|
-
tanstackStart(),
|
|
337
|
-
react(),
|
|
338
|
-
think({ routePrefix: "/api/agents", allowNonVirtualMain: true })
|
|
339
|
-
]
|
|
340
|
-
});
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
Use the same Worker shim:
|
|
344
|
-
|
|
345
|
-
```typescript
|
|
346
|
-
// src/worker.ts
|
|
347
|
-
export { default } from "virtual:think/entry";
|
|
348
|
-
export * from "virtual:think/entry";
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
Then delegate ordinary app requests to TanStack Start:
|
|
352
|
-
|
|
353
|
-
```typescript
|
|
354
|
-
// src/server.ts
|
|
355
|
-
import handler from "@tanstack/react-start/server-entry";
|
|
356
|
-
import type { ThinkAppContext } from "@cloudflare/think/server-entry";
|
|
357
|
-
|
|
358
|
-
export default {
|
|
359
|
-
async fetch(
|
|
360
|
-
request: Request,
|
|
361
|
-
env: Env,
|
|
362
|
-
ctx: ExecutionContext,
|
|
363
|
-
_think?: ThinkAppContext
|
|
364
|
-
) {
|
|
365
|
-
const url = new URL(request.url);
|
|
366
|
-
if (url.pathname.startsWith("/api/agents/")) {
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
return handler.fetch(request);
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
TanStack route modules are also part of the client build. If a route needs
|
|
376
|
-
Cloudflare bindings, access them through a TanStack server function instead of
|
|
377
|
-
importing `cloudflare:workers` into client-executed code.
|
|
378
|
-
|
|
379
|
-
### Diagnostics
|
|
380
|
-
|
|
381
|
-
During Vite build/startup, Think reads `wrangler.jsonc` or `wrangler.json`,
|
|
382
|
-
watches Wrangler config files (`wrangler.jsonc`, `wrangler.json`, and
|
|
383
|
-
`wrangler.toml`) plus the `agents/` tree, discovers convention agents, and
|
|
384
|
-
reports framework-specific diagnostics for:
|
|
385
|
-
|
|
386
|
-
- `wrangler.jsonc.main` values that bypass `virtual:think/entry`,
|
|
387
|
-
- missing Durable Object bindings or migrations for top-level generated classes,
|
|
388
|
-
- missing Worker Loader bindings when colocated skills require one,
|
|
389
|
-
- custom `assets.run_worker_first` values that omit the configured route prefix,
|
|
390
|
-
- duplicate generated class names, agent ids, route ids, or orphan sub-agents.
|
|
391
|
-
|
|
392
|
-
Platform bindings such as AI, KV, R2, D1, and secrets remain user-owned. Think
|
|
393
|
-
does not infer or silently add those bindings.
|
|
394
|
-
|
|
395
|
-
`wrangler.toml` is watched so dev servers notice config churn, but Think's
|
|
396
|
-
framework diagnostics currently parse JSON/JSONC Wrangler config. Prefer
|
|
397
|
-
`wrangler.jsonc` for framework apps.
|
|
398
|
-
|
|
399
|
-
Advanced embedders that intentionally do not use `virtual:think/entry` can opt
|
|
400
|
-
out of the `main` diagnostic with:
|
|
401
|
-
|
|
402
|
-
```typescript
|
|
403
|
-
think({ allowNonVirtualMain: true });
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
Use that only when another wrapper still re-exports Think's generated Durable
|
|
407
|
-
Object classes.
|
|
408
|
-
|
|
409
|
-
### CLI Type Generation
|
|
410
|
-
|
|
411
|
-
Use `think types` to keep Think-specific TypeScript declarations in sync with the
|
|
412
|
-
discovered manifest:
|
|
413
|
-
|
|
414
|
-
```bash
|
|
415
|
-
npx @cloudflare/think types
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
By default, the command only writes Think-owned declarations to `think.d.ts`:
|
|
419
|
-
`virtual:think/entry`, `virtual:think/router`, generated Durable Object exports,
|
|
420
|
-
skill stubs, and the generated Durable Object bindings on `Cloudflare.Env`.
|
|
421
|
-
|
|
422
|
-
When you also want Wrangler platform declarations, use `--all`. Wrangler flags
|
|
423
|
-
can be passed through after `--`:
|
|
424
|
-
|
|
425
|
-
```bash
|
|
426
|
-
npx @cloudflare/think types --all -- --env production
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
With `--all`, Think runs `wrangler types env.d.ts --include-runtime false` before
|
|
430
|
-
generating `think.d.ts`. Pass `--wrangler-env-file` to change Wrangler's output
|
|
431
|
-
path, or pass `-- --include-runtime true` when you intentionally want Wrangler's
|
|
432
|
-
runtime declarations included.
|
|
433
|
-
|
|
434
|
-
`think types` does not generate an importable Env module. App code can use the
|
|
435
|
-
augmented `Cloudflare.Env` directly, or define its own local alias if it prefers
|
|
436
|
-
imported types.
|
|
437
|
-
|
|
438
|
-
Use `think types --check` in CI to verify Think-generated files are current
|
|
439
|
-
without modifying the working tree.
|
|
440
|
-
|
|
441
|
-
### Runtime CLI
|
|
442
|
-
|
|
443
|
-
Once an agent is running — locally with `pnpm dev` or deployed to a Worker — you
|
|
444
|
-
can reach it from the terminal. `think init`, `think inspect`, and `think types`
|
|
445
|
-
are build-time tools; `think studio` and `think state` connect to the live
|
|
446
|
-
Durable Object over the same chat WebSocket the browser client uses.
|
|
447
|
-
|
|
448
|
-
> These commands are experimental and may change in any release.
|
|
449
|
-
|
|
450
|
-
Launch Think Studio — a local web app for chatting with and inspecting a running
|
|
451
|
-
Think instance:
|
|
452
|
-
|
|
453
|
-
```bash
|
|
454
|
-
# Local dev server (defaults to localhost:5173)
|
|
455
|
-
npx @cloudflare/think studio support
|
|
456
|
-
|
|
457
|
-
# A specific instance, against a deployed Worker, with an auth token
|
|
458
|
-
npx @cloudflare/think studio support alice --url https://app.example.com --token "$TOKEN"
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
`studio` starts a tiny local server, opens your browser, and serves a bundled
|
|
462
|
-
single-page app. The connect screen is pre-filled from the flags you passed (and
|
|
463
|
-
from the local manifest's agent list when run inside a Think project), but you
|
|
464
|
-
can point it at any local or remote Think instance from the UI. Once connected,
|
|
465
|
-
Studio gives you:
|
|
466
|
-
|
|
467
|
-
- A **chat view** with token-by-token streaming, tool calls, and inline
|
|
468
|
-
approve/reject buttons for `needsApproval` tools.
|
|
469
|
-
- A read-only **inspector** showing the agent's identity, connection status,
|
|
470
|
-
live state, recent history count, and a turn/recovery status badge.
|
|
471
|
-
|
|
472
|
-
The browser talks to the agent directly over a WebSocket, so the Studio server
|
|
473
|
-
stays a thin static launcher (`--port` to change it, `--no-open` to skip
|
|
474
|
-
opening the browser). **Chatting drives a real, persisted turn** against the live
|
|
475
|
-
agent — it writes to the agent's session exactly as any browser client would.
|
|
476
|
-
|
|
477
|
-
When you run `pnpm dev`, the Think Vite plugin also adds an **`s` shortcut** to
|
|
478
|
-
the dev server: press `s` (alongside Vite's built-in `r`/`u`/`o`/`c`/`q`) to
|
|
479
|
-
launch Studio pointed at the running dev server. Pass `studioShortcut: false` to
|
|
480
|
-
the `think()` Vite plugin to disable it.
|
|
481
|
-
|
|
482
|
-
Print an agent's identity, state, and recent history without sending a message:
|
|
483
|
-
|
|
484
|
-
```bash
|
|
485
|
-
npx @cloudflare/think state support alice --limit 20
|
|
486
|
-
npx @cloudflare/think state support --json
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
Both commands share the same connection flags:
|
|
490
|
-
|
|
491
|
-
| Flag | Description |
|
|
492
|
-
| ---------------- | ----------------------------------------------------------- |
|
|
493
|
-
| `<agent>` | Manifest agent id/alias, or a raw route segment |
|
|
494
|
-
| `[instance]` | Agent instance name (default `default`) |
|
|
495
|
-
| `--url <origin>` | Remote origin, e.g. `https://app.example.com` (implies wss) |
|
|
496
|
-
| `--host <h[:p]>` | Local host (default `localhost:5173`; Wrangler uses `8787`) |
|
|
497
|
-
| `--protocol` | Force `ws` or `wss` |
|
|
498
|
-
| `--token <t>` | Auth token, sent as the `token` query param |
|
|
499
|
-
| `--query k=v` | Extra query params (repeatable) |
|
|
500
|
-
| `--route-prefix` | Override the Think route prefix |
|
|
501
|
-
| `--root` | Project root used to discover the manifest (default cwd) |
|
|
502
|
-
|
|
503
|
-
WebSocket upgrades cannot send custom headers, so `--token` is delivered as a
|
|
504
|
-
query parameter — see [Cross-domain authentication](/agents/api-reference/cross-domain-authentication/)
|
|
505
|
-
for how to validate it server-side. Run from inside a Think project so the CLI
|
|
506
|
-
can resolve friendly agent ids and a custom route prefix from the manifest; from
|
|
507
|
-
anywhere else, pass the literal route segment and `--route-prefix` directly.
|
|
508
|
-
|
|
509
|
-
The CLI uses Node's built-in `WebSocket`, so it requires Node.js 24+ and adds no
|
|
510
|
-
extra dependencies.
|
|
511
|
-
|
|
512
66
|
## Messengers
|
|
513
67
|
|
|
514
68
|
Think agents can receive and reply to messenger webhooks directly. Messenger
|
|
@@ -626,12 +180,10 @@ function Chat() {
|
|
|
626
180
|
}
|
|
627
181
|
```
|
|
628
182
|
|
|
629
|
-
###
|
|
183
|
+
### Wrangler configuration
|
|
630
184
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
keep `main` set to `virtual:think/entry` and use the generated class names shown
|
|
634
|
-
in the framework section above.
|
|
185
|
+
Export each top-level Think class from the Worker entry and configure its
|
|
186
|
+
Durable Object binding and migration explicitly.
|
|
635
187
|
|
|
636
188
|
```jsonc
|
|
637
189
|
{
|
|
@@ -885,8 +437,20 @@ instructions. A skill source provides a catalog of skill names and descriptions;
|
|
|
885
437
|
Think adds that catalog to the system prompt and exposes tools the model can use
|
|
886
438
|
when a user task matches a skill.
|
|
887
439
|
|
|
888
|
-
Bundled skills are
|
|
889
|
-
the
|
|
440
|
+
Bundled skills are imported with the Agents Vite plugin from `agents/vite`.
|
|
441
|
+
Register it alongside the Cloudflare plugin in `vite.config.ts`:
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
445
|
+
import agents from "agents/vite";
|
|
446
|
+
import { defineConfig } from "vite";
|
|
447
|
+
|
|
448
|
+
export default defineConfig({
|
|
449
|
+
plugins: [agents(), cloudflare()]
|
|
450
|
+
});
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Then import the bundled skill manifest:
|
|
890
454
|
|
|
891
455
|
```typescript
|
|
892
456
|
import { Think, skills } from "@cloudflare/think";
|
|
@@ -1286,8 +850,6 @@ Think's `this.messages` getter reads directly from Session's tree-structured sto
|
|
|
1286
850
|
| Export | Description |
|
|
1287
851
|
| --------------------------------------- | ------------------------------------------------------------- |
|
|
1288
852
|
| `@cloudflare/think` | `Think`, `Session`, `Workspace`, `skills` namespace |
|
|
1289
|
-
| `@cloudflare/think/framework` | Framework manifest discovery and Worker config helpers |
|
|
1290
|
-
| `@cloudflare/think/server-entry` | Framework Worker entry helpers for custom server handlers |
|
|
1291
853
|
| `@cloudflare/think/messengers` | Messenger contracts, Chat SDK bridge, state agent, delivery |
|
|
1292
854
|
| `@cloudflare/think/messengers/telegram` | Telegram messenger provider and delivery helpers |
|
|
1293
855
|
| `@cloudflare/think/workflows` | `ThinkWorkflow`, `step.prompt()` — Workflow prompts |
|
|
@@ -1296,19 +858,17 @@ Think's `this.messages` getter reads directly from Session's tree-structured sto
|
|
|
1296
858
|
| `@cloudflare/think/tools/execute` | `createExecuteTool()` — sandboxed code execution via codemode |
|
|
1297
859
|
| `@cloudflare/think/tools/extensions` | `createExtensionTools()` — LLM-driven extension loading |
|
|
1298
860
|
| `@cloudflare/think/extensions` | `ExtensionManager`, `HostBridgeLoopback` — extension runtime |
|
|
1299
|
-
| `@cloudflare/think/vite` | Think Vite plugin and generated Worker config helpers |
|
|
1300
861
|
|
|
1301
862
|
## Dependencies
|
|
1302
863
|
|
|
1303
864
|
Peer dependencies you provide:
|
|
1304
865
|
|
|
1305
|
-
| Package | Required | Notes
|
|
1306
|
-
| ------------------------ | -------- |
|
|
1307
|
-
| `agents` | yes | Cloudflare Agents SDK
|
|
1308
|
-
| `ai` | yes | Vercel AI SDK v6
|
|
1309
|
-
| `zod` | yes | Schema validation (v4)
|
|
1310
|
-
| `@chat-adapter/telegram` | optional | Required for Telegram messengers
|
|
1311
|
-
| `vite` | optional | Required for the Think Vite plugin (`/vite`) |
|
|
866
|
+
| Package | Required | Notes |
|
|
867
|
+
| ------------------------ | -------- | -------------------------------- |
|
|
868
|
+
| `agents` | yes | Cloudflare Agents SDK |
|
|
869
|
+
| `ai` | yes | Vercel AI SDK v6 |
|
|
870
|
+
| `zod` | yes | Schema validation (v4) |
|
|
871
|
+
| `@chat-adapter/telegram` | optional | Required for Telegram messengers |
|
|
1312
872
|
|
|
1313
873
|
Bundled with `@cloudflare/think`:
|
|
1314
874
|
|
|
@@ -1317,7 +877,6 @@ Bundled with `@cloudflare/think`:
|
|
|
1317
877
|
| `@cloudflare/shell` | `Workspace` filesystem |
|
|
1318
878
|
| `@cloudflare/codemode` | Code execution for `createExecuteTool()` |
|
|
1319
879
|
| `just-bash` | Sandboxed shell for the default workspace `bash` tool |
|
|
1320
|
-
| `aywson` | Wrangler JSON/JSONC parsing for the framework plugin |
|
|
1321
880
|
|
|
1322
881
|
The Agent Skills engine and its script runner live in
|
|
1323
882
|
[`agents/skills`](https://github.com/cloudflare/agents/blob/main/packages/agents/AGENTS.md) (so skill scripts pull
|
package/docs/lifecycle-hooks.md
CHANGED
|
@@ -143,6 +143,7 @@ All fields are optional. Return only what you want to change.
|
|
|
143
143
|
| `chatStreamStallTimeoutMs` | `number` | Override the stream-stall watchdog for this turn (`0` disables it); auto-resets after the turn. Useful for a turn with a known-slow tool — see [Think configuration](./index.md). |
|
|
144
144
|
| `headers` | `Record<string, string>` | Additional provider request headers |
|
|
145
145
|
| `providerOptions` | `Record<string, unknown>` | Provider-specific options |
|
|
146
|
+
| `repairToolCall` | `ToolCallRepairFunction` | Repair a tool call that the AI SDK cannot parse or validate. The returned call is revalidated before execution. |
|
|
146
147
|
| `experimental_transform` | `StreamTextTransform \| StreamTextTransform[]` | AI SDK stream transform(s) for this turn — inspect or rewrite stream parts (for example, emit `source` parts derived from tool results). Applied in order. |
|
|
147
148
|
|
|
148
149
|
### Examples
|
|
@@ -199,6 +200,29 @@ beforeTurn() {
|
|
|
199
200
|
|
|
200
201
|
`stopWhen` is additive: Think sends both `stepCountIs(maxSteps)` and your condition(s) to the AI SDK, so the loop ends when either one matches. Stop conditions are functions, so they can be returned from a Think subclass's `beforeTurn`, but not from sandboxed extension `beforeTurn` hooks over RPC.
|
|
201
202
|
|
|
203
|
+
Repair fenced JSON tool input before execution:
|
|
204
|
+
|
|
205
|
+
````typescript
|
|
206
|
+
import { InvalidToolInputError } from "ai";
|
|
207
|
+
|
|
208
|
+
beforeTurn() {
|
|
209
|
+
return {
|
|
210
|
+
repairToolCall: async ({ toolCall, error }) => {
|
|
211
|
+
if (!InvalidToolInputError.isInstance(error)) return null;
|
|
212
|
+
|
|
213
|
+
const fencedJson = /^```(?:json)?\s*([\s\S]*?)\s*```$/.exec(
|
|
214
|
+
toolCall.input
|
|
215
|
+
);
|
|
216
|
+
if (!fencedJson?.[1]) return null;
|
|
217
|
+
|
|
218
|
+
return { ...toolCall, input: fencedJson[1] };
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
````
|
|
223
|
+
|
|
224
|
+
The AI SDK invokes `repairToolCall` only for `NoSuchToolError` or `InvalidToolInputError`. Return a complete raw tool call, usually by preserving the original call and replacing its `input` JSON string, or return `null` when the call cannot be repaired. The SDK parses and schema-validates a returned call once before `beforeToolCall` and tool execution. Because the callback is a function, configure it from a Think subclass; sandboxed extensions cannot send it over RPC.
|
|
225
|
+
|
|
202
226
|
Prune older tool calls from the model context with the AI SDK's [`pruneMessages`](https://ai-sdk.dev/):
|
|
203
227
|
|
|
204
228
|
```typescript
|
package/docs/tools.md
CHANGED
|
@@ -276,9 +276,9 @@ Setup checklist:
|
|
|
276
276
|
```
|
|
277
277
|
|
|
278
278
|
```typescript
|
|
279
|
-
//
|
|
280
|
-
// must be exported
|
|
281
|
-
// automatically;
|
|
279
|
+
// Worker entry — the runtime lives in a Durable Object facet, so the class
|
|
280
|
+
// must be exported. The @cloudflare/codemode/vite plugin can do this
|
|
281
|
+
// automatically; otherwise export it explicitly.
|
|
282
282
|
export { CodemodeRuntime } from "@cloudflare/codemode";
|
|
283
283
|
```
|
|
284
284
|
|