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
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# MageAgent Architecture Diagrams
|
|
2
|
+
|
|
3
|
+
## System Overview
|
|
4
|
+
|
|
5
|
+
```mermaid
|
|
6
|
+
graph TB
|
|
7
|
+
subgraph "User Interface"
|
|
8
|
+
MB[Menu Bar App<br/>MageAgentMenuBar.app]
|
|
9
|
+
CLI[Claude Code CLI]
|
|
10
|
+
API[Direct API Calls]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
subgraph "MageAgent Server :3457"
|
|
14
|
+
FW[FastAPI Server]
|
|
15
|
+
OR[Orchestrator]
|
|
16
|
+
TE[Tool Executor]
|
|
17
|
+
|
|
18
|
+
subgraph "Patterns"
|
|
19
|
+
AUTO[auto - Task Router]
|
|
20
|
+
EXEC[execute - ReAct Loop]
|
|
21
|
+
HYB[hybrid - Reasoning + Tools]
|
|
22
|
+
VAL[validated - Gen + Validate]
|
|
23
|
+
COMP[compete - Multi-model Judge]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
subgraph "MLX Models"
|
|
28
|
+
M72[Qwen-72B Q8<br/>77GB - Reasoning]
|
|
29
|
+
M8[Hermes-3 8B Q8<br/>9GB - Tool Calling]
|
|
30
|
+
M7[Qwen-Coder 7B<br/>5GB - Validation]
|
|
31
|
+
M32[Qwen-Coder 32B<br/>18GB - Coding]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
subgraph "External"
|
|
35
|
+
FS[File System]
|
|
36
|
+
WEB[Web Search]
|
|
37
|
+
BASH[Bash Commands]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
MB --> FW
|
|
41
|
+
CLI --> FW
|
|
42
|
+
API --> FW
|
|
43
|
+
|
|
44
|
+
FW --> OR
|
|
45
|
+
OR --> AUTO
|
|
46
|
+
OR --> EXEC
|
|
47
|
+
OR --> HYB
|
|
48
|
+
OR --> VAL
|
|
49
|
+
OR --> COMP
|
|
50
|
+
|
|
51
|
+
AUTO --> M7
|
|
52
|
+
EXEC --> M72
|
|
53
|
+
EXEC --> M8
|
|
54
|
+
HYB --> M72
|
|
55
|
+
HYB --> M8
|
|
56
|
+
VAL --> M72
|
|
57
|
+
VAL --> M7
|
|
58
|
+
COMP --> M72
|
|
59
|
+
COMP --> M32
|
|
60
|
+
COMP --> M7
|
|
61
|
+
|
|
62
|
+
TE --> FS
|
|
63
|
+
TE --> WEB
|
|
64
|
+
TE --> BASH
|
|
65
|
+
|
|
66
|
+
EXEC --> TE
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Menu Bar App Architecture
|
|
70
|
+
|
|
71
|
+
```mermaid
|
|
72
|
+
graph TB
|
|
73
|
+
subgraph "MageAgentMenuBar.app"
|
|
74
|
+
AD[AppDelegate]
|
|
75
|
+
SI[NSStatusItem]
|
|
76
|
+
MN[NSMenu]
|
|
77
|
+
|
|
78
|
+
subgraph "Menu Items"
|
|
79
|
+
ST[Status Display]
|
|
80
|
+
SC[Server Control<br/>Start/Stop/Restart]
|
|
81
|
+
WM[Warmup Models]
|
|
82
|
+
LM[Load Models Submenu]
|
|
83
|
+
PT[Patterns Submenu]
|
|
84
|
+
UT[Utilities<br/>Docs/Logs/Test/Settings]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
subgraph "Windows"
|
|
88
|
+
TW[Test Results Window]
|
|
89
|
+
SW[Settings Alert]
|
|
90
|
+
TT[Toast Notifications]
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
subgraph "External"
|
|
95
|
+
SRV[MageAgent Server<br/>localhost:3457]
|
|
96
|
+
SCR[mageagent-server.sh]
|
|
97
|
+
LOG[Log Files]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
AD --> SI
|
|
101
|
+
SI --> MN
|
|
102
|
+
MN --> ST
|
|
103
|
+
MN --> SC
|
|
104
|
+
MN --> WM
|
|
105
|
+
MN --> LM
|
|
106
|
+
MN --> PT
|
|
107
|
+
MN --> UT
|
|
108
|
+
|
|
109
|
+
AD --> TW
|
|
110
|
+
AD --> SW
|
|
111
|
+
AD --> TT
|
|
112
|
+
|
|
113
|
+
SC --> SCR
|
|
114
|
+
AD --> SRV
|
|
115
|
+
UT --> LOG
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Pattern Flow Diagrams
|
|
119
|
+
|
|
120
|
+
### Execute Pattern (ReAct Loop)
|
|
121
|
+
|
|
122
|
+
```mermaid
|
|
123
|
+
sequenceDiagram
|
|
124
|
+
participant U as User
|
|
125
|
+
participant S as Server
|
|
126
|
+
participant Q as Qwen-72B
|
|
127
|
+
participant H as Hermes-3
|
|
128
|
+
participant T as Tool Executor
|
|
129
|
+
|
|
130
|
+
U->>S: Request with tools needed
|
|
131
|
+
S->>Q: Generate response
|
|
132
|
+
Q->>S: Response with tool intentions
|
|
133
|
+
S->>H: Extract tool calls
|
|
134
|
+
H->>S: Structured tool calls JSON
|
|
135
|
+
S->>T: Execute tools
|
|
136
|
+
T->>S: Tool results
|
|
137
|
+
S->>Q: Continue with results
|
|
138
|
+
Q->>S: Final response
|
|
139
|
+
S->>U: Complete answer
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Validated Pattern
|
|
143
|
+
|
|
144
|
+
```mermaid
|
|
145
|
+
sequenceDiagram
|
|
146
|
+
participant U as User
|
|
147
|
+
participant S as Server
|
|
148
|
+
participant Q as Qwen-72B (Generator)
|
|
149
|
+
participant V as Qwen-7B (Validator)
|
|
150
|
+
|
|
151
|
+
U->>S: Request
|
|
152
|
+
S->>Q: Generate code/response
|
|
153
|
+
Q->>S: Initial response
|
|
154
|
+
S->>V: Validate response
|
|
155
|
+
V->>S: Validation result + issues
|
|
156
|
+
alt Has Issues
|
|
157
|
+
S->>Q: Revise with feedback
|
|
158
|
+
Q->>S: Revised response
|
|
159
|
+
end
|
|
160
|
+
S->>U: Final validated response
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Compete Pattern
|
|
164
|
+
|
|
165
|
+
```mermaid
|
|
166
|
+
sequenceDiagram
|
|
167
|
+
participant U as User
|
|
168
|
+
participant S as Server
|
|
169
|
+
participant Q72 as Qwen-72B
|
|
170
|
+
participant Q32 as Qwen-32B
|
|
171
|
+
participant J as Qwen-7B (Judge)
|
|
172
|
+
|
|
173
|
+
U->>S: Request
|
|
174
|
+
par Generate in Parallel
|
|
175
|
+
S->>Q72: Generate response
|
|
176
|
+
S->>Q32: Generate response
|
|
177
|
+
end
|
|
178
|
+
Q72->>S: Response A
|
|
179
|
+
Q32->>S: Response B
|
|
180
|
+
S->>J: Judge responses
|
|
181
|
+
J->>S: Best response selection
|
|
182
|
+
S->>U: Winning response
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Model Memory Layout
|
|
186
|
+
|
|
187
|
+
```mermaid
|
|
188
|
+
pie title GPU/Unified Memory Usage (M4 Max 128GB)
|
|
189
|
+
"Qwen-72B Q8" : 77
|
|
190
|
+
"Qwen-Coder 32B" : 18
|
|
191
|
+
"Hermes-3 8B Q8" : 9
|
|
192
|
+
"Qwen-Coder 7B" : 5
|
|
193
|
+
"Available" : 19
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Installation Flow
|
|
197
|
+
|
|
198
|
+
```mermaid
|
|
199
|
+
flowchart TD
|
|
200
|
+
A[Clone Repository] --> B[Run npm install]
|
|
201
|
+
B --> C[Install Python Dependencies]
|
|
202
|
+
C --> D{Download MLX Models?}
|
|
203
|
+
D -->|Yes| E[Download Models<br/>~109GB total]
|
|
204
|
+
D -->|Skip| F[Use on-demand loading]
|
|
205
|
+
E --> G[Build Menu Bar App]
|
|
206
|
+
F --> G
|
|
207
|
+
G --> H[Install to /Applications]
|
|
208
|
+
H --> I[Configure LaunchAgent]
|
|
209
|
+
I --> J[Start Server]
|
|
210
|
+
J --> K[Verify Installation]
|
|
211
|
+
K --> L[Ready to Use!]
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## API Endpoints
|
|
215
|
+
|
|
216
|
+
```mermaid
|
|
217
|
+
graph LR
|
|
218
|
+
subgraph "OpenAI-Compatible API"
|
|
219
|
+
H[/health]
|
|
220
|
+
M[/v1/models]
|
|
221
|
+
C[/v1/chat/completions]
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
subgraph "Response Format"
|
|
225
|
+
H --> |JSON| HS[status, loaded_models]
|
|
226
|
+
M --> |JSON| MS[model list]
|
|
227
|
+
C --> |JSON/SSE| CS[chat completion]
|
|
228
|
+
end
|
|
229
|
+
```
|