



























@@ -691,7 +691,7 @@ describe("resolvePluginCapabilityProviders", () => {
691691});
692692});
693693694-it("uses active capability providers when plugins are globally disabled", () => {
694+it("does not resolve non-speech capability providers when plugins are globally disabled", () => {
695695const cfg = { plugins: { enabled: false, allow: ["custom-plugin"] } } as OpenClawConfig;
696696const active = createEmptyPluginRegistry();
697697active.mediaUnderstandingProviders.push({
@@ -710,12 +710,12 @@ describe("resolvePluginCapabilityProviders", () => {
710710 cfg,
711711});
712712713-expectResolvedCapabilityProviderIds(providers, ["openai"]);
713+expectNoResolvedCapabilityProviders(providers);
714714expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled();
715715expect(mocks.withBundledPluginAllowlistCompat).not.toHaveBeenCalled();
716716expect(mocks.withBundledPluginEnablementCompat).not.toHaveBeenCalled();
717717expect(mocks.withBundledPluginVitestCompat).not.toHaveBeenCalled();
718-expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith();
718+expect(mocks.resolveRuntimePluginRegistry).not.toHaveBeenCalled();
719719});
720720721721it("loads bundled speech providers through compat when plugins are globally disabled", () => {
@@ -958,42 +958,95 @@ describe("resolvePluginCapabilityProviders", () => {
958958});
959959});
960960961-it("loads targeted bundled capability providers through compat when plugins are globally disabled", () => {
961+it("does not load targeted non-speech capability providers when plugins are globally disabled", () => {
962+const cfg = { plugins: { enabled: false, allow: ["custom-plugin"] } } as OpenClawConfig;
963+const loaded = createEmptyPluginRegistry();
964+loaded.memoryEmbeddingProviders.push({
965+pluginId: "google",
966+pluginName: "google",
967+source: "test",
968+provider: {
969+id: "gemini",
970+create: async () => ({ provider: null }),
971+},
972+} as never);
973+mocks.loadPluginManifestRegistry.mockReturnValue({
974+plugins: [
975+{
976+id: "google",
977+origin: "bundled",
978+contracts: { memoryEmbeddingProviders: ["gemini"] },
979+},
980+{
981+id: "openai",
982+origin: "bundled",
983+contracts: { memoryEmbeddingProviders: ["openai"] },
984+},
985+] as never,
986+diagnostics: [],
987+});
988+mocks.resolveRuntimePluginRegistry.mockImplementation((params?: unknown) =>
989+params === undefined ? undefined : loaded,
990+);
991+992+const provider = resolvePluginCapabilityProvider({
993+key: "memoryEmbeddingProviders",
994+providerId: "gemini",
995+ cfg,
996+});
997+998+expect(provider).toBeUndefined();
999+expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled();
1000+expect(mocks.withBundledPluginAllowlistCompat).not.toHaveBeenCalled();
1001+expect(mocks.withBundledPluginEnablementCompat).not.toHaveBeenCalled();
1002+expect(mocks.withBundledPluginVitestCompat).not.toHaveBeenCalled();
1003+expect(mocks.resolveRuntimePluginRegistry).not.toHaveBeenCalled();
1004+});
1005+1006+it("loads targeted bundled speech providers through compat when plugins are globally disabled", () => {
9621007const cfg = { plugins: { enabled: false, allow: ["custom-plugin"] } } as OpenClawConfig;
9631008const allowlistCompat = {
9641009plugins: {
9651010enabled: false,
966-allow: ["custom-plugin", "google"],
1011+allow: ["custom-plugin", "microsoft"],
9671012},
9681013} as OpenClawConfig;
9691014const enablementCompat = {
9701015plugins: {
9711016enabled: true,
972-allow: ["custom-plugin", "google"],
973-entries: { google: { enabled: true } },
1017+allow: ["custom-plugin", "microsoft"],
1018+entries: { microsoft: { enabled: true } },
9741019},
9751020};
9761021const loaded = createEmptyPluginRegistry();
977-loaded.memoryEmbeddingProviders.push({
978-pluginId: "google",
979-pluginName: "google",
1022+loaded.speechProviders.push({
1023+pluginId: "microsoft",
1024+pluginName: "microsoft",
9801025source: "test",
9811026provider: {
982-id: "gemini",
983-create: async () => ({ provider: null }),
1027+id: "microsoft",
1028+label: "microsoft",
1029+aliases: ["edge"],
1030+isConfigured: () => true,
1031+synthesize: async () => ({
1032+audioBuffer: Buffer.from("x"),
1033+outputFormat: "mp3",
1034+voiceCompatible: false,
1035+fileExtension: ".mp3",
1036+}),
9841037},
9851038} as never);
9861039mocks.loadPluginManifestRegistry.mockReturnValue({
9871040plugins: [
9881041{
989-id: "google",
1042+id: "microsoft",
9901043origin: "bundled",
991-contracts: { memoryEmbeddingProviders: ["gemini"] },
1044+contracts: { speechProviders: ["microsoft"] },
9921045},
9931046{
9941047id: "openai",
9951048origin: "bundled",
996-contracts: { memoryEmbeddingProviders: ["openai"] },
1049+contracts: { speechProviders: ["openai"] },
9971050},
9981051] as never,
9991052diagnostics: [],
@@ -1005,24 +1058,24 @@ describe("resolvePluginCapabilityProviders", () => {
10051058);
1006105910071060const provider = resolvePluginCapabilityProvider({
1008-key: "memoryEmbeddingProviders",
1009-providerId: "gemini",
1061+key: "speechProviders",
1062+providerId: "microsoft",
10101063 cfg,
10111064});
101210651013-expect(provider?.id).toBe("gemini");
1066+expect(provider?.id).toBe("microsoft");
10141067expect(mocks.withBundledPluginAllowlistCompat).toHaveBeenCalledWith({
10151068config: cfg,
1016-pluginIds: ["google"],
1069+pluginIds: ["microsoft"],
10171070});
10181071expect(mocks.withBundledPluginEnablementCompat).toHaveBeenCalledWith({
10191072config: allowlistCompat,
1020-pluginIds: ["google"],
1073+pluginIds: ["microsoft"],
10211074});
10221075expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith();
10231076expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith({
10241077config: enablementCompat,
1025-onlyPluginIds: ["google"],
1078+onlyPluginIds: ["microsoft"],
10261079activate: false,
10271080});
10281081});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。