






















@@ -43,6 +43,7 @@ function createCandidate(
4343rootDir: string,
4444id = "demo",
4545origin: PluginCandidate["origin"] = "global",
46+options: { enabledByDefault?: boolean } = {},
4647): PluginCandidate {
4748fs.writeFileSync(
4849path.join(rootDir, "index.ts"),
@@ -54,6 +55,7 @@ function createCandidate(
5455JSON.stringify({
5556 id,
5657name: id,
58+ ...(options.enabledByDefault ? { enabledByDefault: true } : {}),
5759configSchema: { type: "object" },
5860providers: [id],
5961}),
@@ -184,6 +186,34 @@ describe("plugin registry install migration", () => {
184186]);
185187});
186188189+it("keeps enabled-by-default bundled provider plugins discoverable for setup", async () => {
190+const stateDir = makeTempDir();
191+const openaiDir = path.join(stateDir, "plugins", "openai");
192+const unusedBundledDir = path.join(stateDir, "plugins", "unused-bundled");
193+fs.mkdirSync(openaiDir, { recursive: true });
194+fs.mkdirSync(unusedBundledDir, { recursive: true });
195+196+await expect(
197+migratePluginRegistryForInstall({
198+ stateDir,
199+candidates: [
200+createCandidate(openaiDir, "openai", "bundled", { enabledByDefault: true }),
201+createCandidate(unusedBundledDir, "unused-bundled", "bundled"),
202+],
203+readConfig: async () => ({}),
204+env: hermeticEnv(),
205+}),
206+).resolves.toMatchObject({
207+status: "migrated",
208+current: {
209+plugins: [expect.objectContaining({ pluginId: "openai", enabledByDefault: true })],
210+},
211+});
212+213+const persisted = await readPersistedInstalledPluginIndex({ stateDir });
214+expect(persisted?.plugins.map((plugin) => plugin.pluginId)).toEqual(["openai"]);
215+});
216+187217it("supports dry-run preflight without reading config or writing the registry", async () => {
188218const stateDir = makeTempDir();
189219const readConfig = vi.fn(async () => ({}));
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。