QMD: use OpenClaw config types

This commit is contained in:
Benjamin Jesuiter
2026-02-02 22:34:07 +01:00
committed by Vignesh
parent 3d1c3b78ec
commit 465536e811
5 changed files with 30 additions and 35 deletions

View File

@@ -1,14 +1,12 @@
import path from "node:path";
import { describe, expect, it } from "vitest";
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import { resolveAgentWorkspaceDir } from "../agents/agent-scope.js";
import { resolveMemoryBackendConfig } from "./backend-config.js";
describe("resolveMemoryBackendConfig", () => {
it("defaults to builtin backend when config missing", () => {
const cfg = { agents: { defaults: { workspace: "/tmp/memory-test" } } } as MoltbotConfig;
const cfg = { agents: { defaults: { workspace: "/tmp/memory-test" } } } as OpenClawConfig;
const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });
expect(resolved.backend).toBe("builtin");
expect(resolved.citations).toBe("auto");
@@ -22,7 +20,7 @@ describe("resolveMemoryBackendConfig", () => {
backend: "qmd",
qmd: {},
},
} as MoltbotConfig;
} as OpenClawConfig;
const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });
expect(resolved.backend).toBe("qmd");
expect(resolved.qmd?.collections.length).toBeGreaterThanOrEqual(3);
@@ -39,7 +37,7 @@ describe("resolveMemoryBackendConfig", () => {
command: '"/Applications/QMD Tools/qmd" --flag',
},
},
} as MoltbotConfig;
} as OpenClawConfig;
const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });
expect(resolved.qmd?.command).toBe("/Applications/QMD Tools/qmd");
});
@@ -62,7 +60,7 @@ describe("resolveMemoryBackendConfig", () => {
],
},
},
} as MoltbotConfig;
} as OpenClawConfig;
const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });
const custom = resolved.qmd?.collections.find((c) => c.name.startsWith("custom-notes"));
expect(custom).toBeDefined();