ceylon_core/workspace/
agent.rs1use std::fmt::Debug;
8
9use serde::{Deserialize, Serialize};
10
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct AgentDetail {
13 pub name: String,
14 pub id: String,
15 pub role: String,
16}
17
18#[async_trait::async_trait]
19pub trait AgentBase {
20 async fn run_(&self, inputs: Vec<u8>);
21}
22
23#[async_trait::async_trait]
24pub trait MessageHandler: Send + Sync + Debug {
25 async fn on_message(&self, agent_id: String, data: Vec<u8>, time: u64);
26}
27
28#[async_trait::async_trait]
29pub trait Processor: Send + Sync + Debug {
30 async fn run(&self, input: Vec<u8>) -> ();
31}
32
33#[async_trait::async_trait]
34pub trait EventHandler: Send + Sync + Debug {
35 async fn on_agent_connected(&self, topic: String, agent: AgentDetail) -> ();
36}
37
38pub static ENV_WORKSPACE_ID: &str = "WORKSPACE_ID";
39pub static ENV_WORKSPACE_PEER: &str = "WORKSPACE_PEER";
40pub static ENV_WORKSPACE_PORT: &str = "WORKSPACE_PORT";
41pub static ENV_WORKSPACE_IP: &str = "WORKSPACE_IP";