From 6fc463fc2ee0ceca7d7538bdf20cc1aaa4828e28 Mon Sep 17 00:00:00 2001 From: itsskofficial Date: Thu, 15 Oct 2026 20:08:45 +0530 Subject: [PATCH 1/5] feat(channels): treat other people in group chats as outside content, and let the user trust a chat again Telegram groups and Discord server channels can be paired; the person who paired one is its owner and the only one Sentient answers there. Other members' messages are stored as outside content (role other), mark the chat and never start a reply, a command or a button. The user can clear a chat's mark after checking it (I've checked it in the window, /trust yes in a paired chat), logged in the chat and in Activity. ADR 0029 amends 0018, 0023 and 0024. Closes #217 --- CHANGELOG.md | 10 + .../src/features/channels/MessagingApps.tsx | 4 +- desktop/src/features/chat/ChatPage.tsx | 8 +- desktop/src/features/chat/OutsideContent.tsx | 88 ++++++++ desktop/src/lib/api.ts | 2 + desktop/src/lib/chatFold.ts | 36 +++- desktop/src/lib/events.ts | 4 +- desktop/src/lib/types.ts | 11 +- docs/API.md | 52 ++++- .../0018-untrusted-content-gates-sending.md | 8 +- .../0023-mark-outside-content-in-prompts.md | 4 +- .../0024-second-look-at-outgoing-actions.md | 4 +- ...9-group-chats-and-trusting-a-chat-again.md | 64 ++++++ docs/adr/README.md | 1 + sentient/activity/timeline.py | 40 +++- sentient/agent/loop.py | 59 ++++++ sentient/agent/second_look.py | 9 +- sentient/channels/base.py | 100 ++++++++- sentient/channels/discord.py | 39 +++- sentient/channels/store.py | 17 +- sentient/channels/telegram.py | 37 +++- sentient/gateway/routes/core.py | 13 ++ sentient/store/schema.sql | 4 +- sentient/tools/builtin/memory_tool.py | 8 +- sentient/tools/rules.py | 16 ++ tests/channels/test_discord.py | 33 +++ tests/channels/test_group_chats.py | 173 ++++++++++++++++ tests/test_group_and_trust.py | 189 ++++++++++++++++++ 28 files changed, 987 insertions(+), 46 deletions(-) create mode 100644 desktop/src/features/chat/OutsideContent.tsx create mode 100644 docs/adr/0029-group-chats-and-trusting-a-chat-again.md create mode 100644 tests/channels/test_group_chats.py create mode 100644 tests/test_group_and_trust.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bd71fb1..05e3aae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ and versions follow [Semantic Versioning](https://semver.org/). ## [Unreleased] ### Added +- **Sentient in group chats, safely.** You can now pair a Telegram group or a Discord server channel with the same + `/pair` code. Sentient answers only you there, when you mention it, reply to it or send a command. What other people + write is treated like an email from a stranger: Sentient can read it, but never takes orders from it, and after + someone else writes, anything it would send checks with you first, naming who wrote it ("That address came from + another group member (Ravi), not from you."). Only you can press its buttons, and task results stay out of a group + unless you turn them on. +- **Trust a chat again after you've checked it.** A chat that read an email, a web page or a group member's message + shows a bar saying so above the message box. If you've looked at it and it's fine, click **I've checked it** (or + send `/trust` in Telegram, Discord or WhatsApp) and sending from that chat follows your usual approval settings + again. It's noted in the chat and in Activity, and anything new from outside makes it ask again. - **Keep work, personal and project memories apart.** Each memory is now kept for Personal, Work, a project you name, or every chat (for things like your name or how you like answers). Pick a chat's memories from the button at the top of the chat, or before you start one. A work chat then uses your work memories and the ones for every chat, diff --git a/desktop/src/features/channels/MessagingApps.tsx b/desktop/src/features/channels/MessagingApps.tsx index b96aca8c..31268128 100644 --- a/desktop/src/features/channels/MessagingApps.tsx +++ b/desktop/src/features/channels/MessagingApps.tsx @@ -189,7 +189,9 @@ function PairedRow({ channel, chat }: { channel: Channel; chat: PairedChat }) {
{chat.label}
-
Paired {relativeTime(chat.paired_at)}
+
+ {chat.is_group ? 'Group: only you can talk to Sentient here. ' : ''}Paired {relativeTime(chat.paired_at)} +