minion-code 0.1.0__tar.gz → 0.1.1__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.
- minion_code-0.1.1/PKG-INFO +475 -0
- minion_code-0.1.1/README.md +447 -0
- minion_code-0.1.1/examples/cli_entrypoint.py +60 -0
- {minion_code-0.1.0/examples → minion_code-0.1.1/examples/components}/agent_with_todos.py +58 -47
- {minion_code-0.1.0/examples → minion_code-0.1.1/examples/components}/message_response_children_demo.py +61 -55
- minion_code-0.1.1/examples/components/messages_component.py +199 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/examples/file_freshness_example.py +22 -22
- {minion_code-0.1.0 → minion_code-0.1.1}/examples/file_watching_example.py +32 -26
- minion_code-0.1.1/examples/interruptible_tui.py +923 -0
- minion_code-0.1.1/examples/repl_tui.py +129 -0
- minion_code-0.1.1/examples/skills/example_usage.py +57 -0
- minion_code-0.1.1/examples/start.py +173 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/__init__.py +1 -1
- minion_code-0.1.1/minion_code/acp_server/__init__.py +34 -0
- minion_code-0.1.1/minion_code/acp_server/agent.py +539 -0
- minion_code-0.1.1/minion_code/acp_server/hooks.py +354 -0
- minion_code-0.1.1/minion_code/acp_server/main.py +194 -0
- minion_code-0.1.1/minion_code/acp_server/permissions.py +142 -0
- minion_code-0.1.1/minion_code/acp_server/test_client.py +104 -0
- minion_code-0.1.1/minion_code/adapters/__init__.py +22 -0
- minion_code-0.1.1/minion_code/adapters/output_adapter.py +207 -0
- minion_code-0.1.1/minion_code/adapters/rich_adapter.py +169 -0
- minion_code-0.1.1/minion_code/adapters/textual_adapter.py +254 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/agents/__init__.py +2 -2
- minion_code-0.1.1/minion_code/agents/code_agent.py +733 -0
- minion_code-0.1.1/minion_code/agents/hooks.py +378 -0
- minion_code-0.1.1/minion_code/cli.py +611 -0
- minion_code-0.1.1/minion_code/cli_simple.py +665 -0
- minion_code-0.1.1/minion_code/commands/__init__.py +197 -0
- minion_code-0.1.1/minion_code/commands/clear_command.py +43 -0
- minion_code-0.1.1/minion_code/commands/help_command.py +74 -0
- minion_code-0.1.1/minion_code/commands/history_command.py +86 -0
- minion_code-0.1.1/minion_code/commands/model_command.py +194 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/commands/quit_command.py +9 -12
- minion_code-0.1.1/minion_code/commands/resume_command.py +181 -0
- minion_code-0.1.1/minion_code/commands/skill_command.py +89 -0
- minion_code-0.1.1/minion_code/commands/status_command.py +90 -0
- minion_code-0.1.1/minion_code/commands/tools_command.py +88 -0
- minion_code-0.1.1/minion_code/commands/version_command.py +69 -0
- minion_code-0.1.1/minion_code/components/ConfirmDialog.py +430 -0
- minion_code-0.1.1/minion_code/components/Message.py +525 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/components/MessageResponse.py +30 -29
- minion_code-0.1.1/minion_code/components/Messages.py +351 -0
- minion_code-0.1.1/minion_code/components/PromptInput.py +788 -0
- minion_code-0.1.1/minion_code/components/__init__.py +36 -0
- minion_code-0.1.1/minion_code/const.py +7 -0
- minion_code-0.1.1/minion_code/screens/REPL.py +1909 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/screens/__init__.py +1 -1
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/services/__init__.py +20 -20
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/services/event_system.py +19 -14
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/services/file_freshness_service.py +223 -170
- minion_code-0.1.1/minion_code/skills/__init__.py +25 -0
- minion_code-0.1.1/minion_code/skills/skill.py +128 -0
- minion_code-0.1.1/minion_code/skills/skill_loader.py +198 -0
- minion_code-0.1.1/minion_code/skills/skill_registry.py +177 -0
- minion_code-0.1.1/minion_code/subagents/__init__.py +31 -0
- minion_code-0.1.1/minion_code/subagents/builtin/__init__.py +30 -0
- minion_code-0.1.1/minion_code/subagents/builtin/claude_code_guide.py +32 -0
- minion_code-0.1.1/minion_code/subagents/builtin/explore.py +36 -0
- minion_code-0.1.1/minion_code/subagents/builtin/general_purpose.py +19 -0
- minion_code-0.1.1/minion_code/subagents/builtin/plan.py +61 -0
- minion_code-0.1.1/minion_code/subagents/subagent.py +116 -0
- minion_code-0.1.1/minion_code/subagents/subagent_loader.py +147 -0
- minion_code-0.1.1/minion_code/subagents/subagent_registry.py +151 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/__init__.py +8 -2
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/bash_tool.py +16 -3
- minion_code-0.1.1/minion_code/tools/file_edit_tool.py +335 -0
- minion_code-0.1.1/minion_code/tools/file_read_tool.py +230 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/file_write_tool.py +17 -3
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/glob_tool.py +23 -2
- minion_code-0.1.1/minion_code/tools/grep_tool.py +313 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/ls_tool.py +28 -3
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/multi_edit_tool.py +89 -84
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/python_interpreter_tool.py +9 -1
- minion_code-0.1.1/minion_code/tools/skill_tool.py +210 -0
- minion_code-0.1.1/minion_code/tools/task_tool.py +287 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/todo_read_tool.py +28 -24
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/todo_write_tool.py +82 -65
- minion_code-0.1.0/minion_code/types.py → minion_code-0.1.1/minion_code/type_defs.py +15 -2
- minion_code-0.1.1/minion_code/utils/__init__.py +72 -0
- minion_code-0.1.1/minion_code/utils/config.py +610 -0
- minion_code-0.1.1/minion_code/utils/history.py +114 -0
- minion_code-0.1.1/minion_code/utils/logs.py +53 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/utils/mcp_loader.py +153 -55
- minion_code-0.1.1/minion_code/utils/output_truncator.py +233 -0
- minion_code-0.1.1/minion_code/utils/session_storage.py +369 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/utils/todo_file_utils.py +26 -22
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/utils/todo_storage.py +43 -33
- minion_code-0.1.1/minion_code/web/__init__.py +9 -0
- minion_code-0.1.1/minion_code/web/adapters/__init__.py +5 -0
- minion_code-0.1.1/minion_code/web/adapters/web_adapter.py +524 -0
- minion_code-0.1.1/minion_code/web/api/__init__.py +7 -0
- minion_code-0.1.1/minion_code/web/api/chat.py +277 -0
- minion_code-0.1.1/minion_code/web/api/interactions.py +136 -0
- minion_code-0.1.1/minion_code/web/api/sessions.py +135 -0
- minion_code-0.1.1/minion_code/web/server.py +149 -0
- minion_code-0.1.1/minion_code/web/services/__init__.py +5 -0
- minion_code-0.1.1/minion_code/web/services/session_manager.py +420 -0
- minion_code-0.1.1/minion_code.egg-info/PKG-INFO +475 -0
- minion_code-0.1.1/minion_code.egg-info/SOURCES.txt +114 -0
- minion_code-0.1.1/minion_code.egg-info/entry_points.txt +6 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code.egg-info/requires.txt +7 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code.egg-info/top_level.txt +0 -1
- minion_code-0.1.1/pyproject.toml +62 -0
- minion_code-0.1.1/tests/test_adapter.py +67 -0
- minion_code-0.1.1/tests/test_adapter_simple.py +79 -0
- minion_code-0.1.1/tests/test_file_read_tool.py +144 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/tests/test_readonly_tools.py +0 -2
- minion_code-0.1.1/tests/test_skills.py +441 -0
- minion_code-0.1.0/PKG-INFO +0 -350
- minion_code-0.1.0/README.md +0 -328
- minion_code-0.1.0/examples/advance_tui.py +0 -508
- minion_code-0.1.0/examples/interruptible_tui.py +0 -5
- minion_code-0.1.0/examples/rich_example.py +0 -4
- minion_code-0.1.0/examples/simple_file_watching.py +0 -57
- minion_code-0.1.0/examples/simple_tui.py +0 -267
- minion_code-0.1.0/examples/simple_usage.py +0 -69
- minion_code-0.1.0/minion_code/agents/code_agent.py +0 -320
- minion_code-0.1.0/minion_code/cli.py +0 -502
- minion_code-0.1.0/minion_code/commands/__init__.py +0 -90
- minion_code-0.1.0/minion_code/commands/clear_command.py +0 -70
- minion_code-0.1.0/minion_code/commands/help_command.py +0 -90
- minion_code-0.1.0/minion_code/commands/history_command.py +0 -104
- minion_code-0.1.0/minion_code/commands/status_command.py +0 -115
- minion_code-0.1.0/minion_code/commands/tools_command.py +0 -86
- minion_code-0.1.0/minion_code/commands/version_command.py +0 -104
- minion_code-0.1.0/minion_code/components/Message.py +0 -304
- minion_code-0.1.0/minion_code/components/PromptInput.py +0 -534
- minion_code-0.1.0/minion_code/components/__init__.py +0 -29
- minion_code-0.1.0/minion_code/screens/REPL.py +0 -925
- minion_code-0.1.0/minion_code/tools/file_edit_tool.py +0 -238
- minion_code-0.1.0/minion_code/tools/file_read_tool.py +0 -73
- minion_code-0.1.0/minion_code/tools/grep_tool.py +0 -105
- minion_code-0.1.0/minion_code/utils/__init__.py +0 -44
- minion_code-0.1.0/minion_code.egg-info/PKG-INFO +0 -350
- minion_code-0.1.0/minion_code.egg-info/SOURCES.txt +0 -62
- minion_code-0.1.0/minion_code.egg-info/entry_points.txt +0 -4
- minion_code-0.1.0/pyproject.toml +0 -38
- {minion_code-0.1.0 → minion_code-0.1.1}/LICENSE +0 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code/tools/user_input_tool.py +0 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/minion_code.egg-info/dependency_links.txt +0 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/setup.cfg +0 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/tests/__init__.py +0 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/tests/test_basic.py +0 -0
- {minion_code-0.1.0 → minion_code-0.1.1}/tests/test_tools.py +0 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: minion-code
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A Python project depending on minion
|
|
5
|
+
Author-email: User <user@example.com>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: minionx
|
|
10
|
+
Requires-Dist: typer>=0.9.0
|
|
11
|
+
Requires-Dist: Pillow>=10.0.0
|
|
12
|
+
Requires-Dist: nest-asyncio>=1.5.0
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest; extra == "dev"
|
|
15
|
+
Requires-Dist: black; extra == "dev"
|
|
16
|
+
Requires-Dist: flake8; extra == "dev"
|
|
17
|
+
Requires-Dist: mypy; extra == "dev"
|
|
18
|
+
Provides-Extra: tui
|
|
19
|
+
Requires-Dist: textual>=0.40.0; extra == "tui"
|
|
20
|
+
Requires-Dist: rich>=13.0.0; extra == "tui"
|
|
21
|
+
Provides-Extra: agent
|
|
22
|
+
Requires-Dist: openai>=1.0.0; extra == "agent"
|
|
23
|
+
Provides-Extra: web
|
|
24
|
+
Requires-Dist: fastapi>=0.100.0; extra == "web"
|
|
25
|
+
Requires-Dist: uvicorn>=0.20.0; extra == "web"
|
|
26
|
+
Requires-Dist: pydantic>=2.0.0; extra == "web"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# MinionCodeAgent
|
|
30
|
+
|
|
31
|
+
An enhanced AI code assistant built on the Minion framework, pre-configured with rich development tools, optimized for code development tasks.
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- 🤖 **Intelligent Code Assistant**: Pre-configured AI agent designed for programming tasks
|
|
36
|
+
- 🔧 **Rich Toolset**: Automatically includes 12+ tools for file operations, command execution, web search, etc.
|
|
37
|
+
- ⚡ **Ready to Use**: One-line creation, no complex configuration needed
|
|
38
|
+
- 📝 **Conversation History**: Built-in conversation history tracking and management
|
|
39
|
+
- 🎯 **Optimized Prompts**: System prompts optimized for code development tasks
|
|
40
|
+
- 🛡️ **Security by Design**: Built-in security checks to prevent dangerous operations
|
|
41
|
+
- 🔌 **ACP Protocol Support**: Seamless integration with ACP clients like Zed editor
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
### Option 1: Install from source (recommended for development)
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Clone the dependency repository
|
|
49
|
+
git clone https://github.com/femto/minion
|
|
50
|
+
|
|
51
|
+
# Clone this repository
|
|
52
|
+
git clone https://github.com/femto/minion-code
|
|
53
|
+
|
|
54
|
+
# Enter the directory
|
|
55
|
+
cd minion-code
|
|
56
|
+
|
|
57
|
+
# Install minion dependency
|
|
58
|
+
pip install -e ../minion
|
|
59
|
+
|
|
60
|
+
# Install minion-code
|
|
61
|
+
pip install -e .
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
In this case, `MINION_ROOT` is located at `../minion`
|
|
65
|
+
|
|
66
|
+
### Option 2: Direct installation (recommended for general use)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Clone this repository
|
|
70
|
+
git clone https://github.com/femto/minion-code
|
|
71
|
+
cd minion-code
|
|
72
|
+
|
|
73
|
+
# Install dependencies
|
|
74
|
+
pip install minionx
|
|
75
|
+
|
|
76
|
+
# Install minion-code
|
|
77
|
+
pip install -e .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
In this case, `MINION_ROOT` is located at the current startup location
|
|
81
|
+
|
|
82
|
+
On startup, the actual path of `MINION_ROOT` will be displayed:
|
|
83
|
+
```
|
|
84
|
+
2025-11-13 12:21:48.042 | INFO | minion.const:get_minion_root:44 - MINION_ROOT set to: <some_path>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
# LLM Configuration
|
|
88
|
+
|
|
89
|
+
Please refer to https://github.com/femto/minion?tab=readme-ov-file#get-started
|
|
90
|
+
|
|
91
|
+
Make sure the config file is in `MINION_ROOT/config/config.yaml` or `~/.minion/config.yaml`
|
|
92
|
+
|
|
93
|
+
## Quick Start
|
|
94
|
+
|
|
95
|
+
### CLI Usage
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Basic usage
|
|
99
|
+
mcode
|
|
100
|
+
|
|
101
|
+
# Specify working directory
|
|
102
|
+
mcode --dir /path/to/project
|
|
103
|
+
|
|
104
|
+
# Specify LLM model
|
|
105
|
+
mcode --model gpt-4o
|
|
106
|
+
mcode --model claude-3-5-sonnet
|
|
107
|
+
|
|
108
|
+
# Enable verbose output
|
|
109
|
+
mcode --verbose
|
|
110
|
+
|
|
111
|
+
# Load additional tools using MCP config file
|
|
112
|
+
mcode --config mcp.json
|
|
113
|
+
|
|
114
|
+
# Combined usage
|
|
115
|
+
mcode --dir /path/to/project --model gpt-4o --config mcp.json --verbose
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Model Configuration
|
|
119
|
+
|
|
120
|
+
Configure the default LLM model used by minion-code:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# View current default model
|
|
124
|
+
mcode model
|
|
125
|
+
|
|
126
|
+
# Set default model (saved to ~/.minion/minion-code.json)
|
|
127
|
+
mcode model gpt-4o
|
|
128
|
+
mcode model claude-3-5-sonnet
|
|
129
|
+
|
|
130
|
+
# Clear default model (use built-in default)
|
|
131
|
+
mcode model --clear
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Model Priority:**
|
|
135
|
+
1. CLI `--model` argument (highest priority)
|
|
136
|
+
2. Config file `~/.minion/minion-code.json`
|
|
137
|
+
3. Built-in default (lowest priority)
|
|
138
|
+
|
|
139
|
+
### ACP Protocol Support
|
|
140
|
+
|
|
141
|
+
MinionCodeAgent supports the [ACP (Agent Communication Protocol)](https://agentcommunicationprotocol.dev/) protocol, enabling integration with ACP-compatible clients like Zed editor.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Start ACP server (stdio mode)
|
|
145
|
+
mcode acp
|
|
146
|
+
|
|
147
|
+
# Specify working directory
|
|
148
|
+
mcode acp --dir /path/to/project
|
|
149
|
+
|
|
150
|
+
# Specify LLM model
|
|
151
|
+
mcode acp --model gpt-4o
|
|
152
|
+
|
|
153
|
+
# Enable verbose logging
|
|
154
|
+
mcode acp --verbose
|
|
155
|
+
|
|
156
|
+
# Skip tool permission prompts (auto-allow all tools)
|
|
157
|
+
mcode acp --dangerously-skip-permissions
|
|
158
|
+
|
|
159
|
+
# Combined usage
|
|
160
|
+
mcode acp --dir /path/to/project --model claude-3-5-sonnet --verbose
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Using with Zed Editor
|
|
164
|
+
|
|
165
|
+
Add the following to Zed's `settings.json`:
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"agent_servers": {
|
|
170
|
+
|
|
171
|
+
"minion-code": {
|
|
172
|
+
"type": "custom",
|
|
173
|
+
"command": "/path/to/mcode",
|
|
174
|
+
"args": [
|
|
175
|
+
"acp"
|
|
176
|
+
],
|
|
177
|
+
"env": {}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Permission Management
|
|
184
|
+
|
|
185
|
+
In ACP mode, tool calls will request user permission:
|
|
186
|
+
- **Allow once**: Allow this time only
|
|
187
|
+
- **Always allow**: Permanently allow this tool (saved to `~/.minion/sessions/`)
|
|
188
|
+
- **Reject**: Deny execution
|
|
189
|
+
|
|
190
|
+
### Programming Interface
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
import asyncio
|
|
194
|
+
from minion_code import MinionCodeAgent
|
|
195
|
+
|
|
196
|
+
async def main():
|
|
197
|
+
# Create AI code assistant with all tools auto-configured
|
|
198
|
+
agent = await MinionCodeAgent.create(
|
|
199
|
+
name="My Code Assistant",
|
|
200
|
+
llm="gpt-4.1"
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
# Chat with the AI assistant
|
|
204
|
+
response = await agent.run_async("List files in current directory")
|
|
205
|
+
print(response.answer)
|
|
206
|
+
|
|
207
|
+
response = await agent.run_async("Read the README.md file")
|
|
208
|
+
print(response.answer)
|
|
209
|
+
|
|
210
|
+
asyncio.run(main())
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Custom Configuration
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
# Custom system prompt and working directory
|
|
217
|
+
agent = await MinionCodeAgent.create(
|
|
218
|
+
name="Python Expert",
|
|
219
|
+
llm="gpt-4.1",
|
|
220
|
+
system_prompt="You are a specialized Python developer assistant.",
|
|
221
|
+
workdir="/path/to/project",
|
|
222
|
+
additional_tools=[MyCustomTool()]
|
|
223
|
+
)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### View Available Tools
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
# Print tools summary
|
|
230
|
+
agent.print_tools_summary()
|
|
231
|
+
|
|
232
|
+
# Get tools info
|
|
233
|
+
tools_info = agent.get_tools_info()
|
|
234
|
+
for tool in tools_info:
|
|
235
|
+
print(f"{tool['name']}: {tool['description']}")
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Built-in Tools
|
|
239
|
+
|
|
240
|
+
MinionCodeAgent automatically includes the following tool categories:
|
|
241
|
+
|
|
242
|
+
### 📁 File and Directory Tools
|
|
243
|
+
- **FileReadTool**: Read file contents
|
|
244
|
+
- **FileWriteTool**: Write files
|
|
245
|
+
- **GrepTool**: Search text in files
|
|
246
|
+
- **GlobTool**: File pattern matching
|
|
247
|
+
- **LsTool**: List directory contents
|
|
248
|
+
|
|
249
|
+
### 💻 System and Execution Tools
|
|
250
|
+
- **BashTool**: Execute shell commands
|
|
251
|
+
- **PythonInterpreterTool**: Execute Python code
|
|
252
|
+
|
|
253
|
+
### 🌐 Network and Search Tools
|
|
254
|
+
- **WebSearchTool**: Web search
|
|
255
|
+
- **WikipediaSearchTool**: Wikipedia search
|
|
256
|
+
- **VisitWebpageTool**: Visit webpages
|
|
257
|
+
|
|
258
|
+
### 🔧 Other Tools
|
|
259
|
+
- **UserInputTool**: User input
|
|
260
|
+
- **TodoWriteTool**: Task management write
|
|
261
|
+
- **TodoReadTool**: Task management read
|
|
262
|
+
|
|
263
|
+
## MCP Tool Integration
|
|
264
|
+
|
|
265
|
+
MinionCodeAgent supports loading additional tools via MCP (Model Context Protocol) configuration files.
|
|
266
|
+
|
|
267
|
+
### MCP Configuration File Format
|
|
268
|
+
|
|
269
|
+
Create a JSON configuration file (e.g., `mcp.json`):
|
|
270
|
+
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"mcpServers": {
|
|
274
|
+
"chrome-devtools": {
|
|
275
|
+
"command": "npx",
|
|
276
|
+
"args": ["-y", "chrome-devtools-mcp@latest"],
|
|
277
|
+
"env": {
|
|
278
|
+
"FASTMCP_LOG_LEVEL": "ERROR"
|
|
279
|
+
},
|
|
280
|
+
"disabled": false,
|
|
281
|
+
"autoApprove": []
|
|
282
|
+
},
|
|
283
|
+
"filesystem": {
|
|
284
|
+
"command": "uvx",
|
|
285
|
+
"args": ["mcp-server-filesystem", "/tmp"],
|
|
286
|
+
"disabled": true,
|
|
287
|
+
"autoApprove": ["read_file", "list_directory"]
|
|
288
|
+
},
|
|
289
|
+
"git": {
|
|
290
|
+
"command": "uvx",
|
|
291
|
+
"args": ["mcp-server-git"],
|
|
292
|
+
"disabled": false,
|
|
293
|
+
"autoApprove": ["git_status", "git_log"]
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Configuration Options
|
|
300
|
+
|
|
301
|
+
- `command`: Command to start the MCP server
|
|
302
|
+
- `args`: List of command arguments
|
|
303
|
+
- `env`: Environment variables (optional)
|
|
304
|
+
- `disabled`: Whether to disable this server (default: false)
|
|
305
|
+
- `autoApprove`: List of tool names to auto-approve (optional)
|
|
306
|
+
|
|
307
|
+
### Using MCP Configuration
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
# Use MCP config file
|
|
311
|
+
minion-code --config examples/mcp_config.json
|
|
312
|
+
|
|
313
|
+
# View loaded tools (including MCP tools)
|
|
314
|
+
# In CLI, type: tools
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Using MCP Tools in Programming Interface
|
|
318
|
+
|
|
319
|
+
```python
|
|
320
|
+
from minion_code.utils.mcp_loader import load_mcp_tools
|
|
321
|
+
from pathlib import Path
|
|
322
|
+
|
|
323
|
+
async def main():
|
|
324
|
+
# Load MCP tools
|
|
325
|
+
mcp_tools = await load_mcp_tools(Path("mcp.json"))
|
|
326
|
+
|
|
327
|
+
# Create agent with MCP tools
|
|
328
|
+
agent = await MinionCodeAgent.create(
|
|
329
|
+
name="Enhanced Assistant",
|
|
330
|
+
llm="gpt-4o-mini",
|
|
331
|
+
additional_tools=mcp_tools
|
|
332
|
+
)
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Conversation History Management
|
|
336
|
+
|
|
337
|
+
```python
|
|
338
|
+
# Get conversation history
|
|
339
|
+
history = agent.get_conversation_history()
|
|
340
|
+
for entry in history:
|
|
341
|
+
print(f"User: {entry['user_message']}")
|
|
342
|
+
print(f"Agent: {entry['agent_response']}")
|
|
343
|
+
|
|
344
|
+
# Clear history
|
|
345
|
+
agent.clear_conversation_history()
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Comparison with Original Implementation
|
|
349
|
+
|
|
350
|
+
### Before (Complex manual configuration)
|
|
351
|
+
```python
|
|
352
|
+
# Need to manually import and configure all tools
|
|
353
|
+
from minion_code.tools import (
|
|
354
|
+
FileReadTool, FileWriteTool, BashTool,
|
|
355
|
+
GrepTool, GlobTool, LsTool,
|
|
356
|
+
PythonInterpreterTool, WebSearchTool,
|
|
357
|
+
# ... more tools
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
# Manually create tool instances
|
|
361
|
+
custom_tools = [
|
|
362
|
+
FileReadTool(),
|
|
363
|
+
FileWriteTool(),
|
|
364
|
+
BashTool(),
|
|
365
|
+
# ... more tool configuration
|
|
366
|
+
]
|
|
367
|
+
|
|
368
|
+
# Manually set system prompt
|
|
369
|
+
SYSTEM_PROMPT = "You are a coding agent..."
|
|
370
|
+
|
|
371
|
+
# Create agent (~50 lines of code)
|
|
372
|
+
agent = await CodeAgent.create(
|
|
373
|
+
name="Minion Code Assistant",
|
|
374
|
+
llm="gpt-4o-mini",
|
|
375
|
+
system_prompt=SYSTEM_PROMPT,
|
|
376
|
+
tools=custom_tools,
|
|
377
|
+
)
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Now (Using MinionCodeAgent)
|
|
381
|
+
```python
|
|
382
|
+
# One line of code completes all setup
|
|
383
|
+
agent = await MinionCodeAgent.create(
|
|
384
|
+
name="Minion Code Assistant",
|
|
385
|
+
llm="gpt-4o-mini"
|
|
386
|
+
)
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## API Reference
|
|
390
|
+
|
|
391
|
+
### MinionCodeAgent.create()
|
|
392
|
+
|
|
393
|
+
```python
|
|
394
|
+
async def create(
|
|
395
|
+
name: str = "Minion Code Assistant",
|
|
396
|
+
llm: str = "gpt-4o-mini",
|
|
397
|
+
system_prompt: Optional[str] = None,
|
|
398
|
+
workdir: Optional[Union[str, Path]] = None,
|
|
399
|
+
additional_tools: Optional[List[Any]] = None,
|
|
400
|
+
**kwargs
|
|
401
|
+
) -> MinionCodeAgent
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
**Parameters:**
|
|
405
|
+
- `name`: Agent name
|
|
406
|
+
- `llm`: LLM model to use
|
|
407
|
+
- `system_prompt`: Custom system prompt (optional)
|
|
408
|
+
- `workdir`: Working directory (optional, defaults to current directory)
|
|
409
|
+
- `additional_tools`: List of additional tools (optional)
|
|
410
|
+
- `**kwargs`: Other parameters passed to CodeAgent.create()
|
|
411
|
+
|
|
412
|
+
### Instance Methods
|
|
413
|
+
|
|
414
|
+
- `run_async(message: str)`: Run agent asynchronously
|
|
415
|
+
- `run(message: str)`: Run agent synchronously
|
|
416
|
+
- `get_conversation_history()`: Get conversation history
|
|
417
|
+
- `clear_conversation_history()`: Clear conversation history
|
|
418
|
+
- `get_tools_info()`: Get tools info
|
|
419
|
+
- `print_tools_summary()`: Print tools summary
|
|
420
|
+
|
|
421
|
+
### Properties
|
|
422
|
+
|
|
423
|
+
- `agent`: Access underlying CodeAgent instance
|
|
424
|
+
- `tools`: Get available tools list
|
|
425
|
+
- `name`: Get agent name
|
|
426
|
+
|
|
427
|
+
## Security Features
|
|
428
|
+
|
|
429
|
+
- **Command Execution Safety**: BashTool prohibits dangerous commands (e.g., `rm -rf`, `sudo`, etc.)
|
|
430
|
+
- **Python Execution Restrictions**: PythonInterpreterTool runs in a restricted environment, allowing only safe built-in functions and specified modules
|
|
431
|
+
- **File Access Control**: All file operations have path validation and error handling
|
|
432
|
+
|
|
433
|
+
## Examples
|
|
434
|
+
|
|
435
|
+
See complete examples in the `examples/` directory:
|
|
436
|
+
|
|
437
|
+
- `simple_code_agent.py`: Basic MinionCodeAgent usage example
|
|
438
|
+
- `simple_tui.py`: Simplified TUI implementation
|
|
439
|
+
- `advanced_textual_tui.py`: Advanced TUI interface (using Textual library)
|
|
440
|
+
- `minion_agent_tui.py`: Original complex implementation (for comparison)
|
|
441
|
+
- `mcp_config.json`: MCP configuration file example
|
|
442
|
+
- `test_mcp_config.py`: MCP configuration loading test
|
|
443
|
+
- `demo_mcp_cli.py`: MCP CLI feature demo
|
|
444
|
+
|
|
445
|
+
Run examples:
|
|
446
|
+
|
|
447
|
+
```bash
|
|
448
|
+
# Basic usage example
|
|
449
|
+
python examples/simple_code_agent.py
|
|
450
|
+
|
|
451
|
+
# Simple TUI
|
|
452
|
+
python examples/simple_tui.py
|
|
453
|
+
|
|
454
|
+
# Advanced TUI (requires textual: pip install textual rich)
|
|
455
|
+
python examples/advanced_textual_tui.py
|
|
456
|
+
|
|
457
|
+
# Test MCP config loading
|
|
458
|
+
python examples/test_mcp_config.py
|
|
459
|
+
|
|
460
|
+
# MCP CLI feature demo
|
|
461
|
+
python examples/demo_mcp_cli.py
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
## Documentation
|
|
465
|
+
|
|
466
|
+
- [LLM Configuration Guide](LLM_CONFIG.md) - How to configure Large Language Models (LLM)
|
|
467
|
+
- [MCP Tool Integration Guide](docs/MCP_GUIDE.md) - Detailed MCP configuration and usage guide
|
|
468
|
+
|
|
469
|
+
## Contributing
|
|
470
|
+
|
|
471
|
+
Issues and Pull Requests are welcome to improve this project!
|
|
472
|
+
|
|
473
|
+
## License
|
|
474
|
+
|
|
475
|
+
MIT License
|