Gateway: eager-init QMD backend on startup

This commit is contained in:
Vignesh Natarajan
2026-02-07 19:38:04 -08:00
committed by Vignesh
parent ef4a0e92b7
commit efc79f69a2
5 changed files with 97 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import type { OpenClawConfig } from "../config/config.js";
import { resolveDefaultAgentId } from "../agents/agent-scope.js";
import { resolveMemoryBackendConfig } from "../memory/backend-config.js";
import { getMemorySearchManager } from "../memory/index.js";
export async function startGatewayMemoryBackend(params: {
cfg: OpenClawConfig;
log: { info?: (msg: string) => void; warn: (msg: string) => void };
}): Promise<void> {
const agentId = resolveDefaultAgentId(params.cfg);
const resolved = resolveMemoryBackendConfig({ cfg: params.cfg, agentId });
if (resolved.backend !== "qmd" || !resolved.qmd) {
return;
}
const { manager, error } = await getMemorySearchManager({ cfg: params.cfg, agentId });
if (!manager) {
params.log.warn(
`qmd memory startup initialization failed for agent "${agentId}": ${error ?? "unknown error"}`,
);
return;
}
params.log.info?.(`qmd memory startup initialization armed for agent "${agentId}"`);
}