1use agent_stream_kit::{
2 ASKit, AgentContext, AgentData, AgentError, AgentOutput, AgentSpec, AgentValue, AsAgent,
3 askit_agent, async_trait,
4};
5
6const CATEGORY: &str = "Std/UI";
7
8const COMMENT: &str = "comment";
9const PIN_SP: &str = " ";
10
11#[askit_agent(
12 kind = "UI",
13 title = "Comment",
14 hide_title,
15 category = CATEGORY,
16 text_config(name = COMMENT, hide_title)
17)]
18struct CommentAgent {
19 data: AgentData,
20}
21
22impl AsAgent for CommentAgent {
23 fn new(askit: ASKit, id: String, spec: AgentSpec) -> Result<Self, AgentError> {
24 Ok(Self {
25 data: AgentData::new(askit, id, spec),
26 })
27 }
28}
29
30#[askit_agent(
31 kind = "UI",
32 title = "Router",
33 hide_title,
34 category = CATEGORY,
35 inputs=[PIN_SP],
36 outputs=[PIN_SP],
37)]
38struct RouterAgent {
39 data: AgentData,
40}
41
42#[async_trait]
43impl AsAgent for RouterAgent {
44 fn new(askit: ASKit, id: String, spec: AgentSpec) -> Result<Self, AgentError> {
45 Ok(Self {
46 data: AgentData::new(askit, id, spec),
47 })
48 }
49
50 async fn process(
51 &mut self,
52 ctx: AgentContext,
53 pin: String,
54 value: AgentValue,
55 ) -> Result<(), AgentError> {
56 self.output(ctx, pin, value).await
57 }
58}