mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-31 20:01:36 +00:00
build: copy acpx mcp-proxy.mjs to dist in runtime-postbuild
This commit is contained in:
committed by
Peter Steinberger
parent
415899984e
commit
5f628c0bf8
@@ -1,16 +1,48 @@
|
||||
import { pathToFileURL } from "node:url";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { copyBundledPluginMetadata } from "./copy-bundled-plugin-metadata.mjs";
|
||||
import { copyPluginSdkRootAlias } from "./copy-plugin-sdk-root-alias.mjs";
|
||||
import { stageBundledPluginRuntimeDeps } from "./stage-bundled-plugin-runtime-deps.mjs";
|
||||
import { stageBundledPluginRuntime } from "./stage-bundled-plugin-runtime.mjs";
|
||||
import { writeOfficialChannelCatalog } from "./write-official-channel-catalog.mjs";
|
||||
|
||||
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
|
||||
/**
|
||||
* Copy static (non-transpiled) runtime assets that are referenced by their
|
||||
* source-relative path inside bundled extension code.
|
||||
*
|
||||
* Each entry: { src: repo-root-relative source, dest: dist-relative dest }
|
||||
*/
|
||||
const STATIC_EXTENSION_ASSETS = [
|
||||
// acpx MCP proxy — co-deployed alongside the acpx index bundle so that
|
||||
// `path.resolve(dirname(import.meta.url), "mcp-proxy.mjs")` resolves correctly
|
||||
// at runtime (see extensions/acpx/src/runtime-internals/mcp-agent-command.ts).
|
||||
{
|
||||
src: "extensions/acpx/src/runtime-internals/mcp-proxy.mjs",
|
||||
dest: "dist/extensions/acpx/mcp-proxy.mjs",
|
||||
},
|
||||
];
|
||||
|
||||
function copyStaticExtensionAssets() {
|
||||
for (const { src, dest } of STATIC_EXTENSION_ASSETS) {
|
||||
const srcPath = path.join(ROOT, src);
|
||||
const destPath = path.join(ROOT, dest);
|
||||
if (fs.existsSync(srcPath)) {
|
||||
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
||||
fs.copyFileSync(srcPath, destPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function runRuntimePostBuild(params = {}) {
|
||||
copyPluginSdkRootAlias(params);
|
||||
copyBundledPluginMetadata(params);
|
||||
writeOfficialChannelCatalog(params);
|
||||
stageBundledPluginRuntimeDeps(params);
|
||||
stageBundledPluginRuntime(params);
|
||||
copyStaticExtensionAssets();
|
||||
}
|
||||
|
||||
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
||||
|
||||
@@ -134,6 +134,7 @@ function buildCoreDistEntries(): Record<string, string> {
|
||||
"plugins/build-smoke-entry": "src/plugins/build-smoke-entry.ts",
|
||||
"plugins/runtime/index": "src/plugins/runtime/index.ts",
|
||||
"llm-slug-generator": "src/hooks/llm-slug-generator.ts",
|
||||
"mcp/plugin-tools-serve": "src/mcp/plugin-tools-serve.ts",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user