
    %jU1                        d Z ddlmZ ddlmZ ddlmZ  G d d          Z G d d          Z G d	 d
          Z	 G d d          Z
 G d de          ZdS )z
Wrapper for Hindsight client that adds API namespaces.

Provides organized access to different parts of the Hindsight API through
namespaces like .banks, .mental_models, etc.
    )annotations)Any)	Hindsightc                  J    e Zd ZdZddZ	 	 	 dddZddZddZddZddZ	dS )BanksAPIzqNamespace for bank-related operations.
    
    Provides methods to create, delete, and manage memory banks.
    clientr   c                    || _         d S N_clientselfr   s     `/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/hindsight/client_wrapper.py__init__zBanksAPI.__init__           Nbank_idstrname
str | Nonemissiondispositiondict[str, Any] | Nonereturnr   c                >    | j                             ||||          S )al  Create a new bank.
        
        Args:
            bank_id: Unique identifier for the bank.
            name: Optional display name for the bank.
            mission: Optional mission statement for the bank.
            disposition: Optional disposition configuration dict.
            
        Returns:
            Bank creation response from the API.
        )r   r   r   r   )r   create_bank)r   r   r   r   r   s        r   createzBanksAPI.create   s/    $ |''#	 ( 
 
 	
r   c                8    | j                             |          S )zDelete a bank.
        
        Args:
            bank_id: The ID of the bank to delete.
            
        Returns:
            Deletion response from the API.
        )r   )r   delete_bank)r   r   s     r   deletezBanksAPI.delete1   s     |'''888r   c                :    | j                             ||          S )zSet or update the mission for a bank.
        
        Args:
            bank_id: The ID of the bank.
            mission: The mission statement to set.
            
        Returns:
            API response confirming the update.
        )r   r   )r   set_mission)r   r   r   s      r   r"   zBanksAPI.set_mission<   s     |'''IIIr   dict[str, Any]c                :    | j                             ||          S )zSet or update the disposition for a bank.
        
        Args:
            bank_id: The ID of the bank.
            disposition: The disposition configuration dict.
            
        Returns:
            API response confirming the update.
        )r   r   )r   set_disposition)r   r   r   s      r   r%   zBanksAPI.set_dispositionH   s     |++G+UUUr   c                \    ddl m}  || j        j                                                  S )zZList all banks.
        
        Returns:
            List of banks from the API.
        r   )
_run_async)!hindsight_client.hindsight_clientr'   r   
_banks_api
list_banks)r   r'   s     r   listzBanksAPI.listT   s8     	A@@@@@z$,1<<>>???r   r   r   NNN)
r   r   r   r   r   r   r   r   r   r   )r   r   r   r   )r   r   r   r   r   r   )r   r   r   r#   r   r   )r   r   )
__name__
__module____qualname____doc__r   r   r    r"   r%   r+    r   r   r   r      s         
     "-1
 
 
 
 
2	9 	9 	9 	9
J 
J 
J 
J
V 
V 
V 
V@ @ @ @ @ @r   r   c                  X    e Zd ZdZddZ	 dddZdddZddZddZ	 	 	 dddZ	ddZ
dS )MentalModelsAPIzNamespace for mental model operations.
    
    Mental models are reusable knowledge structures that guide agent behavior.
    r   r   c                    || _         d S r
   r   r   s     r   r   zMentalModelsAPI.__init__e   r   r   Nr   r   r   contenttagslist[str] | Noner   r   c                >    | j                             ||||          S )an  Create a new mental model.
        
        Args:
            bank_id: The ID of the bank to add the model to.
            name: Name for the mental model.
            content: The content/instructions for the mental model.
            tags: Optional list of tags for categorization.
            
        Returns:
            Creation response from the API.
        r   r   r6   r7   )r   create_mental_modelr   r   r   r6   r7   s        r   r   zMentalModelsAPI.createh   s/    $ |//	 0 
 
 	
r   c                :    | j                             ||          S )zList all mental models for a bank.
        
        Args:
            bank_id: The ID of the bank.
            tags: Optional filter by tags.
            
        Returns:
            List of mental models.
        r   r7   )r   list_mental_modelsr   r   r7   s      r   r+   zMentalModelsAPI.list   s     |..wT.JJJr   mental_model_idc                :    | j                             ||          S )zGet a specific mental model.
        
        Args:
            bank_id: The ID of the bank.
            mental_model_id: The ID of the mental model.
            
        Returns:
            The mental model details.
        r   rA   )r   get_mental_modelr   r   rA   s      r   getzMentalModelsAPI.get   s     |,,Wo,^^^r   c                :    | j                             ||          S )zRefresh a mental model.
        
        Args:
            bank_id: The ID of the bank.
            mental_model_id: The ID of the mental model to refresh.
            
        Returns:
            Refresh response from the API.
        rC   )r   refresh_mental_modelrE   s      r   refreshzMentalModelsAPI.refresh   s      |00Ra0bbbr   r   c                @    | j                             |||||          S )ad  Update a mental model.
        
        Args:
            bank_id: The ID of the bank.
            mental_model_id: The ID of the mental model to update.
            name: Optional new name.
            content: Optional new content.
            tags: Optional new tags list.
            
        Returns:
            Update response from the API.
        )r   rA   r   r6   r7   )r   update_mental_model)r   r   rA   r   r6   r7   s         r   updatezMentalModelsAPI.update   s2    ( |//+ 0 
 
 	
r   c                :    | j                             ||          S )zDelete a mental model.
        
        Args:
            bank_id: The ID of the bank.
            mental_model_id: The ID of the mental model to delete.
            
        Returns:
            Deletion response from the API.
        rC   )r   delete_mental_modelrE   s      r   r    zMentalModelsAPI.delete   s      |//Q`/aaar   r,   r
   
r   r   r   r   r6   r   r7   r8   r   r   r   r   r7   r8   r   r   )r   r   rA   r   r   r   r-   )r   r   rA   r   r   r   r6   r   r7   r8   r   r   )r.   r/   r0   r1   r   r   r+   rF   rI   rL   r    r2   r   r   r4   r4   _   s         
    "&
 
 
 
 
2
K 
K 
K 
K 
K
_ 
_ 
_ 
_
c 
c 
c 
c   "!%
 
 
 
 
8
b 
b 
b 
b 
b 
br   r4   c                  P    e Zd ZdZddZ	 dddZdddZddZ	 	 	 dddZddZ	dS )DirectivesAPIzqNamespace for directive operations.
    
    Directives are explicit instructions that guide agent behavior.
    r   r   c                    || _         d S r
   r   r   s     r   r   zDirectivesAPI.__init__   r   r   Nr   r   r   r6   r7   r8   r   r   c                >    | j                             ||||          S )aa  Create a new directive.
        
        Args:
            bank_id: The ID of the bank to add the directive to.
            name: Name for the directive.
            content: The directive content/instructions.
            tags: Optional list of tags for categorization.
            
        Returns:
            Creation response from the API.
        r:   )r   create_directiver<   s        r   r   zDirectivesAPI.create   s/    $ |,,	 - 
 
 	
r   c                :    | j                             ||          S )zList all directives for a bank.
        
        Args:
            bank_id: The ID of the bank.
            tags: Optional filter by tags.
            
        Returns:
            List of directives.
        r>   )r   list_directivesr@   s      r   r+   zDirectivesAPI.list   s     |++G$+GGGr   directive_idc                :    | j                             ||          S )zGet a specific directive.
        
        Args:
            bank_id: The ID of the bank.
            directive_id: The ID of the directive.
            
        Returns:
            The directive details.
        r   rX   )r   get_directiver   r   rX   s      r   rF   zDirectivesAPI.get   s     |))')UUUr   r   c                @    | j                             |||||          S )a[  Update a directive.
        
        Args:
            bank_id: The ID of the bank.
            directive_id: The ID of the directive to update.
            name: Optional new name.
            content: Optional new content.
            tags: Optional new tags list.
            
        Returns:
            Update response from the API.
        )r   rX   r   r6   r7   )r   update_directive)r   r   rX   r   r6   r7   s         r   rL   zDirectivesAPI.update  s2    ( |,,% - 
 
 	
r   c                :    | j                             ||          S )zDelete a directive.
        
        Args:
            bank_id: The ID of the bank.
            directive_id: The ID of the directive to delete.
            
        Returns:
            Deletion response from the API.
        rZ   )r   delete_directiver\   s      r   r    zDirectivesAPI.delete$  s     |,,W<,XXXr   r,   r
   rO   rP   )r   r   rX   r   r   r   r-   )r   r   rX   r   r   r   r6   r   r7   r8   r   r   )
r.   r/   r0   r1   r   r   r+   rF   rL   r    r2   r   r   rR   rR      s         
    "&
 
 
 
 
2
H 
H 
H 
H 
H
V 
V 
V 
V   "!%
 
 
 
 
8
Y 
Y 
Y 
Y 
Y 
Yr   rR   c                  ,    e Zd ZdZddZ	 	 	 	 dddZdS )MemoriesAPIzfNamespace for memory operations.
    
    Provides methods to query and retrieve stored memories.
    r   r   c                    || _         d S r
   r   r   s     r   r   zMemoriesAPI.__init__7  r   r   Nd   r   r   r   typer   search_querylimitintoffsetr   r   c                @    | j                             |||||          S )a  List memories in a bank.
        
        Args:
            bank_id: The ID of the bank to query.
            type: Optional filter by memory type.
            search_query: Optional search query for filtering.
            limit: Maximum number of results to return (default: 100).
            offset: Number of results to skip for pagination (default: 0).
            
        Returns:
            List of memories matching the criteria.
        )r   re   rf   rg   ri   )r   list_memories)r   r   re   rf   rg   ri   s         r   r+   zMemoriesAPI.list:  s2    ( |))% * 
 
 	
r   r,   )NNrd   r   )r   r   re   r   rf   r   rg   rh   ri   rh   r   r   )r.   r/   r0   r1   r   r+   r2   r   r   rb   rb   1  sY         
     #'
 
 
 
 
 
 
r   rb   c                       e Zd ZdZd fdZedd	            Zedd            Zedd            Zedd            Z	 xZ
S )HindsightClienta9  
    Enhanced Hindsight client with organized API namespaces.

    This wrapper extends the auto-generated Hindsight client with organized
    access to different parts of the API through namespaces.

    Example:
        ```python
        from hindsight import HindsightClient

        client = HindsightClient(base_url="http://localhost:8888")

        # Core operations (inherited from Hindsight)
        client.retain(bank_id="test", content="Hello")
        results = client.recall(bank_id="test", query="Hello")

        # Organized API access through namespaces
        client.banks.create(bank_id="test", name="Test Bank")
        models = client.mental_models.list(bank_id="test")
        directives = client.directives.list(bank_id="test")
        memories = client.memories.list(bank_id="test")
        ```
        
    Attributes:
        banks: Namespace for bank management operations.
        mental_models: Namespace for mental model operations.
        directives: Namespace for directive operations.
        memories: Namespace for memory listing operations.
    argsr   kwargsr   Nonec                r     t                      j        |i | d | _        d | _        d | _        d | _        d S r
   )superr   _banks_namespace_mental_models_namespace_directives_namespace_memories_namespace)r   rn   ro   	__class__s      r   r   zHindsightClient.__init__v  sE    $)&)))15@D%;?"7;   r   r   c                F    | j         t          |           | _         | j         S )zxAccess bank management operations.
        
        Returns:
            BanksAPI instance for bank operations.
        )rs   r   r   s    r   bankszHindsightClient.banks}  s$      ($,TNND!$$r   r4   c                F    | j         t          |           | _         | j         S )zAccess mental model operations.
        
        Returns:
            MentalModelsAPI instance for mental model operations.
        )rt   r4   ry   s    r   mental_modelszHindsightClient.mental_models  s&     (0,;D,A,AD),,r   rR   c                F    | j         t          |           | _         | j         S )z|Access directive operations.
        
        Returns:
            DirectivesAPI instance for directive operations.
        )ru   rR   ry   s    r   
directiveszHindsightClient.directives  s&     %-)6t)<)<D&))r   rb   c                F    | j         t          |           | _         | j         S )z|Access memory listing operations.
        
        Returns:
            MemoriesAPI instance for memory operations.
        )rv   rb   ry   s    r   memorieszHindsightClient.memories  s&     #+'24'8'8D$''r   )rn   r   ro   r   r   rp   )r   r   )r   r4   )r   rR   )r   rb   )r.   r/   r0   r1   r   propertyrz   r|   r~   r   __classcell__)rw   s   @r   rm   rm   W  s         << < < < < < % % % X% - - - X- * * * X* ( ( ( X( ( ( ( (r   rm   N)r1   
__future__r   typingr   hindsight_clientr   r   r4   rR   rb   rm   r2   r   r   <module>r      sY    # " " " " "       & & & & & &M@ M@ M@ M@ M@ M@ M@ M@`lb lb lb lb lb lb lb lb^`Y `Y `Y `Y `Y `Y `Y `YF#
 #
 #
 #
 #
 #
 #
 #
LP( P( P( P( P(i P( P( P( P( P(r   