deepcode-hku 1.0.5__tar.gz → 1.0.6__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.
- {deepcode_hku-1.0.5/deepcode_hku.egg-info → deepcode_hku-1.0.6}/PKG-INFO +80 -2
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/README.md +78 -1
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/__init__.py +1 -1
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/cli/cli_interface.py +3 -1
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/cli/main_cli.py +7 -3
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/cli/workflows/cli_workflow_adapter.py +101 -58
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6/deepcode_hku.egg-info}/PKG-INFO +80 -2
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/deepcode_hku.egg-info/SOURCES.txt +1 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/deepcode_hku.egg-info/requires.txt +1 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/mcp_agent.config.yaml +28 -11
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/mcp_agent.secrets.yaml +3 -2
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/prompts/code_prompts.py +160 -174
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/requirements.txt +1 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/schema/mcp-agent.config.schema.json +0 -34
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/pdf_downloader.py +37 -23
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/ui/components.py +22 -28
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/ui/handlers.py +13 -5
- deepcode_hku-1.0.6/utils/cross_platform_file_handler.py +475 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/agent_orchestration_engine.py +102 -227
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/agents/memory_agent_concise.py +604 -167
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/agents/memory_agent_concise_index.py +608 -171
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/code_implementation_workflow.py +273 -52
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/code_implementation_workflow_index.py +250 -34
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/.pre-commit-config.yaml +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/LICENSE +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/MANIFEST.in +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/cli/__init__.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/cli/cli_app.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/cli/cli_launcher.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/cli/workflows/__init__.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/deepcode.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/deepcode_hku.egg-info/dependency_links.txt +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/deepcode_hku.egg-info/entry_points.txt +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/deepcode_hku.egg-info/top_level.txt +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/setup.cfg +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/setup.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/__init__.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/bocha_search_server.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/code_implementation_server.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/code_indexer.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/code_reference_indexer.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/command_executor.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/document_segmentation_server.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/git_command.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/pdf_converter.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/tools/pdf_utils.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/ui/__init__.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/ui/app.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/ui/layout.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/ui/streamlit_app.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/ui/styles.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/utils/__init__.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/utils/cli_interface.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/utils/dialogue_logger.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/utils/file_processor.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/utils/llm_utils.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/utils/simple_llm_logger.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/__init__.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/agents/__init__.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/agents/code_implementation_agent.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/agents/document_segmentation_agent.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/agents/memory_agent_concise_multi.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/agents/requirement_analysis_agent.py +0 -0
- {deepcode_hku-1.0.5 → deepcode_hku-1.0.6}/workflows/codebase_index_workflow.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepcode-hku
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.6
|
|
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
|
|
@@ -27,6 +27,7 @@ Requires-Dist: docling
|
|
|
27
27
|
Requires-Dist: mcp-agent
|
|
28
28
|
Requires-Dist: mcp-server-git
|
|
29
29
|
Requires-Dist: nest_asyncio
|
|
30
|
+
Requires-Dist: openai
|
|
30
31
|
Requires-Dist: pathlib2
|
|
31
32
|
Requires-Dist: PyPDF2>=2.0.0
|
|
32
33
|
Requires-Dist: reportlab>=3.5.0
|
|
@@ -96,6 +97,15 @@ Dynamic: summary
|
|
|
96
97
|
</a>
|
|
97
98
|
</div>
|
|
98
99
|
|
|
100
|
+
<div align="center" style="margin-top: 10px;">
|
|
101
|
+
<a href="README.md">
|
|
102
|
+
<img src="https://img.shields.io/badge/English-00d4ff?style=for-the-badge&logo=readme&logoColor=white&labelColor=1a1a2e" alt="English">
|
|
103
|
+
</a>
|
|
104
|
+
<a href="README_ZH.md">
|
|
105
|
+
<img src="https://img.shields.io/badge/中文-00d4ff?style=for-the-badge&logo=readme&logoColor=white&labelColor=1a1a2e" alt="中文">
|
|
106
|
+
</a>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
99
109
|
### 🖥️ **Interface Showcase**
|
|
100
110
|
|
|
101
111
|
<table align="center" width="100%" style="border: none; border-collapse: collapse; margin: 30px 0;">
|
|
@@ -177,14 +187,30 @@ Dynamic: summary
|
|
|
177
187
|
|
|
178
188
|
## 📑 Table of Contents
|
|
179
189
|
|
|
190
|
+
- [📰 News](#-news)
|
|
180
191
|
- [🚀 Key Features](#-key-features)
|
|
181
192
|
- [🏗️ Architecture](#️-architecture)
|
|
193
|
+
- [📊 Experimental Results](#-experimental-results)
|
|
182
194
|
- [🚀 Quick Start](#-quick-start)
|
|
183
195
|
- [💡 Examples](#-examples)
|
|
184
196
|
- [🎬 Live Demonstrations](#-live-demonstrations)
|
|
185
197
|
- [⭐ Star History](#-star-history)
|
|
186
198
|
- [📄 License](#-license)
|
|
187
199
|
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 📰 News
|
|
204
|
+
|
|
205
|
+
🎉 **[2025-10] 🎉 [2025-10-28] DeepCode Achieves SOTA on PaperBench!**
|
|
206
|
+
|
|
207
|
+
DeepCode sets new benchmarks on OpenAI's PaperBench Code-Dev across all categories:
|
|
208
|
+
|
|
209
|
+
- 🏆 **Surpasses Human Experts**: **75.9%** (DeepCode) vs Top Machine Learning PhDs 72.4% (+3.5%).
|
|
210
|
+
- 🥇 **Outperforms SOTA Commercial Code Agents**: **84.8%** (DeepCode) vs Leading Commercial Code Agents (+26.1%) (Cursor, Claude Code, and Codex).
|
|
211
|
+
- 🔬 **Advances Scientific Coding**: **73.5%** (DeepCode) vs PaperCoder 51.1% (+22.4%).
|
|
212
|
+
- 🚀 **Beats LLM Agents**: **73.5%** (DeepCode) vs best LLM frameworks 43.3% (+30.2%).
|
|
213
|
+
|
|
188
214
|
---
|
|
189
215
|
|
|
190
216
|
## 🚀 Key Features
|
|
@@ -261,7 +287,58 @@ Dynamic: summary
|
|
|
261
287
|
|
|
262
288
|
<br/>
|
|
263
289
|
|
|
264
|
-
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## 📊 Experimental Results
|
|
293
|
+
|
|
294
|
+
<div align="center">
|
|
295
|
+
<img src='./assets/result_main02.jpg' /><br>
|
|
296
|
+
</div>
|
|
297
|
+
<br/>
|
|
298
|
+
|
|
299
|
+
We evaluate **DeepCode** on the [*PaperBench*](https://openai.com/index/paperbench/) benchmark (released by OpenAI), a rigorous testbed requiring AI agents to independently reproduce 20 ICML 2024 papers from scratch. The benchmark comprises 8,316 gradable components assessed using SimpleJudge with hierarchical weighting.
|
|
300
|
+
|
|
301
|
+
Our experiments compare DeepCode against four baseline categories: **(1) Human Experts**, **(2) State-of-the-Art Commercial Code Agents**, **(3) Scientific Code Agents**, and **(4) LLM-Based Agents**.
|
|
302
|
+
|
|
303
|
+
### ① 🧠 Human Expert Performance (Top Machine Learning PhD)
|
|
304
|
+
|
|
305
|
+
**DeepCode: 75.9% vs. Top Machine Learning PhD: 72.4% (+3.5%)**
|
|
306
|
+
|
|
307
|
+
DeepCode achieves **75.9%** on the 3-paper human evaluation subset, **surpassing the best-of-3 human expert baseline (72.4%) by +3.5 percentage points**. This demonstrates that our framework not only matches but exceeds expert-level code reproduction capabilities, representing a significant milestone in autonomous scientific software engineering.
|
|
308
|
+
|
|
309
|
+
### ② 💼 State-of-the-Art Commercial Code Agents
|
|
310
|
+
|
|
311
|
+
**DeepCode: 84.8% vs. Best Commercial Agent: 58.7% (+26.1%)**
|
|
312
|
+
|
|
313
|
+
On the 5-paper subset, DeepCode substantially outperforms leading commercial coding tools:
|
|
314
|
+
- Cursor: 58.4%
|
|
315
|
+
- Claude Code: 58.7%
|
|
316
|
+
- Codex: 40.0%
|
|
317
|
+
- **DeepCode: 84.8%**
|
|
318
|
+
|
|
319
|
+
This represents a **+26.1% improvement** over the leading commercial code agent. All commercial agents utilize Claude Sonnet 4.5 or GPT-5 Codex-high, highlighting that **DeepCode's superior architecture**—rather than base model capability—drives this performance gap.
|
|
320
|
+
|
|
321
|
+
### ③ 🔬 Scientific Code Agents
|
|
322
|
+
|
|
323
|
+
**DeepCode: 73.5% vs. PaperCoder: 51.1% (+22.4%)**
|
|
324
|
+
|
|
325
|
+
Compared to PaperCoder (**51.1%**), the state-of-the-art scientific code reproduction framework, DeepCode achieves **73.5%**, demonstrating a **+22.4% relative improvement**. This substantial margin validates our multi-module architecture combining planning, hierarchical task decomposition, code generation, and iterative debugging over simpler pipeline-based approaches.
|
|
326
|
+
|
|
327
|
+
### ④ 🤖 LLM-Based Agents
|
|
328
|
+
|
|
329
|
+
**DeepCode: 73.5% vs. Best LLM Agent: 43.3% (+30.2%)**
|
|
330
|
+
|
|
331
|
+
DeepCode significantly outperforms all tested LLM agents:
|
|
332
|
+
- Claude 3.5 Sonnet + IterativeAgent: 27.5%
|
|
333
|
+
- o1 + IterativeAgent (36 hours): 42.4%
|
|
334
|
+
- o1 BasicAgent: 43.3%
|
|
335
|
+
- **DeepCode: 73.5%**
|
|
336
|
+
|
|
337
|
+
The **+30.2% improvement** over the best-performing LLM agent demonstrates that sophisticated agent scaffolding, rather than extended inference time or larger models, is critical for complex code reproduction tasks.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
### 🎯 **Autonomous Self-Orchestrating Multi-Agent Architecture**
|
|
265
342
|
|
|
266
343
|
**The Challenges**:
|
|
267
344
|
|
|
@@ -489,6 +566,7 @@ Implementation Generation • Testing • Documentation
|
|
|
489
566
|
|
|
490
567
|
---
|
|
491
568
|
|
|
569
|
+
|
|
492
570
|
## 🚀 Quick Start
|
|
493
571
|
|
|
494
572
|
|
|
@@ -52,6 +52,15 @@
|
|
|
52
52
|
</a>
|
|
53
53
|
</div>
|
|
54
54
|
|
|
55
|
+
<div align="center" style="margin-top: 10px;">
|
|
56
|
+
<a href="README.md">
|
|
57
|
+
<img src="https://img.shields.io/badge/English-00d4ff?style=for-the-badge&logo=readme&logoColor=white&labelColor=1a1a2e" alt="English">
|
|
58
|
+
</a>
|
|
59
|
+
<a href="README_ZH.md">
|
|
60
|
+
<img src="https://img.shields.io/badge/中文-00d4ff?style=for-the-badge&logo=readme&logoColor=white&labelColor=1a1a2e" alt="中文">
|
|
61
|
+
</a>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
55
64
|
### 🖥️ **Interface Showcase**
|
|
56
65
|
|
|
57
66
|
<table align="center" width="100%" style="border: none; border-collapse: collapse; margin: 30px 0;">
|
|
@@ -133,14 +142,30 @@
|
|
|
133
142
|
|
|
134
143
|
## 📑 Table of Contents
|
|
135
144
|
|
|
145
|
+
- [📰 News](#-news)
|
|
136
146
|
- [🚀 Key Features](#-key-features)
|
|
137
147
|
- [🏗️ Architecture](#️-architecture)
|
|
148
|
+
- [📊 Experimental Results](#-experimental-results)
|
|
138
149
|
- [🚀 Quick Start](#-quick-start)
|
|
139
150
|
- [💡 Examples](#-examples)
|
|
140
151
|
- [🎬 Live Demonstrations](#-live-demonstrations)
|
|
141
152
|
- [⭐ Star History](#-star-history)
|
|
142
153
|
- [📄 License](#-license)
|
|
143
154
|
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 📰 News
|
|
159
|
+
|
|
160
|
+
🎉 **[2025-10] 🎉 [2025-10-28] DeepCode Achieves SOTA on PaperBench!**
|
|
161
|
+
|
|
162
|
+
DeepCode sets new benchmarks on OpenAI's PaperBench Code-Dev across all categories:
|
|
163
|
+
|
|
164
|
+
- 🏆 **Surpasses Human Experts**: **75.9%** (DeepCode) vs Top Machine Learning PhDs 72.4% (+3.5%).
|
|
165
|
+
- 🥇 **Outperforms SOTA Commercial Code Agents**: **84.8%** (DeepCode) vs Leading Commercial Code Agents (+26.1%) (Cursor, Claude Code, and Codex).
|
|
166
|
+
- 🔬 **Advances Scientific Coding**: **73.5%** (DeepCode) vs PaperCoder 51.1% (+22.4%).
|
|
167
|
+
- 🚀 **Beats LLM Agents**: **73.5%** (DeepCode) vs best LLM frameworks 43.3% (+30.2%).
|
|
168
|
+
|
|
144
169
|
---
|
|
145
170
|
|
|
146
171
|
## 🚀 Key Features
|
|
@@ -217,7 +242,58 @@
|
|
|
217
242
|
|
|
218
243
|
<br/>
|
|
219
244
|
|
|
220
|
-
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## 📊 Experimental Results
|
|
248
|
+
|
|
249
|
+
<div align="center">
|
|
250
|
+
<img src='./assets/result_main02.jpg' /><br>
|
|
251
|
+
</div>
|
|
252
|
+
<br/>
|
|
253
|
+
|
|
254
|
+
We evaluate **DeepCode** on the [*PaperBench*](https://openai.com/index/paperbench/) benchmark (released by OpenAI), a rigorous testbed requiring AI agents to independently reproduce 20 ICML 2024 papers from scratch. The benchmark comprises 8,316 gradable components assessed using SimpleJudge with hierarchical weighting.
|
|
255
|
+
|
|
256
|
+
Our experiments compare DeepCode against four baseline categories: **(1) Human Experts**, **(2) State-of-the-Art Commercial Code Agents**, **(3) Scientific Code Agents**, and **(4) LLM-Based Agents**.
|
|
257
|
+
|
|
258
|
+
### ① 🧠 Human Expert Performance (Top Machine Learning PhD)
|
|
259
|
+
|
|
260
|
+
**DeepCode: 75.9% vs. Top Machine Learning PhD: 72.4% (+3.5%)**
|
|
261
|
+
|
|
262
|
+
DeepCode achieves **75.9%** on the 3-paper human evaluation subset, **surpassing the best-of-3 human expert baseline (72.4%) by +3.5 percentage points**. This demonstrates that our framework not only matches but exceeds expert-level code reproduction capabilities, representing a significant milestone in autonomous scientific software engineering.
|
|
263
|
+
|
|
264
|
+
### ② 💼 State-of-the-Art Commercial Code Agents
|
|
265
|
+
|
|
266
|
+
**DeepCode: 84.8% vs. Best Commercial Agent: 58.7% (+26.1%)**
|
|
267
|
+
|
|
268
|
+
On the 5-paper subset, DeepCode substantially outperforms leading commercial coding tools:
|
|
269
|
+
- Cursor: 58.4%
|
|
270
|
+
- Claude Code: 58.7%
|
|
271
|
+
- Codex: 40.0%
|
|
272
|
+
- **DeepCode: 84.8%**
|
|
273
|
+
|
|
274
|
+
This represents a **+26.1% improvement** over the leading commercial code agent. All commercial agents utilize Claude Sonnet 4.5 or GPT-5 Codex-high, highlighting that **DeepCode's superior architecture**—rather than base model capability—drives this performance gap.
|
|
275
|
+
|
|
276
|
+
### ③ 🔬 Scientific Code Agents
|
|
277
|
+
|
|
278
|
+
**DeepCode: 73.5% vs. PaperCoder: 51.1% (+22.4%)**
|
|
279
|
+
|
|
280
|
+
Compared to PaperCoder (**51.1%**), the state-of-the-art scientific code reproduction framework, DeepCode achieves **73.5%**, demonstrating a **+22.4% relative improvement**. This substantial margin validates our multi-module architecture combining planning, hierarchical task decomposition, code generation, and iterative debugging over simpler pipeline-based approaches.
|
|
281
|
+
|
|
282
|
+
### ④ 🤖 LLM-Based Agents
|
|
283
|
+
|
|
284
|
+
**DeepCode: 73.5% vs. Best LLM Agent: 43.3% (+30.2%)**
|
|
285
|
+
|
|
286
|
+
DeepCode significantly outperforms all tested LLM agents:
|
|
287
|
+
- Claude 3.5 Sonnet + IterativeAgent: 27.5%
|
|
288
|
+
- o1 + IterativeAgent (36 hours): 42.4%
|
|
289
|
+
- o1 BasicAgent: 43.3%
|
|
290
|
+
- **DeepCode: 73.5%**
|
|
291
|
+
|
|
292
|
+
The **+30.2% improvement** over the best-performing LLM agent demonstrates that sophisticated agent scaffolding, rather than extended inference time or larger models, is critical for complex code reproduction tasks.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
### 🎯 **Autonomous Self-Orchestrating Multi-Agent Architecture**
|
|
221
297
|
|
|
222
298
|
**The Challenges**:
|
|
223
299
|
|
|
@@ -445,6 +521,7 @@ Implementation Generation • Testing • Documentation
|
|
|
445
521
|
|
|
446
522
|
---
|
|
447
523
|
|
|
524
|
+
|
|
448
525
|
## 🚀 Quick Start
|
|
449
526
|
|
|
450
527
|
|
|
@@ -39,7 +39,9 @@ class CLIInterface:
|
|
|
39
39
|
self.uploaded_file = None
|
|
40
40
|
self.is_running = True
|
|
41
41
|
self.processing_history = []
|
|
42
|
-
self.enable_indexing =
|
|
42
|
+
self.enable_indexing = (
|
|
43
|
+
False # Default configuration (matching UI: fast mode by default)
|
|
44
|
+
)
|
|
43
45
|
|
|
44
46
|
# Load segmentation config from the same source as UI
|
|
45
47
|
self._load_segmentation_config()
|
|
@@ -214,15 +214,17 @@ async def main():
|
|
|
214
214
|
# 创建CLI应用
|
|
215
215
|
app = CLIApp()
|
|
216
216
|
|
|
217
|
-
# 设置配置
|
|
217
|
+
# 设置配置 - 默认禁用索引功能以加快处理速度
|
|
218
218
|
if args.optimized:
|
|
219
219
|
app.cli.enable_indexing = False
|
|
220
220
|
print(
|
|
221
221
|
f"\n{Colors.YELLOW}⚡ Optimized mode enabled - indexing disabled{Colors.ENDC}"
|
|
222
222
|
)
|
|
223
223
|
else:
|
|
224
|
+
# 默认也禁用索引功能
|
|
225
|
+
app.cli.enable_indexing = False
|
|
224
226
|
print(
|
|
225
|
-
f"\n{Colors.
|
|
227
|
+
f"\n{Colors.YELLOW}⚡ Fast mode enabled - indexing disabled by default{Colors.ENDC}"
|
|
226
228
|
)
|
|
227
229
|
|
|
228
230
|
# Configure document segmentation settings
|
|
@@ -248,7 +250,9 @@ async def main():
|
|
|
248
250
|
if not os.path.exists(args.file):
|
|
249
251
|
print(f"{Colors.FAIL}❌ File not found: {args.file}{Colors.ENDC}")
|
|
250
252
|
sys.exit(1)
|
|
251
|
-
|
|
253
|
+
# 使用 file:// 前缀保持与交互模式一致,确保文件被复制而非移动
|
|
254
|
+
file_url = f"file://{os.path.abspath(args.file)}"
|
|
255
|
+
success = await run_direct_processing(app, file_url, "file")
|
|
252
256
|
elif args.url:
|
|
253
257
|
success = await run_direct_processing(app, args.url, "url")
|
|
254
258
|
elif args.chat:
|
|
@@ -4,6 +4,14 @@ CLI工作流适配器 - 智能体编排引擎
|
|
|
4
4
|
|
|
5
5
|
This adapter provides CLI-optimized interface to the latest agent orchestration engine,
|
|
6
6
|
with enhanced progress reporting, error handling, and CLI-specific optimizations.
|
|
7
|
+
|
|
8
|
+
Version: 2.0 (Updated to match UI version)
|
|
9
|
+
Changes:
|
|
10
|
+
- Default enable_indexing=False for faster processing (matching UI defaults)
|
|
11
|
+
- Mode-aware progress callback with detailed stage mapping
|
|
12
|
+
- Chat pipeline now accepts enable_indexing parameter
|
|
13
|
+
- Improved error handling and resource management
|
|
14
|
+
- Enhanced progress display for different modes (fast/comprehensive/chat)
|
|
7
15
|
"""
|
|
8
16
|
|
|
9
17
|
import os
|
|
@@ -36,7 +44,7 @@ class CLIWorkflowAdapter:
|
|
|
36
44
|
|
|
37
45
|
async def initialize_mcp_app(self) -> Dict[str, Any]:
|
|
38
46
|
"""
|
|
39
|
-
Initialize MCP application for CLI usage.
|
|
47
|
+
Initialize MCP application for CLI usage (improved version matching UI).
|
|
40
48
|
|
|
41
49
|
Returns:
|
|
42
50
|
dict: Initialization result
|
|
@@ -47,7 +55,7 @@ class CLIWorkflowAdapter:
|
|
|
47
55
|
"🚀 Initializing Agent Orchestration Engine", 2.0
|
|
48
56
|
)
|
|
49
57
|
|
|
50
|
-
# Initialize MCP application
|
|
58
|
+
# Initialize MCP application using async context manager (matching UI pattern)
|
|
51
59
|
self.app = MCPApp(name="cli_agent_orchestration")
|
|
52
60
|
self.app_context = self.app.run()
|
|
53
61
|
agent_app = await self.app_context.__aenter__()
|
|
@@ -56,8 +64,6 @@ class CLIWorkflowAdapter:
|
|
|
56
64
|
self.context = agent_app.context
|
|
57
65
|
|
|
58
66
|
# Configure filesystem access
|
|
59
|
-
import os
|
|
60
|
-
|
|
61
67
|
self.context.config.mcp.servers["filesystem"].args.extend([os.getcwd()])
|
|
62
68
|
|
|
63
69
|
if self.cli_interface:
|
|
@@ -93,9 +99,14 @@ class CLIWorkflowAdapter:
|
|
|
93
99
|
f"⚠️ Cleanup warning: {str(e)}", "warning"
|
|
94
100
|
)
|
|
95
101
|
|
|
96
|
-
def create_cli_progress_callback(self) -> Callable:
|
|
102
|
+
def create_cli_progress_callback(self, enable_indexing: bool = True) -> Callable:
|
|
97
103
|
"""
|
|
98
|
-
Create CLI-optimized progress callback function.
|
|
104
|
+
Create CLI-optimized progress callback function with mode-aware stage mapping.
|
|
105
|
+
|
|
106
|
+
This matches the UI version's detailed progress mapping logic.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
enable_indexing: Whether indexing is enabled (affects stage mapping)
|
|
99
110
|
|
|
100
111
|
Returns:
|
|
101
112
|
Callable: Progress callback function
|
|
@@ -103,23 +114,43 @@ class CLIWorkflowAdapter:
|
|
|
103
114
|
|
|
104
115
|
def progress_callback(progress: int, message: str):
|
|
105
116
|
if self.cli_interface:
|
|
106
|
-
#
|
|
107
|
-
if
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
# Mode-aware stage mapping (matching UI version logic)
|
|
118
|
+
if enable_indexing:
|
|
119
|
+
# Full workflow mapping: Initialize -> Analyze -> Download -> Plan -> References -> Repos -> Index -> Implement
|
|
120
|
+
if progress <= 5:
|
|
121
|
+
stage = 0 # Initialize
|
|
122
|
+
elif progress <= 10:
|
|
123
|
+
stage = 1 # Analyze
|
|
124
|
+
elif progress <= 25:
|
|
125
|
+
stage = 2 # Download
|
|
126
|
+
elif progress <= 40:
|
|
127
|
+
stage = 3 # Plan
|
|
128
|
+
elif progress <= 50:
|
|
129
|
+
stage = 4 # References
|
|
130
|
+
elif progress <= 60:
|
|
131
|
+
stage = 5 # Repos
|
|
132
|
+
elif progress <= 70:
|
|
133
|
+
stage = 6 # Index
|
|
134
|
+
elif progress <= 85:
|
|
135
|
+
stage = 7 # Implement
|
|
136
|
+
else:
|
|
137
|
+
stage = 8 # Complete
|
|
121
138
|
else:
|
|
122
|
-
|
|
139
|
+
# Fast mode mapping: Initialize -> Analyze -> Download -> Plan -> Implement
|
|
140
|
+
if progress <= 5:
|
|
141
|
+
stage = 0 # Initialize
|
|
142
|
+
elif progress <= 10:
|
|
143
|
+
stage = 1 # Analyze
|
|
144
|
+
elif progress <= 25:
|
|
145
|
+
stage = 2 # Download
|
|
146
|
+
elif progress <= 40:
|
|
147
|
+
stage = 3 # Plan
|
|
148
|
+
elif progress <= 85:
|
|
149
|
+
stage = 4 # Implement (skip References, Repos, Index)
|
|
150
|
+
else:
|
|
151
|
+
stage = 4 # Complete
|
|
152
|
+
|
|
153
|
+
self.cli_interface.display_processing_stages(stage, enable_indexing)
|
|
123
154
|
|
|
124
155
|
# Display status message
|
|
125
156
|
self.cli_interface.print_status(message, "processing")
|
|
@@ -127,14 +158,16 @@ class CLIWorkflowAdapter:
|
|
|
127
158
|
return progress_callback
|
|
128
159
|
|
|
129
160
|
async def execute_full_pipeline(
|
|
130
|
-
self, input_source: str, enable_indexing: bool =
|
|
161
|
+
self, input_source: str, enable_indexing: bool = False
|
|
131
162
|
) -> Dict[str, Any]:
|
|
132
163
|
"""
|
|
133
164
|
Execute the complete intelligent multi-agent research orchestration pipeline.
|
|
134
165
|
|
|
166
|
+
Updated to match UI version: default enable_indexing=False for faster processing.
|
|
167
|
+
|
|
135
168
|
Args:
|
|
136
169
|
input_source: Research input source (file path, URL, or preprocessed analysis)
|
|
137
|
-
enable_indexing: Whether to enable advanced intelligence analysis
|
|
170
|
+
enable_indexing: Whether to enable advanced intelligence analysis (default: False)
|
|
138
171
|
|
|
139
172
|
Returns:
|
|
140
173
|
dict: Comprehensive pipeline execution result
|
|
@@ -145,16 +178,20 @@ class CLIWorkflowAdapter:
|
|
|
145
178
|
execute_multi_agent_research_pipeline,
|
|
146
179
|
)
|
|
147
180
|
|
|
148
|
-
# Create CLI progress callback
|
|
149
|
-
progress_callback = self.create_cli_progress_callback()
|
|
181
|
+
# Create CLI progress callback with mode awareness
|
|
182
|
+
progress_callback = self.create_cli_progress_callback(enable_indexing)
|
|
150
183
|
|
|
151
184
|
# Display pipeline start
|
|
152
185
|
if self.cli_interface:
|
|
153
|
-
|
|
186
|
+
if enable_indexing:
|
|
187
|
+
mode_msg = "🧠 comprehensive (with indexing)"
|
|
188
|
+
else:
|
|
189
|
+
mode_msg = "⚡ fast (indexing disabled)"
|
|
154
190
|
self.cli_interface.print_status(
|
|
155
|
-
f"🚀 Starting {
|
|
191
|
+
f"🚀 Starting {mode_msg} agent orchestration pipeline...",
|
|
192
|
+
"processing",
|
|
156
193
|
)
|
|
157
|
-
self.cli_interface.display_processing_stages(0)
|
|
194
|
+
self.cli_interface.display_processing_stages(0, enable_indexing)
|
|
158
195
|
|
|
159
196
|
# Execute the pipeline
|
|
160
197
|
result = await execute_multi_agent_research_pipeline(
|
|
@@ -166,7 +203,10 @@ class CLIWorkflowAdapter:
|
|
|
166
203
|
|
|
167
204
|
# Display completion
|
|
168
205
|
if self.cli_interface:
|
|
169
|
-
|
|
206
|
+
final_stage = 8 if enable_indexing else 4
|
|
207
|
+
self.cli_interface.display_processing_stages(
|
|
208
|
+
final_stage, enable_indexing
|
|
209
|
+
)
|
|
170
210
|
self.cli_interface.print_status(
|
|
171
211
|
"🎉 Agent orchestration pipeline completed successfully!",
|
|
172
212
|
"complete",
|
|
@@ -189,12 +229,17 @@ class CLIWorkflowAdapter:
|
|
|
189
229
|
"pipeline_mode": "comprehensive" if enable_indexing else "optimized",
|
|
190
230
|
}
|
|
191
231
|
|
|
192
|
-
async def execute_chat_pipeline(
|
|
232
|
+
async def execute_chat_pipeline(
|
|
233
|
+
self, user_input: str, enable_indexing: bool = False
|
|
234
|
+
) -> Dict[str, Any]:
|
|
193
235
|
"""
|
|
194
236
|
Execute the chat-based planning and implementation pipeline.
|
|
195
237
|
|
|
238
|
+
Updated to match UI version: accepts enable_indexing parameter.
|
|
239
|
+
|
|
196
240
|
Args:
|
|
197
241
|
user_input: User's coding requirements and description
|
|
242
|
+
enable_indexing: Whether to enable indexing for enhanced code understanding (default: False)
|
|
198
243
|
|
|
199
244
|
Returns:
|
|
200
245
|
dict: Chat pipeline execution result
|
|
@@ -208,51 +253,45 @@ class CLIWorkflowAdapter:
|
|
|
208
253
|
# Create CLI progress callback for chat mode
|
|
209
254
|
def chat_progress_callback(progress: int, message: str):
|
|
210
255
|
if self.cli_interface:
|
|
211
|
-
# Map progress to CLI stages for chat mode
|
|
256
|
+
# Map progress to CLI stages for chat mode (matching UI logic)
|
|
212
257
|
if progress <= 5:
|
|
213
|
-
|
|
214
|
-
0, chat_mode=True
|
|
215
|
-
) # Initialize
|
|
258
|
+
stage = 0 # Initialize
|
|
216
259
|
elif progress <= 30:
|
|
217
|
-
|
|
218
|
-
1, chat_mode=True
|
|
219
|
-
) # Planning
|
|
260
|
+
stage = 1 # Planning
|
|
220
261
|
elif progress <= 50:
|
|
221
|
-
|
|
222
|
-
2, chat_mode=True
|
|
223
|
-
) # Setup
|
|
262
|
+
stage = 2 # Setup
|
|
224
263
|
elif progress <= 70:
|
|
225
|
-
|
|
226
|
-
3, chat_mode=True
|
|
227
|
-
) # Save Plan
|
|
264
|
+
stage = 3 # Save Plan
|
|
228
265
|
else:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
266
|
+
stage = 4 # Implement
|
|
267
|
+
|
|
268
|
+
self.cli_interface.display_processing_stages(stage, chat_mode=True)
|
|
232
269
|
|
|
233
270
|
# Display status message
|
|
234
271
|
self.cli_interface.print_status(message, "processing")
|
|
235
272
|
|
|
236
273
|
# Display pipeline start
|
|
237
274
|
if self.cli_interface:
|
|
275
|
+
indexing_note = (
|
|
276
|
+
" (with indexing)" if enable_indexing else " (fast mode)"
|
|
277
|
+
)
|
|
238
278
|
self.cli_interface.print_status(
|
|
239
|
-
"🚀 Starting chat-based planning pipeline...",
|
|
279
|
+
f"🚀 Starting chat-based planning pipeline{indexing_note}...",
|
|
280
|
+
"processing",
|
|
240
281
|
)
|
|
241
282
|
self.cli_interface.display_processing_stages(0, chat_mode=True)
|
|
242
283
|
|
|
243
|
-
# Execute the chat pipeline with indexing
|
|
284
|
+
# Execute the chat pipeline with configurable indexing
|
|
244
285
|
result = await execute_chat_based_planning_pipeline(
|
|
245
286
|
user_input=user_input,
|
|
246
287
|
logger=self.logger,
|
|
247
288
|
progress_callback=chat_progress_callback,
|
|
248
|
-
enable_indexing=
|
|
289
|
+
enable_indexing=enable_indexing, # Pass through enable_indexing parameter
|
|
249
290
|
)
|
|
250
291
|
|
|
251
292
|
# Display completion
|
|
252
293
|
if self.cli_interface:
|
|
253
|
-
self.cli_interface.display_processing_stages(
|
|
254
|
-
4, chat_mode=True
|
|
255
|
-
) # Final stage for chat mode
|
|
294
|
+
self.cli_interface.display_processing_stages(4, chat_mode=True)
|
|
256
295
|
self.cli_interface.print_status(
|
|
257
296
|
"🎉 Chat-based planning pipeline completed successfully!",
|
|
258
297
|
"complete",
|
|
@@ -268,17 +307,18 @@ class CLIWorkflowAdapter:
|
|
|
268
307
|
return {"status": "error", "error": error_msg, "pipeline_mode": "chat"}
|
|
269
308
|
|
|
270
309
|
async def process_input_with_orchestration(
|
|
271
|
-
self, input_source: str, input_type: str, enable_indexing: bool =
|
|
310
|
+
self, input_source: str, input_type: str, enable_indexing: bool = False
|
|
272
311
|
) -> Dict[str, Any]:
|
|
273
312
|
"""
|
|
274
313
|
Process input using the intelligent agent orchestration engine.
|
|
275
314
|
|
|
276
315
|
This is the main CLI interface to the latest agent orchestration capabilities.
|
|
316
|
+
Updated to match UI version: default enable_indexing=False.
|
|
277
317
|
|
|
278
318
|
Args:
|
|
279
|
-
input_source: Input source (file path or
|
|
280
|
-
input_type: Type of input ('file' or '
|
|
281
|
-
enable_indexing: Whether to enable advanced intelligence analysis
|
|
319
|
+
input_source: Input source (file path, URL, or chat input)
|
|
320
|
+
input_type: Type of input ('file', 'url', or 'chat')
|
|
321
|
+
enable_indexing: Whether to enable advanced intelligence analysis (default: False)
|
|
282
322
|
|
|
283
323
|
Returns:
|
|
284
324
|
dict: Processing result with status and details
|
|
@@ -301,7 +341,10 @@ class CLIWorkflowAdapter:
|
|
|
301
341
|
# Execute appropriate pipeline based on input type
|
|
302
342
|
if input_type == "chat":
|
|
303
343
|
# Use chat-based planning pipeline for user requirements
|
|
304
|
-
|
|
344
|
+
# Pass enable_indexing to chat pipeline as well
|
|
345
|
+
pipeline_result = await self.execute_chat_pipeline(
|
|
346
|
+
input_source, enable_indexing=enable_indexing
|
|
347
|
+
)
|
|
305
348
|
else:
|
|
306
349
|
# Use traditional multi-agent research pipeline for files/URLs
|
|
307
350
|
pipeline_result = await self.execute_full_pipeline(
|