mageagent-local 2.0.1
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.
- package/LICENSE +21 -0
- package/QUICK_START.md +255 -0
- package/README.md +453 -0
- package/bin/install-launchagent.js +135 -0
- package/bin/mageagent.js +255 -0
- package/bin/postinstall.js +43 -0
- package/config/com.adverant.mageagent.plist +38 -0
- package/config/config.example.json +41 -0
- package/docs/AUTOSTART.md +300 -0
- package/docs/MENUBAR_APP.md +238 -0
- package/docs/PATTERNS.md +501 -0
- package/docs/TROUBLESHOOTING.md +364 -0
- package/docs/VSCODE_SETUP.md +230 -0
- package/docs/assets/mageagent-logo.png +0 -0
- package/docs/assets/mageagent-logo.svg +57 -0
- package/docs/assets/menubar-screenshot.png +0 -0
- package/docs/diagrams/architecture.md +229 -0
- package/mageagent/__init__.py +4 -0
- package/mageagent/server.py +951 -0
- package/mageagent/tool_executor.py +453 -0
- package/menubar-app/MageAgentMenuBar/AppDelegate.swift +1337 -0
- package/menubar-app/MageAgentMenuBar/Info.plist +38 -0
- package/menubar-app/MageAgentMenuBar/main.swift +16 -0
- package/menubar-app/Package.swift +18 -0
- package/menubar-app/build/MageAgentMenuBar.app/Contents/Info.plist +38 -0
- package/menubar-app/build/MageAgentMenuBar.app/Contents/MacOS/MageAgentMenuBar +0 -0
- package/menubar-app/build/MageAgentMenuBar.app/Contents/PkgInfo +1 -0
- package/menubar-app/build/MageAgentMenuBar.app/Contents/Resources/icon.png +0 -0
- package/menubar-app/build.sh +96 -0
- package/package.json +81 -0
- package/scripts/build-dmg.sh +196 -0
- package/scripts/install.sh +641 -0
- package/scripts/mageagent-server.sh +218 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Adverant
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/QUICK_START.md
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Quick Start
|
|
2
|
+
|
|
3
|
+
**Get MageAgent running in 5 minutes.** By the end, you'll have 4 AI models working together on your Mac.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What You'll Get
|
|
8
|
+
|
|
9
|
+
After this quick start:
|
|
10
|
+
|
|
11
|
+
- **MageAgent server** running on `localhost:3457`
|
|
12
|
+
- **Menu bar app** for one-click control
|
|
13
|
+
- **Claude Code integration** with `/mage` commands
|
|
14
|
+
- **4 orchestrated models** ready to use
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
| Requirement | Check |
|
|
21
|
+
|-------------|-------|
|
|
22
|
+
| Apple Silicon Mac | M1, M2, M3, or M4 |
|
|
23
|
+
| RAM | 64GB minimum (128GB recommended) |
|
|
24
|
+
| Storage | 120GB free |
|
|
25
|
+
| Python | 3.9+ (`python3 --version`) |
|
|
26
|
+
| macOS | 13.0+ (Ventura or later) |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Option 1: One-Command Install (Recommended)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git clone https://github.com/adverant/nexus-local-mageagent.git
|
|
34
|
+
cd nexus-local-mageagent
|
|
35
|
+
./scripts/install.sh
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The installer will:
|
|
39
|
+
1. Install Python dependencies
|
|
40
|
+
2. Build the menu bar app
|
|
41
|
+
3. Set up Claude Code hooks
|
|
42
|
+
4. Configure auto-start
|
|
43
|
+
5. Optionally download models (~109GB)
|
|
44
|
+
6. Start the server
|
|
45
|
+
|
|
46
|
+
**That's it.** Skip to [Verify Installation](#verify-installation).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Option 2: npm Install
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install -g @adverant/mageagent
|
|
54
|
+
npm run setup
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Option 3: Manual Install
|
|
60
|
+
|
|
61
|
+
If you prefer to understand each step:
|
|
62
|
+
|
|
63
|
+
### Step 1: Install Dependencies
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip3 install mlx mlx-lm fastapi uvicorn pydantic huggingface_hub
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Step 2: Clone and Set Up
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git clone https://github.com/adverant/nexus-local-mageagent.git
|
|
73
|
+
cd nexus-local-mageagent
|
|
74
|
+
|
|
75
|
+
# Create directories
|
|
76
|
+
mkdir -p ~/.claude/mageagent ~/.claude/scripts ~/.claude/debug
|
|
77
|
+
|
|
78
|
+
# Copy server
|
|
79
|
+
cp mageagent/server.py ~/.claude/mageagent/
|
|
80
|
+
cp scripts/mageagent-server.sh ~/.claude/scripts/
|
|
81
|
+
chmod +x ~/.claude/scripts/mageagent-server.sh
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Step 3: Download Models
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python3 << 'EOF'
|
|
88
|
+
from huggingface_hub import snapshot_download
|
|
89
|
+
|
|
90
|
+
# Tool calling specialist (9GB)
|
|
91
|
+
snapshot_download('mlx-community/Hermes-3-Llama-3.1-8B-8bit',
|
|
92
|
+
local_dir='~/.cache/mlx-models/Hermes-3-Llama-3.1-8B-8bit')
|
|
93
|
+
|
|
94
|
+
# Primary reasoning (77GB) - takes time
|
|
95
|
+
snapshot_download('mlx-community/Qwen2.5-72B-Instruct-8bit',
|
|
96
|
+
local_dir='~/.cache/mlx-models/Qwen2.5-72B-Instruct-8bit')
|
|
97
|
+
|
|
98
|
+
# Coding specialist (18GB)
|
|
99
|
+
snapshot_download('mlx-community/Qwen2.5-Coder-32B-Instruct-4bit',
|
|
100
|
+
local_dir='~/.cache/mlx-models/Qwen2.5-Coder-32B-Instruct-4bit')
|
|
101
|
+
|
|
102
|
+
# Fast validator (5GB)
|
|
103
|
+
snapshot_download('mlx-community/Qwen2.5-Coder-7B-Instruct-4bit',
|
|
104
|
+
local_dir='~/.cache/mlx-models/Qwen2.5-Coder-7B-Instruct-4bit')
|
|
105
|
+
EOF
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Step 4: Start Server
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
~/.claude/scripts/mageagent-server.sh start
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Verify Installation
|
|
117
|
+
|
|
118
|
+
### Check Server Health
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
curl http://localhost:3457/health
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Expected output:
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"status": "healthy",
|
|
128
|
+
"loaded_models": ["validator"],
|
|
129
|
+
"available_models": ["tools", "primary", "validator", "competitor"]
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Test a Pattern
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
curl -X POST http://localhost:3457/v1/chat/completions \
|
|
137
|
+
-H "Content-Type: application/json" \
|
|
138
|
+
-d '{
|
|
139
|
+
"model": "mageagent:tools",
|
|
140
|
+
"messages": [{"role": "user", "content": "What is 2+2?"}],
|
|
141
|
+
"max_tokens": 100
|
|
142
|
+
}'
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
You should get a response within seconds.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## First Use
|
|
150
|
+
|
|
151
|
+
### From Terminal
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Use the hybrid pattern (best overall)
|
|
155
|
+
curl -X POST http://localhost:3457/v1/chat/completions \
|
|
156
|
+
-H "Content-Type: application/json" \
|
|
157
|
+
-d '{
|
|
158
|
+
"model": "mageagent:hybrid",
|
|
159
|
+
"messages": [{"role": "user", "content": "Explain how React hooks work"}],
|
|
160
|
+
"max_tokens": 1024
|
|
161
|
+
}'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### From Claude Code
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
/mage hybrid # Switch to hybrid pattern
|
|
168
|
+
/mage execute # Switch to execute pattern (real tools)
|
|
169
|
+
/mageagent status # Check server status
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Or use natural language:
|
|
173
|
+
- "use mage for this"
|
|
174
|
+
- "use best local model"
|
|
175
|
+
- "mage this code"
|
|
176
|
+
|
|
177
|
+
### From Menu Bar
|
|
178
|
+
|
|
179
|
+
Click the MageAgent icon in your menu bar:
|
|
180
|
+
- **Start/Stop** the server
|
|
181
|
+
- **Load models** individually or all at once
|
|
182
|
+
- **Switch patterns** with one click
|
|
183
|
+
- **Run tests** to verify everything works
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Patterns Reference
|
|
188
|
+
|
|
189
|
+
| Pattern | What It Does | Best For |
|
|
190
|
+
|---------|--------------|----------|
|
|
191
|
+
| `mageagent:hybrid` | 72B + Hermes tools | **General use (default)** |
|
|
192
|
+
| `mageagent:execute` | ReAct loop with real tools | File/web/command tasks |
|
|
193
|
+
| `mageagent:validated` | Generate + validate + revise | Code that must work |
|
|
194
|
+
| `mageagent:compete` | 72B vs 32B + judge | Critical decisions |
|
|
195
|
+
| `mageagent:tools` | Hermes-3 only | Fast tool extraction |
|
|
196
|
+
| `mageagent:auto` | Smart routing | Let MageAgent decide |
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Troubleshooting
|
|
201
|
+
|
|
202
|
+
### Server won't start
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Check if port is in use
|
|
206
|
+
lsof -i :3457
|
|
207
|
+
|
|
208
|
+
# View logs
|
|
209
|
+
tail -50 ~/.claude/debug/mageagent.log
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### "Model not found" error
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Verify models are downloaded
|
|
216
|
+
ls ~/.cache/mlx-models/
|
|
217
|
+
|
|
218
|
+
# Should show:
|
|
219
|
+
# Hermes-3-Llama-3.1-8B-8bit/
|
|
220
|
+
# Qwen2.5-72B-Instruct-8bit/
|
|
221
|
+
# Qwen2.5-Coder-32B-Instruct-4bit/
|
|
222
|
+
# Qwen2.5-Coder-7B-Instruct-4bit/
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Out of memory
|
|
226
|
+
|
|
227
|
+
- Close memory-heavy apps (browsers, Docker)
|
|
228
|
+
- Use lighter patterns: `tools` (9GB) or `auto` (5GB)
|
|
229
|
+
- Consider: 128GB Mac runs all patterns simultaneously
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Next Steps
|
|
234
|
+
|
|
235
|
+
You're running MageAgent. Now:
|
|
236
|
+
|
|
237
|
+
1. **Try the `execute` pattern** - Ask it to read a file or run a command
|
|
238
|
+
2. **Set up auto-start** - See [docs/AUTOSTART.md](docs/AUTOSTART.md)
|
|
239
|
+
3. **Configure VSCode** - See [docs/VSCODE_SETUP.md](docs/VSCODE_SETUP.md)
|
|
240
|
+
4. **Deep dive on patterns** - See [docs/PATTERNS.md](docs/PATTERNS.md)
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Getting Help
|
|
245
|
+
|
|
246
|
+
- **Logs**: `tail -f ~/.claude/debug/mageagent.log`
|
|
247
|
+
- **Troubleshooting**: [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)
|
|
248
|
+
- **Issues**: [GitHub Issues](https://github.com/adverant/nexus-local-mageagent/issues)
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
<p align="center">
|
|
253
|
+
<strong>You now have 4 AI models working together on your Mac.</strong><br>
|
|
254
|
+
<em>No API costs. No data leaving your machine. Ever.</em>
|
|
255
|
+
</p>
|