mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-09 11:10:10 +00:00
Thread agent and cloud slugs through to the OpenRouter OAuth URL so OpenRouter knows which agent/cloud combination the user is deploying. Co-authored-by: lab <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
831 B
Bash
Executable file
28 lines
831 B
Bash
Executable file
#!/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 [[ -f "${SCRIPT_DIR}/lib/common.sh" ]]; then
|
|
source "${SCRIPT_DIR}/lib/common.sh"
|
|
else
|
|
eval "$(curl -fsSL https://raw.githubusercontent.com/OpenRouterTeam/spawn/main/sprite/lib/common.sh)"
|
|
fi
|
|
|
|
log_info "OpenCode on Sprite"
|
|
echo ""
|
|
|
|
agent_install() {
|
|
install_agent "OpenCode" "$(opencode_install_cmd)" cloud_run
|
|
}
|
|
|
|
agent_env_vars() {
|
|
generate_env_config \
|
|
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
|
}
|
|
|
|
agent_launch_cmd() {
|
|
echo 'source ~/.spawnrc 2>/dev/null; export PATH=$HOME/.opencode/bin:$(npm prefix -g 2>/dev/null)/bin:$HOME/.bun/bin:/.sprite/languages/bun/bin:$PATH; opencode'
|
|
}
|
|
|
|
spawn_agent "OpenCode" "opencode" "sprite"
|