@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.
- package/README.md +10 -17
- package/dist/{chat-sdk-Bb93yaZh.js → chat-sdk-D6cUghsQ.js} +33 -8
- package/dist/chat-sdk-D6cUghsQ.js.map +1 -0
- package/dist/cli/index.js +718 -55
- package/dist/cli/index.js.map +1 -1
- package/dist/{codegen-CuPdJRpV.js → codegen-DlA2QQuU.js} +6 -38
- package/dist/codegen-DlA2QQuU.js.map +1 -0
- package/dist/{config-D512sQYg.d.ts → config-CD7hqncK.d.ts} +5 -5
- package/dist/extensions/index.js +1 -1
- package/dist/framework/index.d.ts +17 -62
- package/dist/framework/index.js +3 -57
- package/dist/{think-CwxWGsX1.d.ts → index-D_S5mETO.d.ts} +1643 -688
- package/dist/{manager-BPndMP_6.js → manager-CSk5htym.js} +7 -7
- package/dist/{manager-BPndMP_6.js.map → manager-CSk5htym.js.map} +1 -1
- package/dist/{manifest-CpB-xngB.d.ts → manifest-DK5HuGga.d.ts} +16 -18
- package/dist/messengers/index.d.ts +59 -55
- package/dist/messengers/index.js +2 -2
- package/dist/messengers/telegram.d.ts +4 -4
- package/dist/messengers/telegram.js +1 -1
- package/dist/react.d.ts +79 -0
- package/dist/react.js +28 -0
- package/dist/react.js.map +1 -0
- package/dist/server-entry.d.ts +1 -1
- package/dist/server-entry.js +1 -1
- package/dist/server-entry.js.map +1 -1
- package/dist/studio/assets/abap-CLvhMVsD.js +1 -0
- package/dist/studio/assets/actionscript-3--17pq3dv.js +1 -0
- package/dist/studio/assets/ada-C5qYipkI.js +1 -0
- package/dist/studio/assets/andromeeda-vGVdxbeo.js +1 -0
- package/dist/studio/assets/angular-html-D27LthTc.js +1 -0
- package/dist/studio/assets/angular-ts-DtNL2gQ7.js +1 -0
- package/dist/studio/assets/apache-U0d_L8uA.js +1 -0
- package/dist/studio/assets/apex-CGTLDQj6.js +1 -0
- package/dist/studio/assets/apl-BgEcDqM0.js +1 -0
- package/dist/studio/assets/applescript-CCn79oCD.js +1 -0
- package/dist/studio/assets/ara-4CJ0cIlV.js +1 -0
- package/dist/studio/assets/asciidoc-DE70LPWp.js +1 -0
- package/dist/studio/assets/asm-Cmm7eHzH.js +1 -0
- package/dist/studio/assets/astro-CstbRF9e.js +1 -0
- package/dist/studio/assets/aurora-x-CDeNXAV0.js +1 -0
- package/dist/studio/assets/awk-BWXHIvNe.js +1 -0
- package/dist/studio/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/dist/studio/assets/ayu-light-C3h-C4tm.js +1 -0
- package/dist/studio/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/dist/studio/assets/ballerina-B7ZEbQpA.js +1 -0
- package/dist/studio/assets/bat-Bo4NYOV-.js +1 -0
- package/dist/studio/assets/beancount-D-usSTwE.js +1 -0
- package/dist/studio/assets/berry-DKpUyyne.js +1 -0
- package/dist/studio/assets/bibtex-Ci_nEsc7.js +1 -0
- package/dist/studio/assets/bicep-CUHmPFLl.js +1 -0
- package/dist/studio/assets/bird2-C2hNVINV.js +1 -0
- package/dist/studio/assets/blade-CLG-7epG.js +1 -0
- package/dist/studio/assets/bsl-BkkzgIyY.js +1 -0
- package/dist/studio/assets/c-CssQqwxO.js +1 -0
- package/dist/studio/assets/c3-CnJL0r0V.js +1 -0
- package/dist/studio/assets/cadence-CQ2zXKGN.js +1 -0
- package/dist/studio/assets/cairo-DLTphjLi.js +1 -0
- package/dist/studio/assets/catppuccin-frappe-3VR1Za6u.js +1 -0
- package/dist/studio/assets/catppuccin-latte-DwIHMF0Q.js +1 -0
- package/dist/studio/assets/catppuccin-macchiato-DYnBP6_5.js +1 -0
- package/dist/studio/assets/catppuccin-mocha-DYhrFGRu.js +1 -0
- package/dist/studio/assets/clarity-SemFz856.js +1 -0
- package/dist/studio/assets/clojure-DqKBuwfJ.js +1 -0
- package/dist/studio/assets/cmake-Bj61d0ZC.js +1 -0
- package/dist/studio/assets/cobol-CjmzHCjg.js +1 -0
- package/dist/studio/assets/codeowners-C8r90Shi.js +1 -0
- package/dist/studio/assets/codeql-oeQT6MSM.js +1 -0
- package/dist/studio/assets/coffee-B_rqYPkp.js +1 -0
- package/dist/studio/assets/common-lisp-Cv5bFMCO.js +1 -0
- package/dist/studio/assets/coq-BrsZFFmf.js +1 -0
- package/dist/studio/assets/cpp-5YyZJlb7.js +1 -0
- package/dist/studio/assets/crystal-D7uKze0i.js +1 -0
- package/dist/studio/assets/csharp-Ct8U2NOr.js +1 -0
- package/dist/studio/assets/css-k9oPgg7G.js +1 -0
- package/dist/studio/assets/csv-Dx-8-gkx.js +1 -0
- package/dist/studio/assets/cue-CE9AQfxI.js +1 -0
- package/dist/studio/assets/cypher-ClKdZ_lG.js +1 -0
- package/dist/studio/assets/d-qD-0Kul2.js +1 -0
- package/dist/studio/assets/dark-plus-Cs2F2srj.js +1 -0
- package/dist/studio/assets/dart-DkHntEIa.js +1 -0
- package/dist/studio/assets/dax-BkyTk9wS.js +1 -0
- package/dist/studio/assets/desktop-Dlh5hvp9.js +1 -0
- package/dist/studio/assets/diff-woXpYk--.js +1 -0
- package/dist/studio/assets/docker-IyjqRm3v.js +1 -0
- package/dist/studio/assets/dotenv-_5a1GRtc.js +1 -0
- package/dist/studio/assets/dracula-BHWKrbxM.js +1 -0
- package/dist/studio/assets/dracula-soft-5eyTD99u.js +1 -0
- package/dist/studio/assets/dream-maker-DW3nJb8Q.js +1 -0
- package/dist/studio/assets/edge-CGgsSt0x.js +1 -0
- package/dist/studio/assets/elixir-BX_d5Evo.js +1 -0
- package/dist/studio/assets/elm-DENxDm5e.js +1 -0
- package/dist/studio/assets/emacs-lisp-C9PiwqqW.js +1 -0
- package/dist/studio/assets/erb-DvYOup03.js +1 -0
- package/dist/studio/assets/erlang-Cphh6RMH.js +1 -0
- package/dist/studio/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/dist/studio/assets/everforest-light-Df2xbC6M.js +1 -0
- package/dist/studio/assets/fennel-DQxkIbk2.js +1 -0
- package/dist/studio/assets/fish-BJitypiv.js +1 -0
- package/dist/studio/assets/fluent-C03EYrpw.js +1 -0
- package/dist/studio/assets/fortran-fixed-form-DEKoE2YW.js +1 -0
- package/dist/studio/assets/fortran-free-form-CYNrtFtB.js +1 -0
- package/dist/studio/assets/fsharp-D13ZGOAj.js +1 -0
- package/dist/studio/assets/gdresource-C0sCabJj.js +1 -0
- package/dist/studio/assets/gdscript-Cp2uCuqX.js +1 -0
- package/dist/studio/assets/gdshader-CBce3t8t.js +1 -0
- package/dist/studio/assets/genie-CV2tkWYe.js +1 -0
- package/dist/studio/assets/gherkin-DExj1W_8.js +1 -0
- package/dist/studio/assets/git-commit-BSykSTBG.js +1 -0
- package/dist/studio/assets/git-rebase-BsAdTS5A.js +1 -0
- package/dist/studio/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/studio/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/dist/studio/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/dist/studio/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/dist/studio/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/studio/assets/github-light-default-BXViO-2h.js +1 -0
- package/dist/studio/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/dist/studio/assets/gleam-CSRkHgEL.js +1 -0
- package/dist/studio/assets/glimmer-js-e0h98Z67.js +1 -0
- package/dist/studio/assets/glimmer-ts-C9s5Kv8m.js +1 -0
- package/dist/studio/assets/glsl-CCiyeTRs.js +1 -0
- package/dist/studio/assets/gn-ilITqXS6.js +1 -0
- package/dist/studio/assets/gnuplot-7GGW24-e.js +1 -0
- package/dist/studio/assets/go-BJwz_mda.js +1 -0
- package/dist/studio/assets/graphql-BRtHwsqk.js +1 -0
- package/dist/studio/assets/groovy-CacY0gHj.js +1 -0
- package/dist/studio/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/dist/studio/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/dist/studio/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/dist/studio/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/dist/studio/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/dist/studio/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/dist/studio/assets/hack-Dnt0QXHh.js +1 -0
- package/dist/studio/assets/haml-EXGmzuB1.js +1 -0
- package/dist/studio/assets/handlebars-CzyBIDJE.js +1 -0
- package/dist/studio/assets/haskell-D8IpX4py.js +1 -0
- package/dist/studio/assets/haxe-OTjmBuCE.js +1 -0
- package/dist/studio/assets/hcl-Dh228itO.js +1 -0
- package/dist/studio/assets/highlighted-body-OFNGDK62-CQUFKLNu.js +1 -0
- package/dist/studio/assets/hjson-CxZEssPk.js +1 -0
- package/dist/studio/assets/hlsl-Cvrh5tZx.js +1 -0
- package/dist/studio/assets/horizon-CE9ld1lL.js +1 -0
- package/dist/studio/assets/horizon-bright-Br1oVSNq.js +1 -0
- package/dist/studio/assets/houston-CsvMBhTu.js +1 -0
- package/dist/studio/assets/html-BAT8b_VM.js +1 -0
- package/dist/studio/assets/html-derivative-7tkS-r6F.js +1 -0
- package/dist/studio/assets/http-Cgka02Qq.js +1 -0
- package/dist/studio/assets/hurl-Cbkh8WEw.js +1 -0
- package/dist/studio/assets/hxml-B0Qn7Nwc.js +1 -0
- package/dist/studio/assets/hy-CZbG8q4J.js +1 -0
- package/dist/studio/assets/imba-DsUTQ-LC.js +1 -0
- package/dist/studio/assets/index-D6n8vpkp.js +390 -0
- package/dist/studio/assets/index-DkGWw6ES.css +2 -0
- package/dist/studio/assets/ini-B5eOa1yu.js +1 -0
- package/dist/studio/assets/java-DrRKiUno.js +1 -0
- package/dist/studio/assets/javascript-9LAnHOxD.js +1 -0
- package/dist/studio/assets/jinja-CqRt4prs.js +1 -0
- package/dist/studio/assets/jison-BX-IOQpJ.js +1 -0
- package/dist/studio/assets/json-dOrE-En8.js +1 -0
- package/dist/studio/assets/json5-BR5RXkoi.js +1 -0
- package/dist/studio/assets/jsonc-CYpm1nAK.js +1 -0
- package/dist/studio/assets/jsonl-CmCQp5Yx.js +1 -0
- package/dist/studio/assets/jsonnet-CJTPZ8u_.js +1 -0
- package/dist/studio/assets/jssm-DXw9l8Rf.js +1 -0
- package/dist/studio/assets/jsx-BSTPfqWX.js +1 -0
- package/dist/studio/assets/julia-Dvz-BPmf.js +1 -0
- package/dist/studio/assets/just-BHQm0Atq.js +1 -0
- package/dist/studio/assets/kanagawa-dragon-CXtmUGW6.js +1 -0
- package/dist/studio/assets/kanagawa-lotus-BN08jTvb.js +1 -0
- package/dist/studio/assets/kanagawa-wave-CTweb8Dz.js +1 -0
- package/dist/studio/assets/kdl-CsD5j6eV.js +1 -0
- package/dist/studio/assets/kotlin-DhhofPvG.js +1 -0
- package/dist/studio/assets/kusto-BUv0MjJC.js +1 -0
- package/dist/studio/assets/laserwave-C_8bwKvT.js +1 -0
- package/dist/studio/assets/latex-CxdhxuXv.js +1 -0
- package/dist/studio/assets/lean-CewbzKMR.js +1 -0
- package/dist/studio/assets/less-DVTAwKKz.js +1 -0
- package/dist/studio/assets/light-plus-DVQuIRkW.js +1 -0
- package/dist/studio/assets/liquid-D-hM-Q_F.js +1 -0
- package/dist/studio/assets/llvm-Cm23YOpf.js +1 -0
- package/dist/studio/assets/log-BNLmms1o.js +1 -0
- package/dist/studio/assets/logo-Cluzi2Zq.js +1 -0
- package/dist/studio/assets/lua-5qtqjLHq.js +1 -0
- package/dist/studio/assets/luau-CNKltnaQ.js +1 -0
- package/dist/studio/assets/make-Dixweg8N.js +1 -0
- package/dist/studio/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/studio/assets/marko-5FJaM2co.js +1 -0
- package/dist/studio/assets/material-theme-Bm3Qr25_.js +1 -0
- package/dist/studio/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/dist/studio/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/dist/studio/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/dist/studio/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/dist/studio/assets/matlab-D7qyCx1q.js +1 -0
- package/dist/studio/assets/mdc-BhYW7lCG.js +1 -0
- package/dist/studio/assets/mdx-DQZ5AkYe.js +1 -0
- package/dist/studio/assets/mermaid-Bk4SNUv9.js +1 -0
- package/dist/studio/assets/mermaid-GHXKKRXX-CWM2EB-u.js +1 -0
- package/dist/studio/assets/min-dark-BSWPekZh.js +1 -0
- package/dist/studio/assets/min-light-DDpmG2fV.js +1 -0
- package/dist/studio/assets/mipsasm-BMqwQI7S.js +1 -0
- package/dist/studio/assets/mojo-BgCJLMeH.js +1 -0
- package/dist/studio/assets/monokai-CdkpiU2Y.js +1 -0
- package/dist/studio/assets/moonbit-CaWjb8XO.js +1 -0
- package/dist/studio/assets/move-B1IS1UjX.js +1 -0
- package/dist/studio/assets/narrat-_X_XdTYD.js +1 -0
- package/dist/studio/assets/nextflow-Bbiyy34d.js +1 -0
- package/dist/studio/assets/nextflow-groovy-Dc_ddanL.js +1 -0
- package/dist/studio/assets/nginx-rtAXrRye.js +1 -0
- package/dist/studio/assets/night-owl-DhmEMT88.js +1 -0
- package/dist/studio/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/dist/studio/assets/nim-DQSmaN9U.js +1 -0
- package/dist/studio/assets/nix-IvuFDN5E.js +1 -0
- package/dist/studio/assets/nord-Cb4Vim4T.js +1 -0
- package/dist/studio/assets/nushell-DcLAeLz5.js +1 -0
- package/dist/studio/assets/objective-c-D1A_Heim.js +1 -0
- package/dist/studio/assets/objective-cpp-BsSzOQcm.js +1 -0
- package/dist/studio/assets/ocaml-O90oeIOV.js +1 -0
- package/dist/studio/assets/odin-B1RWQWA5.js +1 -0
- package/dist/studio/assets/one-dark-pro-CLwyXe_n.js +1 -0
- package/dist/studio/assets/one-light-D7Lr4KcI.js +1 -0
- package/dist/studio/assets/openscad-BUDT5pXO.js +1 -0
- package/dist/studio/assets/pascal-4ZHwLPI5.js +1 -0
- package/dist/studio/assets/perl-B54AdcaE.js +1 -0
- package/dist/studio/assets/php-DpvTxCny.js +1 -0
- package/dist/studio/assets/pkl-ot-7Btpt.js +1 -0
- package/dist/studio/assets/plastic-DQwYfKfQ.js +1 -0
- package/dist/studio/assets/plsql-DGHpHOYJ.js +1 -0
- package/dist/studio/assets/po-BiJDBrnU.js +1 -0
- package/dist/studio/assets/poimandres-DRFjx7u4.js +1 -0
- package/dist/studio/assets/polar-C7UOKdEL.js +1 -0
- package/dist/studio/assets/postcss-BXeXVLqQ.js +1 -0
- package/dist/studio/assets/powerquery-DNMTfnFr.js +1 -0
- package/dist/studio/assets/powershell-DshXNtvi.js +1 -0
- package/dist/studio/assets/prisma-BsRQq5mF.js +1 -0
- package/dist/studio/assets/prolog-iXnhIJG7.js +1 -0
- package/dist/studio/assets/proto-DB4EqR-F.js +1 -0
- package/dist/studio/assets/pug-Cyffw0Ho.js +1 -0
- package/dist/studio/assets/puppet-CDv2pdJW.js +1 -0
- package/dist/studio/assets/purescript-9MfHhQsQ.js +1 -0
- package/dist/studio/assets/python-gzcpVVnB.js +1 -0
- package/dist/studio/assets/qml-CxRetSkO.js +1 -0
- package/dist/studio/assets/qmldir-DCQb3MpD.js +1 -0
- package/dist/studio/assets/qss-Fe1Jh2GI.js +1 -0
- package/dist/studio/assets/r-CXWRxrXc.js +1 -0
- package/dist/studio/assets/racket-DcIDlBhZ.js +1 -0
- package/dist/studio/assets/raku-B3gFvitq.js +1 -0
- package/dist/studio/assets/razor-BJzI-zc9.js +1 -0
- package/dist/studio/assets/red-CJ3rzSJv.js +1 -0
- package/dist/studio/assets/reg-CRGYupPL.js +1 -0
- package/dist/studio/assets/regexp-dqxdfrnE.js +1 -0
- package/dist/studio/assets/rel-BtDbiS_P.js +1 -0
- package/dist/studio/assets/riscv-Ckw8ddFX.js +1 -0
- package/dist/studio/assets/ron-VUp2lXgN.js +1 -0
- package/dist/studio/assets/rose-pine-BthvhNj6.js +1 -0
- package/dist/studio/assets/rose-pine-dawn-Dg85fqjY.js +1 -0
- package/dist/studio/assets/rose-pine-moon-hon4tzzS.js +1 -0
- package/dist/studio/assets/rosmsg-CAekHB0j.js +1 -0
- package/dist/studio/assets/rst-BW7eKYj4.js +1 -0
- package/dist/studio/assets/ruby-D5Npyj8-.js +1 -0
- package/dist/studio/assets/rust-Cfkwpbl8.js +1 -0
- package/dist/studio/assets/sas-DZLppjul.js +1 -0
- package/dist/studio/assets/sass-DXrisJhu.js +1 -0
- package/dist/studio/assets/scala-DKOlJaKm.js +1 -0
- package/dist/studio/assets/scheme-DQCgrYNe.js +1 -0
- package/dist/studio/assets/scss-CbqoxyAe.js +1 -0
- package/dist/studio/assets/sdbl-bTVj8UrX.js +1 -0
- package/dist/studio/assets/shaderlab-TOUzSsQk.js +1 -0
- package/dist/studio/assets/shellscript-CFHqBeXu.js +1 -0
- package/dist/studio/assets/shellsession-CbZDA4Bf.js +1 -0
- package/dist/studio/assets/slack-dark-DnToyrRv.js +1 -0
- package/dist/studio/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/dist/studio/assets/smalltalk-B16xEiuN.js +1 -0
- package/dist/studio/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/dist/studio/assets/solarized-dark-DV17i1UV.js +1 -0
- package/dist/studio/assets/solarized-light-DSh2HLQt.js +1 -0
- package/dist/studio/assets/solidity-CKzVLygQ.js +1 -0
- package/dist/studio/assets/soy-PImjtV58.js +1 -0
- package/dist/studio/assets/sparql-D_iOobhT.js +1 -0
- package/dist/studio/assets/splunk-BC2Px7Mm.js +1 -0
- package/dist/studio/assets/sql-DhGo8urW.js +1 -0
- package/dist/studio/assets/ssh-config-BgfXC-Er.js +1 -0
- package/dist/studio/assets/stata-CjHWbU2v.js +1 -0
- package/dist/studio/assets/stylus-B6D30XZt.js +1 -0
- package/dist/studio/assets/surrealql-o8Qr4t56.js +1 -0
- package/dist/studio/assets/svelte-DlSIyEV1.js +1 -0
- package/dist/studio/assets/swift-DonLKvLd.js +1 -0
- package/dist/studio/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/dist/studio/assets/system-verilog-DJ5XKQeo.js +1 -0
- package/dist/studio/assets/systemd-BxMlprV5.js +1 -0
- package/dist/studio/assets/talonscript-CohzipZa.js +1 -0
- package/dist/studio/assets/tasl-DMoTqEGO.js +1 -0
- package/dist/studio/assets/tcl-CZd0xW_V.js +1 -0
- package/dist/studio/assets/templ-qizfwU1w.js +1 -0
- package/dist/studio/assets/terraform-DswuEJGm.js +1 -0
- package/dist/studio/assets/tex-Ca7T661H.js +1 -0
- package/dist/studio/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/dist/studio/assets/toml-CcmNWLt0.js +1 -0
- package/dist/studio/assets/ts-tags-DUmjLkgl.js +1 -0
- package/dist/studio/assets/tsv-sltzmVWM.js +1 -0
- package/dist/studio/assets/tsx-CfwgIqHW.js +1 -0
- package/dist/studio/assets/turtle-ByJddavk.js +1 -0
- package/dist/studio/assets/twig-D7NAYUBY.js +1 -0
- package/dist/studio/assets/typescript-Bbz9oX-P.js +1 -0
- package/dist/studio/assets/typespec-B88KGewJ.js +1 -0
- package/dist/studio/assets/typst-DI99ib-x.js +1 -0
- package/dist/studio/assets/v-DETTlOr0.js +1 -0
- package/dist/studio/assets/vala-zf12oZj6.js +1 -0
- package/dist/studio/assets/vb-Djn5o6TS.js +1 -0
- package/dist/studio/assets/verilog-CiiDBU1e.js +1 -0
- package/dist/studio/assets/vesper-D5bVUKB1.js +1 -0
- package/dist/studio/assets/vhdl-BroJfC0k.js +1 -0
- package/dist/studio/assets/viml-DvXPmvsu.js +1 -0
- package/dist/studio/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/dist/studio/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/dist/studio/assets/vitesse-light-VbXTXTou.js +1 -0
- package/dist/studio/assets/vue-html-CcxTb_Jn.js +1 -0
- package/dist/studio/assets/vue-vYpz06zQ.js +1 -0
- package/dist/studio/assets/vue-vine-DW4RqCKF.js +1 -0
- package/dist/studio/assets/vyper-CgoNMtux.js +1 -0
- package/dist/studio/assets/wasm-BnjxR4X6.js +1 -0
- package/dist/studio/assets/wasm-ByWQv1Qj.js +1 -0
- package/dist/studio/assets/wenyan-C8pVoKbM.js +1 -0
- package/dist/studio/assets/wgsl-BsKzXJz4.js +1 -0
- package/dist/studio/assets/wikitext-ClFFjSW2.js +1 -0
- package/dist/studio/assets/wit-DdvCle-K.js +1 -0
- package/dist/studio/assets/wolfram-DLL8P-h_.js +1 -0
- package/dist/studio/assets/xml-R4LZ_u4f.js +1 -0
- package/dist/studio/assets/xsl-CS-xzp3L.js +1 -0
- package/dist/studio/assets/yaml-CqDWbYXd.js +1 -0
- package/dist/studio/assets/zenscript-BnlCZFoB.js +1 -0
- package/dist/studio/assets/zig-CMLA9XwU.js +1 -0
- package/dist/studio/index.html +23 -0
- package/dist/think.d.ts +2 -2
- package/dist/think.js +8292 -2
- package/dist/think.js.map +1 -0
- package/dist/tools/extensions.js +1 -1
- package/dist/tools/workspace.js +2 -2
- package/dist/tools/workspace.js.map +1 -1
- package/dist/{types-codegen-B6c5KpYH.js → types-codegen-C-9yeFao.js} +9 -33
- package/dist/types-codegen-C-9yeFao.js.map +1 -0
- package/dist/vite.d.ts +12 -5
- package/dist/vite.js +73 -1
- package/dist/vite.js.map +1 -1
- package/dist/workflows.d.ts +1 -1
- package/docs/actions.md +297 -0
- package/docs/channels.md +185 -0
- package/docs/client-tools.md +233 -0
- package/docs/getting-started.md +314 -0
- package/docs/index.md +1272 -0
- package/docs/lifecycle-hooks.md +839 -0
- package/docs/messengers.md +197 -0
- package/docs/programmatic-submissions.md +206 -0
- package/docs/sub-agents.md +520 -0
- package/docs/tools.md +582 -0
- package/docs/workflows.md +217 -0
- package/package.json +57 -10
- package/dist/chat-sdk-Bb93yaZh.js.map +0 -1
- package/dist/codegen-CuPdJRpV.js.map +0 -1
- package/dist/framework/index.js.map +0 -1
- package/dist/think-2nHHEcY3.js +0 -6446
- package/dist/think-2nHHEcY3.js.map +0 -1
- package/dist/types-codegen-B6c5KpYH.js.map +0 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as readWranglerConfig, c as createThinkWorkerConfig, h as discoverThinkApp, i as readProjectFiles, m as summarizeThinkManifest, n as createThinkProject, o as resolveThinkManifest, t as applyUserBindingNames } from "../project-BHurFdu4.js";
|
|
3
|
-
import { n as isThinkGeneratedFile, t as generateThinkTypes } from "../types-codegen-
|
|
4
|
-
import {
|
|
3
|
+
import { n as isThinkGeneratedFile, t as generateThinkTypes } from "../types-codegen-C-9yeFao.js";
|
|
4
|
+
import { CHAT_MESSAGE_TYPES } from "agents/chat";
|
|
5
|
+
import { access, mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import yargs from "yargs";
|
|
7
8
|
import { hideBin } from "yargs/helpers";
|
|
9
|
+
import { fileExists, gitOutcomeMessage, initCommand, initializeGit, looksLikeThinkApp, packageName, readTextIfExists, runNpmInstall } from "create-think";
|
|
10
|
+
import { AgentClient } from "agents/client";
|
|
8
11
|
import { spawn } from "node:child_process";
|
|
9
|
-
import {
|
|
12
|
+
import { createReadStream } from "node:fs";
|
|
13
|
+
import { createServer } from "node:http";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
10
15
|
//#region src/cli/init.ts
|
|
11
16
|
const VITE_CONFIG_FILES = [
|
|
12
17
|
"vite.config.ts",
|
|
@@ -56,8 +61,12 @@ async function augmentExistingProject(root, options) {
|
|
|
56
61
|
return;
|
|
57
62
|
}
|
|
58
63
|
await writePlannedFiles(plan, skipped);
|
|
64
|
+
const gitOutcome = await initializeGit(root, {
|
|
65
|
+
gitRunner: options.gitRunner,
|
|
66
|
+
isInsideGitRepo: options.isInsideGitRepo
|
|
67
|
+
});
|
|
59
68
|
if (options.install ?? true) await (options.installRunner ?? runNpmInstall)(root);
|
|
60
|
-
printSuccess(plan, skipped, options.install ?? true);
|
|
69
|
+
printSuccess(plan, skipped, options.install ?? true, gitOutcome);
|
|
61
70
|
}
|
|
62
71
|
async function createInitPlan(options) {
|
|
63
72
|
const sourceFiles = {
|
|
@@ -101,6 +110,18 @@ async function createInitPlan(options) {
|
|
|
101
110
|
path: "tsconfig.json",
|
|
102
111
|
content: tsconfig()
|
|
103
112
|
},
|
|
113
|
+
{
|
|
114
|
+
path: ".gitignore",
|
|
115
|
+
content: gitignore()
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
path: ".oxlintrc.json",
|
|
119
|
+
content: oxlintConfig()
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
path: ".oxfmtrc.json",
|
|
123
|
+
content: oxfmtConfig()
|
|
124
|
+
},
|
|
104
125
|
{
|
|
105
126
|
path: "agents/assistant/agent.ts",
|
|
106
127
|
content: sourceFiles["agents/assistant/agent.ts"]
|
|
@@ -132,7 +153,7 @@ async function writePlannedFiles(plan, skip) {
|
|
|
132
153
|
}
|
|
133
154
|
async function mergePackageJson(absolutePath, generatedContent) {
|
|
134
155
|
const generated = JSON.parse(generatedContent);
|
|
135
|
-
const existingSource = await readTextIfExists
|
|
156
|
+
const existingSource = await readTextIfExists(absolutePath);
|
|
136
157
|
if (!existingSource) return generatedContent;
|
|
137
158
|
const existing = JSON.parse(existingSource);
|
|
138
159
|
return `${JSON.stringify(mergePackageJsonData(existing, generated), null, 2)}\n`;
|
|
@@ -168,46 +189,35 @@ async function unsafeMigrationReason(root) {
|
|
|
168
189
|
function printDryRun(plan, skipped, install) {
|
|
169
190
|
const lines = ["Think init would add to the current project:", ...plan.files.filter((file) => !skipped.has(file.path)).map((file) => `- ${file.path}`)];
|
|
170
191
|
if (skipped.size > 0) lines.push("", "Would keep your existing files (left unchanged):", ...[...skipped].map((file) => `- ${file}`));
|
|
171
|
-
lines.push(install ? "Would run: npm install" : "Would skip dependency install.");
|
|
192
|
+
lines.push("Would initialize a git repository (skipped if already inside one).", install ? "Would run: npm install" : "Would skip dependency install.");
|
|
172
193
|
console.log(lines.join("\n"));
|
|
173
194
|
}
|
|
174
|
-
function printSuccess(plan, skipped, install) {
|
|
175
|
-
const lines = [
|
|
195
|
+
function printSuccess(plan, skipped, install, gitOutcome) {
|
|
196
|
+
const lines = [
|
|
197
|
+
`Added Think to ${plan.root}.`,
|
|
198
|
+
gitOutcomeMessage(gitOutcome),
|
|
199
|
+
install ? "Installed npm dependencies." : "Skipped npm install."
|
|
200
|
+
];
|
|
176
201
|
if (skipped.size > 0) lines.push("", "Kept your existing files (not overwritten):", ...[...skipped].map((file) => `- ${file}`), "Reconcile them with Think's expected setup if the app does not build.");
|
|
177
202
|
lines.push("", "Next steps:", "- Edit agents/assistant/agent.ts to customize the model, prompt, skills, and schedules", "- npm run dev", "- npm run types", "- npm run deploy");
|
|
178
203
|
console.log(lines.join("\n"));
|
|
179
204
|
}
|
|
180
|
-
async function runNpmInstall(root) {
|
|
181
|
-
await new Promise((resolve, reject) => {
|
|
182
|
-
const child = spawn("npm", ["install"], {
|
|
183
|
-
cwd: root,
|
|
184
|
-
stdio: "inherit",
|
|
185
|
-
shell: process.platform === "win32"
|
|
186
|
-
});
|
|
187
|
-
child.on("error", reject);
|
|
188
|
-
child.on("exit", (code) => {
|
|
189
|
-
if (code === 0) {
|
|
190
|
-
resolve();
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
reject(/* @__PURE__ */ new Error(`npm install failed with exit code ${code ?? "unknown"}.`));
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
205
|
const FRAMEWORK_DEPENDENCIES = {
|
|
198
206
|
"@cloudflare/think": "latest",
|
|
199
207
|
agents: "latest"
|
|
200
208
|
};
|
|
201
209
|
const THIRD_PARTY_DEPENDENCIES = {
|
|
202
210
|
ai: "^6.0.202",
|
|
203
|
-
"workers-ai-provider": "^3.2.
|
|
211
|
+
"workers-ai-provider": "^3.2.1"
|
|
204
212
|
};
|
|
205
213
|
const THIRD_PARTY_DEV_DEPENDENCIES = {
|
|
206
|
-
"@cloudflare/vite-plugin": "^1.
|
|
207
|
-
"@cloudflare/workers-types": "^4.
|
|
214
|
+
"@cloudflare/vite-plugin": "^1.42.3",
|
|
215
|
+
"@cloudflare/workers-types": "^4.20260625.1",
|
|
216
|
+
oxfmt: "^0.56.0",
|
|
217
|
+
oxlint: "^1.71.0",
|
|
208
218
|
typescript: "^6.0.3",
|
|
209
|
-
vite: "^8.0
|
|
210
|
-
wrangler: "^4.
|
|
219
|
+
vite: "^8.1.0",
|
|
220
|
+
wrangler: "^4.105.0"
|
|
211
221
|
};
|
|
212
222
|
function packageJsonSource(projectName) {
|
|
213
223
|
return `${JSON.stringify({
|
|
@@ -218,7 +228,12 @@ function packageJsonSource(projectName) {
|
|
|
218
228
|
dev: "vite dev",
|
|
219
229
|
build: "vite build",
|
|
220
230
|
deploy: "vite build && wrangler deploy",
|
|
221
|
-
types: "think types --all"
|
|
231
|
+
types: "think types --all",
|
|
232
|
+
format: "oxfmt --write .",
|
|
233
|
+
"format:check": "oxfmt --check .",
|
|
234
|
+
lint: "oxlint .",
|
|
235
|
+
typecheck: "tsc --noEmit",
|
|
236
|
+
check: "npm run format:check && npm run lint && npm run typecheck"
|
|
222
237
|
},
|
|
223
238
|
dependencies: {
|
|
224
239
|
...FRAMEWORK_DEPENDENCIES,
|
|
@@ -313,28 +328,187 @@ function tsconfig() {
|
|
|
313
328
|
]
|
|
314
329
|
}, null, 2)}\n`;
|
|
315
330
|
}
|
|
316
|
-
function
|
|
317
|
-
return
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
331
|
+
function gitignore() {
|
|
332
|
+
return `# Logs
|
|
333
|
+
logs
|
|
334
|
+
*.log
|
|
335
|
+
npm-debug.log*
|
|
336
|
+
yarn-debug.log*
|
|
337
|
+
yarn-error.log*
|
|
338
|
+
lerna-debug.log*
|
|
339
|
+
|
|
340
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
341
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
342
|
+
|
|
343
|
+
# Runtime data
|
|
344
|
+
pids
|
|
345
|
+
*.pid
|
|
346
|
+
*.seed
|
|
347
|
+
*.pid.lock
|
|
348
|
+
|
|
349
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
350
|
+
lib-cov
|
|
351
|
+
|
|
352
|
+
# Coverage directory used by tools like istanbul
|
|
353
|
+
coverage
|
|
354
|
+
*.lcov
|
|
355
|
+
|
|
356
|
+
# nyc test coverage
|
|
357
|
+
.nyc_output
|
|
358
|
+
|
|
359
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
360
|
+
.grunt
|
|
361
|
+
|
|
362
|
+
# Bower dependency directory (https://bower.io/)
|
|
363
|
+
bower_components
|
|
364
|
+
|
|
365
|
+
# node-waf configuration
|
|
366
|
+
.lock-wscript
|
|
367
|
+
|
|
368
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
369
|
+
build/Release
|
|
370
|
+
|
|
371
|
+
# Dependency directories
|
|
372
|
+
node_modules/
|
|
373
|
+
jspm_packages/
|
|
374
|
+
|
|
375
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
376
|
+
web_modules/
|
|
377
|
+
|
|
378
|
+
# TypeScript cache
|
|
379
|
+
*.tsbuildinfo
|
|
380
|
+
|
|
381
|
+
# Optional npm cache directory
|
|
382
|
+
.npm
|
|
383
|
+
|
|
384
|
+
# Optional eslint cache
|
|
385
|
+
.eslintcache
|
|
386
|
+
|
|
387
|
+
# Optional stylelint cache
|
|
388
|
+
.stylelintcache
|
|
389
|
+
|
|
390
|
+
# Optional REPL history
|
|
391
|
+
.node_repl_history
|
|
392
|
+
|
|
393
|
+
# Output of 'npm pack'
|
|
394
|
+
*.tgz
|
|
395
|
+
|
|
396
|
+
# Yarn Integrity file
|
|
397
|
+
.yarn-integrity
|
|
398
|
+
|
|
399
|
+
# dotenv environment variable files
|
|
400
|
+
.env
|
|
401
|
+
.env.*
|
|
402
|
+
!.env.example
|
|
403
|
+
|
|
404
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
405
|
+
.cache
|
|
406
|
+
.parcel-cache
|
|
407
|
+
|
|
408
|
+
# Next.js build output
|
|
409
|
+
.next
|
|
410
|
+
out
|
|
411
|
+
|
|
412
|
+
# Nuxt.js build / generate output
|
|
413
|
+
.nuxt
|
|
414
|
+
dist
|
|
415
|
+
.output
|
|
416
|
+
|
|
417
|
+
# Gatsby files
|
|
418
|
+
.cache/
|
|
419
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
420
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
421
|
+
# public
|
|
422
|
+
|
|
423
|
+
# vuepress build output
|
|
424
|
+
.vuepress/dist
|
|
425
|
+
|
|
426
|
+
# vuepress v2.x temp directory
|
|
427
|
+
.temp
|
|
428
|
+
|
|
429
|
+
# Sveltekit cache directory
|
|
430
|
+
.svelte-kit/
|
|
431
|
+
|
|
432
|
+
# vitepress build output
|
|
433
|
+
**/.vitepress/dist
|
|
434
|
+
|
|
435
|
+
# vitepress cache directory
|
|
436
|
+
**/.vitepress/cache
|
|
437
|
+
|
|
438
|
+
# Docusaurus cache and generated files
|
|
439
|
+
.docusaurus
|
|
440
|
+
|
|
441
|
+
# Serverless directories
|
|
442
|
+
.serverless/
|
|
443
|
+
|
|
444
|
+
# FuseBox cache
|
|
445
|
+
.fusebox/
|
|
446
|
+
|
|
447
|
+
# DynamoDB Local files
|
|
448
|
+
.dynamodb/
|
|
449
|
+
|
|
450
|
+
# Firebase cache directory
|
|
451
|
+
.firebase/
|
|
452
|
+
|
|
453
|
+
# TernJS port file
|
|
454
|
+
.tern-port
|
|
455
|
+
|
|
456
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
457
|
+
.vscode-test
|
|
458
|
+
|
|
459
|
+
# pnpm
|
|
460
|
+
.pnpm-store
|
|
461
|
+
|
|
462
|
+
# yarn v3
|
|
463
|
+
.pnp.*
|
|
464
|
+
.yarn/*
|
|
465
|
+
!.yarn/patches
|
|
466
|
+
!.yarn/plugins
|
|
467
|
+
!.yarn/releases
|
|
468
|
+
!.yarn/sdks
|
|
469
|
+
!.yarn/versions
|
|
470
|
+
|
|
471
|
+
# Vite files
|
|
472
|
+
vite.config.js.timestamp-*
|
|
473
|
+
vite.config.ts.timestamp-*
|
|
474
|
+
.vite/
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
.wrangler
|
|
478
|
+
.dev.vars
|
|
479
|
+
.DS_Store
|
|
480
|
+
`;
|
|
326
481
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
482
|
+
function oxlintConfig() {
|
|
483
|
+
return `${JSON.stringify({
|
|
484
|
+
$schema: "./node_modules/oxlint/configuration_schema.json",
|
|
485
|
+
plugins: [
|
|
486
|
+
"react",
|
|
487
|
+
"jsx-a11y",
|
|
488
|
+
"typescript"
|
|
489
|
+
],
|
|
490
|
+
categories: { correctness: "error" },
|
|
491
|
+
rules: {
|
|
492
|
+
"no-explicit-any": "error",
|
|
493
|
+
"typescript/no-deprecated": "warn",
|
|
494
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
495
|
+
"no-unused-vars": ["error", {
|
|
496
|
+
argsIgnorePattern: "^_",
|
|
497
|
+
varsIgnorePattern: "^_",
|
|
498
|
+
caughtErrorsIgnorePattern: "^_"
|
|
499
|
+
}]
|
|
500
|
+
},
|
|
501
|
+
ignorePatterns: ["**/env.d.ts", "**/think.d.ts"]
|
|
502
|
+
}, null, 2)}\n`;
|
|
335
503
|
}
|
|
336
|
-
function
|
|
337
|
-
return
|
|
504
|
+
function oxfmtConfig() {
|
|
505
|
+
return `${JSON.stringify({
|
|
506
|
+
$schema: "./node_modules/oxfmt/configuration_schema.json",
|
|
507
|
+
trailingComma: "none",
|
|
508
|
+
printWidth: 80,
|
|
509
|
+
experimentalSortPackageJson: false,
|
|
510
|
+
ignorePatterns: ["**/think.d.ts"]
|
|
511
|
+
}, null, 2)}\n`;
|
|
338
512
|
}
|
|
339
513
|
//#endregion
|
|
340
514
|
//#region src/cli/inspect.ts
|
|
@@ -426,6 +600,417 @@ function severityLabel(severity) {
|
|
|
426
600
|
return severity.toUpperCase();
|
|
427
601
|
}
|
|
428
602
|
//#endregion
|
|
603
|
+
//#region src/cli/target.ts
|
|
604
|
+
/**
|
|
605
|
+
* Browser-safe, IO-free helpers for turning loose connection inputs (a remote
|
|
606
|
+
* `url` or a local `host`, an agent id, an instance, a token, extra query
|
|
607
|
+
* params) into the concrete `{ host, protocol, basePath, query }` an
|
|
608
|
+
* `AgentClient`/`useAgent` needs.
|
|
609
|
+
*
|
|
610
|
+
* This module is deliberately dependency-free so it can be imported by both the
|
|
611
|
+
* Node-side runtime CLI (`connect.ts`) and the browser Studio app. The
|
|
612
|
+
* manifest-aware resolution (friendly agent ids/aliases) lives in `connect.ts`;
|
|
613
|
+
* everything here is pure string math.
|
|
614
|
+
*/
|
|
615
|
+
/**
|
|
616
|
+
* Mirror the default `routeAgentRequest` segment derivation so a raw agent name
|
|
617
|
+
* (e.g. a class name) maps to the same route the server exposes.
|
|
618
|
+
*/
|
|
619
|
+
function camelCaseToKebabCase(str) {
|
|
620
|
+
if (str === str.toUpperCase() && str !== str.toLowerCase()) return str.toLowerCase().replace(/_/g, "-");
|
|
621
|
+
let kebabified = str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
622
|
+
kebabified = kebabified.startsWith("-") ? kebabified.slice(1) : kebabified;
|
|
623
|
+
return kebabified.replace(/_/g, "-").replace(/-$/, "");
|
|
624
|
+
}
|
|
625
|
+
/** Normalize a route prefix to a slash-free segment (default `agents`). */
|
|
626
|
+
function normalizeRoutePrefix(routePrefix) {
|
|
627
|
+
return (routePrefix ?? "/agents").replace(/^\/+|\/+$/g, "") || "agents";
|
|
628
|
+
}
|
|
629
|
+
function parseQuery(query, token) {
|
|
630
|
+
const result = {};
|
|
631
|
+
if (token) result.token = token;
|
|
632
|
+
if (!query) return result;
|
|
633
|
+
if (Array.isArray(query)) {
|
|
634
|
+
for (const pair of query) {
|
|
635
|
+
const eq = pair.indexOf("=");
|
|
636
|
+
if (eq <= 0) throw new Error(`Invalid query "${pair}" (expected key=value).`);
|
|
637
|
+
result[pair.slice(0, eq)] = pair.slice(eq + 1);
|
|
638
|
+
}
|
|
639
|
+
return result;
|
|
640
|
+
}
|
|
641
|
+
for (const [key, value] of Object.entries(query)) result[key] = value;
|
|
642
|
+
return result;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Resolve host/protocol/basePath/query from loose inputs. Pure (no IO), so it
|
|
646
|
+
* is safe in the browser and trivially unit-testable.
|
|
647
|
+
*/
|
|
648
|
+
function deriveWsTarget(input) {
|
|
649
|
+
const instance = input.instance?.trim() || "default";
|
|
650
|
+
const prefix = normalizeRoutePrefix(input.routePrefix);
|
|
651
|
+
let host;
|
|
652
|
+
let protocol;
|
|
653
|
+
if (input.url) {
|
|
654
|
+
let origin;
|
|
655
|
+
try {
|
|
656
|
+
origin = new URL(input.url);
|
|
657
|
+
} catch {
|
|
658
|
+
throw new Error(`Invalid url "${input.url}" (expected a full origin).`);
|
|
659
|
+
}
|
|
660
|
+
if (!origin.host) throw new Error(`Invalid url "${input.url}" (missing host — include a scheme, e.g. https://host).`);
|
|
661
|
+
host = origin.host;
|
|
662
|
+
protocol = input.protocol === "ws" || input.protocol === "wss" ? input.protocol : origin.protocol === "https:" || origin.protocol === "wss:" ? "wss" : "ws";
|
|
663
|
+
} else {
|
|
664
|
+
host = input.host?.trim() || "localhost:5173";
|
|
665
|
+
protocol = input.protocol === "wss" ? "wss" : "ws";
|
|
666
|
+
}
|
|
667
|
+
const segment = input.canonicalAgent ? input.agent : camelCaseToKebabCase(input.agent);
|
|
668
|
+
const basePath = [
|
|
669
|
+
prefix,
|
|
670
|
+
encodeURIComponent(segment),
|
|
671
|
+
encodeURIComponent(instance)
|
|
672
|
+
].join("/");
|
|
673
|
+
return {
|
|
674
|
+
host,
|
|
675
|
+
protocol,
|
|
676
|
+
basePath,
|
|
677
|
+
query: parseQuery(input.query, input.token),
|
|
678
|
+
instance,
|
|
679
|
+
segment
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/cli/connect.ts
|
|
684
|
+
function findTopLevelAgent(manifest, agent) {
|
|
685
|
+
return manifest.agents.find((entry) => entry.kind === "top-level" && (entry.id === agent || entry.bindingName === agent || entry.className === agent || entry.aliases.includes(agent)));
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Resolve target/URL/auth details from CLI options. Pure (no IO) so it can be
|
|
689
|
+
* unit-tested with a synthetic manifest. The manifest, when supplied, lets the
|
|
690
|
+
* CLI accept friendly agent ids/aliases and honor a custom route prefix; when
|
|
691
|
+
* the agent isn't found we treat it as a literal route segment (kebab-cased to
|
|
692
|
+
* match the default `routeAgentRequest` behavior) so the CLI also works against
|
|
693
|
+
* an arbitrary deployed worker. The browser-safe URL/query math lives in
|
|
694
|
+
* {@link deriveWsTarget}; this layer only adds manifest awareness.
|
|
695
|
+
*/
|
|
696
|
+
function resolveTarget(input) {
|
|
697
|
+
const topLevel = input.manifest ? findTopLevelAgent(input.manifest, input.agent) : void 0;
|
|
698
|
+
const matchedManifest = topLevel !== void 0;
|
|
699
|
+
const derived = deriveWsTarget({
|
|
700
|
+
agent: topLevel ? topLevel.id : input.agent,
|
|
701
|
+
canonicalAgent: topLevel !== void 0,
|
|
702
|
+
instance: input.instance,
|
|
703
|
+
url: input.url,
|
|
704
|
+
host: input.host,
|
|
705
|
+
protocol: input.protocol,
|
|
706
|
+
token: input.token,
|
|
707
|
+
query: input.query,
|
|
708
|
+
routePrefix: input.routePrefix
|
|
709
|
+
});
|
|
710
|
+
return {
|
|
711
|
+
host: derived.host,
|
|
712
|
+
protocol: derived.protocol,
|
|
713
|
+
basePath: derived.basePath,
|
|
714
|
+
query: derived.query,
|
|
715
|
+
agent: input.agent,
|
|
716
|
+
instance: derived.instance,
|
|
717
|
+
matchedManifest
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
async function loadManifest(root, routePrefix) {
|
|
721
|
+
try {
|
|
722
|
+
return await resolveThinkManifest({ routePrefix }, path.resolve(root ?? process.cwd()));
|
|
723
|
+
} catch {
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
const DEFAULT_CONNECT_TIMEOUT_MS = 15e3;
|
|
728
|
+
/**
|
|
729
|
+
* Resolve once the client receives its identity handshake, or reject after
|
|
730
|
+
* `timeoutMs` (covers unreachable hosts, which otherwise retry silently).
|
|
731
|
+
*/
|
|
732
|
+
function waitForClientReady(client, timeoutMs = DEFAULT_CONNECT_TIMEOUT_MS) {
|
|
733
|
+
return new Promise((resolve, reject) => {
|
|
734
|
+
let settled = false;
|
|
735
|
+
const timer = setTimeout(() => {
|
|
736
|
+
if (settled) return;
|
|
737
|
+
settled = true;
|
|
738
|
+
reject(/* @__PURE__ */ new Error(`Timed out after ${timeoutMs}ms connecting to the agent. Check the host/url, that the dev server or worker is running, and the token.`));
|
|
739
|
+
}, timeoutMs);
|
|
740
|
+
client.ready.then(() => {
|
|
741
|
+
if (settled) return;
|
|
742
|
+
settled = true;
|
|
743
|
+
clearTimeout(timer);
|
|
744
|
+
resolve();
|
|
745
|
+
}, (error) => {
|
|
746
|
+
if (settled) return;
|
|
747
|
+
settled = true;
|
|
748
|
+
clearTimeout(timer);
|
|
749
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
750
|
+
});
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Resolve a target (loading the local manifest when present) and open a
|
|
755
|
+
* connected {@link AgentClient} backed by Node's global `WebSocket`.
|
|
756
|
+
*/
|
|
757
|
+
async function connectToThinkAgent(options) {
|
|
758
|
+
const WebSocketImpl = globalThis.WebSocket;
|
|
759
|
+
if (typeof WebSocketImpl !== "function") throw new Error("No global WebSocket found. The `think` runtime CLI requires Node.js 24+ (which provides a built-in WebSocket).");
|
|
760
|
+
const manifest = await loadManifest(options.root, options.routePrefix);
|
|
761
|
+
const target = resolveTarget({
|
|
762
|
+
...options,
|
|
763
|
+
manifest
|
|
764
|
+
});
|
|
765
|
+
return {
|
|
766
|
+
client: new AgentClient({
|
|
767
|
+
agent: target.agent,
|
|
768
|
+
name: target.instance,
|
|
769
|
+
basePath: target.basePath,
|
|
770
|
+
host: target.host,
|
|
771
|
+
protocol: target.protocol,
|
|
772
|
+
query: target.query,
|
|
773
|
+
WebSocket: WebSocketImpl
|
|
774
|
+
}),
|
|
775
|
+
target
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
//#endregion
|
|
779
|
+
//#region src/cli/state.ts
|
|
780
|
+
const SNAPSHOT_WAIT_MS = 1e3;
|
|
781
|
+
function delay(ms) {
|
|
782
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
783
|
+
}
|
|
784
|
+
function messageText(message) {
|
|
785
|
+
let text = "";
|
|
786
|
+
for (const part of message.parts) if (part.type === "text") text += part.text;
|
|
787
|
+
return text;
|
|
788
|
+
}
|
|
789
|
+
async function stateCommand(options) {
|
|
790
|
+
const { client, target } = await connectToThinkAgent(options);
|
|
791
|
+
const socket = client;
|
|
792
|
+
let messages = [];
|
|
793
|
+
let gotSnapshot = false;
|
|
794
|
+
const listener = (event) => {
|
|
795
|
+
if (typeof event.data !== "string") return;
|
|
796
|
+
let frame;
|
|
797
|
+
try {
|
|
798
|
+
frame = JSON.parse(event.data);
|
|
799
|
+
} catch {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
if (frame.type === CHAT_MESSAGE_TYPES.CHAT_MESSAGES && Array.isArray(frame.messages)) {
|
|
803
|
+
messages = frame.messages;
|
|
804
|
+
gotSnapshot = true;
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
socket.addEventListener("message", listener);
|
|
808
|
+
try {
|
|
809
|
+
await waitForClientReady(client);
|
|
810
|
+
} catch (error) {
|
|
811
|
+
socket.removeEventListener("message", listener);
|
|
812
|
+
client.close();
|
|
813
|
+
throw error;
|
|
814
|
+
}
|
|
815
|
+
const deadline = Date.now() + SNAPSHOT_WAIT_MS;
|
|
816
|
+
while (!gotSnapshot && Date.now() < deadline) await delay(50);
|
|
817
|
+
socket.removeEventListener("message", listener);
|
|
818
|
+
const limit = options.limit ?? 10;
|
|
819
|
+
const recent = limit > 0 ? messages.slice(-limit) : messages;
|
|
820
|
+
if (options.json) {
|
|
821
|
+
console.log(JSON.stringify({
|
|
822
|
+
agent: client.agent,
|
|
823
|
+
name: client.name,
|
|
824
|
+
state: client.state ?? null,
|
|
825
|
+
messages: recent
|
|
826
|
+
}, null, 2));
|
|
827
|
+
client.close();
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
const lines = [
|
|
831
|
+
"Think state",
|
|
832
|
+
`Endpoint: ${target.protocol === "wss" ? "https" : "http"}://${target.host}/${target.basePath}`,
|
|
833
|
+
`Agent: ${client.agent}`,
|
|
834
|
+
`Instance: ${client.name}`,
|
|
835
|
+
"",
|
|
836
|
+
"State:",
|
|
837
|
+
client.state === void 0 ? "- none" : indent(JSON.stringify(client.state, null, 2)),
|
|
838
|
+
"",
|
|
839
|
+
`Recent messages (${recent.length}):`,
|
|
840
|
+
...recent.length === 0 ? ["- none"] : recent.map((message) => {
|
|
841
|
+
const text = messageText(message).trim();
|
|
842
|
+
return `- ${message.role}: ${text || "(no text)"}`;
|
|
843
|
+
})
|
|
844
|
+
];
|
|
845
|
+
console.log(lines.join("\n"));
|
|
846
|
+
client.close();
|
|
847
|
+
}
|
|
848
|
+
function indent(value) {
|
|
849
|
+
return value.split("\n").map((line) => ` ${line}`).join("\n");
|
|
850
|
+
}
|
|
851
|
+
//#endregion
|
|
852
|
+
//#region src/cli/studio-config.ts
|
|
853
|
+
/**
|
|
854
|
+
* Build the `/__studio/config.json` payload from the resolved target and the
|
|
855
|
+
* (optional) local manifest. Pure so it can be unit-tested directly.
|
|
856
|
+
*/
|
|
857
|
+
function buildStudioConfig(input) {
|
|
858
|
+
const agents = (input.manifest?.agents ?? []).filter((entry) => entry.kind === "top-level").map((entry) => ({
|
|
859
|
+
id: entry.id,
|
|
860
|
+
label: entry.bindingName || entry.id
|
|
861
|
+
}));
|
|
862
|
+
return {
|
|
863
|
+
target: input.target,
|
|
864
|
+
agents
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
//#endregion
|
|
868
|
+
//#region src/cli/studio.ts
|
|
869
|
+
const CONTENT_TYPES = {
|
|
870
|
+
".html": "text/html; charset=utf-8",
|
|
871
|
+
".js": "text/javascript; charset=utf-8",
|
|
872
|
+
".mjs": "text/javascript; charset=utf-8",
|
|
873
|
+
".css": "text/css; charset=utf-8",
|
|
874
|
+
".json": "application/json; charset=utf-8",
|
|
875
|
+
".svg": "image/svg+xml",
|
|
876
|
+
".png": "image/png",
|
|
877
|
+
".jpg": "image/jpeg",
|
|
878
|
+
".jpeg": "image/jpeg",
|
|
879
|
+
".gif": "image/gif",
|
|
880
|
+
".ico": "image/x-icon",
|
|
881
|
+
".woff": "font/woff",
|
|
882
|
+
".woff2": "font/woff2",
|
|
883
|
+
".map": "application/json; charset=utf-8"
|
|
884
|
+
};
|
|
885
|
+
function studioDistDir() {
|
|
886
|
+
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../studio");
|
|
887
|
+
}
|
|
888
|
+
async function loadManifestAgents(root, routePrefix) {
|
|
889
|
+
try {
|
|
890
|
+
return await resolveThinkManifest({ routePrefix }, path.resolve(root ?? process.cwd()));
|
|
891
|
+
} catch {
|
|
892
|
+
return null;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
function buildTarget(options) {
|
|
896
|
+
const target = {};
|
|
897
|
+
if (options.url) target.url = options.url;
|
|
898
|
+
if (options.host) target.host = options.host;
|
|
899
|
+
if (options.protocol === "ws" || options.protocol === "wss") target.protocol = options.protocol;
|
|
900
|
+
if (options.token) target.token = options.token;
|
|
901
|
+
if (options.agent) target.agent = options.agent;
|
|
902
|
+
if (options.instance) target.instance = options.instance;
|
|
903
|
+
if (options.routePrefix) target.routePrefix = options.routePrefix;
|
|
904
|
+
return target;
|
|
905
|
+
}
|
|
906
|
+
function openBrowser(url) {
|
|
907
|
+
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
908
|
+
try {
|
|
909
|
+
const child = spawn(command, [url], {
|
|
910
|
+
stdio: "ignore",
|
|
911
|
+
detached: true,
|
|
912
|
+
shell: process.platform === "win32"
|
|
913
|
+
});
|
|
914
|
+
child.on("error", () => {});
|
|
915
|
+
child.unref();
|
|
916
|
+
} catch {}
|
|
917
|
+
}
|
|
918
|
+
/** Resolve a file under `root`, guarding against path traversal. */
|
|
919
|
+
function safeResolve(root, urlPath) {
|
|
920
|
+
let decoded;
|
|
921
|
+
try {
|
|
922
|
+
decoded = decodeURIComponent(urlPath.split("?")[0]);
|
|
923
|
+
} catch {
|
|
924
|
+
return null;
|
|
925
|
+
}
|
|
926
|
+
const resolved = path.resolve(root, `.${decoded}`);
|
|
927
|
+
if (resolved !== root && !resolved.startsWith(root + path.sep)) return null;
|
|
928
|
+
return resolved;
|
|
929
|
+
}
|
|
930
|
+
async function studioCommand(options) {
|
|
931
|
+
const distDir = studioDistDir();
|
|
932
|
+
try {
|
|
933
|
+
await stat(path.join(distDir, "index.html"));
|
|
934
|
+
} catch {
|
|
935
|
+
throw new Error(`Think Studio assets were not found at ${distDir}. Reinstall @cloudflare/think (the published package ships the prebuilt Studio), or run the package build.`);
|
|
936
|
+
}
|
|
937
|
+
const manifest = await loadManifestAgents(options.root, options.routePrefix);
|
|
938
|
+
const config = buildStudioConfig({
|
|
939
|
+
target: buildTarget(options),
|
|
940
|
+
manifest
|
|
941
|
+
});
|
|
942
|
+
const configJson = JSON.stringify(config);
|
|
943
|
+
const server = createServer((req, res) => {
|
|
944
|
+
const urlPath = req.url ?? "/";
|
|
945
|
+
if (urlPath === "/__studio/config.json") {
|
|
946
|
+
res.writeHead(200, {
|
|
947
|
+
"content-type": "application/json; charset=utf-8",
|
|
948
|
+
"cache-control": "no-store"
|
|
949
|
+
});
|
|
950
|
+
res.end(configJson);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
const rawPath = urlPath.split("?")[0];
|
|
954
|
+
const candidate = rawPath === "/" ? path.join(distDir, "index.html") : safeResolve(distDir, rawPath);
|
|
955
|
+
const serve = (filePath) => {
|
|
956
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
957
|
+
const stream = createReadStream(filePath);
|
|
958
|
+
stream.on("error", () => {
|
|
959
|
+
if (res.headersSent) res.destroy();
|
|
960
|
+
else {
|
|
961
|
+
res.writeHead(500);
|
|
962
|
+
res.end("Internal error");
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
stream.once("open", () => {
|
|
966
|
+
res.writeHead(200, { "content-type": CONTENT_TYPES[ext] ?? "application/octet-stream" });
|
|
967
|
+
stream.pipe(res);
|
|
968
|
+
});
|
|
969
|
+
};
|
|
970
|
+
if (!candidate) {
|
|
971
|
+
res.writeHead(404);
|
|
972
|
+
res.end("Not found");
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
stat(candidate).then((s) => {
|
|
976
|
+
if (s.isFile()) serve(candidate);
|
|
977
|
+
else serve(path.join(distDir, "index.html"));
|
|
978
|
+
}).catch(() => serve(path.join(distDir, "index.html")));
|
|
979
|
+
});
|
|
980
|
+
const studioUrl = `http://localhost:${await listen(server, options.port ?? 4321)}/`;
|
|
981
|
+
console.log(`Think Studio running at ${studioUrl}`);
|
|
982
|
+
console.log("Press Ctrl+C to stop.");
|
|
983
|
+
if (options.open !== false) openBrowser(studioUrl);
|
|
984
|
+
await new Promise((resolve) => {
|
|
985
|
+
const shutdown = () => {
|
|
986
|
+
server.close(() => resolve());
|
|
987
|
+
};
|
|
988
|
+
process.once("SIGINT", shutdown);
|
|
989
|
+
process.once("SIGTERM", shutdown);
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
/** Listen on `startPort`, advancing on EADDRINUSE up to 20 ports. */
|
|
993
|
+
function listen(server, startPort) {
|
|
994
|
+
return new Promise((resolve, reject) => {
|
|
995
|
+
let attempt = 0;
|
|
996
|
+
const tryPort = (port) => {
|
|
997
|
+
const onError = (err) => {
|
|
998
|
+
if (err.code === "EADDRINUSE" && attempt < 20) {
|
|
999
|
+
attempt += 1;
|
|
1000
|
+
tryPort(port + 1);
|
|
1001
|
+
} else reject(err);
|
|
1002
|
+
};
|
|
1003
|
+
server.once("error", onError);
|
|
1004
|
+
server.listen(port, "127.0.0.1", () => {
|
|
1005
|
+
server.removeListener("error", onError);
|
|
1006
|
+
const address = server.address();
|
|
1007
|
+
resolve(typeof address === "object" && address ? address.port : port);
|
|
1008
|
+
});
|
|
1009
|
+
};
|
|
1010
|
+
tryPort(startPort);
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
//#endregion
|
|
429
1014
|
//#region src/cli/types.ts
|
|
430
1015
|
async function typesCommand(options) {
|
|
431
1016
|
const root = path.resolve(options.root ?? process.cwd());
|
|
@@ -464,7 +1049,7 @@ async function findStaleFiles(root, files) {
|
|
|
464
1049
|
const stale = [];
|
|
465
1050
|
for (const file of files) {
|
|
466
1051
|
const expected = await expectedFileContent(root, file);
|
|
467
|
-
if (await readTextIfExists(path.join(root, file.path)) !== expected) stale.push(file.path);
|
|
1052
|
+
if (await readTextIfExists$1(path.join(root, file.path)) !== expected) stale.push(file.path);
|
|
468
1053
|
}
|
|
469
1054
|
return stale;
|
|
470
1055
|
}
|
|
@@ -475,11 +1060,11 @@ async function writeGeneratedFile(root, file) {
|
|
|
475
1060
|
await writeFile(absolute, expected, "utf8");
|
|
476
1061
|
}
|
|
477
1062
|
async function expectedFileContent(root, file) {
|
|
478
|
-
const current = await readTextIfExists(path.join(root, file.path));
|
|
1063
|
+
const current = await readTextIfExists$1(path.join(root, file.path));
|
|
479
1064
|
if (current && !isThinkGeneratedFile(current)) throw new Error(`${file.path} already exists and is not Think-generated; pass a different output path or replace it with a Think-generated file.`);
|
|
480
1065
|
return file.content;
|
|
481
1066
|
}
|
|
482
|
-
async function readTextIfExists(file) {
|
|
1067
|
+
async function readTextIfExists$1(file) {
|
|
483
1068
|
try {
|
|
484
1069
|
return await readFile(file, "utf8");
|
|
485
1070
|
} catch (error) {
|
|
@@ -533,6 +1118,40 @@ function isMissingFileError(error) {
|
|
|
533
1118
|
}
|
|
534
1119
|
//#endregion
|
|
535
1120
|
//#region src/cli/create.ts
|
|
1121
|
+
function connectionOptions(cmd) {
|
|
1122
|
+
return cmd.positional("agent", {
|
|
1123
|
+
type: "string",
|
|
1124
|
+
describe: "Agent id/alias (from the manifest) or a raw route segment"
|
|
1125
|
+
}).positional("instance", {
|
|
1126
|
+
type: "string",
|
|
1127
|
+
describe: "Agent instance name",
|
|
1128
|
+
default: "default"
|
|
1129
|
+
}).option("url", {
|
|
1130
|
+
type: "string",
|
|
1131
|
+
describe: "Remote origin, e.g. https://app.example.com (implies wss)"
|
|
1132
|
+
}).option("host", {
|
|
1133
|
+
type: "string",
|
|
1134
|
+
describe: "Local host[:port] (default: localhost:5173)"
|
|
1135
|
+
}).option("protocol", {
|
|
1136
|
+
type: "string",
|
|
1137
|
+
choices: ["ws", "wss"],
|
|
1138
|
+
describe: "Override the WebSocket protocol"
|
|
1139
|
+
}).option("token", {
|
|
1140
|
+
type: "string",
|
|
1141
|
+
describe: "Auth token, sent as the `token` query param"
|
|
1142
|
+
}).option("query", {
|
|
1143
|
+
type: "string",
|
|
1144
|
+
array: true,
|
|
1145
|
+
describe: "Extra query params as key=value (repeatable)"
|
|
1146
|
+
}).option("root", {
|
|
1147
|
+
type: "string",
|
|
1148
|
+
describe: "Project root used to discover the Think manifest",
|
|
1149
|
+
default: process.cwd()
|
|
1150
|
+
}).option("route-prefix", {
|
|
1151
|
+
type: "string",
|
|
1152
|
+
describe: "Override the Think route prefix"
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
536
1155
|
function createCli(argv = process.argv) {
|
|
537
1156
|
return yargs(hideBin(argv)).parserConfiguration({ "populate--": true }).scriptName("think").usage("$0 <command> [options]").command("init [directory]", "Scaffold a new Think app from a starter template, or add Think to the current project", (cmd) => cmd.positional("directory", {
|
|
538
1157
|
type: "string",
|
|
@@ -546,7 +1165,7 @@ function createCli(argv = process.argv) {
|
|
|
546
1165
|
describe: "Package and Worker name for the generated app"
|
|
547
1166
|
}).option("template", {
|
|
548
1167
|
type: "string",
|
|
549
|
-
describe: "Starter template to scaffold (
|
|
1168
|
+
describe: "Starter template to scaffold (omit to choose)"
|
|
550
1169
|
}).option("ref", {
|
|
551
1170
|
type: "string",
|
|
552
1171
|
describe: "Git ref to fetch remote templates from"
|
|
@@ -638,6 +1257,50 @@ function createCli(argv = process.argv) {
|
|
|
638
1257
|
check: args.check,
|
|
639
1258
|
wranglerArgs: Array.isArray(args["--"]) ? args["--"].map(String) : []
|
|
640
1259
|
});
|
|
1260
|
+
}).command("studio [agent] [instance]", "Launch Think Studio — a local web app to chat with and inspect a running Think instance (local or remote)", (cmd) => connectionOptions(cmd).option("port", {
|
|
1261
|
+
type: "number",
|
|
1262
|
+
describe: "Port for the local Studio server",
|
|
1263
|
+
default: 4321
|
|
1264
|
+
}).option("open", {
|
|
1265
|
+
type: "boolean",
|
|
1266
|
+
describe: "Open the browser automatically",
|
|
1267
|
+
default: true
|
|
1268
|
+
}), async (args) => {
|
|
1269
|
+
await studioCommand({
|
|
1270
|
+
agent: args.agent,
|
|
1271
|
+
instance: args.instance,
|
|
1272
|
+
url: args.url,
|
|
1273
|
+
host: args.host,
|
|
1274
|
+
protocol: args.protocol,
|
|
1275
|
+
token: args.token,
|
|
1276
|
+
query: args.query,
|
|
1277
|
+
root: args.root,
|
|
1278
|
+
routePrefix: args.routePrefix,
|
|
1279
|
+
port: args.port,
|
|
1280
|
+
open: args.open
|
|
1281
|
+
});
|
|
1282
|
+
}).command("state <agent> [instance]", "Print a running Think agent's identity, state, and recent history (read-only)", (cmd) => connectionOptions(cmd).option("json", {
|
|
1283
|
+
type: "boolean",
|
|
1284
|
+
describe: "Print machine-readable JSON output",
|
|
1285
|
+
default: false
|
|
1286
|
+
}).option("limit", {
|
|
1287
|
+
type: "number",
|
|
1288
|
+
describe: "Number of recent messages to include",
|
|
1289
|
+
default: 10
|
|
1290
|
+
}), async (args) => {
|
|
1291
|
+
await stateCommand({
|
|
1292
|
+
agent: args.agent,
|
|
1293
|
+
instance: args.instance,
|
|
1294
|
+
url: args.url,
|
|
1295
|
+
host: args.host,
|
|
1296
|
+
protocol: args.protocol,
|
|
1297
|
+
token: args.token,
|
|
1298
|
+
query: args.query,
|
|
1299
|
+
root: args.root,
|
|
1300
|
+
routePrefix: args.routePrefix,
|
|
1301
|
+
json: args.json,
|
|
1302
|
+
limit: args.limit
|
|
1303
|
+
});
|
|
641
1304
|
}).demandCommand(1, "Please provide a command").strict().help();
|
|
642
1305
|
}
|
|
643
1306
|
//#endregion
|