fix: reuse plugin snapshot for auto enable

This commit is contained in:
Shakker
2026-05-06 07:00:28 +01:00
parent 5655c2b066
commit df209586bd

View File

@@ -2,6 +2,7 @@ import { collectConfiguredAgentHarnessRuntimes } from "../agents/harness-runtime
import { normalizeProviderId } from "../agents/provider-id.js";
import { listPotentialConfiguredChannelPresenceSignals } from "../channels/config-presence.js";
import { getChatChannelMeta, normalizeChatChannelId } from "../channels/registry.js";
import { getCurrentPluginMetadataSnapshot } from "../plugins/current-plugin-metadata-snapshot.js";
import {
type PluginManifestRecord,
type PluginManifestRegistry,
@@ -886,14 +887,23 @@ export function resolvePluginAutoEnableManifestRegistry(params: {
env: NodeJS.ProcessEnv;
manifestRegistry?: PluginManifestRegistry;
}): PluginManifestRegistry {
if (params.manifestRegistry) {
return params.manifestRegistry;
}
if (!configMayNeedPluginManifestRegistry(params.config, params.env)) {
return EMPTY_PLUGIN_MANIFEST_REGISTRY;
}
const currentSnapshot = getCurrentPluginMetadataSnapshot({
config: params.config,
env: params.env,
allowWorkspaceScopedSnapshot: true,
});
return (
params.manifestRegistry ??
(configMayNeedPluginManifestRegistry(params.config, params.env)
? loadPluginMetadataSnapshot({
config: params.config,
env: params.env,
}).manifestRegistry
: EMPTY_PLUGIN_MANIFEST_REGISTRY)
currentSnapshot?.manifestRegistry ??
loadPluginMetadataSnapshot({
config: params.config,
env: params.env,
}).manifestRegistry
);
}