deepcode-hku 1.2.0__tar.gz → 1.3.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 (231) hide show
  1. {deepcode_hku-1.2.0/deepcode_hku.egg-info → deepcode_hku-1.3.0}/PKG-INFO +261 -323
  2. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/README.md +251 -319
  3. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/__init__.py +3 -3
  4. deepcode_hku-1.3.0/cli/__init__.py +15 -0
  5. deepcode_hku-1.3.0/cli/config_errors.py +30 -0
  6. deepcode_hku-1.3.0/cli/exec_cli.py +113 -0
  7. deepcode_hku-1.3.0/cli/init_config.py +154 -0
  8. deepcode_hku-1.3.0/cli/loop_cli.py +112 -0
  9. deepcode_hku-1.3.0/cli/mcp_server.py +178 -0
  10. deepcode_hku-1.3.0/cli/schedule_cli.py +132 -0
  11. deepcode_hku-1.3.0/cli/tui/__init__.py +1 -0
  12. deepcode_hku-1.3.0/cli/tui/__main__.py +6 -0
  13. deepcode_hku-1.3.0/cli/tui/app.py +228 -0
  14. deepcode_hku-1.3.0/cli/tui/commands.py +120 -0
  15. deepcode_hku-1.3.0/cli/tui/input.py +128 -0
  16. deepcode_hku-1.3.0/cli/tui/renderer.py +113 -0
  17. deepcode_hku-1.3.0/cli/tui/session_bridge.py +131 -0
  18. deepcode_hku-1.3.0/cli/tui/theme.py +41 -0
  19. deepcode_hku-1.3.0/core/__init__.py +6 -0
  20. deepcode_hku-1.3.0/core/agent_runtime/__init__.py +37 -0
  21. deepcode_hku-1.3.0/core/agent_runtime/helpers.py +317 -0
  22. deepcode_hku-1.3.0/core/agent_runtime/hook.py +106 -0
  23. deepcode_hku-1.3.0/core/agent_runtime/runner.py +1463 -0
  24. deepcode_hku-1.3.0/core/agent_runtime/runtime.py +92 -0
  25. deepcode_hku-1.3.0/core/agent_runtime/tools/__init__.py +21 -0
  26. deepcode_hku-1.3.0/core/agent_runtime/tools/alias.py +96 -0
  27. deepcode_hku-1.3.0/core/agent_runtime/tools/base.py +253 -0
  28. deepcode_hku-1.3.0/core/agent_runtime/tools/mcp.py +677 -0
  29. deepcode_hku-1.3.0/core/agent_runtime/tools/registry.py +206 -0
  30. deepcode_hku-1.3.0/core/agent_setup.py +199 -0
  31. deepcode_hku-1.3.0/core/compat/__init__.py +54 -0
  32. deepcode_hku-1.3.0/core/compat/agent.py +612 -0
  33. deepcode_hku-1.3.0/core/compat/mcp_app.py +75 -0
  34. deepcode_hku-1.3.0/core/compat/parallel.py +90 -0
  35. deepcode_hku-1.3.0/core/compat/request_params.py +149 -0
  36. deepcode_hku-1.3.0/core/compat/runtime.py +130 -0
  37. deepcode_hku-1.3.0/core/config.py +717 -0
  38. deepcode_hku-1.3.0/core/events/__init__.py +97 -0
  39. deepcode_hku-1.3.0/core/events/llm_events.py +152 -0
  40. deepcode_hku-1.3.0/core/events/parts.py +179 -0
  41. deepcode_hku-1.3.0/core/events/protocol.py +184 -0
  42. deepcode_hku-1.3.0/core/events/session.py +371 -0
  43. deepcode_hku-1.3.0/core/harness/__init__.py +39 -0
  44. deepcode_hku-1.3.0/core/harness/agents/__init__.py +10 -0
  45. deepcode_hku-1.3.0/core/harness/agents/control.py +361 -0
  46. deepcode_hku-1.3.0/core/harness/approval.py +122 -0
  47. deepcode_hku-1.3.0/core/harness/code_mode/__init__.py +12 -0
  48. deepcode_hku-1.3.0/core/harness/code_mode/_runner.py +114 -0
  49. deepcode_hku-1.3.0/core/harness/code_mode/tool.py +233 -0
  50. deepcode_hku-1.3.0/core/harness/collaboration.py +43 -0
  51. deepcode_hku-1.3.0/core/harness/hooks/__init__.py +33 -0
  52. deepcode_hku-1.3.0/core/harness/hooks/discovery.py +175 -0
  53. deepcode_hku-1.3.0/core/harness/hooks/engine.py +341 -0
  54. deepcode_hku-1.3.0/core/harness/hooks/events.py +95 -0
  55. deepcode_hku-1.3.0/core/harness/hooks/execution.py +337 -0
  56. deepcode_hku-1.3.0/core/harness/memory.py +238 -0
  57. deepcode_hku-1.3.0/core/harness/permissions.py +336 -0
  58. deepcode_hku-1.3.0/core/harness/policy.py +54 -0
  59. deepcode_hku-1.3.0/core/harness/sandbox.py +381 -0
  60. deepcode_hku-1.3.0/core/harness/skills.py +254 -0
  61. deepcode_hku-1.3.0/core/harness/snapshot.py +145 -0
  62. deepcode_hku-1.3.0/core/harness/tools/__init__.py +110 -0
  63. deepcode_hku-1.3.0/core/harness/tools/diagnostics.py +207 -0
  64. deepcode_hku-1.3.0/core/harness/tools/files.py +250 -0
  65. deepcode_hku-1.3.0/core/harness/tools/patch.py +355 -0
  66. deepcode_hku-1.3.0/core/harness/tools/plan.py +116 -0
  67. deepcode_hku-1.3.0/core/harness/tools/replace.py +384 -0
  68. deepcode_hku-1.3.0/core/harness/tools/search.py +210 -0
  69. deepcode_hku-1.3.0/core/harness/tools/shell.py +121 -0
  70. deepcode_hku-1.3.0/core/harness/tools/spawn_agent.py +268 -0
  71. deepcode_hku-1.3.0/core/harness/tools/user_input.py +108 -0
  72. deepcode_hku-1.3.0/core/llm_runtime.py +97 -0
  73. deepcode_hku-1.3.0/core/loop/__init__.py +29 -0
  74. deepcode_hku-1.3.0/core/loop/autodream.py +76 -0
  75. deepcode_hku-1.3.0/core/loop/backpressure.py +120 -0
  76. deepcode_hku-1.3.0/core/loop/policy.py +70 -0
  77. deepcode_hku-1.3.0/core/loop/state.py +103 -0
  78. deepcode_hku-1.3.0/core/loop/task.py +244 -0
  79. deepcode_hku-1.3.0/core/observability/__init__.py +65 -0
  80. deepcode_hku-1.3.0/core/observability/bus.py +399 -0
  81. deepcode_hku-1.3.0/core/observability/context.py +86 -0
  82. deepcode_hku-1.3.0/core/observability/records.py +187 -0
  83. deepcode_hku-1.3.0/core/platform_compat.py +114 -0
  84. deepcode_hku-1.3.0/core/providers/__init__.py +34 -0
  85. deepcode_hku-1.3.0/core/providers/anthropic.py +692 -0
  86. deepcode_hku-1.3.0/core/providers/base.py +786 -0
  87. deepcode_hku-1.3.0/core/providers/catalog.py +236 -0
  88. deepcode_hku-1.3.0/core/providers/model_compat.py +187 -0
  89. deepcode_hku-1.3.0/core/providers/openai_compat.py +1244 -0
  90. deepcode_hku-1.3.0/core/providers/openai_responses/__init__.py +29 -0
  91. deepcode_hku-1.3.0/core/providers/openai_responses/converters.py +132 -0
  92. deepcode_hku-1.3.0/core/providers/openai_responses/parsing.py +319 -0
  93. deepcode_hku-1.3.0/core/providers/registry.py +201 -0
  94. deepcode_hku-1.3.0/core/schedule/__init__.py +18 -0
  95. deepcode_hku-1.3.0/core/schedule/keepalive.py +37 -0
  96. deepcode_hku-1.3.0/core/schedule/scheduler.py +66 -0
  97. deepcode_hku-1.3.0/core/sessions/__init__.py +44 -0
  98. deepcode_hku-1.3.0/core/sessions/index.py +243 -0
  99. deepcode_hku-1.3.0/core/sessions/models.py +242 -0
  100. deepcode_hku-1.3.0/core/sessions/store.py +680 -0
  101. deepcode_hku-1.3.0/core/team/__init__.py +13 -0
  102. deepcode_hku-1.3.0/core/team/worktree.py +250 -0
  103. deepcode_hku-1.3.0/deepcode.py +640 -0
  104. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0/deepcode_hku.egg-info}/PKG-INFO +261 -323
  105. deepcode_hku-1.3.0/deepcode_hku.egg-info/SOURCES.txt +197 -0
  106. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/deepcode_hku.egg-info/requires.txt +9 -3
  107. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/deepcode_hku.egg-info/top_level.txt +2 -1
  108. deepcode_hku-1.3.0/eval/__init__.py +1 -0
  109. deepcode_hku-1.3.0/eval/swebench/__init__.py +28 -0
  110. deepcode_hku-1.3.0/eval/swebench/dataset.py +82 -0
  111. deepcode_hku-1.3.0/eval/swebench/evaluate.py +104 -0
  112. deepcode_hku-1.3.0/eval/swebench/instance.py +210 -0
  113. deepcode_hku-1.3.0/eval/swebench/predict.py +152 -0
  114. deepcode_hku-1.3.0/eval/swebench/report.py +59 -0
  115. deepcode_hku-1.3.0/eval/swebench/run.py +123 -0
  116. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/prompts/code_prompts.py +0 -108
  117. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/requirements.txt +11 -3
  118. deepcode_hku-1.3.0/tests/test_agent_chat_service.py +222 -0
  119. deepcode_hku-1.3.0/tests/test_agent_fs.py +61 -0
  120. deepcode_hku-1.3.0/tests/test_agent_runner_kernel.py +279 -0
  121. deepcode_hku-1.3.0/tests/test_agent_session.py +189 -0
  122. deepcode_hku-1.3.0/tests/test_apply_patch.py +173 -0
  123. deepcode_hku-1.3.0/tests/test_autodream.py +66 -0
  124. deepcode_hku-1.3.0/tests/test_catalog.py +85 -0
  125. deepcode_hku-1.3.0/tests/test_code_mode.py +176 -0
  126. deepcode_hku-1.3.0/tests/test_collaboration.py +33 -0
  127. deepcode_hku-1.3.0/tests/test_config_errors.py +59 -0
  128. deepcode_hku-1.3.0/tests/test_config_layering.py +149 -0
  129. deepcode_hku-1.3.0/tests/test_diagnostics.py +136 -0
  130. deepcode_hku-1.3.0/tests/test_exec_cli.py +106 -0
  131. deepcode_hku-1.3.0/tests/test_exec_sandbox_wiring.py +142 -0
  132. deepcode_hku-1.3.0/tests/test_fuzzy_replace.py +141 -0
  133. deepcode_hku-1.3.0/tests/test_harness_approval.py +80 -0
  134. deepcode_hku-1.3.0/tests/test_harness_permissions.py +144 -0
  135. deepcode_hku-1.3.0/tests/test_harness_policy.py +85 -0
  136. deepcode_hku-1.3.0/tests/test_harness_sandbox.py +124 -0
  137. deepcode_hku-1.3.0/tests/test_hooks.py +893 -0
  138. deepcode_hku-1.3.0/tests/test_init_config.py +115 -0
  139. deepcode_hku-1.3.0/tests/test_llm_events.py +85 -0
  140. deepcode_hku-1.3.0/tests/test_loop.py +261 -0
  141. deepcode_hku-1.3.0/tests/test_loop_cli.py +99 -0
  142. deepcode_hku-1.3.0/tests/test_mcp_server.py +131 -0
  143. deepcode_hku-1.3.0/tests/test_memory.py +153 -0
  144. deepcode_hku-1.3.0/tests/test_model_compat.py +120 -0
  145. deepcode_hku-1.3.0/tests/test_native_file_tools.py +121 -0
  146. deepcode_hku-1.3.0/tests/test_parts.py +152 -0
  147. deepcode_hku-1.3.0/tests/test_plan_tool.py +87 -0
  148. deepcode_hku-1.3.0/tests/test_schedule.py +103 -0
  149. deepcode_hku-1.3.0/tests/test_session_compaction.py +212 -0
  150. deepcode_hku-1.3.0/tests/test_session_index.py +142 -0
  151. deepcode_hku-1.3.0/tests/test_shell_search_tools.py +129 -0
  152. deepcode_hku-1.3.0/tests/test_skills.py +181 -0
  153. deepcode_hku-1.3.0/tests/test_snapshot.py +84 -0
  154. deepcode_hku-1.3.0/tests/test_spawn_agent.py +350 -0
  155. deepcode_hku-1.3.0/tests/test_swebench_harness.py +184 -0
  156. deepcode_hku-1.3.0/tests/test_team_worktree.py +121 -0
  157. deepcode_hku-1.3.0/tests/test_tui.py +230 -0
  158. deepcode_hku-1.3.0/tests/test_unified_impl_workflow.py +330 -0
  159. deepcode_hku-1.3.0/tests/test_user_input_tool.py +80 -0
  160. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/tools/code_implementation_server.py +55 -30
  161. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/tools/code_indexer.py +38 -137
  162. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/tools/code_reference_indexer.py +4 -0
  163. deepcode_hku-1.3.0/tools/command_executor.py +475 -0
  164. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/tools/document_segmentation_server.py +39 -14
  165. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/tools/git_command.py +14 -1
  166. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/tools/pdf_converter.py +156 -46
  167. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/tools/pdf_downloader.py +16 -16
  168. deepcode_hku-1.3.0/utils/__init__.py +13 -0
  169. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/utils/file_processor.py +26 -11
  170. deepcode_hku-1.3.0/utils/llm_utils.py +173 -0
  171. deepcode_hku-1.3.0/utils/loop_detector.py +253 -0
  172. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/__init__.py +2 -4
  173. deepcode_hku-1.3.0/workflows/agent_orchestration_engine.py +2308 -0
  174. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/agents/document_segmentation_agent.py +11 -6
  175. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/agents/memory_agent_concise.py +124 -74
  176. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/agents/requirement_analysis_agent.py +6 -9
  177. deepcode_hku-1.3.0/workflows/code_implementation_workflow.py +1062 -0
  178. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/codebase_index_workflow.py +0 -6
  179. deepcode_hku-1.3.0/workflows/environment.py +434 -0
  180. deepcode_hku-1.3.0/workflows/plan_review_runtime.py +569 -0
  181. deepcode_hku-1.3.0/workflows/planning_runtime.py +263 -0
  182. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/plugins/integration.py +8 -0
  183. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/plugins/plan_review.py +47 -13
  184. deepcode_hku-1.3.0/workflows/workflow_context.py +168 -0
  185. deepcode_hku-1.2.0/cli/__init__.py +0 -18
  186. deepcode_hku-1.2.0/cli/cli_app.py +0 -500
  187. deepcode_hku-1.2.0/cli/cli_interface.py +0 -1053
  188. deepcode_hku-1.2.0/cli/cli_launcher.py +0 -155
  189. deepcode_hku-1.2.0/cli/main_cli.py +0 -337
  190. deepcode_hku-1.2.0/cli/workflows/__init__.py +0 -11
  191. deepcode_hku-1.2.0/cli/workflows/cli_workflow_adapter.py +0 -457
  192. deepcode_hku-1.2.0/deepcode.py +0 -755
  193. deepcode_hku-1.2.0/deepcode_hku.egg-info/SOURCES.txt +0 -68
  194. deepcode_hku-1.2.0/mcp_agent.config.yaml +0 -134
  195. deepcode_hku-1.2.0/mcp_agent.secrets.yaml +0 -14
  196. deepcode_hku-1.2.0/tools/bocha_search_server.py +0 -219
  197. deepcode_hku-1.2.0/tools/command_executor.py +0 -324
  198. deepcode_hku-1.2.0/ui/__init__.py +0 -43
  199. deepcode_hku-1.2.0/ui/app.py +0 -13
  200. deepcode_hku-1.2.0/ui/components.py +0 -970
  201. deepcode_hku-1.2.0/ui/handlers.py +0 -1189
  202. deepcode_hku-1.2.0/ui/layout.py +0 -142
  203. deepcode_hku-1.2.0/ui/sidebar_feed.py +0 -91
  204. deepcode_hku-1.2.0/ui/streamlit_app.py +0 -38
  205. deepcode_hku-1.2.0/ui/styles.py +0 -356
  206. deepcode_hku-1.2.0/utils/__init__.py +0 -17
  207. deepcode_hku-1.2.0/utils/cli_interface.py +0 -459
  208. deepcode_hku-1.2.0/utils/cross_platform_file_handler.py +0 -475
  209. deepcode_hku-1.2.0/utils/dialogue_logger.py +0 -671
  210. deepcode_hku-1.2.0/utils/llm_utils.py +0 -437
  211. deepcode_hku-1.2.0/utils/simple_llm_logger.py +0 -198
  212. deepcode_hku-1.2.0/workflows/agent_orchestration_engine.py +0 -2028
  213. deepcode_hku-1.2.0/workflows/agents/memory_agent_concise_index.py +0 -2157
  214. deepcode_hku-1.2.0/workflows/agents/memory_agent_concise_multi.py +0 -1708
  215. deepcode_hku-1.2.0/workflows/code_implementation_workflow.py +0 -1500
  216. deepcode_hku-1.2.0/workflows/code_implementation_workflow_index.py +0 -1522
  217. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/.pre-commit-config.yaml +0 -0
  218. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/LICENSE +0 -0
  219. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/MANIFEST.in +0 -0
  220. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/deepcode_hku.egg-info/dependency_links.txt +0 -0
  221. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/deepcode_hku.egg-info/entry_points.txt +0 -0
  222. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/schema/mcp-agent.config.schema.json +0 -0
  223. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/setup.cfg +0 -0
  224. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/setup.py +0 -0
  225. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/tools/__init__.py +0 -0
  226. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/tools/pdf_utils.py +0 -0
  227. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/agents/__init__.py +0 -0
  228. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/agents/code_implementation_agent.py +0 -0
  229. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/plugins/__init__.py +0 -0
  230. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/plugins/base.py +0 -0
  231. {deepcode_hku-1.2.0 → deepcode_hku-1.3.0}/workflows/plugins/requirement_analysis.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepcode-hku
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: AI Research Engine - Transform research papers into working code automatically
5
5
  Home-page: https://github.com/HKUDS/DeepCode
6
6
  Author: DeepCodeTeam
@@ -21,21 +21,27 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: aiofiles>=0.8.0
23
23
  Requires-Dist: aiohttp>=3.8.0
24
- Requires-Dist: anthropic
24
+ Requires-Dist: anthropic>=0.40.0
25
25
  Requires-Dist: asyncio-mqtt
26
26
  Requires-Dist: docling
27
27
  Requires-Dist: fastapi>=0.104.0
28
28
  Requires-Dist: google-genai
29
- Requires-Dist: mcp-agent
29
+ Requires-Dist: httpx>=0.27.0
30
+ Requires-Dist: json-repair>=0.30.0
31
+ Requires-Dist: loguru>=0.7.0
32
+ Requires-Dist: mcp>=1.0.0
30
33
  Requires-Dist: mcp-server-git
31
34
  Requires-Dist: nest_asyncio
32
- Requires-Dist: openai
35
+ Requires-Dist: openai>=1.55.0
36
+ Requires-Dist: openapi
33
37
  Requires-Dist: pathlib2
38
+ Requires-Dist: prompt_toolkit>=3.0.0
34
39
  Requires-Dist: pydantic-settings>=2.0.0
35
40
  Requires-Dist: PyPDF2>=2.0.0
36
41
  Requires-Dist: python-multipart>=0.0.6
37
42
  Requires-Dist: PyYAML>=6.0
38
43
  Requires-Dist: reportlab>=3.5.0
44
+ Requires-Dist: rich>=13.0.0
39
45
  Requires-Dist: streamlit
40
46
  Requires-Dist: uvicorn>=0.24.0
41
47
  Requires-Dist: websockets>=12.0
@@ -92,8 +98,8 @@ Dynamic: summary
92
98
  <!-- <a href="https://pypi.org/project/deepcode-hku/"><img src="https://img.shields.io/pypi/v/deepcode-hku.svg?style=for-the-badge&logo=pypi&logoColor=white&labelColor=1a1a2e&color=ff6b6b"></a> -->
93
99
  </p>
94
100
  <p>
95
- <a href="https://discord.gg/yF2MmDJyGJ"><img src="https://img.shields.io/badge/💬Discord-Community-7289da?style=for-the-badge&logo=discord&logoColor=white&labelColor=1a1a2e"></a>
96
- <a href="https://github.com/HKUDS/DeepCode/issues/11"><img src="https://img.shields.io/badge/💬WeChat-Group-07c160?style=for-the-badge&logo=wechat&logoColor=white&labelColor=1a1a2e"></a>
101
+ <a href="https://github.com/HKUDS/.github/blob/main/profile/README.md"><img src="https://img.shields.io/badge/Feishu-Group-E9DBFC?style=flat&logo=feishu&logoColor=white" alt="Feishu"></a>
102
+ <a href="https://github.com/HKUDS/.github/blob/main/profile/README.md"><img src="https://img.shields.io/badge/WeChat-Group-C5EAB4?style=flat&logo=wechat&logoColor=white" alt="WeChat"></a>
97
103
  </p>
98
104
  <div align="center">
99
105
  <div style="width: 100%; height: 2px; margin: 20px 0; background: linear-gradient(90deg, transparent, #00d9ff, transparent);"></div>
@@ -200,7 +206,6 @@ Dynamic: summary
200
206
  - [🏗️ Architecture](#️-architecture)
201
207
  - [📊 Experimental Results](#-experimental-results)
202
208
  - [🚀 Quick Start](#-quick-start)
203
- - [🤖 nanobot Integration (Feishu Chatbot)](#-nanobot-integration-feishu-chatbot)
204
209
  - [💡 Examples](#-examples)
205
210
  - [🎬 Live Demonstrations](#-live-demonstrations)
206
211
  - [⭐ Star History](#-star-history)
@@ -211,35 +216,96 @@ Dynamic: summary
211
216
 
212
217
  ## 📰 News
213
218
 
214
- 🎉 **[2025-02] DeepCode + nanobot Integration Chat with DeepCode via Feishu Bot!**
219
+ **[2026-07-17] Extensible agents: reusable Skills, lifecycle Hooks & model-driven delegation**
215
220
 
216
- <div align="center">
217
- <table><tr>
218
- <td align="center"><a href="https://github.com/HKUDS/DeepCode"><img src="./assets/logo.png" alt="DeepCode" height="60"/></a></td>
219
- <td align="center"><h2>✦</h2></td>
220
- <td align="center"><a href="https://github.com/HKUDS/nanobot"><img src="./assets/nanobot.png" alt="nanobot" height="60"/></a></td>
221
- </tr></table>
222
- </div>
221
+ - **The agent chooses how to work.** DeepCode can maintain a plan, ask a focused question when genuinely blocked, and load reusable `SKILL.md` playbooks only when needed. Project and user skills under `.deepcode/skills/` — plus existing `.claude/skills/` packages — work across the CLI, web chat, and headless runs.
222
+ - **Complex tasks delegate themselves.** The model can spawn bounded subagents with focused context, track their progress, and bring the results back into the parent task — without a special team command or a fixed workflow.
223
+ - **Plug in your own guardrails and automation.** External command hooks cover session start, prompt submission, tool use, permission decisions, stopping, and subagent lifecycle events. DeepCode reads native hook files as well as compatible `.claude/settings.json` configurations, with timeouts and validated outputs so a broken hook cannot hang the agent.
224
+ - **Run DeepCode from any folder.** `deepcode init` creates a user-level base under `~/.deepcode`; user configuration, instructions, and memory are layered with project overrides, so credentials stay global while repository-specific behavior follows the workspace. Configuration failures now show a clear setup hint instead of a traceback.
223
225
 
224
- - [nanobot](https://github.com/HKUDS/nanobot) now connects to DeepCode — send messages in **Feishu** and get auto-generated code back
225
- - Supports **Paper-to-Code** and **Chat-to-Code**, plus real-time task tracking, all from your chat app
226
- - One-command deploy: `./nanobot/run_nanobot.sh` → **[Setup Guide →](#-nanobot-integration-feishu-chatbot)**
226
+ ---
227
227
 
228
- <div align="center">
229
- <table width="100%"><tr>
230
- <td width="50%" align="center">
231
- <img src="./assets/IMG_8098.jpeg" alt="Feishu Chat Example 1" width="95%" style="border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);"/>
232
- </td>
233
- <td width="50%" align="center">
234
- <img src="./assets/IMG_8099.jpeg" alt="Feishu Chat Example 2" width="95%" style="border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);"/>
235
- </td>
236
- </tr></table>
237
- <sub><em>Feishu Bot in Action — Natural language → Full code generation with setup instructions</em></sub>
238
- </div>
228
+ **[2026-07-10] Team mode: split a big feature across parallel workers**
229
+
230
+ - **A team, not just one agent.** Hand DeepCode a larger feature and it breaks the work into pieces, builds them at the same time, and combines the results — each piece checked against your tests as it goes.
231
+ - **Parallel work that never collides.** Every worker builds on its own isolated copy of your project, so simultaneous changes can't corrupt each other; when two pieces touch the same code, the overlap is flagged instead of silently overwritten.
232
+ - **Only ships when the tests pass.** Once everything is combined, the whole feature runs against your test command — the team reports success only when the tests are actually green.
233
+
234
+ ---
235
+
236
+ **[2026-07-10] Loop engineering: give it a goal, it works until the tests pass**
237
+
238
+ - **Autonomous coding loops.** Hand DeepCode a goal and a test command — it works, runs your tests, and keeps fixing until they pass, on its own.
239
+ - **Self-tidying memory.** The agent periodically cleans up its own notes, so its memory stays sharp across sessions.
240
+ - **Run it on a schedule.** Kick off a loop or a memory tidy-up on an interval, with sensible stop conditions so it never runs away.
241
+
242
+ ---
243
+
244
+ **[2026-07-08] Agent Chat, polished: memory, folder picker, session management**
245
+
246
+ - **The agent remembers across sessions.** Drop an `AGENTS.md` (or `DEEPCODE.md`) at your project root for standing instructions, and the agent keeps its own persistent notes under `.deepcode/memory/` — so a fact it learned yesterday is there today. Works the same in the CLI, the web chat, and headless runs.
247
+ - **Point it at a real project folder.** New chats get a workspace picker — browse and choose the directory the agent works in (fenced to your home), instead of typing a path blind.
248
+ - **Manage your conversations.** Rename or delete any chat from the sidebar; a new chat stays a draft until you send the first message, so the list no longer fills with empty sessions. Each chat's folder is shown and remembered across restarts.
249
+ - **Replies you can actually read.** Assistant messages render as markdown (code blocks, lists, tables); every tool call is an expandable card showing what it did (e.g. "Wrote 163 bytes to plan.md"); errors read as errors, not as a fake answer.
250
+
251
+ ---
252
+
253
+ **[2026-07-08] General coding agent: interactive CLI, web Agent Chat & native tools**
254
+
255
+ - **Talk to DeepCode in your terminal.** `python -m cli.tui` (or just `deepcode`) opens a free-form, multi-turn coding conversation — describe any task in natural language and watch the agent stream its reply, edit files, and run commands with live progress cards. Steer with `/new`, `/resume`, `/model`, `/clear`, `/help`, and attach files with `@path`. (Replaces the previous menu-driven CLI.)
256
+ - **Chat with the agent in your browser.** The new "Agent Chat" page keeps continuous conversations: a sidebar of past chats, one-click New chat, streamed replies with tool progress, and mid-run interrupt. Every chat persists, reopens any time, and works in its own workspace under `deepcode_lab/chats/`.
257
+ - **Edits that land on the first try.** First-class `read` / `write` / `edit` / `apply_patch` / `bash` / `grep` / `glob` tools: whitespace-tolerant fuzzy edits, multi-file atomic patches, and automatic post-edit diagnostics the agent fixes on the spot.
258
+ - **Script any task.** `python -m cli.exec_cli "task" --json` runs one task end-to-end and emits a machine-readable event stream — drop it straight into CI or your own pipelines.
259
+ - **Long conversations stay fast and stable.** Context windows resolve per model with automatic history compaction, and sessions are SQLite-indexed so listing and resume are instant.
260
+
261
+ ---
262
+
263
+ **[2026-07-04] V2 foundation: unified agent kernel, security sandbox & event protocol**
264
+
265
+ - **Every coding phase behaves the same.** All phases now run on one shared agent runtime, with tool definitions sourced straight from the MCP servers as the single source of truth — Paper2Code results unchanged.
266
+ - **Your credentials stay yours.** Every tool call passes a three-valued permission engine (allow / ask / deny) with a non-overridable credential denylist (`.ssh`, `.aws/credentials`, `.env`, `*.pem`, ...), and shell/Python execution runs inside a platform sandbox (macOS seatbelt / Linux bubblewrap) fenced to the workspace. Tune it via `DEEPCODE_SANDBOX` / `DEEPCODE_PERMISSION_MODE` or the `security` block in `deepcode_config.json`.
267
+ - **Build any frontend on one contract.** Declarative per-model provider settings, a normalized model-event stream, a structured message model, and an `AgentSession` event protocol back the CLI, the web UI, and headless runs alike.
268
+ - **Web chat planning just runs.** It now proceeds autonomously by default (requirements -> plan -> implementation) instead of stalling on a clarifying-questions step.
269
+
270
+ ---
271
+
272
+ <details>
273
+ <summary><strong>Earlier news</strong></summary>
274
+
275
+ 🧭 **[2026-05-01] OpenRouter model selector, session cleanup & workflow UX hardening**
276
+
277
+ - 🧠 **OpenRouter model catalog in Settings.** The new UI can now fetch OpenRouter model metadata from `https://openrouter.ai/api/v1/models`, cache it locally, and expose searchable model selectors for the Default, Planning, and Implementation phases. Use exact OpenRouter model ids such as `z-ai/glm-5.1` without editing JSON by hand.
278
+ - 🔄 **Runtime model switching.** Saving model choices from Settings updates `deepcode_config.json` and reloads the in-process LLM runtime so newly started workflows pick up the selected provider/model combination immediately.
279
+ - 🗑️ **Session deletion now performs safe cascade cleanup.** Deleting a session from the UI removes its persistent session store and associated `deepcode_lab/tasks/<task_id>/` workspaces, while preserving shared `uploads/` source files. Sessions with `pending`, `running`, or `waiting_for_input` tasks are blocked with a clear `409 Conflict`.
280
+ - 📊 **More accurate Paper2Code progress.** The frontend now shows backend stage messages and avoids marking intermediate phases as fully "Done" while long LLM work is still running.
281
+ - 🛡️ **Workflow robustness fixes.** Uploads now reject Git LFS pointer files, cancelled tasks stop backend work promptly, stale browser session ids recover cleanly, planner retries fall back to a minimal valid plan when a model defers/tool-calls incorrectly, and document segmentation skips an extra validation LLM call that could stall progress.
282
+
283
+ ---
284
+
285
+ 🗂️ **[2026-04-28] Persistent sessions & dual-layer logging**
286
+
287
+ - 🆕 **Sessions are now persistent.** Every CLI / UI run is automatically attached to a session under `~/.deepcode/sessions/<id>/` (override with `DEEPCODE_SESSIONS_DIR`). Sessions are JSONL — `tail -f session.jsonl` works out of the box. List / inspect / branch them with `python cli/main_cli.py session list|show <id>|new|resume <id>|delete <id>`, or via `GET /api/v1/sessions` from the backend.
288
+ - 🔄 **Resume a previous run** by passing `--session <id>` to the CLI or `session_id` to `POST /api/v1/workflows/paper-to-code` (or `chat-planning`). Backend restarts no longer drop task history; running tasks left over from a crash are surfaced as `interrupted`.
289
+ - 💻 **CLI session UX.** The interactive CLI now supports Cursor-style slash commands: `/resume` opens a numbered session picker, `/new [title]` creates and switches sessions, `/session` shows the active session, and `/help` lists commands. You can also paste inline inputs directly at the menu prompt with `@/path/to/paper.pdf`, `@"C:\path with spaces\paper.pdf"`, or `@https://...`.
290
+ - 📜 **Two-layer structured logging.** A global rotating JSONL lives at `logs/server-YYYYMMDD.jsonl`; per-task logs at `deepcode_lab/tasks/<task_id>/logs/{system,llm,mcp}.jsonl`. Every `loguru.logger` call automatically picks up the active `task_id` via a contextvar — business code did not have to change. Configure via the new `logger.{globalFile,taskFile,llm}` block in `deepcode_config.json`.
291
+ - 📡 **WebSocket log streaming.** Tail one task with `/ws/tasks/{task_id}/logs?channel=llm`, or merge every task in a session via `/ws/sessions/{session_id}/logs`. The legacy `/ws/logs/{session_id}` endpoint that silently ignored its parameter has been removed.
292
+ - 🧹 **Dead code removed.** `utils/simple_llm_logger.py`, `utils/dialogue_logger.py`, and the in-memory `services/session_service.py` implementation are gone (the latter is now a thin re-export of `core.sessions.SessionStore`).
293
+
294
+ ---
295
+
296
+ 🛠️ **[2026-04-17] Stability, Windows compatibility & secrets hygiene update**
297
+
298
+ - 🐛 **Code Implementation no longer crashes** with `name 'LoopDetector' is not defined` — added the missing `LoopDetector`/`ProgressTracker` imports in both `workflows/code_implementation_workflow.py` and `workflows/code_implementation_workflow_index.py`.
299
+ - 🪟 **Windows: `mkdir -p` / `touch` / `rm -rf` / `cp -r` / `mv` now work natively.** `tools/command_executor.py` translates these common Unix file-tree commands via `pathlib`/`shutil` on every platform, eliminating the bug where `cmd.exe` would create a literal `-p` directory and stall the workflow.
300
+ - 🚀 **Removed Brave Search end-to-end.** All Python code, MCP server config, and docs are scrubbed of `brave`/`BRAVE_API_KEY`/`WebSearchTool`. Web fetching now relies entirely on the built-in `fetch` MCP server.
301
+ - 🔌 **OpenAI-compatible providers documented.** New `Quick Start → Configuration` snippet shows how to point the `openai`/`openrouter` blocks at Poe (`https://api.poe.com/v1`), OpenRouter, or Alibaba DashScope, plus how to set `agents.defaults.model` / `agents.planning.model` / `agents.implementation.model` (e.g. `openai/gpt-5.4`).
302
+ - 🔐 **Secrets hygiene.** All YAML config has been collapsed into a single `deepcode_config.json`, and `.gitignore` now ignores it alongside `secrets.json`, `*credentials*.json`, `.env`, `.env.*` (with `*.env.example` whitelisted).
303
+ - 📝 **Launch table fixed.** The README now documents `deepcode --local` for the web UI path and adds explicit Troubleshooting rows for Windows GBK encoding and the issues fixed above.
304
+ - 🧹 **Misc:** auto-create `logs/` directory so JSONL logging never fails on a fresh checkout, replace bare `except:` with `except Exception:` in `agent_orchestration_engine.py` (Ruff E722), `command_executor` MCP tool descriptions now embed the host OS so the LLM picks compatible commands.
239
305
 
240
306
  ---
241
307
 
242
- 🎉 **[2025-02] New Web UI Experience Upgrade!**
308
+ 🎉 **[2026-02] New Web UI Experience Upgrade!**
243
309
 
244
310
  - 🔄 **User-in-Loop Interaction**: Support real-time user interaction during workflows - AI asks clarifying questions directly in the chat
245
311
  - 💬 **Inline Interaction Design**: Interaction prompts appear naturally within the chat flow for a seamless experience
@@ -264,6 +330,8 @@ DeepCode sets new benchmarks on OpenAI's PaperBench Code-Dev across all categori
264
330
  - 🔬 **Advances Scientific Coding**: **73.5%** (DeepCode) vs PaperCoder 51.1% (+22.4%).
265
331
  - 🚀 **Beats LLM Agents**: **73.5%** (DeepCode) vs best LLM frameworks 43.3% (+30.2%).
266
332
 
333
+ </details>
334
+
267
335
  ---
268
336
 
269
337
  ## 🚀 Key Features
@@ -484,8 +552,6 @@ DeepCode leverages the **Model Context Protocol (MCP)** standard to seamlessly i
484
552
 
485
553
  | 🛠️ **MCP Server** | 🔧 **Primary Function** | 💡 **Purpose & Capabilities** |
486
554
  |-------------------|-------------------------|-------------------------------|
487
- | **🔍 brave** | Web Search Engine | Real-time information retrieval via Brave Search API |
488
- | **🌐 bocha-mcp** | Alternative Search | Secondary search option with independent API access |
489
555
  | **📂 filesystem** | File System Operations | Local file and directory management, read/write operations |
490
556
  | **🌐 fetch** | Web Content Retrieval | Fetch and extract content from URLs and web resources |
491
557
  | **📥 github-downloader** | Repository Management | Clone and download GitHub repositories for analysis |
@@ -666,9 +732,8 @@ Choose one of the following installation methods:
666
732
  # 🚀 Install DeepCode package directly
667
733
  pip install deepcode-hku
668
734
 
669
- # 🔑 Download configuration files
670
- curl -O https://raw.githubusercontent.com/HKUDS/DeepCode/main/mcp_agent.config.yaml
671
- curl -O https://raw.githubusercontent.com/HKUDS/DeepCode/main/mcp_agent.secrets.yaml
735
+ # 🔑 One-time setup: create ~/.deepcode/deepcode_config.json (then add a key)
736
+ deepcode init
672
737
  ```
673
738
 
674
739
  #### 🔧 **Development Installation (From Source)**
@@ -703,216 +768,237 @@ pip install -r requirements.txt
703
768
  npm install --prefix new_ui/frontend
704
769
  ```
705
770
 
771
+ ##### 🧪 **Editable install (lets `deepcode` always run THIS checkout)**
772
+
773
+ If you want the global `deepcode` command to launch the source tree you are
774
+ hacking on, install the project in editable mode after the steps above:
775
+
776
+ ```bash
777
+ pip install -e .
778
+ ```
779
+
780
+ This registers a `deepcode-hku` package (current version 1.2.0) and exposes
781
+ the `deepcode` CLI entry point. Any local code change is picked up
782
+ immediately on next launch — no reinstall needed.
783
+
784
+ > If you maintain multiple DeepCode checkouts, only one of them can own the
785
+ > `deepcode` command at a time (the most recent `pip install -e .` wins).
786
+ > Reinstall in the checkout you currently want to be active.
787
+
706
788
  </details>
707
789
 
708
790
  ### 🔧 **Step 2: Configuration**
709
791
 
710
- > The following configuration applies to **all installation methods** (pip, UV, source, and Docker).
792
+ > The following configuration applies to **all installation methods** (pip, UV, source). Everything lives in a single `deepcode_config.json` file.
711
793
 
712
- #### 🔑 API Keys *(required)*
794
+ #### 🌍 Run `deepcode` from any directory
713
795
 
714
- Edit `mcp_agent.secrets.yaml` with your API keys:
796
+ DeepCode resolves its config in two layers, the same way Codex and Claude Code do:
715
797
 
716
- ```yaml
717
- # At least ONE provider API key is required
718
- openai:
719
- api_key: "your_openai_api_key"
720
- base_url: "https://openrouter.ai/api/v1" # Optional: for OpenRouter or custom endpoints
798
+ | Layer | Location | Role |
799
+ |-------|----------|------|
800
+ | **User base** | `~/.deepcode/deepcode_config.json` (or `$DEEPCODE_HOME`) | Read from **any** working directory. Keep your provider keys here. |
801
+ | **Project override** | `deepcode_config.json` in the current directory (or any parent) | Optional. Deep-merged on top of the base, overriding it key by key. |
721
802
 
722
- anthropic:
723
- api_key: "your_anthropic_api_key" # For Claude models
803
+ Run the one-time setup and you can launch `deepcode` anywhere:
724
804
 
725
- google:
726
- api_key: "your_google_api_key" # For Gemini models
805
+ ```bash
806
+ deepcode init # creates ~/.deepcode/deepcode_config.json
727
807
  ```
728
808
 
729
- #### 🤖 LLM Provider *(optional)*
809
+ `deepcode init` is a single cross-platform command (Windows, macOS, Linux). Run
810
+ from a checkout that already has a `deepcode_config.json`, it lifts that config —
811
+ keys and all — into the user base; run elsewhere, it drops the template there for
812
+ you to fill in. It never overwrites an existing base (use `--force` to reseed,
813
+ which keeps a `.bak`), and on Unix it locks the file to `600`. To relocate the
814
+ base, set `DEEPCODE_HOME` (`export DEEPCODE_HOME=...` on macOS/Linux,
815
+ `setx DEEPCODE_HOME ...` on Windows).
730
816
 
731
- Edit `mcp_agent.config.yaml` to choose your preferred LLM provider (line ~106):
817
+ > If you prefer to keep the config only next to a specific project, skip
818
+ > `deepcode init` and just create `deepcode_config.json` in that directory — it
819
+ > is picked up whenever you launch from there.
732
820
 
733
- ```yaml
734
- # Options: "google", "anthropic", "openai"
735
- # If not set or unavailable, will automatically fallback to first available provider
736
- llm_provider: "google"
821
+ #### 🔑 API Keys *(required)*
822
+
823
+ Edit `deepcode_config.json` and fill in at least one provider key. Inline strings work, and `${ENV_VAR}` references are resolved at load time.
824
+
825
+ ```json
826
+ {
827
+ "providers": {
828
+ "openai": { "apiKey": "your_openai_api_key" },
829
+ "anthropic": { "apiKey": "${ANTHROPIC_API_KEY}" },
830
+ "gemini": { "apiKey": "" }
831
+ }
832
+ }
737
833
  ```
738
834
 
739
- #### 🔍 Search API Keys *(optional)*
835
+ <details>
836
+ <summary><strong>🔌 Using OpenAI-compatible providers (OpenRouter / Poe / DashScope / etc.)</strong></summary>
740
837
 
741
- Configure web search in `mcp_agent.config.yaml`:
838
+ Any OpenAI-compatible endpoint is supported by overriding `apiBase` on the matching provider entry. Then set the model name on the `agents` block (using `provider/model` slugs):
742
839
 
743
- ```yaml
744
- # For Brave Search (default) — set in brave.env section (line ~28)
745
- brave:
746
- env:
747
- BRAVE_API_KEY: "your_brave_api_key_here"
840
+ ```json
841
+ {
842
+ "agents": {
843
+ "defaults": {
844
+ "provider": "openrouter",
845
+ "model": "z-ai/glm-5.1"
846
+ },
847
+ "planning": { "provider": "openrouter", "model": "z-ai/glm-5.1" },
848
+ "implementation": { "provider": "openrouter", "model": "z-ai/glm-5.1" }
849
+ },
850
+ "providers": {
851
+ "openai": { "apiKey": "your_openai_api_key" },
852
+ "openrouter": { "apiKey": "your_openrouter_key", "apiBase": "https://openrouter.ai/api/v1" }
853
+ }
854
+ }
855
+ ```
748
856
 
749
- # For Bocha-MCP (alternative) set in bocha-mcp.env section (line ~74)
750
- bocha-mcp:
751
- env:
752
- BOCHA_API_KEY: "your_bocha_api_key_here"
857
+ OpenRouter model ids must use the exact `id` returned by OpenRouter, for example
858
+ `z-ai/glm-5.1`, `anthropic/claude-sonnet-4.5`, or
859
+ `google/gemini-2.5-pro`. In the new UI, open **Settings → OpenRouter Models**
860
+ to search the live OpenRouter catalog and update the Default, Planning, and
861
+ Implementation models without editing this file manually. Saving from the UI
862
+ reloads the runtime for newly started workflows.
863
+
864
+ > **🔐 Never commit `deepcode_config.json`.** It is already in `.gitignore`.
865
+
866
+ </details>
867
+
868
+ #### 🤖 LLM Provider *(optional)*
869
+
870
+ The provider is inferred from the `model` slug (`openai/...`, `anthropic/...`, `gemini/...`, etc.). To force a specific backend, set `agents.defaults.provider`:
871
+
872
+ ```json
873
+ {
874
+ "agents": {
875
+ "defaults": { "provider": "openai" }
876
+ }
877
+ }
753
878
  ```
754
879
 
755
880
  #### 📄 Document Segmentation *(optional)*
756
881
 
757
- Control document processing in `mcp_agent.config.yaml`:
758
-
759
- ```yaml
760
- document_segmentation:
761
- enabled: true # true/false — whether to use intelligent document segmentation
762
- size_threshold_chars: 50000 # Document size threshold to trigger segmentation
882
+ ```json
883
+ {
884
+ "documentSegmentation": {
885
+ "enabled": true,
886
+ "sizeThresholdChars": 50000
887
+ }
888
+ }
763
889
  ```
764
890
 
765
891
  <details>
766
892
  <summary><strong>🪟 Windows Users: Additional MCP Server Configuration</strong></summary>
767
893
 
768
- If you're using Windows, you may need to configure MCP servers manually in `mcp_agent.config.yaml`:
894
+ On Windows you may need to configure MCP servers manually in `deepcode_config.json` (`tools.mcpServers`):
769
895
 
770
896
  ```bash
771
897
  # 1. Install MCP servers globally
772
- npm i -g @modelcontextprotocol/server-brave-search
773
898
  npm i -g @modelcontextprotocol/server-filesystem
774
899
 
775
900
  # 2. Find your global node_modules path
776
901
  npm -g root
777
902
  ```
778
903
 
779
- Then update your `mcp_agent.config.yaml` to use absolute paths:
780
-
781
- ```yaml
782
- mcp:
783
- servers:
784
- brave:
785
- command: "node"
786
- args: ["C:/Program Files/nodejs/node_modules/@modelcontextprotocol/server-brave-search/dist/index.js"]
787
- filesystem:
788
- command: "node"
789
- args: ["C:/Program Files/nodejs/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js", "."]
904
+ ```json
905
+ {
906
+ "tools": {
907
+ "mcpServers": {
908
+ "filesystem": {
909
+ "type": "stdio",
910
+ "command": "node",
911
+ "args": ["C:/Program Files/nodejs/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js", "."]
912
+ }
913
+ }
914
+ }
915
+ }
790
916
  ```
791
917
 
792
- > **Note**: Replace the path with your actual global node_modules path from step 2.
918
+ > Replace the path with the actual global `node_modules` path from step 2.
793
919
 
794
920
  </details>
795
921
 
796
922
  <details>
797
- <summary><strong>🔍 Search Server Configuration (Optional)</strong></summary>
923
+ <summary><strong>🔍 Web Search Configuration</strong></summary>
798
924
 
799
- DeepCode supports multiple search servers for web search functionality. You can configure your preferred option in `mcp_agent.config.yaml`:
800
-
801
- ```yaml
802
- # Default search server configuration
803
- # Options: "brave" or "bocha-mcp"
804
- default_search_server: "brave"
805
- ```
925
+ DeepCode performs web content retrieval through the built-in `fetch` MCP server (no API key required) and reads local files via `filesystem`. The auxiliary search server defaults to `filesystem`:
806
926
 
807
- **Available Options:**
808
- - **🔍 Brave Search** (`"brave"`): Default option with high-quality search results. Requires `BRAVE_API_KEY`. Recommended for most users.
809
- - **🌐 Bocha-MCP** (`"bocha-mcp"`): Alternative search server. Requires `BOCHA_API_KEY`. Uses local Python server implementation.
810
-
811
- **Full MCP server configuration in mcp_agent.config.yaml:**
812
- ```yaml
813
- # For Brave Search (default) - around line 28
814
- brave:
815
- command: "npx"
816
- args: ["-y", "@modelcontextprotocol/server-brave-search"]
817
- env:
818
- BRAVE_API_KEY: "your_brave_api_key_here"
819
-
820
- # For Bocha-MCP (alternative) - around line 74
821
- bocha-mcp:
822
- command: "python"
823
- args: ["tools/bocha_search_server.py"]
824
- env:
825
- PYTHONPATH: "."
826
- BOCHA_API_KEY: "your_bocha_api_key_here"
927
+ ```json
928
+ {
929
+ "tools": { "defaultSearchServer": "filesystem" }
930
+ }
827
931
  ```
828
932
 
829
- > **💡 Tip**: Both search servers require API key configuration. Choose the one that best fits your API access and requirements.
933
+ > **💡 Tip**: To plug in another search backend, add it under `tools.mcpServers` in `deepcode_config.json` and set `tools.defaultSearchServer` to its name.
830
934
 
831
935
  </details>
832
936
 
833
937
  ### ⚡ **Step 3: Launch Application**
834
938
 
835
- Choose your preferred launch method:
836
-
837
- <table width="100%">
838
- <tr>
839
- <th width="33%">🐳 Docker (Recommended)</th>
840
- <th width="33%">🚀 Local (<code>deepcode</code> command)</th>
841
- <th width="33%">🛠️ Other Methods</th>
842
- </tr>
843
- <tr><td>
939
+ DeepCode runs three ways, all on the same agent core:
844
940
 
845
- No Python/Node needed everything in container.
941
+ **🖥️ Interactive agent (default).** A multi-turn coding conversation in your terminal:
846
942
 
847
943
  ```bash
848
- git clone https://github.com/HKUDS/DeepCode.git
849
- cd DeepCode/
850
- cp mcp_agent.secrets.yaml.example \
851
- mcp_agent.secrets.yaml
852
- # Edit secrets with your API keys
853
-
854
- ./deepcode_docker/run_docker.sh
855
- # Access → http://localhost:8000
944
+ deepcode # equivalent to: python -m cli.tui
856
945
  ```
857
946
 
858
- </td><td>
859
-
860
- Auto-installs deps on first run.
947
+ **🌐 Local web UI.** React frontend + FastAPI backend on your host:
861
948
 
862
949
  ```bash
863
- deepcode
864
- # Frontend → http://localhost:5173
865
- # Backend → http://localhost:8000
866
- # Ctrl+C to stop
950
+ deepcode --local
951
+ # Frontend → http://localhost:5173 Backend → http://localhost:8000
867
952
  ```
868
953
 
869
- Features: User-in-Loop, real-time progress, inline chat.
870
-
871
- </td><td>
954
+ **🤖 Headless (scripting / CI).** One task, machine-readable output:
872
955
 
873
956
  ```bash
874
- # macOS / Linux
875
- ./run.sh
876
- # or: python deepcode.py
957
+ python -m cli.exec_cli "fix the failing test in mathlib.py" --json
958
+ ```
877
959
 
878
- # Windows
879
- run.bat
880
- # or: python deepcode.py
960
+ #### 💻 **Interactive CLI (multi-turn coding agent)**
881
961
 
882
- # Classic Streamlit UI
883
- deepcode --classic
962
+ `python -m cli.tui` opens a Claude Code-style conversation in your terminal:
963
+ describe any coding task in natural language, watch the agent stream its
964
+ reply and tool progress live, and keep the conversation going across turns.
884
965
 
885
- # CLI mode
886
- deepcode --cli
887
- # or: python cli/main_cli.py
966
+ ```bash
967
+ python -m cli.tui # converse in the current directory
968
+ python -m cli.tui -w ./my-project # explicit workspace
969
+ python -m cli.tui -m gpt-5.4 # explicit model
970
+ python -m cli.tui --resume <session_id> # pick up a stored conversation
888
971
  ```
889
972
 
890
- </td></tr>
891
- </table>
892
-
893
- <details>
894
- <summary><strong>🐳 Docker Management Commands</strong></summary>
973
+ Inside the conversation:
895
974
 
896
- ```bash
897
- ./deepcode_docker/run_docker.sh stop # Stop
898
- ./deepcode_docker/run_docker.sh restart # Restart (no rebuild needed for config changes)
899
- ./deepcode_docker/run_docker.sh --build # Force rebuild
900
- ./deepcode_docker/run_docker.sh logs # Real-time logs
901
- ./deepcode_docker/run_docker.sh status # Health check
902
- ./deepcode_docker/run_docker.sh clean # Remove containers & images
975
+ ```text
976
+ /help # list all commands
977
+ /new [title] # start a fresh conversation
978
+ /resume # list THIS directory's sessions; /resume <id> restores one
979
+ /resume all # list sessions from every directory (origins shown)
980
+ /model [id] # show or switch the model (history preserved)
981
+ /clear # clear the conversation context
982
+ @src/main.py # attach a file's content to your message
903
983
  ```
904
984
 
905
- Or with Docker Compose directly:
985
+ Conversations persist under `~/.deepcode/sessions/<id>/` (JSONL, with a SQLite
986
+ index for instant listing) and are titled automatically from your first
987
+ message.
988
+
989
+ For scripting and CI there is a headless one-shot entry:
990
+
906
991
  ```bash
907
- docker compose -f deepcode_docker/docker-compose.yml up --build # Build & start
908
- docker compose -f deepcode_docker/docker-compose.yml down # Stop
909
- docker compose -f deepcode_docker/docker-compose.yml logs -f # Logs
992
+ python -m cli.exec_cli "fix the failing test in mathlib.py" --json
910
993
  ```
911
994
 
912
- > **💡** Config files are mounted as volumes — edit and restart, no rebuild needed.
913
- > **💡** Windows users: run `docker compose` commands directly if shell scripts aren't available.
995
+ which streams machine-readable events (NDJSON) and exits 0 on completion.
914
996
 
915
- </details>
997
+ In the web UI, use the **Sessions** menu in the header to resume or delete a
998
+ session. Deleting a session removes its JSONL session record and associated task
999
+ workspace under `deepcode_lab/tasks/`, but keeps original files in `uploads/`.
1000
+ If the session still has `pending`, `running`, or `waiting_for_input` tasks, the
1001
+ backend rejects the deletion until the task is cancelled or completed.
916
1002
 
917
1003
  ### 🎯 **Step 4: Generate Code**
918
1004
 
@@ -929,166 +1015,18 @@ docker compose -f deepcode_docker/docker-compose.yml logs -f # Logs
929
1015
 
930
1016
  | Problem | Cause | Fix |
931
1017
  |---|---|---|
932
- | Docker build fails with `tsc: not found` | Corrupted build cache | `docker builder prune -f` then rebuild with `--no-cache` |
933
- | `error during connect` / `cannot find the file` | Docker Desktop not running | Start Docker Desktop, wait until ready, retry |
934
1018
  | Frontend blank page | Corrupted `node_modules` | `cd new_ui/frontend && rm -rf node_modules && npm install` |
935
- | `ERR_CONNECTION_REFUSED` | Wrong port / backend not running | Docker: `http://localhost:8000`. Local: `http://localhost:5173` |
1019
+ | `ERR_CONNECTION_REFUSED` | Wrong port / backend not running | With `--local`: frontend `http://localhost:5173`, backend `http://localhost:8000` |
936
1020
  | `npm install` → `Could not read package.json` | Wrong directory | Use `npm install --prefix new_ui/frontend` |
937
1021
  | Windows: MCP servers not working | Need absolute paths | See [Windows MCP Configuration](#-step-2-configuration) above |
1022
+ | Windows: `UnicodeEncodeError: 'gbk' codec can't encode...` on launch | Default GBK console can't render emoji in startup banner | Set UTF-8 first: `set PYTHONIOENCODING=utf-8 && set PYTHONUTF8=1` (cmd) or `$env:PYTHONIOENCODING="utf-8"; $env:PYTHONUTF8="1"` (PowerShell) |
1023
+ | Windows: code-implementation stage hangs / produces a `-p` directory | LLM emitted `mkdir -p ...` and `cmd.exe` treated `-p` as a folder name | Already fixed in `tools/command_executor.py` — common Unix commands (`mkdir -p`, `touch`, `rm -rf`, `cp -r`, `mv`) are now executed natively via `pathlib`/`shutil`, no shell needed |
1024
+ | `name 'LoopDetector' is not defined` during code implementation | Missing import in workflow modules | Already fixed — `LoopDetector` and `ProgressTracker` are now imported from `utils.loop_detector` in both `workflows/code_implementation_workflow.py` and `workflows/code_implementation_workflow_index.py` |
938
1025
 
939
1026
  </details>
940
1027
 
941
1028
  ---
942
1029
 
943
- ## 🤖 nanobot Integration (Feishu Chatbot)
944
-
945
- > Chat with DeepCode from **Feishu** — powered by [nanobot](https://github.com/HKUDS/nanobot).
946
-
947
- <div align="center">
948
-
949
- ```mermaid
950
- flowchart LR
951
- subgraph Clients["💬 Chat Platforms"]
952
- direction TB
953
- F["<b>Feishu</b><br/>WebSocket"]
954
- T["<b>Telegram</b><br/>Polling"]
955
- D["<b>Discord</b><br/>Gateway"]
956
- end
957
-
958
- subgraph Gateway["🐈 nanobot Gateway"]
959
- direction TB
960
- A["Agent Loop<br/><i>LLM + Tool Calls</i>"]
961
- end
962
-
963
- subgraph Engine["🧠 DeepCode Engine"]
964
- direction TB
965
- P2C["Paper → Code"]
966
- C2C["Chat → Code"]
967
- TRK["Task Tracking"]
968
- end
969
-
970
- F & T & D <-->|"messages"| A
971
- A -->|"HTTP API"| P2C & C2C & TRK
972
- A -.->|"LLM API"| LLM["☁️ OpenRouter"]
973
-
974
- style Clients fill:#1a1a2e,stroke:#00d9ff,color:#fff
975
- style Gateway fill:#1a1a2e,stroke:#4ecdc4,color:#fff
976
- style Engine fill:#1a1a2e,stroke:#ff6b6b,color:#fff
977
- style LLM fill:#1a1a2e,stroke:#9b59b6,color:#fff
978
- ```
979
-
980
- </div>
981
-
982
- <div align="center">
983
- <table><tr>
984
- <td align="center"><a href="https://github.com/HKUDS/DeepCode"><img src="./assets/logo.png" alt="DeepCode" height="55"/></a></td>
985
- <td align="center"><h2>✦</h2></td>
986
- <td align="center"><a href="https://github.com/HKUDS/nanobot"><img src="./assets/nanobot.png" alt="nanobot" height="55"/></a></td>
987
- </tr></table>
988
- </div>
989
-
990
- Both services run inside the same **Docker Compose** network. Prerequisites: **Docker Desktop** + **OpenRouter API Key** ([get one](https://openrouter.ai/keys)) + **Feishu App**.
991
-
992
- ---
993
-
994
- ### Step 1 · Create a Feishu Bot
995
-
996
- <details open>
997
- <summary><b>Feishu / Lark</b> (Recommended — WebSocket, no public IP needed)</summary>
998
-
999
- 1. Go to [Feishu Open Platform](https://open.feishu.cn/app) → **Create Custom App**
1000
- 2. Enable **Bot** capability in App Features
1001
- 3. Add permissions: `im:message` · `im:message:send_as_bot`
1002
- 4. Event Subscription → select **Long Connection** → add `im.message.receive_v1`
1003
- 5. Note your **App ID** (`cli_xxx`) and **App Secret** → Publish the app
1004
-
1005
- > **Note**: Feishu requires an active WebSocket connection before you can save "Long Connection" mode. Start nanobot first (Step 3), then come back to configure Event Subscription.
1006
-
1007
- </details>
1008
-
1009
- ### Step 2 · Configure
1010
-
1011
- ```bash
1012
- cp nanobot_config.json.example nanobot_config.json
1013
- ```
1014
-
1015
- Edit `nanobot_config.json` — fill in the 3 required fields:
1016
-
1017
- ```jsonc
1018
- {
1019
- "channels": {
1020
- "feishu": {
1021
- "enabled": true,
1022
- "appId": "cli_xxx", // ← Feishu App ID
1023
- "appSecret": "xxx", // ← Feishu App Secret
1024
- "allowFrom": [] // [] = allow all users
1025
- }
1026
- },
1027
- "providers": {
1028
- "openrouter": {
1029
- "apiKey": "sk-or-v1-xxx" // ← OpenRouter API Key
1030
- }
1031
- },
1032
- "agents": {
1033
- "defaults": {
1034
- "model": "anthropic/claude-sonnet-4-20250514"
1035
- }
1036
- }
1037
- }
1038
- ```
1039
-
1040
- > **Model choice**: Any model on [openrouter.ai/models](https://openrouter.ai/models). Use `anthropic/claude-sonnet-4-20250514` for English, `minimax/minimax-m2.1` for Chinese.
1041
-
1042
- ---
1043
-
1044
- ### Step 3 · Launch
1045
-
1046
- Make sure `mcp_agent.secrets.yaml` has your DeepCode API keys (see [Configuration](#-step-2-configuration)), then:
1047
-
1048
- ```bash
1049
- ./nanobot/run_nanobot.sh -d # Start both DeepCode + nanobot in background
1050
- ```
1051
-
1052
- The script checks Docker, validates configs, builds images (first run only), and starts both containers.
1053
-
1054
- ```
1055
- ✓ DeepCode API: http://localhost:8000
1056
- ✓ Nanobot: http://localhost:18790
1057
- ```
1058
-
1059
- Now open Feishu → find your bot → send a message!
1060
-
1061
- <details>
1062
- <summary><b>Management Commands</b></summary>
1063
-
1064
- ```bash
1065
- ./nanobot/run_nanobot.sh # Start (foreground)
1066
- ./nanobot/run_nanobot.sh -d # Start (background)
1067
- ./nanobot/run_nanobot.sh stop # Stop all services
1068
- ./nanobot/run_nanobot.sh restart # Restart (config changes take effect immediately)
1069
- ./nanobot/run_nanobot.sh --build # Force rebuild Docker images
1070
- ./nanobot/run_nanobot.sh logs # View real-time logs
1071
- ./nanobot/run_nanobot.sh status # Health check
1072
- ./nanobot/run_nanobot.sh clean # Remove containers & images
1073
- ```
1074
-
1075
- </details>
1076
-
1077
- <details>
1078
- <summary><b>Troubleshooting</b></summary>
1079
-
1080
- | Problem | Fix |
1081
- |---|---|
1082
- | Feishu bot doesn't respond | Check logs (`./nanobot/run_nanobot.sh logs`), verify `appId`/`appSecret`, ensure app is published with Long Connection mode |
1083
- | Can't connect to DeepCode | Verify `deepcode` container is healthy: `curl http://localhost:8000/health` |
1084
- | Wrong language output | Switch model — `minimax-m2.1` defaults to Chinese, use Claude/GPT for English |
1085
- | Config not taking effect | Just restart: `./nanobot/run_nanobot.sh restart` (no rebuild needed) |
1086
- | Clear chat history | Send `/clear` in chat, or: `docker exec nanobot sh -c 'rm -rf /root/.nanobot/sessions/*.jsonl'` |
1087
-
1088
- </details>
1089
-
1090
- ---
1091
-
1092
1030
  ## 💡 Examples
1093
1031
 
1094
1032