diff --git a/memind-clients/java/memind-client/src/main/java/com/openmemind/ai/client/MemindClient.java b/memind-clients/java/memind-client/src/main/java/com/openmemind/ai/client/MemindClient.java index 1ec62d9a..f066b2e3 100644 --- a/memind-clients/java/memind-client/src/main/java/com/openmemind/ai/client/MemindClient.java +++ b/memind-clients/java/memind-client/src/main/java/com/openmemind/ai/client/MemindClient.java @@ -26,6 +26,7 @@ import com.openmemind.ai.client.model.response.AddMessageResponse; import com.openmemind.ai.client.model.response.ExtractMemoryResponse; import com.openmemind.ai.client.model.response.HealthResponse; +import com.openmemind.ai.client.model.response.OperationAccepted; import com.openmemind.ai.client.model.response.QueryMemoryItemsResponse; import com.openmemind.ai.client.model.response.QueryMemoryRawDataResponse; import com.openmemind.ai.client.model.response.RetrieveMemoryResponse; @@ -134,6 +135,40 @@ public CompletableFuture queryRawDataAsync( new TypeReference>() {}); } + /** + * Fire-and-forget: submits a message to the async pipeline + * ({@code POST /open/v1/memory/async/add-message}). + * + *

The server buffers the message and returns 202 immediately; extraction is + * triggered asynchronously by the server's boundary detector. Unlike + * {@link #addMessageAsync(AddMessageRequest)}, this does not block waiting for the + * synchronous extraction path. + */ + public CompletableFuture submitMessageAsync(AddMessageRequest request) { + ensureOpen(); + return httpClient.post( + "/open/v1/memory/async/add-message", + Objects.requireNonNull(request, "request"), + new TypeReference>() {}) + .thenApply(ignored -> null); + } + + /** + * Fire-and-forget: submits a commit to the async pipeline + * ({@code POST /open/v1/memory/async/commit}). + * + *

Returns 202 immediately; extraction runs asynchronously server-side. Use this to + * avoid blocking on long LLM-driven extraction (the sync commit can exceed HTTP timeouts). + */ + public CompletableFuture submitCommitAsync(CommitMemoryRequest request) { + ensureOpen(); + return httpClient.post( + "/open/v1/memory/async/commit", + Objects.requireNonNull(request, "request"), + new TypeReference>() {}) + .thenApply(ignored -> null); + } + public CompletableFuture healthAsync() { ensureOpen(); return httpClient.get("/open/v1/health", new TypeReference>() {}); diff --git a/memind-clients/java/memind-client/src/main/java/com/openmemind/ai/client/model/response/OperationAccepted.java b/memind-clients/java/memind-client/src/main/java/com/openmemind/ai/client/model/response/OperationAccepted.java new file mode 100644 index 00000000..1df0821c --- /dev/null +++ b/memind-clients/java/memind-client/src/main/java/com/openmemind/ai/client/model/response/OperationAccepted.java @@ -0,0 +1,20 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.openmemind.ai.client.model.response; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** Response payload of the async /open/v1/memory/async/* endpoints (HTTP 202). */ +@JsonIgnoreProperties(ignoreUnknown = true) +public record OperationAccepted(String operationId, String status, String mode) {}