67220a14ea
Prevent phase2/phase3/all reruns from burning DashScope tokens unless GOOSE_V149_ALLOW_REAL_LLM=1 is explicitly set with human approval. Co-authored-by: Cursor <cursoragent@cursor.com>
86 lines
3.6 KiB
Bash
Executable File
86 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run upstream Goose v1.49 candidate on isolated local port (default 18049).
|
|
# Does not touch 103 production ports 18006-18014 or Portal 8081.
|
|
set -euo pipefail
|
|
|
|
if [[ "${GOOSE_V149_ALLOW_REAL_LLM:-}" != "1" ]]; then
|
|
echo "[goose-v149] REAL_LLM_BLOCKED: run-goosed-v149-local.sh disabled by default (see docs/goose-v149-real-llm-gate.md)" >&2
|
|
echo "[goose-v149] To start once with explicit approval: GOOSE_V149_ALLOW_REAL_LLM=1 bash scripts/run-goosed-v149-local.sh" >&2
|
|
exit 2
|
|
fi
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
GOOSED_ROOT="${GOOSED_V149_ROOT:-/Users/john/Project/tkmind_go-v149}"
|
|
PORT="${GOOSE_V149_PORT:-18049}"
|
|
RUNTIME_ROOT="${GOOSE_V149_RUNTIME_ROOT:-/tmp/goose-v149-runtime}"
|
|
GOOSE_BIN_NAME="${GOOSE_V149_BIN:-goose}"
|
|
|
|
for blocked in 18006 18007 18008 18009 18010 18011 18012 18013 18014 8081; do
|
|
if [[ "${PORT}" == "${blocked}" ]]; then
|
|
echo "[goose-v149] refusing stable/production port ${PORT}" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if [[ ! -d "${GOOSED_ROOT}" ]]; then
|
|
echo "[goose-v149] worktree missing: ${GOOSED_ROOT}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
bash "${ROOT}/scripts/ensure-goose-v149-vendor.sh" 2>/dev/null || true
|
|
bash "${ROOT}/scripts/ensure-goose-v149-local-db.sh"
|
|
|
|
PG_USER="${GOOSE_V149_PG_USER:-${USER:-john}}"
|
|
PG_HOST="${GOOSE_V149_PG_HOST:-127.0.0.1}"
|
|
PG_PORT="${GOOSE_V149_PG_PORT:-5432}"
|
|
DB_NAME="${GOOSE_V149_SESSION_DB:-goose_sessions_v149_dev}"
|
|
|
|
mkdir -p "${RUNTIME_ROOT}/"{config,data,state,cache}
|
|
|
|
if [[ -x "${GOOSED_ROOT}/target/release/${GOOSE_BIN_NAME}" ]]; then
|
|
GOOSED_BIN="${GOOSED_ROOT}/target/release/${GOOSE_BIN_NAME}"
|
|
elif [[ -x "${GOOSED_ROOT}/target/debug/${GOOSE_BIN_NAME}" ]]; then
|
|
GOOSED_BIN="${GOOSED_ROOT}/target/debug/${GOOSE_BIN_NAME}"
|
|
else
|
|
echo "[goose-v149] goose binary not found; build with:" >&2
|
|
echo " bash ${ROOT}/scripts/build-goosed-v149-local.sh" >&2
|
|
exit 1
|
|
fi
|
|
|
|
export XDG_CONFIG_HOME="${RUNTIME_ROOT}/config"
|
|
export XDG_DATA_HOME="${RUNTIME_ROOT}/data"
|
|
export XDG_STATE_HOME="${RUNTIME_ROOT}/state"
|
|
export XDG_CACHE_HOME="${RUNTIME_ROOT}/cache"
|
|
|
|
export GOOSE_PORT="${PORT}"
|
|
export GOOSE_HOST="${GOOSE_HOST:-127.0.0.1}"
|
|
export GOOSE_TLS="${GOOSE_TLS:-true}"
|
|
export GOOSE_SERVER__SECRET_KEY="${GOOSE_SERVER__SECRET_KEY:-local-v149-dev-secret}"
|
|
export GOOSE_DISABLE_KEYRING="${GOOSE_DISABLE_KEYRING:-1}"
|
|
|
|
# Phase 1: vanilla v1.49 may still use default SQLite unless PG adapter is ported.
|
|
export GOOSE_SESSION_DB_URL="${GOOSE_SESSION_DB_URL:-postgresql://${PG_USER}@${PG_HOST}:${PG_PORT}/${DB_NAME}}"
|
|
|
|
export GOOSED_MCP_NODE_PATH="${GOOSED_MCP_NODE_PATH:-$(command -v node)}"
|
|
export GOOSED_MCP_SERVER_PATH="${GOOSED_MCP_SERVER_PATH:-${ROOT}/mindspace-sandbox-mcp.mjs}"
|
|
export PORTAL_RUNTIME_DIR="${PORTAL_RUNTIME_DIR:-${ROOT}}"
|
|
export MINDSPACE_ROOT="${MINDSPACE_ROOT:-${ROOT}/MindSpace}"
|
|
|
|
# Memory: force legacy owner during local upgrade (see TKMIND_V1_49_MIGRATION.md)
|
|
export MEMORY_BACKEND="${MEMORY_BACKEND:-legacy}"
|
|
export MEMORY_VECTOR_ENABLED="${MEMORY_VECTOR_ENABLED:-0}"
|
|
export MEMORY_AGENT_INJECTION_MODE="${MEMORY_AGENT_INJECTION_MODE:-off}"
|
|
export MEMORY_LIFECYCLE_ENABLED="${MEMORY_LIFECYCLE_ENABLED:-0}"
|
|
export MEMORY_CANDIDATE_ENABLED="${MEMORY_CANDIDATE_ENABLED:-0}"
|
|
|
|
echo "[goose-v149] binary=$(${GOOSED_BIN} --version 2>&1 | head -1)"
|
|
echo "[goose-v149] port=${PORT} session_db=${DB_NAME} runtime=${RUNTIME_ROOT}"
|
|
echo "[goose-v149] mode=goose serve (ACP HTTP/WS); legacy REST /agent/* requires tkmind_compat port"
|
|
|
|
cd "${GOOSED_ROOT}"
|
|
SERVE_TLS_FLAG=()
|
|
if [[ "${GOOSE_TLS:-true}" == "true" ]]; then
|
|
SERVE_TLS_FLAG=(--tls)
|
|
fi
|
|
exec "${GOOSED_BIN}" serve --host "${GOOSE_HOST:-127.0.0.1}" --port "${PORT}" "${SERVE_TLS_FLAG[@]}"
|