Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ The backend (`fastapi_backend`) and the frontend (`nextjs-frontend`) are version
- **Automations on feed posts.** Each new post of a news feed is a `feed_post.received` activity with its address,
site, feed, author, date and categories, so an automation can start on posts from one feed, author or category
([Kinds](docs/automations.md#kinds)).
- **Agents follow news feeds.** `subscribe_feed` (MCP and the assistant, admins) follows a feed into a namespace in one
step, checked before it's kept; `news_feeds` lists them and `unsubscribe_feed` stops one
([News feeds](docs/processing.md#news-feeds-rss-and-atom)).

## 0.14.0 <small>October 17, 2026</small> {id="0.14.0"}

Expand Down
5 changes: 3 additions & 2 deletions docs/assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,9 @@ and stops after 15 idle minutes. Installs that don't run on Docker don't have th
## Setting up and running the server by chat

Admins also get the server tools: `server_status` (what's set up and what's missing), `find_model_servers`,
`read_settings` and `change_settings` (the processing and AI sections, not the server's hosts, cookies or tokens) and
`create_namespace`, and the people tools: `list_people`, `invite_person` (an account, optionally with a role in one
`read_settings` and `change_settings` (the processing and AI sections, not the server's hosts, cookies or tokens),
`create_namespace`, the news feed tools: `news_feeds`, `subscribe_feed` (follow a feed into a namespace in one step,
[News feeds](processing.md#news-feeds-rss-and-atom)) and `unsubscribe_feed`, and the people tools: `list_people`, `invite_person` (an account, optionally with a role in one
namespace; Lens emails the sign-in link when mail is set up) and `change_person` (a role in a namespace, or disabling
and enabling an account). Removing an account for good stays in the web app and the API. In an ordinary conversation
their changes are approval cards. In a **setup conversation**
Expand Down
5 changes: 4 additions & 1 deletion docs/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ For an app that speaks OpenAI's API rather than MCP, the namespace can also answ
| `set_picture_descriptions` | choose what describes pictures (`engine` `llm` or `florence-2`), the provider's `vision_model`, Florence-2's size (`florence_model`) and `describe_max`. Admins only, with a write-scope token |
| `install_settings` | whether other devices on the network reach Lens and its edition (full or lean), whether the machine's upgrade agent can change them, and the install line to run when it can't. Admins only |
| `set_install_settings` | open Lens to the network or keep it to this machine, or change the edition: the machine sets itself up again and Lens restarts ([Updates](updates.md#setting-the-machine-up-again)). Admins only, with a write-scope token |
| `news_feeds` | the news feeds (RSS or Atom) Lens follows, the namespaces each brings posts into and how the last scan went; addresses stay sealed. Admins only |
| `subscribe_feed` | follow a news feed into a namespace in one step: its address or a page of the site, read first and kept only if it works; `backfill` also brings in the posts it lists now ([News feeds](processing.md#news-feeds-rss-and-atom)). Admins only, with a write-scope token |
| `unsubscribe_feed` | stop following a news feed; the posts it brought in stay. Admins only, with a write-scope token |
| `propose_graph_change` | ask for two entities to be merged or linked; it waits in Proposed changes unless `apply` makes it at once (it can be undone). Needs a write-scope token and editor access |
| `undo_graph_change` | take back a merge or link `propose_graph_change` made. Needs a write-scope token and editor access |
| `edit_entity` | rename an entity, change its type, describe it, set the other ways it's said, or hide or show it. Needs a write-scope token and editor access |
Expand All @@ -147,7 +150,7 @@ which records an undoable change (proposed by default), `undo_graph_change`, `ed
`merge_topics`, `delete_topic` and `undo_topic_change`, which curate entities and topics as an editor does in the web
app (merges and deletes can be undone), `write_note`, which adds a note, `create_podcast`, which
queues an episode, `write_spec`, which queues a spec, `set_nsfw` and `mark_nsfw`, which change [NSFW classification](nsfw.md) (owners or admins, and
editors), `set_namespace_integrations`, which turns a namespace's own MCP server or chat completions on or off (owners), `set_picture_descriptions`, which changes what describes pictures (admins), `set_file_storage`, which changes where new files are kept (admins), and `set_monitoring`,
editors), `set_namespace_integrations`, which turns a namespace's own MCP server or chat completions on or off (owners), `set_picture_descriptions`, which changes what describes pictures (admins), `set_file_storage`, which changes where new files are kept (admins), `subscribe_feed` and `unsubscribe_feed`, which follow and stop following news feeds (admins), and `set_monitoring`,
`set_sandbox_gateway` (the [code sandbox](assistant.md#code-sandbox)'s gateway) and `set_install_settings`, which have
the machine change how Lens runs (admins).
Importing stays in the web app and the API.
Expand Down
10 changes: 6 additions & 4 deletions docs/processing.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,11 @@ importing chosen ones and watching work as above. [News feeds](#news-feeds-rss-a

### News feeds (RSS and Atom)

A news feed (type `rss`) is a source too: Settings › Sources › Add › News feed, then watch it. Watching a feed
subscribes to it: each new post becomes a text resource of the namespace, titled and dated by the post, so answers cite
it and its link.
A news feed (type `rss`) is a source too: on the Sources page (Sensors › Files, email and calendars), add a News feed,
then watch it. Watching a feed subscribes to it: each new post becomes a text resource of the namespace, titled and
dated by the post, so answers cite it and its link. An agent does both in one step: `subscribe_feed` over
[MCP](mcp.md) or the assistant's tool of that name (admins) takes the address and a namespace, reads the feed first and
keeps it only if it works; `news_feeds` lists what's followed and `unsubscribe_feed` stops one.

- **Address**: the feed's own (`https://`, or `feed://`), or a page of the site: when the page names its feed
(`<link rel="alternate" type="application/rss+xml">`, as blogs and news sites do), the first feed it names is read.
Expand Down Expand Up @@ -601,7 +603,7 @@ it and its link.

Refine later: JSON Feed (feedparser reads RSS and Atom only); an option to capture each post's whole page, for feeds
that carry only a summary; podcast feeds bringing in each episode's audio to transcribe; OPML import of a feed list;
subscribing in one step (address and namespace) from Settings.
subscribing in one step (address and namespace) on the Sources page, as agents can.

### Gmail and Google Workspace

Expand Down
1 change: 1 addition & 0 deletions docs/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ request, to another check that proves the same thing; loosening a requirement or
| IMAP mail, Gmail and Google Workspace | [test_mail_calendar_sources.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_mail_calendar_sources.py) `test_an_imap_account_as_a_source`, `test_an_imap_message_is_an_email_document_with_its_attachments`; [test_gmail_source.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_gmail_source.py) `test_a_workspace_mailbox_through_the_gmail_api`, `test_a_connected_google_account` |
| iCal calendars and Google Calendar | [test_mail_calendar_sources.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_mail_calendar_sources.py) `test_a_calendar_feed_as_a_source`; [test_google_calendar_source.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_google_calendar_source.py) `test_a_shared_calendar_read_as_a_service_account`, `test_a_connected_google_account` |
| RSS and Atom news feeds: a feed or a site's page as a source, each post imported as text with its link, author and date; private networks only when allowed | [test_news_feed_source.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_news_feed_source.py) `test_a_news_feed_as_a_source`, `test_feed_addresses`, `test_what_a_feed_holds_stays_data`, `test_a_feed_file_imported_as_text` |
| Agents follow news feeds in one step: MCP `subscribe_feed` checks a feed and watches it into a namespace, `news_feeds` lists them with addresses sealed, `unsubscribe_feed` stops one; the assistant's tools ask first | [test_news_feed_source.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_news_feed_source.py) `test_subscribing_in_one_step`; [test_setup_assistant.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_setup_assistant.py) `test_the_assistant_follows_news_feeds` |
| A built-in MQTT broker, syslog and webhook streams | [test_sensors.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_sensors.py) `test_hub_takes_devices_in_and_organises_them`, `test_syslog_senders_become_sensors`, `test_webhooks_and_one_list_of_sensors`; [journeys.mjs](https://github.com/adeelahmad/lense/blob/main/ci/clicks/journeys.mjs) `sensor-webhook`; [baseline.json](https://github.com/adeelahmad/lense/blob/main/ci/clicks/baseline.json) `sensor-webhook` ≤ 3 clicks |
| Import webhooks for scanners and phone shortcuts | [test_import_hooks.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_import_hooks.py) `test_pushing_files_urls_and_text`, `test_owners_manage_hooks`; [import-hooks.test.tsx](https://github.com/adeelahmad/lense/blob/main/nextjs-frontend/__tests__/import-hooks.test.tsx) |
| Connect with Google; Dropbox, OneDrive and Google Drive sign in through rclone on the server | [test_gmail_source.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_gmail_source.py) `test_connecting_the_account_in_the_browser`; [test_drive_google.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_drive_google.py) `test_drive_connects_with_google_for_rclone`; [test_rclone_signin.py](https://github.com/adeelahmad/lense/blob/main/fastapi_backend/tests/api/test_rclone_signin.py) `test_drive_signs_in_through_rclone_with_no_google_app`, `test_a_browser_on_the_server_reaches_rclone_itself`, `test_onedrive_finds_the_accounts_own_drive` |
Expand Down
64 changes: 64 additions & 0 deletions fastapi_backend/app/api/mcp_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
nsfw,
rdf,
render,
rss,
settings,
sources,
store,
Expand Down Expand Up @@ -2534,6 +2535,69 @@ def set_install_settings(ctx: Context, public: bool | None = None, target: str |
return updates.install_view(ctx.db, ctx.cfg) | {"changing": asked}


# ---------- news feeds (admins) ----------
def _feeds_admin(ctx: Context, write: bool = False) -> None:
if not ctx.user.admin:
raise ToolError("only admins see or change the news feeds Lens follows")
if write and not ctx.user.can_write:
raise ToolError("this token is read-only: ask for a token with the write scope to change news feeds")


@tool(
"news_feeds",
"News feeds",
"The news feeds (RSS or Atom) Lens follows: each one's id (feed), name, the feed's own title, whether it could be "
"read last time (health), and the namespaces it brings new posts into, with how each one's last scan went. Their "
"addresses stay sealed. Each post comes in as text with its link, author and date; a new one is a "
"feed_post.received activity. Admins only.",
admin=True,
)
def news_feeds(ctx: Context) -> dict[str, Any]:
_feeds_admin(ctx)
return {"feeds": rss.subscriptions(ctx.db), "settings": f"{ctx.web}/sources"}


@tool(
"subscribe_feed",
"Subscribe to a news feed",
"Follow a news feed (RSS or Atom) into a namespace: url is the feed's address, or a page of the site that names its "
"feed. It's read first and kept only if it works; it's named by the feed's title unless name says. Each new post "
"then comes in as text, and with backfill also the posts the feed lists now. The namespace is made if it's new. "
"A feed already followed is reused. Feeds that need a password are added in the web app (Sources). Admins only, "
"with a token that has the write scope.",
Arg("url", "string", "the feed's address, or a page of the site", required=True, max_length=2000),
Arg("namespace", "string", "the namespace its posts go in", required=True, max_length=41),
Arg("name", "string", "what to call it (else the feed's title)", max_length=80),
Arg("backfill", "boolean", "also bring in the posts the feed lists now", default=False),
writes=True,
admin=True,
)
def subscribe_feed(ctx: Context, url: str, namespace: str, name: str | None = None, backfill: bool = False) -> dict[str, Any]:
_feeds_admin(ctx, write=True)
out = rss.subscribe(ctx.db, ctx.cfg, url, namespace, name, bool(backfill), by=ctx.user.email)
if out["added"]:
auth.audit(ctx.db, ctx.user.as_audit(), "source.create", f"storage_source:{out['feed']}", ["mcp"])
if not out["already"]:
auth.audit(ctx.db, ctx.user.as_audit(), "watch.create", f"watch_path:{out['watch']}", ["mcp"])
return out


@tool(
"unsubscribe_feed",
"Stop following a news feed",
"Stop following a news feed (its id from news_feeds): no more posts come in from it. The posts it brought in stay. "
"Admins only, with a token that has the write scope.",
Arg("feed", "integer", "the feed's id, from news_feeds", required=True),
writes=True,
admin=True,
)
def unsubscribe_feed(ctx: Context, feed: int) -> dict[str, Any]:
_feeds_admin(ctx, write=True)
rss.unsubscribe(ctx.db, feed)
auth.audit(ctx.db, ctx.user.as_audit(), "source.delete", f"storage_source:{feed}", ["mcp"])
return {"unsubscribed": feed}


# ---------- the stream of activities ----------
@tool(
"timeline",
Expand Down
14 changes: 12 additions & 2 deletions fastapi_backend/app/domain/ai_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,8 @@ def cited(self, text):

def approve(db, cfg, aid, user, editable, decision="approve", base=None, admin=False, readable=None, params=None, via="web"):
"""Carry out an approved action: a batch run (or a sample of it), an entity change, a note an automation's agent
proposed, or a change to the server (ops_tools.py: settings, a namespace, importing attached files or web pages).
proposed, or a change to the server (ops_tools.py: settings, a namespace, importing attached files or web pages,
following a news feed).
An automation's action (an approval with an intent) is decided by approvals.decide: `params` are an edit's, `via`
where the pick was made (web, chat, token, oauth or agent; only the person, signed in or in their own chat,
approves it)."""
Expand Down Expand Up @@ -2198,7 +2199,16 @@ def _carry_out(db, cfg, a, user, editable, decision, base, admin, readable):
result = {"result": sandboxmod.run(db, cfg, a["chat"], a.get("account") or user["id"], kind, source, args.get("files") or [])}
except sandboxmod.SandboxError as e:
raise ValueError(str(e)) from None
elif a["tool"] in ("change_settings", "create_namespace", "import_files", "import_urls", "invite_person", "change_person"):
elif a["tool"] in (
"change_settings",
"create_namespace",
"import_files",
"import_urls",
"invite_person",
"change_person",
"subscribe_feed",
"unsubscribe_feed",
):
result = ops_tools.apply(db, cfg, base or cfg, a["tool"], args, user, editable, admin)
elif a["tool"] == "decline_approval": # the person's yes to declining another of their approvals
from . import approvals
Expand Down
Loading
Loading