Repository navigation
feat(automations): new assets as emails, calendar events, files, uploads, web pages and imports - #435
Merged
Merged
Conversation
…ads, web pages and imports A new asset is now an activity of the most specific kind its row tells: email.received, calendar_event.added, file.added, upload.added, web_page.saved or import.received, all children of asset.added, each with its own fields (who an email was from and to, an event's times and place, a file's path, type and size, a page's site) and outside text marked untrusted. Actors are named from what Lens writes down (sources, watches, people by account or email, import hooks, routines, sensors, automations) in a few queries per page. Mail addressing and event times are kept on the resource when it is made (recording.mail, recording.event), and an email's attachments and the start of its text once it is read, so nothing is parsed on read. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019nbuG2q5wEXeUxWb8vr5HJ
… the API Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019nbuG2q5wEXeUxWb8vr5HJ
…-pss8a6 # Conflicts: # docs/automations.md # docs/database.md
This was referenced Oct 15, 2026
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.
Requested by Adeel · project thread
Description
Before: every new asset in the stream of activities was a plain
asset.added, so an automation couldn't say "when an email from the school arrives" and the timeline couldn't tell an email from an upload.After: a new asset is an activity of the most specific kind its row tells, each a child of
asset.added(a trigger onasset.addedstill matches them all):email.receivedfrom,to,cc,subject,list,mailbox,date,snippet,attachmentscalendar_event.addedstartTime,endTime,location,organizer,attendees,calendarfile.addedpath,mediaType,size,durationupload.addedpath(file name),mediaType,size,durationweb_page.savedhref,siteimport.receivedvia(hook, paste, file)How: the kind comes from the row's content type and where it came from (mail or calendar source, import hook,
web,remote, the uploads folder, an import), never from reading the file. Actors are named from what Lens writes down (sources and watches, people by account id or email, import hooks by id or by name, routines, sensors, automations, the assistant) byevents_content.actors, a few batched queries per page with names kept 30 seconds. Every asset's object also carries its recognised content type now (it was only a chosen one). Outside text (subjects, addresses, snippets, places, file names, page addresses) is listed inlens.untrusted.So nothing is parsed on read, a message's addressing is kept on the resource as it is listed (
recording.mail; Cc now kept apart, Gmail's snippet kept), a calendar event's times, place and people as it is imported (recording.event,calendars.details), and an email's attachment count and the start of its text once it is read (convert.email_info, into the existingrecording.email, whose API schemaEmailInfonow namesattachmentsandsnippet). Older rows are read without those fields.Workflow studio M2 (content sources), part 1 of 3. Jobs, deletions and calendar moves come next, then comments, notes and graph changes.
Motivation and Context
Workflow studio plan, module M2 (
/mnt/project-files/workflow-studio/briefs/M2.md): make what arrives in the archive readable as specific activities for triggers (M6), pickers (M11), variables (M9) and the timeline (M10).Defaults taken (reversible): an uploaded
.emlcounts asemail.received(content type decides first); a file an email held staysasset.added; a video saved from a URL isweb_page.saved; the page address isobject.hrefsoobject.urlstays the Lens link, as on every other kind;durationis in seconds.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.recording.mail,recording.event); older rows read without them, so no upgrade step.EmailInfogained two fields; client regenerated withmake openapi).startTime,endTime,mediaType,href); no new dependencies.Tests:
tests/domain/test_events_content.py, one per kind through the real code paths (sources._ingestwith a mail and a calendar entry, a storage file,uploads.take,webcapture.create,import_hooks.accept_textandaccept_file,ingest.import_text), actors, and paging 600 assets with one timestamp.🤖 Generated with Claude Code
https://claude.ai/code/session_019nbuG2q5wEXeUxWb8vr5HJ