feat: news notifications for the background collection and a collectedNews tool

Each collection target can announce new items at once or in a daily digest
(off by default) in collect.notifyChannel, as titles and links only, with no
LLM; each post is recorded in the activity log. The brain gets a read-only
collectedNews tool (every target's newest items by default, fenced as
untrusted web content), offered with the app's collection file and the
collection feature, and available to scheduled tasks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-14 17:22:54 +09:00
parent a5bd25b86f
commit 324fd2ea0a
21 changed files with 653 additions and 28 deletions

View File

@@ -19,6 +19,7 @@ from .builtin.nutrition.delete_meal import DeleteMealTool
from .builtin.chat_channels import ChatChannelsTool
from .builtin.schedule import ScheduleTool
from .builtin.personal_notes import PersonalNotesTool
from .builtin.collected_news import CollectedNewsTool, COLLECT_ENV
from .builtin.bot_browser import BotBrowserTool, CDP_ENV
from .builtin.refresh_mcp_tools import RefreshMCPToolsTool
from .builtin.weather import WeatherTool
@@ -52,6 +53,7 @@ BUILTIN_TOOLS = {
"chatChannels": ChatChannelsTool(),
"schedule": ScheduleTool(),
"personalNotes": PersonalNotesTool(),
"collectedNews": CollectedNewsTool(),
"botBrowser": BotBrowserTool(),
}
@@ -63,8 +65,9 @@ _SCREEN_SHARE_TOOLS = ("controlBrowser", "browseAndPlay", "setBroadcast")
def enabled_builtin_tools(cfg) -> Dict[str, Any]:
"""The built-in tools this configuration allows: none in ``cfg.disabled_tools``, and the
screen-share tools only in screen-share mode, and botBrowser only when the app started the bot
browser (bot_browser.spec.md). The router, toolSearchTool and the executor all use this, so a
screen-share tools only in screen-share mode, botBrowser only when the app started the bot
browser (bot_browser.spec.md), and collectedNews only with the app's collection file
(collected_news.spec.md). The router, toolSearchTool and the executor all use this, so a
turned-off tool is neither offered nor run."""
disabled = getattr(cfg, "disabled_tools", ())
disabled = set(disabled) if isinstance(disabled, (list, tuple, set, frozenset)) else set()
@@ -72,6 +75,8 @@ def enabled_builtin_tools(cfg) -> Dict[str, Any]:
return {k: v for k, v in BUILTIN_TOOLS.items()
if k not in disabled and (stream or k not in _SCREEN_SHARE_TOOLS)
and (k != "botBrowser" or os.environ.get(CDP_ENV))
# The collection's results exist only when the app passed its collection file.
and (k != "collectedNews" or os.environ.get(COLLECT_ENV))
# One tool reads pages: with the bot browser offered it does (through the app's proxy).
and (k != "fetchWebPage" or "botBrowser" in disabled or not os.environ.get(CDP_ENV))}