@@ -8,7 +8,7 @@ use tinymemory_api::recall::RecallOpts;
88use tinymemory_api:: traits:: Memory ;
99use tinymemory_api:: types:: MemoryTaint ;
1010
11- use crate :: common:: { stable_id, Dialect , HttpClient , RemoteMemory , StoredEntry } ;
11+ use crate :: common:: { stable_id, Attempts , Dialect , HttpClient , RemoteMemory , StoredEntry } ;
1212
1313/// Stable driver id used by configuration and status output.
1414pub use tinymemory_api:: drivers:: COGNEE_DRIVER_ID ;
@@ -20,6 +20,26 @@ pub struct CogneeMemory {
2020}
2121
2222impl CogneeMemory {
23+ /// Rebuilds the HTTP transport with a different per-request deadline
24+ /// (issue #18 follow-up U5). The default is 60s with a 10s connect
25+ /// deadline — right for interactive calls; a bulk migration or a tight
26+ /// liveness probe may want its own budget.
27+ ///
28+ /// # Errors
29+ ///
30+ /// Fails only if the underlying HTTP client cannot be rebuilt — a
31+ /// configuration-time failure, before any request is made.
32+ pub fn with_request_timeout ( mut self , timeout : std:: time:: Duration ) -> anyhow:: Result < Self > {
33+ let client = self
34+ . inner
35+ . dialect_mut ( )
36+ . client
37+ . clone ( )
38+ . with_timeout ( timeout) ?;
39+ self . inner . dialect_mut ( ) . client = client;
40+ Ok ( self )
41+ }
42+
2343 /// Connect to a self-hosted Cognee server.
2444 ///
2545 /// `access_token` is sent as a bearer token. Local deployments with
@@ -152,6 +172,13 @@ impl Memory for CogneeMemory {
152172 async fn health_check ( & self ) -> bool {
153173 self . inner . health_check ( ) . await
154174 }
175+ /// Forwarded explicitly: this wrapper delegates method-by-method, so the
176+ /// defaulted `None` would otherwise shadow `RemoteMemory`'s typed probe —
177+ /// which is exactly what the first cut shipped, making §U4's deep health
178+ /// unreachable through every public type (the #68 review's Major 1).
179+ async fn health_probe ( & self ) -> Option < tinymemory_api:: health:: MemoryHealth > {
180+ self . inner . health_probe ( ) . await
181+ }
155182}
156183
157184#[ derive( Debug ) ]
@@ -181,7 +208,12 @@ impl CogneeDialect {
181208 async fn datasets ( & self ) -> anyhow:: Result < Vec < Dataset > > {
182209 let response: Value = self
183210 . client
184- . json ( Method :: GET , "api/v1/datasets/" , None )
211+ . json (
212+ Method :: GET ,
213+ "api/v1/datasets/" ,
214+ None ,
215+ Attempts :: RetryTransient ,
216+ )
185217 . await ?;
186218 Ok ( response
187219 . as_array ( )
@@ -205,6 +237,7 @@ impl CogneeDialect {
205237 Method :: GET ,
206238 & format ! ( "api/v1/datasets/{}/data" , dataset. id) ,
207239 None ,
240+ Attempts :: RetryTransient ,
208241 )
209242 . await ?;
210243 let mut entries = Vec :: new ( ) ;
@@ -225,6 +258,7 @@ impl CogneeDialect {
225258 . text (
226259 Method :: GET ,
227260 & format ! ( "api/v1/datasets/{}/data/{id}/raw" , dataset. id) ,
261+ Attempts :: RetryTransient ,
228262 )
229263 . await ?;
230264 let mut entry: StoredEntry =
@@ -356,6 +390,7 @@ impl Dialect for CogneeDialect {
356390 "only_context" : true ,
357391 "session_id" : opts. session_id
358392 } ) ) ,
393+ Attempts :: RetryTransient ,
359394 )
360395 . await ?;
361396 let mut entries = Vec :: new ( ) ;
@@ -402,9 +437,17 @@ impl Dialect for CogneeDialect {
402437 Ok ( true )
403438 }
404439
405- /// Checks Cognee's aggregate health endpoint.
406- async fn health ( & self ) -> bool {
407- self . client . healthy ( "health" ) . await
440+ /// Probes Cognee's aggregate health endpoint, typed.
441+ async fn health ( & self ) -> anyhow:: Result < ( ) > {
442+ self . client . probe ( "health" ) . await
443+ }
444+
445+ /// Context-only recall carries no score field — see the trait doc for
446+ /// what this means for `min_score` (documented-inert, not everything-
447+ /// dropping; the first cut's over-fetch pulled 3x the data and discarded
448+ /// all of it).
449+ fn scores_recall ( & self ) -> bool {
450+ false
408451 }
409452}
410453
0 commit comments