Class ContextManagerNode

java.lang.Object
uno.anahata.asi.swing.agi.context.AbstractContextNode<ContextManager>
uno.anahata.asi.swing.agi.context.ContextManagerNode

public class ContextManagerNode extends AbstractContextNode<ContextManager>
The root node of the context tree, representing the ContextManager. It aggregates all top-level providers and the conversation history.
Author:
anahata
  • Constructor Details

    • ContextManagerNode

      public ContextManagerNode(AgiPanel agiPanel, ContextManager userObject)
      Constructs a new ContextManagerNode.
      Parameters:
      agiPanel - The parent agi panel.
      userObject - The context manager to wrap.
  • Method Details

    • getName

      public String getName()
      Gets the human-readable display name for this node.

      Implementation details: Returns the static identifier "Context Manager", marking this node as the root of the AGI's environmental awareness.

      Specified by:
      getName in class AbstractContextNode<ContextManager>
      Returns:
      The name to be displayed in the tree.
    • getDescription

      public String getDescription()
      Gets a detailed description of the node's purpose or content.

      Implementation details: Provides a high-level overview of the root orchestrator's role in maintaining the conversation and provider state.

      Specified by:
      getDescription in class AbstractContextNode<ContextManager>
      Returns:
      The description string.
    • fetchChildObjects

      protected List<?> fetchChildObjects()
      Fetches the current list of domain objects that should be represented as children of this node.

      Implementation details: Aggregates all registered ContextProviders (excluding toolkits) and injects the manager itself to represent the conversation history branch.

      Specified by:
      fetchChildObjects in class AbstractContextNode<ContextManager>
      Returns:
      A list of domain objects.
    • createChildNode

      protected AbstractContextNode<?> createChildNode(Object obj)
      Creates a new child node for the given domain object.

      Implementation details: Maps domain-level orchestrators to their specialized context nodes, including ResourcesNode and HistoryNode.

      Specified by:
      createChildNode in class AbstractContextNode<ContextManager>
      Parameters:
      obj - The domain object to wrap.
      Returns:
      A new AbstractContextNode, or null if the object type is not supported.
    • calculateLocalTokens

      protected void calculateLocalTokens()
      Calculates the token counts for this node's own content (excluding children).

      Implementation details: The manager node is a logical container and does not contribute tokens directly. All token metrics are aggregated from its children.

      Specified by:
      calculateLocalTokens in class AbstractContextNode<ContextManager>
    • isActive

      public boolean isActive()
      Checks if the underlying domain object is currently active in the context.

      Subclasses override this method to define their specific active-state policy, allowing for clean, polymorphic evaluation without dirty instanceof chains.

      Specified by:
      isActive in class AbstractContextNode<ContextManager>
      Returns:
      true if active, false otherwise.
    • updateStatus

      protected void updateStatus()
      Updates the status string for this node.

      Implementation details: Fixed to "Providing" as the manager is always the active source of the AGI's context.

      Specified by:
      updateStatus in class AbstractContextNode<ContextManager>