Plugins: extract loader finalization

This commit is contained in:
Gustavo Madeira Santana
2026-03-15 11:48:32 +00:00
parent 1c88ecda3f
commit b721840568
4 changed files with 185 additions and 60 deletions

View File

@@ -10,12 +10,12 @@ import {
resolvePluginSdkAliasFile,
resolvePluginSdkScopedAliasMap,
} from "../extension-host/loader-compat.js";
import { finalizeExtensionHostRegistryLoad } from "../extension-host/loader-finalize.js";
import { processExtensionHostPluginCandidate } from "../extension-host/loader-flow.js";
import {
buildExtensionHostProvenanceIndex,
compareExtensionHostDuplicateCandidateOrder,
pushExtensionHostDiagnostics,
warnAboutUntrackedLoadedExtensions,
warnWhenExtensionAllowlistIsOpen,
} from "../extension-host/loader-policy.js";
import type { GatewayRequestHandler } from "../gateway/server-methods/types.js";
@@ -971,23 +971,16 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
memorySlotMatched ||= processed.memorySlotMatched;
}
if (typeof memorySlot === "string" && !memorySlotMatched) {
registry.diagnostics.push({
level: "warn",
message: `memory slot plugin not found or not marked as memory: ${memorySlot}`,
});
}
warnAboutUntrackedLoadedExtensions({
return finalizeExtensionHostRegistryLoad({
registry,
memorySlot,
memorySlotMatched,
provenance,
logger,
env,
cacheEnabled,
cacheKey,
setCachedRegistry: setCachedPluginRegistry,
activateRegistry: activateExtensionHostRegistry,
});
if (cacheEnabled) {
setCachedPluginRegistry(cacheKey, registry);
}
activateExtensionHostRegistry(registry, cacheKey);
return registry;
}