Class UserMessage
java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.message.AbstractMessage
uno.anahata.asi.agi.message.UserMessage
- All Implemented Interfaces:
PropertyChangeSource, Rebindable
- Direct Known Subclasses:
AgiUserMessage, InputUserMessage, RagMessage
Represents a conversation message originating from the end-user.
This class is the primary entry point for human intent within the Agi session.
It extends AbstractMessage to provide user-specific identity
resolution and ensures that all user-provided content is correctly typed
and attributed to the host device.
- Author:
- anahata
-
Field Summary
Fields inherited from class BasicPropertyChangeSource
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal BlobPartaddBlobPart(String mimeType, byte[] data) Creates and adds a new binary data part to this message.final BlobPartaddBlobPart(Path path) Creates and adds a new binary data part from a local file path.final TextPartaddTextPart(String text) Creates and adds a new text part to this message.Gets the ID of the device where this message was created or processed.getFrom()Gets the identity of the sender of this message.getRole()Gets the role of the entity that created this message.Methods inherited from class AbstractMessage
addPart, appendMetadata, asText, createMetadataHeader, getDepth, getEffectiveTokenCount, getIdentityLabel, getParts, getParts, getRemainingDepth, getTokenCount, isAllPinned, isAllPruned, isAnyPinned, isEffectivelyPruned, isEmpty, isGarbageCollectable, isPrunnableOrRemovable, pinAllParts, pruneAllParts, remove, removePart, resetTokenCounts, setAutoAllParts, shouldCreateMetadataMethods 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
-
Constructor Details
-
UserMessage
-
-
Method Details
-
getRole
Gets the role of the entity that created this message. This is implemented by subclasses to provide compile-time type safety.Returns the
Role.USERconstant for this message type.- Specified by:
getRolein classAbstractMessage- Returns:
- The role of the message creator.
-
getFrom
Gets the identity of the sender of this message. For user messages, this is typically the user's name. For model messages, it's the model ID. For tool messages, it's the identity of the execution context.Returns the user's identity formatted as 'username@device'.
- Specified by:
getFromin classAbstractMessage- Returns:
- The sender's identity.
-
getDevice
Gets the ID of the device where this message was created or processed. This could be a hostname, a JVM ID, or a cloud identifier.Returns the unique identifier of the host that originated this user message.
- Specified by:
getDevicein classAbstractMessage- Returns:
- The device ID.
-
addTextPart
Creates and adds a new text part to this message. Creates and adds aUserTextPart.- Specified by:
addTextPartin classAbstractMessage- Parameters:
text- The text content.- Returns:
- The created text part.
-
addBlobPart
Creates and adds a new binary data part to this message. Creates and adds aUserBlobPart.- Specified by:
addBlobPartin classAbstractMessage- Parameters:
mimeType- The MIME type.data- The binary data.- Returns:
- The created blob part.
-
addBlobPart
Creates and adds a new binary data part from a local file path. Creates and adds aUserBlobPartfrom a file path.- Specified by:
addBlobPartin classAbstractMessage- Parameters:
path- The file path.- Returns:
- The created blob part.
- Throws:
Exception- if the file cannot be read.
-

