fix: restore v3 search response format — return {results: [...]} not bare array

The v3 API returns {results: [...]} and the client should pass that
through without unwrapping. Updated return type to Promise<{results: Array<Memory>}>,
removed the unwrap logic, and fixed integration tests to access .results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Soumil Rathi
2026-04-13 13:25:25 -07:00
co-authored by Claude Opus 4.6
parent 0aa0f44ac4
commit 2da2ded2d8
3 changed files with 9 additions and 9 deletions
+2 -3
View File
@@ -280,7 +280,7 @@ export default class MemoryClient {
async search(
query: string,
options?: SearchMemoryOptions,
): Promise<Array<Memory>> {
): Promise<{ results: Array<Memory> }> {
if (this.telemetryId === "") await this.ping();
const payloadKeys = Object.keys(options || {});
this._captureEvent("search", [payloadKeys]);
@@ -298,8 +298,7 @@ export default class MemoryClient {
body: JSON.stringify(payload),
},
);
// Unwrap v1.1 format: { results: [...] } → [...]
return Array.isArray(response) ? response : (response?.results ?? response);
return response;
}
async delete(memoryId: string): Promise<{ message: string }> {