fix(runtime): bundle MindSearch MCP for production

This commit is contained in:
john
2026-07-16 22:26:47 +08:00
parent 4e6abacce1
commit 3cafadba5a
3 changed files with 27 additions and 3 deletions
+22
View File
@@ -143,6 +143,26 @@ async function bundleSandboxMcp() {
await run(esbuildBin, args);
}
async function bundleMindSearchMcp() {
if (!(await exists(esbuildBin))) {
throw new Error(`未找到 esbuild: ${esbuildBin}`);
}
console.log('==> 打包 MindSearch MCP 为单文件 runtime');
const args = [
'tkmind-search-mcp.mjs',
'--bundle',
'--platform=node',
'--format=esm',
`--target=${runtimeNodeTarget}`,
'--outfile=.runtime/portal/tkmind-search-mcp.mjs',
'--banner:js=import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);',
];
for (const pkg of externalPackages) {
args.push(`--external:${pkg}`);
}
await run(esbuildBin, args);
}
async function bundleAgentRunWorker() {
if (!(await exists(esbuildBin))) {
throw new Error(`未找到 esbuild: ${esbuildBin}`);
@@ -414,6 +434,7 @@ async function writeMetadata() {
'',
'Bundled alongside server.mjs (required for sandbox-fs MCP):',
' mindspace-sandbox-mcp.mjs (esbuild bundle; includes schedule-service deps)',
' tkmind-search-mcp.mjs (esbuild bundle; required when MindSearch is enabled)',
' wechat-mp.bundle.mjs (esbuild bundle; hot-swappable WeChat MP module)',
'',
'Post-deploy validation (scripts/check-mindspace-public-links.mjs):',
@@ -486,6 +507,7 @@ async function main() {
await bundleServer();
await bundleWechatMp();
await bundleSandboxMcp();
await bundleMindSearchMcp();
await bundleAgentRunWorker();
if (runtimeInstallMode === 'bundle-node-modules' && !skipNodeModules) {
await copyNodeModules();