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.
202 lines
6.2 KiB
Bash
Executable File
202 lines
6.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# GyanDoot v2.0 — Cross-platform installer
|
|
# 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() {
|
|
local arch
|
|
arch="$(uname -m)"
|
|
case "$arch" in
|
|
x86_64|amd64) echo "x86_64" ;;
|
|
aarch64|arm64) echo "aarch64" ;;
|
|
*) err "Unsupported architecture: $arch" ;;
|
|
esac
|
|
}
|
|
|
|
detect_os() {
|
|
local os
|
|
os="$(uname -s)"
|
|
case "$os" in
|
|
Linux) echo "linux" ;;
|
|
Darwin) echo "darwin" ;;
|
|
CYGWIN*|MINGW*|MSYS*) echo "windows" ;;
|
|
*) err "Unsupported OS: $os" ;;
|
|
esac
|
|
}
|
|
|
|
install_rust_if_needed() {
|
|
if ! command -v cargo &>/dev/null; then
|
|
info "Rust toolchain not found. Installing..."
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
source "$HOME/.cargo/env"
|
|
ok "Rust installed"
|
|
else
|
|
ok "Rust already installed ($(cargo --version))"
|
|
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 ($(du -sh target/release/gyandoot | cut -f1))"
|
|
}
|
|
|
|
install_binary() {
|
|
local root_dir
|
|
root_dir="$(cd "$(dirname "$0")" && pwd)"
|
|
local target_dir="$root_dir/target/release"
|
|
local bin_name="gyandoot"
|
|
|
|
if [ ! -f "$target_dir/$bin_name" ]; then
|
|
err "Binary not found at $target_dir/$bin_name"
|
|
fi
|
|
|
|
local install_dir="/usr/local/bin"
|
|
if [ ! -w "$install_dir" ]; then
|
|
info "Need sudo to install to $install_dir"
|
|
sudo cp "$target_dir/$bin_name" "$install_dir/$bin_name"
|
|
sudo chmod +x "$install_dir/$bin_name"
|
|
else
|
|
cp "$target_dir/$bin_name" "$install_dir/$bin_name"
|
|
chmod +x "$install_dir/$bin_name"
|
|
fi
|
|
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)
|
|
arch=$(detect_architecture)
|
|
info "Detected: $os / $arch"
|
|
|
|
install_rust_if_needed
|
|
install_node_if_needed
|
|
install_camofox_browser
|
|
|
|
build_release
|
|
install_binary
|
|
|
|
# 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 "$@" |