feat: add external agent run worker entry
This commit is contained in:
@@ -119,6 +119,26 @@ async function bundleSandboxMcp() {
|
||||
await run(esbuildBin, args);
|
||||
}
|
||||
|
||||
async function bundleAgentRunWorker() {
|
||||
if (!(await exists(esbuildBin))) {
|
||||
throw new Error(`未找到 esbuild: ${esbuildBin}`);
|
||||
}
|
||||
console.log('==> 打包 agent run worker 为单文件 runtime');
|
||||
const args = [
|
||||
'scripts/agent-run-worker.mjs',
|
||||
'--bundle',
|
||||
'--platform=node',
|
||||
'--format=esm',
|
||||
`--target=${runtimeNodeTarget}`,
|
||||
'--outfile=.runtime/portal/scripts/agent-run-worker.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);
|
||||
@@ -347,6 +367,8 @@ async function writeMetadata() {
|
||||
' node scripts/check-tool-runtime.mjs',
|
||||
' node scripts/check-agent-code-run-entry.mjs',
|
||||
' curl -sk https://mm.tkmind.cn/api/runtime/status # includes toolRuntime.queue',
|
||||
' node scripts/agent-run-worker.mjs --status',
|
||||
' node scripts/agent-run-worker.mjs --once',
|
||||
'',
|
||||
].join('\n'),
|
||||
);
|
||||
@@ -357,6 +379,7 @@ async function main() {
|
||||
await copyRuntimeAssets();
|
||||
await bundleServer();
|
||||
await bundleSandboxMcp();
|
||||
await bundleAgentRunWorker();
|
||||
if (runtimeInstallMode === 'bundle-node-modules' && !skipNodeModules) {
|
||||
await copyNodeModules();
|
||||
}
|
||||
@@ -368,6 +391,7 @@ async function main() {
|
||||
await fs.chmod(path.join(runtimeRoot, 'scripts', 'runtime-worker-drain.mjs'), 0o755);
|
||||
await fs.chmod(path.join(runtimeRoot, 'scripts', 'runtime-worker-metrics.mjs'), 0o755);
|
||||
await fs.chmod(path.join(runtimeRoot, 'scripts', 'runtime-slo-report.mjs'), 0o755);
|
||||
await fs.chmod(path.join(runtimeRoot, 'scripts', 'agent-run-worker.mjs'), 0o755);
|
||||
await fs.chmod(path.join(runtimeRoot, 'scripts', 'install-runtime-metrics-agent.sh'), 0o755);
|
||||
await fs.chmod(path.join(runtimeRoot, 'scripts', 'check-tool-runtime.mjs'), 0o755);
|
||||
await fs.chmod(path.join(runtimeRoot, 'scripts', 'memind-portal-tunnel.sh'), 0o755);
|
||||
|
||||
Reference in New Issue
Block a user