Add smart ACK provider for WeChat MP replies
Replace fixed ackText with a rule-based AckProvider that picks response templates by message type and intent (translate, summary, rewrite, poster, ppt, mindmap, code, search, schedule). Pure sync, zero I/O, auto-falls back to config.ackText on any error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -94,6 +94,26 @@ async function bundleServer() {
|
||||
await run(esbuildBin, args);
|
||||
}
|
||||
|
||||
async function bundleSandboxMcp() {
|
||||
if (!(await exists(esbuildBin))) {
|
||||
throw new Error(`未找到 esbuild: ${esbuildBin}`);
|
||||
}
|
||||
console.log('==> 打包 sandbox MCP 为单文件 runtime');
|
||||
const args = [
|
||||
'mindspace-sandbox-mcp.mjs',
|
||||
'--bundle',
|
||||
'--platform=node',
|
||||
'--format=esm',
|
||||
'--target=node24',
|
||||
'--outfile=.runtime/portal/mindspace-sandbox-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 copyRuntimeAssets() {
|
||||
console.log('==> 拷贝运行时静态资源');
|
||||
await remove(runtimeRoot);
|
||||
@@ -111,11 +131,6 @@ async function copyRuntimeAssets() {
|
||||
if (await exists(schemaFile)) {
|
||||
await fs.copyFile(schemaFile, path.join(runtimeRoot, 'schema.sql'));
|
||||
}
|
||||
|
||||
const sandboxMcpFile = path.join(root, 'mindspace-sandbox-mcp.mjs');
|
||||
if (await exists(sandboxMcpFile)) {
|
||||
await fs.copyFile(sandboxMcpFile, path.join(runtimeRoot, 'mindspace-sandbox-mcp.mjs'));
|
||||
}
|
||||
}
|
||||
|
||||
async function copyNodeModules() {
|
||||
@@ -212,7 +227,7 @@ async function writeMetadata() {
|
||||
' logs/',
|
||||
'',
|
||||
'Bundled alongside server.mjs (required for sandbox-fs MCP):',
|
||||
' mindspace-sandbox-mcp.mjs',
|
||||
' mindspace-sandbox-mcp.mjs (esbuild bundle; includes schedule-service deps)',
|
||||
'',
|
||||
'Key runtime differences must stay in .env, not in the artifact:',
|
||||
' DATABASE_URL / MYSQL_*',
|
||||
@@ -233,6 +248,7 @@ async function main() {
|
||||
await buildFrontend();
|
||||
await copyRuntimeAssets();
|
||||
await bundleServer();
|
||||
await bundleSandboxMcp();
|
||||
await copyNodeModules();
|
||||
await writeMetadata();
|
||||
await fs.chmod(path.join(runtimeRoot, 'scripts', 'run-memind-portal-prod.sh'), 0o755);
|
||||
|
||||
Reference in New Issue
Block a user