feat(plugins): add image generation capability

This commit is contained in:
Peter Steinberger
2026-03-16 22:56:14 -07:00
parent c79ade10e6
commit aa2d5aaa0c
38 changed files with 701 additions and 4 deletions

View File

@@ -59,10 +59,17 @@ describe("plugin runtime command execution", () => {
const runtime = createPluginRuntime();
expect(typeof runtime.mediaUnderstanding.runFile).toBe("function");
expect(typeof runtime.mediaUnderstanding.describeImageFile).toBe("function");
expect(typeof runtime.mediaUnderstanding.describeImageFileWithModel).toBe("function");
expect(typeof runtime.mediaUnderstanding.describeVideoFile).toBe("function");
expect(runtime.mediaUnderstanding.transcribeAudioFile).toBe(runtime.stt.transcribeAudioFile);
});
it("exposes runtime.imageGeneration helpers", () => {
const runtime = createPluginRuntime();
expect(typeof runtime.imageGeneration.generate).toBe("function");
expect(typeof runtime.imageGeneration.listProviders).toBe("function");
});
it("exposes runtime.webSearch helpers", () => {
const runtime = createPluginRuntime();
expect(typeof runtime.webSearch.listProviders).toBe("function");

View File

@@ -4,13 +4,18 @@ import {
resolveApiKeyForProvider as resolveApiKeyForProviderRaw,
} from "../../agents/model-auth.js";
import { resolveStateDir } from "../../config/paths.js";
import {
generateImage,
listRuntimeImageGenerationProviders,
} from "../../image-generation/runtime.js";
import {
describeImageFile,
describeImageFileWithModel,
describeVideoFile,
runMediaUnderstandingFile,
transcribeAudioFile,
} from "../../media-understanding/runtime.js";
import { listSpeechVoices, textToSpeech, textToSpeechTelephony } from "../../tts/tts.js";
import { listSpeechVoices, textToSpeech, textToSpeechTelephony } from "../../tts/runtime.js";
import { listWebSearchProviders, runWebSearch } from "../../web-search/runtime.js";
import { createRuntimeAgent } from "./runtime-agent.js";
import { createRuntimeChannel } from "./runtime-channel.js";
@@ -145,9 +150,14 @@ export function createPluginRuntime(_options: CreatePluginRuntimeOptions = {}):
mediaUnderstanding: {
runFile: runMediaUnderstandingFile,
describeImageFile,
describeImageFileWithModel,
describeVideoFile,
transcribeAudioFile,
},
imageGeneration: {
generate: generateImage,
listProviders: listRuntimeImageGenerationProviders,
},
webSearch: {
listProviders: listWebSearchProviders,
search: runWebSearch,

View File

@@ -47,16 +47,21 @@ export type PluginRuntimeCore = {
resizeToJpeg: typeof import("../../media/image-ops.js").resizeToJpeg;
};
tts: {
textToSpeech: typeof import("../../tts/tts.js").textToSpeech;
textToSpeechTelephony: typeof import("../../tts/tts.js").textToSpeechTelephony;
listVoices: typeof import("../../tts/tts.js").listSpeechVoices;
textToSpeech: typeof import("../../tts/runtime.js").textToSpeech;
textToSpeechTelephony: typeof import("../../tts/runtime.js").textToSpeechTelephony;
listVoices: typeof import("../../tts/runtime.js").listSpeechVoices;
};
mediaUnderstanding: {
runFile: typeof import("../../media-understanding/runtime.js").runMediaUnderstandingFile;
describeImageFile: typeof import("../../media-understanding/runtime.js").describeImageFile;
describeImageFileWithModel: typeof import("../../media-understanding/runtime.js").describeImageFileWithModel;
describeVideoFile: typeof import("../../media-understanding/runtime.js").describeVideoFile;
transcribeAudioFile: typeof import("../../media-understanding/runtime.js").transcribeAudioFile;
};
imageGeneration: {
generate: typeof import("../../image-generation/runtime.js").generateImage;
listProviders: typeof import("../../image-generation/runtime.js").listRuntimeImageGenerationProviders;
};
webSearch: {
listProviders: typeof import("../../web-search/runtime.js").listWebSearchProviders;
search: typeof import("../../web-search/runtime.js").runWebSearch;