mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-09 00:01:17 +00:00
22 lines
746 B
TypeScript
22 lines
746 B
TypeScript
import type { OpenClawConfig } from "../config/config.js";
|
|
import type { MemoryIndexManager } from "./index.js";
|
|
|
|
export async function getRequiredMemoryIndexManager(params: {
|
|
cfg: OpenClawConfig;
|
|
agentId?: string;
|
|
}): Promise<MemoryIndexManager> {
|
|
await import("./embedding.test-mocks.js");
|
|
const { getMemorySearchManager } = await import("./index.js");
|
|
const result = await getMemorySearchManager({
|
|
cfg: params.cfg,
|
|
agentId: params.agentId ?? "main",
|
|
});
|
|
if (!result.manager) {
|
|
throw new Error("manager missing");
|
|
}
|
|
if (!("sync" in result.manager) || typeof result.manager.sync !== "function") {
|
|
throw new Error("manager does not support sync");
|
|
}
|
|
return result.manager as unknown as MemoryIndexManager;
|
|
}
|