



























@@ -565,6 +565,93 @@ describe("optional media tool factory planning", () => {
565565).not.toEqual(expect.arrayContaining(["image_generate", "video_generate", "music_generate"]));
566566});
567567568+it("counts configured non-env SecretRef config signals without resolving secrets", () => {
569+const config: OpenClawConfig = {
570+plugins: {
571+entries: {
572+comfy: {
573+config: {
574+mode: "cloud",
575+apiKey: { source: "file", provider: "vault", id: "/comfy/api-key" },
576+workflow: { "1": { inputs: {} } },
577+promptNodeId: "1",
578+},
579+},
580+},
581+},
582+secrets: {
583+providers: {
584+vault: {
585+source: "file",
586+path: "/tmp/openclaw-secrets.json",
587+mode: "json",
588+},
589+},
590+},
591+};
592+const configSignals = [
593+{
594+rootPath: "plugins.entries.comfy.config",
595+mode: {
596+path: "mode",
597+allowed: ["cloud"],
598+},
599+requiredAny: ["workflow", "workflowPath"],
600+required: ["promptNodeId", "apiKey"],
601+},
602+];
603+installSnapshot(config, [
604+createPlugin({
605+id: "comfy",
606+contracts: {
607+imageGenerationProviders: ["comfy"],
608+videoGenerationProviders: ["comfy"],
609+musicGenerationProviders: ["comfy"],
610+},
611+imageGenerationProviderMetadata: {
612+comfy: { configSignals },
613+},
614+videoGenerationProviderMetadata: {
615+comfy: { configSignals },
616+},
617+musicGenerationProviderMetadata: {
618+comfy: { configSignals },
619+},
620+}),
621+]);
622+623+expect(
624+__testing.resolveOptionalMediaToolFactoryPlan({
625+ config,
626+authStore: createAuthStore(),
627+}),
628+).toMatchObject({
629+imageGenerate: true,
630+videoGenerate: true,
631+musicGenerate: true,
632+});
633+});
634+635+it("does not register the image tool without cheap vision availability evidence", () => {
636+const config: OpenClawConfig = {};
637+installSnapshot(config, [
638+createPlugin({
639+id: "media-owner",
640+contracts: { mediaUnderstandingProviders: ["media-owner"] },
641+setupProviders: [{ id: "media-owner", envVars: ["MEDIA_OWNER_API_KEY"] }],
642+}),
643+]);
644+645+expect(
646+createOpenClawTools({
647+ config,
648+agentDir: "/tmp/openclaw-agent",
649+authProfileStore: createAuthStore(),
650+disablePluginTools: true,
651+}).map((tool) => tool.name),
652+).not.toContain("image");
653+});
654+568655it.each([
569656{
570657name: "legacy local provider config",
@@ -687,22 +774,20 @@ describe("optional media tool factory planning", () => {
687774});
688775});
689776690-it("falls back to existing factory checks when snapshot or auth store proof is missing", () => {
691-expect(__testing.resolveOptionalMediaToolFactoryPlan({ config: {} })).toEqual({
692-imageGenerate: true,
693-videoGenerate: true,
694-musicGenerate: true,
695-pdf: true,
696-});
697-777+it("does not use a generic factory plan when metadata has no availability proof", () => {
698778const config: OpenClawConfig = {};
699779installSnapshot(config, []);
700780701-expect(__testing.resolveOptionalMediaToolFactoryPlan({ config })).toEqual({
702-imageGenerate: true,
703-videoGenerate: true,
704-musicGenerate: true,
705-pdf: true,
781+expect(
782+__testing.resolveOptionalMediaToolFactoryPlan({
783+ config,
784+authStore: createAuthStore(),
785+}),
786+).toEqual({
787+imageGenerate: false,
788+videoGenerate: false,
789+musicGenerate: false,
790+pdf: false,
706791});
707792});
708793});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。