mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 14:10:45 +00:00
fix(plugins): cold-load partial tool registries
Fix plugin tool discovery when a selected wildcard plugin set is resolved against a partial active registry.\n\nRequire scoped registries to cover every requested plugin owner, force cold-load incomplete tool discovery registries without replacing active plugin runtime state, and add regression coverage for the partial-registry path.\n\nFixes #76780.\nThanks @lilesjtu.
This commit is contained in:
@@ -50,23 +50,30 @@ function installStandaloneRegistry(
|
||||
|
||||
export function ensureStandaloneRuntimePluginRegistryLoaded(params: {
|
||||
loadOptions: PluginLoadOptions;
|
||||
forceLoad?: boolean;
|
||||
installRegistry?: boolean;
|
||||
requiredPluginIds?: readonly string[];
|
||||
surface?: ActiveRuntimePluginRegistrySurface;
|
||||
}): PluginRegistry | undefined {
|
||||
const requiredPluginIds = params.requiredPluginIds ?? params.loadOptions.onlyPluginIds;
|
||||
const surface = params.surface ?? "active";
|
||||
const existing = getLoadedRuntimePluginRegistry({
|
||||
env: params.loadOptions.env,
|
||||
loadOptions: params.loadOptions,
|
||||
workspaceDir: params.loadOptions.workspaceDir,
|
||||
requiredPluginIds,
|
||||
surface,
|
||||
});
|
||||
if (existing) {
|
||||
return existing;
|
||||
if (!params.forceLoad) {
|
||||
const existing = getLoadedRuntimePluginRegistry({
|
||||
env: params.loadOptions.env,
|
||||
loadOptions: params.loadOptions,
|
||||
workspaceDir: params.loadOptions.workspaceDir,
|
||||
requiredPluginIds,
|
||||
surface,
|
||||
});
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
}
|
||||
|
||||
const registry = loadOpenClawPlugins(params.loadOptions);
|
||||
const effectiveLoadOptions = params.forceLoad
|
||||
? { ...params.loadOptions, cache: false }
|
||||
: params.loadOptions;
|
||||
const registry = loadOpenClawPlugins(effectiveLoadOptions);
|
||||
if (params.loadOptions.activate !== false) {
|
||||
switch (surface) {
|
||||
case "active":
|
||||
@@ -81,6 +88,10 @@ export function ensureStandaloneRuntimePluginRegistryLoaded(params: {
|
||||
return registry;
|
||||
}
|
||||
|
||||
if (params.installRegistry === false) {
|
||||
return registry;
|
||||
}
|
||||
|
||||
installStandaloneRegistry(registry, {
|
||||
loadOptions: params.loadOptions,
|
||||
surface,
|
||||
|
||||
Reference in New Issue
Block a user