@cloudflare/think 0.9.1 → 0.11.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.
Files changed (361) hide show
  1. package/README.md +10 -17
  2. package/dist/{chat-sdk-Bb93yaZh.js → chat-sdk-D6cUghsQ.js} +33 -8
  3. package/dist/chat-sdk-D6cUghsQ.js.map +1 -0
  4. package/dist/cli/index.js +718 -55
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/{codegen-CuPdJRpV.js → codegen-DlA2QQuU.js} +6 -38
  7. package/dist/codegen-DlA2QQuU.js.map +1 -0
  8. package/dist/{config-D512sQYg.d.ts → config-CD7hqncK.d.ts} +5 -5
  9. package/dist/extensions/index.js +1 -1
  10. package/dist/framework/index.d.ts +17 -62
  11. package/dist/framework/index.js +3 -57
  12. package/dist/{think-CwxWGsX1.d.ts → index-D_S5mETO.d.ts} +1643 -688
  13. package/dist/{manager-BPndMP_6.js → manager-CSk5htym.js} +7 -7
  14. package/dist/{manager-BPndMP_6.js.map → manager-CSk5htym.js.map} +1 -1
  15. package/dist/{manifest-CpB-xngB.d.ts → manifest-DK5HuGga.d.ts} +16 -18
  16. package/dist/messengers/index.d.ts +59 -55
  17. package/dist/messengers/index.js +2 -2
  18. package/dist/messengers/telegram.d.ts +4 -4
  19. package/dist/messengers/telegram.js +1 -1
  20. package/dist/react.d.ts +79 -0
  21. package/dist/react.js +28 -0
  22. package/dist/react.js.map +1 -0
  23. package/dist/server-entry.d.ts +1 -1
  24. package/dist/server-entry.js +1 -1
  25. package/dist/server-entry.js.map +1 -1
  26. package/dist/studio/assets/abap-CLvhMVsD.js +1 -0
  27. package/dist/studio/assets/actionscript-3--17pq3dv.js +1 -0
  28. package/dist/studio/assets/ada-C5qYipkI.js +1 -0
  29. package/dist/studio/assets/andromeeda-vGVdxbeo.js +1 -0
  30. package/dist/studio/assets/angular-html-D27LthTc.js +1 -0
  31. package/dist/studio/assets/angular-ts-DtNL2gQ7.js +1 -0
  32. package/dist/studio/assets/apache-U0d_L8uA.js +1 -0
  33. package/dist/studio/assets/apex-CGTLDQj6.js +1 -0
  34. package/dist/studio/assets/apl-BgEcDqM0.js +1 -0
  35. package/dist/studio/assets/applescript-CCn79oCD.js +1 -0
  36. package/dist/studio/assets/ara-4CJ0cIlV.js +1 -0
  37. package/dist/studio/assets/asciidoc-DE70LPWp.js +1 -0
  38. package/dist/studio/assets/asm-Cmm7eHzH.js +1 -0
  39. package/dist/studio/assets/astro-CstbRF9e.js +1 -0
  40. package/dist/studio/assets/aurora-x-CDeNXAV0.js +1 -0
  41. package/dist/studio/assets/awk-BWXHIvNe.js +1 -0
  42. package/dist/studio/assets/ayu-dark-DluEY0Gj.js +1 -0
  43. package/dist/studio/assets/ayu-light-C3h-C4tm.js +1 -0
  44. package/dist/studio/assets/ayu-mirage-Bqwy1Gya.js +1 -0
  45. package/dist/studio/assets/ballerina-B7ZEbQpA.js +1 -0
  46. package/dist/studio/assets/bat-Bo4NYOV-.js +1 -0
  47. package/dist/studio/assets/beancount-D-usSTwE.js +1 -0
  48. package/dist/studio/assets/berry-DKpUyyne.js +1 -0
  49. package/dist/studio/assets/bibtex-Ci_nEsc7.js +1 -0
  50. package/dist/studio/assets/bicep-CUHmPFLl.js +1 -0
  51. package/dist/studio/assets/bird2-C2hNVINV.js +1 -0
  52. package/dist/studio/assets/blade-CLG-7epG.js +1 -0
  53. package/dist/studio/assets/bsl-BkkzgIyY.js +1 -0
  54. package/dist/studio/assets/c-CssQqwxO.js +1 -0
  55. package/dist/studio/assets/c3-CnJL0r0V.js +1 -0
  56. package/dist/studio/assets/cadence-CQ2zXKGN.js +1 -0
  57. package/dist/studio/assets/cairo-DLTphjLi.js +1 -0
  58. package/dist/studio/assets/catppuccin-frappe-3VR1Za6u.js +1 -0
  59. package/dist/studio/assets/catppuccin-latte-DwIHMF0Q.js +1 -0
  60. package/dist/studio/assets/catppuccin-macchiato-DYnBP6_5.js +1 -0
  61. package/dist/studio/assets/catppuccin-mocha-DYhrFGRu.js +1 -0
  62. package/dist/studio/assets/clarity-SemFz856.js +1 -0
  63. package/dist/studio/assets/clojure-DqKBuwfJ.js +1 -0
  64. package/dist/studio/assets/cmake-Bj61d0ZC.js +1 -0
  65. package/dist/studio/assets/cobol-CjmzHCjg.js +1 -0
  66. package/dist/studio/assets/codeowners-C8r90Shi.js +1 -0
  67. package/dist/studio/assets/codeql-oeQT6MSM.js +1 -0
  68. package/dist/studio/assets/coffee-B_rqYPkp.js +1 -0
  69. package/dist/studio/assets/common-lisp-Cv5bFMCO.js +1 -0
  70. package/dist/studio/assets/coq-BrsZFFmf.js +1 -0
  71. package/dist/studio/assets/cpp-5YyZJlb7.js +1 -0
  72. package/dist/studio/assets/crystal-D7uKze0i.js +1 -0
  73. package/dist/studio/assets/csharp-Ct8U2NOr.js +1 -0
  74. package/dist/studio/assets/css-k9oPgg7G.js +1 -0
  75. package/dist/studio/assets/csv-Dx-8-gkx.js +1 -0
  76. package/dist/studio/assets/cue-CE9AQfxI.js +1 -0
  77. package/dist/studio/assets/cypher-ClKdZ_lG.js +1 -0
  78. package/dist/studio/assets/d-qD-0Kul2.js +1 -0
  79. package/dist/studio/assets/dark-plus-Cs2F2srj.js +1 -0
  80. package/dist/studio/assets/dart-DkHntEIa.js +1 -0
  81. package/dist/studio/assets/dax-BkyTk9wS.js +1 -0
  82. package/dist/studio/assets/desktop-Dlh5hvp9.js +1 -0
  83. package/dist/studio/assets/diff-woXpYk--.js +1 -0
  84. package/dist/studio/assets/docker-IyjqRm3v.js +1 -0
  85. package/dist/studio/assets/dotenv-_5a1GRtc.js +1 -0
  86. package/dist/studio/assets/dracula-BHWKrbxM.js +1 -0
  87. package/dist/studio/assets/dracula-soft-5eyTD99u.js +1 -0
  88. package/dist/studio/assets/dream-maker-DW3nJb8Q.js +1 -0
  89. package/dist/studio/assets/edge-CGgsSt0x.js +1 -0
  90. package/dist/studio/assets/elixir-BX_d5Evo.js +1 -0
  91. package/dist/studio/assets/elm-DENxDm5e.js +1 -0
  92. package/dist/studio/assets/emacs-lisp-C9PiwqqW.js +1 -0
  93. package/dist/studio/assets/erb-DvYOup03.js +1 -0
  94. package/dist/studio/assets/erlang-Cphh6RMH.js +1 -0
  95. package/dist/studio/assets/everforest-dark-sB-x3p7T.js +1 -0
  96. package/dist/studio/assets/everforest-light-Df2xbC6M.js +1 -0
  97. package/dist/studio/assets/fennel-DQxkIbk2.js +1 -0
  98. package/dist/studio/assets/fish-BJitypiv.js +1 -0
  99. package/dist/studio/assets/fluent-C03EYrpw.js +1 -0
  100. package/dist/studio/assets/fortran-fixed-form-DEKoE2YW.js +1 -0
  101. package/dist/studio/assets/fortran-free-form-CYNrtFtB.js +1 -0
  102. package/dist/studio/assets/fsharp-D13ZGOAj.js +1 -0
  103. package/dist/studio/assets/gdresource-C0sCabJj.js +1 -0
  104. package/dist/studio/assets/gdscript-Cp2uCuqX.js +1 -0
  105. package/dist/studio/assets/gdshader-CBce3t8t.js +1 -0
  106. package/dist/studio/assets/genie-CV2tkWYe.js +1 -0
  107. package/dist/studio/assets/gherkin-DExj1W_8.js +1 -0
  108. package/dist/studio/assets/git-commit-BSykSTBG.js +1 -0
  109. package/dist/studio/assets/git-rebase-BsAdTS5A.js +1 -0
  110. package/dist/studio/assets/github-dark-C-LZuMrd.js +1 -0
  111. package/dist/studio/assets/github-dark-default-DXG-b-1a.js +1 -0
  112. package/dist/studio/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
  113. package/dist/studio/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
  114. package/dist/studio/assets/github-light-EUqPIrTm.js +1 -0
  115. package/dist/studio/assets/github-light-default-BXViO-2h.js +1 -0
  116. package/dist/studio/assets/github-light-high-contrast-B68TUdTA.js +1 -0
  117. package/dist/studio/assets/gleam-CSRkHgEL.js +1 -0
  118. package/dist/studio/assets/glimmer-js-e0h98Z67.js +1 -0
  119. package/dist/studio/assets/glimmer-ts-C9s5Kv8m.js +1 -0
  120. package/dist/studio/assets/glsl-CCiyeTRs.js +1 -0
  121. package/dist/studio/assets/gn-ilITqXS6.js +1 -0
  122. package/dist/studio/assets/gnuplot-7GGW24-e.js +1 -0
  123. package/dist/studio/assets/go-BJwz_mda.js +1 -0
  124. package/dist/studio/assets/graphql-BRtHwsqk.js +1 -0
  125. package/dist/studio/assets/groovy-CacY0gHj.js +1 -0
  126. package/dist/studio/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
  127. package/dist/studio/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
  128. package/dist/studio/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
  129. package/dist/studio/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
  130. package/dist/studio/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
  131. package/dist/studio/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
  132. package/dist/studio/assets/hack-Dnt0QXHh.js +1 -0
  133. package/dist/studio/assets/haml-EXGmzuB1.js +1 -0
  134. package/dist/studio/assets/handlebars-CzyBIDJE.js +1 -0
  135. package/dist/studio/assets/haskell-D8IpX4py.js +1 -0
  136. package/dist/studio/assets/haxe-OTjmBuCE.js +1 -0
  137. package/dist/studio/assets/hcl-Dh228itO.js +1 -0
  138. package/dist/studio/assets/highlighted-body-OFNGDK62-CQUFKLNu.js +1 -0
  139. package/dist/studio/assets/hjson-CxZEssPk.js +1 -0
  140. package/dist/studio/assets/hlsl-Cvrh5tZx.js +1 -0
  141. package/dist/studio/assets/horizon-CE9ld1lL.js +1 -0
  142. package/dist/studio/assets/horizon-bright-Br1oVSNq.js +1 -0
  143. package/dist/studio/assets/houston-CsvMBhTu.js +1 -0
  144. package/dist/studio/assets/html-BAT8b_VM.js +1 -0
  145. package/dist/studio/assets/html-derivative-7tkS-r6F.js +1 -0
  146. package/dist/studio/assets/http-Cgka02Qq.js +1 -0
  147. package/dist/studio/assets/hurl-Cbkh8WEw.js +1 -0
  148. package/dist/studio/assets/hxml-B0Qn7Nwc.js +1 -0
  149. package/dist/studio/assets/hy-CZbG8q4J.js +1 -0
  150. package/dist/studio/assets/imba-DsUTQ-LC.js +1 -0
  151. package/dist/studio/assets/index-D6n8vpkp.js +390 -0
  152. package/dist/studio/assets/index-DkGWw6ES.css +2 -0
  153. package/dist/studio/assets/ini-B5eOa1yu.js +1 -0
  154. package/dist/studio/assets/java-DrRKiUno.js +1 -0
  155. package/dist/studio/assets/javascript-9LAnHOxD.js +1 -0
  156. package/dist/studio/assets/jinja-CqRt4prs.js +1 -0
  157. package/dist/studio/assets/jison-BX-IOQpJ.js +1 -0
  158. package/dist/studio/assets/json-dOrE-En8.js +1 -0
  159. package/dist/studio/assets/json5-BR5RXkoi.js +1 -0
  160. package/dist/studio/assets/jsonc-CYpm1nAK.js +1 -0
  161. package/dist/studio/assets/jsonl-CmCQp5Yx.js +1 -0
  162. package/dist/studio/assets/jsonnet-CJTPZ8u_.js +1 -0
  163. package/dist/studio/assets/jssm-DXw9l8Rf.js +1 -0
  164. package/dist/studio/assets/jsx-BSTPfqWX.js +1 -0
  165. package/dist/studio/assets/julia-Dvz-BPmf.js +1 -0
  166. package/dist/studio/assets/just-BHQm0Atq.js +1 -0
  167. package/dist/studio/assets/kanagawa-dragon-CXtmUGW6.js +1 -0
  168. package/dist/studio/assets/kanagawa-lotus-BN08jTvb.js +1 -0
  169. package/dist/studio/assets/kanagawa-wave-CTweb8Dz.js +1 -0
  170. package/dist/studio/assets/kdl-CsD5j6eV.js +1 -0
  171. package/dist/studio/assets/kotlin-DhhofPvG.js +1 -0
  172. package/dist/studio/assets/kusto-BUv0MjJC.js +1 -0
  173. package/dist/studio/assets/laserwave-C_8bwKvT.js +1 -0
  174. package/dist/studio/assets/latex-CxdhxuXv.js +1 -0
  175. package/dist/studio/assets/lean-CewbzKMR.js +1 -0
  176. package/dist/studio/assets/less-DVTAwKKz.js +1 -0
  177. package/dist/studio/assets/light-plus-DVQuIRkW.js +1 -0
  178. package/dist/studio/assets/liquid-D-hM-Q_F.js +1 -0
  179. package/dist/studio/assets/llvm-Cm23YOpf.js +1 -0
  180. package/dist/studio/assets/log-BNLmms1o.js +1 -0
  181. package/dist/studio/assets/logo-Cluzi2Zq.js +1 -0
  182. package/dist/studio/assets/lua-5qtqjLHq.js +1 -0
  183. package/dist/studio/assets/luau-CNKltnaQ.js +1 -0
  184. package/dist/studio/assets/make-Dixweg8N.js +1 -0
  185. package/dist/studio/assets/markdown-BYOwaDjH.js +1 -0
  186. package/dist/studio/assets/marko-5FJaM2co.js +1 -0
  187. package/dist/studio/assets/material-theme-Bm3Qr25_.js +1 -0
  188. package/dist/studio/assets/material-theme-darker-2IIEA8gg.js +1 -0
  189. package/dist/studio/assets/material-theme-lighter-uhdI0v04.js +1 -0
  190. package/dist/studio/assets/material-theme-ocean-CHQ94UKr.js +1 -0
  191. package/dist/studio/assets/material-theme-palenight-B5W6OYN7.js +1 -0
  192. package/dist/studio/assets/matlab-D7qyCx1q.js +1 -0
  193. package/dist/studio/assets/mdc-BhYW7lCG.js +1 -0
  194. package/dist/studio/assets/mdx-DQZ5AkYe.js +1 -0
  195. package/dist/studio/assets/mermaid-Bk4SNUv9.js +1 -0
  196. package/dist/studio/assets/mermaid-GHXKKRXX-CWM2EB-u.js +1 -0
  197. package/dist/studio/assets/min-dark-BSWPekZh.js +1 -0
  198. package/dist/studio/assets/min-light-DDpmG2fV.js +1 -0
  199. package/dist/studio/assets/mipsasm-BMqwQI7S.js +1 -0
  200. package/dist/studio/assets/mojo-BgCJLMeH.js +1 -0
  201. package/dist/studio/assets/monokai-CdkpiU2Y.js +1 -0
  202. package/dist/studio/assets/moonbit-CaWjb8XO.js +1 -0
  203. package/dist/studio/assets/move-B1IS1UjX.js +1 -0
  204. package/dist/studio/assets/narrat-_X_XdTYD.js +1 -0
  205. package/dist/studio/assets/nextflow-Bbiyy34d.js +1 -0
  206. package/dist/studio/assets/nextflow-groovy-Dc_ddanL.js +1 -0
  207. package/dist/studio/assets/nginx-rtAXrRye.js +1 -0
  208. package/dist/studio/assets/night-owl-DhmEMT88.js +1 -0
  209. package/dist/studio/assets/night-owl-light-eJ-hLW7d.js +1 -0
  210. package/dist/studio/assets/nim-DQSmaN9U.js +1 -0
  211. package/dist/studio/assets/nix-IvuFDN5E.js +1 -0
  212. package/dist/studio/assets/nord-Cb4Vim4T.js +1 -0
  213. package/dist/studio/assets/nushell-DcLAeLz5.js +1 -0
  214. package/dist/studio/assets/objective-c-D1A_Heim.js +1 -0
  215. package/dist/studio/assets/objective-cpp-BsSzOQcm.js +1 -0
  216. package/dist/studio/assets/ocaml-O90oeIOV.js +1 -0
  217. package/dist/studio/assets/odin-B1RWQWA5.js +1 -0
  218. package/dist/studio/assets/one-dark-pro-CLwyXe_n.js +1 -0
  219. package/dist/studio/assets/one-light-D7Lr4KcI.js +1 -0
  220. package/dist/studio/assets/openscad-BUDT5pXO.js +1 -0
  221. package/dist/studio/assets/pascal-4ZHwLPI5.js +1 -0
  222. package/dist/studio/assets/perl-B54AdcaE.js +1 -0
  223. package/dist/studio/assets/php-DpvTxCny.js +1 -0
  224. package/dist/studio/assets/pkl-ot-7Btpt.js +1 -0
  225. package/dist/studio/assets/plastic-DQwYfKfQ.js +1 -0
  226. package/dist/studio/assets/plsql-DGHpHOYJ.js +1 -0
  227. package/dist/studio/assets/po-BiJDBrnU.js +1 -0
  228. package/dist/studio/assets/poimandres-DRFjx7u4.js +1 -0
  229. package/dist/studio/assets/polar-C7UOKdEL.js +1 -0
  230. package/dist/studio/assets/postcss-BXeXVLqQ.js +1 -0
  231. package/dist/studio/assets/powerquery-DNMTfnFr.js +1 -0
  232. package/dist/studio/assets/powershell-DshXNtvi.js +1 -0
  233. package/dist/studio/assets/prisma-BsRQq5mF.js +1 -0
  234. package/dist/studio/assets/prolog-iXnhIJG7.js +1 -0
  235. package/dist/studio/assets/proto-DB4EqR-F.js +1 -0
  236. package/dist/studio/assets/pug-Cyffw0Ho.js +1 -0
  237. package/dist/studio/assets/puppet-CDv2pdJW.js +1 -0
  238. package/dist/studio/assets/purescript-9MfHhQsQ.js +1 -0
  239. package/dist/studio/assets/python-gzcpVVnB.js +1 -0
  240. package/dist/studio/assets/qml-CxRetSkO.js +1 -0
  241. package/dist/studio/assets/qmldir-DCQb3MpD.js +1 -0
  242. package/dist/studio/assets/qss-Fe1Jh2GI.js +1 -0
  243. package/dist/studio/assets/r-CXWRxrXc.js +1 -0
  244. package/dist/studio/assets/racket-DcIDlBhZ.js +1 -0
  245. package/dist/studio/assets/raku-B3gFvitq.js +1 -0
  246. package/dist/studio/assets/razor-BJzI-zc9.js +1 -0
  247. package/dist/studio/assets/red-CJ3rzSJv.js +1 -0
  248. package/dist/studio/assets/reg-CRGYupPL.js +1 -0
  249. package/dist/studio/assets/regexp-dqxdfrnE.js +1 -0
  250. package/dist/studio/assets/rel-BtDbiS_P.js +1 -0
  251. package/dist/studio/assets/riscv-Ckw8ddFX.js +1 -0
  252. package/dist/studio/assets/ron-VUp2lXgN.js +1 -0
  253. package/dist/studio/assets/rose-pine-BthvhNj6.js +1 -0
  254. package/dist/studio/assets/rose-pine-dawn-Dg85fqjY.js +1 -0
  255. package/dist/studio/assets/rose-pine-moon-hon4tzzS.js +1 -0
  256. package/dist/studio/assets/rosmsg-CAekHB0j.js +1 -0
  257. package/dist/studio/assets/rst-BW7eKYj4.js +1 -0
  258. package/dist/studio/assets/ruby-D5Npyj8-.js +1 -0
  259. package/dist/studio/assets/rust-Cfkwpbl8.js +1 -0
  260. package/dist/studio/assets/sas-DZLppjul.js +1 -0
  261. package/dist/studio/assets/sass-DXrisJhu.js +1 -0
  262. package/dist/studio/assets/scala-DKOlJaKm.js +1 -0
  263. package/dist/studio/assets/scheme-DQCgrYNe.js +1 -0
  264. package/dist/studio/assets/scss-CbqoxyAe.js +1 -0
  265. package/dist/studio/assets/sdbl-bTVj8UrX.js +1 -0
  266. package/dist/studio/assets/shaderlab-TOUzSsQk.js +1 -0
  267. package/dist/studio/assets/shellscript-CFHqBeXu.js +1 -0
  268. package/dist/studio/assets/shellsession-CbZDA4Bf.js +1 -0
  269. package/dist/studio/assets/slack-dark-DnToyrRv.js +1 -0
  270. package/dist/studio/assets/slack-ochin-B2OO5cIa.js +1 -0
  271. package/dist/studio/assets/smalltalk-B16xEiuN.js +1 -0
  272. package/dist/studio/assets/snazzy-light-4G7pJPwS.js +1 -0
  273. package/dist/studio/assets/solarized-dark-DV17i1UV.js +1 -0
  274. package/dist/studio/assets/solarized-light-DSh2HLQt.js +1 -0
  275. package/dist/studio/assets/solidity-CKzVLygQ.js +1 -0
  276. package/dist/studio/assets/soy-PImjtV58.js +1 -0
  277. package/dist/studio/assets/sparql-D_iOobhT.js +1 -0
  278. package/dist/studio/assets/splunk-BC2Px7Mm.js +1 -0
  279. package/dist/studio/assets/sql-DhGo8urW.js +1 -0
  280. package/dist/studio/assets/ssh-config-BgfXC-Er.js +1 -0
  281. package/dist/studio/assets/stata-CjHWbU2v.js +1 -0
  282. package/dist/studio/assets/stylus-B6D30XZt.js +1 -0
  283. package/dist/studio/assets/surrealql-o8Qr4t56.js +1 -0
  284. package/dist/studio/assets/svelte-DlSIyEV1.js +1 -0
  285. package/dist/studio/assets/swift-DonLKvLd.js +1 -0
  286. package/dist/studio/assets/synthwave-84-nFMaYfgc.js +1 -0
  287. package/dist/studio/assets/system-verilog-DJ5XKQeo.js +1 -0
  288. package/dist/studio/assets/systemd-BxMlprV5.js +1 -0
  289. package/dist/studio/assets/talonscript-CohzipZa.js +1 -0
  290. package/dist/studio/assets/tasl-DMoTqEGO.js +1 -0
  291. package/dist/studio/assets/tcl-CZd0xW_V.js +1 -0
  292. package/dist/studio/assets/templ-qizfwU1w.js +1 -0
  293. package/dist/studio/assets/terraform-DswuEJGm.js +1 -0
  294. package/dist/studio/assets/tex-Ca7T661H.js +1 -0
  295. package/dist/studio/assets/tokyo-night-oM2G3aXe.js +1 -0
  296. package/dist/studio/assets/toml-CcmNWLt0.js +1 -0
  297. package/dist/studio/assets/ts-tags-DUmjLkgl.js +1 -0
  298. package/dist/studio/assets/tsv-sltzmVWM.js +1 -0
  299. package/dist/studio/assets/tsx-CfwgIqHW.js +1 -0
  300. package/dist/studio/assets/turtle-ByJddavk.js +1 -0
  301. package/dist/studio/assets/twig-D7NAYUBY.js +1 -0
  302. package/dist/studio/assets/typescript-Bbz9oX-P.js +1 -0
  303. package/dist/studio/assets/typespec-B88KGewJ.js +1 -0
  304. package/dist/studio/assets/typst-DI99ib-x.js +1 -0
  305. package/dist/studio/assets/v-DETTlOr0.js +1 -0
  306. package/dist/studio/assets/vala-zf12oZj6.js +1 -0
  307. package/dist/studio/assets/vb-Djn5o6TS.js +1 -0
  308. package/dist/studio/assets/verilog-CiiDBU1e.js +1 -0
  309. package/dist/studio/assets/vesper-D5bVUKB1.js +1 -0
  310. package/dist/studio/assets/vhdl-BroJfC0k.js +1 -0
  311. package/dist/studio/assets/viml-DvXPmvsu.js +1 -0
  312. package/dist/studio/assets/vitesse-black-fwtXNY1n.js +1 -0
  313. package/dist/studio/assets/vitesse-dark-BZCL-v6S.js +1 -0
  314. package/dist/studio/assets/vitesse-light-VbXTXTou.js +1 -0
  315. package/dist/studio/assets/vue-html-CcxTb_Jn.js +1 -0
  316. package/dist/studio/assets/vue-vYpz06zQ.js +1 -0
  317. package/dist/studio/assets/vue-vine-DW4RqCKF.js +1 -0
  318. package/dist/studio/assets/vyper-CgoNMtux.js +1 -0
  319. package/dist/studio/assets/wasm-BnjxR4X6.js +1 -0
  320. package/dist/studio/assets/wasm-ByWQv1Qj.js +1 -0
  321. package/dist/studio/assets/wenyan-C8pVoKbM.js +1 -0
  322. package/dist/studio/assets/wgsl-BsKzXJz4.js +1 -0
  323. package/dist/studio/assets/wikitext-ClFFjSW2.js +1 -0
  324. package/dist/studio/assets/wit-DdvCle-K.js +1 -0
  325. package/dist/studio/assets/wolfram-DLL8P-h_.js +1 -0
  326. package/dist/studio/assets/xml-R4LZ_u4f.js +1 -0
  327. package/dist/studio/assets/xsl-CS-xzp3L.js +1 -0
  328. package/dist/studio/assets/yaml-CqDWbYXd.js +1 -0
  329. package/dist/studio/assets/zenscript-BnlCZFoB.js +1 -0
  330. package/dist/studio/assets/zig-CMLA9XwU.js +1 -0
  331. package/dist/studio/index.html +23 -0
  332. package/dist/think.d.ts +2 -2
  333. package/dist/think.js +8292 -2
  334. package/dist/think.js.map +1 -0
  335. package/dist/tools/extensions.js +1 -1
  336. package/dist/tools/workspace.js +2 -2
  337. package/dist/tools/workspace.js.map +1 -1
  338. package/dist/{types-codegen-B6c5KpYH.js → types-codegen-C-9yeFao.js} +9 -33
  339. package/dist/types-codegen-C-9yeFao.js.map +1 -0
  340. package/dist/vite.d.ts +12 -5
  341. package/dist/vite.js +73 -1
  342. package/dist/vite.js.map +1 -1
  343. package/dist/workflows.d.ts +1 -1
  344. package/docs/actions.md +297 -0
  345. package/docs/channels.md +185 -0
  346. package/docs/client-tools.md +233 -0
  347. package/docs/getting-started.md +314 -0
  348. package/docs/index.md +1272 -0
  349. package/docs/lifecycle-hooks.md +839 -0
  350. package/docs/messengers.md +197 -0
  351. package/docs/programmatic-submissions.md +206 -0
  352. package/docs/sub-agents.md +520 -0
  353. package/docs/tools.md +582 -0
  354. package/docs/workflows.md +217 -0
  355. package/package.json +57 -10
  356. package/dist/chat-sdk-Bb93yaZh.js.map +0 -1
  357. package/dist/codegen-CuPdJRpV.js.map +0 -1
  358. package/dist/framework/index.js.map +0 -1
  359. package/dist/think-2nHHEcY3.js +0 -6446
  360. package/dist/think-2nHHEcY3.js.map +0 -1
  361. package/dist/types-codegen-B6c5KpYH.js.map +0 -1
@@ -0,0 +1,233 @@
1
+ # Client Tools
2
+
3
+ Think supports tools that execute in the browser. The client sends tool schemas in the chat request body, Think merges them with server tools, and when the LLM calls a client tool, the call is routed to the client for execution.
4
+
5
+ ## How Client Tools Work
6
+
7
+ 1. The client sends tool schemas as part of the chat request body
8
+ 2. Think merges client tools with server-side tools (workspace, `getTools()`, session, MCP)
9
+ 3. The LLM calls a client tool — the tool call chunk is sent to the client over WebSocket
10
+ 4. The client executes the tool and sends back a `CF_AGENT_TOOL_RESULT` message
11
+ 5. Think persists the result, broadcasts `CF_AGENT_MESSAGE_UPDATED`, and optionally auto-continues
12
+
13
+ Client tools are tools without an `execute` function on the server — they only have a schema. When the LLM produces a tool call for one of these, Think sends the call to the client instead of executing it server-side.
14
+
15
+ ## Defining Client Tools
16
+
17
+ On the client, pass `clientTools` to `useAgentChat`:
18
+
19
+ ```tsx
20
+ import { useAgent } from "agents/react";
21
+ import { useAgentChat } from "@cloudflare/think/react";
22
+
23
+ function Chat() {
24
+ const agent = useAgent({ agent: "MyAgent" });
25
+ const { messages, sendMessage } = useAgentChat({
26
+ agent,
27
+ clientTools: {
28
+ getUserTimezone: {
29
+ description: "Get the user's timezone from their browser",
30
+ parameters: {},
31
+ execute: async () => {
32
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
33
+ }
34
+ },
35
+ getClipboard: {
36
+ description: "Read text from the user's clipboard",
37
+ parameters: {},
38
+ execute: async () => {
39
+ return navigator.clipboard.readText();
40
+ }
41
+ }
42
+ }
43
+ });
44
+
45
+ // ... render chat UI
46
+ }
47
+ ```
48
+
49
+ The `parameters` field is a JSON Schema object describing the tool's input. The `execute` function runs in the browser.
50
+
51
+ ## Client Tools over the Sub-Agent RPC `chat()` Path
52
+
53
+ When a parent agent delegates to a Think sub-agent over RPC with `chat()` (rather than the browser WebSocket), there is no WebSocket to carry `clientTools` or to send tool results back. Pass them through `ChatOptions` instead:
54
+
55
+ ```typescript
56
+ await child.chat(message, callback, {
57
+ signal,
58
+ clientTools: [
59
+ {
60
+ name: "get_user_timezone",
61
+ description: "Get the caller's timezone",
62
+ parameters: { type: "object" }
63
+ }
64
+ ],
65
+ onClientToolCall: async ({ toolName, input }) => {
66
+ // Run the client tool wherever the parent can — return its output.
67
+ return runClientTool(toolName, input);
68
+ }
69
+ });
70
+ ```
71
+
72
+ - `clientTools` registers the tool schemas for the turn, exactly like the WebSocket `clientTools` field.
73
+ - `onClientToolCall` executes a client-tool call and returns its output. The model can call a client tool, receive the result, and continue — all within the single `chat()` call.
74
+
75
+ If you omit `onClientToolCall`, the tools are registered but have no result: the model's call is surfaced through the stream callback and the turn ends with a dangling tool call (the RPC stream callback has no inbound result channel of its own). Supply `onClientToolCall` whenever you want the round trip to complete.
76
+
77
+ ### Behavior notes
78
+
79
+ - **Recovery:** neither the schemas nor the `onClientToolCall` executor are persisted — they are per-turn only. The executor is a live RPC reference that dies with the isolate, and (unlike the WebSocket path) there is no SPA to replay a `tool-result` after an eviction. So if an eviction interrupts the turn while a client-tool call is mid-flight, chat recovery treats the orphaned call like a server tool: `continueLastTurn`'s transcript repair errors it and the model proceeds. (Persisting the schemas would instead make recovery mistake the orphan for a pending human interaction and park forever.) To re-run cleanly, the parent re-invokes `chat()` with the `clientTools` and `onClientToolCall` again.
80
+ - **Errors:** if `onClientToolCall` throws, the failure is surfaced to the model as a tool error (`output-error`) and the turn continues — it does not crash the turn.
81
+ - **Serialization:** the value returned from `onClientToolCall` becomes the tool output, so it must be JSON-serializable (it travels back over RPC and into the model context).
82
+ - **No approval gate:** RPC client tools execute immediately through `onClientToolCall`. The WebSocket approval flow (`needsApproval`) does not apply on this path — gate execution inside your executor if you need it.
83
+ - **Name precedence:** client tools are merged after server tools, so a client tool that shares a name with a server tool (for example a workspace tool) overrides it for that turn — the same as the WebSocket path.
84
+ - **Abort:** aborting the turn via `signal` stops the loop, but an in-flight `onClientToolCall` is not itself cancelled; the turn ends after the current call resolves.
85
+
86
+ ## Tool Approval
87
+
88
+ Tools can require user approval before execution. This works for both server-side and client-side tools.
89
+
90
+ ### Server-side approval
91
+
92
+ Use `needsApproval` in the tool definition:
93
+
94
+ ```typescript
95
+ getTools(): ToolSet {
96
+ return {
97
+ calculate: tool({
98
+ description: "Perform a calculation",
99
+ inputSchema: z.object({
100
+ a: z.number(),
101
+ b: z.number(),
102
+ operator: z.enum(["+", "-", "*", "/"])
103
+ }),
104
+ needsApproval: async ({ a, b }) =>
105
+ Math.abs(a) > 1000 || Math.abs(b) > 1000,
106
+ execute: async ({ a, b, operator }) => {
107
+ const ops: Record<string, (x: number, y: number) => number> = {
108
+ "+": (x, y) => x + y, "-": (x, y) => x - y,
109
+ "*": (x, y) => x * y, "/": (x, y) => x / y
110
+ };
111
+ return { result: ops[operator](a, b) };
112
+ }
113
+ })
114
+ };
115
+ }
116
+ ```
117
+
118
+ When `needsApproval` returns `true`:
119
+
120
+ 1. Think sends the tool call to the client with a pending approval state
121
+ 2. The conversation pauses
122
+ 3. The client shows an approval UI and sends `CF_AGENT_TOOL_APPROVAL` (approve or deny)
123
+ 4. If approved, the tool executes and the conversation continues
124
+ 5. If denied, the denial reason is returned to the model as the tool result
125
+
126
+ ### Handling approvals on the client
127
+
128
+ `useAgentChat` provides approval helpers:
129
+
130
+ ```tsx
131
+ const { messages, sendMessage, addToolResult } = useAgentChat({
132
+ agent,
133
+ onToolCall: ({ toolCall }) => {
134
+ // Auto-approve safe tools
135
+ if (toolCall.toolName === "read") {
136
+ return { approve: true };
137
+ }
138
+ // Others go through the UI approval flow
139
+ }
140
+ });
141
+ ```
142
+
143
+ See [Client Tools Continuation](https://github.com/cloudflare/agents/blob/main/docs/agents/client-tools-continuation.md) for the full protocol reference.
144
+
145
+ ## Auto-Continuation
146
+
147
+ After a client tool result is received, Think can automatically continue the conversation without a new user message. This is the default behavior — when all pending tool results are received, Think starts a new model turn with the tool results in context.
148
+
149
+ The continuation turn has `continuation: true` in the `TurnContext`, which you can use in `beforeTurn` to adjust model or tool selection:
150
+
151
+ ```typescript
152
+ beforeTurn(ctx: TurnContext) {
153
+ if (ctx.continuation) {
154
+ return { model: this.cheapModel };
155
+ }
156
+ }
157
+ ```
158
+
159
+ ## Message Concurrency
160
+
161
+ The `messageConcurrency` property controls how overlapping user submits behave when a chat turn is already active.
162
+
163
+ ```typescript
164
+ import { Think } from "@cloudflare/think";
165
+ import type { MessageConcurrency } from "@cloudflare/think";
166
+
167
+ export class MyAgent extends Think<Env> {
168
+ override messageConcurrency: MessageConcurrency = "queue"; // default
169
+
170
+ getModel() {
171
+ /* ... */
172
+ }
173
+ }
174
+ ```
175
+
176
+ ### Strategies
177
+
178
+ | Strategy | Behavior |
179
+ | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
180
+ | `"queue"` | Queue every submit and process them in order. Default. |
181
+ | `"latest"` | Keep only the latest overlapping submit. Superseded submits still persist their user messages but do not start their own model turn. |
182
+ | `"merge"` | Like `"latest"`, but all overlapping user messages remain in the conversation history. The model sees them all in one turn. |
183
+ | `"drop"` | Ignore overlapping submits entirely. Messages are not persisted. |
184
+ | `{ strategy: "debounce", debounceMs?: number }` | Trailing-edge latest with a quiet window (default 750ms). |
185
+
186
+ Concurrency strategies only apply to `submit-message` requests. Regenerations, tool continuations, approvals, clears, `saveMessages`, durable `submitMessages` submissions, and `continueLastTurn` keep their serialized behavior.
187
+
188
+ ### Examples
189
+
190
+ For a search-as-you-type UI where each keystroke sends a new query:
191
+
192
+ ```typescript
193
+ export class SearchAgent extends Think<Env> {
194
+ override messageConcurrency: MessageConcurrency = "latest";
195
+ getModel() {
196
+ /* ... */
197
+ }
198
+ }
199
+ ```
200
+
201
+ For a collaborative editor where multiple users type simultaneously:
202
+
203
+ ```typescript
204
+ export class CollabAgent extends Think<Env> {
205
+ override messageConcurrency: MessageConcurrency = "merge";
206
+ getModel() {
207
+ /* ... */
208
+ }
209
+ }
210
+ ```
211
+
212
+ For a debounced input where the model only responds after the user stops typing:
213
+
214
+ ```typescript
215
+ export class DebouncedAgent extends Think<Env> {
216
+ override messageConcurrency: MessageConcurrency = {
217
+ strategy: "debounce",
218
+ debounceMs: 1000
219
+ };
220
+ getModel() {
221
+ /* ... */
222
+ }
223
+ }
224
+ ```
225
+
226
+ ## Multi-Tab Broadcast
227
+
228
+ Think broadcasts streaming responses to all connected WebSocket clients. When multiple browser tabs are connected to the same agent:
229
+
230
+ - All tabs see the streamed response in real time
231
+ - Tool call states (pending, result, approval) are broadcast to all tabs
232
+ - The tab that resumes a stream is excluded from the broadcast to avoid duplicates
233
+ - `CF_AGENT_MESSAGE_UPDATED` events are sent to all tabs after tool results and message persistence
@@ -0,0 +1,314 @@
1
+ # Getting Started with Think
2
+
3
+ Build a chat agent with persistent memory, built-in file tools, and streaming — step by step.
4
+
5
+ By the end of this tutorial you will have a Think agent that:
6
+
7
+ - Streams responses to a React chat UI
8
+ - Has persistent memory the model can read and write
9
+ - Includes workspace file tools (read, write, edit, find, grep, delete)
10
+ - Supports custom server-side tools
11
+
12
+ ## Prerequisites
13
+
14
+ - Node.js 24+
15
+ - A Cloudflare account with Workers AI access
16
+ - Familiarity with TypeScript and Cloudflare Workers
17
+
18
+ ## 1. Create a project
19
+
20
+ ```sh
21
+ mkdir my-think-agent && cd my-think-agent
22
+ npm init -y
23
+ ```
24
+
25
+ Install dependencies:
26
+
27
+ ```sh
28
+ npm install @cloudflare/think agents ai @cloudflare/shell zod workers-ai-provider react react-dom
29
+ npm install -D wrangler @cloudflare/vite-plugin @cloudflare/workers-types @vitejs/plugin-react @tailwindcss/vite tailwindcss typescript vite
30
+ ```
31
+
32
+ ## 2. Configure wrangler
33
+
34
+ Create `wrangler.jsonc`:
35
+
36
+ ```jsonc
37
+ {
38
+ "name": "my-think-agent",
39
+ "compatibility_date": "2026-01-28",
40
+ "compatibility_flags": ["nodejs_compat"],
41
+ "ai": { "binding": "AI" },
42
+ "assets": {
43
+ "not_found_handling": "single-page-application",
44
+ "run_worker_first": ["/agents/*"]
45
+ },
46
+ "durable_objects": {
47
+ "bindings": [{ "class_name": "MyAgent", "name": "MyAgent" }]
48
+ },
49
+ "migrations": [{ "new_sqlite_classes": ["MyAgent"], "tag": "v1" }],
50
+ "main": "src/server.ts"
51
+ }
52
+ ```
53
+
54
+ Create `vite.config.ts`:
55
+
56
+ ```typescript
57
+ import { cloudflare } from "@cloudflare/vite-plugin";
58
+ import tailwindcss from "@tailwindcss/vite";
59
+ import react from "@vitejs/plugin-react";
60
+ import { defineConfig } from "vite";
61
+
62
+ export default defineConfig({
63
+ plugins: [react(), cloudflare(), tailwindcss()]
64
+ });
65
+ ```
66
+
67
+ Create `tsconfig.json`:
68
+
69
+ ```json
70
+ {
71
+ "extends": "agents/tsconfig"
72
+ }
73
+ ```
74
+
75
+ ## 3. Define the agent
76
+
77
+ Create `src/server.ts`:
78
+
79
+ ```typescript
80
+ import { Think } from "@cloudflare/think";
81
+ import { createWorkersAI } from "workers-ai-provider";
82
+ import { routeAgentRequest } from "agents";
83
+
84
+ export class MyAgent extends Think<Env> {
85
+ getModel() {
86
+ return createWorkersAI({ binding: this.env.AI })(
87
+ "@cf/moonshotai/kimi-k2.7-code"
88
+ );
89
+ }
90
+
91
+ getSystemPrompt() {
92
+ return "You are a helpful assistant with access to a workspace filesystem.";
93
+ }
94
+ }
95
+
96
+ export default {
97
+ async fetch(request: Request, env: Env) {
98
+ return (
99
+ (await routeAgentRequest(request, env)) ||
100
+ new Response("Not found", { status: 404 })
101
+ );
102
+ }
103
+ } satisfies ExportedHandler<Env>;
104
+ ```
105
+
106
+ This is a working agent. Think automatically provides:
107
+
108
+ - WebSocket chat protocol (compatible with `useAgentChat`)
109
+ - Message persistence in SQLite
110
+ - Resumable streaming (page refresh replays buffered chunks)
111
+ - Workspace file tools (read, write, edit, list, find, grep, delete)
112
+ - Abort/cancel support
113
+ - Error handling with partial message persistence
114
+
115
+ ## 4. Connect a React client
116
+
117
+ Create `src/client.tsx`:
118
+
119
+ ```tsx
120
+ import { createRoot } from "react-dom/client";
121
+ import { useAgent } from "agents/react";
122
+ import { useAgentChat } from "@cloudflare/think/react";
123
+
124
+ function Chat() {
125
+ const agent = useAgent({ agent: "MyAgent" });
126
+ const { messages, sendMessage, status } = useAgentChat({ agent });
127
+
128
+ return (
129
+ <div style={{ maxWidth: 600, margin: "0 auto", padding: 20 }}>
130
+ <h1>Think Agent</h1>
131
+
132
+ <div>
133
+ {messages.map((msg) => (
134
+ <div key={msg.id} style={{ margin: "12px 0" }}>
135
+ <strong>{msg.role}:</strong>{" "}
136
+ {msg.parts.map((part, i) =>
137
+ part.type === "text" ? <span key={i}>{part.text}</span> : null
138
+ )}
139
+ </div>
140
+ ))}
141
+ </div>
142
+
143
+ <form
144
+ onSubmit={(e) => {
145
+ e.preventDefault();
146
+ const input = e.currentTarget.elements.namedItem(
147
+ "input"
148
+ ) as HTMLInputElement;
149
+ if (!input.value.trim()) return;
150
+ sendMessage({ text: input.value });
151
+ input.value = "";
152
+ }}
153
+ >
154
+ <input
155
+ name="input"
156
+ placeholder="Send a message..."
157
+ style={{ width: "80%", padding: 8 }}
158
+ />
159
+ <button type="submit" style={{ padding: 8 }}>
160
+ Send
161
+ </button>
162
+ </form>
163
+
164
+ <p style={{ fontSize: 12, color: "#666" }}>Status: {status}</p>
165
+ </div>
166
+ );
167
+ }
168
+
169
+ createRoot(document.getElementById("root")!).render(<Chat />);
170
+ ```
171
+
172
+ Create `index.html`:
173
+
174
+ ```html
175
+ <!doctype html>
176
+ <html lang="en">
177
+ <head>
178
+ <meta charset="UTF-8" />
179
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
180
+ <title>Think Agent</title>
181
+ </head>
182
+ <body>
183
+ <div id="root"></div>
184
+ <script type="module" src="/src/client.tsx"></script>
185
+ </body>
186
+ </html>
187
+ ```
188
+
189
+ ## 5. Run it
190
+
191
+ ```sh
192
+ npx vite dev
193
+ ```
194
+
195
+ Open the browser and send a message. The agent responds with streaming text, and workspace file tools are available to the model automatically.
196
+
197
+ > **`setMessages` is display-only on Think.** Think is server-authoritative — its transcript is a projection of the Session tree, not a flat array the client owns. `useAgentChat` from `@cloudflare/think/react` therefore keeps `setMessages` local to the React view: edits update what's on screen but are **not** persisted and won't survive a refresh or reconnect (the server re-projects the authoritative history). To persist a clear, call `clearHistory()`. If you push a full transcript to Think anyway (for example, by using `@cloudflare/ai-chat/react` against a Think server), the server ignores it and logs a one-time dev warning.
198
+
199
+ ## 6. Add persistent memory
200
+
201
+ Override `configureSession` to give the model writable memory that survives restarts:
202
+
203
+ ```typescript
204
+ export class MyAgent extends Think<Env> {
205
+ getModel(): LanguageModel {
206
+ return createWorkersAI({ binding: this.env.AI })(
207
+ "@cf/moonshotai/kimi-k2.7-code"
208
+ );
209
+ }
210
+
211
+ configureSession(session: Session) {
212
+ return session
213
+ .withContext("soul", {
214
+ provider: {
215
+ get: async () =>
216
+ "You are a helpful assistant. Remember important facts about the user."
217
+ }
218
+ })
219
+ .withContext("memory", {
220
+ description: "Important facts about the user and conversation.",
221
+ maxTokens: 2000
222
+ })
223
+ .withCachedPrompt();
224
+ }
225
+ }
226
+ ```
227
+
228
+ Now the model sees a `MEMORY` section in its system prompt and gets a `set_context` tool to update it. Facts written to memory persist in SQLite and survive DO hibernation and restarts.
229
+
230
+ When you use `configureSession`, the system prompt is built from context blocks rather than `getSystemPrompt()`. The `"soul"` block above acts as the system identity — it is read-only and always appears first. The `"memory"` block is writable, and the model proactively updates it when it learns something useful.
231
+
232
+ See the [Sessions documentation](https://github.com/cloudflare/agents/blob/main/docs/agents/sessions.md) for context blocks, compaction, search, skills, and multi-session support.
233
+
234
+ ## 7. Add custom tools
235
+
236
+ Override `getTools()` to add your own tools alongside the built-in workspace tools:
237
+
238
+ ```typescript
239
+ import { tool } from "ai";
240
+ import { z } from "zod";
241
+
242
+ export class MyAgent extends Think<Env> {
243
+ getModel(): LanguageModel {
244
+ /* ... */
245
+ }
246
+ configureSession(session: Session) {
247
+ /* ... */
248
+ }
249
+
250
+ getTools(): ToolSet {
251
+ return {
252
+ getWeather: tool({
253
+ description: "Get the current weather for a city",
254
+ inputSchema: z.object({
255
+ city: z.string().describe("City name")
256
+ }),
257
+ execute: async ({ city }) => {
258
+ const res = await fetch(
259
+ `https://api.weatherapi.com/v1/current.json?key=${this.env.WEATHER_KEY}&q=${city}`
260
+ );
261
+ return res.json();
262
+ }
263
+ })
264
+ };
265
+ }
266
+ }
267
+ ```
268
+
269
+ Think merges tools from multiple sources automatically. On every turn, the model has access to:
270
+
271
+ 1. **Workspace tools** — read, write, edit, list, find, grep, delete (built-in)
272
+ 2. **Session tools** — set_context, load_context, search_context (from `configureSession`)
273
+ 3. **Your tools** — from `getTools()`
274
+ 4. **Skill tools** — activate_skill, read_skill_resource, and optional run_skill_script (from `getSkills()`)
275
+ 5. **MCP tools** — from connected MCP servers (if any)
276
+ 6. **Client tools** — from the browser (if any)
277
+
278
+ ## 8. Add lifecycle hooks
279
+
280
+ Think provides hooks that fire on every turn, regardless of entry path:
281
+
282
+ ```typescript
283
+ import type {
284
+ TurnContext,
285
+ TurnConfig,
286
+ ChatResponseResult
287
+ } from "@cloudflare/think";
288
+
289
+ export class MyAgent extends Think<Env> {
290
+ getModel(): LanguageModel {
291
+ /* ... */
292
+ }
293
+
294
+ beforeTurn(ctx: TurnContext): TurnConfig | void {
295
+ console.log(
296
+ `Turn starting: ${Object.keys(ctx.tools).length} tools available`
297
+ );
298
+ }
299
+
300
+ onChatResponse(result: ChatResponseResult) {
301
+ console.log(`Turn ${result.status}: ${result.message.parts.length} parts`);
302
+ }
303
+ }
304
+ ```
305
+
306
+ See [Lifecycle Hooks](./lifecycle-hooks.md) for the full reference.
307
+
308
+ ## Next Steps
309
+
310
+ - [Lifecycle Hooks](./lifecycle-hooks.md) — control model behavior, switch models per-turn, restrict tools
311
+ - [Tools](./tools.md) — workspace tools, code execution, extensions
312
+ - [Client Tools](./client-tools.md) — browser-side tools, approval flows, concurrency
313
+ - [Sub-agents and Programmatic Turns](./sub-agents.md) — RPC streaming, scheduled turns, recovery
314
+ - [Sessions](https://github.com/cloudflare/agents/blob/main/docs/agents/sessions.md) — context blocks, compaction, search, multi-session