mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:50:43 +00:00
fix: normalize stale qmd binary paths
This commit is contained in:
@@ -89,6 +89,20 @@ describe("resolveMemoryBackendConfig", () => {
|
||||
expect(resolved.qmd?.command).toBe("/Applications/QMD Tools/qmd");
|
||||
});
|
||||
|
||||
it("normalizes stale homebrew qmd paths to the portable command", () => {
|
||||
const cfg = {
|
||||
agents: { defaults: { workspace: "/tmp/memory-test" } },
|
||||
memory: {
|
||||
backend: "qmd",
|
||||
qmd: {
|
||||
command: "/opt/homebrew/bin/qmd",
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });
|
||||
expect(resolved.qmd?.command).toBe("qmd");
|
||||
});
|
||||
|
||||
it("resolves custom paths relative to workspace", () => {
|
||||
const cfg = {
|
||||
agents: {
|
||||
|
||||
@@ -244,6 +244,14 @@ function resolveSearchTool(raw?: MemoryQmdConfig["searchTool"]): string | undefi
|
||||
return value ? value : undefined;
|
||||
}
|
||||
|
||||
function normalizeQmdCommand(command: string): string {
|
||||
const normalized = path.normalize(command);
|
||||
if (normalized === "/opt/homebrew/bin/qmd" || normalized === "/usr/local/bin/qmd") {
|
||||
return "qmd";
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
function resolveSessionConfig(
|
||||
cfg: MemoryQmdConfig["sessions"],
|
||||
workspaceDir: string,
|
||||
@@ -397,7 +405,7 @@ export function resolveMemoryBackendConfig(params: {
|
||||
|
||||
const rawCommand = normalizeOptionalString(qmdCfg?.command) || "qmd";
|
||||
const parsedCommand = splitShellArgs(rawCommand);
|
||||
const command = parsedCommand?.[0] || rawCommand.split(/\s+/)[0] || "qmd";
|
||||
const command = normalizeQmdCommand(parsedCommand?.[0] || rawCommand.split(/\s+/)[0] || "qmd");
|
||||
const resolved: ResolvedQmdConfig = {
|
||||
command,
|
||||
mcporter: resolveMcporterConfig(qmdCfg?.mcporter),
|
||||
|
||||
Reference in New Issue
Block a user