Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(agent): introduce the Macro agent as @macro, not @macro-new (#7808)

Wolf Mermelstein29f795a4bace
diff --git a/crates/bot_id/src/lib.rs b/crates/bot_id/src/lib.rs
index 92b77bb4f7..dbe4f691ba 100644
--- a/crates/bot_id/src/lib.rs
+++ b/crates/bot_id/src/lib.rs
@@ -218,6 +218,19 @@ pub fn system_bot_by_handle(handle: &str) -> Option<&'static SystemBot> {
SYSTEM_BOTS.iter().find(|bot| bot.handle == handle)
}
+/// The handle users type to reach the bot `id`, whose own handle is `handle`.
+///
+/// Macro's agent-session bot is reached through `@macro`; its own handle,
+/// [`MACRO_NEW_HANDLE`], only tells it apart from the classic bot.
+#[must_use]
+pub fn mention_handle(id: BotId, handle: &str) -> &str {
+ if id == MACRO_NEW_BOT_ID {
+ MACRO_AI_HANDLE
+ } else {
+ handle
+ }
+}
+
/// Whether `id` is a first-party bot, and so has no `bots` row.
#[must_use]
pub fn is_system_bot(id: BotId) -> bool {
diff --git a/crates/bot_id/src/test.rs b/crates/bot_id/src/test.rs
index 10a5e43894..ef2046d0ca 100644
--- a/crates/bot_id/src/test.rs
+++ b/crates/bot_id/src/test.rs
@@ -127,3 +127,9 @@ fn equality_and_hash_ignore_uuid_case() {
[lower.clone(), upper.clone()].into_iter().collect();
assert_eq!(set.len(), 1);
}
+
+#[test]
+fn macro_agent_session_bot_is_mentioned_as_macro() {
+ assert_eq!(mention_handle(MACRO_NEW_BOT_ID, MACRO_NEW_HANDLE), "macro");
+ assert_eq!(mention_handle(CURSOR_BOT_ID, CURSOR_HANDLE), "cursor");
+}
diff --git a/services/agent_harness_service/src/containers.rs b/services/agent_harness_service/src/containers.rs
index 7af25ca259..ca67001d15 100644
--- a/services/agent_harness_service/src/containers.rs
+++ b/services/agent_harness_service/src/containers.rs
@@ -134,8 +134,8 @@ where
model: row.model,
identity: Some(AgentIdentity {
bot: row.bot_id,
+ handle: bot_id::mention_handle(row.bot_id, &bot.handle).to_owned(),
name: bot.name,
- handle: bot.handle,
}),
instructions: row.instructions,
acp_session_id: row.acp_session_id,