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.
Files changed (379) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +179 -0
  3. package/bin/miko +10 -0
  4. package/dist/client/antigravity.webp +0 -0
  5. package/dist/client/assets/abap-BdImnpbu.js +1 -0
  6. package/dist/client/assets/actionscript-3-CoDkCxhg.js +1 -0
  7. package/dist/client/assets/ada-bCR0ucgS.js +1 -0
  8. package/dist/client/assets/andromeeda-C4gqWexZ.js +1 -0
  9. package/dist/client/assets/angular-html-CU67Zn6k.js +1 -0
  10. package/dist/client/assets/angular-ts-BwZT4LLn.js +1 -0
  11. package/dist/client/assets/apache-Pmp26Uib.js +1 -0
  12. package/dist/client/assets/apex-D8_7TLub.js +1 -0
  13. package/dist/client/assets/apl-dKokRX4l.js +1 -0
  14. package/dist/client/assets/applescript-Co6uUVPk.js +1 -0
  15. package/dist/client/assets/ara-BRHolxvo.js +1 -0
  16. package/dist/client/assets/asciidoc-Ve4PFQV2.js +1 -0
  17. package/dist/client/assets/asm-D_Q5rh1f.js +1 -0
  18. package/dist/client/assets/astro-CbQHKStN.js +1 -0
  19. package/dist/client/assets/aurora-x-D-2ljcwZ.js +1 -0
  20. package/dist/client/assets/awk-DMzUqQB5.js +1 -0
  21. package/dist/client/assets/ayu-dark-DYE7WIF3.js +1 -0
  22. package/dist/client/assets/ayu-light-BA47KaF1.js +1 -0
  23. package/dist/client/assets/ayu-mirage-32ctXXKs.js +1 -0
  24. package/dist/client/assets/ballerina-BFfxhgS-.js +1 -0
  25. package/dist/client/assets/bat-BkioyH1T.js +1 -0
  26. package/dist/client/assets/beancount-k_qm7-4y.js +1 -0
  27. package/dist/client/assets/berry-uYugtg8r.js +1 -0
  28. package/dist/client/assets/bibtex-CHM0blh-.js +1 -0
  29. package/dist/client/assets/bicep-Bmn6On1c.js +1 -0
  30. package/dist/client/assets/bird2-DPOp833l.js +1 -0
  31. package/dist/client/assets/blade-D4QpJJKB.js +1 -0
  32. package/dist/client/assets/bsl-BO_Y6i37.js +1 -0
  33. package/dist/client/assets/c-BIGW1oBm.js +1 -0
  34. package/dist/client/assets/c3-eo99z4R2.js +1 -0
  35. package/dist/client/assets/cadence-Bv_4Rxtq.js +1 -0
  36. package/dist/client/assets/cairo-KRGpt6FW.js +1 -0
  37. package/dist/client/assets/catppuccin-frappe-DFWUc33u.js +1 -0
  38. package/dist/client/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
  39. package/dist/client/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
  40. package/dist/client/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
  41. package/dist/client/assets/clarity-D53aC0YG.js +1 -0
  42. package/dist/client/assets/clojure-P80f7IUj.js +1 -0
  43. package/dist/client/assets/cmake-D1j8_8rp.js +1 -0
  44. package/dist/client/assets/cobol-nwyudZeR.js +1 -0
  45. package/dist/client/assets/codeowners-Bp6g37R7.js +1 -0
  46. package/dist/client/assets/codeql-DsOJ9woJ.js +1 -0
  47. package/dist/client/assets/coffee-Ch7k5sss.js +1 -0
  48. package/dist/client/assets/common-lisp-Cg-RD9OK.js +1 -0
  49. package/dist/client/assets/coq-DkFqJrB1.js +1 -0
  50. package/dist/client/assets/cpp-CofmeUqb.js +1 -0
  51. package/dist/client/assets/crystal-tKQVLTB8.js +1 -0
  52. package/dist/client/assets/csharp-COcwbKMJ.js +1 -0
  53. package/dist/client/assets/css-DPfMkruS.js +1 -0
  54. package/dist/client/assets/csv-fuZLfV_i.js +1 -0
  55. package/dist/client/assets/cue-D82EKSYY.js +1 -0
  56. package/dist/client/assets/cypher-COkxafJQ.js +1 -0
  57. package/dist/client/assets/d-85-TOEBH.js +1 -0
  58. package/dist/client/assets/dark-plus-C3mMm8J8.js +1 -0
  59. package/dist/client/assets/dart-CF10PKvl.js +1 -0
  60. package/dist/client/assets/dax-CEL-wOlO.js +1 -0
  61. package/dist/client/assets/desktop-BmXAJ9_W.js +1 -0
  62. package/dist/client/assets/diff-D97Zzqfu.js +1 -0
  63. package/dist/client/assets/docker-BcOcwvcX.js +1 -0
  64. package/dist/client/assets/dotenv-Da5cRb03.js +1 -0
  65. package/dist/client/assets/dracula-BzJJZx-M.js +1 -0
  66. package/dist/client/assets/dracula-soft-BXkSAIEj.js +1 -0
  67. package/dist/client/assets/dream-maker-BtqSS_iP.js +1 -0
  68. package/dist/client/assets/edge-BkV0erSs.js +1 -0
  69. package/dist/client/assets/elixir-CDX3lj18.js +1 -0
  70. package/dist/client/assets/elm-DbKCFpqz.js +1 -0
  71. package/dist/client/assets/emacs-lisp-C9XAeP06.js +1 -0
  72. package/dist/client/assets/erb-B12qg9BL.js +1 -0
  73. package/dist/client/assets/erlang-DsQrWhSR.js +1 -0
  74. package/dist/client/assets/everforest-dark-BgDCqdQA.js +1 -0
  75. package/dist/client/assets/everforest-light-C8M2exoo.js +1 -0
  76. package/dist/client/assets/fennel-BYunw83y.js +1 -0
  77. package/dist/client/assets/fish-BvzEVeQv.js +1 -0
  78. package/dist/client/assets/fluent-C4IJs8-o.js +1 -0
  79. package/dist/client/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
  80. package/dist/client/assets/fortran-free-form-BxgE0vQu.js +1 -0
  81. package/dist/client/assets/fsharp-CXgrBDvD.js +1 -0
  82. package/dist/client/assets/gdresource-BOOCDP_w.js +1 -0
  83. package/dist/client/assets/gdscript-C5YyOfLZ.js +1 -0
  84. package/dist/client/assets/gdshader-DkwncUOv.js +1 -0
  85. package/dist/client/assets/genie-D0YGMca9.js +1 -0
  86. package/dist/client/assets/gherkin-DyxjwDmM.js +1 -0
  87. package/dist/client/assets/git-commit-F4YmCXRG.js +1 -0
  88. package/dist/client/assets/git-rebase-r7XF79zn.js +1 -0
  89. package/dist/client/assets/github-dark-DHJKELXO.js +1 -0
  90. package/dist/client/assets/github-dark-default-Cuk6v7N8.js +1 -0
  91. package/dist/client/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  92. package/dist/client/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  93. package/dist/client/assets/github-light-DAi9KRSo.js +1 -0
  94. package/dist/client/assets/github-light-default-D7oLnXFd.js +1 -0
  95. package/dist/client/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  96. package/dist/client/assets/gleam-BspZqrRM.js +1 -0
  97. package/dist/client/assets/glimmer-js-Rg0-pVw9.js +1 -0
  98. package/dist/client/assets/glimmer-ts-U6CK756n.js +1 -0
  99. package/dist/client/assets/glsl-DplSGwfg.js +1 -0
  100. package/dist/client/assets/gn-n2N0HUVH.js +1 -0
  101. package/dist/client/assets/gnuplot-DdkO51Og.js +1 -0
  102. package/dist/client/assets/go-CxLEBnE3.js +1 -0
  103. package/dist/client/assets/graphql-ChdNCCLP.js +1 -0
  104. package/dist/client/assets/groovy-gcz8RCvz.js +1 -0
  105. package/dist/client/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
  106. package/dist/client/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
  107. package/dist/client/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
  108. package/dist/client/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
  109. package/dist/client/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
  110. package/dist/client/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
  111. package/dist/client/assets/hack-CaT9iCJl.js +1 -0
  112. package/dist/client/assets/haml-B8DHNrY2.js +1 -0
  113. package/dist/client/assets/handlebars-BL8al0AC.js +1 -0
  114. package/dist/client/assets/haskell-Df6bDoY_.js +1 -0
  115. package/dist/client/assets/haxe-CzTSHFRz.js +1 -0
  116. package/dist/client/assets/hcl-BWvSN4gD.js +1 -0
  117. package/dist/client/assets/hjson-D5-asLiD.js +1 -0
  118. package/dist/client/assets/hlsl-D3lLCCz7.js +1 -0
  119. package/dist/client/assets/horizon-BUw7H-hv.js +1 -0
  120. package/dist/client/assets/horizon-bright-Cn-bp-IR.js +1 -0
  121. package/dist/client/assets/houston-DnULxvSX.js +1 -0
  122. package/dist/client/assets/html-GMplVEZG.js +1 -0
  123. package/dist/client/assets/html-derivative-BFtXZ54Q.js +1 -0
  124. package/dist/client/assets/http-jrhK8wxY.js +1 -0
  125. package/dist/client/assets/hurl-irOxFIW8.js +1 -0
  126. package/dist/client/assets/hxml-Bvhsp5Yf.js +1 -0
  127. package/dist/client/assets/hy-DFXneXwc.js +1 -0
  128. package/dist/client/assets/imba-DGztddWO.js +1 -0
  129. package/dist/client/assets/index-C07zYq_-.css +32 -0
  130. package/dist/client/assets/index-Ce3hNHfL.js +2351 -0
  131. package/dist/client/assets/ini-BEwlwnbL.js +1 -0
  132. package/dist/client/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  133. package/dist/client/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  134. package/dist/client/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  135. package/dist/client/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  136. package/dist/client/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  137. package/dist/client/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  138. package/dist/client/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  139. package/dist/client/assets/java-CylS5w8V.js +1 -0
  140. package/dist/client/assets/javascript-wDzz0qaB.js +1 -0
  141. package/dist/client/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  142. package/dist/client/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  143. package/dist/client/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  144. package/dist/client/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  145. package/dist/client/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  146. package/dist/client/assets/jinja-4LBKfQ-Z.js +1 -0
  147. package/dist/client/assets/jison-wvAkD_A8.js +1 -0
  148. package/dist/client/assets/json-Cp-IABpG.js +1 -0
  149. package/dist/client/assets/json5-C9tS-k6U.js +1 -0
  150. package/dist/client/assets/jsonc-Des-eS-w.js +1 -0
  151. package/dist/client/assets/jsonl-DcaNXYhu.js +1 -0
  152. package/dist/client/assets/jsonnet-DFQXde-d.js +1 -0
  153. package/dist/client/assets/jssm-C2t-YnRu.js +1 -0
  154. package/dist/client/assets/jsx-g9-lgVsj.js +1 -0
  155. package/dist/client/assets/julia-CxzCAyBv.js +1 -0
  156. package/dist/client/assets/just-Cw27pwNe.js +1 -0
  157. package/dist/client/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
  158. package/dist/client/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
  159. package/dist/client/assets/kanagawa-wave-DWedfzmr.js +1 -0
  160. package/dist/client/assets/kdl-DV7GczEv.js +1 -0
  161. package/dist/client/assets/kotlin-BdnUsdx6.js +1 -0
  162. package/dist/client/assets/kusto-DZf3V79B.js +1 -0
  163. package/dist/client/assets/laserwave-DUszq2jm.js +1 -0
  164. package/dist/client/assets/latex-CWtU0Tv5.js +1 -0
  165. package/dist/client/assets/lean-BZvkOJ9d.js +1 -0
  166. package/dist/client/assets/less-B1dDrJ26.js +1 -0
  167. package/dist/client/assets/light-plus-B7mTdjB0.js +1 -0
  168. package/dist/client/assets/liquid-DYVedYrR.js +1 -0
  169. package/dist/client/assets/llvm-DjAJT7YJ.js +1 -0
  170. package/dist/client/assets/log-2UxHyX5q.js +1 -0
  171. package/dist/client/assets/logo-BtOb2qkB.js +1 -0
  172. package/dist/client/assets/lua-BaeVxFsk.js +1 -0
  173. package/dist/client/assets/luau-C-HG3fhB.js +1 -0
  174. package/dist/client/assets/make-CHLpvVh8.js +1 -0
  175. package/dist/client/assets/markdown-Cvjx9yec.js +1 -0
  176. package/dist/client/assets/marko-CnJfTvn9.js +1 -0
  177. package/dist/client/assets/material-theme-D5KoaKCx.js +1 -0
  178. package/dist/client/assets/material-theme-darker-BfHTSMKl.js +1 -0
  179. package/dist/client/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  180. package/dist/client/assets/material-theme-ocean-CyktbL80.js +1 -0
  181. package/dist/client/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  182. package/dist/client/assets/matlab-D7o27uSR.js +1 -0
  183. package/dist/client/assets/mdc-BMNejdWA.js +1 -0
  184. package/dist/client/assets/mdx-Cmh6b_Ma.js +1 -0
  185. package/dist/client/assets/mermaid-mWjccvbQ.js +1 -0
  186. package/dist/client/assets/min-dark-CafNBF8u.js +1 -0
  187. package/dist/client/assets/min-light-CTRr51gU.js +1 -0
  188. package/dist/client/assets/mipsasm-CKIfxQSi.js +1 -0
  189. package/dist/client/assets/mojo-rZm6bMo-.js +1 -0
  190. package/dist/client/assets/monokai-D4h5O-jR.js +1 -0
  191. package/dist/client/assets/moonbit-_H4v1dQx.js +1 -0
  192. package/dist/client/assets/move-IF9eRakj.js +1 -0
  193. package/dist/client/assets/narrat-DRg8JJMk.js +1 -0
  194. package/dist/client/assets/nextflow-Zz6hmt5N.js +1 -0
  195. package/dist/client/assets/nextflow-groovy-BeH2EWoN.js +1 -0
  196. package/dist/client/assets/nginx-BpAMiNFr.js +1 -0
  197. package/dist/client/assets/night-owl-C39BiMTA.js +1 -0
  198. package/dist/client/assets/night-owl-light-CMTm3GFP.js +1 -0
  199. package/dist/client/assets/nim-CVrawwO9.js +1 -0
  200. package/dist/client/assets/nix-CwoSXNpI.js +1 -0
  201. package/dist/client/assets/nord-Ddv68eIx.js +1 -0
  202. package/dist/client/assets/nushell-Cz2AlsmD.js +1 -0
  203. package/dist/client/assets/objective-c-DXmwc3jG.js +1 -0
  204. package/dist/client/assets/objective-cpp-CLxacb5B.js +1 -0
  205. package/dist/client/assets/ocaml-C0hk2d4L.js +1 -0
  206. package/dist/client/assets/odin-BBf5iR-q.js +1 -0
  207. package/dist/client/assets/one-dark-pro-DVMEJ2y_.js +1 -0
  208. package/dist/client/assets/one-light-C3Wv6jpd.js +1 -0
  209. package/dist/client/assets/openscad-C4EeE6gA.js +1 -0
  210. package/dist/client/assets/pascal-D93ZcfNL.js +1 -0
  211. package/dist/client/assets/perl-C0TMdlhV.js +1 -0
  212. package/dist/client/assets/php-Dhbhpdrm.js +1 -0
  213. package/dist/client/assets/pierre-dark-DF2SEV7i.js +1 -0
  214. package/dist/client/assets/pierre-light-DOlZxES8.js +1 -0
  215. package/dist/client/assets/pkl-u5AG7uiY.js +1 -0
  216. package/dist/client/assets/plastic-3e1v2bzS.js +1 -0
  217. package/dist/client/assets/plsql-ChMvpjG-.js +1 -0
  218. package/dist/client/assets/po-BTJTHyun.js +1 -0
  219. package/dist/client/assets/poimandres-CS3Unz2-.js +1 -0
  220. package/dist/client/assets/polar-C0HS_06l.js +1 -0
  221. package/dist/client/assets/postcss-CXtECtnM.js +1 -0
  222. package/dist/client/assets/powerquery-CEu0bR-o.js +1 -0
  223. package/dist/client/assets/powershell-Dpen1YoG.js +1 -0
  224. package/dist/client/assets/prisma-Dd19v3D-.js +1 -0
  225. package/dist/client/assets/prolog-CbFg5uaA.js +1 -0
  226. package/dist/client/assets/proto-C7zT0LnQ.js +1 -0
  227. package/dist/client/assets/pug-CGlum2m_.js +1 -0
  228. package/dist/client/assets/puppet-BMWR74SV.js +1 -0
  229. package/dist/client/assets/purescript-CklMAg4u.js +1 -0
  230. package/dist/client/assets/python-B6aJPvgy.js +1 -0
  231. package/dist/client/assets/qml-3beO22l8.js +1 -0
  232. package/dist/client/assets/qmldir-C8lEn-DE.js +1 -0
  233. package/dist/client/assets/qss-IeuSbFQv.js +1 -0
  234. package/dist/client/assets/r-Dspwwk_N.js +1 -0
  235. package/dist/client/assets/racket-BqYA7rlc.js +1 -0
  236. package/dist/client/assets/raku-DXvB9xmW.js +1 -0
  237. package/dist/client/assets/razor-Uh8Bk_45.js +1 -0
  238. package/dist/client/assets/red-bN70gL4F.js +1 -0
  239. package/dist/client/assets/reg-C-SQnVFl.js +1 -0
  240. package/dist/client/assets/regexp-CDVJQ6XC.js +1 -0
  241. package/dist/client/assets/rel-C3B-1QV4.js +1 -0
  242. package/dist/client/assets/riscv-BM1_JUlF.js +1 -0
  243. package/dist/client/assets/ron-D8l8udqQ.js +1 -0
  244. package/dist/client/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
  245. package/dist/client/assets/rose-pine-moon-D4_iv3hh.js +1 -0
  246. package/dist/client/assets/rose-pine-qdsjHGoJ.js +1 -0
  247. package/dist/client/assets/rosmsg-BJDFO7_C.js +1 -0
  248. package/dist/client/assets/rst-BrH8l1NY.js +1 -0
  249. package/dist/client/assets/ruby-Dw2BHqvy.js +1 -0
  250. package/dist/client/assets/rust-B1yitclQ.js +1 -0
  251. package/dist/client/assets/sas-cz2c8ADy.js +1 -0
  252. package/dist/client/assets/sass-Cj5Yp3dK.js +1 -0
  253. package/dist/client/assets/scala-C151Ov-r.js +1 -0
  254. package/dist/client/assets/scheme-C98Dy4si.js +1 -0
  255. package/dist/client/assets/scratchpad-page-DcMny6uZ.js +1 -0
  256. package/dist/client/assets/scss-OYdSNvt2.js +1 -0
  257. package/dist/client/assets/sdbl-DVxCFoDh.js +1 -0
  258. package/dist/client/assets/shaderlab-Dg9Lc6iA.js +1 -0
  259. package/dist/client/assets/shellscript-Yzrsuije.js +1 -0
  260. package/dist/client/assets/shellsession-BADoaaVG.js +1 -0
  261. package/dist/client/assets/slack-dark-BthQWCQV.js +1 -0
  262. package/dist/client/assets/slack-ochin-DqwNpetd.js +1 -0
  263. package/dist/client/assets/smalltalk-BERRCDM3.js +1 -0
  264. package/dist/client/assets/snazzy-light-Bw305WKR.js +1 -0
  265. package/dist/client/assets/solarized-dark-DXbdFlpD.js +1 -0
  266. package/dist/client/assets/solarized-light-L9t79GZl.js +1 -0
  267. package/dist/client/assets/solidity-rGO070M0.js +1 -0
  268. package/dist/client/assets/soy-Brmx7dQM.js +1 -0
  269. package/dist/client/assets/sparql-rVzFXLq3.js +1 -0
  270. package/dist/client/assets/splunk-BtCnVYZw.js +1 -0
  271. package/dist/client/assets/sql-BLtJtn59.js +1 -0
  272. package/dist/client/assets/ssh-config-_ykCGR6B.js +1 -0
  273. package/dist/client/assets/stata-BH5u7GGu.js +1 -0
  274. package/dist/client/assets/stylus-BEDo0Tqx.js +1 -0
  275. package/dist/client/assets/surrealql-Bq5Q-fJD.js +1 -0
  276. package/dist/client/assets/svelte-C_ipcX3V.js +1 -0
  277. package/dist/client/assets/swift-D82vCrfD.js +1 -0
  278. package/dist/client/assets/synthwave-84-CbfX1IO0.js +1 -0
  279. package/dist/client/assets/system-verilog-CnnmHF94.js +1 -0
  280. package/dist/client/assets/systemd-4A_iFExJ.js +1 -0
  281. package/dist/client/assets/talonscript-CkByrt1z.js +1 -0
  282. package/dist/client/assets/tasl-QIJgUcNo.js +1 -0
  283. package/dist/client/assets/tcl-dwOrl1Do.js +1 -0
  284. package/dist/client/assets/templ-P3uqSqPl.js +1 -0
  285. package/dist/client/assets/terraform-BETggiCN.js +1 -0
  286. package/dist/client/assets/tex-idrVyKtj.js +1 -0
  287. package/dist/client/assets/tokyo-night-hegEt444.js +1 -0
  288. package/dist/client/assets/toml-vGWfd6FD.js +1 -0
  289. package/dist/client/assets/ts-tags-zn1MmPIZ.js +1 -0
  290. package/dist/client/assets/tsv-B_m7g4N7.js +1 -0
  291. package/dist/client/assets/tsx-COt5Ahok.js +1 -0
  292. package/dist/client/assets/turtle-BsS91CYL.js +1 -0
  293. package/dist/client/assets/twig-DNn4PbVi.js +1 -0
  294. package/dist/client/assets/typescript-BPQ3VLAy.js +1 -0
  295. package/dist/client/assets/typespec-BGHnOYBU.js +1 -0
  296. package/dist/client/assets/typst-DHCkPAjA.js +1 -0
  297. package/dist/client/assets/v-BcVCzyr7.js +1 -0
  298. package/dist/client/assets/vala-CsfeWuGM.js +1 -0
  299. package/dist/client/assets/vb-D17OF-Vu.js +1 -0
  300. package/dist/client/assets/verilog-BQ8w6xss.js +1 -0
  301. package/dist/client/assets/vesper-DU1UobuO.js +1 -0
  302. package/dist/client/assets/vhdl-CeAyd5Ju.js +1 -0
  303. package/dist/client/assets/viml-CJc9bBzg.js +1 -0
  304. package/dist/client/assets/vitesse-black-Bkuqu6BP.js +1 -0
  305. package/dist/client/assets/vitesse-dark-D0r3Knsf.js +1 -0
  306. package/dist/client/assets/vitesse-light-CVO1_9PV.js +1 -0
  307. package/dist/client/assets/vue-DN_0RTcg.js +1 -0
  308. package/dist/client/assets/vue-html-AaS7Mt5G.js +1 -0
  309. package/dist/client/assets/vue-vine-CQOfvN7w.js +1 -0
  310. package/dist/client/assets/vyper-CDx5xZoG.js +1 -0
  311. package/dist/client/assets/wasm-CG6Dc4jp.js +1 -0
  312. package/dist/client/assets/wasm-MzD3tlZU.js +1 -0
  313. package/dist/client/assets/wenyan-BV7otONQ.js +1 -0
  314. package/dist/client/assets/wgsl-Dx-B1_4e.js +1 -0
  315. package/dist/client/assets/wikitext-BhOHFoWU.js +1 -0
  316. package/dist/client/assets/wit-5i3qLPDT.js +1 -0
  317. package/dist/client/assets/wolfram-lXgVvXCa.js +1 -0
  318. package/dist/client/assets/xml-sdJ4AIDG.js +1 -0
  319. package/dist/client/assets/xsl-CtQFsRM5.js +1 -0
  320. package/dist/client/assets/yaml-Buea-lGh.js +1 -0
  321. package/dist/client/assets/zenscript-DVFEvuxE.js +1 -0
  322. package/dist/client/assets/zig-VOosw3JB.js +1 -0
  323. package/dist/client/cursor.png +0 -0
  324. package/dist/client/favicon.svg +17 -0
  325. package/dist/client/finder.png +0 -0
  326. package/dist/client/icons/claude.svg +1 -0
  327. package/dist/client/icons/openai.svg +1 -0
  328. package/dist/client/images/github.png +0 -0
  329. package/dist/client/index.html +15 -0
  330. package/dist/client/logo.svg +17 -0
  331. package/dist/client/terminal.png +0 -0
  332. package/dist/client/vscode.png +0 -0
  333. package/dist/client/warp.png +0 -0
  334. package/package.json +107 -0
  335. package/src/server/agent-instruction-attachments.ts +458 -0
  336. package/src/server/agent.ts +1879 -0
  337. package/src/server/cli-runtime.ts +418 -0
  338. package/src/server/cli-supervisor.ts +90 -0
  339. package/src/server/cli.ts +102 -0
  340. package/src/server/codex-app-server-protocol.ts +478 -0
  341. package/src/server/codex-app-server.ts +1645 -0
  342. package/src/server/data-dir-lock.ts +128 -0
  343. package/src/server/diff-store.ts +1587 -0
  344. package/src/server/durable-file.ts +74 -0
  345. package/src/server/event-store.ts +1448 -0
  346. package/src/server/event.ts +249 -0
  347. package/src/server/external-file-access.ts +48 -0
  348. package/src/server/external-open.ts +259 -0
  349. package/src/server/generate-title.ts +75 -0
  350. package/src/server/git-refresh-poller.ts +92 -0
  351. package/src/server/github-rest-client.ts +176 -0
  352. package/src/server/harness-types.ts +24 -0
  353. package/src/server/keybindings.ts +203 -0
  354. package/src/server/machine-name.ts +22 -0
  355. package/src/server/paths.ts +51 -0
  356. package/src/server/pr-manager.ts +1204 -0
  357. package/src/server/pr-refresh-poller.ts +126 -0
  358. package/src/server/process-utils.ts +18 -0
  359. package/src/server/provider-catalog.ts +90 -0
  360. package/src/server/quick-response.ts +274 -0
  361. package/src/server/read-models.ts +311 -0
  362. package/src/server/restart.ts +33 -0
  363. package/src/server/scratchpad-manager.ts +87 -0
  364. package/src/server/server.ts +759 -0
  365. package/src/server/share.ts +126 -0
  366. package/src/server/terminal-manager.ts +371 -0
  367. package/src/server/update-manager.ts +250 -0
  368. package/src/server/uploads.ts +191 -0
  369. package/src/server/workspace-file-search.ts +191 -0
  370. package/src/server/workspace-manager.ts +627 -0
  371. package/src/server/workspace-polling.ts +10 -0
  372. package/src/server/ws-router.ts +1039 -0
  373. package/src/shared/branding.ts +69 -0
  374. package/src/shared/dev-ports.ts +100 -0
  375. package/src/shared/ports.ts +2 -0
  376. package/src/shared/protocol.ts +217 -0
  377. package/src/shared/tools.ts +324 -0
  378. package/src/shared/types.ts +1220 -0
  379. 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,2 @@
1
+ export const PROD_SERVER_PORT = 3210;
2
+ export const DEV_CLIENT_PORT = 5174;
@@ -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
+ }