




















@@ -441,25 +441,45 @@ const CORE_SECRET_TARGET_REGISTRY: SecretTargetRegistryEntry[] = [
441441442442let cachedSecretTargetRegistry: SecretTargetRegistryEntry[] | null = null;
443443444-export function getCoreSecretTargetRegistry(): SecretTargetRegistryEntry[] {
445-return CORE_SECRET_TARGET_REGISTRY;
446-}
447-448-export function getSecretTargetRegistry(): SecretTargetRegistryEntry[] {
449-if (cachedSecretTargetRegistry) {
450-return cachedSecretTargetRegistry;
451-}
444+function loadSecretTargetRegistryFromPluginMetadata(params: {
445+env: NodeJS.ProcessEnv;
446+preferPersisted?: boolean;
447+}): SecretTargetRegistryEntry[] {
452448const plugins = loadPluginMetadataSnapshot({
453449config: {},
454-env: process.env,
450+env: params.env,
451+ ...(params.preferPersisted !== undefined ? { preferPersisted: params.preferPersisted } : {}),
455452}).plugins;
456453const bundledPlugins = plugins.filter((record) => record.origin === "bundled");
457454const channelPlugins = plugins.filter((record) => record.channels.length > 0);
458-cachedSecretTargetRegistry = [
455+return [
459456 ...CORE_SECRET_TARGET_REGISTRY,
460457 ...listBundledWebProviderSecretTargetRegistryEntries(bundledPlugins),
461458 ...listBundledPluginConfigSecretTargetRegistryEntries(bundledPlugins),
462459 ...listChannelSecretTargetRegistryEntries(channelPlugins),
463460];
461+}
462+463+export function getCoreSecretTargetRegistry(): SecretTargetRegistryEntry[] {
464+return CORE_SECRET_TARGET_REGISTRY;
465+}
466+467+export function getSecretTargetRegistry(): SecretTargetRegistryEntry[] {
468+if (cachedSecretTargetRegistry) {
469+return cachedSecretTargetRegistry;
470+}
471+cachedSecretTargetRegistry = loadSecretTargetRegistryFromPluginMetadata({
472+env: process.env,
473+});
464474return cachedSecretTargetRegistry;
465475}
476+477+export function getSourceSecretTargetRegistry(): SecretTargetRegistryEntry[] {
478+return loadSecretTargetRegistryFromPluginMetadata({
479+env: {
480+ ...process.env,
481+OPENCLAW_BUNDLED_PLUGINS_DIR: process.env.OPENCLAW_BUNDLED_PLUGINS_DIR ?? "extensions",
482+},
483+preferPersisted: false,
484+});
485+}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。