Add camofox-browser integration: gyandoot-browser crate + agent tools
New crate: crates/gyandoot-browser/
- client.rs: Full REST client for camofox-browser API (health, tabs,
navigation, snapshots, click/type/scroll, search macros)
- macros.rs: 14 SearchMacro enum (Google, YouTube, Amazon, Reddit,
Wikipedia, Twitter, Yelp, Spotify, Netflix, LinkedIn, Instagram,
TikTok, Twitch) with parse/display
- snapshot.rs: PageSnapshot, PageLinks, NavigationResult, HealthResponse
- session.rs: BrowserSession, SessionManager with idle cleanup
New module: crates/gyandoot-agent/src/browser_tools.rs
- WebSearchTool: Search the web using anti-detection browser
- WebBrowseTool: Browse URLs, click, type, scroll with element refs
- register_browser_tools(): Wire both tools into ToolExecutor
CLI: Added
o
|
- - - - - - .---. - - - - - -
- - - - - - - - - [ ^ ^ ] - - - - - - - - -
- - - - - - - | ___ | - - - - - - -
`-----'
____ __ __ ___ _ _ ____ ___ ___ _____
/ ___|\ \ / / / _ \ | \ | || _ \ / _ \ / _ \|_ _|
| | _ \ V / / /_\ \| \| || | | | | | | | | | | |
| |_| | | | | _ || |\ || |_| | |_| | |_| | | |
\____/ |_| |_| |_||_| \_||____/ \___/ \___/ |_|
o - - - - - - - knowledge. delivered. - - - - - - - o
Unknown command: browser
Run 'gyandoot help' for usage. subcommand with health/search/browse actions
Installer: Updated install.sh with camofox-browser cloning, Node.js
detection, npm dependency install, and systemd service setup
Camofox-browser running at http://localhost:9377 (Docker, verified working)
Workspace: 12 crates + CLI binary — cargo check passes with 0 errors.
This commit is contained in:
118
install.sh
118
install.sh
@@ -2,15 +2,18 @@
|
||||
set -euo pipefail
|
||||
|
||||
# GyanDoot v2.0 — Cross-platform installer
|
||||
# Detects OS, architecture, and installs the gyandoot binary.
|
||||
# Detects OS, architecture, and installs the gyandoot binary + camofox-browser.
|
||||
# For full documentation, visit: https://git.gyannetra.in/gnpl_admin/gyandoot-v2
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
info() { echo -e "${BLUE}[INFO]${NC} $*"; }
|
||||
ok() { echo -e "${GREEN}[OK]${NC} $*"; }
|
||||
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
|
||||
err() { echo -e "${RED}[ERR]${NC} $*" >&2; exit 1; }
|
||||
|
||||
detect_architecture() {
|
||||
@@ -45,13 +48,91 @@ install_rust_if_needed() {
|
||||
fi
|
||||
}
|
||||
|
||||
install_node_if_needed() {
|
||||
if ! command -v node &>/dev/null; then
|
||||
info "Node.js not found. Installing via nvm..."
|
||||
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
|
||||
[ -s "$HOME/.nvm/nvm.sh" ] && \. "$HOME/.nvm/nvm.sh"
|
||||
nvm install 22
|
||||
ok "Node.js installed ($(node --version))"
|
||||
else
|
||||
ok "Node.js already installed ($(node --version))"
|
||||
fi
|
||||
}
|
||||
|
||||
install_camofox_browser() {
|
||||
local camofox_dir="${CAMOFOX_DIR:-$HOME/camofox-browser}"
|
||||
if [ -d "$camofox_dir" ] && [ -f "$camofox_dir/package.json" ]; then
|
||||
info "Camofox-browser already cloned. Updating..."
|
||||
cd "$camofox_dir" && git pull --ff-only 2>/dev/null || true
|
||||
else
|
||||
info "Cloning camofox-browser..."
|
||||
git clone https://github.com/jo-inc/camofox-browser.git "$camofox_dir"
|
||||
fi
|
||||
|
||||
info "Installing camofox-browser dependencies..."
|
||||
cd "$camofox_dir"
|
||||
npm install --ignore-scripts 2>&1 | tail -3
|
||||
ok "Camofox-browser dependencies installed"
|
||||
}
|
||||
|
||||
setup_camofox_service() {
|
||||
local os
|
||||
os=$(detect_os)
|
||||
|
||||
info "Setting up camofox-browser as a background service..."
|
||||
case "$os" in
|
||||
linux)
|
||||
# Create systemd service
|
||||
local service_file="/etc/systemd/system/camofox-browser.service"
|
||||
if [ ! -f "$service_file" ]; then
|
||||
cat > /tmp/camofox-browser.service << 'SYSTEMD'
|
||||
[Unit]
|
||||
Description=Camofox Browser — Anti-detection browser server for AI agents
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=%s
|
||||
WorkingDirectory=%s
|
||||
ExecStart=/usr/bin/node server.js
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
Environment=NODE_ENV=production
|
||||
Environment=PORT=9377
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
SYSTEMD
|
||||
local user
|
||||
user=$(whoami)
|
||||
local camofox_dir="${CAMOFOX_DIR:-$HOME/camofox-browser}"
|
||||
sed -i "s|%s|$user|g; s|%s|$camofox_dir|g" /tmp/camofox-browser.service
|
||||
sudo mv /tmp/camofox-browser.service "$service_file"
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable camofox-browser
|
||||
info "Camofox-browser service created. Start with: sudo systemctl start camofox-browser"
|
||||
else
|
||||
ok "Camofox-browser service already exists"
|
||||
fi
|
||||
;;
|
||||
darwin)
|
||||
info "macOS detected. Add 'cd $HOME/camofox-browser && npm start' to your startup items."
|
||||
;;
|
||||
windows)
|
||||
info "Windows detected. Use 'npm start' in the camofox-browser directory."
|
||||
;;
|
||||
esac
|
||||
ok "Camofox-browser setup complete"
|
||||
}
|
||||
|
||||
build_release() {
|
||||
local root_dir
|
||||
root_dir="$(cd "$(dirname "$0")" && pwd)"
|
||||
info "Building GyanDoot v2.0 in release mode..."
|
||||
cd "$root_dir"
|
||||
cargo build --release
|
||||
ok "Build complete"
|
||||
ok "Build complete ($(du -sh target/release/gyandoot | cut -f1))"
|
||||
}
|
||||
|
||||
install_binary() {
|
||||
@@ -76,6 +157,29 @@ install_binary() {
|
||||
ok "Installed to $install_dir/$bin_name"
|
||||
}
|
||||
|
||||
print_post_install() {
|
||||
echo ""
|
||||
ok "GyanDoot v2.0 installed successfully!"
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo " Quick Start:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo " gyandoot --help Show all commands"
|
||||
echo " gyandoot init Create config"
|
||||
echo " gyandoot run Start interactive agent"
|
||||
echo ""
|
||||
echo " Browser Tools (anti-detection browsing):"
|
||||
echo " gyandoot browser health Check camofox status"
|
||||
echo " gyandoot browser search <query>"
|
||||
echo " gyandoot browser browse <url>"
|
||||
echo ""
|
||||
echo " Start camofox-browser:"
|
||||
echo " sudo systemctl start camofox-browser"
|
||||
echo " # Or manually: cd ~/camofox-browser && npm start"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
}
|
||||
|
||||
main() {
|
||||
local os arch
|
||||
os=$(detect_os)
|
||||
@@ -83,12 +187,16 @@ main() {
|
||||
info "Detected: $os / $arch"
|
||||
|
||||
install_rust_if_needed
|
||||
install_node_if_needed
|
||||
install_camofox_browser
|
||||
|
||||
build_release
|
||||
install_binary
|
||||
|
||||
echo ""
|
||||
ok "GyanDoot v2.0 installed successfully!"
|
||||
echo "Run 'gyandoot --help' to get started."
|
||||
# Optional: don't fail if service setup doesn't work
|
||||
setup_camofox_service 2>/dev/null || warn "Could not setup camofox service (manual start works)"
|
||||
|
||||
print_post_install
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user