8000 feat(automations): read the stream of activities over the API, MCP and the assistant by adeelahmad · Pull Request #428 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(automations): read the stream of activities over the API, MCP and the assistant - #428

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-3p5r9r
Oct 15, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-3p5r9r

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: the stream of activities (new assets and the event log) could only be read from Python inside the server.

After: people and agents read it the same way. GET /api/v1/activities lists what happened, newest first, as Activity Streams 2.0 activities with a Lens kind, filtered by kinds, actor, namespace, tag, time, words or a match tree, and paged with next; GET /api/v1/activities/kinds is the kinds catalog (label, source, parent and children, a JSON Schema with field titles, untrusted fields, a sample); GET /api/v1/activities/{id} is one activity. Agents get the same through the MCP tools timeline and event_kinds and the assistant's timeline tool. Everyone sees only what their namespaces and each activity's audience allow; an app signed in by an admin over OAuth reads every namespace but not what is for admins alone.

How: thin routes over events.page/events.get/events.kinds with response models (fields a source leaves out stay out, so the API's JSON equals what MCP gives), the MCP tools call the routes' helpers, and the assistant tool keeps to the conversation's namespaces and the recordings it may read. Fourth part of workflow studio module M1.

Motivation and Context

Workflow studio plan (/mnt/project-files/workflow-studio/plan.md, M1 step 4); differences from the plan are in /mnt/project-files/workflow-studio/m1-notes.md.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md. (n/a: the title says it)

Done questions (AGENTS.md)

  • Goal: the timeline read over the API, MCP and the assistant, merged on green CI.
  • Agents: yes, this is the agent surface: MCP timeline and event_kinds, the assistant's timeline, and the REST routes.
  • Zero setup: works on install; no new setting.
  • Fewest clicks: n/a, no UI here (the timeline page is a later module).
  • Configurable: n/a, no new setting (stream settings come in the next PR).
  • Light: reads existing rows with indexed queries; no new process.
  • Private and secure: namespace and audience checks on every read, admins-only activities kept from OAuth apps, outside text listed in lens.untrusted; the assistant tool stays in its conversation's namespaces.
  • Cost: no model calls.
  • User decides: read only.
  • Upgrades: no stored data changes.
  • Honest: docs/automations.md labels the timeline API and tools built.
  • Tests, docs and generated files: tests/api/test_activities.py (newest first, visibility per person, filters, paging, errors, kinds; MCP and the assistant give the same as the API; a follower in two processes handles each new asset once); docs/api.md, docs/mcp.md, docs/assistant.md, docs/automations.md; openapi.json and the client regenerated with make openapi's commands.
  • Open standards: W3C Activity Streams 2.0 and JSON Schema; no new dependencies.
  • Reported; refine later stays in docs/automations.md.
  • Reuse: events.page, match trees, the MCP tool and assistant Toolbox patterns, Access.readable/nsid.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RFQUkVmALkdhRqXY1yFxW5


Generated by Claude Code

…d the assistant

GET /api/v1/activities (newest first, with filters and paging),
/activities/kinds and /activities/{id}; the MCP tools timeline and
event_kinds; and the assistant's timeline tool. Each person sees only
their namespaces and the activities meant for them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RFQUkVmALkdhRqXY1yFxW5
@adeelahmad adeelahmad self-assigned this Oct 15, 2026
@adeelahmad
adeelahmad merged commit 6ae9790 into main Oct 15, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-3p5r9r branch October 15, 2026 18:07
adeelahmad added a commit that referenced this pull request Oct 15, 2026
… in progress (#430)

The stream of activities (#425 to #428) merged: agents read it through
the API, MCP's timeline tool and the assistant. Say so under Automate it,
with automations that act on it labelled in progress, add the open
Settings section (#429) to In progress, and link the automations page
from the docs index.


Claude-Session: https://claude.ai/code/session_01HDx7PPUauyjMn1LZs8JAsS

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0