fix: portal stability, session list DB fallback, and UX polish
- Free stale Memind listeners on 8081 before startup and exit cleanly on EADDRINUSE - Backfill owned sessions missing from Goose via h5_conversation_messages summaries - Strip Memind task orchestration prefixes from user-facing chat text - Repair missing public docx links before release MindSpace link checks Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -231,6 +231,14 @@ async function copyMindspacePublicLinkTools() {
|
||||
path.join(root, 'scripts', 'check-mindspace-public-links.mjs'),
|
||||
path.join(runtimeRoot, 'scripts', 'check-mindspace-public-links.mjs'),
|
||||
);
|
||||
await fs.copyFile(
|
||||
path.join(root, 'scripts', 'repair-mindspace-public-downloads.mjs'),
|
||||
path.join(runtimeRoot, 'scripts', 'repair-mindspace-public-downloads.mjs'),
|
||||
);
|
||||
await fs.copyFile(
|
||||
path.join(root, 'mindspace-public-finish-sync.mjs'),
|
||||
path.join(runtimeRoot, 'mindspace-public-finish-sync.mjs'),
|
||||
);
|
||||
}
|
||||
|
||||
async function writeMetadata() {
|
||||
@@ -260,41 +268,14 @@ async function writeMetadata() {
|
||||
throw new Error(`缺少隧道脚本: ${tunnelScript}`);
|
||||
}
|
||||
|
||||
await writeFile(
|
||||
path.join(runtimeScriptsDir, 'run-memind-portal-prod.sh'),
|
||||
[
|
||||
'#!/usr/bin/env bash',
|
||||
'set -euo pipefail',
|
||||
'',
|
||||
'ROOT="$(cd "$(dirname "$0")/.." && pwd)"',
|
||||
'cd "$ROOT"',
|
||||
'',
|
||||
'if [[ -f "${ROOT}/.env" ]]; then',
|
||||
' set -a',
|
||||
' # shellcheck disable=SC1091',
|
||||
' source "${ROOT}/.env"',
|
||||
' set +a',
|
||||
'fi',
|
||||
'',
|
||||
'export NODE_ENV=production',
|
||||
'export H5_PORT="${H5_PORT:-8081}"',
|
||||
'export H5_PUBLIC_BASE_URL="${H5_PUBLIC_BASE_URL:-https://m.tkmind.cn}"',
|
||||
'export TKMIND_API_TARGETS="${TKMIND_API_TARGETS:-https://127.0.0.1:18006,https://127.0.0.1:18007,https://127.0.0.1:18008,https://127.0.0.1:18009}"',
|
||||
'export TKMIND_API_TARGET="${TKMIND_API_TARGET:-https://127.0.0.1:18006}"',
|
||||
'export TKMIND_API_TARGET_1="${TKMIND_API_TARGET_1:-https://127.0.0.1:18007}"',
|
||||
'',
|
||||
'NODE_BIN="${NODE_BIN:-/opt/homebrew/opt/node@24/bin/node}"',
|
||||
'if [[ ! -x "${NODE_BIN}" ]]; then',
|
||||
' NODE_BIN="$(command -v node)"',
|
||||
'fi',
|
||||
'',
|
||||
'export GOOSED_MCP_NODE_PATH="${GOOSED_MCP_NODE_PATH:-${NODE_BIN}}"',
|
||||
'export GOOSED_MCP_SERVER_PATH="${GOOSED_MCP_SERVER_PATH:-${ROOT}/mindspace-sandbox-mcp.mjs}"',
|
||||
'',
|
||||
'exec "${NODE_BIN}" "${ROOT}/server.mjs"',
|
||||
'',
|
||||
].join('\n'),
|
||||
);
|
||||
const prodStartScript = path.join(root, 'scripts', 'run-memind-portal-prod.sh');
|
||||
if (await exists(prodStartScript)) {
|
||||
await fs.copyFile(prodStartScript, path.join(runtimeScriptsDir, 'run-memind-portal-prod.sh'));
|
||||
await fs.chmod(path.join(runtimeScriptsDir, 'run-memind-portal-prod.sh'), 0o755);
|
||||
} else {
|
||||
throw new Error(`缺少 Portal 启动脚本: ${prodStartScript}`);
|
||||
}
|
||||
|
||||
await fs.copyFile(
|
||||
path.join(root, 'scripts', 'load-env.mjs'),
|
||||
path.join(runtimeRoot, 'scripts', 'load-env.mjs'),
|
||||
|
||||
Reference in New Issue
Block a user