Class AnahataToolkit

java.lang.Object
uno.anahata.asi.agi.tool.ToolContext
uno.anahata.asi.agi.tool.AnahataToolkit
All Implemented Interfaces:
ContextProvider, PropertyChangeSource, Rebindable
Direct Known Subclasses:
AbstractBrowser, AsiContainer, Audio, BatchCodeRefiner, BatchCodeRefiner, Benchmarks, CodeModel, CodeModel, CodeRefiner, CodeRefiner, Debugger, Editor, Editor, Gradle, Hints, Hints, History, Host, IDE, IDE, Java, Maven, Maven, NbTerminal, Projects, Projects, Radio, Refactor, Refactor, Resources, RunConfigurations, Screens, Session, Shell, Speech, Terminals, Vcs, YouTube

public abstract class AnahataToolkit extends ToolContext implements ContextProvider, Rebindable, PropertyChangeSource
The base class for all AI toolkits. It integrates the tool execution context with the hierarchical context provider system, allowing toolkits to natively contribute system instructions and RAG data.

This class is designed for autonomy: toolkits manage their own state and can notify the UI of changes via the PropertyChangeSource interface.

Author:
anahata
  • Field Details

    • providing

      private boolean providing
      Whether this toolkit is currently providing context augmentation.
    • propertyChangeSupport

      protected transient PropertyChangeSupport propertyChangeSupport
      Support for firing property change events. Marked transient to avoid serializing listeners.
    • childrenProviders

      protected List<ContextProvider> childrenProviders
      The list of child context providers managed by this toolkit. Uses CopyOnWriteArrayList for thread-safe concurrent access during IDE events.
  • Constructor Details

    • AnahataToolkit

      public AnahataToolkit()
  • Method Details

    • isEffectivelyProviding

      public boolean isEffectivelyProviding()
      Override to also take into consideration the AbstractToolkit.enabled
      Specified by:
      isEffectivelyProviding in interface ContextProvider
      Returns:
      true if the providing flag is true and the toolkit is enabled
    • initialize

      public void initialize()
      Performs initial setup for a newly created toolkit instance.

      This method is called exactly once by the ToolManager after the toolkit has been instantiated and registered. It provides a clean hook for toolkits to perform one-time initialization logic that requires the tool environment to be fully configured, such as scanning for project instructions or registering default resources.

    • rebind

      public void rebind()
      Rebinds the toolkit after deserialization.

      This method is called by the framework during session activation to restore transient state, reconnect listeners, or refresh cached project instances. It ensures the propertyChangeSupport is re-initialized.

      Specified by:
      rebind in interface Rebindable
    • postActivate

      public void postActivate()
      Callback method triggered by the Asi Container once the Agi session has been fully deserialized and associated to the ASI container.
    • getId

      public String getId()
      Gets the unique identifier for this context provider.
      Specified by:
      getId in interface ContextProvider
      Returns:
      The provider's ID.
    • getName

      public String getName()
      Gets the human-readable name of this context provider.
      Specified by:
      getName in interface ContextProvider
      Returns:
      The provider's name.
    • getDescription

      public String getDescription()
      Gets a detailed description of what this context provider does.
      Specified by:
      getDescription in interface ContextProvider
      Returns:
      The provider's description.
    • getParentProvider

      public ContextProvider getParentProvider()
      Gets the parent context provider in the hierarchy, if any.
      Specified by:
      getParentProvider in interface ContextProvider
      Returns:
      The parent provider, or null if this is a root provider.
    • getChildrenProviders

      public List<ContextProvider> getChildrenProviders()
      Gets the list of immediate child context providers.
      Specified by:
      getChildrenProviders in interface ContextProvider
      Returns:
      The list of children, or an empty list if none.
    • getPropertyChangeSupport

      public PropertyChangeSupport getPropertyChangeSupport()
      Gets the PropertyChangeSupport instance for this object.
      Specified by:
      getPropertyChangeSupport in interface PropertyChangeSource
      Returns:
      The PropertyChangeSupport.