diff --git a/plugins/openclaw/openclaw/__tests__/client.test.ts b/plugins/openclaw/openclaw/__tests__/client.test.ts index cfe94089..9f90c045 100644 --- a/plugins/openclaw/openclaw/__tests__/client.test.ts +++ b/plugins/openclaw/openclaw/__tests__/client.test.ts @@ -14,6 +14,24 @@ afterEach(() => { }); describe("Group 5: Session & Backend Routing", () => { + it("passes configured retrieval memory types to the API without changing omitted filters", async () => { + const fetchMock = mockFetch(); + fetchMock.respondWith(200, { results: [] }); + const client = new MemoriaClient(buildApiConfig()); + try { + await client.retrieve({ userId: "u1", query: "type-filter", topK: 3, memoryTypes: ["episodic", "profile"] }); + expect(fetchMock.lastCall()!.body).toMatchObject({ + query: "type-filter", + top_k: 3, + memory_types: ["episodic", "profile"], + }); + await client.retrieve({ userId: "u1", query: "no-filter", topK: 2 }); + expect(fetchMock.lastCall()!.body).toEqual({ query: "no-filter", top_k: 2 }); + } finally { + client.close(); + } + }); + it("5.1 getSession with backend=api returns MemoriaHttpTransport", async () => { const fetchMock = mockFetch(); fetchMock.respondWith(200, { results: [] }); diff --git a/plugins/openclaw/openclaw/client.ts b/plugins/openclaw/openclaw/client.ts index 9240b2b9..a79d4893 100644 --- a/plugins/openclaw/openclaw/client.ts +++ b/plugins/openclaw/openclaw/client.ts @@ -387,6 +387,7 @@ export class MemoriaClient { const text = await this.callToolText(params.userId, "memory_retrieve", { query: params.query, top_k: params.topK, + memory_types: params.memoryTypes, session_id: params.sessionId, }); const memories = parseMemoryTextList(text); diff --git a/plugins/openclaw/openclaw/http-client.ts b/plugins/openclaw/openclaw/http-client.ts index 80c3f106..330eedba 100644 --- a/plugins/openclaw/openclaw/http-client.ts +++ b/plugins/openclaw/openclaw/http-client.ts @@ -133,6 +133,7 @@ export class MemoriaHttpTransport { top_k: args.top_k ?? 5, }; if (args.session_id) body.session_id = args.session_id; + if (args.memory_types !== undefined) body.memory_types = args.memory_types; const data = await this.post("/v1/memories/retrieve", body); return this.formatMemoryList(data); }