deepcode-hku 1.0.2__tar.gz → 1.0.4__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.2/deepcode_hku.egg-info → deepcode_hku-1.0.4}/PKG-INFO +132 -22
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/README.md +131 -21
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/__init__.py +1 -1
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/cli/cli_app.py +56 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/cli/cli_interface.py +45 -3
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/cli/main_cli.py +42 -5
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4/deepcode_hku.egg-info}/PKG-INFO +132 -22
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/deepcode_hku.egg-info/SOURCES.txt +4 -0
- deepcode_hku-1.0.4/mcp_agent.config.yaml +90 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/prompts/code_prompts.py +655 -183
- deepcode_hku-1.0.4/tools/bocha_search_server.py +219 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/tools/code_implementation_server.py +85 -45
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/tools/code_indexer.py +1 -39
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/tools/code_reference_indexer.py +12 -3
- deepcode_hku-1.0.4/tools/document_segmentation_server.py +1937 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/ui/styles.py +94 -14
- deepcode_hku-1.0.4/utils/llm_utils.py +225 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/workflows/agent_orchestration_engine.py +237 -46
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/workflows/agents/__init__.py +0 -1
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/workflows/agents/code_implementation_agent.py +108 -83
- deepcode_hku-1.0.4/workflows/agents/document_segmentation_agent.py +353 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/workflows/agents/memory_agent_concise.py +523 -45
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/workflows/agents/memory_agent_concise_index.py +490 -41
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/workflows/code_implementation_workflow.py +39 -84
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/workflows/code_implementation_workflow_index.py +38 -86
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/workflows/codebase_index_workflow.py +134 -128
- deepcode_hku-1.0.2/mcp_agent.config.yaml +0 -75
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/.pre-commit-config.yaml +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/LICENSE +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/MANIFEST.in +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/cli/__init__.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/cli/cli_launcher.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/cli/workflows/__init__.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/cli/workflows/cli_workflow_adapter.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/deepcode.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/deepcode_hku.egg-info/dependency_links.txt +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/deepcode_hku.egg-info/entry_points.txt +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/deepcode_hku.egg-info/requires.txt +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/deepcode_hku.egg-info/top_level.txt +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/mcp_agent.secrets.yaml +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/requirements.txt +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/schema/mcp-agent.config.schema.json +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/setup.cfg +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/setup.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/tools/__init__.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/tools/command_executor.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/tools/git_command.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/tools/pdf_converter.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/tools/pdf_downloader.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/tools/pdf_utils.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/ui/__init__.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/ui/app.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/ui/components.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/ui/handlers.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/ui/layout.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/ui/streamlit_app.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/utils/__init__.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/utils/cli_interface.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/utils/dialogue_logger.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/utils/file_processor.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/utils/simple_llm_logger.py +0 -0
- {deepcode_hku-1.0.2 → deepcode_hku-1.0.4}/workflows/__init__.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.4
|
|
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
|
|
@@ -135,6 +135,32 @@ Dynamic: summary
|
|
|
135
135
|
</tr>
|
|
136
136
|
</table>
|
|
137
137
|
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
<div align="center">
|
|
141
|
+
|
|
142
|
+
### 🎬 **Introduction Video**
|
|
143
|
+
|
|
144
|
+
<div style="margin: 20px 0;">
|
|
145
|
+
<a href="https://youtu.be/PRgmP8pOI08" target="_blank">
|
|
146
|
+
<img src="https://img.youtube.com/vi/PRgmP8pOI08/maxresdefault.jpg"
|
|
147
|
+
alt="DeepCode Introduction Video"
|
|
148
|
+
width="75%"
|
|
149
|
+
style="border-radius: 12px; box-shadow: 0 8px 25px rgba(0,0,0,0.15); transition: transform 0.3s ease;"/>
|
|
150
|
+
</a>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
*🎯 **Watch our complete introduction** - See how DeepCode transforms research papers and natural language into production-ready code*
|
|
154
|
+
|
|
155
|
+
<p>
|
|
156
|
+
<a href="https://youtu.be/PRgmP8pOI08" target="_blank">
|
|
157
|
+
<img src="https://img.shields.io/badge/▶️_Watch_Video-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="Watch Video"/>
|
|
158
|
+
</a>
|
|
159
|
+
</p>
|
|
160
|
+
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
---
|
|
138
164
|
|
|
139
165
|
|
|
140
166
|
|
|
@@ -316,21 +342,35 @@ Advanced retrieval-augmented generation combining semantic vector embeddings wit
|
|
|
316
342
|
|
|
317
343
|
#### 🛠️ **Implementation Tools Matrix**
|
|
318
344
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
|
326
|
-
|
|
327
|
-
|
|
|
328
|
-
|
|
|
329
|
-
|
|
|
330
|
-
|
|
|
331
|
-
|
|
|
332
|
-
|
|
|
333
|
-
|
|
|
345
|
+
**🔧 Powered by MCP (Model Context Protocol)**
|
|
346
|
+
|
|
347
|
+
DeepCode leverages the **Model Context Protocol (MCP)** standard to seamlessly integrate with various tools and services. This standardized approach ensures reliable communication between AI agents and external systems, enabling powerful automation capabilities.
|
|
348
|
+
|
|
349
|
+
##### 📡 **MCP Servers & Tools**
|
|
350
|
+
|
|
351
|
+
| 🛠️ **MCP Server** | 🔧 **Primary Function** | 💡 **Purpose & Capabilities** |
|
|
352
|
+
|-------------------|-------------------------|-------------------------------|
|
|
353
|
+
| **🔍 brave** | Web Search Engine | Real-time information retrieval via Brave Search API |
|
|
354
|
+
| **🌐 bocha-mcp** | Alternative Search | Secondary search option with independent API access |
|
|
355
|
+
| **📂 filesystem** | File System Operations | Local file and directory management, read/write operations |
|
|
356
|
+
| **🌐 fetch** | Web Content Retrieval | Fetch and extract content from URLs and web resources |
|
|
357
|
+
| **📥 github-downloader** | Repository Management | Clone and download GitHub repositories for analysis |
|
|
358
|
+
| **📋 file-downloader** | Document Processing | Download and convert files (PDF, DOCX, etc.) to Markdown |
|
|
359
|
+
| **⚡ command-executor** | System Commands | Execute bash/shell commands for environment management |
|
|
360
|
+
| **🧬 code-implementation** | Code Generation Hub | Comprehensive code reproduction with execution and testing |
|
|
361
|
+
| **📚 code-reference-indexer** | Smart Code Search | Intelligent indexing and search of code repositories |
|
|
362
|
+
| **📄 document-segmentation** | Smart Document Analysis | Intelligent document segmentation for large papers and technical documents |
|
|
363
|
+
|
|
364
|
+
##### 🔧 **Legacy Tool Functions** *(for reference)*
|
|
365
|
+
|
|
366
|
+
| 🛠️ **Function** | 🎯 **Usage Context** |
|
|
367
|
+
|-----------------|---------------------|
|
|
368
|
+
| **📄 read_code_mem** | Efficient code context retrieval from memory |
|
|
369
|
+
| **✍️ write_file** | Direct file content generation and modification |
|
|
370
|
+
| **🐍 execute_python** | Python code testing and validation |
|
|
371
|
+
| **📁 get_file_structure** | Project structure analysis and organization |
|
|
372
|
+
| **⚙️ set_workspace** | Dynamic workspace and environment configuration |
|
|
373
|
+
| **📊 get_operation_history** | Process monitoring and operation tracking |
|
|
334
374
|
|
|
335
375
|
|
|
336
376
|
---
|
|
@@ -466,8 +506,15 @@ curl -O https://raw.githubusercontent.com/HKUDS/DeepCode/main/mcp_agent.secrets.
|
|
|
466
506
|
# - openai: api_key, base_url (for OpenAI/custom endpoints)
|
|
467
507
|
# - anthropic: api_key (for Claude models)
|
|
468
508
|
|
|
469
|
-
# 🔑 Configure
|
|
470
|
-
# Edit mcp_agent.config.yaml
|
|
509
|
+
# 🔑 Configure search API keys for web search (optional)
|
|
510
|
+
# Edit mcp_agent.config.yaml to set your API keys:
|
|
511
|
+
# - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
|
|
512
|
+
# - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
|
|
513
|
+
|
|
514
|
+
# 📄 Configure document segmentation (optional)
|
|
515
|
+
# Edit mcp_agent.config.yaml to control document processing:
|
|
516
|
+
# - enabled: true/false (whether to use intelligent document segmentation)
|
|
517
|
+
# - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
|
|
471
518
|
```
|
|
472
519
|
|
|
473
520
|
#### 🔧 **Development Installation (From Source)**
|
|
@@ -495,8 +542,15 @@ uv pip install -r requirements.txt
|
|
|
495
542
|
# - openai: api_key, base_url (for OpenAI/custom endpoints)
|
|
496
543
|
# - anthropic: api_key (for Claude models)
|
|
497
544
|
|
|
498
|
-
# 🔑 Configure
|
|
499
|
-
# Edit mcp_agent.config.yaml
|
|
545
|
+
# 🔑 Configure search API keys for web search (optional)
|
|
546
|
+
# Edit mcp_agent.config.yaml to set your API keys:
|
|
547
|
+
# - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
|
|
548
|
+
# - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
|
|
549
|
+
|
|
550
|
+
# 📄 Configure document segmentation (optional)
|
|
551
|
+
# Edit mcp_agent.config.yaml to control document processing:
|
|
552
|
+
# - enabled: true/false (whether to use intelligent document segmentation)
|
|
553
|
+
# - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
|
|
500
554
|
```
|
|
501
555
|
|
|
502
556
|
##### 🐍 **Using Traditional pip**
|
|
@@ -514,8 +568,15 @@ pip install -r requirements.txt
|
|
|
514
568
|
# - openai: api_key, base_url (for OpenAI/custom endpoints)
|
|
515
569
|
# - anthropic: api_key (for Claude models)
|
|
516
570
|
|
|
517
|
-
# 🔑 Configure
|
|
518
|
-
# Edit mcp_agent.config.yaml
|
|
571
|
+
# 🔑 Configure search API keys for web search (optional)
|
|
572
|
+
# Edit mcp_agent.config.yaml to set your API keys:
|
|
573
|
+
# - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
|
|
574
|
+
# - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
|
|
575
|
+
|
|
576
|
+
# 📄 Configure document segmentation (optional)
|
|
577
|
+
# Edit mcp_agent.config.yaml to control document processing:
|
|
578
|
+
# - enabled: true/false (whether to use intelligent document segmentation)
|
|
579
|
+
# - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
|
|
519
580
|
```
|
|
520
581
|
|
|
521
582
|
</details>
|
|
@@ -548,6 +609,47 @@ mcp:
|
|
|
548
609
|
|
|
549
610
|
> **Note**: Replace the path with your actual global node_modules path from step 2.
|
|
550
611
|
|
|
612
|
+
#### 🔍 **Search Server Configuration (Optional)**
|
|
613
|
+
|
|
614
|
+
DeepCode supports multiple search servers for web search functionality. You can configure your preferred option in `mcp_agent.config.yaml`:
|
|
615
|
+
|
|
616
|
+
```yaml
|
|
617
|
+
# Default search server configuration
|
|
618
|
+
# Options: "brave" or "bocha-mcp"
|
|
619
|
+
default_search_server: "brave"
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
**Available Options:**
|
|
623
|
+
- **🔍 Brave Search** (`"brave"`):
|
|
624
|
+
- Default option with high-quality search results
|
|
625
|
+
- Requires BRAVE_API_KEY configuration
|
|
626
|
+
- Recommended for most users
|
|
627
|
+
|
|
628
|
+
- **🌐 Bocha-MCP** (`"bocha-mcp"`):
|
|
629
|
+
- Alternative search server option
|
|
630
|
+
- Requires BOCHA_API_KEY configuration
|
|
631
|
+
- Uses local Python server implementation
|
|
632
|
+
|
|
633
|
+
**API Key Configuration in mcp_agent.config.yaml:**
|
|
634
|
+
```yaml
|
|
635
|
+
# For Brave Search (default) - around line 28
|
|
636
|
+
brave:
|
|
637
|
+
command: "npx"
|
|
638
|
+
args: ["-y", "@modelcontextprotocol/server-brave-search"]
|
|
639
|
+
env:
|
|
640
|
+
BRAVE_API_KEY: "your_brave_api_key_here"
|
|
641
|
+
|
|
642
|
+
# For Bocha-MCP (alternative) - around line 74
|
|
643
|
+
bocha-mcp:
|
|
644
|
+
command: "python"
|
|
645
|
+
args: ["tools/bocha_search_server.py"]
|
|
646
|
+
env:
|
|
647
|
+
PYTHONPATH: "."
|
|
648
|
+
BOCHA_API_KEY: "your_bocha_api_key_here"
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
> **💡 Tip**: Both search servers require API key configuration. Choose the one that best fits your API access and requirements.
|
|
652
|
+
|
|
551
653
|
### ⚡ **Step 2: Launch Application**
|
|
552
654
|
|
|
553
655
|
#### 🚀 **Using Installed Package (Recommended)**
|
|
@@ -657,6 +759,14 @@ python cli/main_cli.py
|
|
|
657
759
|
|
|
658
760
|
|
|
659
761
|
|
|
762
|
+
### 🆕 **Recent Updates**
|
|
763
|
+
|
|
764
|
+
#### 📄 **Smart Document Segmentation (v1.2.0)**
|
|
765
|
+
- **Intelligent Processing**: Automatically handles large research papers and technical documents that exceed LLM token limits
|
|
766
|
+
- **Configurable Control**: Toggle segmentation via configuration with size-based thresholds
|
|
767
|
+
- **Semantic Analysis**: Advanced content understanding with algorithm, concept, and formula preservation
|
|
768
|
+
- **Backward Compatibility**: Seamlessly falls back to traditional processing for smaller documents
|
|
769
|
+
|
|
660
770
|
### 🚀 **Coming Soon**
|
|
661
771
|
|
|
662
772
|
We're continuously enhancing DeepCode with exciting new features:
|
|
@@ -91,6 +91,32 @@
|
|
|
91
91
|
</tr>
|
|
92
92
|
</table>
|
|
93
93
|
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
<div align="center">
|
|
97
|
+
|
|
98
|
+
### 🎬 **Introduction Video**
|
|
99
|
+
|
|
100
|
+
<div style="margin: 20px 0;">
|
|
101
|
+
<a href="https://youtu.be/PRgmP8pOI08" target="_blank">
|
|
102
|
+
<img src="https://img.youtube.com/vi/PRgmP8pOI08/maxresdefault.jpg"
|
|
103
|
+
alt="DeepCode Introduction Video"
|
|
104
|
+
width="75%"
|
|
105
|
+
style="border-radius: 12px; box-shadow: 0 8px 25px rgba(0,0,0,0.15); transition: transform 0.3s ease;"/>
|
|
106
|
+
</a>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
*🎯 **Watch our complete introduction** - See how DeepCode transforms research papers and natural language into production-ready code*
|
|
110
|
+
|
|
111
|
+
<p>
|
|
112
|
+
<a href="https://youtu.be/PRgmP8pOI08" target="_blank">
|
|
113
|
+
<img src="https://img.shields.io/badge/▶️_Watch_Video-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="Watch Video"/>
|
|
114
|
+
</a>
|
|
115
|
+
</p>
|
|
116
|
+
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
---
|
|
94
120
|
|
|
95
121
|
|
|
96
122
|
|
|
@@ -272,21 +298,35 @@ Advanced retrieval-augmented generation combining semantic vector embeddings wit
|
|
|
272
298
|
|
|
273
299
|
#### 🛠️ **Implementation Tools Matrix**
|
|
274
300
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
|
282
|
-
|
|
283
|
-
|
|
|
284
|
-
|
|
|
285
|
-
|
|
|
286
|
-
|
|
|
287
|
-
|
|
|
288
|
-
|
|
|
289
|
-
|
|
|
301
|
+
**🔧 Powered by MCP (Model Context Protocol)**
|
|
302
|
+
|
|
303
|
+
DeepCode leverages the **Model Context Protocol (MCP)** standard to seamlessly integrate with various tools and services. This standardized approach ensures reliable communication between AI agents and external systems, enabling powerful automation capabilities.
|
|
304
|
+
|
|
305
|
+
##### 📡 **MCP Servers & Tools**
|
|
306
|
+
|
|
307
|
+
| 🛠️ **MCP Server** | 🔧 **Primary Function** | 💡 **Purpose & Capabilities** |
|
|
308
|
+
|-------------------|-------------------------|-------------------------------|
|
|
309
|
+
| **🔍 brave** | Web Search Engine | Real-time information retrieval via Brave Search API |
|
|
310
|
+
| **🌐 bocha-mcp** | Alternative Search | Secondary search option with independent API access |
|
|
311
|
+
| **📂 filesystem** | File System Operations | Local file and directory management, read/write operations |
|
|
312
|
+
| **🌐 fetch** | Web Content Retrieval | Fetch and extract content from URLs and web resources |
|
|
313
|
+
| **📥 github-downloader** | Repository Management | Clone and download GitHub repositories for analysis |
|
|
314
|
+
| **📋 file-downloader** | Document Processing | Download and convert files (PDF, DOCX, etc.) to Markdown |
|
|
315
|
+
| **⚡ command-executor** | System Commands | Execute bash/shell commands for environment management |
|
|
316
|
+
| **🧬 code-implementation** | Code Generation Hub | Comprehensive code reproduction with execution and testing |
|
|
317
|
+
| **📚 code-reference-indexer** | Smart Code Search | Intelligent indexing and search of code repositories |
|
|
318
|
+
| **📄 document-segmentation** | Smart Document Analysis | Intelligent document segmentation for large papers and technical documents |
|
|
319
|
+
|
|
320
|
+
##### 🔧 **Legacy Tool Functions** *(for reference)*
|
|
321
|
+
|
|
322
|
+
| 🛠️ **Function** | 🎯 **Usage Context** |
|
|
323
|
+
|-----------------|---------------------|
|
|
324
|
+
| **📄 read_code_mem** | Efficient code context retrieval from memory |
|
|
325
|
+
| **✍️ write_file** | Direct file content generation and modification |
|
|
326
|
+
| **🐍 execute_python** | Python code testing and validation |
|
|
327
|
+
| **📁 get_file_structure** | Project structure analysis and organization |
|
|
328
|
+
| **⚙️ set_workspace** | Dynamic workspace and environment configuration |
|
|
329
|
+
| **📊 get_operation_history** | Process monitoring and operation tracking |
|
|
290
330
|
|
|
291
331
|
|
|
292
332
|
---
|
|
@@ -422,8 +462,15 @@ curl -O https://raw.githubusercontent.com/HKUDS/DeepCode/main/mcp_agent.secrets.
|
|
|
422
462
|
# - openai: api_key, base_url (for OpenAI/custom endpoints)
|
|
423
463
|
# - anthropic: api_key (for Claude models)
|
|
424
464
|
|
|
425
|
-
# 🔑 Configure
|
|
426
|
-
# Edit mcp_agent.config.yaml
|
|
465
|
+
# 🔑 Configure search API keys for web search (optional)
|
|
466
|
+
# Edit mcp_agent.config.yaml to set your API keys:
|
|
467
|
+
# - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
|
|
468
|
+
# - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
|
|
469
|
+
|
|
470
|
+
# 📄 Configure document segmentation (optional)
|
|
471
|
+
# Edit mcp_agent.config.yaml to control document processing:
|
|
472
|
+
# - enabled: true/false (whether to use intelligent document segmentation)
|
|
473
|
+
# - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
|
|
427
474
|
```
|
|
428
475
|
|
|
429
476
|
#### 🔧 **Development Installation (From Source)**
|
|
@@ -451,8 +498,15 @@ uv pip install -r requirements.txt
|
|
|
451
498
|
# - openai: api_key, base_url (for OpenAI/custom endpoints)
|
|
452
499
|
# - anthropic: api_key (for Claude models)
|
|
453
500
|
|
|
454
|
-
# 🔑 Configure
|
|
455
|
-
# Edit mcp_agent.config.yaml
|
|
501
|
+
# 🔑 Configure search API keys for web search (optional)
|
|
502
|
+
# Edit mcp_agent.config.yaml to set your API keys:
|
|
503
|
+
# - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
|
|
504
|
+
# - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
|
|
505
|
+
|
|
506
|
+
# 📄 Configure document segmentation (optional)
|
|
507
|
+
# Edit mcp_agent.config.yaml to control document processing:
|
|
508
|
+
# - enabled: true/false (whether to use intelligent document segmentation)
|
|
509
|
+
# - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
|
|
456
510
|
```
|
|
457
511
|
|
|
458
512
|
##### 🐍 **Using Traditional pip**
|
|
@@ -470,8 +524,15 @@ pip install -r requirements.txt
|
|
|
470
524
|
# - openai: api_key, base_url (for OpenAI/custom endpoints)
|
|
471
525
|
# - anthropic: api_key (for Claude models)
|
|
472
526
|
|
|
473
|
-
# 🔑 Configure
|
|
474
|
-
# Edit mcp_agent.config.yaml
|
|
527
|
+
# 🔑 Configure search API keys for web search (optional)
|
|
528
|
+
# Edit mcp_agent.config.yaml to set your API keys:
|
|
529
|
+
# - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
|
|
530
|
+
# - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
|
|
531
|
+
|
|
532
|
+
# 📄 Configure document segmentation (optional)
|
|
533
|
+
# Edit mcp_agent.config.yaml to control document processing:
|
|
534
|
+
# - enabled: true/false (whether to use intelligent document segmentation)
|
|
535
|
+
# - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
|
|
475
536
|
```
|
|
476
537
|
|
|
477
538
|
</details>
|
|
@@ -504,6 +565,47 @@ mcp:
|
|
|
504
565
|
|
|
505
566
|
> **Note**: Replace the path with your actual global node_modules path from step 2.
|
|
506
567
|
|
|
568
|
+
#### 🔍 **Search Server Configuration (Optional)**
|
|
569
|
+
|
|
570
|
+
DeepCode supports multiple search servers for web search functionality. You can configure your preferred option in `mcp_agent.config.yaml`:
|
|
571
|
+
|
|
572
|
+
```yaml
|
|
573
|
+
# Default search server configuration
|
|
574
|
+
# Options: "brave" or "bocha-mcp"
|
|
575
|
+
default_search_server: "brave"
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
**Available Options:**
|
|
579
|
+
- **🔍 Brave Search** (`"brave"`):
|
|
580
|
+
- Default option with high-quality search results
|
|
581
|
+
- Requires BRAVE_API_KEY configuration
|
|
582
|
+
- Recommended for most users
|
|
583
|
+
|
|
584
|
+
- **🌐 Bocha-MCP** (`"bocha-mcp"`):
|
|
585
|
+
- Alternative search server option
|
|
586
|
+
- Requires BOCHA_API_KEY configuration
|
|
587
|
+
- Uses local Python server implementation
|
|
588
|
+
|
|
589
|
+
**API Key Configuration in mcp_agent.config.yaml:**
|
|
590
|
+
```yaml
|
|
591
|
+
# For Brave Search (default) - around line 28
|
|
592
|
+
brave:
|
|
593
|
+
command: "npx"
|
|
594
|
+
args: ["-y", "@modelcontextprotocol/server-brave-search"]
|
|
595
|
+
env:
|
|
596
|
+
BRAVE_API_KEY: "your_brave_api_key_here"
|
|
597
|
+
|
|
598
|
+
# For Bocha-MCP (alternative) - around line 74
|
|
599
|
+
bocha-mcp:
|
|
600
|
+
command: "python"
|
|
601
|
+
args: ["tools/bocha_search_server.py"]
|
|
602
|
+
env:
|
|
603
|
+
PYTHONPATH: "."
|
|
604
|
+
BOCHA_API_KEY: "your_bocha_api_key_here"
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
> **💡 Tip**: Both search servers require API key configuration. Choose the one that best fits your API access and requirements.
|
|
608
|
+
|
|
507
609
|
### ⚡ **Step 2: Launch Application**
|
|
508
610
|
|
|
509
611
|
#### 🚀 **Using Installed Package (Recommended)**
|
|
@@ -613,6 +715,14 @@ python cli/main_cli.py
|
|
|
613
715
|
|
|
614
716
|
|
|
615
717
|
|
|
718
|
+
### 🆕 **Recent Updates**
|
|
719
|
+
|
|
720
|
+
#### 📄 **Smart Document Segmentation (v1.2.0)**
|
|
721
|
+
- **Intelligent Processing**: Automatically handles large research papers and technical documents that exceed LLM token limits
|
|
722
|
+
- **Configurable Control**: Toggle segmentation via configuration with size-based thresholds
|
|
723
|
+
- **Semantic Analysis**: Advanced content understanding with algorithm, concept, and formula preservation
|
|
724
|
+
- **Backward Compatibility**: Seamlessly falls back to traditional processing for smaller documents
|
|
725
|
+
|
|
616
726
|
### 🚀 **Coming Soon**
|
|
617
727
|
|
|
618
728
|
We're continuously enhancing DeepCode with exciting new features:
|
|
@@ -37,6 +37,8 @@ class CLIApp:
|
|
|
37
37
|
self.app = None # Will be initialized by workflow adapter
|
|
38
38
|
self.logger = None
|
|
39
39
|
self.context = None
|
|
40
|
+
# Document segmentation configuration
|
|
41
|
+
self.segmentation_config = {"enabled": True, "size_threshold_chars": 50000}
|
|
40
42
|
|
|
41
43
|
async def initialize_mcp_app(self):
|
|
42
44
|
"""初始化MCP应用 - 使用工作流适配器"""
|
|
@@ -47,9 +49,51 @@ class CLIApp:
|
|
|
47
49
|
"""清理MCP应用 - 使用工作流适配器"""
|
|
48
50
|
await self.workflow_adapter.cleanup_mcp_app()
|
|
49
51
|
|
|
52
|
+
def update_segmentation_config(self):
|
|
53
|
+
"""Update document segmentation configuration in mcp_agent.config.yaml"""
|
|
54
|
+
import yaml
|
|
55
|
+
import os
|
|
56
|
+
|
|
57
|
+
config_path = os.path.join(
|
|
58
|
+
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
|
|
59
|
+
"mcp_agent.config.yaml",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
# Read current config
|
|
64
|
+
with open(config_path, "r", encoding="utf-8") as f:
|
|
65
|
+
config = yaml.safe_load(f)
|
|
66
|
+
|
|
67
|
+
# Update document segmentation settings
|
|
68
|
+
if "document_segmentation" not in config:
|
|
69
|
+
config["document_segmentation"] = {}
|
|
70
|
+
|
|
71
|
+
config["document_segmentation"]["enabled"] = self.segmentation_config[
|
|
72
|
+
"enabled"
|
|
73
|
+
]
|
|
74
|
+
config["document_segmentation"]["size_threshold_chars"] = (
|
|
75
|
+
self.segmentation_config["size_threshold_chars"]
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Write updated config
|
|
79
|
+
with open(config_path, "w", encoding="utf-8") as f:
|
|
80
|
+
yaml.dump(config, f, default_flow_style=False, allow_unicode=True)
|
|
81
|
+
|
|
82
|
+
self.cli.print_status(
|
|
83
|
+
"📄 Document segmentation configuration updated", "success"
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
except Exception as e:
|
|
87
|
+
self.cli.print_status(
|
|
88
|
+
f"⚠️ Failed to update segmentation config: {str(e)}", "warning"
|
|
89
|
+
)
|
|
90
|
+
|
|
50
91
|
async def process_input(self, input_source: str, input_type: str):
|
|
51
92
|
"""处理输入源(URL或文件)- 使用升级版智能体编排引擎"""
|
|
52
93
|
try:
|
|
94
|
+
# Update segmentation configuration before processing
|
|
95
|
+
self.update_segmentation_config()
|
|
96
|
+
|
|
53
97
|
self.cli.print_separator()
|
|
54
98
|
self.cli.print_status(
|
|
55
99
|
"🚀 Starting intelligent agent orchestration...", "processing"
|
|
@@ -237,8 +281,20 @@ class CLIApp:
|
|
|
237
281
|
self.cli.show_history()
|
|
238
282
|
|
|
239
283
|
elif choice in ["c", "config", "configure"]:
|
|
284
|
+
# Sync current segmentation config from CLI interface
|
|
285
|
+
self.segmentation_config["enabled"] = self.cli.segmentation_enabled
|
|
286
|
+
self.segmentation_config["size_threshold_chars"] = (
|
|
287
|
+
self.cli.segmentation_threshold
|
|
288
|
+
)
|
|
289
|
+
|
|
240
290
|
self.cli.show_configuration_menu()
|
|
241
291
|
|
|
292
|
+
# Sync back from CLI interface after configuration changes
|
|
293
|
+
self.segmentation_config["enabled"] = self.cli.segmentation_enabled
|
|
294
|
+
self.segmentation_config["size_threshold_chars"] = (
|
|
295
|
+
self.cli.segmentation_threshold
|
|
296
|
+
)
|
|
297
|
+
|
|
242
298
|
else:
|
|
243
299
|
self.cli.print_status(
|
|
244
300
|
"Invalid choice. Please select U, F, T, C, H, or Q.", "warning"
|
|
@@ -40,6 +40,8 @@ class CLIInterface:
|
|
|
40
40
|
self.is_running = True
|
|
41
41
|
self.processing_history = []
|
|
42
42
|
self.enable_indexing = True # Default configuration
|
|
43
|
+
self.segmentation_enabled = True # Default to smart segmentation
|
|
44
|
+
self.segmentation_threshold = 50000 # Default threshold
|
|
43
45
|
|
|
44
46
|
# Check tkinter availability for file dialogs
|
|
45
47
|
self.tkinter_available = True
|
|
@@ -125,6 +127,9 @@ class CLIInterface:
|
|
|
125
127
|
# Display current configuration
|
|
126
128
|
pipeline_mode = "🧠 COMPREHENSIVE" if self.enable_indexing else "⚡ OPTIMIZED"
|
|
127
129
|
index_status = "✅ Enabled" if self.enable_indexing else "🔶 Disabled"
|
|
130
|
+
segmentation_mode = (
|
|
131
|
+
"📄 SMART" if self.segmentation_enabled else "📋 TRADITIONAL"
|
|
132
|
+
)
|
|
128
133
|
|
|
129
134
|
menu = f"""
|
|
130
135
|
{Colors.BOLD}{Colors.CYAN}╔═══════════════════════════════════════════════════════════════════════════════╗
|
|
@@ -135,6 +140,7 @@ class CLIInterface:
|
|
|
135
140
|
║ ║
|
|
136
141
|
║ {Colors.BOLD}🤖 Current Pipeline Mode: {pipeline_mode}{Colors.CYAN} ║
|
|
137
142
|
║ {Colors.BOLD}🗂️ Codebase Indexing: {index_status}{Colors.CYAN} ║
|
|
143
|
+
║ {Colors.BOLD}📄 Document Processing: {segmentation_mode}{Colors.CYAN} ║
|
|
138
144
|
║ ║
|
|
139
145
|
║ {Colors.YELLOW}📝 URL Processing:{Colors.CYAN} ║
|
|
140
146
|
║ {Colors.YELLOW} ▶ Enter research paper URL (arXiv, IEEE, ACM, etc.) {Colors.CYAN}║
|
|
@@ -693,6 +699,11 @@ class CLIInterface:
|
|
|
693
699
|
def show_configuration_menu(self):
|
|
694
700
|
"""Show configuration options menu"""
|
|
695
701
|
self.clear_screen()
|
|
702
|
+
|
|
703
|
+
# Get segmentation config status
|
|
704
|
+
segmentation_enabled = getattr(self, "segmentation_enabled", True)
|
|
705
|
+
segmentation_threshold = getattr(self, "segmentation_threshold", 50000)
|
|
706
|
+
|
|
696
707
|
print(f"""
|
|
697
708
|
{Colors.BOLD}{Colors.CYAN}╔═══════════════════════════════════════════════════════════════════════════════╗
|
|
698
709
|
║ CONFIGURATION MENU ║
|
|
@@ -716,9 +727,23 @@ class CLIInterface:
|
|
|
716
727
|
║ ✗ Repository Acquisition (Skipped) ║
|
|
717
728
|
║ ✗ Codebase Intelligence Orchestration (Skipped) ║
|
|
718
729
|
║ ║
|
|
719
|
-
║ {Colors.
|
|
730
|
+
║ {Colors.OKCYAN}[2] Document Processing:{Colors.CYAN} ║
|
|
731
|
+
║ {Colors.BOLD}📄 Smart Segmentation{Colors.CYAN} - Intelligent document analysis (Default) ║
|
|
732
|
+
║ ✓ Semantic boundary detection ║
|
|
733
|
+
║ ✓ Algorithm integrity preservation ║
|
|
734
|
+
║ ✓ Formula chain recognition ║
|
|
735
|
+
║ ✓ Adaptive character limits ║
|
|
736
|
+
║ ║
|
|
737
|
+
║ {Colors.BOLD}📋 Traditional Processing{Colors.CYAN} - Full document reading ║
|
|
738
|
+
║ ✓ Complete document analysis ║
|
|
739
|
+
║ ✗ Smart segmentation (Disabled) ║
|
|
720
740
|
║ ║
|
|
721
|
-
║ {Colors.
|
|
741
|
+
║ {Colors.YELLOW}Current Settings:{Colors.CYAN} ║
|
|
742
|
+
║ Pipeline: {'🧠 Comprehensive Mode' if self.enable_indexing else '⚡ Optimized Mode'} ║
|
|
743
|
+
║ Document: {'📄 Smart Segmentation' if segmentation_enabled else '📋 Traditional Processing'} ║
|
|
744
|
+
║ Threshold: {segmentation_threshold} characters ║
|
|
745
|
+
║ ║
|
|
746
|
+
║ {Colors.OKGREEN}[T] Toggle Pipeline {Colors.BLUE}[S] Toggle Segmentation {Colors.FAIL}[B] Back{Colors.CYAN} ║
|
|
722
747
|
╚═══════════════════════════════════════════════════════════════════════════════╝{Colors.ENDC}
|
|
723
748
|
""")
|
|
724
749
|
|
|
@@ -737,8 +762,25 @@ class CLIInterface:
|
|
|
737
762
|
self.show_configuration_menu()
|
|
738
763
|
return
|
|
739
764
|
|
|
765
|
+
elif choice in ["s", "segmentation"]:
|
|
766
|
+
current_state = getattr(self, "segmentation_enabled", True)
|
|
767
|
+
self.segmentation_enabled = not current_state
|
|
768
|
+
seg_mode = (
|
|
769
|
+
"📄 Smart Segmentation"
|
|
770
|
+
if self.segmentation_enabled
|
|
771
|
+
else "📋 Traditional Processing"
|
|
772
|
+
)
|
|
773
|
+
self.print_status(
|
|
774
|
+
f"Document processing switched to: {seg_mode}", "success"
|
|
775
|
+
)
|
|
776
|
+
time.sleep(1)
|
|
777
|
+
self.show_configuration_menu()
|
|
778
|
+
return
|
|
779
|
+
|
|
740
780
|
elif choice in ["b", "back"]:
|
|
741
781
|
return
|
|
742
782
|
|
|
743
783
|
else:
|
|
744
|
-
self.print_status(
|
|
784
|
+
self.print_status(
|
|
785
|
+
"Invalid choice. Please enter 'T', 'S', or 'B'.", "warning"
|
|
786
|
+
)
|