mycode-cli 0.1.0__py3-none-any.whl

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 (404) hide show
  1. mycode/__init__.py +1 -0
  2. mycode/cli/__init__.py +1 -0
  3. mycode/cli/chat.py +650 -0
  4. mycode/cli/main.py +245 -0
  5. mycode/cli/render.py +693 -0
  6. mycode/cli/runtime.py +271 -0
  7. mycode/cli/theme.py +109 -0
  8. mycode/core/__init__.py +30 -0
  9. mycode/core/agent.py +515 -0
  10. mycode/core/config.py +551 -0
  11. mycode/core/messages.py +166 -0
  12. mycode/core/models.py +144 -0
  13. mycode/core/models_catalog.json +2090 -0
  14. mycode/core/providers/__init__.py +86 -0
  15. mycode/core/providers/anthropic_like.py +366 -0
  16. mycode/core/providers/base.py +351 -0
  17. mycode/core/providers/gemini.py +321 -0
  18. mycode/core/providers/openai_chat.py +356 -0
  19. mycode/core/providers/openai_responses.py +326 -0
  20. mycode/core/session.py +537 -0
  21. mycode/core/system_prompt.md +10 -0
  22. mycode/core/system_prompt.py +319 -0
  23. mycode/core/tools.py +898 -0
  24. mycode/server/__init__.py +1 -0
  25. mycode/server/app.py +52 -0
  26. mycode/server/deps.py +29 -0
  27. mycode/server/routers/__init__.py +7 -0
  28. mycode/server/routers/chat.py +320 -0
  29. mycode/server/routers/sessions.py +77 -0
  30. mycode/server/routers/workspaces.py +92 -0
  31. mycode/server/run_manager.py +195 -0
  32. mycode/server/schemas.py +66 -0
  33. mycode/server/static/assets/EditDiff-C1ql7kft.js +12 -0
  34. mycode/server/static/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  35. mycode/server/static/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  36. mycode/server/static/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  37. mycode/server/static/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  38. mycode/server/static/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  39. mycode/server/static/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  40. mycode/server/static/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  41. mycode/server/static/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  42. mycode/server/static/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  43. mycode/server/static/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  44. mycode/server/static/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  45. mycode/server/static/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  46. mycode/server/static/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  47. mycode/server/static/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  48. mycode/server/static/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  49. mycode/server/static/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  50. mycode/server/static/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  51. mycode/server/static/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  52. mycode/server/static/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  53. mycode/server/static/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  54. mycode/server/static/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  55. mycode/server/static/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  56. mycode/server/static/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  57. mycode/server/static/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  58. mycode/server/static/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  59. mycode/server/static/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  60. mycode/server/static/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  61. mycode/server/static/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  62. mycode/server/static/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  63. mycode/server/static/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  64. mycode/server/static/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  65. mycode/server/static/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  66. mycode/server/static/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  67. mycode/server/static/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  68. mycode/server/static/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  69. mycode/server/static/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  70. mycode/server/static/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  71. mycode/server/static/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  72. mycode/server/static/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  73. mycode/server/static/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  74. mycode/server/static/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  75. mycode/server/static/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  76. mycode/server/static/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  77. mycode/server/static/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  78. mycode/server/static/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  79. mycode/server/static/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  80. mycode/server/static/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  81. mycode/server/static/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  82. mycode/server/static/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  83. mycode/server/static/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  84. mycode/server/static/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  85. mycode/server/static/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  86. mycode/server/static/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  87. mycode/server/static/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  88. mycode/server/static/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  89. mycode/server/static/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  90. mycode/server/static/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  91. mycode/server/static/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  92. mycode/server/static/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  93. mycode/server/static/assets/abap-BdImnpbu.js +1 -0
  94. mycode/server/static/assets/actionscript-3-CoDkCxhg.js +1 -0
  95. mycode/server/static/assets/ada-bCR0ucgS.js +1 -0
  96. mycode/server/static/assets/andromeeda-C4gqWexZ.js +1 -0
  97. mycode/server/static/assets/angular-html-DA-rfuFy.js +1 -0
  98. mycode/server/static/assets/angular-ts-BrjP3tb8.js +1 -0
  99. mycode/server/static/assets/apache-Pmp26Uib.js +1 -0
  100. mycode/server/static/assets/apex-D8_7TLub.js +1 -0
  101. mycode/server/static/assets/apl-CORt7UWP.js +1 -0
  102. mycode/server/static/assets/applescript-Co6uUVPk.js +1 -0
  103. mycode/server/static/assets/ara-BRHolxvo.js +1 -0
  104. mycode/server/static/assets/asciidoc-Ve4PFQV2.js +1 -0
  105. mycode/server/static/assets/asm-D_Q5rh1f.js +1 -0
  106. mycode/server/static/assets/astro-HNnZUWAn.js +1 -0
  107. mycode/server/static/assets/aurora-x-D-2ljcwZ.js +1 -0
  108. mycode/server/static/assets/auto-render-xntwXHOX.js +261 -0
  109. mycode/server/static/assets/awk-DMzUqQB5.js +1 -0
  110. mycode/server/static/assets/ayu-dark-DYE7WIF3.js +1 -0
  111. mycode/server/static/assets/ayu-light-BA47KaF1.js +1 -0
  112. mycode/server/static/assets/ayu-mirage-32ctXXKs.js +1 -0
  113. mycode/server/static/assets/ballerina-BFfxhgS-.js +1 -0
  114. mycode/server/static/assets/bat-BkioyH1T.js +1 -0
  115. mycode/server/static/assets/beancount-k_qm7-4y.js +1 -0
  116. mycode/server/static/assets/berry-uYugtg8r.js +1 -0
  117. mycode/server/static/assets/bibtex-CHM0blh-.js +1 -0
  118. mycode/server/static/assets/bicep-Bmn6On1c.js +1 -0
  119. mycode/server/static/assets/bird2-BIv1doCn.js +1 -0
  120. mycode/server/static/assets/blade-BjGOyj-B.js +1 -0
  121. mycode/server/static/assets/bsl-BO_Y6i37.js +1 -0
  122. mycode/server/static/assets/c-BIGW1oBm.js +1 -0
  123. mycode/server/static/assets/c3-eo99z4R2.js +1 -0
  124. mycode/server/static/assets/cadence-Bv_4Rxtq.js +1 -0
  125. mycode/server/static/assets/cairo-KRGpt6FW.js +1 -0
  126. mycode/server/static/assets/catppuccin-frappe-DFWUc33u.js +1 -0
  127. mycode/server/static/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
  128. mycode/server/static/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
  129. mycode/server/static/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
  130. mycode/server/static/assets/clarity-D53aC0YG.js +1 -0
  131. mycode/server/static/assets/clojure-P80f7IUj.js +1 -0
  132. mycode/server/static/assets/cmake-D1j8_8rp.js +1 -0
  133. mycode/server/static/assets/cobol-nBiQ_Alo.js +1 -0
  134. mycode/server/static/assets/codeowners-Bp6g37R7.js +1 -0
  135. mycode/server/static/assets/codeql-DsOJ9woJ.js +1 -0
  136. mycode/server/static/assets/coffee-Ch7k5sss.js +1 -0
  137. mycode/server/static/assets/common-lisp-Cg-RD9OK.js +1 -0
  138. mycode/server/static/assets/coq-DkFqJrB1.js +1 -0
  139. mycode/server/static/assets/cpp-CofmeUqb.js +1 -0
  140. mycode/server/static/assets/crystal-DNxU26gB.js +1 -0
  141. mycode/server/static/assets/csharp-COcwbKMJ.js +1 -0
  142. mycode/server/static/assets/css-CLj8gQPS.js +1 -0
  143. mycode/server/static/assets/csv-fuZLfV_i.js +1 -0
  144. mycode/server/static/assets/cue-D82EKSYY.js +1 -0
  145. mycode/server/static/assets/cypher-COkxafJQ.js +1 -0
  146. mycode/server/static/assets/d-85-TOEBH.js +1 -0
  147. mycode/server/static/assets/dark-plus-C3mMm8J8.js +1 -0
  148. mycode/server/static/assets/dart-bE4Kk8sk.js +1 -0
  149. mycode/server/static/assets/dax-CEL-wOlO.js +1 -0
  150. mycode/server/static/assets/desktop-BmXAJ9_W.js +1 -0
  151. mycode/server/static/assets/diff-D97Zzqfu.js +1 -0
  152. mycode/server/static/assets/docker-BcOcwvcX.js +1 -0
  153. mycode/server/static/assets/dotenv-Da5cRb03.js +1 -0
  154. mycode/server/static/assets/dracula-BzJJZx-M.js +1 -0
  155. mycode/server/static/assets/dracula-soft-BXkSAIEj.js +1 -0
  156. mycode/server/static/assets/dream-maker-BtqSS_iP.js +1 -0
  157. mycode/server/static/assets/edge-FbVlp4U3.js +1 -0
  158. mycode/server/static/assets/elixir-CkH2-t6x.js +1 -0
  159. mycode/server/static/assets/elm-DbKCFpqz.js +1 -0
  160. mycode/server/static/assets/emacs-lisp-CXvaQtF9.js +1 -0
  161. mycode/server/static/assets/erb-BYCe7drp.js +1 -0
  162. mycode/server/static/assets/erlang-DsQrWhSR.js +1 -0
  163. mycode/server/static/assets/everforest-dark-BgDCqdQA.js +1 -0
  164. mycode/server/static/assets/everforest-light-C8M2exoo.js +1 -0
  165. mycode/server/static/assets/fennel-BYunw83y.js +1 -0
  166. mycode/server/static/assets/fish-BvzEVeQv.js +1 -0
  167. mycode/server/static/assets/fluent-C4IJs8-o.js +1 -0
  168. mycode/server/static/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
  169. mycode/server/static/assets/fortran-free-form-BxgE0vQu.js +1 -0
  170. mycode/server/static/assets/fsharp-CXgrBDvD.js +1 -0
  171. mycode/server/static/assets/gdresource-BOOCDP_w.js +1 -0
  172. mycode/server/static/assets/gdscript-C5YyOfLZ.js +1 -0
  173. mycode/server/static/assets/gdshader-DkwncUOv.js +1 -0
  174. mycode/server/static/assets/genie-D0YGMca9.js +1 -0
  175. mycode/server/static/assets/gherkin-DyxjwDmM.js +1 -0
  176. mycode/server/static/assets/git-commit-F4YmCXRG.js +1 -0
  177. mycode/server/static/assets/git-rebase-r7XF79zn.js +1 -0
  178. mycode/server/static/assets/github-dark-DHJKELXO.js +1 -0
  179. mycode/server/static/assets/github-dark-default-Cuk6v7N8.js +1 -0
  180. mycode/server/static/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  181. mycode/server/static/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  182. mycode/server/static/assets/github-light-DAi9KRSo.js +1 -0
  183. mycode/server/static/assets/github-light-default-D7oLnXFd.js +1 -0
  184. mycode/server/static/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  185. mycode/server/static/assets/gleam-BspZqrRM.js +1 -0
  186. mycode/server/static/assets/glimmer-js-ByusRIyA.js +1 -0
  187. mycode/server/static/assets/glimmer-ts-BfAWNZQY.js +1 -0
  188. mycode/server/static/assets/glsl-DplSGwfg.js +1 -0
  189. mycode/server/static/assets/gn-n2N0HUVH.js +1 -0
  190. mycode/server/static/assets/gnuplot-DdkO51Og.js +1 -0
  191. mycode/server/static/assets/go-C27-OAKa.js +1 -0
  192. mycode/server/static/assets/graphql-ChdNCCLP.js +1 -0
  193. mycode/server/static/assets/groovy-gcz8RCvz.js +1 -0
  194. mycode/server/static/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
  195. mycode/server/static/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
  196. mycode/server/static/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
  197. mycode/server/static/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
  198. mycode/server/static/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
  199. mycode/server/static/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
  200. mycode/server/static/assets/hack-i7_Ulhet.js +1 -0
  201. mycode/server/static/assets/haml-D5jkg6IW.js +1 -0
  202. mycode/server/static/assets/handlebars-BpdQsYii.js +1 -0
  203. mycode/server/static/assets/haskell-Df6bDoY_.js +1 -0
  204. mycode/server/static/assets/haxe-CzTSHFRz.js +1 -0
  205. mycode/server/static/assets/hcl-BWvSN4gD.js +1 -0
  206. mycode/server/static/assets/hjson-D5-asLiD.js +1 -0
  207. mycode/server/static/assets/hlsl-D3lLCCz7.js +1 -0
  208. mycode/server/static/assets/horizon-BUw7H-hv.js +1 -0
  209. mycode/server/static/assets/horizon-bright-CUuTKBJd.js +1 -0
  210. mycode/server/static/assets/houston-DnULxvSX.js +1 -0
  211. mycode/server/static/assets/html-derivative-DlHx6ybY.js +1 -0
  212. mycode/server/static/assets/html-pp8916En.js +1 -0
  213. mycode/server/static/assets/http-jrhK8wxY.js +1 -0
  214. mycode/server/static/assets/hurl-irOxFIW8.js +1 -0
  215. mycode/server/static/assets/hxml-Bvhsp5Yf.js +1 -0
  216. mycode/server/static/assets/hy-DFXneXwc.js +1 -0
  217. mycode/server/static/assets/imba-DGztddWO.js +1 -0
  218. mycode/server/static/assets/index-B4e4WQPq.css +1 -0
  219. mycode/server/static/assets/index-C2xTNJGd.js +203 -0
  220. mycode/server/static/assets/ini-BEwlwnbL.js +1 -0
  221. mycode/server/static/assets/java-CylS5w8V.js +1 -0
  222. mycode/server/static/assets/javascript-wDzz0qaB.js +1 -0
  223. mycode/server/static/assets/jinja-f2NsQr07.js +1 -0
  224. mycode/server/static/assets/jison-wvAkD_A8.js +1 -0
  225. mycode/server/static/assets/json-Cp-IABpG.js +1 -0
  226. mycode/server/static/assets/json5-C9tS-k6U.js +1 -0
  227. mycode/server/static/assets/jsonc-Des-eS-w.js +1 -0
  228. mycode/server/static/assets/jsonl-DcaNXYhu.js +1 -0
  229. mycode/server/static/assets/jsonnet-DFQXde-d.js +1 -0
  230. mycode/server/static/assets/jssm-C2t-YnRu.js +1 -0
  231. mycode/server/static/assets/jsx-g9-lgVsj.js +1 -0
  232. mycode/server/static/assets/julia-CxzCAyBv.js +1 -0
  233. mycode/server/static/assets/just-VxiPbLrw.js +1 -0
  234. mycode/server/static/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
  235. mycode/server/static/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
  236. mycode/server/static/assets/kanagawa-wave-DWedfzmr.js +1 -0
  237. mycode/server/static/assets/katex-DnJR2-55.css +1 -0
  238. mycode/server/static/assets/kdl-DV7GczEv.js +1 -0
  239. mycode/server/static/assets/kotlin-BdnUsdx6.js +1 -0
  240. mycode/server/static/assets/kusto-wEQ09or8.js +1 -0
  241. mycode/server/static/assets/laserwave-DUszq2jm.js +1 -0
  242. mycode/server/static/assets/latex-CWtU0Tv5.js +1 -0
  243. mycode/server/static/assets/lean-BZvkOJ9d.js +1 -0
  244. mycode/server/static/assets/less-B1dDrJ26.js +1 -0
  245. mycode/server/static/assets/light-plus-B7mTdjB0.js +1 -0
  246. mycode/server/static/assets/liquid-C0sCDyMI.js +1 -0
  247. mycode/server/static/assets/llvm-DjAJT7YJ.js +1 -0
  248. mycode/server/static/assets/log-2UxHyX5q.js +1 -0
  249. mycode/server/static/assets/logo-BtOb2qkB.js +1 -0
  250. mycode/server/static/assets/lua-BaeVxFsk.js +1 -0
  251. mycode/server/static/assets/luau-C-HG3fhB.js +1 -0
  252. mycode/server/static/assets/make-CHLpvVh8.js +1 -0
  253. mycode/server/static/assets/markdown-Cvjx9yec.js +1 -0
  254. mycode/server/static/assets/marko-DjSrsDqO.js +1 -0
  255. mycode/server/static/assets/material-theme-D5KoaKCx.js +1 -0
  256. mycode/server/static/assets/material-theme-darker-BfHTSMKl.js +1 -0
  257. mycode/server/static/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  258. mycode/server/static/assets/material-theme-ocean-CyktbL80.js +1 -0
  259. mycode/server/static/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  260. mycode/server/static/assets/matlab-D7o27uSR.js +1 -0
  261. mycode/server/static/assets/mdc-DTYItulj.js +1 -0
  262. mycode/server/static/assets/mdx-Cmh6b_Ma.js +1 -0
  263. mycode/server/static/assets/mermaid-mWjccvbQ.js +1 -0
  264. mycode/server/static/assets/min-dark-CafNBF8u.js +1 -0
  265. mycode/server/static/assets/min-light-CTRr51gU.js +1 -0
  266. mycode/server/static/assets/mipsasm-CKIfxQSi.js +1 -0
  267. mycode/server/static/assets/mojo-rZm6bMo-.js +1 -0
  268. mycode/server/static/assets/monokai-D4h5O-jR.js +1 -0
  269. mycode/server/static/assets/moonbit-_H4v1dQx.js +1 -0
  270. mycode/server/static/assets/move-IF9eRakj.js +1 -0
  271. mycode/server/static/assets/narrat-DRg8JJMk.js +1 -0
  272. mycode/server/static/assets/nextflow-C-mBbutL.js +1 -0
  273. mycode/server/static/assets/nextflow-groovy-vE_lwT2v.js +1 -0
  274. mycode/server/static/assets/nginx-BpAMiNFr.js +1 -0
  275. mycode/server/static/assets/night-owl-C39BiMTA.js +1 -0
  276. mycode/server/static/assets/night-owl-light-CMTm3GFP.js +1 -0
  277. mycode/server/static/assets/nim-BIad80T-.js +1 -0
  278. mycode/server/static/assets/nix-CwoSXNpI.js +1 -0
  279. mycode/server/static/assets/nord-Ddv68eIx.js +1 -0
  280. mycode/server/static/assets/nushell-Cz2AlsmD.js +1 -0
  281. mycode/server/static/assets/objective-c-DXmwc3jG.js +1 -0
  282. mycode/server/static/assets/objective-cpp-CLxacb5B.js +1 -0
  283. mycode/server/static/assets/ocaml-C0hk2d4L.js +1 -0
  284. mycode/server/static/assets/odin-BBf5iR-q.js +1 -0
  285. mycode/server/static/assets/one-dark-pro-DVMEJ2y_.js +1 -0
  286. mycode/server/static/assets/one-light-C3Wv6jpd.js +1 -0
  287. mycode/server/static/assets/openscad-C4EeE6gA.js +1 -0
  288. mycode/server/static/assets/pascal-D93ZcfNL.js +1 -0
  289. mycode/server/static/assets/perl-NvoQZIq0.js +1 -0
  290. mycode/server/static/assets/php-R6g_5hLQ.js +1 -0
  291. mycode/server/static/assets/pkl-u5AG7uiY.js +1 -0
  292. mycode/server/static/assets/plastic-3e1v2bzS.js +1 -0
  293. mycode/server/static/assets/plsql-ChMvpjG-.js +1 -0
  294. mycode/server/static/assets/po-BTJTHyun.js +1 -0
  295. mycode/server/static/assets/poimandres-CS3Unz2-.js +1 -0
  296. mycode/server/static/assets/polar-C0HS_06l.js +1 -0
  297. mycode/server/static/assets/postcss-CXtECtnM.js +1 -0
  298. mycode/server/static/assets/powerquery-CEu0bR-o.js +1 -0
  299. mycode/server/static/assets/powershell-Dpen1YoG.js +1 -0
  300. mycode/server/static/assets/prisma-Dd19v3D-.js +1 -0
  301. mycode/server/static/assets/prolog-CbFg5uaA.js +1 -0
  302. mycode/server/static/assets/proto-C7zT0LnQ.js +1 -0
  303. mycode/server/static/assets/pug-DKIMFp6K.js +1 -0
  304. mycode/server/static/assets/puppet-BMWR74SV.js +1 -0
  305. mycode/server/static/assets/purescript-CklMAg4u.js +1 -0
  306. mycode/server/static/assets/python-B6aJPvgy.js +1 -0
  307. mycode/server/static/assets/qml-3beO22l8.js +1 -0
  308. mycode/server/static/assets/qmldir-C8lEn-DE.js +1 -0
  309. mycode/server/static/assets/qss-IeuSbFQv.js +1 -0
  310. mycode/server/static/assets/r-Dspwwk_N.js +1 -0
  311. mycode/server/static/assets/racket-BqYA7rlc.js +1 -0
  312. mycode/server/static/assets/raku-DXvB9xmW.js +1 -0
  313. mycode/server/static/assets/razor-BDqjjVU7.js +1 -0
  314. mycode/server/static/assets/red-bN70gL4F.js +1 -0
  315. mycode/server/static/assets/reg-C-SQnVFl.js +1 -0
  316. mycode/server/static/assets/regexp-CDVJQ6XC.js +1 -0
  317. mycode/server/static/assets/rel-C3B-1QV4.js +1 -0
  318. mycode/server/static/assets/riscv-BM1_JUlF.js +1 -0
  319. mycode/server/static/assets/ron-D8l8udqQ.js +1 -0
  320. mycode/server/static/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
  321. mycode/server/static/assets/rose-pine-moon-D4_iv3hh.js +1 -0
  322. mycode/server/static/assets/rose-pine-qdsjHGoJ.js +1 -0
  323. mycode/server/static/assets/rosmsg-BJDFO7_C.js +1 -0
  324. mycode/server/static/assets/rst-CRjBmOyv.js +1 -0
  325. mycode/server/static/assets/ruby-Wjq7vjNf.js +1 -0
  326. mycode/server/static/assets/rust-B1yitclQ.js +1 -0
  327. mycode/server/static/assets/sas-cz2c8ADy.js +1 -0
  328. mycode/server/static/assets/sass-Cj5Yp3dK.js +1 -0
  329. mycode/server/static/assets/scala-C151Ov-r.js +1 -0
  330. mycode/server/static/assets/scheme-C98Dy4si.js +1 -0
  331. mycode/server/static/assets/scss-D5BDwBP9.js +1 -0
  332. mycode/server/static/assets/sdbl-DVxCFoDh.js +1 -0
  333. mycode/server/static/assets/shaderlab-Dg9Lc6iA.js +1 -0
  334. mycode/server/static/assets/shellscript-Yzrsuije.js +1 -0
  335. mycode/server/static/assets/shellsession-BADoaaVG.js +1 -0
  336. mycode/server/static/assets/slack-dark-BthQWCQV.js +1 -0
  337. mycode/server/static/assets/slack-ochin-DqwNpetd.js +1 -0
  338. mycode/server/static/assets/smalltalk-BERRCDM3.js +1 -0
  339. mycode/server/static/assets/snazzy-light-Bw305WKR.js +1 -0
  340. mycode/server/static/assets/solarized-dark-DXbdFlpD.js +1 -0
  341. mycode/server/static/assets/solarized-light-L9t79GZl.js +1 -0
  342. mycode/server/static/assets/solidity-rGO070M0.js +1 -0
  343. mycode/server/static/assets/soy-8wufbnw4.js +1 -0
  344. mycode/server/static/assets/sparql-rVzFXLq3.js +1 -0
  345. mycode/server/static/assets/splunk-BtCnVYZw.js +1 -0
  346. mycode/server/static/assets/sql-BLtJtn59.js +1 -0
  347. mycode/server/static/assets/ssh-config-_ykCGR6B.js +1 -0
  348. mycode/server/static/assets/stata-BH5u7GGu.js +1 -0
  349. mycode/server/static/assets/stylus-BEDo0Tqx.js +1 -0
  350. mycode/server/static/assets/surrealql-Bq5Q-fJD.js +1 -0
  351. mycode/server/static/assets/svelte-Cy7k_4gC.js +1 -0
  352. mycode/server/static/assets/swift-D82vCrfD.js +1 -0
  353. mycode/server/static/assets/synthwave-84-CbfX1IO0.js +1 -0
  354. mycode/server/static/assets/system-verilog-CnnmHF94.js +1 -0
  355. mycode/server/static/assets/systemd-4A_iFExJ.js +1 -0
  356. mycode/server/static/assets/talonscript-CkByrt1z.js +1 -0
  357. mycode/server/static/assets/tasl-QIJgUcNo.js +1 -0
  358. mycode/server/static/assets/tcl-dwOrl1Do.js +1 -0
  359. mycode/server/static/assets/templ-DhtptRzy.js +1 -0
  360. mycode/server/static/assets/terraform-BETggiCN.js +1 -0
  361. mycode/server/static/assets/tex-idrVyKtj.js +1 -0
  362. mycode/server/static/assets/tokyo-night-hegEt444.js +1 -0
  363. mycode/server/static/assets/toml-vGWfd6FD.js +1 -0
  364. mycode/server/static/assets/ts-tags-DQrlYJgV.js +1 -0
  365. mycode/server/static/assets/tsv-B_m7g4N7.js +1 -0
  366. mycode/server/static/assets/tsx-COt5Ahok.js +1 -0
  367. mycode/server/static/assets/turtle-BsS91CYL.js +1 -0
  368. mycode/server/static/assets/twig-xg9kU7Mw.js +1 -0
  369. mycode/server/static/assets/typescript-BPQ3VLAy.js +1 -0
  370. mycode/server/static/assets/typespec-CAFt9gP4.js +1 -0
  371. mycode/server/static/assets/typst-DHCkPAjA.js +1 -0
  372. mycode/server/static/assets/v-BcVCzyr7.js +1 -0
  373. mycode/server/static/assets/vala-CsfeWuGM.js +1 -0
  374. mycode/server/static/assets/vb-D17OF-Vu.js +1 -0
  375. mycode/server/static/assets/verilog-BQ8w6xss.js +1 -0
  376. mycode/server/static/assets/vesper-DU1UobuO.js +1 -0
  377. mycode/server/static/assets/vhdl-CeAyd5Ju.js +1 -0
  378. mycode/server/static/assets/viml-CJc9bBzg.js +1 -0
  379. mycode/server/static/assets/vitesse-black-Bkuqu6BP.js +1 -0
  380. mycode/server/static/assets/vitesse-dark-D0r3Knsf.js +1 -0
  381. mycode/server/static/assets/vitesse-light-CVO1_9PV.js +1 -0
  382. mycode/server/static/assets/vue-D2xRrEX4.js +1 -0
  383. mycode/server/static/assets/vue-html-AaS7Mt5G.js +1 -0
  384. mycode/server/static/assets/vue-vine-BoDAl6tE.js +1 -0
  385. mycode/server/static/assets/vyper-CDx5xZoG.js +1 -0
  386. mycode/server/static/assets/wasm-CG6Dc4jp.js +1 -0
  387. mycode/server/static/assets/wasm-MzD3tlZU.js +1 -0
  388. mycode/server/static/assets/wenyan-BV7otONQ.js +1 -0
  389. mycode/server/static/assets/wgsl-Dx-B1_4e.js +1 -0
  390. mycode/server/static/assets/wikitext-BhOHFoWU.js +1 -0
  391. mycode/server/static/assets/wit-5i3qLPDT.js +1 -0
  392. mycode/server/static/assets/wolfram-lXgVvXCa.js +1 -0
  393. mycode/server/static/assets/xml-sdJ4AIDG.js +1 -0
  394. mycode/server/static/assets/xsl-CtQFsRM5.js +1 -0
  395. mycode/server/static/assets/yaml-Buea-lGh.js +1 -0
  396. mycode/server/static/assets/zenscript-DVFEvuxE.js +1 -0
  397. mycode/server/static/assets/zig-VOosw3JB.js +1 -0
  398. mycode/server/static/favicon_slashes.svg +12 -0
  399. mycode/server/static/index.html +35 -0
  400. mycode_cli-0.1.0.dist-info/METADATA +186 -0
  401. mycode_cli-0.1.0.dist-info/RECORD +404 -0
  402. mycode_cli-0.1.0.dist-info/WHEEL +4 -0
  403. mycode_cli-0.1.0.dist-info/entry_points.txt +2 -0
  404. mycode_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,86 @@
1
+ """Provider adapter registry and public import surface."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from mycode.core.providers.anthropic_like import AnthropicAdapter, MiniMaxAdapter, MoonshotAIAdapter
6
+ from mycode.core.providers.base import ProviderAdapter
7
+ from mycode.core.providers.gemini import GoogleGeminiAdapter
8
+ from mycode.core.providers.openai_chat import DeepSeekAdapter, OpenAIChatAdapter, OpenRouterAdapter, ZAIAdapter
9
+ from mycode.core.providers.openai_responses import OpenAIResponsesAdapter
10
+
11
+ _PROVIDERS: dict[str, ProviderAdapter] = {
12
+ adapter.provider_id: adapter
13
+ for adapter in (
14
+ AnthropicAdapter(),
15
+ OpenAIResponsesAdapter(),
16
+ GoogleGeminiAdapter(),
17
+ DeepSeekAdapter(),
18
+ ZAIAdapter(),
19
+ MoonshotAIAdapter(),
20
+ MiniMaxAdapter(),
21
+ OpenRouterAdapter(),
22
+ OpenAIChatAdapter(),
23
+ )
24
+ }
25
+
26
+
27
+ def list_supported_providers() -> list[str]:
28
+ """Return all built-in provider ids."""
29
+
30
+ return sorted(_PROVIDERS)
31
+
32
+
33
+ def list_env_discoverable_providers() -> list[str]:
34
+ """Return provider ids that can be discovered from env vars alone."""
35
+
36
+ return [provider_id for provider_id, adapter in _PROVIDERS.items() if adapter.auto_discoverable]
37
+
38
+
39
+ def is_supported_provider(provider_name: str | None) -> bool:
40
+ """Return whether the given provider id is registered."""
41
+
42
+ return bool(provider_name and provider_name in _PROVIDERS)
43
+
44
+
45
+ def get_provider_adapter(provider_name: str) -> ProviderAdapter:
46
+ try:
47
+ return _PROVIDERS[provider_name]
48
+ except KeyError as exc:
49
+ supported = ", ".join(list_supported_providers())
50
+ raise ValueError(f"unsupported provider {provider_name!r}; supported: {supported}") from exc
51
+
52
+
53
+ def provider_env_api_key_names(provider_name: str | None) -> tuple[str, ...]:
54
+ adapter = _PROVIDERS.get(provider_name) if provider_name else None
55
+ return adapter.env_api_key_names if adapter else ()
56
+
57
+
58
+ def provider_api_key_from_env(provider_name: str | None) -> str | None:
59
+ adapter = _PROVIDERS.get(provider_name) if provider_name else None
60
+ return adapter.api_key_from_env() if adapter else None
61
+
62
+
63
+ def provider_default_models(provider_name: str | None) -> tuple[str, ...]:
64
+ adapter = _PROVIDERS.get(provider_name) if provider_name else None
65
+ return adapter.default_models if adapter else ()
66
+
67
+
68
+ __all__ = [
69
+ "AnthropicAdapter",
70
+ "ProviderAdapter",
71
+ "GoogleGeminiAdapter",
72
+ "MiniMaxAdapter",
73
+ "MoonshotAIAdapter",
74
+ "DeepSeekAdapter",
75
+ "OpenAIChatAdapter",
76
+ "OpenAIResponsesAdapter",
77
+ "OpenRouterAdapter",
78
+ "ZAIAdapter",
79
+ "get_provider_adapter",
80
+ "list_env_discoverable_providers",
81
+ "is_supported_provider",
82
+ "list_supported_providers",
83
+ "provider_api_key_from_env",
84
+ "provider_default_models",
85
+ "provider_env_api_key_names",
86
+ ]
@@ -0,0 +1,366 @@
1
+ """Anthropic Messages adapters built on the official Anthropic Python SDK."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ from collections.abc import AsyncIterator
7
+ from typing import Any
8
+
9
+ from anthropic import APIError, AsyncAnthropic
10
+
11
+ from mycode.core.messages import (
12
+ ConversationMessage,
13
+ assistant_message,
14
+ text_block,
15
+ thinking_block,
16
+ tool_use_block,
17
+ )
18
+ from mycode.core.providers.base import (
19
+ DEFAULT_REQUEST_TIMEOUT,
20
+ ProviderAdapter,
21
+ ProviderRequest,
22
+ ProviderStreamEvent,
23
+ dump_model,
24
+ get_native_meta,
25
+ load_image_block_payload,
26
+ tool_result_content_blocks,
27
+ )
28
+
29
+ # Maps reasoning_effort values to extended thinking budget_tokens.
30
+ _THINKING_BUDGETS: dict[str, int] = {"low": 2048, "medium": 8192, "high": 24576, "xhigh": 32768}
31
+
32
+
33
+ class AnthropicLikeAdapter(ProviderAdapter):
34
+ """Shared Messages adapter for Anthropic-compatible providers.
35
+
36
+ Anthropic, Moonshot, and MiniMax all document agent usage around the
37
+ Anthropic Messages protocol. The differences we care about are limited to:
38
+
39
+ - default base URL
40
+ - API key env var names
41
+ - optional thinking defaults
42
+ - provider-native metadata carried in content blocks
43
+
44
+ MiniMax requires the full assistant content (all blocks) to be sent on
45
+ multi-turn tool-loop requests — not just the text portion.
46
+ """
47
+
48
+ def thinking_config(self, request: ProviderRequest) -> dict[str, Any] | None:
49
+ return None
50
+
51
+ def output_config(self, request: ProviderRequest) -> dict[str, Any] | None:
52
+ return None
53
+
54
+ def manual_thinking_config(self, effort: str | None) -> dict[str, Any] | None:
55
+ if not effort:
56
+ return None
57
+ if effort == "none":
58
+ return {"type": "disabled"}
59
+ budget = _THINKING_BUDGETS.get(effort)
60
+ return {"type": "enabled", "budget_tokens": budget} if budget else None
61
+
62
+ def _build_request_payload(self, request: ProviderRequest) -> dict[str, Any]:
63
+ messages = [self._serialize_message(message) for message in self.prepare_messages(request)]
64
+ self._apply_cache_control(messages)
65
+
66
+ payload: dict[str, Any] = {
67
+ "model": request.model,
68
+ "max_tokens": request.max_tokens,
69
+ "messages": messages,
70
+ }
71
+ if request.system:
72
+ payload["system"] = [
73
+ {
74
+ "type": "text",
75
+ "text": request.system,
76
+ "cache_control": {"type": "ephemeral"},
77
+ }
78
+ ]
79
+ if request.tools:
80
+ payload["tools"] = [self._serialize_tool(tool) for tool in request.tools]
81
+ payload["tool_choice"] = {"type": "auto"}
82
+ thinking = self.thinking_config(request)
83
+ if thinking is not None:
84
+ payload["thinking"] = thinking
85
+ output_config = self.output_config(request)
86
+ if output_config is not None:
87
+ payload["output_config"] = output_config
88
+ return payload
89
+
90
+ def project_tool_call_id(self, tool_call_id: str, used_tool_call_ids: set[str]) -> str:
91
+ """Return a short ASCII ID without introducing collisions.
92
+
93
+ Anthropic-compatible endpoints only accept IDs containing letters,
94
+ numbers, underscores, and dashes. When projection changes the original
95
+ ID, append a short hash so distinct canonical IDs stay distinct.
96
+ """
97
+
98
+ safe_id = "".join(char if char.isalnum() or char in "_-" else "_" for char in tool_call_id)
99
+ if safe_id == tool_call_id and len(safe_id) <= 64 and safe_id not in used_tool_call_ids:
100
+ return safe_id
101
+
102
+ prefix = (safe_id or "tool")[:55]
103
+ digest = hashlib.sha1(tool_call_id.encode("utf-8")).hexdigest()[:8]
104
+ candidate = f"{prefix}_{digest}"
105
+ if candidate not in used_tool_call_ids:
106
+ return candidate
107
+
108
+ counter = 2
109
+ while True:
110
+ suffix = f"_{digest}_{counter}"
111
+ candidate = f"{(safe_id or 'tool')[: 64 - len(suffix)]}{suffix}"
112
+ if candidate not in used_tool_call_ids:
113
+ return candidate
114
+ counter += 1
115
+
116
+ def _apply_cache_control(self, messages: list[dict[str, Any]]) -> None:
117
+ """Mark the last replayed user content block as ephemeral."""
118
+
119
+ for message in reversed(messages):
120
+ if message.get("role") != "user":
121
+ continue
122
+
123
+ content = message.get("content")
124
+ if not isinstance(content, list):
125
+ return
126
+
127
+ for block in reversed(content):
128
+ if not isinstance(block, dict):
129
+ continue
130
+ if block.get("type") not in {"text", "image", "tool_result"}:
131
+ continue
132
+
133
+ block["cache_control"] = {"type": "ephemeral"}
134
+ return
135
+
136
+ return
137
+
138
+ async def stream_turn(self, request: ProviderRequest) -> AsyncIterator[ProviderStreamEvent]:
139
+ api_key = self.require_api_key(request.api_key)
140
+ client = AsyncAnthropic(
141
+ api_key=api_key,
142
+ base_url=self.resolve_base_url(request.api_base),
143
+ timeout=DEFAULT_REQUEST_TIMEOUT,
144
+ )
145
+
146
+ try:
147
+ async with client.messages.stream(**self._build_request_payload(request)) as stream:
148
+ async for event in stream:
149
+ if event.type == "thinking" and event.thinking:
150
+ yield ProviderStreamEvent("thinking_delta", {"text": event.thinking})
151
+ continue
152
+ if event.type == "text" and event.text:
153
+ yield ProviderStreamEvent("text_delta", {"text": event.text})
154
+
155
+ final_message = await stream.get_final_message()
156
+ except APIError as exc:
157
+ raise ValueError(str(exc)) from exc
158
+
159
+ yield ProviderStreamEvent(
160
+ "message_done",
161
+ {
162
+ "message": self._convert_final_message(final_message),
163
+ },
164
+ )
165
+
166
+ def _convert_final_message(self, message: Any) -> ConversationMessage:
167
+ blocks = []
168
+ for block in getattr(message, "content", []) or []:
169
+ block_type = getattr(block, "type", None)
170
+
171
+ if block_type == "thinking":
172
+ native_meta = {}
173
+ signature = getattr(block, "signature", None)
174
+ if signature:
175
+ native_meta["signature"] = signature
176
+ blocks.append(
177
+ thinking_block(
178
+ getattr(block, "thinking", ""),
179
+ meta={"native": native_meta} if native_meta else None,
180
+ )
181
+ )
182
+ continue
183
+
184
+ if block_type == "text":
185
+ native_meta = {}
186
+ citations = getattr(block, "citations", None)
187
+ if citations:
188
+ native_meta["citations"] = dump_model(citations)
189
+ blocks.append(
190
+ text_block(getattr(block, "text", ""), meta={"native": native_meta} if native_meta else None)
191
+ )
192
+ continue
193
+
194
+ if block_type == "tool_use":
195
+ native_meta = {}
196
+ caller = getattr(block, "caller", None)
197
+ if caller is not None:
198
+ native_meta["caller"] = caller
199
+ blocks.append(
200
+ tool_use_block(
201
+ tool_id=getattr(block, "id", ""),
202
+ name=getattr(block, "name", ""),
203
+ input=getattr(block, "input", None),
204
+ meta={"native": native_meta} if native_meta else None,
205
+ )
206
+ )
207
+ continue
208
+
209
+ native_meta: dict[str, Any] = {}
210
+ if stop_sequence := getattr(message, "stop_sequence", None):
211
+ native_meta["stop_sequence"] = stop_sequence
212
+ if service_tier := getattr(message, "service_tier", None):
213
+ native_meta["service_tier"] = service_tier
214
+ return assistant_message(
215
+ blocks,
216
+ provider=self.provider_id,
217
+ model=getattr(message, "model", None),
218
+ provider_message_id=getattr(message, "id", None),
219
+ stop_reason=getattr(message, "stop_reason", None),
220
+ usage=dump_model(getattr(message, "usage", None)),
221
+ native_meta=native_meta,
222
+ )
223
+
224
+ def _serialize_tool(self, tool: dict[str, Any]) -> dict[str, Any]:
225
+ return {
226
+ "name": tool.get("name") or "",
227
+ "description": tool.get("description") or "",
228
+ "input_schema": tool.get("input_schema") or {"type": "object", "properties": {}},
229
+ }
230
+
231
+ def _serialize_message(self, message: ConversationMessage) -> dict[str, Any]:
232
+ return {
233
+ "role": str(message.get("role") or "user"),
234
+ "content": [
235
+ self._serialize_block(block) for block in message.get("content") or [] if isinstance(block, dict)
236
+ ],
237
+ }
238
+
239
+ def _serialize_block(self, block: dict[str, Any]) -> dict[str, Any]:
240
+ block_type = block.get("type")
241
+
242
+ if block_type == "text":
243
+ return {"type": "text", "text": str(block.get("text") or "")}
244
+
245
+ if block_type == "thinking":
246
+ native_meta = get_native_meta(block)
247
+ payload: dict[str, Any] = {
248
+ "type": "thinking",
249
+ "thinking": str(block.get("text") or ""),
250
+ }
251
+ if native_meta.get("signature"):
252
+ payload["signature"] = native_meta["signature"]
253
+ return payload
254
+
255
+ if block_type == "tool_use":
256
+ native_meta = get_native_meta(block)
257
+ payload = {
258
+ "type": "tool_use",
259
+ "id": block.get("id"),
260
+ "name": block.get("name"),
261
+ "input": block.get("input") if isinstance(block.get("input"), dict) else {},
262
+ }
263
+ if native_meta.get("caller") is not None:
264
+ payload["caller"] = native_meta["caller"]
265
+ return payload
266
+
267
+ if block_type == "image":
268
+ mime_type, data = load_image_block_payload(block)
269
+ return {
270
+ "type": "image",
271
+ "source": {"type": "base64", "media_type": mime_type, "data": data},
272
+ }
273
+
274
+ if block_type == "tool_result":
275
+ content_blocks = []
276
+ for item in tool_result_content_blocks(block):
277
+ if item.get("type") == "text":
278
+ content_blocks.append({"type": "text", "text": str(item.get("text") or "")})
279
+ continue
280
+ if item.get("type") == "image":
281
+ mime_type, data = load_image_block_payload(item)
282
+ content_blocks.append(
283
+ {"type": "image", "source": {"type": "base64", "media_type": mime_type, "data": data}}
284
+ )
285
+ return {
286
+ "type": "tool_result",
287
+ "tool_use_id": block.get("tool_use_id"),
288
+ "content": content_blocks or str(block.get("model_text") or ""),
289
+ "is_error": bool(block.get("is_error")),
290
+ }
291
+
292
+ return dict(block)
293
+
294
+
295
+ class AnthropicAdapter(AnthropicLikeAdapter):
296
+ provider_id = "anthropic"
297
+ label = "Anthropic"
298
+ default_base_url = "https://api.anthropic.com"
299
+ env_api_key_names = ("ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN")
300
+ default_models = ("claude-sonnet-4-6", "claude-opus-4-6")
301
+ supports_reasoning_effort = True
302
+
303
+ def thinking_config(self, request: ProviderRequest) -> dict[str, Any] | None:
304
+ effort = request.reasoning_effort
305
+ if not effort:
306
+ return None
307
+ if effort == "none":
308
+ return {"type": "disabled"}
309
+ normalized = request.model.lower()
310
+ if normalized.startswith("claude-sonnet-4-6") or normalized.startswith("claude-opus-4-6"):
311
+ return {"type": "adaptive"}
312
+ return self.manual_thinking_config(effort)
313
+
314
+ def output_config(self, request: ProviderRequest) -> dict[str, Any] | None:
315
+ effort = request.reasoning_effort
316
+ if not effort or effort == "none":
317
+ return None
318
+
319
+ normalized = request.model.lower()
320
+ if normalized.startswith("claude-sonnet-4-6"):
321
+ mapped_effort = "high" if effort == "xhigh" else effort
322
+ return {"effort": mapped_effort}
323
+
324
+ if normalized.startswith("claude-opus-4-6"):
325
+ mapped_effort = "max" if effort == "xhigh" else effort
326
+ return {"effort": mapped_effort}
327
+
328
+ return None
329
+
330
+
331
+ class MoonshotAIAdapter(AnthropicLikeAdapter):
332
+ """Moonshot's Anthropic-compatible Messages endpoint.
333
+
334
+ kimi-k2.5 tool loops work through this endpoint. When thinking is enabled,
335
+ prior reasoning blocks must be replayed in the conversation history —
336
+ Moonshot does not strip them on the server side.
337
+ """
338
+
339
+ provider_id = "moonshotai"
340
+ label = "Moonshot"
341
+ default_base_url = "https://api.moonshot.ai/anthropic"
342
+ env_api_key_names = ("MOONSHOT_API_KEY",)
343
+ default_models = ("kimi-k2.5",)
344
+ supports_reasoning_effort = True
345
+
346
+ def thinking_config(self, request: ProviderRequest) -> dict[str, Any] | None:
347
+ return self.manual_thinking_config(request.reasoning_effort)
348
+
349
+
350
+ class MiniMaxAdapter(AnthropicLikeAdapter):
351
+ """MiniMax's Anthropic-compatible Messages endpoint.
352
+
353
+ MiniMax reasoning models emit thinking signatures on this endpoint;
354
+ signatures are preserved in block.meta.native and replayed via
355
+ _serialize_block so multi-turn tool loops stay valid.
356
+ """
357
+
358
+ provider_id = "minimax"
359
+ label = "MiniMax"
360
+ default_base_url = "https://api.minimax.io/anthropic"
361
+ env_api_key_names = ("MINIMAX_API_KEY",)
362
+ default_models = ("MiniMax-M2.7", "MiniMax-M2.7-highspeed")
363
+ supports_reasoning_effort = True
364
+
365
+ def thinking_config(self, request: ProviderRequest) -> dict[str, Any] | None:
366
+ return self.manual_thinking_config(request.reasoning_effort)