Prevent self-directed agent messages

This commit is contained in:
ZacharyZhang-NY committed 2026-04-22 20:28:49 -04:00
1 parent 1a7eb8f1b3
commit a4af4a866a
6 files changed
+169

No files matched your search

+3
View File
@@ -61,6 +61,9 @@ export function buildMessageMethods(
if (channel === "direct" && !input.toAgentId) {
throw new Error("Direct messages require a recipient.");
}
if (channel === "direct" && input.toAgentId === input.fromAgentId) {
throw new Error("Direct messages require two distinct participants.");
}
const senderKind = input.senderKind
?? (input.fromAgentId === BOARD_READER_ID ? "human" : "agent");
const id = randomUUID();