kimi-cli-x 1.37.0__tar.gz

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 (250) hide show
  1. kimi_cli_x-1.37.0/PKG-INFO +211 -0
  2. kimi_cli_x-1.37.0/README.md +174 -0
  3. kimi_cli_x-1.37.0/pyproject.toml +117 -0
  4. kimi_cli_x-1.37.0/src/kimi_cli/CHANGELOG.md +1 -0
  5. kimi_cli_x-1.37.0/src/kimi_cli/__init__.py +29 -0
  6. kimi_cli_x-1.37.0/src/kimi_cli/__main__.py +34 -0
  7. kimi_cli_x-1.37.0/src/kimi_cli/acp/AGENTS.md +92 -0
  8. kimi_cli_x-1.37.0/src/kimi_cli/acp/__init__.py +13 -0
  9. kimi_cli_x-1.37.0/src/kimi_cli/acp/convert.py +128 -0
  10. kimi_cli_x-1.37.0/src/kimi_cli/acp/kaos.py +291 -0
  11. kimi_cli_x-1.37.0/src/kimi_cli/acp/mcp.py +46 -0
  12. kimi_cli_x-1.37.0/src/kimi_cli/acp/server.py +458 -0
  13. kimi_cli_x-1.37.0/src/kimi_cli/acp/session.py +496 -0
  14. kimi_cli_x-1.37.0/src/kimi_cli/acp/tools.py +167 -0
  15. kimi_cli_x-1.37.0/src/kimi_cli/acp/types.py +13 -0
  16. kimi_cli_x-1.37.0/src/kimi_cli/acp/version.py +45 -0
  17. kimi_cli_x-1.37.0/src/kimi_cli/agents/default/agent.yaml +36 -0
  18. kimi_cli_x-1.37.0/src/kimi_cli/agents/default/coder.yaml +25 -0
  19. kimi_cli_x-1.37.0/src/kimi_cli/agents/default/explore.yaml +46 -0
  20. kimi_cli_x-1.37.0/src/kimi_cli/agents/default/plan.yaml +30 -0
  21. kimi_cli_x-1.37.0/src/kimi_cli/agents/default/system.md +162 -0
  22. kimi_cli_x-1.37.0/src/kimi_cli/agents/okabe/agent.yaml +22 -0
  23. kimi_cli_x-1.37.0/src/kimi_cli/agentspec.py +160 -0
  24. kimi_cli_x-1.37.0/src/kimi_cli/app.py +718 -0
  25. kimi_cli_x-1.37.0/src/kimi_cli/approval_runtime/__init__.py +29 -0
  26. kimi_cli_x-1.37.0/src/kimi_cli/approval_runtime/models.py +42 -0
  27. kimi_cli_x-1.37.0/src/kimi_cli/approval_runtime/runtime.py +221 -0
  28. kimi_cli_x-1.37.0/src/kimi_cli/auth/__init__.py +5 -0
  29. kimi_cli_x-1.37.0/src/kimi_cli/auth/oauth.py +993 -0
  30. kimi_cli_x-1.37.0/src/kimi_cli/auth/platforms.py +301 -0
  31. kimi_cli_x-1.37.0/src/kimi_cli/background/__init__.py +36 -0
  32. kimi_cli_x-1.37.0/src/kimi_cli/background/agent_runner.py +231 -0
  33. kimi_cli_x-1.37.0/src/kimi_cli/background/ids.py +19 -0
  34. kimi_cli_x-1.37.0/src/kimi_cli/background/manager.py +612 -0
  35. kimi_cli_x-1.37.0/src/kimi_cli/background/models.py +105 -0
  36. kimi_cli_x-1.37.0/src/kimi_cli/background/store.py +237 -0
  37. kimi_cli_x-1.37.0/src/kimi_cli/background/summary.py +66 -0
  38. kimi_cli_x-1.37.0/src/kimi_cli/background/worker.py +209 -0
  39. kimi_cli_x-1.37.0/src/kimi_cli/cli/__init__.py +1066 -0
  40. kimi_cli_x-1.37.0/src/kimi_cli/cli/__main__.py +11 -0
  41. kimi_cli_x-1.37.0/src/kimi_cli/cli/_lazy_group.py +238 -0
  42. kimi_cli_x-1.37.0/src/kimi_cli/cli/export.py +322 -0
  43. kimi_cli_x-1.37.0/src/kimi_cli/cli/info.py +62 -0
  44. kimi_cli_x-1.37.0/src/kimi_cli/cli/mcp.py +349 -0
  45. kimi_cli_x-1.37.0/src/kimi_cli/cli/plugin.py +302 -0
  46. kimi_cli_x-1.37.0/src/kimi_cli/cli/toad.py +73 -0
  47. kimi_cli_x-1.37.0/src/kimi_cli/cli/vis.py +38 -0
  48. kimi_cli_x-1.37.0/src/kimi_cli/cli/web.py +80 -0
  49. kimi_cli_x-1.37.0/src/kimi_cli/config.py +407 -0
  50. kimi_cli_x-1.37.0/src/kimi_cli/constant.py +35 -0
  51. kimi_cli_x-1.37.0/src/kimi_cli/exception.py +43 -0
  52. kimi_cli_x-1.37.0/src/kimi_cli/hooks/__init__.py +4 -0
  53. kimi_cli_x-1.37.0/src/kimi_cli/hooks/config.py +34 -0
  54. kimi_cli_x-1.37.0/src/kimi_cli/hooks/engine.py +357 -0
  55. kimi_cli_x-1.37.0/src/kimi_cli/hooks/events.py +190 -0
  56. kimi_cli_x-1.37.0/src/kimi_cli/hooks/runner.py +89 -0
  57. kimi_cli_x-1.37.0/src/kimi_cli/llm.py +330 -0
  58. kimi_cli_x-1.37.0/src/kimi_cli/metadata.py +79 -0
  59. kimi_cli_x-1.37.0/src/kimi_cli/notifications/__init__.py +33 -0
  60. kimi_cli_x-1.37.0/src/kimi_cli/notifications/llm.py +77 -0
  61. kimi_cli_x-1.37.0/src/kimi_cli/notifications/manager.py +145 -0
  62. kimi_cli_x-1.37.0/src/kimi_cli/notifications/models.py +50 -0
  63. kimi_cli_x-1.37.0/src/kimi_cli/notifications/notifier.py +41 -0
  64. kimi_cli_x-1.37.0/src/kimi_cli/notifications/store.py +118 -0
  65. kimi_cli_x-1.37.0/src/kimi_cli/notifications/wire.py +21 -0
  66. kimi_cli_x-1.37.0/src/kimi_cli/plugin/__init__.py +124 -0
  67. kimi_cli_x-1.37.0/src/kimi_cli/plugin/manager.py +153 -0
  68. kimi_cli_x-1.37.0/src/kimi_cli/plugin/tool.py +173 -0
  69. kimi_cli_x-1.37.0/src/kimi_cli/prompts/__init__.py +6 -0
  70. kimi_cli_x-1.37.0/src/kimi_cli/prompts/compact.md +73 -0
  71. kimi_cli_x-1.37.0/src/kimi_cli/prompts/init.md +21 -0
  72. kimi_cli_x-1.37.0/src/kimi_cli/py.typed +0 -0
  73. kimi_cli_x-1.37.0/src/kimi_cli/session.py +319 -0
  74. kimi_cli_x-1.37.0/src/kimi_cli/session_fork.py +325 -0
  75. kimi_cli_x-1.37.0/src/kimi_cli/session_state.py +128 -0
  76. kimi_cli_x-1.37.0/src/kimi_cli/share.py +14 -0
  77. kimi_cli_x-1.37.0/src/kimi_cli/skill/__init__.py +388 -0
  78. kimi_cli_x-1.37.0/src/kimi_cli/skill/flow/__init__.py +99 -0
  79. kimi_cli_x-1.37.0/src/kimi_cli/skill/flow/d2.py +482 -0
  80. kimi_cli_x-1.37.0/src/kimi_cli/skill/flow/mermaid.py +266 -0
  81. kimi_cli_x-1.37.0/src/kimi_cli/skills/backup_/kimi-cli-help/SKILL.md +40 -0
  82. kimi_cli_x-1.37.0/src/kimi_cli/skills/skill-creator/SKILL.md +109 -0
  83. kimi_cli_x-1.37.0/src/kimi_cli/soul/__init__.py +302 -0
  84. kimi_cli_x-1.37.0/src/kimi_cli/soul/agent.py +533 -0
  85. kimi_cli_x-1.37.0/src/kimi_cli/soul/approval.py +173 -0
  86. kimi_cli_x-1.37.0/src/kimi_cli/soul/btw.py +212 -0
  87. kimi_cli_x-1.37.0/src/kimi_cli/soul/compaction.py +189 -0
  88. kimi_cli_x-1.37.0/src/kimi_cli/soul/context.py +339 -0
  89. kimi_cli_x-1.37.0/src/kimi_cli/soul/denwarenji.py +39 -0
  90. kimi_cli_x-1.37.0/src/kimi_cli/soul/dynamic_injection.py +66 -0
  91. kimi_cli_x-1.37.0/src/kimi_cli/soul/dynamic_injections/__init__.py +0 -0
  92. kimi_cli_x-1.37.0/src/kimi_cli/soul/dynamic_injections/plan_mode.py +238 -0
  93. kimi_cli_x-1.37.0/src/kimi_cli/soul/dynamic_injections/yolo_mode.py +37 -0
  94. kimi_cli_x-1.37.0/src/kimi_cli/soul/kimisoul.py +1352 -0
  95. kimi_cli_x-1.37.0/src/kimi_cli/soul/message.py +92 -0
  96. kimi_cli_x-1.37.0/src/kimi_cli/soul/slash.py +285 -0
  97. kimi_cli_x-1.37.0/src/kimi_cli/soul/toolset.py +810 -0
  98. kimi_cli_x-1.37.0/src/kimi_cli/subagents/__init__.py +21 -0
  99. kimi_cli_x-1.37.0/src/kimi_cli/subagents/builder.py +42 -0
  100. kimi_cli_x-1.37.0/src/kimi_cli/subagents/core.py +86 -0
  101. kimi_cli_x-1.37.0/src/kimi_cli/subagents/git_context.py +170 -0
  102. kimi_cli_x-1.37.0/src/kimi_cli/subagents/models.py +54 -0
  103. kimi_cli_x-1.37.0/src/kimi_cli/subagents/output.py +71 -0
  104. kimi_cli_x-1.37.0/src/kimi_cli/subagents/registry.py +28 -0
  105. kimi_cli_x-1.37.0/src/kimi_cli/subagents/runner.py +425 -0
  106. kimi_cli_x-1.37.0/src/kimi_cli/subagents/store.py +196 -0
  107. kimi_cli_x-1.37.0/src/kimi_cli/tools/AGENTS.md +1 -0
  108. kimi_cli_x-1.37.0/src/kimi_cli/tools/__init__.py +105 -0
  109. kimi_cli_x-1.37.0/src/kimi_cli/tools/agent/__init__.py +265 -0
  110. kimi_cli_x-1.37.0/src/kimi_cli/tools/agent/description.md +14 -0
  111. kimi_cli_x-1.37.0/src/kimi_cli/tools/ask_user/__init__.py +151 -0
  112. kimi_cli_x-1.37.0/src/kimi_cli/tools/ask_user/description.md +1 -0
  113. kimi_cli_x-1.37.0/src/kimi_cli/tools/background/__init__.py +318 -0
  114. kimi_cli_x-1.37.0/src/kimi_cli/tools/background/list.md +7 -0
  115. kimi_cli_x-1.37.0/src/kimi_cli/tools/background/output.md +7 -0
  116. kimi_cli_x-1.37.0/src/kimi_cli/tools/background/stop.md +1 -0
  117. kimi_cli_x-1.37.0/src/kimi_cli/tools/display.py +46 -0
  118. kimi_cli_x-1.37.0/src/kimi_cli/tools/dmail/__init__.py +38 -0
  119. kimi_cli_x-1.37.0/src/kimi_cli/tools/dmail/dmail.md +1 -0
  120. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/__init__.py +30 -0
  121. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/check_fmt.py +95 -0
  122. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/glob.md +1 -0
  123. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/glob.py +164 -0
  124. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/grep.md +1 -0
  125. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/grep_local.py +1035 -0
  126. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/plan_mode.py +42 -0
  127. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/read.md +1 -0
  128. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/read.py +280 -0
  129. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/read_media.md +1 -0
  130. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/read_media.py +214 -0
  131. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/replace.md +1 -0
  132. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/replace.py +240 -0
  133. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/utils.py +257 -0
  134. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/write.md +1 -0
  135. kimi_cli_x-1.37.0/src/kimi_cli/tools/file/write.py +249 -0
  136. kimi_cli_x-1.37.0/src/kimi_cli/tools/plan/__init__.py +317 -0
  137. kimi_cli_x-1.37.0/src/kimi_cli/tools/plan/description.md +11 -0
  138. kimi_cli_x-1.37.0/src/kimi_cli/tools/plan/enter.py +188 -0
  139. kimi_cli_x-1.37.0/src/kimi_cli/tools/plan/enter_description.md +9 -0
  140. kimi_cli_x-1.37.0/src/kimi_cli/tools/plan/heroes.py +277 -0
  141. kimi_cli_x-1.37.0/src/kimi_cli/tools/shell/__init__.py +246 -0
  142. kimi_cli_x-1.37.0/src/kimi_cli/tools/shell/bash.md +25 -0
  143. kimi_cli_x-1.37.0/src/kimi_cli/tools/shell/powershell.md +1 -0
  144. kimi_cli_x-1.37.0/src/kimi_cli/tools/test.py +55 -0
  145. kimi_cli_x-1.37.0/src/kimi_cli/tools/think/__init__.py +21 -0
  146. kimi_cli_x-1.37.0/src/kimi_cli/tools/think/think.md +1 -0
  147. kimi_cli_x-1.37.0/src/kimi_cli/tools/todo/__init__.py +165 -0
  148. kimi_cli_x-1.37.0/src/kimi_cli/tools/todo/set_todo_list.md +5 -0
  149. kimi_cli_x-1.37.0/src/kimi_cli/tools/utils.py +198 -0
  150. kimi_cli_x-1.37.0/src/kimi_cli/tools/web/__init__.py +4 -0
  151. kimi_cli_x-1.37.0/src/kimi_cli/tools/web/fetch.md +1 -0
  152. kimi_cli_x-1.37.0/src/kimi_cli/tools/web/fetch.py +188 -0
  153. kimi_cli_x-1.37.0/src/kimi_cli/tools/web/search.md +1 -0
  154. kimi_cli_x-1.37.0/src/kimi_cli/tools/web/search.py +153 -0
  155. kimi_cli_x-1.37.0/src/kimi_cli/ui/__init__.py +0 -0
  156. kimi_cli_x-1.37.0/src/kimi_cli/ui/acp/__init__.py +99 -0
  157. kimi_cli_x-1.37.0/src/kimi_cli/ui/print/__init__.py +474 -0
  158. kimi_cli_x-1.37.0/src/kimi_cli/ui/print/visualize.py +185 -0
  159. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/__init__.py +1455 -0
  160. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/console.py +109 -0
  161. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/debug.py +190 -0
  162. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/echo.py +17 -0
  163. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/export_import.py +111 -0
  164. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/keyboard.py +300 -0
  165. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/mcp_status.py +111 -0
  166. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/oauth.py +143 -0
  167. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/placeholders.py +531 -0
  168. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/prompt.py +2207 -0
  169. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/replay.py +215 -0
  170. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/session_picker.py +227 -0
  171. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/setup.py +212 -0
  172. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/slash.py +821 -0
  173. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/startup.py +32 -0
  174. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/task_browser.py +486 -0
  175. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/update.py +349 -0
  176. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/usage.py +281 -0
  177. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/visualize/__init__.py +165 -0
  178. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/visualize/_approval_panel.py +481 -0
  179. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/visualize/_blocks.py +629 -0
  180. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/visualize/_btw_panel.py +224 -0
  181. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/visualize/_input_router.py +48 -0
  182. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/visualize/_interactive.py +517 -0
  183. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/visualize/_live_view.py +814 -0
  184. kimi_cli_x-1.37.0/src/kimi_cli/ui/shell/visualize/_question_panel.py +586 -0
  185. kimi_cli_x-1.37.0/src/kimi_cli/ui/theme.py +238 -0
  186. kimi_cli_x-1.37.0/src/kimi_cli/utils/__init__.py +0 -0
  187. kimi_cli_x-1.37.0/src/kimi_cli/utils/aiohttp.py +24 -0
  188. kimi_cli_x-1.37.0/src/kimi_cli/utils/aioqueue.py +72 -0
  189. kimi_cli_x-1.37.0/src/kimi_cli/utils/broadcast.py +37 -0
  190. kimi_cli_x-1.37.0/src/kimi_cli/utils/changelog.py +108 -0
  191. kimi_cli_x-1.37.0/src/kimi_cli/utils/clipboard.py +169 -0
  192. kimi_cli_x-1.37.0/src/kimi_cli/utils/datetime.py +64 -0
  193. kimi_cli_x-1.37.0/src/kimi_cli/utils/diff.py +135 -0
  194. kimi_cli_x-1.37.0/src/kimi_cli/utils/editor.py +91 -0
  195. kimi_cli_x-1.37.0/src/kimi_cli/utils/environment.py +100 -0
  196. kimi_cli_x-1.37.0/src/kimi_cli/utils/envvar.py +22 -0
  197. kimi_cli_x-1.37.0/src/kimi_cli/utils/export.py +696 -0
  198. kimi_cli_x-1.37.0/src/kimi_cli/utils/file_filter.py +367 -0
  199. kimi_cli_x-1.37.0/src/kimi_cli/utils/frontmatter.py +50 -0
  200. kimi_cli_x-1.37.0/src/kimi_cli/utils/io.py +19 -0
  201. kimi_cli_x-1.37.0/src/kimi_cli/utils/logging.py +124 -0
  202. kimi_cli_x-1.37.0/src/kimi_cli/utils/media_tags.py +29 -0
  203. kimi_cli_x-1.37.0/src/kimi_cli/utils/message.py +24 -0
  204. kimi_cli_x-1.37.0/src/kimi_cli/utils/path.py +182 -0
  205. kimi_cli_x-1.37.0/src/kimi_cli/utils/proctitle.py +33 -0
  206. kimi_cli_x-1.37.0/src/kimi_cli/utils/proxy.py +31 -0
  207. kimi_cli_x-1.37.0/src/kimi_cli/utils/pyinstaller.py +39 -0
  208. kimi_cli_x-1.37.0/src/kimi_cli/utils/rich/__init__.py +33 -0
  209. kimi_cli_x-1.37.0/src/kimi_cli/utils/rich/columns.py +99 -0
  210. kimi_cli_x-1.37.0/src/kimi_cli/utils/rich/diff_render.py +481 -0
  211. kimi_cli_x-1.37.0/src/kimi_cli/utils/rich/markdown.py +900 -0
  212. kimi_cli_x-1.37.0/src/kimi_cli/utils/rich/markdown_sample.md +108 -0
  213. kimi_cli_x-1.37.0/src/kimi_cli/utils/rich/markdown_sample_short.md +2 -0
  214. kimi_cli_x-1.37.0/src/kimi_cli/utils/rich/syntax.py +114 -0
  215. kimi_cli_x-1.37.0/src/kimi_cli/utils/sensitive.py +54 -0
  216. kimi_cli_x-1.37.0/src/kimi_cli/utils/server.py +121 -0
  217. kimi_cli_x-1.37.0/src/kimi_cli/utils/signals.py +43 -0
  218. kimi_cli_x-1.37.0/src/kimi_cli/utils/slashcmd.py +124 -0
  219. kimi_cli_x-1.37.0/src/kimi_cli/utils/string.py +41 -0
  220. kimi_cli_x-1.37.0/src/kimi_cli/utils/subprocess_env.py +73 -0
  221. kimi_cli_x-1.37.0/src/kimi_cli/utils/term.py +168 -0
  222. kimi_cli_x-1.37.0/src/kimi_cli/utils/typing.py +20 -0
  223. kimi_cli_x-1.37.0/src/kimi_cli/vis/__init__.py +0 -0
  224. kimi_cli_x-1.37.0/src/kimi_cli/vis/api/__init__.py +5 -0
  225. kimi_cli_x-1.37.0/src/kimi_cli/vis/api/sessions.py +687 -0
  226. kimi_cli_x-1.37.0/src/kimi_cli/vis/api/statistics.py +209 -0
  227. kimi_cli_x-1.37.0/src/kimi_cli/vis/api/system.py +19 -0
  228. kimi_cli_x-1.37.0/src/kimi_cli/vis/app.py +175 -0
  229. kimi_cli_x-1.37.0/src/kimi_cli/web/__init__.py +5 -0
  230. kimi_cli_x-1.37.0/src/kimi_cli/web/api/__init__.py +15 -0
  231. kimi_cli_x-1.37.0/src/kimi_cli/web/api/config.py +208 -0
  232. kimi_cli_x-1.37.0/src/kimi_cli/web/api/open_in.py +197 -0
  233. kimi_cli_x-1.37.0/src/kimi_cli/web/api/sessions.py +1213 -0
  234. kimi_cli_x-1.37.0/src/kimi_cli/web/app.py +451 -0
  235. kimi_cli_x-1.37.0/src/kimi_cli/web/auth.py +191 -0
  236. kimi_cli_x-1.37.0/src/kimi_cli/web/models.py +98 -0
  237. kimi_cli_x-1.37.0/src/kimi_cli/web/runner/__init__.py +5 -0
  238. kimi_cli_x-1.37.0/src/kimi_cli/web/runner/messages.py +57 -0
  239. kimi_cli_x-1.37.0/src/kimi_cli/web/runner/process.py +754 -0
  240. kimi_cli_x-1.37.0/src/kimi_cli/web/runner/worker.py +93 -0
  241. kimi_cli_x-1.37.0/src/kimi_cli/web/store/__init__.py +1 -0
  242. kimi_cli_x-1.37.0/src/kimi_cli/web/store/sessions.py +432 -0
  243. kimi_cli_x-1.37.0/src/kimi_cli/wire/__init__.py +148 -0
  244. kimi_cli_x-1.37.0/src/kimi_cli/wire/file.py +151 -0
  245. kimi_cli_x-1.37.0/src/kimi_cli/wire/jsonrpc.py +263 -0
  246. kimi_cli_x-1.37.0/src/kimi_cli/wire/protocol.py +2 -0
  247. kimi_cli_x-1.37.0/src/kimi_cli/wire/root_hub.py +27 -0
  248. kimi_cli_x-1.37.0/src/kimi_cli/wire/serde.py +26 -0
  249. kimi_cli_x-1.37.0/src/kimi_cli/wire/server.py +1038 -0
  250. kimi_cli_x-1.37.0/src/kimi_cli/wire/types.py +698 -0
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.3
2
+ Name: kimi-cli-x
3
+ Version: 1.37.0
4
+ Summary: Kimi Code CLI is your next CLI agent.
5
+ Requires-Dist: agent-client-protocol==0.8.0
6
+ Requires-Dist: aiofiles>=24.0,<26.0
7
+ Requires-Dist: aiohttp==3.13.3
8
+ Requires-Dist: typer==0.21.1
9
+ Requires-Dist: kosong==0.50.0
10
+ Requires-Dist: loguru>=0.6.0,<0.8
11
+ Requires-Dist: prompt-toolkit==3.0.52
12
+ Requires-Dist: pillow==12.1.0
13
+ Requires-Dist: pyyaml==6.0.3
14
+ Requires-Dist: rich==14.2.0
15
+ Requires-Dist: ripgrepy==2.2.0
16
+ Requires-Dist: streamingjson==0.0.5
17
+ Requires-Dist: trafilatura==2.0.0
18
+ Requires-Dist: lxml==6.0.2
19
+ Requires-Dist: tenacity
20
+ Requires-Dist: fastmcp
21
+ Requires-Dist: pydantic==2.13.2
22
+ Requires-Dist: httpx[socks]==0.28.1
23
+ Requires-Dist: pykaos==0.9.0
24
+ Requires-Dist: batrachian-toad==0.5.23 ; python_full_version >= '3.14'
25
+ Requires-Dist: tomlkit==0.14.0
26
+ Requires-Dist: jinja2==3.1.6
27
+ Requires-Dist: pyobjc-framework-cocoa>=12.1 ; sys_platform == 'darwin'
28
+ Requires-Dist: fastapi>=0.115.0
29
+ Requires-Dist: uvicorn[standard]>=0.32.0
30
+ Requires-Dist: scalar-fastapi>=1.5.0
31
+ Requires-Dist: websockets>=14.0
32
+ Requires-Dist: keyring>=25.7.0
33
+ Requires-Dist: setproctitle>=1.3.0
34
+ Requires-Dist: demjson3
35
+ Requires-Python: >=3.12
36
+ Description-Content-Type: text/markdown
37
+
38
+ # Kimi Code CLI
39
+
40
+ [![Commit Activity](https://img.shields.io/github/commit-activity/w/MoonshotAI/kimi-cli)](https://github.com/MoonshotAI/kimi-cli/graphs/commit-activity)
41
+ [![Checks](https://img.shields.io/github/check-runs/MoonshotAI/kimi-cli/main)](https://github.com/MoonshotAI/kimi-cli/actions)
42
+ [![Version](https://img.shields.io/pypi/v/kimi-cli)](https://pypi.org/project/kimi-cli/)
43
+ [![Downloads](https://img.shields.io/pypi/dw/kimi-cli)](https://pypistats.org/packages/kimi-cli)
44
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/MoonshotAI/kimi-cli)
45
+
46
+ [Kimi Code](https://www.kimi.com/code/) | [Documentation](https://moonshotai.github.io/kimi-cli/en/) | [文档](https://moonshotai.github.io/kimi-cli/zh/)
47
+
48
+ Kimi Code CLI is an AI agent that runs in the terminal, helping you complete software development tasks and terminal operations. It can read and edit code, execute shell commands, search and fetch web pages, and autonomously plan and adjust actions during execution.
49
+
50
+ ## Getting Started
51
+
52
+ See [Getting Started](https://moonshotai.github.io/kimi-cli/en/guides/getting-started.html) for how to install and start using Kimi Code CLI.
53
+
54
+ ## Key Features
55
+
56
+ ### Shell command mode
57
+
58
+ Kimi Code CLI is not only a coding agent, but also a shell. You can switch the shell command mode by pressing `Ctrl-X`. In this mode, you can directly run shell commands without leaving Kimi Code CLI.
59
+
60
+ ![](./docs/media/shell-mode.gif)
61
+
62
+ > [!NOTE]
63
+ > Built-in shell commands like `cd` are not supported yet.
64
+
65
+ ### VS Code extension
66
+
67
+ Kimi Code CLI can be integrated with [Visual Studio Code](https://code.visualstudio.com/) via the [Kimi Code VS Code Extension](https://marketplace.visualstudio.com/items?itemName=moonshot-ai.kimi-code).
68
+
69
+ ![VS Code Extension](./docs/media/vscode.png)
70
+
71
+ ### IDE integration via ACP
72
+
73
+ Kimi Code CLI supports [Agent Client Protocol] out of the box. You can use it together with any ACP-compatible editor or IDE.
74
+
75
+ [Agent Client Protocol]: https://github.com/agentclientprotocol/agent-client-protocol
76
+
77
+ To use Kimi Code CLI with ACP clients, make sure to run Kimi Code CLI in the terminal and send `/login` to complete the login first. Then, you can configure your ACP client to start Kimi Code CLI as an ACP agent server with command `kimi acp`.
78
+
79
+ For example, to use Kimi Code CLI with [Zed](https://zed.dev/) or [JetBrains](https://blog.jetbrains.com/ai/2025/12/bring-your-own-ai-agent-to-jetbrains-ides/), add the following configuration to your `~/.config/zed/settings.json` or `~/.jetbrains/acp.json` file:
80
+
81
+ ```json
82
+ {
83
+ "agent_servers": {
84
+ "Kimi Code CLI": {
85
+ "type": "custom",
86
+ "command": "kimi",
87
+ "args": ["acp"],
88
+ "env": {}
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ Then you can create Kimi Code CLI threads in IDE's agent panel.
95
+
96
+ ![](./docs/media/acp-integration.gif)
97
+
98
+ ### Zsh integration
99
+
100
+ You can use Kimi Code CLI together with Zsh, to empower your shell experience with AI agent capabilities.
101
+
102
+ Install the [zsh-kimi-cli](https://github.com/MoonshotAI/zsh-kimi-cli) plugin via:
103
+
104
+ ```sh
105
+ git clone https://github.com/MoonshotAI/zsh-kimi-cli.git \
106
+ ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/kimi-cli
107
+ ```
108
+
109
+ > [!NOTE]
110
+ > If you are using a plugin manager other than Oh My Zsh, you may need to refer to the plugin's README for installation instructions.
111
+
112
+ Then add `kimi-cli` to your Zsh plugin list in `~/.zshrc`:
113
+
114
+ ```sh
115
+ plugins=(... kimi-cli)
116
+ ```
117
+
118
+ After restarting Zsh, you can switch to agent mode by pressing `Ctrl-X`.
119
+
120
+ ### MCP support
121
+
122
+ Kimi Code CLI supports MCP (Model Context Protocol) tools.
123
+
124
+ **`kimi mcp` sub-command group**
125
+
126
+ You can manage MCP servers with `kimi mcp` sub-command group. For example:
127
+
128
+ ```sh
129
+ # Add streamable HTTP server:
130
+ kimi mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: ctx7sk-your-key"
131
+
132
+ # Add streamable HTTP server with OAuth authorization:
133
+ kimi mcp add --transport http --auth oauth linear https://mcp.linear.app/mcp
134
+
135
+ # Add stdio server:
136
+ kimi mcp add --transport stdio chrome-devtools -- npx chrome-devtools-mcp@latest
137
+
138
+ # List added MCP servers:
139
+ kimi mcp list
140
+
141
+ # Remove an MCP server:
142
+ kimi mcp remove chrome-devtools
143
+
144
+ # Authorize an MCP server:
145
+ kimi mcp auth linear
146
+ ```
147
+
148
+ **Ad-hoc MCP configuration**
149
+
150
+ Kimi Code CLI also supports ad-hoc MCP server configuration via CLI option.
151
+
152
+ Given an MCP config file in the well-known MCP config format like the following:
153
+
154
+ ```json
155
+ {
156
+ "mcpServers": {
157
+ "context7": {
158
+ "url": "https://mcp.context7.com/mcp",
159
+ "headers": {
160
+ "CONTEXT7_API_KEY": "YOUR_API_KEY"
161
+ }
162
+ },
163
+ "chrome-devtools": {
164
+ "command": "npx",
165
+ "args": ["-y", "chrome-devtools-mcp@latest"]
166
+ }
167
+ }
168
+ }
169
+ ```
170
+
171
+ Run `kimi` with `--mcp-config-file` option to connect to the specified MCP servers:
172
+
173
+ ```sh
174
+ kimi --mcp-config-file /path/to/mcp.json
175
+ ```
176
+
177
+ ### More
178
+
179
+ See more features in the [Documentation](https://moonshotai.github.io/kimi-cli/en/).
180
+
181
+ ## Development
182
+
183
+ To develop Kimi Code CLI, run:
184
+
185
+ ```sh
186
+ git clone https://github.com/MoonshotAI/kimi-cli.git
187
+ cd kimi-cli
188
+
189
+ make prepare # prepare the development environment
190
+ ```
191
+
192
+ Then you can start working on Kimi Code CLI.
193
+
194
+ Refer to the following commands after you make changes:
195
+
196
+ ```sh
197
+ uv run kimi # run Kimi Code CLI
198
+
199
+ make format # format code
200
+ make check # run linting and type checking
201
+ make test # run tests
202
+ make test-kimi-cli # run Kimi Code CLI tests only
203
+ make test-kosong # run kosong tests only
204
+ make test-pykaos # run pykaos tests only
205
+ make build-web # build the web UI and sync it into the package (requires Node.js/npm)
206
+ make build # build python packages
207
+ make build-bin # build standalone binary
208
+ make help # show all make targets
209
+ ```
210
+
211
+ Note: `make build` and `make build-bin` automatically run `make build-web` to embed the web UI.
@@ -0,0 +1,174 @@
1
+ # Kimi Code CLI
2
+
3
+ [![Commit Activity](https://img.shields.io/github/commit-activity/w/MoonshotAI/kimi-cli)](https://github.com/MoonshotAI/kimi-cli/graphs/commit-activity)
4
+ [![Checks](https://img.shields.io/github/check-runs/MoonshotAI/kimi-cli/main)](https://github.com/MoonshotAI/kimi-cli/actions)
5
+ [![Version](https://img.shields.io/pypi/v/kimi-cli)](https://pypi.org/project/kimi-cli/)
6
+ [![Downloads](https://img.shields.io/pypi/dw/kimi-cli)](https://pypistats.org/packages/kimi-cli)
7
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/MoonshotAI/kimi-cli)
8
+
9
+ [Kimi Code](https://www.kimi.com/code/) | [Documentation](https://moonshotai.github.io/kimi-cli/en/) | [文档](https://moonshotai.github.io/kimi-cli/zh/)
10
+
11
+ Kimi Code CLI is an AI agent that runs in the terminal, helping you complete software development tasks and terminal operations. It can read and edit code, execute shell commands, search and fetch web pages, and autonomously plan and adjust actions during execution.
12
+
13
+ ## Getting Started
14
+
15
+ See [Getting Started](https://moonshotai.github.io/kimi-cli/en/guides/getting-started.html) for how to install and start using Kimi Code CLI.
16
+
17
+ ## Key Features
18
+
19
+ ### Shell command mode
20
+
21
+ Kimi Code CLI is not only a coding agent, but also a shell. You can switch the shell command mode by pressing `Ctrl-X`. In this mode, you can directly run shell commands without leaving Kimi Code CLI.
22
+
23
+ ![](./docs/media/shell-mode.gif)
24
+
25
+ > [!NOTE]
26
+ > Built-in shell commands like `cd` are not supported yet.
27
+
28
+ ### VS Code extension
29
+
30
+ Kimi Code CLI can be integrated with [Visual Studio Code](https://code.visualstudio.com/) via the [Kimi Code VS Code Extension](https://marketplace.visualstudio.com/items?itemName=moonshot-ai.kimi-code).
31
+
32
+ ![VS Code Extension](./docs/media/vscode.png)
33
+
34
+ ### IDE integration via ACP
35
+
36
+ Kimi Code CLI supports [Agent Client Protocol] out of the box. You can use it together with any ACP-compatible editor or IDE.
37
+
38
+ [Agent Client Protocol]: https://github.com/agentclientprotocol/agent-client-protocol
39
+
40
+ To use Kimi Code CLI with ACP clients, make sure to run Kimi Code CLI in the terminal and send `/login` to complete the login first. Then, you can configure your ACP client to start Kimi Code CLI as an ACP agent server with command `kimi acp`.
41
+
42
+ For example, to use Kimi Code CLI with [Zed](https://zed.dev/) or [JetBrains](https://blog.jetbrains.com/ai/2025/12/bring-your-own-ai-agent-to-jetbrains-ides/), add the following configuration to your `~/.config/zed/settings.json` or `~/.jetbrains/acp.json` file:
43
+
44
+ ```json
45
+ {
46
+ "agent_servers": {
47
+ "Kimi Code CLI": {
48
+ "type": "custom",
49
+ "command": "kimi",
50
+ "args": ["acp"],
51
+ "env": {}
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ Then you can create Kimi Code CLI threads in IDE's agent panel.
58
+
59
+ ![](./docs/media/acp-integration.gif)
60
+
61
+ ### Zsh integration
62
+
63
+ You can use Kimi Code CLI together with Zsh, to empower your shell experience with AI agent capabilities.
64
+
65
+ Install the [zsh-kimi-cli](https://github.com/MoonshotAI/zsh-kimi-cli) plugin via:
66
+
67
+ ```sh
68
+ git clone https://github.com/MoonshotAI/zsh-kimi-cli.git \
69
+ ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/kimi-cli
70
+ ```
71
+
72
+ > [!NOTE]
73
+ > If you are using a plugin manager other than Oh My Zsh, you may need to refer to the plugin's README for installation instructions.
74
+
75
+ Then add `kimi-cli` to your Zsh plugin list in `~/.zshrc`:
76
+
77
+ ```sh
78
+ plugins=(... kimi-cli)
79
+ ```
80
+
81
+ After restarting Zsh, you can switch to agent mode by pressing `Ctrl-X`.
82
+
83
+ ### MCP support
84
+
85
+ Kimi Code CLI supports MCP (Model Context Protocol) tools.
86
+
87
+ **`kimi mcp` sub-command group**
88
+
89
+ You can manage MCP servers with `kimi mcp` sub-command group. For example:
90
+
91
+ ```sh
92
+ # Add streamable HTTP server:
93
+ kimi mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: ctx7sk-your-key"
94
+
95
+ # Add streamable HTTP server with OAuth authorization:
96
+ kimi mcp add --transport http --auth oauth linear https://mcp.linear.app/mcp
97
+
98
+ # Add stdio server:
99
+ kimi mcp add --transport stdio chrome-devtools -- npx chrome-devtools-mcp@latest
100
+
101
+ # List added MCP servers:
102
+ kimi mcp list
103
+
104
+ # Remove an MCP server:
105
+ kimi mcp remove chrome-devtools
106
+
107
+ # Authorize an MCP server:
108
+ kimi mcp auth linear
109
+ ```
110
+
111
+ **Ad-hoc MCP configuration**
112
+
113
+ Kimi Code CLI also supports ad-hoc MCP server configuration via CLI option.
114
+
115
+ Given an MCP config file in the well-known MCP config format like the following:
116
+
117
+ ```json
118
+ {
119
+ "mcpServers": {
120
+ "context7": {
121
+ "url": "https://mcp.context7.com/mcp",
122
+ "headers": {
123
+ "CONTEXT7_API_KEY": "YOUR_API_KEY"
124
+ }
125
+ },
126
+ "chrome-devtools": {
127
+ "command": "npx",
128
+ "args": ["-y", "chrome-devtools-mcp@latest"]
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ Run `kimi` with `--mcp-config-file` option to connect to the specified MCP servers:
135
+
136
+ ```sh
137
+ kimi --mcp-config-file /path/to/mcp.json
138
+ ```
139
+
140
+ ### More
141
+
142
+ See more features in the [Documentation](https://moonshotai.github.io/kimi-cli/en/).
143
+
144
+ ## Development
145
+
146
+ To develop Kimi Code CLI, run:
147
+
148
+ ```sh
149
+ git clone https://github.com/MoonshotAI/kimi-cli.git
150
+ cd kimi-cli
151
+
152
+ make prepare # prepare the development environment
153
+ ```
154
+
155
+ Then you can start working on Kimi Code CLI.
156
+
157
+ Refer to the following commands after you make changes:
158
+
159
+ ```sh
160
+ uv run kimi # run Kimi Code CLI
161
+
162
+ make format # format code
163
+ make check # run linting and type checking
164
+ make test # run tests
165
+ make test-kimi-cli # run Kimi Code CLI tests only
166
+ make test-kosong # run kosong tests only
167
+ make test-pykaos # run pykaos tests only
168
+ make build-web # build the web UI and sync it into the package (requires Node.js/npm)
169
+ make build # build python packages
170
+ make build-bin # build standalone binary
171
+ make help # show all make targets
172
+ ```
173
+
174
+ Note: `make build` and `make build-bin` automatically run `make build-web` to embed the web UI.
@@ -0,0 +1,117 @@
1
+ [project]
2
+ name = "kimi-cli-x"
3
+ version = "1.37.0"
4
+ description = "Kimi Code CLI is your next CLI agent."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = [
8
+ "agent-client-protocol==0.8.0",
9
+ "aiofiles>=24.0,<26.0",
10
+ "aiohttp==3.13.3",
11
+ "typer==0.21.1",
12
+ "kosong==0.50.0",
13
+ # loguru stays >=0.6.0 because notify-py (via batrachian-toad) caps it at <=0.6.0 on 3.14+.
14
+ "loguru>=0.6.0,<0.8",
15
+ "prompt-toolkit==3.0.52",
16
+ "pillow==12.1.0",
17
+ "pyyaml==6.0.3",
18
+ "rich==14.2.0",
19
+ "ripgrepy==2.2.0",
20
+ "streamingjson==0.0.5",
21
+ "trafilatura==2.0.0",
22
+ # lxml is used by trafilatura/htmldate/justext; keep pinned for binary wheels.
23
+ "lxml==6.0.2",
24
+ "tenacity",
25
+ "fastmcp",
26
+ "pydantic==2.13.2",
27
+ "httpx[socks]==0.28.1",
28
+ "pykaos==0.9.0",
29
+ "batrachian-toad==0.5.23; python_version >= \"3.14\"",
30
+ "tomlkit==0.14.0",
31
+ "jinja2==3.1.6",
32
+ "pyobjc-framework-cocoa>=12.1 ; sys_platform == 'darwin'",
33
+ "fastapi>=0.115.0",
34
+ "uvicorn[standard]>=0.32.0",
35
+ "scalar-fastapi>=1.5.0",
36
+ "websockets>=14.0",
37
+ "keyring>=25.7.0",
38
+ "setproctitle>=1.3.0",
39
+ "demjson3",
40
+ ]
41
+
42
+ [dependency-groups]
43
+ dev = [
44
+ "pyinstaller==6.18.0",
45
+ "inline-snapshot[black]>=0.31.1",
46
+ "pyright>=1.1.407",
47
+ "ty>=0.0.9",
48
+ "pytest>=9.0.2",
49
+ "pytest-asyncio>=1.3.0",
50
+ "ruff>=0.14.10",
51
+ ]
52
+
53
+ [build-system]
54
+ requires = ["uv_build>=0.8.5,<0.10.0"]
55
+ build-backend = "uv_build"
56
+
57
+ [tool.uv.build-backend]
58
+ module-name = ["kimi_cli"]
59
+ source-exclude = ["examples/**/*", "tests/**/*", "src/kimi_cli/deps/**/*"]
60
+
61
+ [tool.uv.sources]
62
+ kosong = { workspace = true }
63
+ pykaos = { workspace = true }
64
+ kimi-cli = { workspace = true }
65
+
66
+ [project.scripts]
67
+ kimi = "kimi_cli.__main__:main"
68
+ kimi-cli = "kimi_cli.__main__:main"
69
+
70
+ [tool.ruff]
71
+ line-length = 100
72
+
73
+ [tool.ruff.lint]
74
+ select = [
75
+ "E", # pycodestyle
76
+ "F", # Pyflakes
77
+ "UP", # pyupgrade
78
+ "B", # flake8-bugbear
79
+ "SIM", # flake8-simplify
80
+ "I", # isort
81
+ ]
82
+
83
+ [tool.ruff.lint.per-file-ignores]
84
+ "tests/**/*.py" = ["E501"]
85
+ "tests_e2e/**/*.py" = ["E501"]
86
+ "src/kimi_cli/web/api/**/*.py" = ["B008"] # FastAPI Depends() is standard usage
87
+
88
+ [tool.pyright]
89
+ typeCheckingMode = "standard"
90
+ pythonVersion = "3.14"
91
+ include = [
92
+ "src/**/*.py",
93
+ "tests/**/*.py",
94
+ "tests_ai/scripts/**/*.py",
95
+ "tests_e2e/**/*.py",
96
+ ]
97
+ strict = ["src/kimi_cli/**/*.py"]
98
+
99
+ [tool.ty.environment]
100
+ python-version = "3.14"
101
+
102
+ [tool.ty.src]
103
+ include = [
104
+ "src/**/*.py",
105
+ "tests/**/*.py",
106
+ "tests_ai/scripts/**/*.py",
107
+ "tests_e2e/**/*.py",
108
+ ]
109
+
110
+ [tool.typos.files]
111
+ extend-exclude = ["kimi.spec", "pyinstaller.py"]
112
+
113
+ [tool.typos.default.extend-words]
114
+ datas = "datas"
115
+ Seeked = "Seeked"
116
+ seeked = "seeked"
117
+ iterm = "iterm"
@@ -0,0 +1 @@
1
+ ../../CHANGELOG.md
@@ -0,0 +1,29 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, cast
4
+
5
+
6
+ class _LazyLogger:
7
+ """Import loguru only when logging is actually used."""
8
+
9
+ def __init__(self) -> None:
10
+ self._logger: Any | None = None
11
+
12
+ def _get(self) -> Any:
13
+ if self._logger is None:
14
+ from loguru import logger as real_logger
15
+
16
+ # Disable logging by default for library usage.
17
+ # Application entry points (e.g., kimi_cli.cli) should call logger.enable("kimi_cli")
18
+ # to enable logging.
19
+ real_logger.disable("kimi_cli")
20
+ self._logger = real_logger
21
+ return self._logger
22
+
23
+ def __getattr__(self, name: str) -> Any:
24
+ return getattr(self._get(), name)
25
+
26
+
27
+ logger = cast(Any, _LazyLogger())
28
+
29
+ __all__ = ["logger"]
@@ -0,0 +1,34 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+ from collections.abc import Sequence
5
+ from pathlib import Path
6
+
7
+
8
+ def _prog_name() -> str:
9
+ return Path(sys.argv[0]).name or "kimi"
10
+
11
+
12
+ def main(argv: Sequence[str] | None = None) -> int | str | None:
13
+ from kimi_cli.utils.proxy import normalize_proxy_env
14
+
15
+ normalize_proxy_env()
16
+
17
+ args = list(sys.argv[1:] if argv is None else argv)
18
+
19
+ if len(args) == 1 and args[0] in {"--version", "-V"}:
20
+ from kimi_cli.constant import get_version
21
+
22
+ print(f"kimi, version {get_version()}")
23
+ return 0
24
+
25
+ from kimi_cli.cli import cli
26
+
27
+ try:
28
+ return cli(args=args, prog_name=_prog_name())
29
+ except SystemExit as exc:
30
+ return exc.code
31
+
32
+
33
+ if __name__ == "__main__":
34
+ raise SystemExit(main())
@@ -0,0 +1,92 @@
1
+ # ACP Integration Notes (kimi-cli)
2
+
3
+ ## Protocol summary (ACP overview)
4
+ - ACP is JSON-RPC 2.0 with request/response methods plus one-way notifications.
5
+ - Typical flow: `initialize` -> optional `authenticate` -> `session/new` or `session/load`
6
+ -> `session/prompt`
7
+ with `session/update` notifications and optional `session/cancel`.
8
+ - Clients provide `session/request_permission` and optional terminal/filesystem methods.
9
+ - All ACP file paths must be absolute; line numbers are 1-based.
10
+
11
+ ## Entry points and server modes
12
+ - **Single-session server**: `KimiCLI.run_acp()` uses `ACP` -> `ACPServerSingleSession`.
13
+ - Code: `src/kimi_cli/app.py`, `src/kimi_cli/ui/acp/__init__.py`.
14
+ - Used when running CLI with `--acp` UI mode.
15
+ - **Multi-session server**: `acp_main()` runs `ACPServer` with `use_unstable_protocol=True`.
16
+ - Code: `src/kimi_cli/acp/__init__.py`, `src/kimi_cli/acp/server.py`.
17
+ - Exposed via the `kimi acp` command in `src/kimi_cli/cli/__init__.py`.
18
+
19
+ ## Capabilities advertised
20
+ - `prompt_capabilities`: `embedded_context=False`, `image=True`, `audio=False`.
21
+ - `mcp_capabilities`: `http=True`, `sse=False`.
22
+ - Single-session: `load_session=False`, no session list capabilities.
23
+ - Multi-session: `load_session=True`, `session_capabilities.list` supported.
24
+ - `auth_methods=[]` (no authentication methods advertised).
25
+
26
+ ## Session lifecycle (implemented behavior)
27
+ - `session/new`
28
+ - Multi-session: creates a persisted `Session`, builds `KimiCLI`, stores `ACPSession`.
29
+ - Single-session: wraps the existing `Soul` into a `Wire` loop and creates `ACPSession`.
30
+ - Both send `AvailableCommandsUpdate` for slash commands on session creation.
31
+ - MCP servers passed by ACP are converted via `acp_mcp_servers_to_mcp_config`.
32
+ - `session/load`
33
+ - Multi-session only: loads by `Session.find`, then builds `KimiCLI` and `ACPSession`.
34
+ - No history replay yet (TODO).
35
+ - Single-session: not implemented.
36
+ - `session/list`
37
+ - Multi-session only: lists sessions via `Session.list`, no pagination.
38
+ - Single-session: not implemented.
39
+ - `session/prompt`
40
+ - Uses `ACPSession.prompt()` to stream updates and produce a `stop_reason`.
41
+ - Stop reasons: `end_turn`, `max_turn_requests`, `cancelled`.
42
+ - `session/cancel`
43
+ - Sets the per-turn cancel event to stop the prompt.
44
+
45
+ ## Streaming updates and content mapping
46
+ - Text chunks -> `AgentMessageChunk`.
47
+ - Think chunks -> `AgentThoughtChunk`.
48
+ - Tool calls:
49
+ - Start -> `ToolCallStart` with JSON args as text content.
50
+ - Streaming args -> `ToolCallProgress` with updated title/args.
51
+ - Results -> `ToolCallProgress` with `completed` or `failed`.
52
+ - Tool call IDs are prefixed with turn ID to avoid collisions across turns.
53
+ - Plan updates:
54
+ - `TodoDisplayBlock` is converted into `AgentPlanUpdate`.
55
+ - Available commands:
56
+ - `AvailableCommandsUpdate` is sent right after session creation.
57
+
58
+ ## Prompt/content conversion
59
+ - Incoming prompt blocks:
60
+ - Supported: `TextContentBlock`, `ImageContentBlock` (converted to data URL).
61
+ - Unsupported types are logged and ignored.
62
+ - Tool result display blocks:
63
+ - `DiffDisplayBlock` -> `FileEditToolCallContent`.
64
+ - `HideOutputDisplayBlock` suppresses tool output in ACP (used by terminal tool).
65
+
66
+ ## Tool integration and permission flow
67
+ - ACP sessions use `ACPKaos` to route filesystem reads/writes through ACP clients.
68
+ - If the client advertises `terminal` capability, the `Shell` tool is replaced by an
69
+ ACP-backed `Terminal` tool.
70
+ - Uses ACP `terminal/create`, waits for exit, streams `TerminalToolCallContent`,
71
+ then releases the terminal handle.
72
+ - Approval requests in the core tool system are bridged to ACP
73
+ `session/request_permission` with allow-once/allow-always/reject options.
74
+
75
+ ## Current gaps / not implemented
76
+ - `authenticate` method (not used by current Zed ACP client).
77
+ - `session/set_mode` and `session/set_model` (no multi-mode/model switching in kimi-cli).
78
+ - `ext_method` / `ext_notification` for custom ACP extensions are stubbed.
79
+ - Single-session server does not implement `session/load` or `session/list`.
80
+
81
+ ## Filesystem (ACP client-backed)
82
+ - When the client advertises `fs.readTextFile` / `fs.writeTextFile`, `ACPKaos` routes
83
+ reads and writes through ACP `fs/*` methods.
84
+ - `ReadFile` uses `KaosPath.read_lines`, which `ACPKaos` implements via ACP reads.
85
+ - `ReadMediaFile` uses `KaosPath.read_bytes` to load image/video payloads through ACP reads.
86
+ - `WriteFile` uses `KaosPath.read_text/write_text/append_text` and still generates diffs
87
+ and approvals in the tool layer.
88
+
89
+ ## Zed-specific notes (as of current integration)
90
+ - Zed does not currently call `authenticate`.
91
+ - Zed’s external agent server session management is not yet available, so
92
+ `session/load` is not exercised in practice.
@@ -0,0 +1,13 @@
1
+ def acp_main() -> None:
2
+ """Entry point for the multi-session ACP server."""
3
+ import asyncio
4
+
5
+ import acp
6
+
7
+ from kimi_cli.acp.server import ACPServer
8
+ from kimi_cli.app import enable_logging
9
+ from kimi_cli.utils.logging import logger
10
+
11
+ enable_logging()
12
+ logger.info("Starting ACP server on stdio")
13
+ asyncio.run(acp.run_agent(ACPServer(), use_unstable_protocol=True))