mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 16:14:31 +00:00
refactor(core): dedupe shared config and runtime helpers
This commit is contained in:
19
src/memory/test-manager-helpers.ts
Normal file
19
src/memory/test-manager-helpers.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { getMemorySearchManager, type MemoryIndexManager } from "./index.js";
|
||||
|
||||
export async function getRequiredMemoryIndexManager(params: {
|
||||
cfg: OpenClawConfig;
|
||||
agentId?: string;
|
||||
}): Promise<MemoryIndexManager> {
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user