unifai_sdk/toolkit/
messages.rs

1use super::ActionDefinition;
2use serde::{Deserialize, Serialize};
3use serde_json::Value;
4use std::collections::HashMap;
5
6#[derive(Clone, Debug, Deserialize, Serialize)]
7#[serde(tag = "type", rename_all = "camelCase")]
8pub enum ToolkitMessage {
9    Action { data: ActionCallParams },
10    ActionResult { data: ActionCallResult },
11    RegisterActions { data: ActionsRegisterParams },
12}
13
14#[derive(Clone, Debug, Deserialize, Serialize)]
15pub struct ActionCallParams {
16    pub action: String,
17    #[serde(rename = "actionID")]
18    pub action_id: u64,
19    #[serde(rename = "agentID")]
20    pub agent_id: u64,
21    pub payload: Value,
22    pub payment: Option<u64>,
23}
24
25#[derive(Clone, Debug, Deserialize, Serialize)]
26pub struct ActionCallResult {
27    pub action: String,
28    #[serde(rename = "actionID")]
29    pub action_id: u64,
30    #[serde(rename = "agentID")]
31    pub agent_id: u64,
32    pub payload: Value,
33    pub payment: Option<u64>,
34}
35
36#[derive(Clone, Debug, Deserialize, Serialize)]
37pub struct ActionsRegisterParams {
38    pub actions: HashMap<String, ActionDefinition>,
39}