mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-19 16:39:50 +00:00
* feat: convert daytona/ cloud provider from Bash to TypeScript Replaces fragile bash SSH workarounds with structured TypeScript. Converts 341-line lib/common.sh and 6 agent scripts to TS/Bun. Fixes #1679 Agent: ux-engineer Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: update test assertions for daytona TypeScript conversion Add daytona to TS_CLOUDS set and lower cloud count thresholds since daytona no longer has a bash lib/common.sh. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: address security review - path traversal, command injection, test counts - Add path traversal rejection (reject '..') in uploadConfigFile and uploadFile - Use single quotes around remotePath in shell commands to prevent expansion - Add strict remotePath validation to uploadConfigFile (allowlist regex) - Update TS_CLOUDS sets across all test files for daytona TS conversion - Adjust upload-file-security test count expectations for TS migrations Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: update test assertions for TS-converted cloud providers After converting daytona and digitalocean from Bash to TypeScript, the number of bash-based cloud libs dropped. Updated expected counts: - cloud-lib-source-chain: >= 6 to >= 5 - cloud-error-guidance create_server: >= 5 to >= 4 - upload-file-security SSH clouds: >= 4 to >= 3 - shared-common-post-session SSH clouds: >= 4 to >= 3 Agent: pr-maintainer Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
29 lines
1.1 KiB
Bash
29 lines
1.1 KiB
Bash
#!/bin/bash
|
|
set -eo pipefail
|
|
|
|
# Thin shim: ensures bun is available, runs bundled daytona TypeScript (local or from GitHub release)
|
|
|
|
_ensure_bun() {
|
|
if command -v bun &>/dev/null; then return 0; fi
|
|
printf '\033[0;36mInstalling bun...\033[0m\n' >&2
|
|
curl -fsSL https://bun.sh/install | bash >/dev/null 2>&1 || { printf '\033[0;31mFailed to install bun\033[0m\n' >&2; exit 1; }
|
|
export PATH="$HOME/.bun/bin:$PATH"
|
|
command -v bun &>/dev/null || { printf '\033[0;31mbun not found after install\033[0m\n' >&2; exit 1; }
|
|
}
|
|
|
|
_ensure_bun
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
|
|
|
# Local checkout — run from source
|
|
if [[ -n "$SCRIPT_DIR" && -f "$SCRIPT_DIR/../cli/src/daytona/main.ts" ]]; then
|
|
exec bun run "$SCRIPT_DIR/../cli/src/daytona/main.ts" codex "$@"
|
|
fi
|
|
|
|
# Remote — download bundled daytona.js from GitHub release
|
|
DAYTONA_JS=$(mktemp)
|
|
trap 'rm -f "$DAYTONA_JS"' EXIT
|
|
curl -fsSL "https://github.com/OpenRouterTeam/spawn/releases/download/daytona-latest/daytona.js" -o "$DAYTONA_JS" \
|
|
|| { printf '\033[0;31mFailed to download daytona.js\033[0m\n' >&2; exit 1; }
|
|
|
|
exec bun run "$DAYTONA_JS" codex "$@"
|