mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:50:43 +00:00
fix(plugins): keep onboarding install records out of config
This commit is contained in:
@@ -313,9 +313,7 @@ describe("ensureChannelSetupPluginInstalled", () => {
|
||||
expect(result.installed).toBe(true);
|
||||
expect(result.cfg.plugins?.entries?.["bundled-chat"]?.enabled).toBe(true);
|
||||
expect(result.cfg.plugins?.allow).toContain("bundled-chat");
|
||||
expect(result.cfg.plugins?.installs?.["bundled-chat"]?.source).toBe("npm");
|
||||
expect(result.cfg.plugins?.installs?.["bundled-chat"]?.spec).toBe(bundledChatNpmSpec);
|
||||
expect(result.cfg.plugins?.installs?.["bundled-chat"]?.installPath).toBe("/tmp/bundled-chat");
|
||||
expect(result.cfg.plugins?.installs).toBeUndefined();
|
||||
expect(installPluginFromNpmSpec).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
expectedIntegrity: bundledChatIntegrity,
|
||||
|
||||
@@ -32,7 +32,18 @@ vi.mock("../plugins/enable.js", () => ({
|
||||
enablePluginInConfig,
|
||||
}));
|
||||
|
||||
const recordPluginInstall = vi.hoisted(() => vi.fn((cfg) => cfg));
|
||||
const recordPluginInstall = vi.hoisted(() =>
|
||||
vi.fn((cfg: OpenClawConfig, update: { pluginId: string }) => ({
|
||||
...cfg,
|
||||
plugins: {
|
||||
...cfg.plugins,
|
||||
installs: {
|
||||
...cfg.plugins?.installs,
|
||||
[update.pluginId]: update,
|
||||
},
|
||||
},
|
||||
})),
|
||||
);
|
||||
const buildNpmResolutionInstallFields = vi.hoisted(() => vi.fn(() => ({})));
|
||||
vi.mock("../plugins/installs.js", () => ({
|
||||
recordPluginInstall,
|
||||
@@ -123,6 +134,7 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
);
|
||||
expect(result.installed).toBe(true);
|
||||
expect(result.status).toBe("installed");
|
||||
expect(result.cfg.plugins?.installs).toBeUndefined();
|
||||
});
|
||||
|
||||
it("returns a timed out status and notes the retry path when npm install hangs", async () => {
|
||||
@@ -443,6 +455,7 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
);
|
||||
expect(result.installed).toBe(true);
|
||||
expect(result.status).toBe("installed");
|
||||
expect(result.cfg.plugins?.installs).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -502,6 +515,7 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
);
|
||||
expect(result.installed).toBe(true);
|
||||
expect(result.status).toBe("installed");
|
||||
expect(result.cfg.plugins?.installs).toBeUndefined();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ import { enablePluginInConfig, type PluginEnableResult } from "../plugins/enable
|
||||
import {
|
||||
loadPluginInstallRecords,
|
||||
recordPluginInstallInRecords,
|
||||
withoutPluginInstallRecords,
|
||||
writePersistedPluginInstallLedger,
|
||||
} from "../plugins/install-ledger-store.js";
|
||||
import { installPluginFromNpmSpec } from "../plugins/install.js";
|
||||
@@ -166,7 +167,7 @@ async function recordLocalPluginInstall(params: {
|
||||
cfg: params.cfg,
|
||||
install,
|
||||
});
|
||||
return recordPluginInstall(params.cfg, install);
|
||||
return withoutPluginInstallRecords(recordPluginInstall(params.cfg, install));
|
||||
}
|
||||
|
||||
function resolveLocalPath(params: {
|
||||
@@ -574,7 +575,7 @@ export async function ensureOnboardingPluginInstalled(params: {
|
||||
cfg: next,
|
||||
install,
|
||||
});
|
||||
next = recordPluginInstall(next, install);
|
||||
next = withoutPluginInstallRecords(recordPluginInstall(next, install));
|
||||
return {
|
||||
cfg: next,
|
||||
installed: true,
|
||||
|
||||
Reference in New Issue
Block a user