refactor(config): migrate plugin config access

This commit is contained in:
Peter Steinberger
2026-04-27 12:16:48 +01:00
parent 48ebed3ed3
commit 7f3f108521
531 changed files with 3502 additions and 1646 deletions

View File

@@ -105,7 +105,7 @@ describe("gateway multi-instance e2e", () => {
const idempotencyKey = `idem-${randomUUID()}`;
const sendRes = await chatClient.request("chat.send", {
sessionKey,
message: "/context list",
message: "/whoami",
idempotencyKey,
});
expect(sendRes.status).toBe("started");

View File

@@ -75,6 +75,24 @@ export function createPluginRuntimeMock(overrides: DeepPartial<PluginRuntime> =
const base: PluginRuntime = {
version: "1.0.0-test",
config: {
current: vi.fn(() => ({})) as unknown as PluginRuntime["config"]["current"],
mutateConfigFile: vi.fn(async () => ({
path: "/tmp/openclaw.json",
previousHash: null,
snapshot: {} as never,
nextConfig: {},
afterWrite: { mode: "auto" },
followUp: { mode: "auto", requiresRestart: false },
result: undefined,
})) as unknown as PluginRuntime["config"]["mutateConfigFile"],
replaceConfigFile: vi.fn(async ({ nextConfig }) => ({
path: "/tmp/openclaw.json",
previousHash: null,
snapshot: {} as never,
nextConfig,
afterWrite: { mode: "auto" },
followUp: { mode: "auto", requiresRestart: false },
})) as unknown as PluginRuntime["config"]["replaceConfigFile"],
loadConfig: vi.fn(() => ({})) as unknown as PluginRuntime["config"]["loadConfig"],
writeConfigFile: vi.fn() as unknown as PluginRuntime["config"]["writeConfigFile"],
},