Package uno.anahata.ai.context


package uno.anahata.ai.context
Provides the core classes and subpackages for managing the chat conversation's state and history.

This package is the heart of the client's state management. It is responsible for maintaining the history of the conversation, handling session persistence, tracking stateful resources, and performing context pruning to manage token limits.

Core Components:

  • ContextManager: The central orchestrator for all context-related activities. It holds the list of ChatMessages and delegates specialized tasks such as session management, resource tracking, and pruning to dedicated components in its subpackages.
  • ContextListener: A simple interface that allows other components (like the UI) to listen for and react to any changes in the chat context, ensuring the view is always synchronized with the state.

Subpackages:

  • provider: Contains interfaces and implementations for providers that supply just-in-time, high-salience context to the model on each turn.
  • pruning: Implements the logic for intelligently removing parts or entire messages from the context to stay within token limits.
  • session: Handles the saving and loading of entire chat sessions using Kryo serialization.
  • stateful: Provides the framework for tracking and managing local resources (like files) that have a persistent state outside the chat context itself.
  • Class
    Description
    A listener interface for receiving notifications about changes in the conversation context.
    Manages the conversation context (history) for a Chat session.