Light Dark

Functions

Identity alias

Alias of ::ai::session/Identity

Session alias

Alias of ::ai::session/Session

assistant-msg

fn (content: Str): ChatMessage

Create a ChatMessage with role Assistant.

format-chat-messages

fn (messages: Vec): Str

Render a Vec of ChatMessages as role: content lines.

format-messages

fn (messages: Vec): Str

Render a Vec of Messages as [sender]: content lines for AI prompts.

ns alias

Alias of ::ai::message/

Normalized message types for AI agents. Includes Role enum, ChatMessage, Message (with session + sender), and AgentMessage for inter-agent bus.

system-msg

fn (content: Str): ChatMessage

Create a ChatMessage with role System.

tool-msg

fn (content: Str): ChatMessage

Create a ChatMessage with role Tool — used for tool/function call results fed back into the model.

user-msg

fn (content: Str): ChatMessage

Create a ChatMessage with role User.

Types

AgentMessage

AgentMessage type {
    session: ::ai::session/Session,
    sender: ::ai::session/Identity,
    from-agent: Str?,
    to-agent: Str?,
    content: Str,
    reply-event: Str?,
    correlation-id: Str?,
    metadata: Map?
}

A message routed between agents via the event bus. Carries session + sender.

ChatMessage

ChatMessage type {
    role: Role,
    content: Str
}

A single message in an AI conversation thread.

Message

Message type {
    id: Str,
    content: Str,
    sender: ::ai::session/Identity,
    session: ::ai::session/Session,
    timestamp: Int,
    source: Str?,
    metadata: Map?
}

A message in a conversation, carrying session and sender context.

Role

The role of a message in an AI conversation. The closed variant set covers the standard chat-completion roles: User, Assistant, System, and Tool (for tool/function call results that are fed back to the model). Tool is the only role recognized by every modern provider beyond the original three; rather than open the enum, we add it explicitly.