Class OpenToolWindowsContextProvider

java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.context.BasicContextProvider
uno.anahata.asi.intellij.tools.ide.context.OpenToolWindowsContextProvider
All Implemented Interfaces:
ContextProvider, PropertyChangeSource, Rebindable

public class OpenToolWindowsContextProvider extends BasicContextProvider
Injects a live snapshot of the IntelliJ windowing system — every registered tool window per open project, flagged with its visible/active state — into the RAG message.

This is the IntelliJ analogue of the NetBeans OpenTopComponentsContextProvider. Tool-window state is read on the EDT because ToolWindow.isVisible() and ToolWindow.isActive() are UI-model queries, while context is assembled on a background AI thread.

Author:
anahata
  • Constructor Details

    • OpenToolWindowsContextProvider

      public OpenToolWindowsContextProvider()
      Constructs the tool-windows context provider with a stable id and label.
  • Method Details

    • populateMessage

      public void populateMessage(RagMessage ragMessage) throws Exception
      Populates the given RagMessage with dynamic, just-in-time context parts. These parts are appended to the end of the user's prompt (RAG).

      Renders a Markdown table (Tool Window | Project | Visible | Active) covering all registered tool windows across every open project.

      Parameters:
      ragMessage - The message to be augmented with context.
      Throws:
      Exception - if an error occurs during context generation.