java-client: extend LongTermMemoryService to take TagFilters as params#310
java-client: extend LongTermMemoryService to take TagFilters as params#310lygaret wants to merge 1 commit into
Conversation
currently, `namespace`, `userId`, `sessionId`, `topics`, and `entities` are hard coded into the LongTermMemoryService's search request as strings (for `eq`),or lists-of-strings (for `any`). replace them with a new `TagFilter` class, which mirrors the filter definitions in the server and other client just encodes the query into the JSON the server see: agent-memory-server/agent_memory_server/models.py SearchRequest see: agent-memory-client/agent-memory-client-js/src/models.ts SearchRequestParams
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 457057f. Configure here.
|
|
||
| public static TagFilter all(@NotNull String... values) { | ||
| return all(Arrays.asList(values)); | ||
| } |
There was a problem hiding this comment.
Empty any/all filters rejected
Medium Severity
TagFilter.any and TagFilter.all accept empty lists (including zero-arg varargs), producing JSON such as {"any":[]}. The server TagFilter rejects empty any/all lists, so searches built this way fail validation. List-based SearchRequest helpers omit empty topic/entity lists, but the TagFilter path does not.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 457057f. Configure here.
|
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |


currently,
namespace,userId,sessionId,topics, andentitiesare hard coded into the LongTermMemoryService's search request as strings (foreq),or lists-of-strings (forany).replace them with a new
TagFilterclass, which mirrors the filter definitions in the server and other client just encodes the query into the JSON the serversee: agent-memory-server/agent_memory_server/models.py SearchRequest
see: agent-memory-client/agent-memory-client-js/src/models.ts SearchRequestParams
Note
Medium Risk
Changes public SearchRequest getter types to TagFilter, which can break compile-time callers that expected String or List; runtime search JSON should stay compatible for existing string/list builder usage.
Overview
Adds a
TagFiltermodel to the Java client so long-term memory search can express the same tag operators as the server (eq,ne,any,all,startswith).SearchRequestnow storesuser_id,session_id,namespace,topics, andentitiesasTagFilterinstead of plain strings or string lists. Overloaded setters and builder methods still accept strings andList<String>and map them toTagFilter.eq/TagFilter.any, so existing call sites keep working while new code can pass richer filters (e.g.TagFilter.any("user-123", "__account__")orstartsWithon namespace).LongTermMemoryService.searchLongTermMemoriesstops wrapping filters in ad-hocMap.of("eq", …)/Map.of("any", …)and serializesTagFilterdirectly; the default namespace fallback usesTagFilter.eq. Tests cover Jackson serialization and HTTP request bodies for the new operators.Reviewed by Cursor Bugbot for commit 457057f. Bugbot is set up for automated code reviews on this repo. Configure here.