tirea-protocol-ag-ui 0.5.0

AG-UI protocol event encoding and history adapters for tirea
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub struct AgUiHistoryEncoder;

impl AgUiHistoryEncoder {
    pub fn encode_message(msg: &tirea_contract::Message) -> crate::Message {
        crate::Message {
            id: msg.id.clone(),
            role: match msg.role {
                tirea_contract::Role::System => crate::Role::System,
                tirea_contract::Role::User => crate::Role::User,
                tirea_contract::Role::Assistant => crate::Role::Assistant,
                tirea_contract::Role::Tool => crate::Role::Tool,
            },
            content: msg.content.clone(),
            tool_call_id: msg.tool_call_id.clone(),
        }
    }
}