Class SwingJava
java.lang.Object
uno.anahata.asi.agi.tool.ToolContext
uno.anahata.asi.agi.tool.AnahataToolkit
uno.anahata.asi.toolkit.java.Java
uno.anahata.asi.swing.toolkit.SwingJava
- All Implemented Interfaces:
ContextProvider, PropertyChangeSource, Rebindable
- Direct Known Subclasses:
IntellijJava, NbJava
An extension of the
Java toolkit that provides Swing-specific
execution utilities, such as EDT synchronization with context propagation.
This toolkit ensures that code running on the Event Dispatch Thread (EDT) can still access the tool execution context (logs, errors, attachments) by capturing and re-applying the thread-local state.
- Author:
- anahata
-
Field Summary
Fields inherited from class Java
classpathPrinter, defaultCompilerClasspath, parentFirstClassessFields inherited from class AnahataToolkit
childrenProviders, propertyChangeSupportFields inherited from class ToolContext
toolkit -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance of the toolkit and adds SwingAgiTool to the list of parentFirstClassess. -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<? extends ToolContext> The class the model should extend when generating Agi tools.Gets a list of system instruction strings provided by this context provider.Methods inherited from class Java
addParentFirstClasses, appendMethods, compile, compileAndExecute, createClassPathPrinter, findClassFallbackBytes, getClasspathPrinter, getDefaultClasspath, getExtraClassLoaders, getPrettyPrintedDefaultClasspath, getSystemProperties, initialize, populateMessage, postActivate, registerParentFirstClass, removeParentFirstClasses, setDefaultClasspathMethods inherited from class AnahataToolkit
getChildrenProviders, getDescription, getId, getName, getParentProvider, getPropertyChangeSupport, isEffectivelyProviding, rebindMethods inherited from class ToolContext
addAttachment, addAttachment, addAttachment, error, error, getAgi, getApplicationMap, getAsiContainer, getAsiContainerMap, getCall, getExecutorService, getModelId, getModelMessage, getResourceManager, getResponse, getSessionMap, getThreadSafeLogger, getTool, getToolContext, getToolkit, getToolManager, getTurnMap, isToolExecution, log, peekResponse, runAsyncMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContextProvider
getAgi, getContextPosition, getFlattenedHierarchy, getFullyQualifiedId, getHeader, getIconId, getInstructionsTokenCount, getRagTokenCount, isProviding, setParentProvider, setProviding
-
Constructor Details
-
SwingJava
public SwingJava()Constructs a new instance of the toolkit and adds SwingAgiTool to the list of parentFirstClassess.
-
-
Method Details
-
getSystemInstructions
Gets a list of system instruction strings provided by this context provider. These are typically prepended to the conversation as high-level guidance.Injects Swing-specific execution helpers into the system instructions, enabling the model to use
runInEdtandrunInEdtAndWaitfor safe UI interactions.- Specified by:
getSystemInstructionsin interfaceContextProvider- Overrides:
getSystemInstructionsin classJava- Returns:
- A list of system instruction strings.
- Throws:
Exception- if an error occurs during instruction generation.
-
getConcreteClassModelShouldExtend
The class the model should extend when generating Agi tools.In this base implementation, it returns
OnTheFlyAgiTool, which provides the necessary context anchors (log, error, etc.) for the script.Configures the code generator to produce classes extending
SwingAgiTool, which provides the necessary plumbing for EDT-aware context propagation.- Overrides:
getConcreteClassModelShouldExtendin classJava- Returns:
- the base AgiTool class.
-

