@hamp10/agentforge 0.2.15 → 0.2.17
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/bin/agentforge.js +25 -2
- package/package.json +5 -1
- package/scripts/postinstall.js +62 -0
- package/src/OllamaAgent.js +938 -252
- package/src/hampagent/browser.js +209 -73
- package/src/selfUpdate.js +7 -2
- package/src/worker.js +68 -36
- package/templates/agent/AGENTFORGE.md +120 -0
|
@@ -367,6 +367,126 @@ Take a snapshot first to see the page structure, then interact with elements usi
|
|
|
367
367
|
|
|
368
368
|
**The point:** You are not a passive assistant waiting for users to click things. You can operate the platform yourself.
|
|
369
369
|
|
|
370
|
+
## 🖥️ SETTING UP AGENTFORGE BROWSER ON A NEW MACHINE
|
|
371
|
+
|
|
372
|
+
**You can fully set up Chrome + the AgentForge browser profile on a remote machine via SSH.** If a user says "add my other Mac", "set up AgentForge on my Mac Mini", "get browser tools working on X" — do it yourself, don't give them instructions.
|
|
373
|
+
|
|
374
|
+
### Prerequisites
|
|
375
|
+
- SSH access to the target machine (test with `ssh user@hostname echo ok`)
|
|
376
|
+
- Target is a Mac (macOS)
|
|
377
|
+
|
|
378
|
+
### Full setup sequence (run from your machine via SSH)
|
|
379
|
+
|
|
380
|
+
**1. Install Homebrew if missing**
|
|
381
|
+
```bash
|
|
382
|
+
ssh user@target 'which brew || NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
|
|
383
|
+
# Apple Silicon: /opt/homebrew/bin/brew | Intel: /usr/local/bin/brew
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**2. Install Google Chrome** (must be Chrome, not Chromium — required for Keychain cookie encryption)
|
|
387
|
+
```bash
|
|
388
|
+
ssh user@target '/opt/homebrew/bin/brew install --cask google-chrome'
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**3. Create browser profile dir and LaunchAgent plist**
|
|
392
|
+
```bash
|
|
393
|
+
ssh user@target 'mkdir -p ~/.agentforge/browser/Default'
|
|
394
|
+
ssh user@target 'cat > ~/Library/LaunchAgents/ai.agentforge.browser.plist' << 'EOF'
|
|
395
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
396
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
397
|
+
<plist version="1.0">
|
|
398
|
+
<dict>
|
|
399
|
+
<key>Label</key><string>ai.agentforge.browser</string>
|
|
400
|
+
<key>ProgramArguments</key>
|
|
401
|
+
<array>
|
|
402
|
+
<string>/Applications/Google Chrome.app/Contents/MacOS/Google Chrome</string>
|
|
403
|
+
<string>--remote-debugging-address=127.0.0.1</string>
|
|
404
|
+
<string>--remote-debugging-port=9223</string>
|
|
405
|
+
<string>--user-data-dir=/Users/hamp/.agentforge/browser</string>
|
|
406
|
+
<string>--no-first-run</string>
|
|
407
|
+
<string>--no-default-browser-check</string>
|
|
408
|
+
<string>--disable-sync</string>
|
|
409
|
+
<string>--disable-component-update</string>
|
|
410
|
+
<string>--safebrowsing-disable-auto-update</string>
|
|
411
|
+
<string>--disable-gpu</string>
|
|
412
|
+
<string>--disable-dev-shm-usage</string>
|
|
413
|
+
<string>--bwsi</string>
|
|
414
|
+
<string>--password-store=basic</string>
|
|
415
|
+
<string>about:blank</string>
|
|
416
|
+
</array>
|
|
417
|
+
<key>RunAtLoad</key><false/>
|
|
418
|
+
<key>KeepAlive</key><false/>
|
|
419
|
+
<key>StandardErrorPath</key><string>/Users/hamp/.agentforge/browser.log</string>
|
|
420
|
+
</dict>
|
|
421
|
+
</plist>
|
|
422
|
+
EOF
|
|
423
|
+
launchctl load ~/Library/LaunchAgents/ai.agentforge.browser.plist'
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
**4. Create AgentForge Browser.app wrapper**
|
|
427
|
+
```bash
|
|
428
|
+
ssh user@target 'mkdir -p "/Applications/AgentForge Browser.app/Contents/MacOS"'
|
|
429
|
+
ssh user@target 'cat > "/Applications/AgentForge Browser.app/Contents/MacOS/AgentForge Browser"' << 'SCRIPT'
|
|
430
|
+
#!/bin/bash
|
|
431
|
+
CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
432
|
+
"$CHROME" --remote-debugging-address=127.0.0.1 --remote-debugging-port=9223 \
|
|
433
|
+
--user-data-dir="$HOME/.agentforge/browser" \
|
|
434
|
+
--no-first-run --no-default-browser-check --disable-sync \
|
|
435
|
+
--disable-component-update --safebrowsing-disable-auto-update \
|
|
436
|
+
--disable-gpu --disable-dev-shm-usage --bwsi --password-store=basic "$@"
|
|
437
|
+
SCRIPT
|
|
438
|
+
ssh user@target 'chmod +x "/Applications/AgentForge Browser.app/Contents/MacOS/AgentForge Browser"'
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
**5. Update openclaw.json browser config**
|
|
442
|
+
```bash
|
|
443
|
+
ssh user@target 'python3 -c "
|
|
444
|
+
import json
|
|
445
|
+
with open(\"$HOME/.openclaw/openclaw.json\") as f: cfg = json.load(f)
|
|
446
|
+
cfg[\"browser\"] = {\"cdpUrl\": \"http://127.0.0.1:9223\", \"defaultProfile\": \"agentforge\",
|
|
447
|
+
\"profiles\": {\"agentforge\": {\"cdpPort\": 9223, \"color\": \"#FF6B35\"}}}
|
|
448
|
+
with open(\"$HOME/.openclaw/openclaw.json\", \"w\") as f: json.dump(cfg, f, indent=2)
|
|
449
|
+
print(\"done\")"'
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
**6. Seed browser profile from source machine** (copies your Chrome cookies/logins)
|
|
453
|
+
```bash
|
|
454
|
+
for f in Cookies "Web Data" Preferences Bookmarks "Login Data"; do
|
|
455
|
+
safe="${f// /_}"
|
|
456
|
+
cp ~/Library/Application\ Support/Google/Chrome/Default/"$f" /tmp/chrome_seed_${safe}.db 2>/dev/null
|
|
457
|
+
scp /tmp/chrome_seed_${safe}.db user@target:~/.agentforge/browser/Default/"$f"
|
|
458
|
+
rm /tmp/chrome_seed_${safe}.db
|
|
459
|
+
done
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
**7. Start Chrome in headless mode and verify**
|
|
463
|
+
```bash
|
|
464
|
+
ssh user@target '"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
|
|
465
|
+
--remote-debugging-port=9223 --user-data-dir=$HOME/.agentforge/browser \
|
|
466
|
+
--no-first-run --no-default-browser-check --disable-sync \
|
|
467
|
+
--disable-component-update --safebrowsing-disable-auto-update --headless=new about:blank &'
|
|
468
|
+
sleep 3
|
|
469
|
+
ssh user@target 'curl -s http://127.0.0.1:9223/json | head -3'
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
**8. Restart the worker on the target**
|
|
473
|
+
```bash
|
|
474
|
+
ssh user@target 'pkill -f "agentforge start" 2>/dev/null; sleep 2; nohup /usr/local/bin/node ~/.npm-global/bin/agentforge start > /tmp/agentforge-worker.log 2>&1 &'
|
|
475
|
+
sleep 10
|
|
476
|
+
ssh user@target 'tail -10 /tmp/agentforge-worker.log'
|
|
477
|
+
# Should see: "OpenClaw Gateway started" (no "exited (code 1)") and "Connected to AgentForge"
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### ⚠️ One thing the user must do manually
|
|
481
|
+
**Google login** in the AgentForge browser on the target machine. Google session-binds cookies to the machine — they can't be seeded. Everything else works without it. Tell the user: "Open AgentForge Browser on [machine] and sign into Google once — everything else is ready."
|
|
482
|
+
|
|
483
|
+
### Verification
|
|
484
|
+
- `curl http://TARGET:9223/json` returns a tab list → Chrome is running
|
|
485
|
+
- Worker log shows no `openclaw-gateway exited (code 1)` → gateway healthy
|
|
486
|
+
- Worker log shows `✅ Connected to AgentForge` → worker online
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
370
490
|
## ⚠️ TAB MANAGEMENT — UNDERSTAND THE MECHANISM
|
|
371
491
|
|
|
372
492
|
**How `openclaw browser navigate` works:** It loads the URL into whichever tab is currently focused. On this platform, the focused tab is the user's live AgentForge dashboard — the chat window they are watching right now. Calling `navigate` with an external URL replaces that dashboard with the external site. The user's chat disappears. They can no longer see what you're doing or send you messages.
|