mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-06 08:10:48 +00:00
feat: Add NanoClaw support for Northflank (#212)
Agent: gap-filler-1 Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
44d6e6304d
commit
9f7c14c19c
2 changed files with 75 additions and 1 deletions
|
|
@ -974,7 +974,7 @@
|
|||
"koyeb/kilocode": "implemented",
|
||||
"northflank/claude": "implemented",
|
||||
"northflank/openclaw": "implemented",
|
||||
"northflank/nanoclaw": "missing",
|
||||
"northflank/nanoclaw": "implemented",
|
||||
"northflank/aider": "implemented",
|
||||
"northflank/goose": "missing",
|
||||
"northflank/codex": "implemented",
|
||||
|
|
|
|||
74
northflank/nanoclaw.sh
Normal file
74
northflank/nanoclaw.sh
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
# Source common functions - try local file first, fall back to remote
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
||||
if [[ -n "${SCRIPT_DIR}" && -f "${SCRIPT_DIR}/lib/common.sh" ]]; then
|
||||
source "${SCRIPT_DIR}/lib/common.sh"
|
||||
else
|
||||
eval "$(curl -fsSL https://raw.githubusercontent.com/OpenRouterTeam/spawn/main/northflank/lib/common.sh)"
|
||||
fi
|
||||
|
||||
log_info "Spawn a NanoClaw agent on Northflank"
|
||||
echo ""
|
||||
|
||||
# Ensure Northflank CLI is installed
|
||||
ensure_northflank_cli
|
||||
|
||||
# Authenticate with Northflank
|
||||
ensure_northflank_token
|
||||
|
||||
# Get project and service names
|
||||
PROJECT_NAME=$(get_project_name)
|
||||
SERVER_NAME=$(get_server_name)
|
||||
|
||||
# Create server/service
|
||||
create_server "${SERVER_NAME}"
|
||||
|
||||
# Wait for container to be ready and install base tools
|
||||
wait_for_cloud_init
|
||||
|
||||
log_warn "Installing Node.js dependencies..."
|
||||
run_server "export PATH=\"\$HOME/.bun/bin:\$PATH\" && bun install -g tsx" >/dev/null 2>&1 || true
|
||||
|
||||
# Clone nanoclaw
|
||||
log_warn "Cloning nanoclaw..."
|
||||
run_server "git clone https://github.com/gavrielc/nanoclaw.git ~/nanoclaw && cd ~/nanoclaw && npm install && npm run build"
|
||||
|
||||
# Get OpenRouter API key
|
||||
echo ""
|
||||
if [[ -n "${OPENROUTER_API_KEY:-}" ]]; then
|
||||
log_info "Using OpenRouter API key from environment"
|
||||
else
|
||||
OPENROUTER_API_KEY=$(get_openrouter_api_key_oauth 5180)
|
||||
fi
|
||||
|
||||
log_warn "Setting up environment variables..."
|
||||
inject_env_vars_northflank \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}" \
|
||||
"ANTHROPIC_API_KEY=${OPENROUTER_API_KEY}" \
|
||||
"ANTHROPIC_BASE_URL=https://openrouter.ai/api"
|
||||
|
||||
# Create nanoclaw .env file
|
||||
log_warn "Configuring nanoclaw..."
|
||||
|
||||
DOTENV_TEMP=$(mktemp)
|
||||
chmod 600 "${DOTENV_TEMP}"
|
||||
track_temp_file "${DOTENV_TEMP}"
|
||||
|
||||
cat > "${DOTENV_TEMP}" << EOF
|
||||
ANTHROPIC_API_KEY=${OPENROUTER_API_KEY}
|
||||
EOF
|
||||
|
||||
upload_file "${DOTENV_TEMP}" "/tmp/nanoclaw_env"
|
||||
run_server "mv /tmp/nanoclaw_env ~/nanoclaw/.env"
|
||||
|
||||
echo ""
|
||||
log_info "Northflank setup completed successfully!"
|
||||
echo ""
|
||||
|
||||
# Start nanoclaw
|
||||
log_warn "Starting nanoclaw..."
|
||||
log_warn "You will need to scan a WhatsApp QR code to authenticate."
|
||||
echo ""
|
||||
interactive_session "cd ~/nanoclaw && source ~/.bashrc && npm run dev"
|
||||
Loading…
Add table
Add a link
Reference in a new issue