


























@@ -9,6 +9,7 @@ import {
99collectPackageRuntimeDeps,
1010normalizeInstallableRuntimeDepName,
1111parseInstallableRuntimeDep,
12+parseInstallableRuntimeDepSpec,
1213type RuntimeDepEntry,
1314} from "./bundled-runtime-deps-specs.js";
1415import {
@@ -30,6 +31,7 @@ export type BundledPluginRuntimeDepsManifest = {
3031enabledByDefault: boolean;
3132id?: string;
3233legacyPluginIds: string[];
34+localMemoryEmbeddingRuntimeDeps: RuntimeDepEntry[];
3335modelSupport?: BundledPluginRuntimeDepsModelSupport;
3436providers: string[];
3537};
@@ -110,6 +112,9 @@ function readBundledPluginRuntimeDepsManifest(
110112const manifest = readRuntimeDepsJsonObject(path.join(pluginDir, "openclaw.plugin.json"));
111113const channels = manifest?.channels;
112114const legacyPluginIds = manifest?.legacyPluginIds;
115+const localMemoryEmbeddingRuntimeDeps = readBundledPluginLocalMemoryEmbeddingRuntimeDeps(
116+manifest?.runtimeDependencies,
117+);
113118const modelSupport = readBundledPluginRuntimeDepsModelSupport(manifest?.modelSupport);
114119const providers = manifest?.providers;
115120const runtimeDepsManifest = {
@@ -123,6 +128,7 @@ function readBundledPluginRuntimeDepsManifest(
123128(entry): entry is string => typeof entry === "string" && entry !== "",
124129)
125130 : [],
131+ localMemoryEmbeddingRuntimeDeps,
126132 ...(modelSupport ? { modelSupport } : {}),
127133providers: Array.isArray(providers)
128134 ? providers.filter((entry): entry is string => typeof entry === "string" && entry !== "")
@@ -132,6 +138,24 @@ function readBundledPluginRuntimeDepsManifest(
132138return runtimeDepsManifest;
133139}
134140141+function readBundledPluginLocalMemoryEmbeddingRuntimeDeps(value: unknown): RuntimeDepEntry[] {
142+if (!isRecord(value)) {
143+return [];
144+}
145+const specs = value.localMemoryEmbedding;
146+if (!Array.isArray(specs)) {
147+return [];
148+}
149+return specs.map((spec) => {
150+if (typeof spec !== "string") {
151+throw new Error(
152+"openclaw.plugin.json runtimeDependencies.localMemoryEmbedding must contain strings",
153+);
154+}
155+return { ...parseInstallableRuntimeDepSpec(spec), pluginIds: [] };
156+});
157+}
158+135159function readBundledPluginRuntimeDepsModelSupport(
136160value: unknown,
137161): BundledPluginRuntimeDepsModelSupport | undefined {
@@ -353,6 +377,30 @@ function collectConfiguredProviderIds(config: OpenClawConfig): Set<string> {
353377return collectConfiguredRuntimeDepsTargets(config).providerIds;
354378}
355379380+function memorySearchConfigUsesProvider(
381+value: { enabled?: boolean; provider?: string } | undefined,
382+providerId: string,
383+): boolean {
384+return (
385+value?.enabled !== false && normalizeOptionalLowercaseString(value?.provider) === providerId
386+);
387+}
388+389+function isMemoryEmbeddingProviderConfiguredForRuntimeDeps(
390+config: OpenClawConfig | undefined,
391+providerId: string,
392+): boolean {
393+if (!config) {
394+return false;
395+}
396+if (memorySearchConfigUsesProvider(config.agents?.defaults?.memorySearch, providerId)) {
397+return true;
398+}
399+return (config.agents?.list ?? []).some((agent) =>
400+memorySearchConfigUsesProvider(agent.memorySearch, providerId),
401+);
402+}
403+356404function matchesBundledRuntimeDepsModelSupport(
357405manifest: BundledPluginRuntimeDepsManifest,
358406modelId: string,
@@ -665,20 +713,32 @@ export function collectBundledPluginRuntimeDeps(params: {
665713continue;
666714}
667715includedPluginIds.add(pluginId);
716+const manifest = readBundledPluginRuntimeDepsManifest(pluginDir, manifestCache);
668717const packageJson = readRuntimeDepsJsonObject(path.join(pluginDir, "package.json"));
669-if (!packageJson) {
670-continue;
718+if (packageJson) {
719+for (const [name, rawVersion] of Object.entries(collectPackageRuntimeDeps(packageJson))) {
720+const dep = parseInstallableRuntimeDep(name, rawVersion);
721+if (!dep) {
722+continue;
723+}
724+const byVersion = versionMap.get(dep.name) ?? new Map<string, Set<string>>();
725+const pluginIds = byVersion.get(dep.version) ?? new Set<string>();
726+pluginIds.add(pluginId);
727+byVersion.set(dep.version, pluginIds);
728+versionMap.set(dep.name, byVersion);
729+}
671730}
672-for (const [name, rawVersion] of Object.entries(collectPackageRuntimeDeps(packageJson))) {
673-const dep = parseInstallableRuntimeDep(name, rawVersion);
674-if (!dep) {
675-continue;
731+if (
732+manifest.localMemoryEmbeddingRuntimeDeps.length > 0 &&
733+isMemoryEmbeddingProviderConfiguredForRuntimeDeps(params.config, "local")
734+) {
735+for (const dep of manifest.localMemoryEmbeddingRuntimeDeps) {
736+const byVersion = versionMap.get(dep.name) ?? new Map<string, Set<string>>();
737+const pluginIds = byVersion.get(dep.version) ?? new Set<string>();
738+pluginIds.add(pluginId);
739+byVersion.set(dep.version, pluginIds);
740+versionMap.set(dep.name, byVersion);
676741}
677-const byVersion = versionMap.get(dep.name) ?? new Map<string, Set<string>>();
678-const pluginIds = byVersion.get(dep.version) ?? new Set<string>();
679-pluginIds.add(pluginId);
680-byVersion.set(dep.version, pluginIds);
681-versionMap.set(dep.name, byVersion);
682742}
683743}
684744此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。