Briyah SDK - v2.0.6
    Preparing search index...

    Class RoomMessage

    Represents a message exchanged between conversations in a Room

    Implements

    Index
    • Creates a new Message

      Every name on a message is an agentNickname, never an agentName. The nickname is what the room routes by, what an agent writes into targets, and what artifact viewers and the room leader are recorded as. agentName is a label — it names the role, carries the room's name as a prefix, and nothing resolves it. The parameters here said otherwise for a long time while every caller passed a nickname.

      Parameters

      • sender: string

        The agentNickname of the agent sending the message

      • action: MessageAction = MessageAction.SPEAK

        The action type of the message

      • content: string

        The content of the message

      • targets: string[] = []

        Array of agentNicknames that will receive the message

      • Optionalname: string

        Optional name for PUBLISH and EXECUTE actions

      • Optionalsituation: string

        Optional situation update to set the current story situation

      Returns RoomMessage

    changes?: Record<string, any>
    content: string
    index?: number
    name?: string
    relayAs?: MessageAction

    On a moderator's routing answer: the action the relayed message should carry in the room, rather than staying a MODERATE.

    A moderated message with no relayAs is stored in every recipient's history as From: <sender>\n<content> (see Agent.addToConversationHistory), which is what a story character expects and what a room agent that speaks the JSON protocol does not — half its history would model the wrong output format. Naming an action here makes the relayed message an ordinary room message: the right shape in history, and the right badge in the transcript.

    Only moderators whose moderate.json declares the field can produce it, so a moderator that says nothing keeps the original behaviour.

    sender: string
    situation?: string
    targets: string[]
    timestamp: Date
    • Checks if a conversation can hear this message

      Parameters

      • agentNickname: string

        The agentNickname to check

      Returns boolean

      True if the conversation can hear the message, false otherwise

    • Gets the action type of the message

      Returns MessageAction

      The message action

    • Gets the content of the message

      Returns string

      The message content

    • Gets the sender of the message

      Returns string

      The agentNickname of the sender

    • Gets the targets of the message

      Returns string[]

      Array of agentNicknames of target conversations

    • Gets the timestamp when the message was created

      Returns Date

      The message timestamp

    • Checks if an agent is a target of this message (intended recipient)

      Parameters

      • agentNickname: string

        The agentNickname to check

      Returns boolean

      True if the conversation is a target, false otherwise