Repository navigation
feat(automations): what people say to Lens as chat.message activities - #448
Merged
Merged
Conversation
Messages Lens already keeps (chat_message with role user) are read by (created_at, id) over a new (role, created_at) index. A web-app message is its person's alone; a chat app's belongs to the namespace its room answers in, else to the answering account. Room chats keep where they are (chat.via), and an automation's own question to its agent is marked with its origin so it never counts as a person's. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QewNs6jxSB2vRoag2EvdyX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Before: automations could not start from something a person said to Lens.
After: a new
chat.messageactivity for each message a person says to Lens, in the web app or through a chat app (Telegram, Slack, Matterbridge). A web-app message is its person's alone (not even admins see it). A chat-app message belongs to the namespace its room answers in, else to the account the bot answers as. Messages Lens never stores (group chatter not addressed to it) never become activities. An automation's own question to its agent carries its origin and is left out, so an automation can't trigger itself.How: a
chat_messagessource readschat_messagerows with role user by (created_at, id) over a new (role, created_at) index. Room chats now keep where they came from (chat.via), andchat.addtakes anorigin.Motivation and Context
Workflow Studio M3 (plan section 3): chat as a trigger for automations.
Types of changes
!in the title)Checklist:
make hookschecks it on commit).tests/api/test_chat_activities.py, embedded and SurrealDB server)docs/accordingly. (docs/automations.md,docs/chat-rooms.md)## UnreleasedinCHANGELOG.md. n/a: the title says it.Done questions (AGENTS.md)
IF NOT EXISTS; older rows withoutviaororiginread as before. Safe to run twice.docs/automations.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01QewNs6jxSB2vRoag2EvdyX
Generated by Claude Code