mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:40:44 +00:00
fix(plugins): stage runtime deps for selected slots
This commit is contained in:
@@ -1013,6 +1013,12 @@ describe("scanBundledPluginRuntimeDeps config policy", () => {
|
||||
includeConfiguredChannels: false,
|
||||
expectedDeps: [],
|
||||
},
|
||||
{
|
||||
name: "includes selected memory slot bundled plugins behind restrictive allowlists",
|
||||
config: { plugins: { allow: ["browser"], slots: { memory: "alpha" } } },
|
||||
includeConfiguredChannels: false,
|
||||
expectedDeps: ["alpha-runtime@1.0.0"],
|
||||
},
|
||||
{
|
||||
name: "does not let explicit plugin entries bypass restrictive allowlists",
|
||||
config: { plugins: { allow: ["browser"], entries: { alpha: { enabled: true } } } },
|
||||
@@ -2562,6 +2568,40 @@ describe("ensureBundledPluginRuntimeDeps", () => {
|
||||
expect(installRoot).not.toBe(pluginRoot);
|
||||
});
|
||||
|
||||
it("installs runtime deps for the default memory slot bundled plugin", () => {
|
||||
const packageRoot = makeTempDir();
|
||||
const pluginRoot = writeBundledPluginPackage({
|
||||
packageRoot,
|
||||
pluginId: "memory-core",
|
||||
deps: { chokidar: "^5.0.0" },
|
||||
});
|
||||
const calls: BundledRuntimeDepsInstallParams[] = [];
|
||||
|
||||
const result = ensureBundledPluginRuntimeDeps({
|
||||
env: {},
|
||||
config: {},
|
||||
installDeps: (params) => {
|
||||
calls.push(params);
|
||||
},
|
||||
pluginId: "memory-core",
|
||||
pluginRoot,
|
||||
});
|
||||
|
||||
expect(result).toEqual({
|
||||
installedSpecs: ["chokidar@^5.0.0"],
|
||||
retainSpecs: ["chokidar@^5.0.0"],
|
||||
});
|
||||
const installRoot = resolveBundledRuntimeDependencyInstallRoot(pluginRoot, { env: {} });
|
||||
expect(calls).toEqual([
|
||||
{
|
||||
installRoot,
|
||||
missingSpecs: ["chokidar@^5.0.0"],
|
||||
installSpecs: ["chokidar@^5.0.0"],
|
||||
},
|
||||
]);
|
||||
expect(installRoot).not.toBe(pluginRoot);
|
||||
});
|
||||
|
||||
it("repairs external staged deps even when packaged plugin-local deps are present", () => {
|
||||
const packageRoot = makeTempDir();
|
||||
const extensionsRoot = path.join(packageRoot, "dist", "extensions");
|
||||
|
||||
@@ -1420,6 +1420,9 @@ function isBundledPluginConfiguredForRuntimeDeps(params: {
|
||||
}
|
||||
const entry = plugins.entries[params.pluginId];
|
||||
const manifest = readBundledPluginRuntimeDepsManifest(params.pluginDir, params.manifestCache);
|
||||
if (plugins.slots.memory === params.pluginId || plugins.slots.contextEngine === params.pluginId) {
|
||||
return true;
|
||||
}
|
||||
let hasExplicitChannelDisable = false;
|
||||
let hasConfiguredChannel = false;
|
||||
for (const channelId of manifest.channels) {
|
||||
|
||||
Reference in New Issue
Block a user