mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-02 22:00:19 +00:00
Agent: gap-filler-goose Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
60 lines
1.8 KiB
Bash
60 lines
1.8 KiB
Bash
#!/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/hyperstack/lib/common.sh)"
|
|
fi
|
|
|
|
log_info "Goose on Hyperstack"
|
|
echo ""
|
|
|
|
# Authenticate with Hyperstack
|
|
ensure_hyperstack_api_key
|
|
ensure_ssh_key
|
|
|
|
# Get VM configuration
|
|
VM_NAME=$(get_vm_name)
|
|
ENVIRONMENT=$(get_environment_name)
|
|
|
|
# Create VM
|
|
create_vm "$VM_NAME" "$ENVIRONMENT"
|
|
verify_server_connectivity "$HYPERSTACK_VM_IP"
|
|
|
|
log_warn "Setting up Hyperstack VM..."
|
|
|
|
# Install Goose
|
|
log_warn "Installing Goose..."
|
|
run_server "$HYPERSTACK_VM_IP" "CONFIGURE=false curl -fsSL https://github.com/block/goose/releases/latest/download/download_cli.sh | bash"
|
|
|
|
# Verify installation succeeded
|
|
if ! run_server "$HYPERSTACK_VM_IP" "command -v goose &> /dev/null && goose --version &> /dev/null"; then
|
|
log_error "Goose installation verification failed"
|
|
log_error "The 'goose' command is not available or not working properly"
|
|
exit 1
|
|
fi
|
|
log_info "Goose installation verified successfully"
|
|
|
|
# Get OpenRouter API key via OAuth
|
|
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..."
|
|
run_server "$HYPERSTACK_VM_IP" "printf '\nexport GOOSE_PROVIDER=openrouter\nexport OPENROUTER_API_KEY=%s\n' '$OPENROUTER_API_KEY' >> ~/.bashrc"
|
|
|
|
echo ""
|
|
log_info "Hyperstack VM setup completed successfully!"
|
|
echo ""
|
|
|
|
# Start Goose interactively
|
|
log_warn "Starting Goose..."
|
|
sleep 1
|
|
clear
|
|
interactive_session "$HYPERSTACK_VM_IP" "bash -c 'source ~/.bashrc && goose'"
|