57 lines
2.1 KiB
Bash
Executable File
57 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
STABLE_ROOT="${MEMIND_CANARY_STABLE_ROOT:-/Users/john/Project/Memind}"
|
|
|
|
if [[ ! -d "${STABLE_ROOT}" || ! -f "${STABLE_ROOT}/.env" ]]; then
|
|
echo "[portal-candidate] stable persistent root is unavailable: ${STABLE_ROOT}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cd "${ROOT}"
|
|
|
|
set -a
|
|
# shellcheck disable=SC1091
|
|
source "${STABLE_ROOT}/.env"
|
|
set +a
|
|
|
|
export NODE_ENV=production
|
|
export MEMIND_PORTAL_H5_ROOT="${STABLE_ROOT}"
|
|
export MEMIND_RUNTIME_ROLE=candidate
|
|
export MEMIND_CANARY_PASSIVE_RUNTIME=1
|
|
export MEMIND_RUNTIME_BUILD_ID="${MEMIND_CANARY_RELEASE_ID:?MEMIND_CANARY_RELEASE_ID is required}"
|
|
export MEMIND_AGENT_RUN_WORKER_ID="portal-candidate-${MEMIND_RUNTIME_BUILD_ID}"
|
|
export MEMIND_WORKSPACE_MAINTENANCE=0
|
|
export H5_REMINDER_WORKER_ENABLED=0
|
|
export H5_PORT="${MEMIND_CANARY_CANDIDATE_PORT:-18081}"
|
|
export H5_HOST=127.0.0.1
|
|
export H5_PUBLIC_BASE_URL="${H5_PUBLIC_BASE_URL:-https://m.tkmind.cn}"
|
|
export TKMIND_API_TARGETS="${MEMIND_CANARY_GOOSED_URL:-https://127.0.0.1:18015}"
|
|
export TKMIND_API_TARGET="${MEMIND_CANARY_GOOSED_URL:-https://127.0.0.1:18015}"
|
|
# Extensions are spawned inside goosed-canary, where the candidate artifact is
|
|
# mounted at /opt/portal. Never inherit host-only MCP paths from the stable .env.
|
|
export GOOSED_MCP_NODE_PATH=/usr/local/bin/node
|
|
export GOOSED_MCP_SERVER_PATH=/opt/portal/mindspace-sandbox-mcp.mjs
|
|
# DeepSeek V4 tool rounds must use the same compatibility contract exercised
|
|
# by the release Gate. Stable .env values cannot disable or redirect it.
|
|
export MEMIND_DEEPSEEK_DISABLE_THINKING=1
|
|
export MEMIND_DEEPSEEK_NO_THINK_PORT="${MEMIND_CANARY_DEEPSEEK_PROXY_PORT:-18036}"
|
|
export MEMIND_GOOSED_HOST_GATEWAY=host.docker.internal
|
|
unset MEMIND_DEEPSEEK_NO_THINK_BASE_URL
|
|
unset MEMIND_DEEPSEEK_NO_THINK_HOST
|
|
unset TKMIND_API_TARGET_1
|
|
|
|
NODE_BIN="${NODE_BIN:-/opt/homebrew/opt/node@24/bin/node}"
|
|
if [[ ! -x "${NODE_BIN}" ]]; then
|
|
NODE_BIN="$(command -v node)"
|
|
fi
|
|
|
|
port="${H5_PORT}"
|
|
if lsof -tiTCP:"${port}" -sTCP:LISTEN >/dev/null 2>&1; then
|
|
echo "[portal-candidate] port ${port} is already in use; refusing to replace it" >&2
|
|
exit 1
|
|
fi
|
|
|
|
exec "${NODE_BIN}" "${ROOT}/server.mjs"
|