@@ -115,11 +115,12 @@ def get_cached_result(self, context: dict[str, Any]) -> dict[str, Any] | None:
115115 Returns:
116116 Cached result dict, or None if not cached
117117 """
118- if not self .has_memory () :
118+ if self .short_term_memory is None :
119119 return None
120120
121121 key = self ._cache_key (context )
122- return self .short_term_memory .retrieve (key , self ._credentials )
122+ result = self .short_term_memory .retrieve (key , self ._credentials )
123+ return dict (result ) if result else None
123124
124125 def cache_result (self , context : dict [str , Any ], result : dict [str , Any ]) -> bool :
125126 """
@@ -132,11 +133,11 @@ def cache_result(self, context: dict[str, Any], result: dict[str, Any]) -> bool:
132133 Returns:
133134 True if cached successfully
134135 """
135- if not self .has_memory () :
136+ if self .short_term_memory is None :
136137 return False
137138
138139 key = self ._cache_key (context )
139- return self .short_term_memory .stash (key , result , self ._credentials )
140+ return bool ( self .short_term_memory .stash (key , result , self ._credentials ) )
140141
141142 async def analyze_with_cache (self , context : dict [str , Any ]) -> dict [str , Any ]:
142143 """
@@ -183,18 +184,20 @@ def share_context(self, key: str, data: Any) -> bool:
183184 Returns:
184185 True if shared successfully
185186 """
186- if not self .has_memory () :
187+ if self .short_term_memory is None :
187188 return False
188189
189190 # Use global credentials for shared context (accessible to all wizards)
190191 global_creds = AgentCredentials (
191192 agent_id = "wizard_shared" ,
192193 tier = AccessTier .CONTRIBUTOR ,
193194 )
194- return self .short_term_memory .stash (
195- f"shared:{ key } " ,
196- data ,
197- global_creds ,
195+ return bool (
196+ self .short_term_memory .stash (
197+ f"shared:{ key } " ,
198+ data ,
199+ global_creds ,
200+ )
198201 )
199202
200203 def get_shared_context (self , key : str , from_wizard : str | None = None ) -> Any | None :
@@ -212,7 +215,7 @@ def get_shared_context(self, key: str, from_wizard: str | None = None) -> Any |
212215 Returns:
213216 The shared data, or None if not found
214217 """
215- if not self .has_memory () :
218+ if self .short_term_memory is None :
216219 return None
217220
218221 # Use global shared namespace by default, or specific wizard if requested
@@ -249,7 +252,7 @@ def stage_discovered_pattern(
249252 Returns:
250253 True if staged successfully
251254 """
252- if not self .has_memory () :
255+ if self .short_term_memory is None :
253256 return False
254257
255258 pattern = StagedPattern (
@@ -263,7 +266,7 @@ def stage_discovered_pattern(
263266 context = {"wizard" : self .name , "level" : self .level },
264267 )
265268
266- return self .short_term_memory .stage_pattern (pattern , self ._credentials )
269+ return bool ( self .short_term_memory .stage_pattern (pattern , self ._credentials ) )
267270
268271 def send_signal (self , signal_type : str , data : dict ) -> bool :
269272 """
@@ -278,11 +281,13 @@ def send_signal(self, signal_type: str, data: dict) -> bool:
278281 Returns:
279282 True if sent successfully
280283 """
281- if not self .has_memory () :
284+ if self .short_term_memory is None :
282285 return False
283286
284- return self .short_term_memory .send_signal (
285- signal_type = signal_type ,
286- data = {"wizard" : self .name , ** data },
287- credentials = self ._credentials ,
287+ return bool (
288+ self .short_term_memory .send_signal (
289+ signal_type = signal_type ,
290+ data = {"wizard" : self .name , ** data },
291+ credentials = self ._credentials ,
292+ )
288293 )
0 commit comments