Class StatusManager
java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.status.StatusManager
- All Implemented Interfaces:
PropertyChangeSource, Rebindable
Manages and broadcasts the real-time operational status of an Agi session.
This manager acts as the 'Voice of Anahata', utilizing a PropertyChangeSource
to provide reactive updates to the UI layer. It tracks state transitions,
performance metrics, and coordinates the retry logic for API failures.
- Author:
- anahata
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AgiThe orchestrator session instance managed by this status tracker.private final List<ApiErrorRecord> List of all recorded API errors captured during this session.private longThe current active backoff duration in milliseconds for transient API retries.private AgiStatusThe current real-time operational status of the AGI session.private longThe duration of the last completed execution phase, in milliseconds.private longThe epoch timestamp of the most recent status transition.Fields inherited from class BasicPropertyChangeSource
propertyChangeSupport -
Constructor Summary
ConstructorsConstructorDescriptionStatusManager(@NonNull Agi agi) Constructs a new StatusManager bound to an active Agi session. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all recorded API errors.voidfireApiError(ApiErrorRecord errorRecord, AgiStatus status, String detailMessage) Records an API error and sets the agi status.voidfireStatusChanged(AgiStatus newStatus) Fires a status change event.voidfireStatusChanged(AgiStatus newStatus, String detailMessage) Fires a status change event, optionally with a detail message.Gets an unmodifiable list of all recorded API errors.voidreset()Resets the status manager to its initial state.Methods inherited from class BasicPropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, rebind, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PropertyChangeSource
getPropertyChangeSupport
-
Field Details
-
agi
The orchestrator session instance managed by this status tracker. -
apiErrors
List of all recorded API errors captured during this session. -
currentStatus
The current real-time operational status of the AGI session. -
statusChangeTime
private long statusChangeTimeThe epoch timestamp of the most recent status transition. -
lastOperationDuration
private long lastOperationDurationThe duration of the last completed execution phase, in milliseconds. -
currentBackoffAmount
private long currentBackoffAmountThe current active backoff duration in milliseconds for transient API retries.
-
-
Constructor Details
-
StatusManager
Constructs a new StatusManager bound to an active Agi session.- Parameters:
agi- The active Agi orchestrator.
-
-
Method Details
-
fireStatusChanged
Fires a status change event.- Parameters:
newStatus- The new status.
-
fireStatusChanged
-
fireApiError
Records an API error and sets the agi status.- Parameters:
errorRecord- The ApiErrorRecord to record.status- The new agi status to set.detailMessage- A detail message for the status change.
-
getApiErrors
Gets an unmodifiable list of all recorded API errors.- Returns:
- The list of errors.
-
clearApiErrors
public void clearApiErrors()Clears all recorded API errors. This should be called upon a successful API response. -
reset
public void reset()Resets the status manager to its initial state.
-

