Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Mentions: a handle in a link isn't a hand-off (M1)
Lin (kwant bot)bd5fbb9a633b
diff --git a/src/router/tags.rs b/src/router/tags.rsindex e117fbd8..4660792b 100644--- a/src/router/tags.rs+++ b/src/router/tags.rs@@ -46,7 +46,7 @@ pub fn parse_mentions_with_lookup(let is_boundary = i == 0|| (!chars[i - 1].is_ascii_alphanumeric() && chars[i - 1] != '_' && chars[i - 1] != '-');- if is_boundary {+ if is_boundary && !in_link(&chars, i) {i += 1;let start = i;while i < len && (chars[i].is_ascii_alphanumeric() || chars[i] == '_' || chars[i] == '-') {@@ -86,6 +86,24 @@ pub fn parse_mentions_with_lookup(mentions}+/// Whether the `@` at `at` is part of a link, where it names an account on that site, not a+/// teammate: a URL (`https://www.tiktok.com/@munichspots/video/…`, `tiktok.com/@munichspots`) or a+/// markdown link's text (`[@munichspots](https://…)`). `@Growth/@Security` is still two mentions.+fn in_link(chars: &[char], at: usize) -> bool {+ let start = chars[..at].iter().rposition(|c| c.is_whitespace()).map_or(0, |i| i + 1);+ let word: String = chars[start..at].iter().collect();+ let host = word.split('/').next().unwrap_or_default();+ if word.contains("://") || (word.contains('/') && host.contains('.')) {+ return true;+ }+ let open = chars[..at].iter().rposition(|&c| c == '[' || c == ']' || c == '\n');+ if open.is_none_or(|o| chars[o] != '[') {+ return false;+ }+ let close = chars[at..].iter().position(|&c| c == ']' || c == '[' || c == '\n').map(|j| at + j);+ close.is_some_and(|c| chars[c] == ']' && chars.get(c + 1) == Some(&'('))+}+fn is_team_mention(token: &str) -> bool {if token.contains('-') {return true;@@ -372,6 +390,24 @@ mod tests {assert!(parse_mentions("follow @mr.absurdia on TikTok").is_empty());}+ /// QA on 0.6.4 (2026-11-02): the Concierge linked a TikTok video and got "Not sent to+ /// munichspots: no teammate has that name here". A handle in a link names an account, not a bot.+ #[test]+ fn a_handle_in_a_link_is_not_a_mention() {+ let names = ["Community", "Analyst", "Growth", "Security"];+ let reply = "Try https://www.tiktok.com/@munichspots/video/7273068214848982304 and @Analyst, check it";+ let m = handoff_mentions(reply, &names);+ assert_eq!((m.targets, m.unknown), (vec![1], vec![]));+ let m = handoff_mentions("See tiktok.com/@munichspots, (https://medium.com/@awriter) and @Community", &names);+ assert_eq!((m.targets, m.unknown), (vec![0], vec![]));+ let m = handoff_mentions("[@munichspots](https://www.tiktok.com/@munichspots) for @Analyst", &names);+ assert_eq!((m.targets, m.unknown), (vec![1], vec![]));+ assert!(parse_mentions("https://www.tiktok.com/@munichspots/video/7273068214848982304").is_empty());+ // Mentions next to a slash, or in brackets that aren't a link, still count+ assert_eq!(handoff_targets("@Growth/@Security, please", &names), vec![2, 3]);+ assert_eq!(handoff_targets("[@Analyst] and/or @Community", &names), vec![1, 0]);+ }+/// Oleks's screenshot (2026-10-24): "Handing off now: @Social revise …, @Writer draft Pillar 1 …"/// asks; "As @SEO found, …" only credits.#[test]diff --git a/tests/concierge_test.rs b/tests/concierge_test.rsindex 684d4d89..a51496bb 100644--- a/tests/concierge_test.rs+++ b/tests/concierge_test.rs@@ -396,6 +396,19 @@ async fn a_hand_back_passes_on_the_message_it_answers_not_the_newest() {assert!(err && text.contains("already handed back"), "{text}");}+/// A TikTok link in the person's message names an account, not a teammate: "@munichspots" in it+/// made the send fail with 400, as an @mention of a bot that isn't here.+#[tokio::test]+async fn a_message_with_a_handle_in_a_link_is_routed() {+ let (app, state, _tmp) = setup().await;+ let script = ok(&app, "POST", "/api/kwants", Some(specialist("Scriptwriter", "TikTok Scriptwriter", "Scripts and hooks for book videos."))).await["id"].as_str().unwrap().to_string();+ let atlas = ok(&app, "POST", "/api/kwants", Some(specialist("Atlas", "Technical SEO", "Crawl errors and sitemaps."))).await["id"].as_str().unwrap().to_string();+ only(&app, &state, &[&script, &atlas]).await;+ let general = state.db.general_channel(&SpaceId::default_space()).await.unwrap().expect("#general").id;+ let (to, _) = routed_to(&app, &state, &general, "Write a TikTok hook like https://www.tiktok.com/@munichspots/video/7273068214848982304").await;+ assert_eq!(to, script);+}+/// The bot routes read and update covers/avoids; left out, a list stays as it is.#[tokio::test]async fn covers_and_avoids_are_read_and_updated() {