miko-code 0.1.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/LICENSE +21 -0
- package/README.md +179 -0
- package/bin/miko +10 -0
- package/dist/client/antigravity.webp +0 -0
- package/dist/client/assets/abap-BdImnpbu.js +1 -0
- package/dist/client/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/dist/client/assets/ada-bCR0ucgS.js +1 -0
- package/dist/client/assets/andromeeda-C4gqWexZ.js +1 -0
- package/dist/client/assets/angular-html-CU67Zn6k.js +1 -0
- package/dist/client/assets/angular-ts-BwZT4LLn.js +1 -0
- package/dist/client/assets/apache-Pmp26Uib.js +1 -0
- package/dist/client/assets/apex-D8_7TLub.js +1 -0
- package/dist/client/assets/apl-dKokRX4l.js +1 -0
- package/dist/client/assets/applescript-Co6uUVPk.js +1 -0
- package/dist/client/assets/ara-BRHolxvo.js +1 -0
- package/dist/client/assets/asciidoc-Ve4PFQV2.js +1 -0
- package/dist/client/assets/asm-D_Q5rh1f.js +1 -0
- package/dist/client/assets/astro-CbQHKStN.js +1 -0
- package/dist/client/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/dist/client/assets/awk-DMzUqQB5.js +1 -0
- package/dist/client/assets/ayu-dark-DYE7WIF3.js +1 -0
- package/dist/client/assets/ayu-light-BA47KaF1.js +1 -0
- package/dist/client/assets/ayu-mirage-32ctXXKs.js +1 -0
- package/dist/client/assets/ballerina-BFfxhgS-.js +1 -0
- package/dist/client/assets/bat-BkioyH1T.js +1 -0
- package/dist/client/assets/beancount-k_qm7-4y.js +1 -0
- package/dist/client/assets/berry-uYugtg8r.js +1 -0
- package/dist/client/assets/bibtex-CHM0blh-.js +1 -0
- package/dist/client/assets/bicep-Bmn6On1c.js +1 -0
- package/dist/client/assets/bird2-DPOp833l.js +1 -0
- package/dist/client/assets/blade-D4QpJJKB.js +1 -0
- package/dist/client/assets/bsl-BO_Y6i37.js +1 -0
- package/dist/client/assets/c-BIGW1oBm.js +1 -0
- package/dist/client/assets/c3-eo99z4R2.js +1 -0
- package/dist/client/assets/cadence-Bv_4Rxtq.js +1 -0
- package/dist/client/assets/cairo-KRGpt6FW.js +1 -0
- package/dist/client/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/dist/client/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/dist/client/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/dist/client/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/dist/client/assets/clarity-D53aC0YG.js +1 -0
- package/dist/client/assets/clojure-P80f7IUj.js +1 -0
- package/dist/client/assets/cmake-D1j8_8rp.js +1 -0
- package/dist/client/assets/cobol-nwyudZeR.js +1 -0
- package/dist/client/assets/codeowners-Bp6g37R7.js +1 -0
- package/dist/client/assets/codeql-DsOJ9woJ.js +1 -0
- package/dist/client/assets/coffee-Ch7k5sss.js +1 -0
- package/dist/client/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/dist/client/assets/coq-DkFqJrB1.js +1 -0
- package/dist/client/assets/cpp-CofmeUqb.js +1 -0
- package/dist/client/assets/crystal-tKQVLTB8.js +1 -0
- package/dist/client/assets/csharp-COcwbKMJ.js +1 -0
- package/dist/client/assets/css-DPfMkruS.js +1 -0
- package/dist/client/assets/csv-fuZLfV_i.js +1 -0
- package/dist/client/assets/cue-D82EKSYY.js +1 -0
- package/dist/client/assets/cypher-COkxafJQ.js +1 -0
- package/dist/client/assets/d-85-TOEBH.js +1 -0
- package/dist/client/assets/dark-plus-C3mMm8J8.js +1 -0
- package/dist/client/assets/dart-CF10PKvl.js +1 -0
- package/dist/client/assets/dax-CEL-wOlO.js +1 -0
- package/dist/client/assets/desktop-BmXAJ9_W.js +1 -0
- package/dist/client/assets/diff-D97Zzqfu.js +1 -0
- package/dist/client/assets/docker-BcOcwvcX.js +1 -0
- package/dist/client/assets/dotenv-Da5cRb03.js +1 -0
- package/dist/client/assets/dracula-BzJJZx-M.js +1 -0
- package/dist/client/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/dist/client/assets/dream-maker-BtqSS_iP.js +1 -0
- package/dist/client/assets/edge-BkV0erSs.js +1 -0
- package/dist/client/assets/elixir-CDX3lj18.js +1 -0
- package/dist/client/assets/elm-DbKCFpqz.js +1 -0
- package/dist/client/assets/emacs-lisp-C9XAeP06.js +1 -0
- package/dist/client/assets/erb-B12qg9BL.js +1 -0
- package/dist/client/assets/erlang-DsQrWhSR.js +1 -0
- package/dist/client/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/dist/client/assets/everforest-light-C8M2exoo.js +1 -0
- package/dist/client/assets/fennel-BYunw83y.js +1 -0
- package/dist/client/assets/fish-BvzEVeQv.js +1 -0
- package/dist/client/assets/fluent-C4IJs8-o.js +1 -0
- package/dist/client/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/dist/client/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/dist/client/assets/fsharp-CXgrBDvD.js +1 -0
- package/dist/client/assets/gdresource-BOOCDP_w.js +1 -0
- package/dist/client/assets/gdscript-C5YyOfLZ.js +1 -0
- package/dist/client/assets/gdshader-DkwncUOv.js +1 -0
- package/dist/client/assets/genie-D0YGMca9.js +1 -0
- package/dist/client/assets/gherkin-DyxjwDmM.js +1 -0
- package/dist/client/assets/git-commit-F4YmCXRG.js +1 -0
- package/dist/client/assets/git-rebase-r7XF79zn.js +1 -0
- package/dist/client/assets/github-dark-DHJKELXO.js +1 -0
- package/dist/client/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/dist/client/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/dist/client/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/dist/client/assets/github-light-DAi9KRSo.js +1 -0
- package/dist/client/assets/github-light-default-D7oLnXFd.js +1 -0
- package/dist/client/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/dist/client/assets/gleam-BspZqrRM.js +1 -0
- package/dist/client/assets/glimmer-js-Rg0-pVw9.js +1 -0
- package/dist/client/assets/glimmer-ts-U6CK756n.js +1 -0
- package/dist/client/assets/glsl-DplSGwfg.js +1 -0
- package/dist/client/assets/gn-n2N0HUVH.js +1 -0
- package/dist/client/assets/gnuplot-DdkO51Og.js +1 -0
- package/dist/client/assets/go-CxLEBnE3.js +1 -0
- package/dist/client/assets/graphql-ChdNCCLP.js +1 -0
- package/dist/client/assets/groovy-gcz8RCvz.js +1 -0
- package/dist/client/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/dist/client/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/dist/client/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/dist/client/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/dist/client/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/dist/client/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/dist/client/assets/hack-CaT9iCJl.js +1 -0
- package/dist/client/assets/haml-B8DHNrY2.js +1 -0
- package/dist/client/assets/handlebars-BL8al0AC.js +1 -0
- package/dist/client/assets/haskell-Df6bDoY_.js +1 -0
- package/dist/client/assets/haxe-CzTSHFRz.js +1 -0
- package/dist/client/assets/hcl-BWvSN4gD.js +1 -0
- package/dist/client/assets/hjson-D5-asLiD.js +1 -0
- package/dist/client/assets/hlsl-D3lLCCz7.js +1 -0
- package/dist/client/assets/horizon-BUw7H-hv.js +1 -0
- package/dist/client/assets/horizon-bright-Cn-bp-IR.js +1 -0
- package/dist/client/assets/houston-DnULxvSX.js +1 -0
- package/dist/client/assets/html-GMplVEZG.js +1 -0
- package/dist/client/assets/html-derivative-BFtXZ54Q.js +1 -0
- package/dist/client/assets/http-jrhK8wxY.js +1 -0
- package/dist/client/assets/hurl-irOxFIW8.js +1 -0
- package/dist/client/assets/hxml-Bvhsp5Yf.js +1 -0
- package/dist/client/assets/hy-DFXneXwc.js +1 -0
- package/dist/client/assets/imba-DGztddWO.js +1 -0
- package/dist/client/assets/index-C07zYq_-.css +32 -0
- package/dist/client/assets/index-Ce3hNHfL.js +2351 -0
- package/dist/client/assets/ini-BEwlwnbL.js +1 -0
- package/dist/client/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/client/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/client/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/client/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/client/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/client/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/client/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/client/assets/java-CylS5w8V.js +1 -0
- package/dist/client/assets/javascript-wDzz0qaB.js +1 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/client/assets/jinja-4LBKfQ-Z.js +1 -0
- package/dist/client/assets/jison-wvAkD_A8.js +1 -0
- package/dist/client/assets/json-Cp-IABpG.js +1 -0
- package/dist/client/assets/json5-C9tS-k6U.js +1 -0
- package/dist/client/assets/jsonc-Des-eS-w.js +1 -0
- package/dist/client/assets/jsonl-DcaNXYhu.js +1 -0
- package/dist/client/assets/jsonnet-DFQXde-d.js +1 -0
- package/dist/client/assets/jssm-C2t-YnRu.js +1 -0
- package/dist/client/assets/jsx-g9-lgVsj.js +1 -0
- package/dist/client/assets/julia-CxzCAyBv.js +1 -0
- package/dist/client/assets/just-Cw27pwNe.js +1 -0
- package/dist/client/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/dist/client/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/dist/client/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/dist/client/assets/kdl-DV7GczEv.js +1 -0
- package/dist/client/assets/kotlin-BdnUsdx6.js +1 -0
- package/dist/client/assets/kusto-DZf3V79B.js +1 -0
- package/dist/client/assets/laserwave-DUszq2jm.js +1 -0
- package/dist/client/assets/latex-CWtU0Tv5.js +1 -0
- package/dist/client/assets/lean-BZvkOJ9d.js +1 -0
- package/dist/client/assets/less-B1dDrJ26.js +1 -0
- package/dist/client/assets/light-plus-B7mTdjB0.js +1 -0
- package/dist/client/assets/liquid-DYVedYrR.js +1 -0
- package/dist/client/assets/llvm-DjAJT7YJ.js +1 -0
- package/dist/client/assets/log-2UxHyX5q.js +1 -0
- package/dist/client/assets/logo-BtOb2qkB.js +1 -0
- package/dist/client/assets/lua-BaeVxFsk.js +1 -0
- package/dist/client/assets/luau-C-HG3fhB.js +1 -0
- package/dist/client/assets/make-CHLpvVh8.js +1 -0
- package/dist/client/assets/markdown-Cvjx9yec.js +1 -0
- package/dist/client/assets/marko-CnJfTvn9.js +1 -0
- package/dist/client/assets/material-theme-D5KoaKCx.js +1 -0
- package/dist/client/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/dist/client/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/dist/client/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/dist/client/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/dist/client/assets/matlab-D7o27uSR.js +1 -0
- package/dist/client/assets/mdc-BMNejdWA.js +1 -0
- package/dist/client/assets/mdx-Cmh6b_Ma.js +1 -0
- package/dist/client/assets/mermaid-mWjccvbQ.js +1 -0
- package/dist/client/assets/min-dark-CafNBF8u.js +1 -0
- package/dist/client/assets/min-light-CTRr51gU.js +1 -0
- package/dist/client/assets/mipsasm-CKIfxQSi.js +1 -0
- package/dist/client/assets/mojo-rZm6bMo-.js +1 -0
- package/dist/client/assets/monokai-D4h5O-jR.js +1 -0
- package/dist/client/assets/moonbit-_H4v1dQx.js +1 -0
- package/dist/client/assets/move-IF9eRakj.js +1 -0
- package/dist/client/assets/narrat-DRg8JJMk.js +1 -0
- package/dist/client/assets/nextflow-Zz6hmt5N.js +1 -0
- package/dist/client/assets/nextflow-groovy-BeH2EWoN.js +1 -0
- package/dist/client/assets/nginx-BpAMiNFr.js +1 -0
- package/dist/client/assets/night-owl-C39BiMTA.js +1 -0
- package/dist/client/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/dist/client/assets/nim-CVrawwO9.js +1 -0
- package/dist/client/assets/nix-CwoSXNpI.js +1 -0
- package/dist/client/assets/nord-Ddv68eIx.js +1 -0
- package/dist/client/assets/nushell-Cz2AlsmD.js +1 -0
- package/dist/client/assets/objective-c-DXmwc3jG.js +1 -0
- package/dist/client/assets/objective-cpp-CLxacb5B.js +1 -0
- package/dist/client/assets/ocaml-C0hk2d4L.js +1 -0
- package/dist/client/assets/odin-BBf5iR-q.js +1 -0
- package/dist/client/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/dist/client/assets/one-light-C3Wv6jpd.js +1 -0
- package/dist/client/assets/openscad-C4EeE6gA.js +1 -0
- package/dist/client/assets/pascal-D93ZcfNL.js +1 -0
- package/dist/client/assets/perl-C0TMdlhV.js +1 -0
- package/dist/client/assets/php-Dhbhpdrm.js +1 -0
- package/dist/client/assets/pierre-dark-DF2SEV7i.js +1 -0
- package/dist/client/assets/pierre-light-DOlZxES8.js +1 -0
- package/dist/client/assets/pkl-u5AG7uiY.js +1 -0
- package/dist/client/assets/plastic-3e1v2bzS.js +1 -0
- package/dist/client/assets/plsql-ChMvpjG-.js +1 -0
- package/dist/client/assets/po-BTJTHyun.js +1 -0
- package/dist/client/assets/poimandres-CS3Unz2-.js +1 -0
- package/dist/client/assets/polar-C0HS_06l.js +1 -0
- package/dist/client/assets/postcss-CXtECtnM.js +1 -0
- package/dist/client/assets/powerquery-CEu0bR-o.js +1 -0
- package/dist/client/assets/powershell-Dpen1YoG.js +1 -0
- package/dist/client/assets/prisma-Dd19v3D-.js +1 -0
- package/dist/client/assets/prolog-CbFg5uaA.js +1 -0
- package/dist/client/assets/proto-C7zT0LnQ.js +1 -0
- package/dist/client/assets/pug-CGlum2m_.js +1 -0
- package/dist/client/assets/puppet-BMWR74SV.js +1 -0
- package/dist/client/assets/purescript-CklMAg4u.js +1 -0
- package/dist/client/assets/python-B6aJPvgy.js +1 -0
- package/dist/client/assets/qml-3beO22l8.js +1 -0
- package/dist/client/assets/qmldir-C8lEn-DE.js +1 -0
- package/dist/client/assets/qss-IeuSbFQv.js +1 -0
- package/dist/client/assets/r-Dspwwk_N.js +1 -0
- package/dist/client/assets/racket-BqYA7rlc.js +1 -0
- package/dist/client/assets/raku-DXvB9xmW.js +1 -0
- package/dist/client/assets/razor-Uh8Bk_45.js +1 -0
- package/dist/client/assets/red-bN70gL4F.js +1 -0
- package/dist/client/assets/reg-C-SQnVFl.js +1 -0
- package/dist/client/assets/regexp-CDVJQ6XC.js +1 -0
- package/dist/client/assets/rel-C3B-1QV4.js +1 -0
- package/dist/client/assets/riscv-BM1_JUlF.js +1 -0
- package/dist/client/assets/ron-D8l8udqQ.js +1 -0
- package/dist/client/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/dist/client/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/dist/client/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/dist/client/assets/rosmsg-BJDFO7_C.js +1 -0
- package/dist/client/assets/rst-BrH8l1NY.js +1 -0
- package/dist/client/assets/ruby-Dw2BHqvy.js +1 -0
- package/dist/client/assets/rust-B1yitclQ.js +1 -0
- package/dist/client/assets/sas-cz2c8ADy.js +1 -0
- package/dist/client/assets/sass-Cj5Yp3dK.js +1 -0
- package/dist/client/assets/scala-C151Ov-r.js +1 -0
- package/dist/client/assets/scheme-C98Dy4si.js +1 -0
- package/dist/client/assets/scratchpad-page-DcMny6uZ.js +1 -0
- package/dist/client/assets/scss-OYdSNvt2.js +1 -0
- package/dist/client/assets/sdbl-DVxCFoDh.js +1 -0
- package/dist/client/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/dist/client/assets/shellscript-Yzrsuije.js +1 -0
- package/dist/client/assets/shellsession-BADoaaVG.js +1 -0
- package/dist/client/assets/slack-dark-BthQWCQV.js +1 -0
- package/dist/client/assets/slack-ochin-DqwNpetd.js +1 -0
- package/dist/client/assets/smalltalk-BERRCDM3.js +1 -0
- package/dist/client/assets/snazzy-light-Bw305WKR.js +1 -0
- package/dist/client/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/dist/client/assets/solarized-light-L9t79GZl.js +1 -0
- package/dist/client/assets/solidity-rGO070M0.js +1 -0
- package/dist/client/assets/soy-Brmx7dQM.js +1 -0
- package/dist/client/assets/sparql-rVzFXLq3.js +1 -0
- package/dist/client/assets/splunk-BtCnVYZw.js +1 -0
- package/dist/client/assets/sql-BLtJtn59.js +1 -0
- package/dist/client/assets/ssh-config-_ykCGR6B.js +1 -0
- package/dist/client/assets/stata-BH5u7GGu.js +1 -0
- package/dist/client/assets/stylus-BEDo0Tqx.js +1 -0
- package/dist/client/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/dist/client/assets/svelte-C_ipcX3V.js +1 -0
- package/dist/client/assets/swift-D82vCrfD.js +1 -0
- package/dist/client/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/dist/client/assets/system-verilog-CnnmHF94.js +1 -0
- package/dist/client/assets/systemd-4A_iFExJ.js +1 -0
- package/dist/client/assets/talonscript-CkByrt1z.js +1 -0
- package/dist/client/assets/tasl-QIJgUcNo.js +1 -0
- package/dist/client/assets/tcl-dwOrl1Do.js +1 -0
- package/dist/client/assets/templ-P3uqSqPl.js +1 -0
- package/dist/client/assets/terraform-BETggiCN.js +1 -0
- package/dist/client/assets/tex-idrVyKtj.js +1 -0
- package/dist/client/assets/tokyo-night-hegEt444.js +1 -0
- package/dist/client/assets/toml-vGWfd6FD.js +1 -0
- package/dist/client/assets/ts-tags-zn1MmPIZ.js +1 -0
- package/dist/client/assets/tsv-B_m7g4N7.js +1 -0
- package/dist/client/assets/tsx-COt5Ahok.js +1 -0
- package/dist/client/assets/turtle-BsS91CYL.js +1 -0
- package/dist/client/assets/twig-DNn4PbVi.js +1 -0
- package/dist/client/assets/typescript-BPQ3VLAy.js +1 -0
- package/dist/client/assets/typespec-BGHnOYBU.js +1 -0
- package/dist/client/assets/typst-DHCkPAjA.js +1 -0
- package/dist/client/assets/v-BcVCzyr7.js +1 -0
- package/dist/client/assets/vala-CsfeWuGM.js +1 -0
- package/dist/client/assets/vb-D17OF-Vu.js +1 -0
- package/dist/client/assets/verilog-BQ8w6xss.js +1 -0
- package/dist/client/assets/vesper-DU1UobuO.js +1 -0
- package/dist/client/assets/vhdl-CeAyd5Ju.js +1 -0
- package/dist/client/assets/viml-CJc9bBzg.js +1 -0
- package/dist/client/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/dist/client/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/dist/client/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/dist/client/assets/vue-DN_0RTcg.js +1 -0
- package/dist/client/assets/vue-html-AaS7Mt5G.js +1 -0
- package/dist/client/assets/vue-vine-CQOfvN7w.js +1 -0
- package/dist/client/assets/vyper-CDx5xZoG.js +1 -0
- package/dist/client/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/client/assets/wasm-MzD3tlZU.js +1 -0
- package/dist/client/assets/wenyan-BV7otONQ.js +1 -0
- package/dist/client/assets/wgsl-Dx-B1_4e.js +1 -0
- package/dist/client/assets/wikitext-BhOHFoWU.js +1 -0
- package/dist/client/assets/wit-5i3qLPDT.js +1 -0
- package/dist/client/assets/wolfram-lXgVvXCa.js +1 -0
- package/dist/client/assets/xml-sdJ4AIDG.js +1 -0
- package/dist/client/assets/xsl-CtQFsRM5.js +1 -0
- package/dist/client/assets/yaml-Buea-lGh.js +1 -0
- package/dist/client/assets/zenscript-DVFEvuxE.js +1 -0
- package/dist/client/assets/zig-VOosw3JB.js +1 -0
- package/dist/client/cursor.png +0 -0
- package/dist/client/favicon.svg +17 -0
- package/dist/client/finder.png +0 -0
- package/dist/client/icons/claude.svg +1 -0
- package/dist/client/icons/openai.svg +1 -0
- package/dist/client/images/github.png +0 -0
- package/dist/client/index.html +15 -0
- package/dist/client/logo.svg +17 -0
- package/dist/client/terminal.png +0 -0
- package/dist/client/vscode.png +0 -0
- package/dist/client/warp.png +0 -0
- package/package.json +107 -0
- package/src/server/agent-instruction-attachments.ts +458 -0
- package/src/server/agent.ts +1879 -0
- package/src/server/cli-runtime.ts +418 -0
- package/src/server/cli-supervisor.ts +90 -0
- package/src/server/cli.ts +102 -0
- package/src/server/codex-app-server-protocol.ts +478 -0
- package/src/server/codex-app-server.ts +1645 -0
- package/src/server/data-dir-lock.ts +128 -0
- package/src/server/diff-store.ts +1587 -0
- package/src/server/durable-file.ts +74 -0
- package/src/server/event-store.ts +1448 -0
- package/src/server/event.ts +249 -0
- package/src/server/external-file-access.ts +48 -0
- package/src/server/external-open.ts +259 -0
- package/src/server/generate-title.ts +75 -0
- package/src/server/git-refresh-poller.ts +92 -0
- package/src/server/github-rest-client.ts +176 -0
- package/src/server/harness-types.ts +24 -0
- package/src/server/keybindings.ts +203 -0
- package/src/server/machine-name.ts +22 -0
- package/src/server/paths.ts +51 -0
- package/src/server/pr-manager.ts +1204 -0
- package/src/server/pr-refresh-poller.ts +126 -0
- package/src/server/process-utils.ts +18 -0
- package/src/server/provider-catalog.ts +90 -0
- package/src/server/quick-response.ts +274 -0
- package/src/server/read-models.ts +311 -0
- package/src/server/restart.ts +33 -0
- package/src/server/scratchpad-manager.ts +87 -0
- package/src/server/server.ts +759 -0
- package/src/server/share.ts +126 -0
- package/src/server/terminal-manager.ts +371 -0
- package/src/server/update-manager.ts +250 -0
- package/src/server/uploads.ts +191 -0
- package/src/server/workspace-file-search.ts +191 -0
- package/src/server/workspace-manager.ts +627 -0
- package/src/server/workspace-polling.ts +10 -0
- package/src/server/ws-router.ts +1039 -0
- package/src/shared/branding.ts +69 -0
- package/src/shared/dev-ports.ts +100 -0
- package/src/shared/ports.ts +2 -0
- package/src/shared/protocol.ts +217 -0
- package/src/shared/tools.ts +324 -0
- package/src/shared/types.ts +1220 -0
- package/tsconfig.json +35 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const APP_NAME = 'Miko';
|
|
2
|
+
export const CLI_COMMAND = 'miko';
|
|
3
|
+
export const DATA_ROOT_NAME = '.miko';
|
|
4
|
+
export const DEV_DATA_ROOT_NAME = '.miko-dev';
|
|
5
|
+
export const PACKAGE_NAME = 'miko-code';
|
|
6
|
+
export const RUNTIME_PROFILE_ENV_VAR = 'MIKO_RUNTIME_PROFILE';
|
|
7
|
+
|
|
8
|
+
// Read version from package.json - JSON import works in both Bun and Vite
|
|
9
|
+
import pkg from '../../package.json';
|
|
10
|
+
export const SDK_CLIENT_APP = `miko/${pkg.version}`;
|
|
11
|
+
export const LOG_PREFIX = '[miko]';
|
|
12
|
+
export const DEFAULT_NEW_PROJECT_ROOT = `~/${APP_NAME}`;
|
|
13
|
+
|
|
14
|
+
export type RuntimeProfile = 'dev' | 'prod';
|
|
15
|
+
|
|
16
|
+
type RuntimeEnv = Record<string, string | undefined> | undefined;
|
|
17
|
+
|
|
18
|
+
function getRuntimeEnv(): RuntimeEnv {
|
|
19
|
+
const candidate = globalThis as typeof globalThis & {
|
|
20
|
+
process?: {
|
|
21
|
+
env?: Record<string, string | undefined>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
return candidate.process.env;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getRuntimeProfile(env: RuntimeEnv = getRuntimeEnv()): RuntimeProfile {
|
|
28
|
+
return env?.[RUNTIME_PROFILE_ENV_VAR]?.trim().toLowerCase() === 'dev' ? 'dev' : 'prod';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getDataRootName(env: RuntimeEnv = getRuntimeEnv()) {
|
|
32
|
+
return getRuntimeProfile(env) === 'dev' ? DEV_DATA_ROOT_NAME : DATA_ROOT_NAME;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getDataRootDir(homeDir: string, env: RuntimeEnv = getRuntimeEnv()) {
|
|
36
|
+
return `${homeDir}/${getDataRootName(env)}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getDataRootDirDisplay(env: RuntimeEnv = getRuntimeEnv()) {
|
|
40
|
+
return `~/${getDataRootName(env)}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getDataDir(homeDir: string, env: RuntimeEnv = getRuntimeEnv()) {
|
|
44
|
+
return `${getDataRootDir(homeDir, env)}/data`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function getDataDirDisplay(env: RuntimeEnv = getRuntimeEnv()) {
|
|
48
|
+
return `${getDataRootDirDisplay(env)}/data`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function getWorktreesDir(homeDir: string, env: RuntimeEnv = getRuntimeEnv()) {
|
|
52
|
+
return `${getDataRootDir(homeDir, env)}/worktrees`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getWorktreesDirDisplay(env: RuntimeEnv = getRuntimeEnv()) {
|
|
56
|
+
return `${getDataRootDirDisplay(env)}/worktrees`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function getKeybindingsFilePath(homeDir: string, env: RuntimeEnv = getRuntimeEnv()) {
|
|
60
|
+
return `${getDataRootDir(homeDir, env)}/keybindings.json`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function getKeybindingsFilePathDisplay(env: RuntimeEnv = getRuntimeEnv()) {
|
|
64
|
+
return `${getDataRootDirDisplay(env)}/keybindings.json`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function getCliInvocation(arg?: string) {
|
|
68
|
+
return arg ? `${CLI_COMMAND} ${arg}` : CLI_COMMAND;
|
|
69
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export const DEFAULT_DEV_CLIENT_PORT = 5174;
|
|
2
|
+
|
|
3
|
+
export function getDefaultDevServerPort(clientPort = DEFAULT_DEV_CLIENT_PORT) {
|
|
4
|
+
return clientPort + 1;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface DevArgResolution {
|
|
8
|
+
clientPort: number;
|
|
9
|
+
serverPort: number;
|
|
10
|
+
share: boolean;
|
|
11
|
+
backendTargetHost: string;
|
|
12
|
+
allowedHosts: true | string[];
|
|
13
|
+
serverArgs: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function resolveDevPorts(args: string[]) {
|
|
17
|
+
let clientPort = DEFAULT_DEV_CLIENT_PORT;
|
|
18
|
+
|
|
19
|
+
for (let index = 0; index < args.length; index++) {
|
|
20
|
+
const arg = args[index];
|
|
21
|
+
if (arg !== '--port') continue;
|
|
22
|
+
|
|
23
|
+
const next = args[index + 1];
|
|
24
|
+
if (!next || next.startsWith('-')) {
|
|
25
|
+
throw new Error('Missing value for --port');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
clientPort = Number(next);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
clientPort,
|
|
33
|
+
serverPort: getDefaultDevServerPort(clientPort),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function stripPortArg(args: string[]) {
|
|
38
|
+
const stripped: string[] = [];
|
|
39
|
+
|
|
40
|
+
for (let index = 0; index < args.length; index++) {
|
|
41
|
+
const arg = args[index];
|
|
42
|
+
if (arg === '--port') {
|
|
43
|
+
index += 1;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
stripped.push(arg);
|
|
48
|
+
}
|
|
49
|
+
return stripped;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function parseDevArgs(args: string[], localHostname: string): DevArgResolution {
|
|
53
|
+
const { clientPort, serverPort } = resolveDevPorts(args);
|
|
54
|
+
const serverArgs = stripPortArg(args).filter((arg) => arg !== '--share');
|
|
55
|
+
|
|
56
|
+
let share = false;
|
|
57
|
+
let sawHost = false;
|
|
58
|
+
let sawRemote = false;
|
|
59
|
+
let backendTargetHost = '127.0.0.1';
|
|
60
|
+
let allowedAllHosts = false;
|
|
61
|
+
|
|
62
|
+
const hosts = new Set<string>(['localhost', '127.0.0.1', '0.0.0.0', localHostname]);
|
|
63
|
+
|
|
64
|
+
for (let index = 0; index < args.length; index++) {
|
|
65
|
+
const arg = args[index];
|
|
66
|
+
if (arg === '--share') {
|
|
67
|
+
if (sawHost) throw new Error('--share cannot be used with --host');
|
|
68
|
+
if (sawRemote) throw new Error('--share cannot be used with --remote');
|
|
69
|
+
share = true;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (arg === '--remote') {
|
|
74
|
+
if (share) throw new Error('--share cannot be used with --remote');
|
|
75
|
+
sawRemote = true;
|
|
76
|
+
backendTargetHost = '127.0.0.1';
|
|
77
|
+
allowedAllHosts = true;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (arg !== '--host') continue;
|
|
82
|
+
|
|
83
|
+
const next = args[index + 1];
|
|
84
|
+
if (!next || next.startsWith('-')) continue;
|
|
85
|
+
if (share) throw new Error('--share cannot be used with --host');
|
|
86
|
+
|
|
87
|
+
sawHost = true;
|
|
88
|
+
hosts.add(next);
|
|
89
|
+
backendTargetHost = next === '0.0.0.0' ? '127.0.0.1' : next;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
clientPort,
|
|
94
|
+
serverPort,
|
|
95
|
+
share,
|
|
96
|
+
backendTargetHost,
|
|
97
|
+
allowedHosts: share || allowedAllHosts ? true : [...hosts],
|
|
98
|
+
serverArgs,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AgentProvider,
|
|
3
|
+
BranchActionFailure,
|
|
4
|
+
BranchActionSuccess,
|
|
5
|
+
ChatAttachment,
|
|
6
|
+
DirectoryListSnapshot,
|
|
7
|
+
GitHubRepoAvailabilityResult,
|
|
8
|
+
GithubPublishInfo,
|
|
9
|
+
KeybindingsSnapshot,
|
|
10
|
+
ModelOptions,
|
|
11
|
+
PromptPart,
|
|
12
|
+
ScratchpadSnapshot,
|
|
13
|
+
SessionHistoryPage,
|
|
14
|
+
SessionSnapshot,
|
|
15
|
+
SidebarSnapshot,
|
|
16
|
+
UpdateSnapshot,
|
|
17
|
+
WorkspaceFileSearchResult,
|
|
18
|
+
WorkspaceSnapshot,
|
|
19
|
+
WorkspaceVisibilityState,
|
|
20
|
+
} from './types';
|
|
21
|
+
|
|
22
|
+
export type EditorPreset = 'cursor' | 'vscode' | 'warp' | 'antigravity' | 'custom';
|
|
23
|
+
|
|
24
|
+
export type EditorOpenSettings =
|
|
25
|
+
| { preset: Exclude<EditorPreset, 'custom'>; commandTemplate?: string }
|
|
26
|
+
| { preset: 'custom'; commandTemplate: string };
|
|
27
|
+
|
|
28
|
+
export type SubscriptionTopic =
|
|
29
|
+
| { type: 'sidebar' }
|
|
30
|
+
| { type: 'directories' }
|
|
31
|
+
| { type: 'update' }
|
|
32
|
+
| { type: 'keybindings' }
|
|
33
|
+
| { type: 'workspace'; workspaceId: string }
|
|
34
|
+
| { type: 'session'; sessionId: string; recentLimit?: number }
|
|
35
|
+
| { type: 'scratchpad'; workspaceId: string }
|
|
36
|
+
| { type: 'terminal'; terminalId: string };
|
|
37
|
+
|
|
38
|
+
export interface TerminalSnapshot {
|
|
39
|
+
terminalId: string;
|
|
40
|
+
title: string;
|
|
41
|
+
cwd: string;
|
|
42
|
+
shell: string;
|
|
43
|
+
cols: number;
|
|
44
|
+
rows: number;
|
|
45
|
+
scrollback: number;
|
|
46
|
+
serializedState: string;
|
|
47
|
+
status: 'running' | 'exited';
|
|
48
|
+
exitCode: number | null;
|
|
49
|
+
signal?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type TerminalEvent =
|
|
53
|
+
| { type: 'terminal.output'; terminalId: string; data: string }
|
|
54
|
+
| { type: 'terminal.exit'; terminalId: string; exitCode: number; signal?: number };
|
|
55
|
+
|
|
56
|
+
export type DirectoryOnboardingResult = BranchActionSuccess | BranchActionFailure;
|
|
57
|
+
|
|
58
|
+
export type ClientCommand =
|
|
59
|
+
| {
|
|
60
|
+
type: 'directory.add';
|
|
61
|
+
localPath: string;
|
|
62
|
+
title?: string;
|
|
63
|
+
}
|
|
64
|
+
| { type: 'directory.remove'; directoryId: string }
|
|
65
|
+
| { type: 'directory.initializeGit'; localPath: string }
|
|
66
|
+
| { type: 'directory.getGithubPublishInfo'; localPath: string }
|
|
67
|
+
| { type: 'directory.checkGithubRepoAvailability'; owner: string; name: string }
|
|
68
|
+
| {
|
|
69
|
+
type: 'directory.publishToGithub';
|
|
70
|
+
localPath: string;
|
|
71
|
+
owner: string;
|
|
72
|
+
name: string;
|
|
73
|
+
visibility: 'public' | 'private';
|
|
74
|
+
description?: string;
|
|
75
|
+
}
|
|
76
|
+
| { type: 'workspace.create'; directoryId: string }
|
|
77
|
+
| { type: 'workspace.remove'; workspaceId: string }
|
|
78
|
+
| {
|
|
79
|
+
type: 'workspace.setVisibility';
|
|
80
|
+
workspaceId: string;
|
|
81
|
+
visibilityState: WorkspaceVisibilityState;
|
|
82
|
+
}
|
|
83
|
+
| { type: 'workspace.renameBranch'; workspaceId: string; branchName: string }
|
|
84
|
+
| { type: 'workspace.continueOnNewBranch'; workspaceId: string }
|
|
85
|
+
| { type: 'workspace.markRead'; workspaceId: string }
|
|
86
|
+
| { type: 'workspace.refreshGit'; workspaceId: string; fetchRemote?: boolean }
|
|
87
|
+
| { type: 'workspace.refreshPrStage'; workspaceId: string }
|
|
88
|
+
| { type: 'workspace.readDiffPatch'; workspaceId: string; path: string }
|
|
89
|
+
| { type: 'workspace.discardFile'; workspaceId: string; path: string }
|
|
90
|
+
| { type: 'workspace.readFile'; workspaceId: string; path: string }
|
|
91
|
+
| { type: 'file.readExternal'; workspaceId: string; sessionId: string; path: string }
|
|
92
|
+
| { type: 'workspace.searchFiles'; workspaceId: string; query: string; limit?: number }
|
|
93
|
+
| { type: 'workspace.listFiles'; workspaceId: string; limit?: number }
|
|
94
|
+
| { type: 'workspace.commitAndPush'; workspaceId: string; sessionId: string }
|
|
95
|
+
| { type: 'workspace.pullLatestMain'; workspaceId: string; sessionId: string }
|
|
96
|
+
| { type: 'workspace.createPr'; workspaceId: string; sessionId: string }
|
|
97
|
+
| { type: 'workspace.fixCi'; workspaceId: string; sessionId: string }
|
|
98
|
+
| { type: 'workspace.resolveMergeConflicts'; workspaceId: string; sessionId: string }
|
|
99
|
+
| { type: 'workspace.markPrReady'; workspaceId: string }
|
|
100
|
+
| {
|
|
101
|
+
type: 'workspace.addressReviewComments';
|
|
102
|
+
workspaceId: string;
|
|
103
|
+
sessionId: string;
|
|
104
|
+
commentIds: string[];
|
|
105
|
+
}
|
|
106
|
+
| { type: 'workspace.mergePr'; workspaceId: string }
|
|
107
|
+
| { type: 'workspace.reviewChanges'; workspaceId: string }
|
|
108
|
+
| { type: 'workspace.updateScratchpad'; workspaceId: string; content: string }
|
|
109
|
+
| { type: 'system.ping' }
|
|
110
|
+
| { type: 'update.check'; force?: boolean }
|
|
111
|
+
| { type: 'update.install' }
|
|
112
|
+
| { type: 'settings.readKeybindings' }
|
|
113
|
+
| { type: 'settings.writeKeybindings'; bindings: KeybindingsSnapshot['bindings'] }
|
|
114
|
+
| {
|
|
115
|
+
type: 'system.openExternal';
|
|
116
|
+
localPath: string;
|
|
117
|
+
action: 'open_finder' | 'open_terminal' | 'open_editor';
|
|
118
|
+
line?: number;
|
|
119
|
+
column?: number;
|
|
120
|
+
editor?: EditorOpenSettings;
|
|
121
|
+
}
|
|
122
|
+
| { type: 'session.create'; workspaceId: string }
|
|
123
|
+
| { type: 'session.rename'; sessionId: string; title: string }
|
|
124
|
+
| { type: 'session.remove'; sessionId: string }
|
|
125
|
+
| {
|
|
126
|
+
type: 'session.send';
|
|
127
|
+
sessionId?: string;
|
|
128
|
+
workspaceId?: string;
|
|
129
|
+
provider?: AgentProvider;
|
|
130
|
+
content: string;
|
|
131
|
+
attachments?: ChatAttachment[];
|
|
132
|
+
parts?: PromptPart[];
|
|
133
|
+
model?: string;
|
|
134
|
+
modelOptions: ModelOptions;
|
|
135
|
+
effort?: string;
|
|
136
|
+
planMode?: boolean;
|
|
137
|
+
}
|
|
138
|
+
| { type: 'session.cancel'; sessionId: string }
|
|
139
|
+
| { type: 'session.stopDraining'; sessionId: string }
|
|
140
|
+
| { type: 'session.loadHistory'; sessionId: string; beforeCursor: string; limit: number }
|
|
141
|
+
| { type: 'session.respondTool'; sessionId: string; toolUseId: string; result: unknown }
|
|
142
|
+
| { type: 'session.listCommands'; sessionId: string; provider: AgentProvider }
|
|
143
|
+
| { type: 'session.dequeue'; sessionId: string; messageId: string }
|
|
144
|
+
| {
|
|
145
|
+
type: 'terminal.create';
|
|
146
|
+
workspaceId: string;
|
|
147
|
+
terminalId: string;
|
|
148
|
+
cols: number;
|
|
149
|
+
rows: number;
|
|
150
|
+
scrollback: number;
|
|
151
|
+
}
|
|
152
|
+
| { type: 'terminal.input'; terminalId: string; data: string }
|
|
153
|
+
| { type: 'terminal.resize'; terminalId: string; cols: number; rows: number }
|
|
154
|
+
| { type: 'terminal.close'; terminalId: string };
|
|
155
|
+
|
|
156
|
+
export type ClientEnvelope =
|
|
157
|
+
| { type: 'subscribe'; id: string; topic: SubscriptionTopic }
|
|
158
|
+
| { type: 'unsubscribe'; id: string }
|
|
159
|
+
| { type: 'command'; id: string; command: ClientCommand };
|
|
160
|
+
|
|
161
|
+
export type ServerSnapshot =
|
|
162
|
+
| { type: 'sidebar'; data: SidebarSnapshot }
|
|
163
|
+
| { type: 'directories'; data: DirectoryListSnapshot }
|
|
164
|
+
| { type: 'update'; data: UpdateSnapshot }
|
|
165
|
+
| { type: 'keybindings'; data: KeybindingsSnapshot }
|
|
166
|
+
| { type: 'workspace'; data: WorkspaceSnapshot | null }
|
|
167
|
+
| { type: 'session'; data: SessionSnapshot | null }
|
|
168
|
+
| { type: 'scratchpad'; data: ScratchpadSnapshot }
|
|
169
|
+
| { type: 'terminal'; data: TerminalSnapshot | null };
|
|
170
|
+
|
|
171
|
+
export type ServerEnvelope =
|
|
172
|
+
| { type: 'snapshot'; id: string; snapshot: ServerSnapshot }
|
|
173
|
+
| { type: 'event'; id: string; event: TerminalEvent }
|
|
174
|
+
| {
|
|
175
|
+
type: 'ack';
|
|
176
|
+
id: string;
|
|
177
|
+
result?:
|
|
178
|
+
| unknown
|
|
179
|
+
| SessionHistoryPage
|
|
180
|
+
| DirectoryOnboardingResult
|
|
181
|
+
| GithubPublishInfo
|
|
182
|
+
| GitHubRepoAvailabilityResult
|
|
183
|
+
| WorkspaceFileSearchResult[];
|
|
184
|
+
}
|
|
185
|
+
| { type: 'error'; id?: string; message: string };
|
|
186
|
+
|
|
187
|
+
function isObject(value: unknown): value is Record<string, unknown> {
|
|
188
|
+
return Boolean(value && typeof value === 'object');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function isClientCommand(value: unknown): value is ClientCommand {
|
|
192
|
+
if (!isObject(value) || typeof value.type !== 'string') return false;
|
|
193
|
+
if (value.type === 'workspace.continueOnNewBranch') {
|
|
194
|
+
return typeof value.workspaceId === 'string' && value.workspaceId.length > 0;
|
|
195
|
+
}
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function isClientEnvelope(value: unknown): value is ClientEnvelope {
|
|
200
|
+
if (!isObject(value)) return false;
|
|
201
|
+
const candidate = value as Partial<ClientEnvelope>;
|
|
202
|
+
if (typeof candidate.id !== 'string') return false;
|
|
203
|
+
|
|
204
|
+
if (candidate.type === 'subscribe') {
|
|
205
|
+
return Boolean(candidate.topic && typeof candidate.topic === 'object');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (candidate.type === 'unsubscribe') {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (candidate.type === 'command') {
|
|
213
|
+
return isClientCommand(candidate.command);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AskUserQuestionAnswerMap,
|
|
3
|
+
AskUserQuestionItem,
|
|
4
|
+
AskUserQuestionToolResult,
|
|
5
|
+
HydratedToolCall,
|
|
6
|
+
NormalizedToolCall,
|
|
7
|
+
ReadFileToolResult,
|
|
8
|
+
TodoItem,
|
|
9
|
+
} from './types';
|
|
10
|
+
|
|
11
|
+
function asRecord(value: unknown): Record<string, unknown> | null {
|
|
12
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
|
|
13
|
+
return value as Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function normalizeToolCall(args: {
|
|
17
|
+
toolName: string;
|
|
18
|
+
toolId: string;
|
|
19
|
+
input: Record<string, unknown>;
|
|
20
|
+
}): NormalizedToolCall {
|
|
21
|
+
const { toolName, toolId, input } = args;
|
|
22
|
+
|
|
23
|
+
switch (toolName) {
|
|
24
|
+
case 'AskUserQuestion':
|
|
25
|
+
return {
|
|
26
|
+
kind: 'tool',
|
|
27
|
+
toolKind: 'ask_user_question',
|
|
28
|
+
toolName,
|
|
29
|
+
toolId,
|
|
30
|
+
input: {
|
|
31
|
+
questions: Array.isArray(input.questions)
|
|
32
|
+
? (input.questions as AskUserQuestionItem[])
|
|
33
|
+
: [],
|
|
34
|
+
},
|
|
35
|
+
rawInput: input,
|
|
36
|
+
};
|
|
37
|
+
case 'ExitPlanMode':
|
|
38
|
+
return {
|
|
39
|
+
kind: 'tool',
|
|
40
|
+
toolKind: 'exit_plan_mode',
|
|
41
|
+
toolName,
|
|
42
|
+
toolId,
|
|
43
|
+
input: {
|
|
44
|
+
plan: typeof input.plan === 'string' ? input.plan : undefined,
|
|
45
|
+
summary: typeof input.summary === 'string' ? input.summary : undefined,
|
|
46
|
+
},
|
|
47
|
+
rawInput: input,
|
|
48
|
+
};
|
|
49
|
+
case 'TodoWrite':
|
|
50
|
+
return {
|
|
51
|
+
kind: 'tool',
|
|
52
|
+
toolKind: 'todo_write',
|
|
53
|
+
toolName,
|
|
54
|
+
toolId,
|
|
55
|
+
input: {
|
|
56
|
+
todos: Array.isArray(input.todos) ? (input.todos as TodoItem[]) : [],
|
|
57
|
+
},
|
|
58
|
+
rawInput: input,
|
|
59
|
+
};
|
|
60
|
+
case 'Skill':
|
|
61
|
+
return {
|
|
62
|
+
kind: 'tool',
|
|
63
|
+
toolKind: 'skill',
|
|
64
|
+
toolName,
|
|
65
|
+
toolId,
|
|
66
|
+
input: {
|
|
67
|
+
skill: typeof input.skill === 'string' ? input.skill : '',
|
|
68
|
+
},
|
|
69
|
+
rawInput: input,
|
|
70
|
+
};
|
|
71
|
+
case 'Glob':
|
|
72
|
+
return {
|
|
73
|
+
kind: 'tool',
|
|
74
|
+
toolKind: 'glob',
|
|
75
|
+
toolName,
|
|
76
|
+
toolId,
|
|
77
|
+
input: {
|
|
78
|
+
pattern: typeof input.pattern === 'string' ? input.pattern : '',
|
|
79
|
+
},
|
|
80
|
+
rawInput: input,
|
|
81
|
+
};
|
|
82
|
+
case 'Bash':
|
|
83
|
+
return {
|
|
84
|
+
kind: 'tool',
|
|
85
|
+
toolKind: 'bash',
|
|
86
|
+
toolName,
|
|
87
|
+
toolId,
|
|
88
|
+
input: {
|
|
89
|
+
command: typeof input.command === 'string' ? input.command : '',
|
|
90
|
+
description: typeof input.description === 'string' ? input.description : undefined,
|
|
91
|
+
timeoutMs: typeof input.timeout === 'number' ? input.timeout : undefined,
|
|
92
|
+
runInBackground: Boolean(input.run_in_background),
|
|
93
|
+
},
|
|
94
|
+
rawInput: input,
|
|
95
|
+
};
|
|
96
|
+
case 'WebSearch':
|
|
97
|
+
return {
|
|
98
|
+
kind: 'tool',
|
|
99
|
+
toolKind: 'web_search',
|
|
100
|
+
toolName,
|
|
101
|
+
toolId,
|
|
102
|
+
input: {
|
|
103
|
+
query: typeof input.query === 'string' ? input.query : '',
|
|
104
|
+
},
|
|
105
|
+
rawInput: input,
|
|
106
|
+
};
|
|
107
|
+
case 'Read':
|
|
108
|
+
return {
|
|
109
|
+
kind: 'tool',
|
|
110
|
+
toolKind: 'read_file',
|
|
111
|
+
toolName,
|
|
112
|
+
toolId,
|
|
113
|
+
input: {
|
|
114
|
+
filePath: typeof input.file_path === 'string' ? input.file_path : '',
|
|
115
|
+
},
|
|
116
|
+
rawInput: input,
|
|
117
|
+
};
|
|
118
|
+
case 'Write':
|
|
119
|
+
return {
|
|
120
|
+
kind: 'tool',
|
|
121
|
+
toolKind: 'write_file',
|
|
122
|
+
toolName,
|
|
123
|
+
toolId,
|
|
124
|
+
input: {
|
|
125
|
+
filePath: typeof input.file_path === 'string' ? input.file_path : '',
|
|
126
|
+
content: typeof input.content === 'string' ? input.content : '',
|
|
127
|
+
},
|
|
128
|
+
rawInput: input,
|
|
129
|
+
};
|
|
130
|
+
case 'Edit':
|
|
131
|
+
return {
|
|
132
|
+
kind: 'tool',
|
|
133
|
+
toolKind: 'edit_file',
|
|
134
|
+
toolName,
|
|
135
|
+
toolId,
|
|
136
|
+
input: {
|
|
137
|
+
filePath: typeof input.file_path === 'string' ? input.file_path : '',
|
|
138
|
+
oldString: typeof input.old_string === 'string' ? input.old_string : '',
|
|
139
|
+
newString: typeof input.new_string === 'string' ? input.new_string : '',
|
|
140
|
+
},
|
|
141
|
+
rawInput: input,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const mcpMatch = toolName.match(/^mcp__(.+?)__(.+)$/);
|
|
146
|
+
if (mcpMatch) {
|
|
147
|
+
return {
|
|
148
|
+
kind: 'tool',
|
|
149
|
+
toolKind: 'mcp_generic',
|
|
150
|
+
toolName,
|
|
151
|
+
toolId,
|
|
152
|
+
input: {
|
|
153
|
+
server: mcpMatch[1],
|
|
154
|
+
tool: mcpMatch[2],
|
|
155
|
+
payload: input,
|
|
156
|
+
},
|
|
157
|
+
rawInput: input,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (typeof input.subagent_type === 'string') {
|
|
162
|
+
return {
|
|
163
|
+
kind: 'tool',
|
|
164
|
+
toolKind: 'subagent_task',
|
|
165
|
+
toolName,
|
|
166
|
+
toolId,
|
|
167
|
+
input: {
|
|
168
|
+
subagentType: input.subagent_type,
|
|
169
|
+
},
|
|
170
|
+
rawInput: input,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
kind: 'tool',
|
|
176
|
+
toolKind: 'unknown_tool',
|
|
177
|
+
toolId,
|
|
178
|
+
toolName,
|
|
179
|
+
input: {
|
|
180
|
+
payload: input,
|
|
181
|
+
},
|
|
182
|
+
rawInput: input,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function parseJsonValue(value: unknown): unknown {
|
|
187
|
+
if (typeof value !== 'string') return value;
|
|
188
|
+
try {
|
|
189
|
+
return JSON.parse(value);
|
|
190
|
+
} catch {
|
|
191
|
+
return value;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
type ReadStructuredTextBlock = {
|
|
196
|
+
type: 'text';
|
|
197
|
+
text: string;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
type ReadStructuredImageBlock = {
|
|
201
|
+
type: 'image';
|
|
202
|
+
data: string;
|
|
203
|
+
mimeType?: string;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
function normalizedReadBlocks(
|
|
207
|
+
value: unknown,
|
|
208
|
+
): Array<ReadStructuredTextBlock | ReadStructuredImageBlock> {
|
|
209
|
+
const blocks =
|
|
210
|
+
value &&
|
|
211
|
+
typeof value === 'object' &&
|
|
212
|
+
'content' in value &&
|
|
213
|
+
Array.isArray((value as { content?: unknown }).content)
|
|
214
|
+
? (value as { content: unknown[] }).content
|
|
215
|
+
: Array.isArray(value)
|
|
216
|
+
? value
|
|
217
|
+
: [];
|
|
218
|
+
|
|
219
|
+
const normalized: Array<ReadStructuredTextBlock | ReadStructuredImageBlock> = [];
|
|
220
|
+
|
|
221
|
+
for (const block of blocks) {
|
|
222
|
+
if (!block || typeof block !== 'object' || !('type' in block)) {
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (block.type === 'text' && typeof block.text === 'string') {
|
|
227
|
+
normalized.push({ type: 'text', text: block.text });
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (block.type === 'image') {
|
|
231
|
+
if ('data' in block && typeof block.data === 'string') {
|
|
232
|
+
normalized.push({
|
|
233
|
+
type: 'image',
|
|
234
|
+
data: block.data,
|
|
235
|
+
mimeType: typeof block.mimeType === 'string' ? block.mimeType : undefined,
|
|
236
|
+
});
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (
|
|
242
|
+
'source' in block &&
|
|
243
|
+
block.source &&
|
|
244
|
+
typeof block.source === 'object' &&
|
|
245
|
+
'type' in block.source &&
|
|
246
|
+
block.source.type === 'base64' &&
|
|
247
|
+
'data' in block.source &&
|
|
248
|
+
typeof block.source.data === 'string'
|
|
249
|
+
) {
|
|
250
|
+
normalized.push({
|
|
251
|
+
type: 'image',
|
|
252
|
+
data: block.source.data,
|
|
253
|
+
mimeType: typeof block.source.media_type === 'string' ? block.source.media_type : undefined,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return normalized;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export function hydrateToolResult(
|
|
262
|
+
tool: NormalizedToolCall,
|
|
263
|
+
raw: unknown,
|
|
264
|
+
): HydratedToolCall['result'] {
|
|
265
|
+
const parsed = parseJsonValue(raw);
|
|
266
|
+
|
|
267
|
+
switch (tool.toolKind) {
|
|
268
|
+
case 'ask_user_question': {
|
|
269
|
+
const record = asRecord(parsed);
|
|
270
|
+
const answers = asRecord(record?.answers) ?? (record ? record : {});
|
|
271
|
+
return {
|
|
272
|
+
answers: Object.fromEntries(
|
|
273
|
+
Object.entries(answers).map(([key, value]) => {
|
|
274
|
+
if (Array.isArray(value)) {
|
|
275
|
+
return [key, value.map((entry) => String(entry))];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (
|
|
279
|
+
value &&
|
|
280
|
+
typeof value === 'object' &&
|
|
281
|
+
Array.isArray((value as { answers?: unknown }).answers)
|
|
282
|
+
) {
|
|
283
|
+
return [key, (value as { answers: unknown[] }).answers.map((entry) => String(entry))];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (value == null || value === '') {
|
|
287
|
+
return [key, []];
|
|
288
|
+
}
|
|
289
|
+
return [key, [String(value)]];
|
|
290
|
+
}),
|
|
291
|
+
) as AskUserQuestionAnswerMap,
|
|
292
|
+
...(record?.discarded === true ? { discarded: true } : {}),
|
|
293
|
+
} satisfies AskUserQuestionToolResult;
|
|
294
|
+
}
|
|
295
|
+
case 'exit_plan_mode': {
|
|
296
|
+
const record = asRecord(parsed);
|
|
297
|
+
return {
|
|
298
|
+
confirmed: typeof record?.confirmed === 'boolean' ? record.confirmed : undefined,
|
|
299
|
+
clearContext: typeof record?.clearContext === 'boolean' ? record.clearContext : undefined,
|
|
300
|
+
message: typeof record?.message === 'string' ? record.message : undefined,
|
|
301
|
+
...(record?.discarded === true ? { discarded: true } : {}),
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
case 'read_file': {
|
|
305
|
+
if (typeof parsed === 'string') return parsed;
|
|
306
|
+
|
|
307
|
+
const blocks = normalizedReadBlocks(parsed);
|
|
308
|
+
if (blocks.length > 0) {
|
|
309
|
+
return {
|
|
310
|
+
content: blocks.flatMap((block) => (block.type === 'text' ? [block.text] : [])).join(''),
|
|
311
|
+
blocks,
|
|
312
|
+
} satisfies ReadFileToolResult;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const record = asRecord(parsed);
|
|
316
|
+
return {
|
|
317
|
+
content:
|
|
318
|
+
typeof record?.content === 'string' ? record.content : JSON.stringify(parsed, null, 2),
|
|
319
|
+
} satisfies ReadFileToolResult;
|
|
320
|
+
}
|
|
321
|
+
default:
|
|
322
|
+
return parsed;
|
|
323
|
+
}
|
|
324
|
+
}
|