mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
457 sites carried an upstream prefix into every surface a user reaches — shell exports, docs, CI, the SDK. CODEX_ is not our name and it was never going to stop arriving on its own: it is what upstream writes, and every sync brings more. Two namespaces, because they answer different questions. DEV_* the app's own configuration — DEV_HOME, DEV_PROFILE, the rest HANZO_API_KEY a credential for the Hanzo stack, which is not app config CODEX_API_KEY held the literal string "CODEX_API_KEY", so the rename moves the value and not just the constant. It becomes HANZO_API_KEY, which is what create_hanzo_provider already reads through HANZO_MACHINE_ENV_KEYS — one name for one credential instead of two spellings of it. vendor/ is untouched, which is the point of vendor/: upstream code keeps upstream names, and the boundary is a path rather than a habit.
62 lines
1.7 KiB
Bash
Executable File
62 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cargo_root="$repo_root/codex-rs"
|
|
listen_url="${DEV_EXEC_SERVER_LISTEN_URL:-ws://127.0.0.1:0}"
|
|
start_timeout_seconds="${DEV_EXEC_SERVER_START_TIMEOUT_SECONDS:-120}"
|
|
tmp_dir="$(mktemp -d "${TMPDIR:-/tmp}/codex-tui-with-exec-server.XXXXXX")"
|
|
stdout_log="$tmp_dir/exec-server.stdout"
|
|
stderr_log="$tmp_dir/exec-server.stderr"
|
|
server_pid=""
|
|
exec_server_url=""
|
|
|
|
cleanup() {
|
|
if [[ -n "$server_pid" ]]; then
|
|
kill "$server_pid" >/dev/null 2>&1 || true
|
|
wait "$server_pid" >/dev/null 2>&1 || true
|
|
fi
|
|
rm -rf "$tmp_dir"
|
|
}
|
|
|
|
trap cleanup EXIT INT TERM HUP
|
|
|
|
(
|
|
cd "$cargo_root"
|
|
cargo run -p codex-cli --bin codex -- exec-server --listen "$listen_url"
|
|
) >"$stdout_log" 2>"$stderr_log" &
|
|
server_pid="$!"
|
|
|
|
# Wait for the server to print its bound websocket URL before launching the TUI.
|
|
for _ in $(seq 1 "$((start_timeout_seconds * 20))"); do
|
|
if [[ -s "$stdout_log" ]]; then
|
|
exec_server_url="$(head -n 1 "$stdout_log" | tr -d '\r')"
|
|
if [[ "$exec_server_url" == ws://* ]]; then
|
|
break
|
|
fi
|
|
fi
|
|
|
|
if ! kill -0 "$server_pid" >/dev/null 2>&1; then
|
|
cat "$stderr_log" >&2 || true
|
|
cat "$stdout_log" >&2 || true
|
|
echo "failed to start codex exec-server" >&2
|
|
exit 1
|
|
fi
|
|
|
|
sleep 0.05
|
|
done
|
|
|
|
if [[ -z "$exec_server_url" ]]; then
|
|
cat "$stderr_log" >&2 || true
|
|
cat "$stdout_log" >&2 || true
|
|
echo "timed out waiting ${start_timeout_seconds}s for codex exec-server to report its websocket URL" >&2
|
|
exit 1
|
|
fi
|
|
|
|
export DEV_EXEC_SERVER_URL="$exec_server_url"
|
|
echo "Starting codex-tui with DEV_EXEC_SERVER_URL=$DEV_EXEC_SERVER_URL" >&2
|
|
|
|
cd "$cargo_root"
|
|
cargo run -p codex-tui --bin codex-tui -- -c mcp_oauth_credentials_store=file "$@"
|