Repository navigation
feat(automations): comments, notes and graph changes as activities - #443
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_019nbuG2q5wEXeUxWb8vr5HJ
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.
Requested by Adeel · project thread
Description
Before: the stream of activities had nothing for what people and agents write and curate, so an automation couldn't react to a comment, a note or a change to the entity graph.
After: four more kinds, each with its own source.
comment.addedcommentsNote:content,inReplyTo,quote,t0,t1;targetis the assetnote.creatednote_pagesPage:summary,about,place,authornote.savednote_versionsversionandwhyentity.changedgraphop(created, renamed, merged, split, linked, unlinked, deleted, rolled back, changed),change,entityType,before,version,count; tagged with its entitiesHow:
comment.addedreadscommentbycreated_at.note.savedreads the versions the notebook keeps of each change (note_versionbyat) and keeps one per page in each ten minutes of the clock (note-<page>-<window>): a follower hears of a window's first change, the timeline shows its newest, and a read goes on past versions already told of, so a page is never short.note.createdreadsnote_pagebycreated_at, so pages the assistant or an agent write (only ever created) are seen too.entity.changedreadsgraph_eventbyat, the event number breaking ties; its actor is the automation, the assistant or the MCP agent it came through, else the person, routine or Lens; a change spanning namespaces (a link) names entities of each, so it is for admins, with every namespace inlens.spaces. Each source reads several activities in one query (get_many). New indexes:comment_created,note_page_created,note_version_at,graph_event_at.Also a fix: SurrealDB 3.2.4 gives an index range's first rows, not its last, for
ORDER BY ... DESC LIMIT n, so a timeline page filtered bysinceoruntil(an admin's, which has no namespace condition) could list the oldest activities in the range instead of the newest. Sources now write a page's time bounds so that no index range is used (events_content._bound); a new test fails without it.Workflow studio M2 (content sources), part 3 of 3, after #435 and #440.
Motivation and Context
Workflow studio plan, module M2 (
/mnt/project-files/workflow-studio/briefs/M2.md), items 5, 6 and 8. Where this differs from the brief is in/mnt/project-files/workflow-studio/m2-notes.mdfor later modules.Defaults taken (reversible):
note.createdadded next tonote.saved, not under it, so a page made and then written on doesn't fire anote.savedtrigger twice; the graph is read by(at, number)rather than the number alone, so it fits the stream's[time, id]positions; up to twenty entity tags; multi-namespace graph changes for admins only (under Refine later).Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md. (n/a: the title says it)Done questions (AGENTS.md)
GET /api/v1/activitiesand/kinds, and the MCP and assistanttimelineandevent_kindstools.make openapi.Note,Page,inReplyTo,target,Mentiontags); no new dependencies.Tests:
tests/domain/test_events_content.py: comments and replies throughcomments.create; notes throughnotebook.createandnotebook.updateby two people and the assistant (one activity per window, newest on the timeline); 99 versions in one window paged one at a time; graph changes from analysis (seed),entities.rename,entities.mergethrough the assistant andentities.linkby an automation (admins only); a page between two times for an admin and a viewer. The timeline tests that list the seeded assets now ask forasset.added, since analysis changes the graph too. Full backend suite green locally (1199 passed).🤖 Generated with Claude Code
https://claude.ai/code/session_019nbuG2q5wEXeUxWb8vr5HJ
Generated by Claude Code