

























@@ -533,10 +533,11 @@ describe("plugins cli install", () => {
533533});
534534535535it("does not persist incomplete config entries for config-gated bundled installs", async () => {
536+const pluginId = "config-required-plugin";
536537const cfg = {
537538plugins: {
538539entries: {
539-"memory-lancedb": {
540+[pluginId]: {
540541config: {},
541542},
542543},
@@ -546,17 +547,31 @@ describe("plugins cli install", () => {
546547},
547548} as OpenClawConfig;
548549loadConfig.mockReturnValue(cfg);
550+findBundledPluginSourceMock.mockReturnValue({
551+ pluginId,
552+localPath: `/app/dist/extensions/${pluginId}`,
553+configSchema: {
554+type: "object",
555+required: ["token"],
556+properties: {
557+token: {
558+type: "string",
559+},
560+},
561+},
562+requiresConfig: true,
563+});
549564550-await runPluginsCommand(["plugins", "install", "memory-lancedb"]);
565+await runPluginsCommand(["plugins", "install", pluginId]);
551566552567const writtenConfig = writeConfigFile.mock.calls.at(-1)?.[0] as OpenClawConfig;
553-expect(writtenConfig.plugins?.entries?.["memory-lancedb"]).toBeUndefined();
568+expect(writtenConfig.plugins?.entries?.[pluginId]).toBeUndefined();
554569expect(writtenConfig.plugins?.load?.paths).toEqual(["/existing/plugin"]);
555570expect(writePersistedInstalledPluginIndexInstallRecords).toHaveBeenCalledWith({
556-"memory-lancedb": expect.objectContaining({
571+[pluginId]: expect.objectContaining({
557572source: "path",
558-sourcePath: expect.stringContaining("memory-lancedb"),
559-installPath: expect.stringContaining("memory-lancedb"),
573+sourcePath: expect.stringContaining(pluginId),
574+installPath: expect.stringContaining(pluginId),
560575}),
561576});
562577expect(enablePluginInConfig).not.toHaveBeenCalled();
@@ -565,25 +580,37 @@ describe("plugins cli install", () => {
565580});
566581567582it("enables config-gated bundled installs when provider-backed config is explicit", async () => {
583+const pluginId = "config-required-plugin";
568584const cfg = {
569585plugins: {
570586entries: {
571-"memory-lancedb": {
587+[pluginId]: {
572588config: {
573-embedding: {
574-apiKey: "sk-test",
575-model: "text-embedding-3-small",
576-},
589+token: "sk-test",
577590},
578591},
579592},
580593},
581594} as OpenClawConfig;
582-const enabledCfg = createEnabledPluginConfig("memory-lancedb");
595+const enabledCfg = createEnabledPluginConfig(pluginId);
583596loadConfig.mockReturnValue(cfg);
597+findBundledPluginSourceMock.mockReturnValue({
598+ pluginId,
599+localPath: `/app/dist/extensions/${pluginId}`,
600+configSchema: {
601+type: "object",
602+required: ["token"],
603+properties: {
604+token: {
605+type: "string",
606+},
607+},
608+},
609+requiresConfig: true,
610+});
584611enablePluginInConfig.mockReturnValue({ config: enabledCfg });
585612586-await runPluginsCommand(["plugins", "install", "memory-lancedb"]);
613+await runPluginsCommand(["plugins", "install", pluginId]);
587614588615expect(enablePluginInConfig).toHaveBeenCalled();
589616expect(writeConfigFile).toHaveBeenCalledWith(enabledCfg);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。