mageagent-local 2.0.1 → 2.0.2
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/README.md +2 -2
- package/bin/mageagent.js +129 -1
- package/package.json +1 -1
- package/scripts/build-dmg.sh +42 -7
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
### Download & Install
|
|
18
18
|
|
|
19
19
|
[](https://github.com/adverant/nexus-local-mageagent/releases/latest/download/MageAgent-2.0.0.dmg)
|
|
20
|
-
[](https://www.npmjs.com/package/mageagent-local)
|
|
21
21
|
[](https://github.com/adverant/nexus-local-mageagent)
|
|
22
22
|
|
|
23
23
|
---
|
|
@@ -90,7 +90,7 @@ That's it. The installer:
|
|
|
90
90
|
|
|
91
91
|
**Or with npm:**
|
|
92
92
|
```bash
|
|
93
|
-
npm install -g
|
|
93
|
+
npm install -g mageagent-local && mageagent setup
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
---
|
package/bin/mageagent.js
CHANGED
|
@@ -157,6 +157,7 @@ ${COLORS.yellow}Usage:${COLORS.reset}
|
|
|
157
157
|
mageagent <command>
|
|
158
158
|
|
|
159
159
|
${COLORS.yellow}Commands:${COLORS.reset}
|
|
160
|
+
setup Complete setup (install + start + launch menu bar)
|
|
160
161
|
install Install MageAgent server and dependencies
|
|
161
162
|
start Start the MageAgent server
|
|
162
163
|
stop Stop the MageAgent server
|
|
@@ -167,8 +168,11 @@ ${COLORS.yellow}Commands:${COLORS.reset}
|
|
|
167
168
|
test Test the API endpoint
|
|
168
169
|
help Show this help message
|
|
169
170
|
|
|
171
|
+
${COLORS.yellow}Quick Start:${COLORS.reset}
|
|
172
|
+
npm install -g mageagent-local && mageagent setup
|
|
173
|
+
|
|
170
174
|
${COLORS.yellow}Examples:${COLORS.reset}
|
|
171
|
-
mageagent
|
|
175
|
+
mageagent setup # Complete first-time setup (recommended)
|
|
172
176
|
mageagent start # Start server on port 3457
|
|
173
177
|
mageagent status # Check if running
|
|
174
178
|
|
|
@@ -195,10 +199,133 @@ function testApi() {
|
|
|
195
199
|
}
|
|
196
200
|
}
|
|
197
201
|
|
|
202
|
+
function installLaunchAgents() {
|
|
203
|
+
const launchAgentsDir = join(homedir(), 'Library', 'LaunchAgents');
|
|
204
|
+
|
|
205
|
+
// Server LaunchAgent
|
|
206
|
+
const serverPlist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
207
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
208
|
+
<plist version="1.0">
|
|
209
|
+
<dict>
|
|
210
|
+
<key>Label</key>
|
|
211
|
+
<string>ai.adverant.mageagent</string>
|
|
212
|
+
<key>ProgramArguments</key>
|
|
213
|
+
<array>
|
|
214
|
+
<string>${SERVER_SCRIPT}</string>
|
|
215
|
+
<string>start</string>
|
|
216
|
+
</array>
|
|
217
|
+
<key>RunAtLoad</key>
|
|
218
|
+
<true/>
|
|
219
|
+
<key>KeepAlive</key>
|
|
220
|
+
<false/>
|
|
221
|
+
<key>StandardOutPath</key>
|
|
222
|
+
<string>${DEBUG_DIR}/mageagent-launchd.log</string>
|
|
223
|
+
<key>StandardErrorPath</key>
|
|
224
|
+
<string>${DEBUG_DIR}/mageagent-launchd.error.log</string>
|
|
225
|
+
<key>EnvironmentVariables</key>
|
|
226
|
+
<dict>
|
|
227
|
+
<key>PATH</key>
|
|
228
|
+
<string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
|
|
229
|
+
<key>HOME</key>
|
|
230
|
+
<string>${homedir()}</string>
|
|
231
|
+
</dict>
|
|
232
|
+
</dict>
|
|
233
|
+
</plist>`;
|
|
234
|
+
|
|
235
|
+
// Menu Bar LaunchAgent
|
|
236
|
+
const menubarPlist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
237
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
238
|
+
<plist version="1.0">
|
|
239
|
+
<dict>
|
|
240
|
+
<key>Label</key>
|
|
241
|
+
<string>ai.adverant.mageagent.menubar</string>
|
|
242
|
+
<key>ProgramArguments</key>
|
|
243
|
+
<array>
|
|
244
|
+
<string>/Applications/MageAgentMenuBar.app/Contents/MacOS/MageAgentMenuBar</string>
|
|
245
|
+
</array>
|
|
246
|
+
<key>RunAtLoad</key>
|
|
247
|
+
<true/>
|
|
248
|
+
<key>KeepAlive</key>
|
|
249
|
+
<false/>
|
|
250
|
+
<key>StandardOutPath</key>
|
|
251
|
+
<string>${DEBUG_DIR}/mageagent-menubar.log</string>
|
|
252
|
+
<key>StandardErrorPath</key>
|
|
253
|
+
<string>${DEBUG_DIR}/mageagent-menubar.error.log</string>
|
|
254
|
+
</dict>
|
|
255
|
+
</plist>`;
|
|
256
|
+
|
|
257
|
+
// Write plists
|
|
258
|
+
const serverPlistPath = join(launchAgentsDir, 'ai.adverant.mageagent.plist');
|
|
259
|
+
const menubarPlistPath = join(launchAgentsDir, 'ai.adverant.mageagent.menubar.plist');
|
|
260
|
+
|
|
261
|
+
require('fs').writeFileSync(serverPlistPath, serverPlist);
|
|
262
|
+
log('Installed server LaunchAgent (auto-start on boot)', 'green');
|
|
263
|
+
|
|
264
|
+
if (existsSync('/Applications/MageAgentMenuBar.app')) {
|
|
265
|
+
require('fs').writeFileSync(menubarPlistPath, menubarPlist);
|
|
266
|
+
log('Installed menu bar LaunchAgent (auto-start on boot)', 'green');
|
|
267
|
+
|
|
268
|
+
// Load LaunchAgents
|
|
269
|
+
try {
|
|
270
|
+
execSync(`launchctl unload "${serverPlistPath}" 2>/dev/null || true`, { stdio: 'ignore' });
|
|
271
|
+
execSync(`launchctl load "${serverPlistPath}"`, { stdio: 'ignore' });
|
|
272
|
+
execSync(`launchctl unload "${menubarPlistPath}" 2>/dev/null || true`, { stdio: 'ignore' });
|
|
273
|
+
execSync(`launchctl load "${menubarPlistPath}"`, { stdio: 'ignore' });
|
|
274
|
+
} catch (e) {
|
|
275
|
+
// Ignore errors
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function launchMenuBar() {
|
|
281
|
+
if (existsSync('/Applications/MageAgentMenuBar.app')) {
|
|
282
|
+
try {
|
|
283
|
+
execSync('open /Applications/MageAgentMenuBar.app', { stdio: 'ignore' });
|
|
284
|
+
log('Menu bar app launched', 'green');
|
|
285
|
+
} catch (e) {
|
|
286
|
+
log('Could not launch menu bar app', 'yellow');
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function fullSetup() {
|
|
292
|
+
log('\n=== MageAgent Complete Setup ===\n', 'cyan');
|
|
293
|
+
checkAppleSilicon();
|
|
294
|
+
if (!checkPython()) process.exit(1);
|
|
295
|
+
ensureDirectories();
|
|
296
|
+
copyServerFiles();
|
|
297
|
+
installPythonDeps();
|
|
298
|
+
installLaunchAgents();
|
|
299
|
+
|
|
300
|
+
// Start server
|
|
301
|
+
log('\nStarting MageAgent server...', 'cyan');
|
|
302
|
+
try {
|
|
303
|
+
execSync(`${SERVER_SCRIPT} start`, { stdio: 'inherit' });
|
|
304
|
+
} catch (e) {
|
|
305
|
+
// Ignore - might already be running
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Wait for server
|
|
309
|
+
setTimeout(() => {
|
|
310
|
+
// Launch menu bar app
|
|
311
|
+
launchMenuBar();
|
|
312
|
+
|
|
313
|
+
log('\n=== Setup Complete! ===\n', 'green');
|
|
314
|
+
log('MageAgent server: http://localhost:3457', 'blue');
|
|
315
|
+
log('Menu bar icon should appear in your menu bar.', 'blue');
|
|
316
|
+
log('Both server and menu bar will auto-start on boot.\n', 'blue');
|
|
317
|
+
log('Next: Download models (~110GB) via menu: Load Models > Load All', 'yellow');
|
|
318
|
+
}, 2000);
|
|
319
|
+
}
|
|
320
|
+
|
|
198
321
|
// Main CLI
|
|
199
322
|
const command = process.argv[2] || 'help';
|
|
200
323
|
|
|
201
324
|
switch (command) {
|
|
325
|
+
case 'setup':
|
|
326
|
+
fullSetup();
|
|
327
|
+
break;
|
|
328
|
+
|
|
202
329
|
case 'install':
|
|
203
330
|
log('\n=== MageAgent Installation ===\n', 'cyan');
|
|
204
331
|
checkAppleSilicon();
|
|
@@ -206,6 +333,7 @@ switch (command) {
|
|
|
206
333
|
ensureDirectories();
|
|
207
334
|
copyServerFiles();
|
|
208
335
|
installPythonDeps();
|
|
336
|
+
installLaunchAgents();
|
|
209
337
|
log('\nInstallation complete!', 'green');
|
|
210
338
|
log('\nNext steps:', 'yellow');
|
|
211
339
|
log(' 1. Download models: mageagent models', 'reset');
|
package/package.json
CHANGED
package/scripts/build-dmg.sh
CHANGED
|
@@ -82,8 +82,8 @@ chmod +x ~/.claude/scripts/mageagent-server.sh
|
|
|
82
82
|
echo "Installing Python dependencies..."
|
|
83
83
|
pip3 install --quiet mlx mlx-lm fastapi uvicorn pydantic huggingface_hub 2>/dev/null
|
|
84
84
|
|
|
85
|
-
# Create LaunchAgent for server
|
|
86
|
-
echo "Setting up auto-start..."
|
|
85
|
+
# Create LaunchAgent for server (auto-start on boot)
|
|
86
|
+
echo "Setting up server auto-start..."
|
|
87
87
|
cat > ~/Library/LaunchAgents/ai.adverant.mageagent.plist << 'PLIST'
|
|
88
88
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
89
89
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
@@ -111,6 +111,33 @@ PLIST
|
|
|
111
111
|
|
|
112
112
|
launchctl load ~/Library/LaunchAgents/ai.adverant.mageagent.plist 2>/dev/null || true
|
|
113
113
|
|
|
114
|
+
# Create LaunchAgent for MenuBar app (auto-start on boot)
|
|
115
|
+
echo "Setting up menu bar app auto-start..."
|
|
116
|
+
cat > ~/Library/LaunchAgents/ai.adverant.mageagent.menubar.plist << 'PLIST'
|
|
117
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
118
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
119
|
+
<plist version="1.0">
|
|
120
|
+
<dict>
|
|
121
|
+
<key>Label</key>
|
|
122
|
+
<string>ai.adverant.mageagent.menubar</string>
|
|
123
|
+
<key>ProgramArguments</key>
|
|
124
|
+
<array>
|
|
125
|
+
<string>/Applications/MageAgentMenuBar.app/Contents/MacOS/MageAgentMenuBar</string>
|
|
126
|
+
</array>
|
|
127
|
+
<key>RunAtLoad</key>
|
|
128
|
+
<true/>
|
|
129
|
+
<key>KeepAlive</key>
|
|
130
|
+
<false/>
|
|
131
|
+
<key>StandardOutPath</key>
|
|
132
|
+
<string>~/.claude/debug/mageagent-menubar.log</string>
|
|
133
|
+
<key>StandardErrorPath</key>
|
|
134
|
+
<string>~/.claude/debug/mageagent-menubar.error.log</string>
|
|
135
|
+
</dict>
|
|
136
|
+
</plist>
|
|
137
|
+
PLIST
|
|
138
|
+
|
|
139
|
+
launchctl load ~/Library/LaunchAgents/ai.adverant.mageagent.menubar.plist 2>/dev/null || true
|
|
140
|
+
|
|
114
141
|
# Start the server
|
|
115
142
|
echo "Starting MageAgent server..."
|
|
116
143
|
~/.claude/scripts/mageagent-server.sh start
|
|
@@ -118,6 +145,10 @@ echo "Starting MageAgent server..."
|
|
|
118
145
|
# Wait for server
|
|
119
146
|
sleep 3
|
|
120
147
|
|
|
148
|
+
# Launch the MenuBar app now
|
|
149
|
+
echo "Launching MageAgent menu bar app..."
|
|
150
|
+
open /Applications/MageAgentMenuBar.app
|
|
151
|
+
|
|
121
152
|
# Test
|
|
122
153
|
if curl -s http://localhost:3457/health > /dev/null 2>&1; then
|
|
123
154
|
echo ""
|
|
@@ -126,11 +157,13 @@ if curl -s http://localhost:3457/health > /dev/null 2>&1; then
|
|
|
126
157
|
echo "=========================================="
|
|
127
158
|
echo ""
|
|
128
159
|
echo "MageAgent is running at: http://localhost:3457"
|
|
160
|
+
echo "Menu bar icon is now visible in your menu bar."
|
|
161
|
+
echo ""
|
|
162
|
+
echo "Both server and menu bar app will auto-start on boot."
|
|
129
163
|
echo ""
|
|
130
164
|
echo "Next steps:"
|
|
131
|
-
echo " 1.
|
|
132
|
-
echo " 2.
|
|
133
|
-
echo " 3. Download models (~110GB) via menu: Load Models > Load All"
|
|
165
|
+
echo " 1. Click the MageAgent menu bar icon"
|
|
166
|
+
echo " 2. Download models (~110GB) via menu: Load Models > Load All"
|
|
134
167
|
echo ""
|
|
135
168
|
echo "Documentation: https://github.com/adverant/nexus-local-mageagent"
|
|
136
169
|
else
|
|
@@ -154,7 +187,8 @@ MageAgent - Multi-Model AI Orchestration for Apple Silicon
|
|
|
154
187
|
Installation Steps:
|
|
155
188
|
1. Drag MageAgentMenuBar.app to your Applications folder
|
|
156
189
|
2. Double-click "Install MageAgent.command" to complete setup
|
|
157
|
-
|
|
190
|
+
- The menu bar icon will appear automatically
|
|
191
|
+
- Both server and menu bar app will auto-start on boot
|
|
158
192
|
|
|
159
193
|
Requirements:
|
|
160
194
|
- macOS 13.0 (Ventura) or later
|
|
@@ -165,8 +199,9 @@ Requirements:
|
|
|
165
199
|
The installer will:
|
|
166
200
|
- Download server components from GitHub
|
|
167
201
|
- Install Python dependencies (MLX, FastAPI)
|
|
168
|
-
- Configure auto-start on login
|
|
202
|
+
- Configure auto-start on login (both server and menu bar app)
|
|
169
203
|
- Start the MageAgent server
|
|
204
|
+
- Launch the menu bar app immediately
|
|
170
205
|
|
|
171
206
|
Models (~110GB total) are downloaded on-demand via the menu bar app.
|
|
172
207
|
|