BlueGit

ict rusty-teams

Files

rusty-teams / crates / agents / src / action.rs

action.rs

action.rs 2.7 KiB Download Raw
1use serde::{Deserialize, Serialize};
2
3const ANSWER_TEMPLATE: &str = "{sender} asked me in the Teams chat \"{chat}\":\n\n{message}\n\nEarlier messages in this chat:\n{thread}\n\nResearch what is needed. The `teams` MCP server can show images of messages (`get_image`) and list the newest messages of other chats (`recent_messages`). `write_message` also takes up to 4 images; to mention someone pass mentions:[{user_id,name}] (user ids are in read_messages sender_id/mentions), and `add_reaction` adds an emoji reaction to a message. Then write my reply with the `write_message` tool of the `teams` MCP server: conversation_id \"{conversation_id}\", reply_to_message_id \"{message_id}\", session_id \"{session_id}\", agent \"{agent}\". Never send anything any other way. {extra}";
4const BUILD_TEMPLATE: &str = "{sender} asked me in the Teams chat \"{chat}\" to build something:\n\n{message}\n\nEarlier messages in this chat:\n{thread}\n\nBuild what is asked in this repository. The `teams` MCP server can show images of messages (`get_image`) and list the newest messages of other chats (`recent_messages`). `write_message` also takes up to 4 images; to mention someone pass mentions:[{user_id,name}] (user ids are in read_messages sender_id/mentions), and `add_reaction` adds an emoji reaction to a message. When done, write a short reply to {sender} with the `write_message` tool of the `teams` MCP server: conversation_id \"{conversation_id}\", reply_to_message_id \"{message_id}\", session_id \"{session_id}\", agent \"{agent}\". {extra}";
5
6#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
7#[serde(default)]
8pub struct AgentAction {
9 pub id: String,
10 pub label: String,
11 pub agent_id: String,
12 pub working_dir: String,
13 pub prompt_template: String,
14 pub ask_extra_instructions: bool,
15 pub extra_args: String,
16}
17
18impl AgentAction {
19 pub fn answer_this(agent_id: &str) -> Self {
20 Self {
21 id: "answer-this".to_string(),
22 label: "Answer this".to_string(),
23 agent_id: agent_id.to_string(),
24 working_dir: "~".to_string(),
25 prompt_template: ANSWER_TEMPLATE.to_string(),
26 ask_extra_instructions: false,
27 extra_args: "--allowedTools WebSearch,WebFetch,Read,Grep,Glob,mcp__teams".to_string(),
28 }
29 }
30
31 pub fn build_this(agent_id: &str) -> Self {
32 Self {
33 id: "build-this".to_string(),
34 label: "Build this".to_string(),
35 agent_id: agent_id.to_string(),
36 working_dir: "~".to_string(),
37 prompt_template: BUILD_TEMPLATE.to_string(),
38 ask_extra_instructions: true,
39 extra_args: "--permission-mode auto".to_string(),
40 }
41 }
42}