Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Rooms: a bot or app that tags a shared name is told the ids, never let through to every bot of it
milind-sonia1aa74862c11
diff --git a/scripts/mcp-server.ts b/scripts/mcp-server.tsindex 00a6468fae..4c79f119e1 100644--- a/scripts/mcp-server.ts+++ b/scripts/mcp-server.ts@@ -275,7 +275,7 @@ export const TOOLS: McpToolDefinition[] = [channel_id: { type: "string", description: "The ID of the channel." },task_id: { type: "string", description: "Optional expected active task/thread ID." },text: { type: "string", description: "The message content to post." },- send_id: SEND_ID_SCHEMA,+ send_id: SEND_ID_SCHEMA, mentions: { type: "array", items: { type: "string" }, maxItems: 20, description: "When an @name in text is shared by several bots in the channel: the ids of the ones you mean." },},required: ["channel_id", "text"],additionalProperties: false,@@ -938,7 +938,7 @@ export async function handleToolCall(}const receipt = await fetcher(`/api/groups/${encodeURIComponent(channelId)}/messages`, {method: "POST",- body: JSON.stringify({ text, threadId: taskId, ...sendIdArg(args) }),+ body: JSON.stringify({ text, threadId: taskId, ...sendIdArg(args), ...(args.mentions !== undefined ? { mentions: stringArrayArg(args, "mentions") } : {}) }),});return { success: true, channelId, taskId, ...sendReceipt(receipt) };}diff --git a/server/drivers/agents-call.ts b/server/drivers/agents-call.tsindex 956b7ea26f..76c5b545fc 100644--- a/server/drivers/agents-call.ts+++ b/server/drivers/agents-call.ts@@ -358,7 +358,7 @@ export async function callTool(called: string, input: Json, context: ToolCallCon}const r = await api("/api/internal/post-to-room", {method: "POST",- body: JSON.stringify({ fromBotId: BOT_ID, fromThreadId: THREAD_ID, groupId, message, attachVoiceNote }),+ body: JSON.stringify({ fromBotId: BOT_ID, fromThreadId: THREAD_ID, groupId, message, attachVoiceNote, ...(args.mention_ids !== undefined ? { mentionIds: args.mention_ids } : {}) }),});if (r.error) return { text: String(r.error), isError: true };return {diff --git a/server/drivers/agents-catalog-goldens/bridged.profiles.json b/server/drivers/agents-catalog-goldens/bridged.profiles.jsonindex 7c49f9332f..cf1b3914b8 100644--- a/server/drivers/agents-catalog-goldens/bridged.profiles.json+++ b/server/drivers/agents-catalog-goldens/bridged.profiles.json@@ -1,7 +1,7 @@{"default": {- "bytes": 16709,- "sha256": "ecaa84405a300c86deacca84c4dcf12e7956bb239ae76cc115179d85f560fc66",+ "bytes": 16859,+ "sha256": "5aaf54364f3ca8f0c65c26d0cb00a554c3ce2f9bf621b2a431e7cad43e5a4bb7","tools": ["tool_result_read","list_room_targets",@@ -21,8 +21,8 @@]},"voice": {- "bytes": 17490,- "sha256": "933218bdcab6ed2ff31fc372ffa52e9cc6ea7fd12dc93a3e7a1ac02ca30e9d97",+ "bytes": 17640,+ "sha256": "d2472c33f76a050d688e597aba8c8cf6545decac07f338d5abf3e8c22dfd4279","tools": ["tool_result_read","list_room_targets",@@ -43,8 +43,8 @@]},"shared": {- "bytes": 16749,- "sha256": "38f6c4706dd47a8636dfc28295c191d89700fabe15650c6432a06caa76a32d45",+ "bytes": 16899,+ "sha256": "98b4a6475a4c206058693b405d94917b9f5d3654e0f8a0666d5cf8832d850817","tools": ["tool_result_read","list_room_targets",@@ -64,8 +64,8 @@]},"shared+voice": {- "bytes": 17530,- "sha256": "9894d9204e01ffd792ac3c8a74cfc76a30f03f11f10b52229bcabd52f40484f0",+ "bytes": 17680,+ "sha256": "d9606fd51528039825406a9be2bbee64892d62fa3da78b2c22cddc2837b01c5a","tools": ["tool_result_read","list_room_targets",@@ -86,8 +86,8 @@]},"skills": {- "bytes": 16736,- "sha256": "9526816a626fe0274704b845be32983890437a9f9634542b2fff031c6245b5a8",+ "bytes": 16886,+ "sha256": "082070af56eb40a33a0c1e1526a92ed53bd68c272f11f8b0d3f1e4aa8c157f0c","tools": ["tool_result_read","list_room_targets",@@ -107,8 +107,8 @@]},"skills+voice": {- "bytes": 17517,- "sha256": "1cb0a0df6716b94f3670510c01b6e25283757e4717312d84f872851564c0e355",+ "bytes": 17667,+ "sha256": "22a66677ce7a144a846694fb4630be181dfd10977ae48fe4e69eee9a26610cfa","tools": ["tool_result_read","list_room_targets",@@ -129,8 +129,8 @@]},"skills+shared": {- "bytes": 16776,- "sha256": "33ec1df0019343a1f6c5addf0a7b363193f72bf36e28e7bcb02240b6345f8853",+ "bytes": 16926,+ "sha256": "f3cc3bb978f209969012106cab33c8a7c2ad2fa0897f483cc424732e9324f007","tools": ["tool_result_read","list_room_targets",@@ -150,8 +150,8 @@]},"skills+shared+voice": {- "bytes": 17557,- "sha256": "a866d3db97bbb676e560cd3052ebbd2c88e04e7d2ec430e10219f3ec0840e3f4",+ "bytes": 17707,+ "sha256": "9d7beab2bc00a73ebea9ba15e346543e1a63f3f4fdc2fd67ca15bebb7f6efa49","tools": ["tool_result_read","list_room_targets",@@ -172,8 +172,8 @@]},"non-chief": {- "bytes": 16592,- "sha256": "9bfa3e9eae6b555c7f4dfbd1c6473881093964d4a4765447162b76b20391d65c",+ "bytes": 16742,+ "sha256": "3f75c5c65b3f8f636a9f693c40f20c8d51113e74b19f49bacb560dd24e823756","tools": ["tool_result_read","list_room_targets",@@ -193,8 +193,8 @@]},"voice+non-chief": {- "bytes": 17373,- "sha256": "6674d91c50a6b02a742eb8c9af9bb066386b2e6743fa07af7ef0841ee250edbc",+ "bytes": 17523,+ "sha256": "9f73d1f73c6e9b9c832a85c0d49febbe6b58cf505444317cf6e355f7f3bc42e3","tools": ["tool_result_read","list_room_targets",@@ -215,8 +215,8 @@]},"shared+non-chief": {- "bytes": 16632,- "sha256": "2b7697ea9819fa455d31a40ac88dc0e4cd195f949093bf1638b4ebb4204826ab",+ "bytes": 16782,+ "sha256": "a8cd967c05da83b5235a2d1d9d51ce45aeed58bc10166654df7f0a365a4ced52","tools": ["tool_result_read","list_room_targets",@@ -236,8 +236,8 @@]},"shared+voice+non-chief": {- "bytes": 17413,- "sha256": "fadc6a51adf285c52ce4acc8a866412204ab49e0aaf85e20f4a82d4b641462ce",+ "bytes": 17563,+ "sha256": "b58bfc6997f35adc204e0b24b6a3fde6c57265edc819ea8d6c39f254182a736e","tools": ["tool_result_read","list_room_targets",@@ -258,8 +258,8 @@]},"skills+non-chief": {- "bytes": 16619,- "sha256": "98f36e1dfdcd6b97e09cfb71c4e6e7e22463fa648bb77ee9a8a10b002fae8ffa",+ "bytes": 16769,+ "sha256": "c0a7f0235563a0d8a48f155407e919ddd10940735fc6e9d8bbb64e6e9a3e9009","tools": ["tool_result_read","list_room_targets",@@ -279,8 +279,8 @@]},"skills+voice+non-chief": {- "bytes": 17400,- "sha256": "ae68b251ae668daebadd85d324a9edc7bd7b71fd8f13fc97c23065c615278815",+ "bytes": 17550,+ "sha256": "6fbfa96e3a5209afe20efc05c09571b84c07b895596fe4c8f686c0c925253354","tools": ["tool_result_read","list_room_targets",@@ -301,8 +301,8 @@]},"skills+shared+non-chief": {- "bytes": 16659,- "sha256": "eb64d013863269904b0a15e9045c2193d205c382392952f43fa3fd44e77f7122",+ "bytes": 16809,+ "sha256": "7df6257af946f5af548695f08781150a4c6fc9d3dde26d839a829fcc26bb2358","tools": ["tool_result_read","list_room_targets",@@ -322,8 +322,8 @@]},"skills+shared+voice+non-chief": {- "bytes": 17440,- "sha256": "6ef48fb515e6a0cd9146599b2366992d245f2692b4039001b17b38abd1616bb6",+ "bytes": 17590,+ "sha256": "9fbf7a97aca6c459c3efa32e652b54f0827bda05a16c43205696a8e95e1209ea","tools": ["tool_result_read","list_room_targets",@@ -344,8 +344,8 @@]},"skills+shared+voice+cloud-home": {- "bytes": 17573,- "sha256": "a0cb1fbb2c3b071e6e80c06302f8e3896f2e00c2f60922d2ad2161d04c2d2020",+ "bytes": 17723,+ "sha256": "4f0457abe3cf811e3ed970cc96d3f5a2cec99f982bee4e15c3d6baed441a6087","tools": ["tool_result_read","list_room_targets",@@ -366,8 +366,8 @@]},"skills+shared+voice+non-chief+cloud-home": {- "bytes": 17456,- "sha256": "361ac7b8d71c2828f14a7955b5bb5bd3169c1d6efaf9dafe913e479c9f3b0e7a",+ "bytes": 17606,+ "sha256": "cb9b5b795fa85620d50941a91463e5710b1c538a73cd242e888d833d109d2edf","tools": ["tool_result_read","list_room_targets",@@ -388,8 +388,8 @@]},"skills+shared+voice+escalations": {- "bytes": 17575,- "sha256": "a21f1c3cd64f3d810dbdaf243f43e145c4b2cdc238657a7801a0c7b3cfc81f01",+ "bytes": 17725,+ "sha256": "c0c376cd2dd763a4550b33a4f1b3ecabbb157b53ea44bd94b0c9095375810292","tools": ["tool_result_read","list_room_targets",@@ -410,8 +410,8 @@]},"skills+shared+voice+escalations+x": {- "bytes": 17636,- "sha256": "a4bc8116d90f106d63af19e95d108f952278e64b9769d60829c510d96cc47c08",+ "bytes": 17786,+ "sha256": "32bbd2c12dff6a809a85013e9f4115c2d15433fb7da3fcf77aba97a519d27d0d","tools": ["tool_result_read","list_room_targets",@@ -432,8 +432,8 @@]},"skills+shared+voice+escalations+x+team": {- "bytes": 17652,- "sha256": "bd56dceb04dd03019ddc28e1c9f7ad6bb0f66581a4f338053856effc302aade8",+ "bytes": 17802,+ "sha256": "b315170bac570494c25db6b3ee42748591b0ce4a75f5df3fde9dafe52de53bd1","tools": ["tool_result_read","list_room_targets",@@ -454,8 +454,8 @@]},"default+legacy-switches": {- "bytes": 16709,- "sha256": "ecaa84405a300c86deacca84c4dcf12e7956bb239ae76cc115179d85f560fc66",+ "bytes": 16859,+ "sha256": "5aaf54364f3ca8f0c65c26d0cb00a554c3ce2f9bf621b2a431e7cad43e5a4bb7","tools": ["tool_result_read","list_room_targets",@@ -475,8 +475,8 @@]},"default+mausbot": {- "bytes": 16761,- "sha256": "8060b2bc051f2d440b88cd49fb61d73fe214766368b5bb55aba4bcdbe0cceafd",+ "bytes": 16911,+ "sha256": "cdef780e241fb168daf8452192718425757c804109d445613d767d1e090d827d","tools": ["tool_result_read","list_room_targets",@@ -496,8 +496,8 @@]},"skills+shared+voice+mausbot": {- "bytes": 17609,- "sha256": "4006d44e118dd3fc968bdd90e002e38db059b3f4c3a940c79be9d399e9896c92",+ "bytes": 17759,+ "sha256": "92ef6d59683b6dce411a6803f46003f6111a1d9cfc1680ce09a828cac8731944","tools": ["tool_result_read","list_room_targets",@@ -518,8 +518,8 @@]},"default+no-computer-pick": {- "bytes": 15497,- "sha256": "a7860ddb4991f49cc9dd531f040a9efb8a34899faf608a2864a354fb37e076f7",+ "bytes": 15647,+ "sha256": "98cf59e22eaa3f73a831ee83cf403cfd42643862d764244f14806415e79ac52a","tools": ["tool_result_read","list_room_targets",@@ -538,8 +538,8 @@]},"default+room": {- "bytes": 15436,- "sha256": "6a660a0f6cd3f1a568cabeedb0faec6c561a0dd65a8665819f02f117692781aa",+ "bytes": 15586,+ "sha256": "3e950a44a3130f42892e481fff7faeaed68b52b499f64061e8c9e1803cbdf5d0","tools": ["tool_result_read","list_room_targets",@@ -558,8 +558,8 @@]},"non-chief+room": {- "bytes": 15319,- "sha256": "d98a3d7e0deb18e7bb19c246d0d54eb422532e482984fad2d985a55b3946c280",+ "bytes": 15469,+ "sha256": "6ff7cc925f34de0500f8ae804f85fdd22c3ff22e3dffa0e6c27096585a1827d3","tools": ["tool_result_read","list_room_targets",diff --git a/server/drivers/agents-catalog-goldens/bridged.tools-list.json b/server/drivers/agents-catalog-goldens/bridged.tools-list.jsonindex ccf0d3395c..b2bea047c7 100644--- a/server/drivers/agents-catalog-goldens/bridged.tools-list.json+++ b/server/drivers/agents-catalog-goldens/bridged.tools-list.json@@ -206,7 +206,7 @@},{"name": "post_to_room",- "description": "Put one message into a shared room you belong to, for example when the user asks you to tell the team something. Get group_id from list_rooms. This posts and returns: no room member's turn starts, nobody replies, and nothing comes back except confirmation — so never use it to ask a question or hand out work (use coordinate_bots for those). Post once, say it in full, and tell the user what you posted. Set attach_voice_note true to attach this turn's voice note. If a post is refused, do not retry it: say what you wanted to post in your reply instead.",+ "description": "Put one message into a shared room you belong to, for example when the user asks you to tell the team something. Get group_id from list_rooms. This posts and returns: no room member's turn starts, nobody replies, and nothing comes back except confirmation — so never use it to ask a question or hand out work (use coordinate_bots for those). Post once, say it in full, and tell the user what you posted. Set attach_voice_note true to attach this turn's voice note. If a post is refused, do not retry it unless the refusal says how: say what you wanted to post in your reply instead.","inputSchema": {"type": "object","additionalProperties": false,@@ -222,6 +222,13 @@"attach_voice_note": {"type": "boolean","description": "True to attach this turn's send_voice_note recording; the message is its caption. Call send_voice_note first."+ },+ "mention_ids": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Ids of the bots a shared @name in message means."}},"required": [diff --git a/server/drivers/agents-catalog-goldens/full.tools-list.json b/server/drivers/agents-catalog-goldens/full.tools-list.jsonindex e7966402bb..b8de31600e 100644--- a/server/drivers/agents-catalog-goldens/full.tools-list.json+++ b/server/drivers/agents-catalog-goldens/full.tools-list.json@@ -535,7 +535,7 @@},{"name": "post_to_room",- "description": "Put one message into a shared room you belong to, for example when the user asks you to tell the team something. Get group_id from list_rooms. This posts and returns: no room member's turn starts, nobody replies, and nothing comes back except confirmation — so never use it to ask a question or hand out work (use coordinate_bots for those). Post once, say it in full, and tell the user what you posted. Set attach_voice_note true to attach this turn's voice note. If a post is refused, do not retry it: say what you wanted to post in your reply instead.",+ "description": "Put one message into a shared room you belong to, for example when the user asks you to tell the team something. Get group_id from list_rooms. This posts and returns: no room member's turn starts, nobody replies, and nothing comes back except confirmation — so never use it to ask a question or hand out work (use coordinate_bots for those). Post once, say it in full, and tell the user what you posted. Set attach_voice_note true to attach this turn's voice note. If a post is refused, do not retry it unless the refusal says how: say what you wanted to post in your reply instead.","inputSchema": {"type": "object","additionalProperties": false,@@ -551,6 +551,13 @@"attach_voice_note": {"type": "boolean","description": "True to attach this turn's send_voice_note recording; the message is its caption. Call send_voice_note first."+ },+ "mention_ids": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Ids of the bots a shared @name in message means."}},"required": [diff --git a/server/drivers/agents-catalog-goldens/profiles.json b/server/drivers/agents-catalog-goldens/profiles.jsonindex ac633d33f0..b2d522e702 100644--- a/server/drivers/agents-catalog-goldens/profiles.json+++ b/server/drivers/agents-catalog-goldens/profiles.json@@ -1,7 +1,7 @@{"default": {- "bytes": 58596,- "sha256": "e79c76eda1bd38d90fcf31c0f383c150259500fdd5abfa76c0c7f6c08832a73b",+ "bytes": 58746,+ "sha256": "8ba56ec7f1d52e76dee6ff1f9f10e549750f60a8d0fb14048ac3910d506dc798","tools": ["tool_result_read","list_room_targets",@@ -50,8 +50,8 @@]},"voice": {- "bytes": 59377,- "sha256": "d46cd4dbc731555de7f13c3b0f3bbd90e3642e1e0132a34be219cf0256872a3c",+ "bytes": 59527,+ "sha256": "397daeb3d7685f9f7807b30be20cb06c0c9d7f434b505c750c1bc237c647e0c9","tools": ["tool_result_read","list_room_targets",@@ -101,8 +101,8 @@]},"shared": {- "bytes": 60861,- "sha256": "dc176a9f663cf6d705b6d121a38f9dacb1f025e4672efd6367b1881c20d0a83f",+ "bytes": 61011,+ "sha256": "fa05b82f7e28513a822e5d7107ac7c4e94f95900f576cad8e9a619c5633c15cf","tools": ["tool_result_read","list_shared_computers",@@ -153,8 +153,8 @@]},"shared+voice": {- "bytes": 61642,- "sha256": "26b7e0e3ad6a2e52f1e8de01b797c9df2359d25547f3c72e9ee7aae287841337",+ "bytes": 61792,+ "sha256": "d09be1411fdefe56f53c2342e5eee5c7edcf4a0d2142fc71b923fec6e24f5ecf","tools": ["tool_result_read","list_shared_computers",@@ -206,8 +206,8 @@]},"skills": {- "bytes": 61415,- "sha256": "6a0c54ad7e3a777e1096cef6d4219acb4b79358b5752efecf6c7b95a3244ea6f",+ "bytes": 61565,+ "sha256": "161775c0307657d57ee4c0c07c2b87dba1df35abe3ab95f0eefa10c7ddd9ab93","tools": ["tool_result_read","list_room_targets",@@ -258,8 +258,8 @@]},"skills+voice": {- "bytes": 62196,- "sha256": "235e04015d56b14ba36c306bab657d7865bd11669a19fa91fde718340b2ffdca",+ "bytes": 62346,+ "sha256": "4a8ec18177c52d70a431b4c924332bd156d604cf543eb7dfdf7e626c4609595b","tools": ["tool_result_read","list_room_targets",@@ -311,8 +311,8 @@]},"skills+shared": {- "bytes": 63680,- "sha256": "7275752679126234d3b76ef1954b5e3edef7cf5ff3e0135c489b1db4487081d4",+ "bytes": 63830,+ "sha256": "6edc8911bb1268cf2e77d4721097ea8ec3c62ce9f6fef34f3863dd74d3373aea","tools": ["tool_result_read","list_shared_computers",@@ -365,8 +365,8 @@]},"skills+shared+voice": {- "bytes": 64461,- "sha256": "9dd7e3c470ee4b6045fa434b5b72d699d31745e427c6fb452a1a9ce16309a604",+ "bytes": 64611,+ "sha256": "2474a80c41897c2f7100de741287129c41d5518ff94b2d9a2686c0be7407b41f","tools": ["tool_result_read","list_shared_computers",@@ -420,8 +420,8 @@]},"non-chief": {- "bytes": 49380,- "sha256": "3dbdef4d9be1dd6266bff68921ff57e4ebfccf2d8c8b5109466e2010860b6dab",+ "bytes": 49530,+ "sha256": "a4cedc0f6898ff493e4390e814d0c0880c45618d5e84c2810344fff1de49c9de","tools": ["tool_result_read","list_room_targets",@@ -463,8 +463,8 @@]},"voice+non-chief": {- "bytes": 50161,- "sha256": "0ef9f17d5167cefc29eb83290f22748109a1b8238a5cd48be05c675e3b4f7ca0",+ "bytes": 50311,+ "sha256": "1851d7c36907e3587f83f763cd611f78fbc692ba698cb43d2ccc346e8dc04501","tools": ["tool_result_read","list_room_targets",@@ -507,8 +507,8 @@]},"shared+non-chief": {- "bytes": 51645,- "sha256": "1a64d20fc09055533323cab445ad8f32bc96ed897dcf9a5752f70366e3bf061e",+ "bytes": 51795,+ "sha256": "3ea5e6c181d7cd1dec5359736b6ccbd1339905a864ef5863a94860fd20657b20","tools": ["tool_result_read","list_shared_computers",@@ -552,8 +552,8 @@]},"shared+voice+non-chief": {- "bytes": 52426,- "sha256": "54cff4b9f2e7c4a79d6f57cb164a8091a5b686e4ab5d44aae5323f78474545ee",+ "bytes": 52576,+ "sha256": "0ac7f3ca60f3ba7989722f72ef2c514737b0645b476e12f3abe2f96abddafaa1","tools": ["tool_result_read","list_shared_computers",@@ -598,8 +598,8 @@]},"skills+non-chief": {- "bytes": 52199,- "sha256": "85714760418ea291098dd0b707565b4fdf3fe1deb1e1834ab88f3b6d9a7b6bd4",+ "bytes": 52349,+ "sha256": "9ab0d0797baed6b40205cf2e927cebbe69c2f75c727e44f0edd9d98c990bb1d9","tools": ["tool_result_read","list_room_targets",@@ -643,8 +643,8 @@]},"skills+voice+non-chief": {- "bytes": 52980,- "sha256": "51fbcf0db61c5389ee167966336c043d2e019b3a46ca01d0681b8eddb9e2e9d7",+ "bytes": 53130,+ "sha256": "48be00e173615d0f8a55e7234ef52d560be6d98b3d2de3fdf6fb9718fbc03d7b","tools": ["tool_result_read","list_room_targets",@@ -689,8 +689,8 @@]},"skills+shared+non-chief": {- "bytes": 54464,- "sha256": "82f8d6d8dc4b69b18cd14c3f5a43b5d84b59865e5f842db310fc1d2528d2a917",+ "bytes": 54614,+ "sha256": "932b86b6d6d3e6dc11299030d54249208d78e580491ad17a0e6c1d8288bc0d05","tools": ["tool_result_read","list_shared_computers",@@ -736,8 +736,8 @@]},"skills+shared+voice+non-chief": {- "bytes": 55245,- "sha256": "ad60071fe7e2b60ac20648dd25db45ed34f6aa393388b4720212c5af028bd81c",+ "bytes": 55395,+ "sha256": "3e4664c8d78a6cef069a3528080c3433210220264327d7d98c3b9ea872a8ff51","tools": ["tool_result_read","list_shared_computers",@@ -784,8 +784,8 @@]},"skills+shared+voice+cloud-home": {- "bytes": 64227,- "sha256": "facc2cfcb57c178d2a2b63b34197a3ccc73044bcb8155030bc7d2a2f2cde0aa9",+ "bytes": 64377,+ "sha256": "6dc3c64b21cf2b271be4c47a3238e96dc87683717e2ed50c4446727a03e3ba93","tools": ["tool_result_read","list_shared_computers",@@ -839,8 +839,8 @@]},"skills+shared+voice+non-chief+cloud-home": {- "bytes": 55011,- "sha256": "64d0b24ce9282a032cc5fc2ee83acbea2bd341e101ea1e3f5f1c57b17d054212",+ "bytes": 55161,+ "sha256": "a601159a7ec6693f40aa49ab5ff03b283f5980be348b662773309eb0dc8da8e7","tools": ["tool_result_read","list_shared_computers",@@ -887,8 +887,8 @@]},"skills+shared+voice+escalations": {- "bytes": 65291,- "sha256": "f24a8ae41f32bedca81c46f999582717b580b357bcb7b60926fb10225a5202cc",+ "bytes": 65441,+ "sha256": "eab815f4e96e69198309ccd8106ada21f49d027da991a09b0013a896112f5353","tools": ["tool_result_read","list_shared_computers",@@ -943,8 +943,8 @@]},"skills+shared+voice+escalations+x": {- "bytes": 69130,- "sha256": "222ade88e0aa7b837e923d10e9d6cedb47bbdf19d87e9c84985fab91b6aed94b",+ "bytes": 69280,+ "sha256": "7c35b8baae43decd9ab7cf792f97b2be6c5b1e682f47e91b82c12c9445927101","tools": ["tool_result_read","list_shared_computers",@@ -1003,8 +1003,8 @@]},"skills+shared+voice+escalations+x+team": {- "bytes": 69762,- "sha256": "674bd7b232fcec8a5355563bef6bf13de91a6687f5b90c7c264a343c4cd5a279",+ "bytes": 69912,+ "sha256": "d27fd9bbc18012a82f88fc2b46ca0e21772f0f3770dec5c68ee8bae4c81963e7","tools": ["tool_result_read","list_shared_computers",@@ -1064,8 +1064,8 @@]},"default+legacy-switches": {- "bytes": 58596,- "sha256": "e79c76eda1bd38d90fcf31c0f383c150259500fdd5abfa76c0c7f6c08832a73b",+ "bytes": 58746,+ "sha256": "8ba56ec7f1d52e76dee6ff1f9f10e549750f60a8d0fb14048ac3910d506dc798","tools": ["tool_result_read","list_room_targets",@@ -1114,8 +1114,8 @@]},"default+mausbot": {- "bytes": 59247,- "sha256": "047e6cf0a0f41ee8a491f554c77a856ebf38a50b66c7f9b2d52496ba1201cd0e",+ "bytes": 59397,+ "sha256": "9e5a6e479519853f66890d382a155a161bbf2b30dd516b065cf9e7235fb97cdb","tools": ["tool_result_read","list_room_targets",@@ -1166,8 +1166,8 @@]},"skills+shared+voice+mausbot": {- "bytes": 65112,- "sha256": "8a2cb33f8cd1bd7bd566f6f5690baaf4d6d97d3c01e79c694608777ae0f42179",+ "bytes": 65262,+ "sha256": "39cc2ef5b620808a7bf694c3d0dcde3a08c2ccd2a9333c399725f8f038c2b9da","tools": ["tool_result_read","list_shared_computers",@@ -1223,8 +1223,8 @@]},"default+no-computer-pick": {- "bytes": 57384,- "sha256": "0260a80ca45e875ebfb475fa88e4b42dbc2803afa39e0ea8efcb4bc426179932",+ "bytes": 57534,+ "sha256": "daffff9d9d61e668ea2a20bbb6e640abc446ba429df4b4bf27a76a4d1efb9d49","tools": ["tool_result_read","list_room_targets",@@ -1272,8 +1272,8 @@]},"default+room": {- "bytes": 50294,- "sha256": "af5c8f93df9533976f3cbb6f3ca414d1c657fa6684f5c8df06e886d5f615edc6",+ "bytes": 50444,+ "sha256": "542da7804b73e63612b2d640f444047d66b935af442f16017d54a6f8726982d9","tools": ["tool_result_read","list_room_targets",@@ -1316,8 +1316,8 @@]},"non-chief+room": {- "bytes": 41078,- "sha256": "644b1aa8dd377c9799e6443cbffac592e78bb8e0eb453a092eb5917349c18dff",+ "bytes": 41228,+ "sha256": "567ff4e006384d18f7ad00cb804a1f829640653550c542ccf542c8972a7fa1c2","tools": ["tool_result_read","list_room_targets",diff --git a/server/drivers/agents-catalog-wire.test.ts b/server/drivers/agents-catalog-wire.test.tsindex 2facd4026f..988480f8a5 100644--- a/server/drivers/agents-catalog-wire.test.ts+++ b/server/drivers/agents-catalog-wire.test.ts@@ -97,8 +97,8 @@ const BUDGET_BASELINE: Record<string, number> = {"skills+voice+non-chief": 52793,"skills+shared+non-chief": 53965,"skills+shared+voice+non-chief": 55058,- "skills+shared+voice+cloud-home": 63096,- "skills+shared+voice+non-chief+cloud-home": 53961,+ "skills+shared+voice+cloud-home": 64377,+ "skills+shared+voice+non-chief+cloud-home": 55161,"default+legacy-switches": 58250,"default+mausbot": 58901,"skills+shared+voice+mausbot": 64766,diff --git a/server/drivers/agents-catalog.ts b/server/drivers/agents-catalog.tsindex 467c57b8b7..1b80d4bb05 100644--- a/server/drivers/agents-catalog.ts+++ b/server/drivers/agents-catalog.ts@@ -345,7 +345,7 @@ const TOOL_DEFINITIONS = [{name: "post_to_room",description:- "Put one message into a shared room you belong to, for example when the user asks you to tell the team something. Get group_id from list_rooms. This posts and returns: no room member's turn starts, nobody replies, and nothing comes back except confirmation — so never use it to ask a question or hand out work (use coordinate_bots for those). Post once, say it in full, and tell the user what you posted. Set attach_voice_note true to attach this turn's voice note. If a post is refused, do not retry it: say what you wanted to post in your reply instead.",+ "Put one message into a shared room you belong to, for example when the user asks you to tell the team something. Get group_id from list_rooms. This posts and returns: no room member's turn starts, nobody replies, and nothing comes back except confirmation — so never use it to ask a question or hand out work (use coordinate_bots for those). Post once, say it in full, and tell the user what you posted. Set attach_voice_note true to attach this turn's voice note. If a post is refused, do not retry it unless the refusal says how: say what you wanted to post in your reply instead.",inputSchema: {type: "object",additionalProperties: false,@@ -353,6 +353,7 @@ const TOOL_DEFINITIONS = [group_id: { type: "string", description: "The room's id, copied exactly from list_rooms." },message: { type: "string", description: "The complete message to post, written for the room to read as it stands." },attach_voice_note: { type: "boolean", description: "True to attach this turn's send_voice_note recording; the message is its caption. Call send_voice_note first." },+ mention_ids: { type: "array", items: { type: "string" }, description: "Ids of the bots a shared @name in message means." },},required: ["group_id", "message"],},diff --git a/server/index.ts b/server/index.tsindex 9a1f3ee9af..5a05d6f527 100644--- a/server/index.ts+++ b/server/index.ts@@ -121,7 +121,7 @@ import { createSideJobs, helperSelection } from "./side-jobs.ts";import type { CaptureTurn, RoomLine } from "./memory-capture.ts";import { createAboutMe } from "./about-me.ts"; import { createPersonPreference } from "./host/person-preference.ts";import { botMemoryUpdate, ownersOwnAsk } from "./memory-forget.ts";-import { canManage, canReach, hasTeamAuthority, livePeerRoster, livePeerRosterBlock, peerName, peerRosterSystemPrompt, peerStatus, peerStatusWords, reachablePeers, resolveTeammate, roomPeerRosterSystemPrompt, roomRosterLine } from "./peer-roster.ts";+import { canManage, canReach, hasTeamAuthority, livePeerRoster, livePeerRosterBlock, peerName, peerRosterSystemPrompt, peerStatus, peerStatusWords, reachablePeers, resolveTeammate, roomPeerRosterSystemPrompt, roomRosterLine } from "./peer-roster.ts"; import { roomPostRefusal, sharedNamesNote, unreachedMentionLines } from "./same-name-mentions.ts";import {containerComputerAction,containerComputerFrame,@@ -10211,11 +10211,10 @@ async function runClaimedGroupMemberTurn(throw await asPlaceFailure(error, place, "room", readyBot, turnProvider(readyBot) === "vps" ? "vps" : "box");}- const roster = readyGroup.memberIds+ const roomMembers = readyGroup.memberIds.map((id) => store.bot(id))- .filter((b): b is NonNullable<typeof b> => Boolean(b))- .map(roomRosterLine)- .join(", ");+ .filter((b): b is NonNullable<typeof b> => Boolean(b));+ const roster = roomMembers.map(roomRosterLine).join(", ");const roomHandoff = orchestration?.roomHandoffId ? coordinator.node(orchestration.roomHandoffId) : undefined;const roomRequester = roomHandoff?.parentId ? store.bot(coordinator.node(roomHandoff.parentId)?.botId ?? "")?.name : undefined;const requesterRule = roomRequester@@ -10231,7 +10230,7 @@ async function runClaimedGroupMemberTurn(`Room members: ${roster}, and ${typeof userName === "string" ? `${userName} (the human)` : roomPeople(threadId, userName)}.`,readyGroup.bulletin.trim() && `Room bulletin (shared instructions for everyone):\n${readyGroup.bulletin.trim()}`,`Reply as yourself, briefly and conversationally. To bring a teammate in, mention them like @Name — they'll see the conversation and respond.${readyGroup.dm ? "" : ` To get ${typeof userName === "string" ? `${userName}'s` : "a person's"} attention or ask them something blocking, write @you.`} A "[reacted 👍 to …]" line is that person's whole reply to the message it names: 👍 means yes, go ahead, and 👎 means no.`,- outsideRoom.length > 0 && roomPeerRosterSystemPrompt(outsideRoom),+ outsideRoom.length > 0 && roomPeerRosterSystemPrompt(outsideRoom), sharedNamesNote(roomMembers.filter((member) => member.id !== bot.id), Boolean(integrations.agents)),integrations.agents && (CREDENTIAL_PROMPT + (orchestration && !orchestration.roomHandoffId ? THREADS_PROMPT : "")).trim(),integrations.agents && (!orchestration || orchestration.roomHandoffId) && "For actual OpenMausBot teamwork, discover IDs with list_room_targets and use coordinate_bots for advice or work in this or another room. Do not substitute native coding helpers for these named bots. Consult only when needed to make a decision; no discussion step is mandatory. Give concrete responsibilities, exact accessible paths and acceptance checks. End your turn after assigning; busy teammates queue and results automatically resume you. When they return, finish the requested verification and give the user one final answer. Native helper names are not evidence that an OpenMausBot teammate participated. Plain @mentions are only for conversational replies in this room." + requesterRule,integrations.agents && TRIGGER_PROMPT.trim(),@@ -10641,16 +10640,16 @@ async function runClaimedGroupMemberTurn(const members = group.memberIds.map((id) => store.bot(id)).filter((b): b is NonNullable<typeof b> => Boolean(b) && b!.id !== bot.id);- const missed = mentionedBots(- replyText,- reachablePeers(store.bots, bot).filter((peer) => !group.memberIds.includes(peer.id)),+ const missed = unreachedMentionLines(+ replyText, members,+ reachablePeers(store.bots, bot).filter((peer) => !group.memberIds.includes(peer.id)), threadLanguage(threadId),); for (const line of placesElsewhere.missed(replyText, store.bots)) store.appendMessage(threadId, { role: "bot", kind: "activity", tool: { name: line, ok: false } });- for (const peer of missed.filter((one, at) => missed.findIndex((other) => other.name === one.name) === at)) {+ for (const line of missed) {store.appendMessage(threadId, {role: "bot",kind: "activity",tool: {- name: serverLine(threadLanguage(threadId), "server.rooms.mentionMissed", { bot: peer.name }),+ name: line,ok: false,},});@@ -14165,6 +14164,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {}const eligibility = roomPostEligibility(from, room, fromThreadId);if (!eligibility.ok) return json(res, eligibility.status, { error: eligibility.error });+ const sameName = roomPostRefusal(body.mentionIds, message, room, (id) => store.bot(id)); if (sameName) return json(res, sameName.status, { error: sameName.error });// The budget is read BEFORE any approval card and CHARGED only on the path that actually appends.const askBudget = (bot: BotRecord, group: GroupRecord) => {const attempt: RoomPostAttempt = {diff --git a/server/mcp-server.test.ts b/server/mcp-server.test.tsindex 1c8a696ed1..058d7df61c 100644--- a/server/mcp-server.test.ts+++ b/server/mcp-server.test.ts@@ -686,6 +686,19 @@ describe("waiting on a conversation's job", () => {await expect(handleToolCall("send_bot_message", { bot_id: "bot-1", text: "Go", send_id: "short" }, fetcher)).rejects.toThrow("send_id must be");expect(sent).toHaveLength(2);});++ it("sends a channel message with the ids of the bots it means when two share a name", async () => {+ const sent: unknown[] = [];+ const fetcher = vi.fn(async (path: string, init?: RequestInit) => {+ if (path === "/api/bots?messages=0") return { bots: [], groups: [{ id: "channel-1", threadId: "room-1", tasks: [] }] };+ sent.push(JSON.parse(String(init?.body)));+ return { ok: true, threadId: "room-1", message: { id: "msg-1", at: 1, text: "@Quill go" } };+ });+ await handleToolCall("send_channel_message", { channel_id: "channel-1", text: "@Quill go", mentions: ["quill-chief"] }, fetcher);+ expect(sent).toEqual([{ text: "@Quill go", threadId: "room-1", mentions: ["quill-chief"] }]);+ await expect(handleToolCall("send_channel_message", { channel_id: "channel-1", text: "@Quill go", mentions: "quill-chief" }, fetcher))+ .rejects.toThrow("arguments.mentions must be array");+ });});describe("connection security and discovery", () => {diff --git a/server/peer-roster.ts b/server/peer-roster.tsindex c0ac1ccdd7..f3bb3b5057 100644--- a/server/peer-roster.ts+++ b/server/peer-roster.ts@@ -192,7 +192,7 @@ export function resolveTeammate<T extends RosterMember>(const CHOICES_MAX = 12;-function sharedNameChoices(matches: readonly RosterMember[]): string {+export function sharedNameChoices(matches: readonly RosterMember[]): string {const listed = matches.slice(0, CHOICES_MAX).map((bot) => {const role = bot.chiefOfStaff ? "Chief of Staff" : peerName(bot.title ?? "");return `${peerName(bot.name)}${role ? `, ${role}` : ""} (id ${bot.id})`;diff --git a/server/routes/channels.ts b/server/routes/channels.tsindex 60ae84c07e..3e6e77a1e3 100644--- a/server/routes/channels.ts+++ b/server/routes/channels.ts@@ -29,7 +29,7 @@ import type { ThreadStarters } from "../thread-starters.ts";import { extractSteerImages } from "../turn-images.ts";import type { UsageTrigger } from "../usage-ledger.ts";import { parseMentionPicks } from "../../shared/room-mentions.ts";-import { sameNameRefusal } from "../same-name-mentions.ts";+import { sameNameRefusal, sameNameRefusalForBots } from "../same-name-mentions.ts";import { conversationLanguage } from "../server-lines.ts";import { bulkDeleteThreadIds, type BulkDeleteRefusal } from "./bulk-delete.ts";import { PASS, type RouteHandler } from "./table.ts";@@ -394,7 +394,10 @@ export function createChannelRoutes(deps: ChannelRouteDeps): RouteHandler {});}const members = current.memberIds.map((id) => store.bot(id)).filter((bot): bot is BotRecord => Boolean(bot));- const sameName = sameNameRefusal(text, members, mentions, conversationLanguage(threadId));+ // A program on this machine (a bot's shell, a script) reads the ids it can send again with; a person never sees them.+ const sameName = auth.kind === "loopback" && !browserOrigin+ ? sameNameRefusalForBots(text, members, mentions, current.name, "sent")+ : sameNameRefusal(text, members, mentions, conversationLanguage(threadId));if (sameName) throw Object.assign(new Error(sameName), { status: 409 });if (channelMode === "chat") applyRoomHoldsFromMessage(current.id, text, mentions);const threadWorking = groupThreadIsWorking(current.id, threadId);diff --git a/server/same-name-mentions.e2e.test.ts b/server/same-name-mentions.e2e.test.tsindex 6f8414022b..4c1170f85a 100644--- a/server/same-name-mentions.e2e.test.ts+++ b/server/same-name-mentions.e2e.test.ts@@ -1,8 +1,10 @@// Two bots on a Team Cloud share a name, end to end. In a room with both, the one a person picks from the @ list is the// one that answers, also when the line waits behind a running turn; the same name typed with no pick is refused in plain// words before anything is queued; a name only one bot has still works. In a one-to-one chat the picked teammate is the-// one the bot is told about. The engine is the synthetic Claude CLI playing a scripted plan, so it proves the routing,-// not a model's judgement.+// one the bot is told about. A bot that tags the shared name is never let through to every bot of it: its post_to_room+// is refused with each bot's id and goes again by id, and its reply wakes neither. A program on the machine is refused+// with the ids too. The engine is the synthetic Claude CLI playing a scripted plan, so it proves the routing, not a+// model's judgement.import { randomBytes, randomUUID } from "node:crypto";import { existsSync, readFileSync, writeFileSync } from "node:fs";import { join } from "node:path";@@ -14,15 +16,19 @@ const OLIVE = { email: "[email protected]", role: "owner" as const };const ENGINE = `process.env.FAKE_CLAUDE_ROOM_PLAN = process.env.FAKE_CLAUDE_FIXTURE_DIR + "/plan.json";`;const REFUSED = 'Two bots here are named "Marlowe": Marlowe, Analyst and Marlowe, Chief of Staff. Pick the one you mean from the @ list.';const HOLD = "hold the room for a moment";+const POST = "post the launch update";+const ASK = "ask the Marlowes about the numbers";+const UPDATE = "@Marlowe the launch numbers are in.";+const TAGGED = "@Marlowe can you check the numbers?";type Bot = { id: string; name: string; threadId: string };-type Message = { role: string; kind?: string; text?: string; from?: { botId: string } };-type Turn = { botId: string; system: string; prompt: unknown };+type Message = { role: string; kind?: string; text?: string; from?: { botId: string }; tool?: { name: string } };+type Turn = { botId: string; system: string; prompt: unknown; evidence: Array<{ step?: unknown; response?: { result?: { isError?: boolean; content?: Array<{ text: string }> } } }> };let fx: CloudSendFixture, team: CloudTeamFixture;let olive = "";let lead: Bot, analyst: Bot, chief: Bot;-let room: { id: string; threadId: string };+let room: { id: string; threadId: string }, ops: { id: string; threadId: string };const planPath = () => join(team.home, "plan.json");const leadGo = () => join(team.home, "lead-go");@@ -59,8 +65,17 @@ beforeAll(async () => {setup: { bulletin: "", defaultResponder: { kind: "member", botId: lead.id } } });expect(made.status, JSON.stringify(made.body)).toBe(201);room = made.body.group;+ const opened = await team.as(olive, "POST", "/api/groups", { name: "Ops", memberIds: [lead.id],+ setup: { bulletin: "", defaultResponder: { kind: "member", botId: lead.id } } });+ expect(opened.status, JSON.stringify(opened.body)).toBe(201);+ ops = opened.body.group;+ const post = (extra: Record<string, unknown>) => ({ tool: "post_to_room", arguments: { group_id: room.id, message: UPDATE, ...extra } });writeFileSync(planPath(), JSON.stringify({- [lead.id]: { byPrompt: [{ promptIncludes: HOLD, plan: { reply: "Holding.", gateFile: leadGo() } }], reply: "Tessaly here." },+ [lead.id]: { byPrompt: [+ { promptIncludes: ASK, plan: { reply: TAGGED } },+ { promptIncludes: POST, plan: { steps: [{ ...post({}), expectError: true }, post({ mention_ids: [analyst.id] })], reply: "Posted it." } },+ { promptIncludes: HOLD, plan: { reply: "Holding.", gateFile: leadGo() } },+ ], reply: "Tessaly here." },[analyst.id]: { reply: "The analyst here." },[chief.id]: { reply: "The chief here." },}));@@ -137,3 +152,57 @@ it("tells a bot in a one-to-one chat about the teammate picked, and about both wexpect(typed).toContain(`Marlowe (${analyst.id})`);expect(typed).toContain(`Marlowe (${chief.id})`);}, hostTimeout(120_000));++it("refuses a bot's post_to_room that tags the shared name, with each bot's id, and posts it again by id", async () => {+ const before = { analyst: ran(analyst), chief: ran(chief), posts: (await transcript()).length };+ const sent = await team.as(olive, "POST", `/api/groups/${ops.id}/messages`, { text: `@Tessaly ${POST}`, sendId: randomUUID() });+ expect(sent.status, JSON.stringify(sent.body)).toBe(202);+ await expect.poll(() => turns().some((turn) => turn.botId === lead.id && JSON.stringify(turn.prompt).includes(POST)), { timeout: 60_000 }).toBe(true);+ await expect.poll(settled, { timeout: 30_000 }).toBe(true);+ const turn = turns().filter((one) => one.botId === lead.id).at(-1)!;+ const [refused, posted] = turn.evidence.filter((entry) => entry.step).map((entry) => entry.response!.result!);+ expect(refused!.isError).toBe(true);+ expect(refused!.content![0]!.text).toBe(`2 bots in the room "Launch" are named "Marlowe", so nothing was posted: Marlowe, Analyst (id ${analyst.id}); `+ + `Marlowe, Chief of Staff (id ${chief.id}). Post it again with the id of the one you mean in mention_ids.`);+ expect(posted!.isError).toBeFalsy();+ const lines = await transcript();+ expect(lines.filter((message) => message.text === UPDATE).map((message) => message.from?.botId)).toEqual([lead.id]);+ expect(lines.length).toBe(before.posts + 1);+ expect({ analyst: ran(analyst), chief: ran(chief) }).toEqual({ analyst: before.analyst, chief: before.chief });+}, hostTimeout(120_000));++it("wakes neither bot when a bot's reply tags the shared name, tells the person, and tells every bot here who they are by id", async () => {+ const before = { analyst: ran(analyst), chief: ran(chief) };+ const sent = await say(`@Tessaly ${ASK}`);+ expect(sent.status, JSON.stringify(sent.body)).toBe(202);+ await expect.poll(async () => (await transcript()).some((message) => message.text === TAGGED), { timeout: 60_000 }).toBe(true);+ await expect.poll(settled, { timeout: 30_000 }).toBe(true);+ const lines = await transcript();+ const reply = lines.findIndex((message) => message.text === TAGGED);+ expect(lines.slice(reply + 1).map((message) => message.tool?.name)).toContain('More than one bot here is named "Marlowe", so that mention reached none of them.');+ expect({ analyst: ran(analyst), chief: ran(chief) }).toEqual(before);+ const system = turns().filter((turn) => turn.botId === lead.id && JSON.stringify(turn.prompt).includes(ASK)).at(-1)!.system;+ expect(system).toContain(`Some members here share a name, so an @mention of that name reaches none of them: "Marlowe" is Marlowe, Analyst (id ${analyst.id}); `+ + `Marlowe, Chief of Staff (id ${chief.id}). To bring one in, use coordinate_bots with its id.`);+}, hostTimeout(120_000));++it("refuses a program on the machine with each bot's id, and takes the line again by id", async () => {+ const local = async (method: string, path: string, body?: unknown) => {+ const answer = await fx.local(method, path, body);+ expect(answer.status, JSON.stringify(answer.body)).toBeLessThan(300);+ return answer.body;+ };+ const one = (await local("POST", "/api/bots", { name: "Marlowe", title: "Analyst" })).bot as Bot;+ const two = (await local("POST", "/api/bots", { name: "Marlowe", title: "Writer" })).bot as Bot;+ const desk = (await local("POST", "/api/groups", { name: "Desk", memberIds: [one.id, two.id],+ setup: { bulletin: "", defaultResponder: { kind: "mentions" } } })).group as { id: string; threadId: string };+ const refused = await fx.local("POST", `/api/groups/${desk.id}/messages`, { text: "@Marlowe status?" });+ expect(refused.status).toBe(409);+ expect(refused.body.error).toBe(`2 bots in the room "Desk" are named "Marlowe", so nothing was sent: Marlowe, Analyst (id ${one.id}); `+ + `Marlowe, Writer (id ${two.id}). Send it again with the id of the one you mean in mentions.`);+ expect((await local("GET", `/api/threads/${desk.threadId}/messages?limit=50`)).messages).toEqual([]);+ const taken = await fx.local("POST", `/api/groups/${desk.id}/messages`, { text: "@Marlowe status?", mentions: [two.id] });+ expect(taken.status, JSON.stringify(taken.body)).toBe(202);+ await expect.poll(async () => ((await local("GET", "/api/bots?messages=0")).groups as Array<{ id: string; working?: boolean; busyBotId?: string | null }>)+ .some((group) => group.id === desk.id && !group.working && !group.busyBotId), { timeout: 60_000 }).toBe(true);+}, hostTimeout(120_000));diff --git a/server/same-name-mentions.test.ts b/server/same-name-mentions.test.tsindex 214308561f..fedc0285f9 100644--- a/server/same-name-mentions.test.ts+++ b/server/same-name-mentions.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from "vitest";-import { sameNameRefusal } from "./same-name-mentions.ts";+import { roomPostRefusal, sameNameRefusal, sameNameRefusalForBots, sharedNamesNote, unreachedMentionLines } from "./same-name-mentions.ts";import { mentionedBots, roomResponders } from "./store.ts";const analyst = { id: "quill-analyst", name: "Quill", title: "Analyst" };@@ -36,8 +36,10 @@ describe("room routing with picks", () => {expect(mentionedBots("@Quill take this", room, [analyst.id])).toEqual([analyst]);});- it("sends a bot's own unpicked tag of a shared name to every bot of that name", () => {- expect(roomResponders("@Quill take this", room, { kind: "mentions" })).toEqual([analyst, chief]);+ it("wakes none of the bots of a shared name a bot tagged with no pick, and still the others it named", () => {+ expect(roomResponders("@Quill take this", room, { kind: "mentions" })).toEqual([]);+ expect(roomResponders("@Quill and @Scout take this", room, { kind: "mentions" })).toEqual([scout]);+ expect(mentionedBots("@Quill take this", room)).toEqual([analyst, chief]);});it("keeps @everyone and a unique name as they were", () => {@@ -46,3 +48,43 @@ describe("room routing with picks", () => {expect(roomResponders("hello", room, { kind: "member", botId: analyst.id }, [chief.id])).toEqual([analyst]);});});++describe("a bot's or another app's room line that tags a name two bots share", () => {+ const ids = `Quill, Analyst (id ${analyst.id}); Quill, Chief of Staff (id ${chief.id})`;++ it("is refused with each bot's role and id, and how to send it again", () => {+ expect(sameNameRefusalForBots("@Quill check this", room, undefined, "Launch", "posted")).toBe(+ `2 bots in the room "Launch" are named "Quill", so nothing was posted: ${ids}. Post it again with the id of the one you mean in mention_ids.`,+ );+ expect(sameNameRefusalForBots("@quill check this", room, [], "Launch", "sent")).toBe(+ `2 bots in the room "Launch" are named "Quill", so nothing was sent: ${ids}. Send it again with the id of the one you mean in mentions.`,+ );+ expect(sameNameRefusalForBots("@Quill check this", room, [analyst.id], "Launch", "sent")).toBeNull();+ });++ it("checks a post's ids before its names", () => {+ const launch = { name: "Launch", memberIds: room.map((bot) => bot.id) };+ const lookup = (id: string) => room.find((bot) => bot.id === id);+ expect(roomPostRefusal(undefined, "@Quill check this", launch, lookup)).toEqual({ status: 409, error: expect.stringContaining(ids) });+ expect(roomPostRefusal([chief.id], "@Quill check this", launch, lookup)).toBeNull();+ expect(roomPostRefusal("quill-chief", "@Quill check this", launch, lookup)).toEqual({ status: 400, error: "mention_ids must be a list of up to 20 bot ids" });+ expect(roomPostRefusal(undefined, "@Scout check this", launch, lookup)).toBeNull();+ });++ it("tells the person under a bot's reply which tags reached nobody", () => {+ const outsider = { id: "bolt", name: "Bolt" };+ expect(unreachedMentionLines("@Quill and @Bolt, and @Scout", room, [outsider], undefined)).toEqual([+ "Bolt isn't in this room, so that mention didn't reach them — add them to the room to bring them in.",+ 'More than one bot here is named "Quill", so that mention reached none of them.',+ ]);+ expect(unreachedMentionLines("@Scout look", room, [outsider], undefined)).toEqual([]);+ });++ it("tells a bot every turn which other members share a name, by id", () => {+ expect(sharedNamesNote(room, true)).toBe(+ `Some members here share a name, so an @mention of that name reaches none of them: "Quill" is ${ids}. To bring one in, use coordinate_bots with its id.`,+ );+ expect(sharedNamesNote(room, false)).not.toContain("coordinate_bots");+ expect(sharedNamesNote([analyst, scout], true)).toBe("");+ });+});diff --git a/server/same-name-mentions.ts b/server/same-name-mentions.tsindex a6044bfd1d..07aab357eb 100644--- a/server/same-name-mentions.ts+++ b/server/same-name-mentions.ts@@ -1,5 +1,5 @@-import { resolveMentions } from "../shared/room-mentions.ts";-import { clip } from "./peer-roster.ts";+import { parseMentionPicks, resolveMentions } from "../shared/room-mentions.ts";+import { clip, peerName, sharedNameChoices } from "./peer-roster.ts";import { serverLine } from "./server-lines.ts";type Member = { id: string; name: string; title?: string; chiefOfStaff?: boolean; hidden?: boolean };@@ -24,3 +24,63 @@ export function sameNameRefusal(? serverLine(language, "server.rooms.sameName.two", { name, first: choices[0]!, second: choices[1]! }): serverLine(language, "server.rooms.sameName.many", { name, count: choices.length, choices: choices.join("; ") });}++/** The same refusal for a bot or another app: each bot of that name with its id, so it sends again by id. `posted`: a+ * bot's post_to_room, which takes the ids in mention_ids; `sent`: a send to the room's messages, in mentions. */+export function sameNameRefusalForBots(+ text: string,+ members: readonly Member[],+ picked: readonly string[] | undefined,+ room: string,+ how: "posted" | "sent",+): string | null {+ const [sharing] = resolveMentions(text, members, picked).ambiguous;+ if (!sharing) return null;+ const again = how === "posted" ? "Post it again with the id of the one you mean in mention_ids." : "Send it again with the id of the one you mean in mentions.";+ return `${sharing.length} bots in the room "${peerName(room)}" are named "${peerName(sharing[0]!.name)}", so nothing was ${how}: ${sharedNameChoices(sharing)}. ${again}`;+}++/** A bot's post_to_room into a room: its mention_ids checked, then its @names. Null when it can go. */+export function roomPostRefusal(+ rawPicks: unknown,+ text: string,+ room: { name: string; memberIds: readonly string[] },+ bot: (id: string) => Member | null | undefined,+): { status: 400 | 409; error: string } | null {+ const picked = parseMentionPicks(rawPicks);+ if (picked === null) return { status: 400, error: "mention_ids must be a list of up to 20 bot ids" };+ const members = room.memberIds.map(bot).filter((member): member is Member => Boolean(member));+ const error = sameNameRefusalForBots(text, members, picked, room.name, "posted");+ return error ? { status: 409, error } : null;+}++/** What a person reads under a bot's room reply about @names it reached nobody with: a bot outside the room, or a name+ * several of the other members share. */+export function unreachedMentionLines(+ text: string,+ members: readonly Member[],+ outsiders: readonly Member[],+ language: string | undefined,+): string[] {+ const outside = resolveMentions(text, outsiders).bots+ .filter((bot, at, all) => all.findIndex((other) => other.name === bot.name) === at)+ .map((bot) => serverLine(language, "server.rooms.mentionMissed", { bot: bot.name }));+ const shared = resolveMentions(text, members).ambiguous+ .map((sharing) => serverLine(language, "server.rooms.sameNameMissed", { name: clip(sharing[0]!.name, 80) }));+ return [...outside, ...shared];+}++/** Told to a bot every turn in a room where other members share a name: who they are, by id, since an @mention of that+ * name reaches none of them. Empty when no name is shared. */+export function sharedNamesNote(others: readonly Member[], canCoordinate: boolean): string {+ const byName = new Map<string, Member[]>();+ for (const bot of others) {+ if (bot.hidden || !bot.name.trim()) continue;+ const key = bot.name.toLowerCase();+ byName.set(key, [...(byName.get(key) ?? []), bot]);+ }+ const sharing = [...byName.values()].filter((group) => group.length > 1);+ if (!sharing.length) return "";+ const named = sharing.map((group) => `"${peerName(group[0]!.name)}" is ${sharedNameChoices(group)}`).join("; ");+ return `Some members here share a name, so an @mention of that name reaches none of them: ${named}.${canCoordinate ? " To bring one in, use coordinate_bots with its id." : ""}`;+}diff --git a/server/store.ts b/server/store.tsindex 7c85a49dda..53db8d6cc6 100644--- a/server/store.ts+++ b/server/store.ts@@ -256,7 +256,8 @@ export function roomResponders<T extends { id: string; name: string; hidden?: boreturn available;}}- const mentioned = mentionedBots(text, available, picked);+ const { bots, ambiguous } = resolveMentions(text, available, picked);+ const mentioned = bots.filter((bot) => !ambiguous.some((sharing) => sharing.includes(bot)));if (mentioned.length) return mentioned;if (defaultResponder.kind === "everyone") return available;if (defaultResponder.kind === "member") {diff --git a/src/locales/de.json b/src/locales/de.jsonindex 26de144dfe..9561eaa6f7 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -186,6 +186,7 @@"server.rooms.sameName.many": "{count} Bots hier heißen „{name}“: {choices}. Wähle in der @-Liste den aus, den du meinst.","server.rooms.sameName.choice": "{name}, {role}","server.rooms.sameName.chief": "Stabschef",+ "server.rooms.sameNameMissed": "Mehrere Bots hier heißen „{name}“, die Erwähnung hat also keinen von ihnen erreicht.","server.rooms.noneActive": "Kein aktives Raummitglied kann antworten. Stelle einen archivierten Bot wieder her oder füge ein aktives Mitglied hinzu.","server.rooms.stillStopping": "{bot} wird noch gestoppt, diese Nachricht wurde nicht zugestellt","server.rooms.someoneStillStopping": "Ein Raummitglied wird noch gestoppt, diese Nachricht wurde nicht zugestellt",diff --git a/src/locales/en.json b/src/locales/en.jsonindex d1806d545e..3503361c5e 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -278,6 +278,7 @@"server.rooms.sameName.many": "{count} bots here are named \"{name}\": {choices}. Pick the one you mean from the @ list.","server.rooms.sameName.choice": "{name}, {role}","server.rooms.sameName.chief": "Chief of Staff",+ "server.rooms.sameNameMissed": "More than one bot here is named \"{name}\", so that mention reached none of them.","server.rooms.noneActive": "No active room members can respond — restore an archived bot or add an active member.","server.rooms.stillStopping": "{bot} is still stopping — this message was not dispatched","server.rooms.someoneStillStopping": "A room member is still stopping — this message was not dispatched",