Skip to content

Give your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.

fix: added channels use their own site tools first; real acceptance only gates releases

Pnant665e2ba6d3b2
diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml
index bdccd1fc..d127e3d3 100644
--- a/.github/workflows/pytest.yml
+++ b/.github/workflows/pytest.yml
@@ -37,10 +37,6 @@ jobs:
run: |
mypy agent_reach
- - name: Require real acceptance before merge
- if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
- run: python scripts/check_release_acceptance.py
-
windows-test:
runs-on: windows-latest
steps:
diff --git a/README.md b/README.md
index 480626a2..5e15f17c 100644
--- a/README.md
+++ b/README.md
@@ -180,7 +180,7 @@ flowchart LR
每个渠道的每个动作都有一个有序的后端列表。比如 `bilibili read` 先用 bili-cli,失败了自动换 B站公开接口;`web read` 先用 Jina Reader,再用 Exa。返回的 JSON 里 `backend` 字段会写明这次实际用的是谁。
-带 `public_web` 声明的关键词搜索和按链接阅读,CLI 会先复用网页搜索/读取。成功就直接交付,不安装浏览器或要求登录;结果来自公开网页,完整性与时效需核对。公开路径不足再尝试站内工具,实际遇到登录墙才提示登录。`--backend public-web` 只查公开内容;`--backend opencli` 等声明后端直接使用站内能力。评论、字幕和账号列表保留各自的动作要求。
+渠道已经加上时,搜索和按链接阅读直接走这个渠道。还没加的渠道,带 `public_web` 声明的关键词搜索和按链接阅读会先复用网页搜索/读取:成功就直接交付,不安装浏览器或要求登录;结果来自公开网页,完整性与时效需核对。公开路径不足再尝试站内工具,实际遇到登录墙才提示登录。`--backend public-web` 只查公开内容;`--backend opencli` 等声明后端直接使用站内能力。评论、字幕和账号列表保留各自的动作要求。
平台改版、工具失效是常态。换后端只是调整这个列表,Agent 的调用方式不变。
diff --git a/agent_reach/runtime/dispatch.py b/agent_reach/runtime/dispatch.py
index 83b43f71..7d3c72f1 100644
--- a/agent_reach/runtime/dispatch.py
+++ b/agent_reach/runtime/dispatch.py
@@ -184,6 +184,16 @@ def _pick_error(errors: List[ReachError]) -> ReachError:
return errors[0]
+def _channel_added(channel: Channel) -> bool:
+ """An added channel answers from its own site tools; public web search is only for channels not set up yet."""
+ from .manage import is_added
+
+ try:
+ return is_added(channel, state.load())
+ except Exception: # noqa: BLE001 - an unreadable ledger must not block the query
+ return False
+
+
def run_action(
channel: Channel,
action_name: str,
@@ -224,7 +234,8 @@ def run_action(
if limited:
raise ReachError(RATE_LIMITED, limited["message"],
hint=f"Wait {limited['retry_after_seconds']} seconds before retrying this channel.")
- if action.public_web and ((public_first and only_backend is None) or public_only):
+ if action.public_web and ((public_first and only_backend is None and not _channel_added(channel))
+ or public_only):
budget = clock.remaining() if public_only else min(public_web.MAX_SECONDS, clock.remaining() / 2)
public = public_web.attempt(channel, action, clean, timeout=budget)
if public is not None:
diff --git a/agent_reach/skill/SKILL.md b/agent_reach/skill/SKILL.md
index b35a35ed..5a07c8c3 100644
--- a/agent_reach/skill/SKILL.md
+++ b/agent_reach/skill/SKILL.md
@@ -39,7 +39,7 @@ metadata:
平台名称和 URL 用来识别来源,不自动触发安装、`ensure` 或登录。用户要求安装、登录或退出时读会话配置;故障、升级或卸载时读 [维护说明](references/maintenance.md),查询时按需加载。
-CLI 也按此顺序执行:`channels` 中带 `public_web` 的搜索/阅读动作,先复用 Reach 的免登录网页搜索/读取,成功后直接返回,不准备浏览器。`backend: public-web` 和 `meta.access.scope` 区分搜索结果与页面文字;不保证站内排序、最新状态、全文或全部评论。公开结果不足才尝试站内工具,实际返回 `NEED_LOGIN` 才请用户登录。用 `--backend public-web` 可只查公开网页;需要站内数据时指定该动作声明的 `--backend opencli` 或 `--backend boss-agent-cli`。评论、字幕、账号列表等动作保持原有粒度;Instagram 搜用户不以通用网页搜索冒充。
+CLI 也按此顺序执行:渠道**已经加上**(默认渠道或 `add` 过)时,搜索/阅读直接走这个渠道的站内工具,不先查网页。渠道**还没加**时,带 `public_web` 的搜索/阅读动作先复用 Reach 的免登录网页搜索/读取,成功后直接返回,不准备浏览器。`backend: public-web` 和 `meta.access.scope` 区分搜索结果与页面文字;不保证站内排序、最新状态、全文或全部评论。公开结果不足才尝试站内工具,实际返回 `NEED_LOGIN` 才请用户登录。用 `--backend public-web` 可只查公开网页;需要站内数据时指定该动作声明的 `--backend opencli` 或 `--backend boss-agent-cli`。评论、字幕、账号列表等动作保持原有粒度;Instagram 搜用户不以通用网页搜索冒充。
Reddit 公开帖可搜索 `site:reddit.com 关键词` 再打开原帖,公开 JSON 有时包含评论父子 ID;以本次实际返回为准。YouTube/B站简介与字幕、视频内容分别验收;X 的单帖公开内容与评论流分别验收。某台机器的失败不能推广为平台必须登录,也不固化“某平台总能匿名读全”。网络路径不同的结果分别记录。
diff --git a/agent_reach/skill/SKILL_en.md b/agent_reach/skill/SKILL_en.md
index e3c9afc7..ea2a9795 100644
--- a/agent_reach/skill/SKILL_en.md
+++ b/agent_reach/skill/SKILL_en.md
@@ -40,7 +40,7 @@ Route by the evidence needed, on every platform:
A platform name or URL identifies a source; it does not automatically trigger installation, ensure or login. Read Sessions for explicit setup/login/logout requests and [Maintenance](references/maintenance.md) for failures/updates/uninstall.
-CLI search/read actions with `public_web` try anonymous web access before preparing site tools. Results identify `backend: public-web` and `meta.access.scope` as search results or page text; site ordering, freshness and completeness remain unverified. Use `--backend public-web` for public access only, or an action's declared `--backend opencli` / `--backend boss-agent-cli` for a site-specific request. Only an actual login requirement warrants asking the user to log in. Comments, subtitles and account-list actions keep their declared scope.
+When a channel is **already added** (a default channel, or one the user added), its search/read actions go straight to that channel's site tools, with no web search first. For channels **not added yet**, CLI search/read actions with `public_web` try anonymous web access before preparing site tools. Results identify `backend: public-web` and `meta.access.scope` as search results or page text; site ordering, freshness and completeness remain unverified. Use `--backend public-web` for public access only, or an action's declared `--backend opencli` / `--backend boss-agent-cli` for a site-specific request. Only an actual login requirement warrants asking the user to log in. Comments, subtitles and account-list actions keep their declared scope.
Public Reddit JSON may expose parent IDs; verify actual coverage. YouTube/Bilibili descriptions, subtitles and video content are separate evidence. Public X posts and reply streams are separate capabilities. Do not generalize a local failure into a platform-wide login requirement, or promise universal anonymous access. Distinguish local HTTP, proxy and built-in web-tool results.
diff --git a/tests/test_public_first.py b/tests/test_public_first.py
index 21dd43d5..2178c39e 100644
--- a/tests/test_public_first.py
+++ b/tests/test_public_first.py
@@ -44,6 +44,17 @@ def test_explicit_site_backend_bypasses_web_search(monkeypatch, public_search):
public_search.assert_not_called()
+def test_added_channel_goes_straight_to_its_site_tool(monkeypatch, public_search):
+ data = state.load()
+ data["channels"]["linkedin"] = {"added_at": state.now()}
+ state.save(data)
+ site = Mock(return_value=[make_item(title="Site result", url=URL)])
+ monkeypatch.setattr(LinkedInChannel, "_jobs", site)
+ out = run_action(LinkedInChannel(), "jobs", {"query": "Data"})
+ assert out["ok"] and out["backend"] != "public-web" and site.call_count == 1
+ public_search.assert_not_called()
+
+
@pytest.mark.parametrize("code", ["UPSTREAM_BROKEN", "TIMEOUT", "RATE_LIMITED"])
def test_web_provider_failure_does_not_become_platform_login_or_cooldown(monkeypatch, code):
def fail(self, **kwargs):