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: preserve public access and refresh real channel acceptance

LohseZSaif04d1d51dfc2
diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml
index d127e3d3..bdccd1fc 100644
--- a/.github/workflows/pytest.yml
+++ b/.github/workflows/pytest.yml
@@ -37,6 +37,10 @@ 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/CHANGELOG.md b/CHANGELOG.md
index 15a9a641..5740cafd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,8 @@ All notable changes to this project will be documented in this file.
## [1.6.0] - unreleased
中文:
+- 修复未登录 gh 阻断公开 API、公开行情触发浏览器、错误认证提示和未登记缓存清理;临时音频/字幕保存在 Reach 内。BOSS 站内搜索优先官方 OpenCLI,JD 上游适配故障单列;PR 与发版均检查真实验收和待验状态。
+- CLI 对已声明的公开搜索/阅读先复用网页工具,成功后不准备浏览器;结果标注来源和内容范围,站内路径明确要求认证时才提示登录。可指定后端保留原有站内能力。
- 浏览器渠道共用一份登录,闲置十分钟自动关闭,下次使用自动打开。
- 添加渠道自动准备工具;删除时只清理该网站的登录。
- 公开内容继续先读,不强制登录;安装后用简短表格说明能查什么。
diff --git a/README.md b/README.md
index a6bfdfdf..480626a2 100644
--- a/README.md
+++ b/README.md
@@ -102,14 +102,14 @@ agent-reach read https://www.v2ex.com/t/123 # 按链接自动选渠道
| v2ex | 默认 | 热门、节点、帖子和回复、用户 | 无 |
| web | 默认 | 网页搜索、网页阅读(保底) | 无 |
| bilibili | 默认 | 搜索、视频信息、热门、字幕 | 无;字幕需要登录(扫码) |
-| xiaohongshu | 可选 | 搜笔记、读正文、看评论 | 浏览器 + 登录 |
+| xiaohongshu | 可选 | 搜笔记、读正文、看评论 | 先查公开笔记;站内与评论路径按需认证 |
| reddit | 可选 | 搜帖子、读正文、看评论、看版块 | 公开帖子和评论先用已有网页工具;浏览器功能按需登录 |
-| linkedin | 可选 | 搜职位、读职位详情 | 登录 |
-| boss | 可选 | 搜职位和 JD | 浏览器 + 登录 |
+| linkedin | 可选 | 搜职位、读职位详情 | 先查公开网页;站内路径按实际结果决定是否登录 |
+| boss | 可选 | 搜职位和 JD | 先查公开职位;站内路径按需认证 |
| xiaoyuzhou | 可选 | 播客转文字 | Groq Key |
| xueqiu | 可选 | 实时行情、搜股票、热帖、热股 | 行情免登录;热帖热股需要浏览器登录 |
-| twitter | 实验 | 搜推文、用户资料、用户推文、读推文串 | 浏览器 + 登录 |
-| facebook | 实验 | 搜索、主页资料 | 浏览器 + 登录 |
+| twitter | 实验 | 搜推文、用户资料、用户推文、读推文串 | 先查公开索引;动态和回复路径按需认证 |
+| facebook | 实验 | 搜索、主页资料 | 先查公开索引;主页路径按需认证 |
| instagram | 实验 | 搜用户、主页资料、用户帖子 | 浏览器 + 登录 |
- **默认**:装好就能用;不想要也可以去掉(`agent-reach remove <渠道>`),以后更新不会再加回来。
@@ -180,6 +180,8 @@ flowchart LR
每个渠道的每个动作都有一个有序的后端列表。比如 `bilibili read` 先用 bili-cli,失败了自动换 B站公开接口;`web read` 先用 Jina Reader,再用 Exa。返回的 JSON 里 `backend` 字段会写明这次实际用的是谁。
+带 `public_web` 声明的关键词搜索和按链接阅读,CLI 会先复用网页搜索/读取。成功就直接交付,不安装浏览器或要求登录;结果来自公开网页,完整性与时效需核对。公开路径不足再尝试站内工具,实际遇到登录墙才提示登录。`--backend public-web` 只查公开内容;`--backend opencli` 等声明后端直接使用站内能力。评论、字幕和账号列表保留各自的动作要求。
+
平台改版、工具失效是常态。换后端只是调整这个列表,Agent 的调用方式不变。
### 📌 保持最新,私有安装
diff --git a/agent_reach/channels/base.py b/agent_reach/channels/base.py
index 0c537d1e..cfaeb2d5 100644
--- a/agent_reach/channels/base.py
+++ b/agent_reach/channels/base.py
@@ -44,6 +44,9 @@ class Action:
live_test: Optional[Dict[str, object]] = None
#: Default timeout in seconds for slow actions (e.g. transcription); None = global default.
timeout: Optional[float] = None
+ #: Public URL scopes tried through the existing Web channel before site tools.
+ #: Search results/page text are labelled separately from authenticated site data.
+ public_web: Tuple[str, ...] = ()
class Channel(ABC):
diff --git a/agent_reach/channels/boss.py b/agent_reach/channels/boss.py
index d935f0d0..68a7cdfb 100644
--- a/agent_reach/channels/boss.py
+++ b/agent_reach/channels/boss.py
@@ -42,12 +42,14 @@ class BossChannel(Channel):
Param("city", "city, e.g. 深圳", required=False),
Param("limit", "max results", required=False, type=int, default=10),
),
- (("boss-agent-cli", "_cli_search"), ("opencli", "_opencli_search")),
+ (("opencli", "_opencli_search"), ("boss-agent-cli", "_cli_search")),
live_test={"query": "Python", "city": "深圳", "limit": 3},
timeout=90,
+ public_web=("zhipin.com/job_detail/",),
),
Action("read", "Read a direct BOSS job URL", (Param("target", "full job URL"),),
- (("boss-agent-cli", "_cli_read"), ("opencli", "_opencli_read")), timeout=90),
+ (("boss-agent-cli", "_cli_read"), ("opencli", "_opencli_read")), timeout=90,
+ public_web=("zhipin.com/job_detail/",)),
)
def can_handle(self, url: str) -> bool:
@@ -143,6 +145,14 @@ class BossChannel(Channel):
match = re.search(r"/job_detail/([A-Za-z0-9_-]+)\.html", str(target))
if not match:
raise ReachError("BAD_INPUT", "Expected a direct BOSS job URL")
- rows = opencli_call("boss", ["detail", match.group(1)], timeout=timeout,
- login_hint="Run agent-reach login boss; complete login yourself in the dedicated browser.")
+ try:
+ rows = opencli_call("boss", ["detail", match.group(1)], timeout=timeout,
+ login_hint="Run agent-reach login boss; complete login yourself in the dedicated browser.")
+ except ReachError as exc:
+ # Upstream's detector also matches hidden login components on readable
+ # job pages. Its message alone cannot establish an expired session.
+ if exc.code == NEED_LOGIN and "BOSS redirected the job detail page to the login flow" in exc.message:
+ raise ReachError(UPSTREAM_BROKEN, "OpenCLI could not extract this BOSS JD; its login signal is ambiguous",
+ hint="Check the existing job page. Do not ask for repeated login based on this adapter error.") from None
+ raise
return opencli_items(rows)[:1]
diff --git a/agent_reach/channels/facebook.py b/agent_reach/channels/facebook.py
index 985c31ec..0532bfe1 100644
--- a/agent_reach/channels/facebook.py
+++ b/agent_reach/channels/facebook.py
@@ -25,6 +25,7 @@ class FacebookChannel(OpenCLISiteChannel):
),
(("opencli", "_opencli_search"),),
live_test={"query": "openai", "limit": 2},
+ public_web=("facebook.com/",),
),
Action(
"profile",
diff --git a/agent_reach/channels/github.py b/agent_reach/channels/github.py
index f56eb17c..2cd38878 100644
--- a/agent_reach/channels/github.py
+++ b/agent_reach/channels/github.py
@@ -11,9 +11,10 @@ from urllib.parse import urlencode
from agent_reach.runtime.result import (
BAD_INPUT,
- NEED_LOGIN,
+ NEED_SETUP,
NOT_FOUND,
RATE_LIMITED,
+ UPSTREAM_BROKEN,
ReachError,
make_item,
)
@@ -59,7 +60,7 @@ def _gh_get(path: str, timeout: float, accept: str = "application/vnd.github+jso
if "http 404" in err or "not found" in err:
raise ReachError(NOT_FOUND, exc.message) from None
if "gh auth login" in err or "authentication" in err:
- raise ReachError(NEED_LOGIN, "gh is not logged in") from None
+ raise ReachError(NEED_SETUP, "gh has no usable credentials; try the public GitHub API") from None
if "rate limit" in err:
raise ReachError(RATE_LIMITED, exc.message) from None
raise
@@ -78,8 +79,12 @@ def _api_get(path: str, timeout: float, accept: str = "application/vnd.github+js
try:
return http_request(f"{_API}{path}", timeout=timeout, headers=headers)
except urllib.error.HTTPError as exc:
- if exc.code == 403:
+ if exc.code == 429 or (exc.code == 403 and (
+ exc.headers.get("X-RateLimit-Remaining") == "0" or exc.headers.get("Retry-After")
+ )):
raise ReachError(RATE_LIMITED, "GitHub API rate limit (60/hour without a token)") from None
+ if exc.code == 403:
+ raise ReachError(UPSTREAM_BROKEN, "GitHub API denied this request (HTTP 403); no rate-limit evidence") from None
raise
diff --git a/agent_reach/channels/linkedin.py b/agent_reach/channels/linkedin.py
index 79b72ee3..6e438ca1 100644
--- a/agent_reach/channels/linkedin.py
+++ b/agent_reach/channels/linkedin.py
@@ -1,4 +1,7 @@
"""LinkedIn job actions through upstream OpenCLI and the shared Reach browser."""
+import re
+from urllib.parse import urlsplit
+
from agent_reach.runtime.result import BAD_INPUT, ReachError
from agent_reach.utils.url import host_matches
@@ -17,9 +20,10 @@ class LinkedInChannel(OpenCLISiteChannel):
Action("jobs", "Search LinkedIn jobs", (
Param("query", "job keywords"), Param("location", "city or country", required=False),
Param("limit", "max results", required=False, type=int, default=5)),
- (("opencli", "_jobs"),), live_test={"query": "python", "limit": 2}, timeout=120),
+ (("opencli", "_jobs"),), live_test={"query": "python", "limit": 2}, timeout=120,
+ public_web=("linkedin.com/jobs/view/",)),
Action("read", "Read a LinkedIn job description", (Param("target", "full job URL"),),
- (("opencli", "_read"),), timeout=90),
+ (("opencli", "_read"),), timeout=90, public_web=("linkedin.com/jobs/view/",)),
)
def _jobs(self, *, query, location, limit, timeout):
@@ -31,4 +35,18 @@ class LinkedInChannel(OpenCLISiteChannel):
def _read(self, *, target, timeout):
if not host_matches(str(target), "linkedin.com"):
raise ReachError(BAD_INPUT, "Expected a linkedin.com job URL")
- return self._opencli(["job-detail", str(target)], timeout)[:1]
+ return self._opencli(["job-detail", self._job_url(str(target))], timeout)[:1]
+
+ @staticmethod
+ def _job_url(target: str) -> str:
+ if not host_matches(target, "linkedin.com"):
+ raise ReachError(BAD_INPUT, "Expected a linkedin.com job URL")
+ match = re.fullmatch(r"/jobs/view/(?:[^/]+-)?([0-9]+)/?", urlsplit(target).path)
+ if not match:
+ raise ReachError(BAD_INPUT, "Expected a LinkedIn /jobs/view/<job-id> URL")
+ # Public indexes use regional hosts and title slugs; upstream accepts IDs.
+ return "https://www.linkedin.com/jobs/view/" + match.group(1)
+
+ def validate_params(self, action, params):
+ if action == "read":
+ params["target"] = self._job_url(str(params["target"]))
diff --git a/agent_reach/channels/reddit.py b/agent_reach/channels/reddit.py
index 5fab9ee9..f7d7dcaa 100644
--- a/agent_reach/channels/reddit.py
+++ b/agent_reach/channels/reddit.py
@@ -41,19 +41,21 @@ class RedditChannel(Channel):
actions = (
Action(
"search",
- "Browser search; prefer existing web search for public Reddit posts",
+ "Search public posts first; --backend opencli uses site search",
(
Param("query", "what to search for"),
Param("limit", "max results", required=False, type=int, default=5),
),
(("opencli", "_opencli_search"),),
live_test={"query": "python", "limit": 2},
+ public_web=("reddit.com/r/",),
),
Action(
"read",
- "Browser read of a post and top comments; prefer web fetch for public posts",
+ "Read public page text first; --backend opencli requests the post and top comments",
(Param("target", "post link or id"),),
(("opencli", "_opencli_read"),),
+ public_web=("reddit.com/r/", "redd.it/"),
),
Action(
"subreddit",
diff --git a/agent_reach/channels/twitter.py b/agent_reach/channels/twitter.py
index 89856ad1..27b68045 100644
--- a/agent_reach/channels/twitter.py
+++ b/agent_reach/channels/twitter.py
@@ -45,6 +45,7 @@ class TwitterChannel(Channel):
),
(("opencli", "_opencli_search"),),
live_test={"query": "openai", "limit": 2},
+ public_web=("x.com/", "twitter.com/"),
),
Action(
"profile",
diff --git a/agent_reach/channels/web.py b/agent_reach/channels/web.py
index ce4e73af..1c518417 100644
--- a/agent_reach/channels/web.py
+++ b/agent_reach/channels/web.py
@@ -5,8 +5,10 @@ This channel is a fallback: agents that already have working built-in web
search / fetch should use those first.
"""
+import http.client
import json
import re
+import time
import urllib.request
from agent_reach.runtime.result import (
@@ -77,12 +79,19 @@ def _exa_call(tool: str, arguments: dict, timeout: float) -> str:
body = json.dumps(
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": tool, "arguments": arguments}}
).encode("utf-8")
- raw = http_request(
- _EXA_MCP,
- timeout=timeout,
- data=body,
- headers={"Content-Type": "application/json", "Accept": "application/json, text/event-stream"},
- ).decode("utf-8", errors="replace")
+ started = time.monotonic()
+ for attempt in range(2):
+ try:
+ raw = http_request(
+ _EXA_MCP, timeout=max(0.1, timeout - (time.monotonic() - started)), data=body,
+ headers={"Content-Type": "application/json", "Accept": "application/json, text/event-stream"},
+ ).decode("utf-8", errors="replace")
+ break
+ except http.client.IncompleteRead:
+ # Read-only provider requests: one retry for a truncated transport,
+ # within the original budget. Never retry HTTP 429/403 or tool errors.
+ if attempt or time.monotonic() - started >= timeout:
+ raise
payloads = [ln[5:].strip() for ln in raw.splitlines() if ln.startswith("data:")] or [raw]
msg = json.loads(payloads[-1])
if "error" in msg:
diff --git a/agent_reach/channels/xiaohongshu.py b/agent_reach/channels/xiaohongshu.py
index fc678614..4da0df13 100644
--- a/agent_reach/channels/xiaohongshu.py
+++ b/agent_reach/channels/xiaohongshu.py
@@ -36,12 +36,14 @@ class XiaoHongShuChannel(Channel):
),
(("opencli", "_opencli_search"),),
live_test={"query": "咖啡", "limit": 2},
+ public_web=("xiaohongshu.com/explore/", "xiaohongshu.com/search_result/", "xhslink.com/"),
),
Action(
"read",
"Read a note (full link including xsec_token, as returned by search)",
(Param("target", "full note link with xsec_token"),),
(("opencli", "_opencli_read"),),
+ public_web=("xiaohongshu.com/explore/", "xiaohongshu.com/search_result/", "xhslink.com/"),
),
Action(
"comments",
diff --git a/agent_reach/channels/xiaoyuzhou.py b/agent_reach/channels/xiaoyuzhou.py
index add183a6..8c0b8ed3 100644
--- a/agent_reach/channels/xiaoyuzhou.py
+++ b/agent_reach/channels/xiaoyuzhou.py
@@ -2,11 +2,11 @@
"""Xiaoyuzhou Podcast (小宇宙播客) — transcribe podcasts via Groq Whisper API."""
import os
-import tempfile
from agent_reach.config import Config
from agent_reach.runtime.result import BAD_INPUT, NEED_SETUP, ReachError, make_item
from agent_reach.runtime.run import run_cmd
+from agent_reach.utils.paths import private_temporary_directory
from .base import Action, Channel, Param
@@ -61,10 +61,10 @@ class XiaoyuzhouChannel(Channel):
raise ReachError(NEED_SETUP, "ffmpeg is not installed", hint="Run `agent-reach add xiaoyuzhou`.")
# our private ffmpeg goes first on the script's PATH
path = os.pathsep.join([os.path.dirname(ffmpeg), os.environ.get("PATH", "")])
- with tempfile.TemporaryDirectory(prefix="agent-reach-xyz-") as tmp:
+ with private_temporary_directory(prefix="agent-reach-xyz-") as tmp:
out = os.path.join(tmp, "transcript.txt")
run_cmd(["bash", _SCRIPT, str(target).strip(), out], timeout=timeout,
- env={"GROQ_API_KEY": str(key), "PATH": path}, label="transcribe")
+ env={"GROQ_API_KEY": str(key), "PATH": path, "TMPDIR": tmp}, label="transcribe")
with open(out, encoding="utf-8", errors="replace") as fh:
text = fh.read().strip()
return [make_item(url=str(target).strip(), text=text)]
diff --git a/agent_reach/channels/xueqiu.py b/agent_reach/channels/xueqiu.py
index 87f2a5dd..5e4bb4d3 100644
--- a/agent_reach/channels/xueqiu.py
+++ b/agent_reach/channels/xueqiu.py
@@ -9,7 +9,7 @@ import urllib.parse
import urllib.request
from typing import Any
-from agent_reach.runtime.result import BAD_INPUT, NEED_LOGIN, NOT_FOUND, ReachError, make_item
+from agent_reach.runtime.result import BAD_INPUT, NEED_LOGIN, NOT_FOUND, UPSTREAM_BROKEN, ReachError, make_item
from agent_reach.runtime.run import http_request
from .base import Action, Channel, Param
@@ -176,11 +176,12 @@ def _prepare_community_session() -> None:
def _xq_json(url: str) -> Any:
try:
return _get_json(url)
- except (urllib.error.HTTPError, json.JSONDecodeError) as exc:
- rejected = isinstance(exc, json.JSONDecodeError) or exc.code in (400, 401, 403)
- if not rejected:
- raise
- raise ReachError(NEED_LOGIN, "Xueqiu rejected the session", hint=_XQ_LOGIN_HINT) from None
+ except json.JSONDecodeError:
+ raise ReachError(UPSTREAM_BROKEN, "Xueqiu returned an unreadable response; login expiry was not established") from None
+ except urllib.error.HTTPError as exc:
+ if exc.code == 401:
+ raise ReachError(NEED_LOGIN, "Xueqiu rejected the session", hint=_XQ_LOGIN_HINT) from None
+ raise
_HOT_POSTS_URL = (
diff --git a/agent_reach/channels/youtube.py b/agent_reach/channels/youtube.py
index a2cb9e24..4995aff4 100644
--- a/agent_reach/channels/youtube.py
+++ b/agent_reach/channels/youtube.py
@@ -7,17 +7,17 @@ import os
import re
import shutil
import sys
-import tempfile
from agent_reach.runtime.result import (
BAD_INPUT,
- NEED_LOGIN,
+ PLATFORM_BLOCKED,
NOT_FOUND,
RATE_LIMITED,
ReachError,
make_item,
)
from agent_reach.runtime.run import CommandFailed, run_cmd
+from agent_reach.utils.paths import private_temporary_directory
from .base import Action, Channel, Param
@@ -54,11 +54,11 @@ def _run_ytdlp(args: list, timeout: float, cwd=None) -> str:
err = exc.stderr.lower()
if any(s in err for s in ("video unavailable", "private video", "has been removed", "does not exist")):
raise ReachError(NOT_FOUND, exc.message) from None
- if "sign in to confirm" in err:
+ if "sign in to confirm" in err or "not a bot" in err:
raise ReachError(
- NEED_LOGIN,
+ PLATFORM_BLOCKED,
exc.message,
- hint="YouTube is asking for a bot check. Ask the user whether to configure YouTube cookies; never sign in for them.",
+ hint="YouTube returned a verification challenge. Stop this request; this does not establish that the public video requires login.",
) from None
if "429" in err or "too many requests" in err:
raise ReachError(RATE_LIMITED, exc.message) from None
@@ -176,7 +176,7 @@ class YouTubeChannel(Channel):
def _ytdlp_subtitle(self, *, target: str, lang: str, timeout: float) -> list:
url = _video_url(target)
wanted = [x.strip() for x in lang.split(",") if x.strip()]
- with tempfile.TemporaryDirectory(prefix="agent-reach-subs-") as tmp:
+ with private_temporary_directory(prefix="agent-reach-subs-") as tmp:
out = _run_ytdlp(
[
"--skip-download", "--no-simulate",
diff --git a/agent_reach/runtime/cli.py b/agent_reach/runtime/cli.py
index da3af0dd..f124319a 100644
--- a/agent_reach/runtime/cli.py
+++ b/agent_reach/runtime/cli.py
@@ -50,6 +50,8 @@ For agents:
agent-reach resume OPERATION_ID continue after the user logs in
agent-reach <channel> <action> [args] e.g. agent-reach bilibili search python
agent-reach read <url> read a link with the matching channel
+ Search/read try declared public web routes first; --backend selects a site tool
+ --backend public-web public access only; no browser fallback
For the user:
agent-reach setup [--text] install defaults and skill; --text displays the capability tables
@@ -134,7 +136,8 @@ def _parse_action_args(action: Action, args: Sequence[str]) -> Dict[str, object]
parser.add_argument(p.name, nargs="+" if p.type is str else None)
else:
parser.add_argument(f"--{p.name}", dest=p.name, default=None)
- parser.add_argument("--backend", choices=[b[0] for b in action.backends], default=None)
+ parser.add_argument("--backend", choices=[b[0] for b in action.backends] +
+ (["public-web"] if action.public_web else []), default=None)
parser.add_argument("--timeout", type=float, default=action.timeout or DEFAULT_TIMEOUT)
ns = vars(parser.parse_args(list(args)))
for p in action.params:
@@ -172,7 +175,7 @@ def _cmd_read(args: Sequence[str]) -> int:
readers = [ch for ch in unified_channels() if find_action(ch, "read")]
specific = [ch for ch in readers if ch.name != "web"]
target = next((ch for ch in specific if ch.can_handle(ns.url)), None)
- if target is not None and target.name == "reddit" and ns.backend in (None, "jina", "exa"):
+ if target is not None and target.name == "reddit" and ns.backend in ("jina", "exa"):
target = next((ch for ch in readers if ch.name == "web"), None) or target
target = target or next((ch for ch in readers if ch.name == "web"), None)
if target is None:
@@ -205,6 +208,7 @@ def _cmd_channels(_args: Sequence[str]) -> int:
for p in a.params
],
"backends": [label for label, _ in a.backends],
+ "public_web": list(a.public_web),
}
for a in ch.actions
],
@@ -529,6 +533,7 @@ def _cmd_flow(head: str, args: Sequence[str]) -> int:
parser.add_argument("channel_action")
parser.add_argument("--params", required=True)
parser.add_argument("--timeout", type=float, default=60.0)
+ parser.add_argument("--backend")
else:
parser.add_argument("--action")
parser.add_argument("--no-verify", action="store_true")
@@ -543,7 +548,7 @@ def _cmd_flow(head: str, args: Sequence[str]) -> int:
params = json.loads(ns.params)
if not isinstance(params, dict):
raise _ArgError("--params must be a JSON object")
- result = flow.execute(ns.channel, ns.channel_action, params, timeout=ns.timeout)
+ result = flow.execute(ns.channel, ns.channel_action, params, timeout=ns.timeout, backend=ns.backend)
except (ValueError, _ArgError) as exc:
return _bad_input(None, head, str(exc))
except ReachError as err:
diff --git a/agent_reach/runtime/dispatch.py b/agent_reach/runtime/dispatch.py
index 48748d11..83b43f71 100644
--- a/agent_reach/runtime/dispatch.py
+++ b/agent_reach/runtime/dispatch.py
@@ -5,7 +5,7 @@ from __future__ import annotations
import threading
import time
from contextlib import nullcontext
-from typing import Any, Dict, List, Optional
+from typing import Any, Callable, Dict, List, Optional
from agent_reach.channels.base import Action, Channel
@@ -192,6 +192,8 @@ def run_action(
timeout: float = DEFAULT_TIMEOUT,
only_backend: Optional[str] = None,
preferred_backend: Optional[str] = None,
+ before_backends: Optional[Callable[[], None]] = None,
+ public_first: bool = True,
) -> dict:
"""Execute one unified action and return the envelope dict."""
started = time.monotonic()
@@ -204,7 +206,10 @@ def run_action(
except ReachError as validation_error:
return envelope(channel=channel.name, action=action_name, elapsed_ms=elapsed(), error=validation_error)
- backends = [b for b in action.backends if only_backend in (None, b[0])]
+ from . import public_web
+
+ public_only = only_backend == public_web.BACKEND and bool(action.public_web)
+ backends = [b for b in action.backends if only_backend in (None, b[0]) or public_only]
if not backends:
return envelope(channel=channel.name, action=action_name, elapsed_ms=elapsed(),
error=ReachError(BAD_INPUT, f"no backend named '{only_backend}'"))
@@ -219,6 +224,26 @@ 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):
+ 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:
+ attempts.extend(public["meta"]["attempts"])
+ if public["ok"] or public_only:
+ public["meta"]["elapsed_ms"] = elapsed()
+ return public
+ elif public_only:
+ raise ReachError(BAD_INPUT, "This input has no public web route; use a full supported URL")
+ # Preparation is deferred until public access actually proves insufficient.
+ if before_backends:
+ if clock.remaining() <= 0:
+ raise ReachError(TIMEOUT, "No time left to prepare the site tool")
+ # Keep the existing rule: cold setup is outside the query deadline.
+ clock.pause()
+ try:
+ before_backends()
+ finally:
+ clock.resume()
# One action per site keeps an agent's parallel requests from fighting
# over the same persistent session; worker-level profile locks remain.
browser_action = any(b[0] in {"opencli", "boss-agent-cli"} for b in action.backends)
@@ -273,5 +298,5 @@ def run_action(
action=action_name,
elapsed_ms=elapsed(),
attempts=attempts,
- error=final_err,
+ error=err,
)
diff --git a/agent_reach/runtime/flow.py b/agent_reach/runtime/flow.py
index e403c11a..c8bd0438 100644
--- a/agent_reach/runtime/flow.py
+++ b/agent_reach/runtime/flow.py
@@ -13,7 +13,7 @@ from typing import Any, Optional
from . import manage, state, tools
from .browser_binding import execution_lock
from .dispatch import cooldown, find_action, run_action, validate_action
-from .result import BAD_INPUT, NEED_LOGIN, PLATFORM_BLOCKED, RATE_LIMITED, ReachError
+from .result import BAD_INPUT, NEED_LOGIN, NEED_SETUP, PLATFORM_BLOCKED, RATE_LIMITED, ReachError
def _action(ch, name: Optional[str]):
@@ -52,7 +52,7 @@ def _record(channel: str, action: str, out: dict) -> None:
if not keep_verified:
evidence[action] = {"backend": out.get("backend"), "at": stamp,
"item_count": len(out["items"]), "verified": bool(out["ok"] and out["items"]),
- "fingerprint": signature}
+ "fingerprint": signature, "access": out.get("meta", {}).get("access")}
data["checks"][channel] = {"at": stamp, "actions": actions, "codes": codes,
"previous": old.get("actions", {}), "scope": action,
"evidence": evidence,
@@ -77,11 +77,21 @@ def prepare(channel: str, *, action: Optional[str] = None,
return {"ok": False, "status": "cooldown", "channel": channel,
"action": selected.name, "retry_after_seconds": limited["retry_after_seconds"],
"error": {"code": RATE_LIMITED, "message": limited["message"]}}
- if not manage.is_added(ch) or any(not tools.present(t) for t in manage.channel_tools(ch)):
+ browser_action = selected.backends[0][0] in {"opencli", "boss-agent-cli"}
+ if not browser_action:
+ # Native clients prepare their own session only if that route needs it.
+ # A stock quote must not provision the whole community browser channel.
+ for tool in dict.fromkeys((*ch.prereqs, *ch.tools)):
+ if tool in {"chrome", "opencli"} or tools.present(tool):
+ continue
+ if not install:
+ return _needs(channel, selected.name, "install", f"Run agent-reach add {channel}")
+ tools.ensure(tool)
+ elif not manage.is_added(ch) or any(not tools.present(t) for t in manage.channel_tools(ch)):
if not install:
return _needs(channel, selected.name, "install", f"Run agent-reach add {channel}")
manage.add(channel)
- if ch.login_url:
+ if ch.login_url and browser_action:
from . import session_reuse
session_reuse.prepare(channel)
return {"ok": True, "status": "prepared", "channel": channel,
@@ -97,7 +107,7 @@ def ensure(channel: str, *, action: Optional[str] = None,
if selected.live_test is None:
return {**prepared, "status": "prepared", "verified": False}
out = run_action(manage._channel(channel), selected.name, dict(selected.live_test),
- timeout=selected.timeout or 60, preferred_backend=prepared.get("backend"))
+ timeout=selected.timeout or 60, preferred_backend=prepared.get("backend"), public_first=False)
_record(channel, selected.name, out)
if out["ok"]:
return {**prepared, "status": "ready" if out["items"] else "prepared", "verified": bool(out["items"]),
@@ -117,16 +127,28 @@ def _failure(channel: str, action: str, out: dict) -> dict:
def execute(channel: str, action: str, params: dict[str, Any], *, timeout: float = 60,
- operation_id: Optional[str] = None) -> dict:
+ operation_id: Optional[str] = None, backend: Optional[str] = None) -> dict:
if not isinstance(params, dict):
raise ReachError(BAD_INPUT, "params must be an object")
ch = manage._channel(channel)
_, params = validate_action(ch, action, params, timeout=timeout)
- prepared = prepare(channel, action=action)
- if not prepared["ok"]:
+ prepared: dict = {}
+ def prepare_site():
+ prepared.update(prepare(channel, action=action))
+ if not prepared["ok"]:
+ err = prepared.get("error")
+ if err:
+ raise ReachError(err["code"], err["message"], err.get("hint"))
+ required = prepared.get("required_action") or {}
+ code = {"login": NEED_LOGIN, "platform_verification": PLATFORM_BLOCKED}.get(required.get("type") or "", NEED_SETUP)
+ raise ReachError(code, required.get("message") or "Site tool preparation did not complete")
+
+ # Resuming a confirmed auth wall verifies the site path, not another index hit.
+ out = run_action(ch, action, params, timeout=timeout, before_backends=prepare_site,
+ public_first=operation_id is None, only_backend=backend)
+ if prepared and not prepared["ok"]:
result = prepared
else:
- out = run_action(ch, action, params, timeout=timeout, preferred_backend=prepared.get("backend"))
_record(channel, action, out)
result = ({"ok": True, "status": "ready", "channel": channel, "action": action,
"backend": out["backend"], "items": out["items"], "meta": out["meta"]}
@@ -137,7 +159,7 @@ def execute(channel: str, action: str, params: dict[str, Any], *, timeout: float
def save_pending(data):
pending = data.setdefault("pending", {})
pending[token] = {"channel": channel, "action": action,
- "params": params, "timeout": timeout, "at": state.now()}
+ "params": params, "timeout": timeout, "backend": backend, "at": state.now()}
for old in list(pending):
if state.age_seconds(pending[old].get("at", "")) > 7 * 86400:
pending.pop(old, None)
@@ -158,5 +180,5 @@ def resume(operation_id: str) -> dict:
if not pending:
raise ReachError(BAD_INPUT, "Unknown or completed operation_id")
result = execute(pending["channel"], pending["action"], pending["params"],
- timeout=pending["timeout"], operation_id=operation_id)
+ timeout=pending["timeout"], operation_id=operation_id, backend=pending.get("backend"))
return result
diff --git a/agent_reach/runtime/manage.py b/agent_reach/runtime/manage.py
index 2f3ff78e..e6639ff5 100644
--- a/agent_reach/runtime/manage.py
+++ b/agent_reach/runtime/manage.py
@@ -172,6 +172,7 @@ def run_checks(names: Optional[List[str]] = None, timeout: float = 60.0, search_
"elapsed_ms": out["meta"]["elapsed_ms"],
"error": err and {"code": err["code"], "message": err["message"]},
"item_count": len(out["items"]), "attempts": out["meta"]["attempts"],
+ "access": out["meta"].get("access"),
})
if err and err["code"] in {"PLATFORM_BLOCKED", "RATE_LIMITED", "NEED_LOGIN"}:
break
@@ -196,7 +197,7 @@ def run_checks(names: Optional[List[str]] = None, timeout: float = 60.0, search_
best = next((r for r in matches if r["verified"]), next((r for r in matches if r["passed"]), matches[-1]))
evidence[action] = {"backend": best["backend"], "at": state.now(),
"item_count": best["item_count"], "verified": best["verified"],
- "fingerprint": signatures[ch.name]}
+ "fingerprint": signatures[ch.name], "access": best.get("access")}
data["checks"][ch.name] = {"at": state.now(), "actions": {**previous, **actions},
"codes": {**{a: code for a, code in old.get("codes", {}).items() if a not in actions}, **failed},
"previous": previous, "scope": "search" if search_only else "all",
diff --git a/agent_reach/runtime/onboarding.py b/agent_reach/runtime/onboarding.py
index 9cb079fb..3e63c23a 100644
--- a/agent_reach/runtime/onboarding.py
+++ b/agent_reach/runtime/onboarding.py
@@ -22,7 +22,7 @@ _PUBLIC_ACCESS = {
'xiaohongshu': '公开发现页可能提供笔记 ID 和作者;不据此认定正文、评论可读。',
'instagram': '公开搜索或主页信息可先尝试;HTML 可能只有应用外壳,Caption 和评论未获统一验证。',
'facebook': '公开搜索摘要可先尝试;帖子正文和评论取决于页面与访问路径。',
- 'linkedin': '公开职位搜索和职位页可先尝试;本轮未做匿名粒度验收。',
+ 'linkedin': '公开职位可先搜索、读详情;2026-10-21 已取得免登录职位样本,不保证所有职位可读。',
'boss': '公开职位索引和页面可先尝试;本轮未做匿名粒度验收。',
'xueqiu': '公开股票行情和名称搜索可先尝试;社区内容另按所选路径判断。',
}
@@ -53,11 +53,11 @@ _QUICK_ACCESS = {
'web': ('✅ 搜资料、读网页', '—'),
'reddit': ('✅ 搜帖子、读正文、看评论', '—'),
'twitter': ('✅ 搜摘要、试读原文', '❌ 搜推文、看动态、看回复'),
- 'xiaohongshu': ('✅ 看推荐(链接、作者)', '❌ 搜笔记、读正文、看评论'),
+ 'xiaohongshu': ('✅ 搜摘要、找链接', '❌ 站内搜、读正文、看评论'),
'instagram': ('✅ 搜简介', '❌ 找用户、看主页、看帖子'),
- 'facebook': ('✅ 搜摘要', '❌ 搜内容、看主页'),
- 'linkedin': ('✅ 搜标题、找链接', '❌ 找职位、读详情'),
- 'boss': ('✅ 搜标题、找链接', '❌ 找职位、读详情'),
+ 'facebook': ('✅ 搜摘要', '❌ 站内搜、看主页'),
+ 'linkedin': ('✅ 找职位、读公开详情', '❌ 站内搜'),
+ 'boss': ('✅ 搜标题、找链接', '❌ 站内搜、读详情'),
'xueqiu': ('✅ 找股票、查行情', '❌ 看热帖、看热股'),
}
diff --git a/agent_reach/runtime/public_web.py b/agent_reach/runtime/public_web.py
new file mode 100644
index 00000000..cf7cd41b
--- /dev/null
+++ b/agent_reach/runtime/public_web.py
@@ -0,0 +1,89 @@
+"""Public-first queries reuse WebChannel; no browser or site extraction rules."""
+
+from __future__ import annotations
+
+import re
+from urllib.parse import urlsplit
+
+from agent_reach.channels.base import Action, Channel
+from agent_reach.utils.url import host_matches, normalize_public_http_url
+
+from .result import UPSTREAM_BROKEN
+
+BACKEND = "public-web"
+MAX_SECONDS = 20.0
+
+
+def _in_scope(url: str, scopes: tuple[str, ...]) -> bool:
+ try:
+ url = normalize_public_http_url(url)
+ path = urlsplit(url).path
+ except ValueError:
+ return False
+ for scope in scopes:
+ host, _, prefix = scope.partition("/")
+ if host_matches(url, host) and (not prefix or path.startswith("/" + prefix)):
+ return True
+ return False
+
+
+def _readable(item: dict) -> bool:
+ """Reject empty shells and clear login/challenge pages, not inline login links.
+
+ ponytail: this is a conservative text check, not proof of a complete article.
+ The response always says page_text with completeness unverified.
+ """
+ text = str(item.get("text") or "").strip()
+ title = str(item.get("title") or "").strip()
+ if not text or (len(text) < 80 and text.casefold() == title.casefold()):
+ return False
+ wall = r"log\s*in|sign\s*in|join\s+(?:now|linkedin)|登录|登入|注册|just a moment|prove your humanity|access denied|security verification|安全验证|验证码"
+ if re.fullmatch(rf"(?:{wall})(?:\s*[-|·:].*)?", title, re.I):
+ return False
+ login_only = (r"(?:(?:please\s+)?(?:log\s*in|sign\s*in)(?:\s+to\s+continue)?[.!?\s]*|"
+ r"(?:请)?(?:登录|登入)(?:后继续|以继续)?[。!\s]*)+")
+ return re.fullmatch(login_only, text, re.I) is None
+
+
+def attempt(channel: Channel, action: Action, params: dict, *, timeout: float) -> dict | None:
+ """Return a scoped Web result, or None when this input has no public route."""
+ if not action.public_web:
+ return None
+ from agent_reach.channels.web import WebChannel
+
+ from .dispatch import run_action
+
+ if action.name in {"search", "jobs"}:
+ query = " ".join(str(params[k]) for k in ("query", "location", "city") if params.get(k))
+ scope = " OR ".join("site:" + url for url in action.public_web)
+ web_action = "search"
+ web_params = {"query": f"({query}) ({scope})", "limit": params.get("limit", 5)}
+ elif action.name == "read" and _in_scope(str(params.get("target", "")), action.public_web):
+ web_action = "read"
+ web_params = {"target": params["target"]}
+ else:
+ return None
+
+ out = run_action(WebChannel(), web_action, web_params, timeout=timeout)
+ out["channel"], out["action"] = channel.name, action.name
+ if out["ok"]:
+ items = [item for item in out["items"] if _in_scope(str(item.get("url") or ""), action.public_web)]
+ if web_action == "read":
+ items = [item for item in items if _readable(item)]
+ if not items:
+ out.update(ok=False, backend=None, items=[], error={"code": UPSTREAM_BROKEN,
+ "message": "Public web returned no usable content in the requested scope",
+ "hint": "Try the site tool; this does not establish a login requirement."})
+ out["meta"]["attempts"].append({"backend": "content-check", "result": "INSUFFICIENT_CONTENT"})
+ else:
+ scope = "search_results" if web_action == "search" else "page_text"
+ for item in items:
+ item["raw"] = {"source": item.get("raw"), "content_scope": scope,
+ "access": "public", "completeness_verified": False}
+ out.update(backend=BACKEND, items=items)
+ out["meta"]["access"] = {"mode": "public", "scope": scope, "completeness_verified": False,
+ "note": "公开网页结果;不保证站内排序、最新状态、全文或全部评论。需要站内数据时指定 --backend。"}
+ # Provider 429/errors belong to Web, never to the destination platform.
+ out["meta"]["attempts"] = [{**row, "backend": BACKEND + "/" + row["backend"]}
+ for row in out["meta"]["attempts"]]
+ return out
diff --git a/agent_reach/runtime/tools.py b/agent_reach/runtime/tools.py
index 7ad2ec6a..9abe5482 100644
--- a/agent_reach/runtime/tools.py
+++ b/agent_reach/runtime/tools.py
@@ -25,7 +25,6 @@ import re
import shutil
import subprocess
import sys
-import tempfile
import urllib.request
from dataclasses import dataclass
from pathlib import Path
@@ -254,9 +253,16 @@ def install_env() -> dict:
"""
extend_path()
env = dict(os.environ)
- cache = state.root() / "cache"
- cache.mkdir(parents=True, exist_ok=True)
+ cache = state.root() / "cache" / "downloads"
+ if cache.exists() and not state.owned_path(cache):
+ raise ReachError(NEED_SETUP, "Unrecorded download cache left untouched; choose a clean Reach directory")
+ from agent_reach.utils.paths import make_private_dir
+
+ make_private_dir(cache)
state.remember_path(cache, "download caches")
+ # Older releases could claim an already existing cache parent. Preserve it;
+ # only the newly created, dedicated child is eligible for recursive cleanup.
+ state.mutate(lambda data: data.get("owned_paths", {}).pop("cache", None))
env.update(PIP_CACHE_DIR=str(cache / "pip"), UV_CACHE_DIR=str(cache / "uv"),
npm_config_cache=str(cache / "npm"), XDG_CACHE_HOME=str(cache))
https = env.get("HTTPS_PROXY") or env.get("https_proxy")
@@ -373,7 +379,9 @@ def _install_node(tool: Tool) -> None:
import zipfile
os_name, arch, ext = _node_platform()
- with tempfile.TemporaryDirectory(prefix="node-", dir=_work_dir()) as tmp:
+ from agent_reach.utils.paths import private_temporary_directory
+
+ with private_temporary_directory(prefix="node-") as tmp:
index = Path(tmp) / "index.json"
_download("https://nodejs.org/dist/index.json", index)
key = {"darwin": f"osx-{arch}-tar", "linux": f"linux-{arch}", "win": f"win-{arch}-zip"}[os_name]
@@ -415,7 +423,9 @@ def _install_uv(tool: Tool) -> None:
if _WIN:
_run(["powershell", "-ExecutionPolicy", "ByPass", "-c", "irm https://astral.sh/uv/install.ps1 | iex"], env=env)
else:
- with tempfile.TemporaryDirectory(prefix="uv-", dir=_work_dir()) as tmp:
+ from agent_reach.utils.paths import private_temporary_directory
+
+ with private_temporary_directory(prefix="uv-") as tmp:
script = Path(tmp) / "install.sh"
_download("https://astral.sh/uv/install.sh", script)
_run(["sh", str(script)], env=env)
@@ -428,13 +438,6 @@ def _install_uv(tool: Tool) -> None:
raise ReachError(UPSTREAM_BROKEN, "the uv installer finished but uvx is missing")
-def _work_dir() -> Path:
- folder = state.root() / "tmp"
- folder.mkdir(parents=True, exist_ok=True)
- state.remember_path(folder, "installer temporary files")
- return folder
-
-
def _install(tool: Tool, *, global_: bool = False) -> None:
"""Install (or upgrade) one tool. Singletons: global_=True (our npm -g prefix)."""
folder = npm_global_dir() if global_ else tool_dir(tool.name)
diff --git a/agent_reach/scripts/transcribe_xiaoyuzhou.sh b/agent_reach/scripts/transcribe_xiaoyuzhou.sh
index d7221343..a6c9f1b7 100755
--- a/agent_reach/scripts/transcribe_xiaoyuzhou.sh
+++ b/agent_reach/scripts/transcribe_xiaoyuzhou.sh
@@ -98,7 +98,11 @@ MAX_AUDIO_BYTES=1073741824
MAX_API_RESPONSE_BYTES=33554432
MAX_DURATION_SECONDS=10800
-TEMP_ROOT="${TMPDIR:-/tmp}"
+TEMP_ROOT="${TMPDIR:-$HOME/.agent-reach/tmp}"
+if command -v cygpath >/dev/null 2>&1; then
+ TEMP_ROOT=$(cygpath -u "$TEMP_ROOT")
+fi
+mkdir -p -- "$TEMP_ROOT" || exit 1
if ! WORK_DIR=$(mktemp -d "${TEMP_ROOT%/}/agent-reach-xiaoyuzhou.XXXXXX"); then
echo "❌ 无法创建临时目录" >&2
exit 1
diff --git a/agent_reach/skill/SKILL.md b/agent_reach/skill/SKILL.md
index 081ed3ec..b35a35ed 100644
--- a/agent_reach/skill/SKILL.md
+++ b/agent_reach/skill/SKILL.md
@@ -39,6 +39,8 @@ 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 搜用户不以通用网页搜索冒充。
+
Reddit 公开帖可搜索 `site:reddit.com 关键词` 再打开原帖,公开 JSON 有时包含评论父子 ID;以本次实际返回为准。YouTube/B站简介与字幕、视频内容分别验收;X 的单帖公开内容与评论流分别验收。某台机器的失败不能推广为平台必须登录,也不固化“某平台总能匿名读全”。网络路径不同的结果分别记录。
@@ -120,7 +122,7 @@ agent-reach read <链接> # 给链接,自动认出渠道
普通查询默认 headless,不弹窗;`login CHANNEL` 才显窗,下一次查询收回窗口转回无头,始终沿用同一配置。所有浏览器渠道使用 `~/.agent-reach/browser/profile`,CloakBrowser 优先,下载失败回退本机 Chrome。OpenCLI 插件自动准备,网页提取由上游 OpenCLI 或原生 CLI 执行。BOSS 使用同一专用浏览器;不启动额外个人 Chrome。闲置 10 分钟自动关闭,下次调用自动重开。
-需要 Reach 时可直接运行 `agent-reach execute CHANNEL ACTION --params '{...}'`,程序准备依赖并执行真实动作,无需先额外搜索一次。`ensure CHANNEL` 留给安装验收和排障;需要本人登录会返回明确提示。`execute` 返回 `operation_id` 时,在用户完成后运行 `agent-reach resume OPERATION_ID`。本版没有 ask 或 Reach MCP 服务,无需模型 API Key。
+需要 Reach 时可直接运行 `agent-reach execute CHANNEL ACTION --params '{...}'`,公开路径成功就返回,剩余站内请求才准备依赖和会话。`ensure CHANNEL` 留给站内安装验收和排障;需要本人登录会返回明确提示。`execute` 返回 `operation_id` 时,在用户完成后运行 `agent-reach resume OPERATION_ID`,直接验证待完成的站内动作。本版没有 ask 或 Reach MCP 服务,无需模型 API Key。
优先按站点复用本地已有登录;默认使用已连接的浏览器,只读复制当前网站 Cookie。多个来源对应不同账号时,用 `browser profiles` / `browser use ID` 选择,不随机切换。来源不可用时保留 Reach 已保存的会话。定期保存会话;真实页面操作和 Reach 调用重置十分钟计时。OpenCLI Bridge 随浏览器启动和回收;已有用户进程保留,版本冲突交由用户处理。详细步骤见 [sessions.md](references/sessions.md)。
diff --git a/agent_reach/skill/SKILL_en.md b/agent_reach/skill/SKILL_en.md
index fed81fc3..e3c9afc7 100644
--- a/agent_reach/skill/SKILL_en.md
+++ b/agent_reach/skill/SKILL_en.md
@@ -40,6 +40,8 @@ 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.
+
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.
@@ -119,7 +121,7 @@ After the user agrees, read [Maintenance](references/maintenance.md) and confirm
Queries default to headless. Explicit login opens a window; the next query switches back using the same profile. All browser channels use `~/.agent-reach/browser/profile`. CloakBrowser is preferred; installation/download failure falls back to installed Chrome. OpenCLI prepares the extension and performs website extraction. BOSS uses the same dedicated browser. The idle watcher closes it after ten minutes; the next action reopens it.
-Use `agent-reach execute CHANNEL ACTION --params '{...}'` to prepare and perform the real action once. Reserve `ensure CHANNEL` for setup checks and diagnosis. After the user completes a requested login, use `agent-reach resume OPERATION_ID` when an operation ID was returned. There is no Reach MCP server or model planner in this version, and no model API key is required.
+Use `agent-reach execute CHANNEL ACTION --params '{...}'` to try the declared public route first and prepare site tools only when needed. Reserve `ensure CHANNEL` for setup checks and diagnosis. After the user completes a requested login, use `agent-reach resume OPERATION_ID` when an operation ID was returned. There is no Reach MCP server or model planner in this version, and no model API key is required.
Reuse the requested site’s existing local login first. Use a connected local Browser Bridge source or saved Reach state; preserve the source. Choose explicitly when multiple source accounts are available. The user logs in in the Reach window; sessions are saved periodically. Human page input and Reach calls reset the idle timer. The official Bridge is supervised alongside the browser; existing user processes are preserved. See [Sessions](references/sessions.md).
diff --git a/agent_reach/skill/references/capabilities.md b/agent_reach/skill/references/capabilities.md
index 4e87eb24..5e8d5659 100644
--- a/agent_reach/skill/references/capabilities.md
+++ b/agent_reach/skill/references/capabilities.md
@@ -21,7 +21,7 @@ Use only when evidence depth needs clarification. Declared actions and local acc
| 小红书 | 公开列表或索引可能有笔记 ID、作者、标题,空字段不能补猜 | search/read/comments;文字描述、顶级评论及已加载回复;不保证全部评论,不声称理解图片/视频 |
| Instagram | 部分索引和主页浅层信息;HTML 应用壳不算帖文 | search 搜用户、profile 主页、posts 指定用户帖子描述;无统一评论动作,不声称理解图片/视频 |
| Facebook | 部分索引或 HTML 摘要;摘要可能被截断 | search/profile;无统一详情或评论动作,不把搜索摘要当全文 |
-| LinkedIn | 搜索索引中部分公开职位 | jobs/read 职位列表与详情;内容深度与所选路径有关 |
+| LinkedIn | 搜公开职位、读公开 JD;已有免登录成功样本 | jobs/read 先尝试公开网页;指定 opencli 才直接走站内;不保证所有职位可读 |
| BOSS | 搜索索引中可能有职位摘要 | search/read 职位列表与 JD;不能根据编码薪资猜数字;详情后备能力依渠道声明 |
| V2EX | 主题、正文及公开回复 | hot/node/read/user;返回范围以本次响应为准,不保证隐藏或缺失回复 |
| 雪球 | 部分公开行情和索引信息 | quote/search/hot_posts/hot_stocks;行情与社区路径分别验收 |
diff --git a/agent_reach/skill/references/sessions.md b/agent_reach/skill/references/sessions.md
index b007a554..17000b53 100644
--- a/agent_reach/skill/references/sessions.md
+++ b/agent_reach/skill/references/sessions.md
@@ -7,7 +7,7 @@
## 使用与登录
1. 公开内容先用 Agent 已有搜索和读取,结果足够就回答。
-2. 需要站内动作时,`agent-reach execute CHANNEL ACTION --params '{...}'` 执行真实请求。不要为每个请求先跑一次 ensure 的测试查询。
+2. `agent-reach execute CHANNEL ACTION --params '{...}'` 对已声明的公开路径先搜索/读取,成功就返回;不足时才准备站内依赖与会话。`--backend public-web` 限定公开查询;指定 `--backend opencli` 等声明后端可直接使用站内能力。不要为每个请求先跑一次 ensure 的测试查询。
3. 只有实际返回 NEED_LOGIN 才请用户登录;`agent-reach login CHANNEL` 打开专用浏览器,登录由用户本人完成。BOSS 等原生工具按返回提示执行 `login CHANNEL --sync`。
4. 若返回 operation_id,用户完成后使用 `agent-reach resume OPERATION_ID`。保存的是任务参数,不会为等待登录另起常驻任务服务。
@@ -23,7 +23,7 @@
复用以该站 Cookie 快照为准,清除专用浏览器中来源没有的旧 Cookie,保留其他网站。导入失败会尝试恢复原站点 Cookie,并保留已保存的会话。切换来源不会撤销已退出的渠道,也不覆盖本人明确选择的专用登录。
-BOSS 搜索和搜索结果的 JD 读取都走上游 CLI 的浏览器通道,共用该配置;短期职位引用只保存在本地,不返回给模型。B站只在读字幕时尝试把已有站点登录交给官方 B站 CLI,普通搜索不准备浏览器;没装 OpenCLI 时,仍可沿用保存的 B站 CLI 登录。雪球社区动作会自动同步已有登录,无需额外执行同步命令。
+BOSS 站内搜索优先走 OpenCLI,共用该配置。JD 的 OpenCLI 提取在部分职位上存在上游误报登录问题,不据此要求用户反复登录。原生 Boss CLI 仍可显式选择;其 JD 读取需要同一原生 CLI 搜索产生的短期引用,引用只保存在本地,不返回给模型。公开网页结果另行标注。B站只在读字幕时尝试把已有站点登录交给官方 B站 CLI,普通搜索不准备浏览器;没装 OpenCLI 时,仍可沿用保存的 B站 CLI 登录。雪球社区动作会自动同步已有登录,无需额外执行同步命令。
登录期间定期保存,无需关窗才能保存。真实页面操作和 Reach 调用重置十分钟计时。OpenCLI Bridge 随专用浏览器由计时程序管理;Reach 启动的桥随浏览器退出,用户已有桥保留。
diff --git a/agent_reach/transcribe.py b/agent_reach/transcribe.py
index 2b17c236..3f0c563e 100644
--- a/agent_reach/transcribe.py
+++ b/agent_reach/transcribe.py
@@ -25,7 +25,6 @@ import math
import re
import socket
import subprocess
-import tempfile
from pathlib import Path
from typing import List, Optional
from urllib.parse import urlparse
@@ -439,7 +438,9 @@ def transcribe(
if out_dir:
return _transcribe_in_dir(source, order, cfg, Path(out_dir))
- with tempfile.TemporaryDirectory(prefix="transcribe-") as tmp:
+ from agent_reach.utils.paths import private_temporary_directory
+
+ with private_temporary_directory(prefix="transcribe-") as tmp:
return _transcribe_in_dir(source, order, cfg, Path(tmp))
diff --git a/agent_reach/utils/paths.py b/agent_reach/utils/paths.py
index 99d623c7..ba6aac43 100644
--- a/agent_reach/utils/paths.py
+++ b/agent_reach/utils/paths.py
@@ -7,6 +7,7 @@ import stat
import sys
import tempfile
import time
+from contextlib import contextmanager
from pathlib import Path
@@ -14,6 +15,24 @@ class PrivatePathError(RuntimeError):
"""Raised when a private write could be redirected through a symlink."""
+@contextmanager
+def private_temporary_directory(prefix: str):
+ """Create and clean only this call's recorded work directory under Reach."""
+ from agent_reach.runtime import state
+
+ root = make_private_dir(state.root())
+ path = None
+ try:
+ with tempfile.TemporaryDirectory(prefix=prefix, dir=root) as tmp:
+ path = Path(tmp)
+ state.remember_path(path, "temporary work")
+ yield tmp
+ finally:
+ if path is not None and not path.exists():
+ relative = path.relative_to(root).as_posix()
+ state.mutate(lambda data: data.get("owned_paths", {}).pop(relative, None))
+
+
def home_dir() -> Path:
"""Return the explicit HOME first, including on Windows.
diff --git a/docs/validation/full-reacceptance-20261021.md b/docs/validation/full-reacceptance-20261021.md
new file mode 100644
index 00000000..e0804b4d
--- /dev/null
+++ b/docs/validation/full-reacceptance-20261021.md
@@ -0,0 +1,98 @@
+# 全环节复验:2026-10-21
+> 本文保留下午首轮验收的历史结果;后续修复和重新验收见 [PR 更新复验](reacceptance-pr-refresh-20261021.md)。
+
+
+## 结论
+
+**当前仍不能发版。** 40 个声明动作中,31 个至少通过一条正式声明的访问路径;其余 9 个受平台验证、限流或缺少转录 Key 影响。公开搜索通过不等于该平台的登录搜索也通过。
+
+另外复现了公开降级、错误分类、清理归属和发布门禁方面的程序缺口。448 项自动化测试通过没有覆盖住这些问题。本轮没有修改业务代码、上游源码或推送分支;更新了验收记录,保留失败项。
+
+- 测试系统:macOS,ARM64。
+- 源代码摘要:`21ab1b85eab356e890c562f4d654f0d4b3212705196a9be0c488675057d99e9e`。
+- 本机安装的 wheel 与 49 个生产 Python 文件逐一一致,已安装中文 Skill 与渲染结果一致。
+- PR #815 仍为 draft,目标分支 `release/1.6`,未合并;本机新改动尚未推送。
+- 所有真实业务请求只读;限流或风控后停止该平台,没有切换账号、浏览器或后端继续请求。
+
+## 逐项验收
+
+✅ 本机真实验证;🧪 隔离测试或静态检查通过;❌ 发现缺口;⏳ 本轮未完成真实验证。
+
+| 环节 | 结果 | 本轮证据与边界 |
+|---|---|---|
+| 功能分支、PR、不直接推主分支 | ✅ | 当前为功能分支;GitHub 查询确认 PR draft、未合并;本轮没有推送 |
+| 不分发维护者路径、账号、Key、Cookie、API 原型 | ✅ | 候选 wheel 扫描未命中本机身份/密钥模式;退休模块与 API 原型不在包内 |
+| 不修改 OpenCLI 源码 | ✅ | 2,340 个发布文件与缓存官方 npm 归档逐字节一致,无额外发布文件 |
+| 不修改其他上游依赖 | 🧪 | Cloak/B站/BOSS 分别有 26/23/170 个文件通过安装 RECORD 哈希校验;这不是重新从远端下载的独立证明 |
+| 移除 ask、Reach MCP、旧 Cloak 逐站抓取和 OpenCLI 补丁 | ✅ | 安装包中无这些模块;真实 CLI 拒绝退休命令;Cursor/Codex 中未发现 Reach MCP 注册 |
+| 网页提取交给上游工具 | 🧪 | 没有新增逐站 DOM 抓取后端;保留原有公开 API 客户端、字段整理和通用活动检测 |
+| 一个共享专用配置、Cloak 优先 | ✅ | 多平台使用同一 `browser/profile`;实际运行后端为 CloakBrowser |
+| 普通查询默认无头 | ✅ | 实际进程含 headless 参数;真实站内查询成功 |
+| 显窗与无头共用登录和存储 | ✅ | 本地测试页跨两次切换保留 Cookie 和 localStorage;原有 167 项网站 Cookie 哈希不变 |
+| 登录窗口无需关闭即可保存 | ✅ | 窗口仍开着时,watcher 自动将测试 Cookie 保存到快照 |
+| 优先复用本地已有登录 | ✅ | 小红书真实业务成功;来源的 17 项站点 Cookie 前后哈希一致,没有改原浏览器 |
+| 继承完整浏览器状态 | ⏳ | 本地来源导入目前是站点 Cookie;不迁移来源的全部 localStorage/IndexedDB,不承诺所有网站均可直接继承 |
+| 登录由本人完成、不问密码 | 🧪 | 本轮复用已有登录,没有让 AI 输入账号密码;显窗和保存实测通过,未人为退出真实账号重做登录 |
+| 自动加载 OpenCLI 扩展 | ✅ | 重开后扩展已连接,随后的站内搜索成功,无需手工接桥 |
+| 添加浏览器渠道准备依赖 | ✅ | 对已安装渠道实际执行 add,返回三个依赖结果,版本不变;这次验证的是复用已有依赖 |
+| 从空电脑完整冷安装 | ⏳ | 本机已有依赖;没有将依赖卸光再装,Windows 冷安装和业务尚需真机验收 |
+| Cloak 下载失败退回本机 Chrome | 🧪 | 相关回归测试通过;本轮没有破坏现有内核来触发真实下载失败 |
+| 删除站点登录,覆盖 www 子域 | ✅ | 本地真实页面的 Cookie/localStorage 清除成功,另一站点的 Cookie/localStorage 保留;未清除用户真实平台登录 |
+| 清理失败保留渠道、退出后不自动复活登录 | 🧪 | 隔离回归测试通过;没有拿真实账号做破坏性退出测试 |
+| 十分钟自动关闭 | ✅ | 正常计时 600 秒;watcher 结束写入发生在约 601 秒,浏览器和 watcher 均退出 |
+| 手动输入影响计时,脚本伪事件不影响 | ✅ | 本地页面的可信输入重置计时,JS dispatchEvent 事件不重置 |
+| 不重复启动 watcher | ✅ | 第二个 watcher 返回 another watcher is running |
+| 关闭后自动重开并继续使用登录 | ✅ | 自动关闭后直接运行小红书站内搜索,自动以无头 Cloak 重开,返回 2 条结果 |
+| 浏览器关闭后回收计时进程 | ✅ | 自动关闭和显式停止均验证 watcher 退出;最终没有留下测试浏览器 |
+| 用户原有 Bridge 不被结束 | ✅ | 本轮开始前的用户 Bridge 在显窗切换、自动关闭、显式关闭后仍保留 |
+| Reach 自启 Bridge 的回收分支 | 🧪 | 隔离测试通过;当前端口由用户已有 Bridge 使用,没有停止它来制造测试条件 |
+| 普通查询不自动更新依赖 | ✅ | setup、add、业务查询前后记录的工具版本一致,未执行 update |
+| 不改其他软件配置 | ✅ | setup 前后 Cursor/Codex 配置哈希一致;只更新允许放置的 Skill |
+| 版本、小宇宙、安装摘要 | ✅ | 版本 1.6.0;小宇宙渠道和脚本保留;5/5 默认依赖就绪,实际输出问候和三列表 |
+| 正式安装/升级文档 | 🧪 | 文档区分正式版与未发布候选,已有正式用户使用 update;候选版不能冒充已发布 1.6.0 |
+| 无额外模型 Key、无本机 Reach MCP 服务 | ✅ | 普通搜索无需模型 Key;退休命令拒绝,未发现 Reach MCP 注册;Web 仍使用既有远端服务 |
+| 公开优先、只为缺口准备浏览器 | ❌ | 声明公开路径已生效;但 GitHub 未登录 gh 阻断公开 API,execute 查雪球行情仍启动浏览器,见问题 1/2 |
+| 正确区分登录、网络和平台验证 | ❌ | 雪球 403/坏 JSON、YouTube 机器人验证和 GitHub 普通 403 仍有错误分类,见问题 3 |
+| 限流后不再发平台请求 | ✅ | IG 429 后停止其余动作;再次调用被本地保护拦截,后端尝试数为 0 |
+| 卸载只删有明确归属的文件 | ❌ | 预先存在的未登记缓存被认领,卸载删除了其中未登记文件;仅在隔离目录复现 |
+| 数据只落 Reach 目录 | ❌ | 字幕/音频临时目录仍使用系统临时目录;隔离复现确认自动删除,但不满足“全部放 Reach 下”的字面约定 |
+| PR/发布必须有真实验收 | ❌ | 发版接了动作检查,PR CI 没接;检查器未执行 release_ready/额外 Windows 待验字段,见问题 5 |
+| 英文 Skill 同步最新 CLI 说明 | ⏳ | 英文版本尚未解释 public-web 参数和本轮 CLI 公开优先细节,需同步 |
+
+## 渠道实际结果
+
+| 渠道 | 本轮结果 | 已取得的粒度 |
+|---|---|---|
+| GitHub | ✅ 当前环境;❌ 未登录默认路线 | 当前 gh 搜索、仓库 README、Issue/PR 及返回的评论可读;隔离匿名公开 API 也成功,但默认路由先被未登录 gh 阻断 |
+| YouTube | ⚠️ 搜索通过,读取受阻 | 搜索返回 2 条;视频信息读取遇机器人验证后停止,字幕未继续;转录预检明确缺少 Key |
+| B站 | ✅ 4/4 | 搜索、视频信息、热门、首P字幕;字幕 979 字,不代表整套多P或视频画面理解 |
+| V2EX | ✅ 4/4 | 热门、节点、用户、主题及返回的回复;主题读取 7,172 字,未声称全量分页回复 |
+| 网页 | ✅ 2/2 | Exa 搜索和 Jina 页面文本读取 |
+| 小红书 | ✅ 3/3 | 公开索引搜索、站内搜索、正文 602 字、10 条已加载评论/回复;不代表完整评论树或图像理解 |
+| X/Twitter | ✅ 4/4 | 搜索、公开账号资料、动态、50 条线程结果;实际线程文字 6,107 字,不保证全部回复 |
+| Reddit | ✅ 3/3 | 公开索引与站内搜索、板块列表、帖子与实际返回评论;读取 7,819 字 |
+| Facebook | ✅ 2/2 | 搜索卡片和主页元信息;没有验证完整帖子正文或评论导出 |
+| LinkedIn | ✅ 公开搜索和 JD;❌ 站内搜索 | JD 3,882 字;官方 OpenCLI 1.8.7 站内搜索仍等待英文 Jobs,公开搜索路线成功 |
+| BOSS | ❌ 本轮被拒绝 | 原生 Boss CLI 返回环境风控 code 37;停止,未换后端,没有新 JD 通过记录 |
+| Instagram | ❌ 本轮被限流 | 主页接口 HTTP 429;其余两个动作跳过,没有继续请求或要求反复重登 |
+| 雪球 | ✅ 4/4 | 行情、股票搜索、热帖和热股;直接行情不启动浏览器,execute 的准备流程仍有缺口 |
+| 小宇宙 | ⏳ 待 Key | 渠道和转录脚本保留;本机没有 Groq Key,未发送转录请求 |
+
+总计 31/40 是按“动作至少有一条通过路线”统计。LinkedIn 的公开职位搜索计入成功,其站内搜索失败仍单列;没有把公开结果算成站内能力通过。登录相关动作按站内路线计为 16/22,其余是 BOSS 两项、IG 三项和 LinkedIn 站内搜索。
+
+## 需要修复的程序问题
+
+1. **GitHub 的公开降级仍会被登录阻断。** 在新的隔离 HOME 中,同一条真实 CLI 搜索默认返回 NEED_LOGIN;加上 `--backend github-api` 后返回公开仓库。没有退出或更改用户真实 GitHub 登录。`channels/github.py` 将 gh 未配置凭据归为 NEED_LOGIN,`runtime/dispatch.py` 遇此代码直接结束,公开 API 没被调用。
+2. **execute 对公开原生动作仍准备浏览器。** 从浏览器关闭状态分别查询同一条雪球行情:直接命令不启动浏览器;execute 返回同样的腾讯行情,同时启动 Cloak。`runtime/flow.py:prepare` 依照整个渠道的 login_url 准备会话,没有区分此动作是否需要浏览器。
+3. **错误分类没有统一到所有原生客户端。** 隔离复现中,雪球把普通 HTTP 403 和无效 JSON 都报为 NEED_LOGIN,GitHub 把普通 403 报为 RATE_LIMITED;真实 YouTube 请求的机器人验证也被报成 NEED_LOGIN。这些信号分别需要按权限、服务/格式错误和平台验证处理,不能直接引导重登。
+4. **未登记缓存会被认领并删除。** 在隔离目录先创建未登记的 cache/用户文件,再调用 install_env:整个 cache 被记入台账,文件本身未登记;实际执行隔离 uninstall 后,文件消失。真实用户目录未被卸载或删除。
+5. **真实验收门禁不完整。** PR CI 只跑自动化和打包;真实动作检查在 tag 发版阶段。检查器在一个隔离样本里,对 release_ready=false 和 Windows 待验字段返回无错误。目前仍因缺少 9 个真实动作而阻止发版;未来补齐动作后,这两项额外条件也必须被明确执行。
+
+次级待收口:系统临时文件目录、英文 Skill 说明、Windows 真机与空环境冷安装、真实下载失败后的系统 Chrome 回退分支。
+
+## 记录与收尾
+
+- 448 项测试通过,Ruff 与 mypy 覆盖 49 个生产 Python 文件。
+- `release-acceptance.json` 更新为当前源码实测,保留 9 项待验和 release_ready=false;实际运行发布检查返回失败,未发布。
+- 原始业务内容、站点 URL、Cookie 哈希及本机环境证明保存在本机私有验收目录,没有写进分发清单。
+- 测试末尾再次显式关闭专用浏览器,等待 watcher 退出;用户原有 Bridge 保留。真实平台登录未被清除,其他软件配置未被修改。
diff --git a/docs/validation/public-first-cli-20261021.md b/docs/validation/public-first-cli-20261021.md
new file mode 100644
index 00000000..6a2213d4
--- /dev/null
+++ b/docs/validation/public-first-cli-20261021.md
@@ -0,0 +1,42 @@
+# CLI 先公开访问,再按需使用站内能力
+
+2026-10-21,本机候选版验证。当前改动位于功能分支,尚未发布。
+
+后续[全环节复验](full-reacceptance-20261021.md)发现,公开优先尚未覆盖所有旧路径:未登录的 gh 会阻断 GitHub 公开 API,execute 查雪球行情仍准备浏览器。本文保留这轮已经取得的样本,不代表全项目均已解决不必要登录或配置。
+
+## 执行顺序
+
+1. 先验证参数。带 `public_web` 声明的搜索、阅读动作复用现有 Web 渠道,不先安装浏览器或导入登录。
+2. 返回公开结果时标记 `backend: public-web`;`meta.access.scope` 区分 `search_results` 与 `page_text`,不承诺完整性和实时性。
+3. 公开访问不足或服务失败后,才尝试所选动作的站内工具;优先复用已有会话。实际站内路径返回 `NEED_LOGIN` 才提示用户本人登录。
+4. 页面正文旁的登录链接不构成登录墙;空壳、明确登录页不当作正文。搜索为空、DNS/TLS、403、超时和服务错误都不能单独证明用户需要登录。
+5. `--backend public-web` 限定公开访问;指定已声明的站内后端可直接获得站内结果。`execute` 支持相同选择。`ensure` 验收站内能力;`resume` 验证实际待完成的站内动作,避免用公开索引命中掩盖认证失败。
+
+公开路径声明覆盖:LinkedIn jobs/read、Reddit search/read、小红书 search/read、BOSS search/read、X search、Facebook search。其他渠道已有的公开原生接口保持原流程。Instagram 搜用户、评论、字幕、账号列表等独立动作保留原语义,不用网页摘要替代。
+
+公开路径仍使用既有 Exa/Jina 服务。Exa 响应传输截断时,只在原时间预算内补试一次;HTTP 429、403 和工具返回的错误不补试。服务限流归属 Web 服务,不写成目标平台的账号限流。
+
+## 最终安装版真实 CLI 验收
+
+代码摘要:`21ab1b85eab356e890c562f4d654f0d4b3212705196a9be0c488675057d99e9e`。
+
+| 请求 | 实际后端 | 本次结果 |
+|---|---|---|
+| LinkedIn 找深圳数据工程师 | public-web | 2 条,1,817 字;约 2.1 秒;无需启动浏览器 |
+| LinkedIn 读取 CASETiFY 公开职位链接 | public-web 尝试后转 opencli | Jina 403,Exa 抓取超时;已有会话返回 3,882 字 JD;约 24.9 秒;没有要求用户重新登录 |
+| execute LinkedIn jobs | public-web | 2 条,1,817 字;约 1.8 秒;未准备站内工具 |
+| Reddit 搜 LocalLLaMA llama.cpp | public-web | 2 条,1,990 字;约 3.9 秒;搜索证据不当作完整帖子或评论树 |
+
+另一次开发阶段的公开 JD 读取曾返回 4,465 字;最终安装版这次走了已有站内会话。两次结果说明公开读取服务存在波动,不能把此样本写成“所有 JD 稳定匿名可读”。测试结束后,测试使用的专用浏览器与计时程序均已关闭。
+
+这轮没有重复验收其他平台的真实业务;新增公开声明不等于全部渠道已通过发布验收。既有完整发布验收仍需按新源码摘要重新执行。
+
+## 代码与验证
+
+- 共用公开路由读取动作声明,未增加站点 DOM 选择器或自写网页提取器。
+- LinkedIn 将公开索引里的地区域名、标题式职位链接转换为官方工具接受的标准职位 ID 链接,先校验域名与路径;未修改 OpenCLI 源码。
+- 普通命令、通用 read、execute 采用同一公开优先路由;公开成功时跳过站内准备。
+- Skill 和安装摘要同步:LinkedIn 显示“找职位、读公开详情”,站内搜索按实际认证结果决定是否登录。
+- 448 项自动化测试通过;49 个生产 Python 文件通过 Ruff 和 mypy;安装 wheel 与这 49 个文件逐一比对一致。
+- 覆盖无结果/错域名、空壳/登录页、正文附登录链接、短正文、明确认证失败、限流归属、显式后端、恢复待办、冷启动预算及响应截断边界。
+- 候选 wheel 排除本机 API 原型、个人配置、Cookie、浏览器目录及已移除的 ask/MCP 模块。本机 CLI 和已安装 Skill 已同步。
diff --git a/docs/validation/reacceptance-pr-refresh-20261021.md b/docs/validation/reacceptance-pr-refresh-20261021.md
new file mode 100644
index 00000000..b3b2c66c
--- /dev/null
+++ b/docs/validation/reacceptance-pr-refresh-20261021.md
@@ -0,0 +1,58 @@
+# PR 更新复验:2026-10-21
+
+本轮已合入 `release/1.6` 的 `aa8db87`,在功能分支修复本地缺口,并用重新构建、实际安装的 wheel 进行只读查询。**仍为测试候选,不能合并或发布。**
+
+源码摘要:`3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98`。
+
+## 本轮修复与真实核验
+
+| 项目 | 结果 |
+|---|---|
+| gh 没登录阻断公开 GitHub API | 修复;隔离 HOME、移除 GitHub 凭据环境变量后,默认 CLI 返回公开仓库,无需登录 |
+| execute 查公开行情却准备整个浏览器渠道 | 修复;直接命令及 execute 均返回行情,前后浏览器保持关闭;本地回归也覆盖未添加渠道的情况 |
+| 普通 403、坏 JSON、机器人验证误报登录 | 修复;隔离回归区分权限拒绝、限流证据、格式错误、401 和平台验证 |
+| 已存在的未知 cache 被认领并递归删除 | 修复;使用单独登记的下载子目录;隔离安装及实际卸载保留原有未知文件 |
+| 临时音频/字幕文件落在系统临时目录 | 改为 Reach 内的独立登记目录;实际临时目录在异常退出后也清理,用户显式指定的输出目录保留 |
+| 验收门禁遗漏 ready 标记、待验项和空时间 | 修复;PR CI 增加真实验收检查,缺失记录和待验状态继续阻断合并、发版 |
+| BOSS 默认站内搜索 | 改为优先官方 OpenCLI;两条真实结果约 7.7 秒返回;保留原生 CLI 显式入口 |
+| BOSS 详情误报登录 | 官方适配器仍失败;Reach 将已知歧义信号归为上游故障,避免反复要求用户重登 |
+| 英文 Skill | 补齐公开优先、结果范围和显式 backend 说明 |
+
+自动化:**462 项通过**;49 个生产 Python 文件类型检查通过;Ruff 基础错误检查通过。自动化结果不代替下面的联网验收。
+
+## 渠道结果
+
+✅ 表示本机至少一条声明路径真实返回内容;搜索卡片、正文、评论、字幕分别计数。
+
+| 渠道 | 本轮结果与边界 |
+|---|---|
+| GitHub | ✅ 搜索、README、Issue/PR 及返回评论;匿名默认路径另外验收通过 |
+| YouTube | ✅ 搜索、简介 3,844 字、字幕 64,352 字;转录缺 Key。前轮曾遇机器人验证,本次通过不构成稳定性保证 |
+| B站 | ✅ 搜索、信息、热门、首P字幕;不代表整套多P或画面理解 |
+| V2EX | ✅ 热门、节点、用户、主题及返回回复;不保证全量分页 |
+| Web | ✅ 页面文字;❌ Exa 搜索两轮出现响应传输中断,原因仍需区分网络路径和服务端 |
+| 小红书 | ✅ 搜索、正文 315 字、8 条已加载评论/回复;非完整评论树 |
+| X/Twitter | ✅ 搜索、资料、动态、50 条线程结果;非全部回复保证 |
+| Reddit | ✅ 公开搜索、站内搜索、板块、帖子及返回评论;正文与评论文字合计 7,819 字 |
+| Facebook | ✅ 搜索卡片、主页元信息;本版未声明帖子全文和评论导出 |
+| LinkedIn | ✅ 公开职位搜索、JD 3,882 字;❌ 官方 OpenCLI 站内搜索仍等待英文 Jobs |
+| BOSS | ✅ OpenCLI 搜索;❌ JD 结构化提取,网页可访问不能计作 detail 命令通过 |
+| Instagram | ❌ 官方接口 429,余下动作停止;本地保护再次拦截时后端尝试数为零 |
+| 雪球 | ✅ 行情、股票搜索、热帖、热股 |
+| 小宇宙 | 保留渠道和转录脚本;缺 Groq Key,未发送转录请求 |
+
+共 **33/40** 个声明动作至少通过一条正式路径。7 个待验动作:BOSS read、Instagram 三项、Web search、YouTube transcribe、小宇宙 transcribe。LinkedIn 的公开搜索已计入通过,站内搜索失败另列,未混同。
+
+## 浏览器与发布约束
+
+- 共用 Cloak 配置;真实进程含 headless 参数。显窗和无头切换保留 Cookie 与 localStorage。
+- 窗口仍打开时自动保存;可信输入重置计时,脚本伪事件不重置;第二个 watcher 不会重复启动。
+- 本地真实页面验证单站 Cookie、www 子域存储清理,另一站保持原样;169 项原有网站 Cookie 前后哈希一致。
+- 十分钟自动关闭:使用真实 600 秒阈值;30 秒轮询在 630 秒确认浏览器与 watcher 均退出,用户原有 Bridge 保留。关闭后直接搜索会自动以无头 Cloak 重开,返回一条结果;收尾再次关闭浏览器和 watcher。
+- 本地来源只读复用;来源站点 Cookie 哈希不变。导入范围仍是 Cookie,未承诺复制完整浏览器存储。
+- OpenCLI 1.8.7 的 2,340 个发布文件与官方归档一致。没有修改上游源码、增加逐站 DOM 提取、恢复 ask 或 Reach MCP。
+- wheel 含 49 个生产 Python 文件,逐一对应源码;无 API 原型、退休模块、维护者路径或密钥;小宇宙保留。
+- setup 成功,安装后能力表和 Skill 已同步;Cursor/Codex 配置哈希未变化,依赖没有自动升级。
+- Windows 真机、空环境冷安装仍待验。当前 `release_ready=false`,PR 和发版检查必须拒绝放行。
+
+原始内容和环境证据仅保存在本机私有验收目录;提交的清单保留计数、时间、错误码和源码摘要。
diff --git a/docs/validation/release-acceptance.json b/docs/validation/release-acceptance.json
index 02fe3770..0386b09e 100644
--- a/docs/validation/release-acceptance.json
+++ b/docs/validation/release-acceptance.json
@@ -1,408 +1,720 @@
{
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "release_ready": false,
"results": [
{
- "channel": "xiaohongshu",
- "action": "search",
- "at": "2026-10-20T19:58:01Z",
+ "at": "2026-10-21T07:34:37.432667+00:00",
+ "method": "real-cli",
+ "backend": "bili-cli",
+ "item_count": 2,
+ "text_chars": 205,
+ "elapsed_ms": 885,
+ "channel": "bilibili",
+ "action": "hot",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "public-native",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:34:36.529817+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "opencli",
+ "backend": "bili-cli",
+ "item_count": 1,
+ "text_chars": 69,
+ "elapsed_ms": 880,
+ "channel": "bilibili",
+ "action": "read",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
+ "acceptance_scope": "public-native",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:34:35.630227+00:00",
+ "method": "real-cli",
+ "backend": "bili-cli",
"item_count": 2,
"text_chars": 0,
- "elapsed_ms": 2498,
+ "elapsed_ms": 1881,
+ "channel": "bilibili",
+ "action": "search",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "public-native",
"error": null
},
{
- "channel": "xiaohongshu",
+ "at": "2026-10-21T07:34:39.427832+00:00",
+ "method": "real-cli",
+ "backend": "bili-cli",
+ "item_count": 1,
+ "text_chars": 979,
+ "elapsed_ms": 1955,
+ "channel": "bilibili",
+ "action": "subtitle",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "site",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:31:09.775120+00:00",
+ "method": "real-cli",
+ "backend": null,
+ "item_count": 0,
+ "text_chars": 0,
+ "elapsed_ms": 20546,
+ "channel": "boss",
"action": "read",
- "at": "2026-10-20T19:58:16Z",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": false,
+ "acceptance_scope": "site",
+ "error": {
+ "code": "UPSTREAM_BROKEN"
+ }
+ },
+ {
+ "at": "2026-10-21T07:30:49.217490+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
"backend": "opencli",
+ "item_count": 2,
+ "text_chars": 0,
+ "elapsed_ms": 7665,
+ "channel": "boss",
+ "action": "search",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 1,
- "text_chars": 22,
- "elapsed_ms": 6823,
+ "acceptance_scope": "site",
"error": null
},
{
- "channel": "xiaohongshu",
- "action": "comments",
- "at": "2026-10-20T19:58:34Z",
- "os": "macOS",
+ "at": "2026-10-21T07:33:17.957318+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
"backend": "opencli",
+ "item_count": 1,
+ "text_chars": 0,
+ "elapsed_ms": 9834,
+ "channel": "facebook",
+ "action": "profile",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 25,
- "text_chars": 523,
- "elapsed_ms": 8982,
+ "acceptance_scope": "site",
"error": null
},
{
- "channel": "reddit",
+ "at": "2026-10-21T07:33:22.530496+00:00",
+ "method": "real-cli",
+ "backend": "public-web",
+ "item_count": 2,
+ "text_chars": 411,
+ "elapsed_ms": 4549,
+ "channel": "facebook",
"action": "search",
- "at": "2026-10-20T19:58:48Z",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "default",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:33:53.846288+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "opencli",
+ "backend": "gh",
+ "item_count": 1,
+ "text_chars": 4745,
+ "elapsed_ms": 3560,
+ "channel": "github",
+ "action": "read",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
+ "acceptance_scope": "public-native",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:33:45.210058+00:00",
+ "method": "real-cli",
+ "backend": "gh",
"item_count": 2,
- "text_chars": 0,
- "elapsed_ms": 6538,
+ "text_chars": 297,
+ "elapsed_ms": 1608,
+ "channel": "github",
+ "action": "search",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "public-native",
"error": null
},
{
- "channel": "reddit",
- "action": "read",
- "at": "2026-10-20T19:59:02Z",
+ "at": "2026-10-21T07:34:29.863191+00:00",
+ "channel": "instagram",
+ "action": "posts",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": false,
+ "acceptance_scope": "site",
+ "error": {
+ "code": "NOT_EXECUTED"
+ }
+ },
+ {
+ "at": "2026-10-21T07:34:29.855006+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "opencli",
+ "backend": null,
+ "item_count": 0,
+ "text_chars": 0,
+ "elapsed_ms": 11347,
+ "channel": "instagram",
+ "action": "profile",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": false,
+ "acceptance_scope": "site",
+ "error": {
+ "code": "RATE_LIMITED"
+ }
+ },
+ {
+ "at": "2026-10-21T07:34:29.862945+00:00",
+ "channel": "instagram",
+ "action": "search",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": false,
+ "acceptance_scope": "site",
+ "error": {
+ "code": "NOT_EXECUTED"
+ }
+ },
+ {
+ "at": "2026-10-21T07:34:18.488404+00:00",
+ "method": "real-cli",
+ "backend": "public-web",
+ "item_count": 2,
+ "text_chars": 1817,
+ "elapsed_ms": 7555,
+ "channel": "linkedin",
+ "action": "jobs",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 1,
- "text_chars": 17821,
- "elapsed_ms": 5368,
+ "acceptance_scope": "default",
"error": null
},
{
- "channel": "reddit",
- "action": "subreddit",
- "at": "2026-10-20T19:59:15Z",
+ "at": "2026-10-21T07:34:10.919879+00:00",
+ "method": "real-cli",
+ "backend": "opencli",
+ "item_count": 1,
+ "text_chars": 3882,
+ "elapsed_ms": 17916,
+ "channel": "linkedin",
+ "action": "read",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "site",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:32:41.322053+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
"backend": "opencli",
+ "item_count": 1,
+ "text_chars": 7819,
+ "elapsed_ms": 14865,
+ "channel": "reddit",
+ "action": "read",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 2,
- "text_chars": 0,
- "elapsed_ms": 5134,
+ "acceptance_scope": "site",
"error": null
},
{
- "channel": "twitter",
+ "at": "2026-10-21T07:32:52.977047+00:00",
+ "method": "real-cli",
+ "backend": "public-web",
+ "item_count": 2,
+ "text_chars": 1990,
+ "elapsed_ms": 2412,
+ "channel": "reddit",
"action": "search",
- "at": "2026-10-20T19:59:28Z",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "default",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:32:50.542243+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
"backend": "opencli",
- "passed": true,
"item_count": 2,
- "text_chars": 1060,
- "elapsed_ms": 5009,
+ "text_chars": 0,
+ "elapsed_ms": 9208,
+ "channel": "reddit",
+ "action": "subreddit",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "site",
"error": null
},
{
- "channel": "twitter",
- "action": "profile",
- "at": "2026-10-20T19:59:44Z",
- "os": "macOS",
+ "at": "2026-10-21T07:31:36.441225+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
"backend": "opencli",
- "passed": true,
"item_count": 1,
"text_chars": 0,
- "elapsed_ms": 7478,
+ "elapsed_ms": 14228,
+ "channel": "twitter",
+ "action": "profile",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "site",
"error": null
},
{
- "channel": "twitter",
- "action": "tweets",
- "at": "2026-10-20T19:59:56Z",
- "os": "macOS",
+ "at": "2026-10-21T07:32:10.157616+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
"backend": "opencli",
- "passed": true,
"item_count": 2,
- "text_chars": 960,
- "elapsed_ms": 4345,
+ "text_chars": 926,
+ "elapsed_ms": 14735,
+ "channel": "twitter",
+ "action": "search",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "default",
"error": null
},
{
+ "at": "2026-10-21T07:31:55.408562+00:00",
+ "method": "real-cli",
+ "backend": "opencli",
+ "item_count": 50,
+ "text_chars": 6247,
+ "elapsed_ms": 13051,
"channel": "twitter",
"action": "thread",
- "at": "2026-10-20T20:00:12Z",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "site",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:31:42.327924+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
"backend": "opencli",
+ "item_count": 2,
+ "text_chars": 960,
+ "elapsed_ms": 5857,
+ "channel": "twitter",
+ "action": "tweets",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 50,
- "text_chars": 7992,
- "elapsed_ms": 7816,
+ "acceptance_scope": "site",
"error": null
},
{
- "channel": "facebook",
- "action": "search",
- "at": "2026-10-20T20:00:28Z",
- "os": "macOS",
+ "at": "2026-10-21T07:34:21.537352+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "opencli",
+ "backend": "v2ex-api",
+ "item_count": 2,
+ "text_chars": 1535,
+ "elapsed_ms": 2810,
+ "channel": "v2ex",
+ "action": "hot",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 1,
- "text_chars": 22,
- "elapsed_ms": 7678,
+ "acceptance_scope": "public-native",
"error": null
},
{
- "channel": "facebook",
- "action": "profile",
- "at": "2026-10-20T20:00:43Z",
+ "at": "2026-10-21T07:34:24.086950+00:00",
+ "method": "real-cli",
+ "backend": "v2ex-api",
+ "item_count": 2,
+ "text_chars": 646,
+ "elapsed_ms": 2549,
+ "channel": "v2ex",
+ "action": "node",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "public-native",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:34:33.722232+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "opencli",
+ "backend": "v2ex-api",
+ "item_count": 1,
+ "text_chars": 6090,
+ "elapsed_ms": 9634,
+ "channel": "v2ex",
+ "action": "read",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
+ "acceptance_scope": "public-native",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:34:36.126523+00:00",
+ "method": "real-cli",
+ "backend": "v2ex-api",
"item_count": 1,
"text_chars": 0,
- "elapsed_ms": 6983,
+ "elapsed_ms": 2403,
+ "channel": "v2ex",
+ "action": "user",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "public-native",
"error": null
},
{
- "channel": "boss",
+ "at": "2026-10-21T07:34:43.663061+00:00",
+ "method": "real-cli",
+ "backend": "jina",
+ "item_count": 1,
+ "text_chars": 958,
+ "elapsed_ms": 2386,
+ "channel": "web",
+ "action": "read",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "public-native",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:42:13.393624+00:00",
+ "method": "real-cli",
+ "backend": null,
+ "item_count": 0,
+ "text_chars": 0,
+ "elapsed_ms": 8227,
+ "channel": "web",
"action": "search",
- "at": "2026-10-20T20:00:53Z",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": false,
+ "acceptance_scope": "public-native-recheck",
+ "error": {
+ "code": "UPSTREAM_BROKEN"
+ }
+ },
+ {
+ "at": "2026-10-21T07:30:40.945948+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "boss-agent-cli",
+ "backend": "opencli",
+ "item_count": 8,
+ "text_chars": 378,
+ "elapsed_ms": 7976,
+ "channel": "xiaohongshu",
+ "action": "comments",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 2,
- "text_chars": 58,
- "elapsed_ms": 1128,
+ "acceptance_scope": "site",
"error": null
},
{
- "channel": "boss",
+ "at": "2026-10-21T07:30:32.959482+00:00",
+ "method": "real-cli",
+ "backend": "opencli",
+ "item_count": 1,
+ "text_chars": 315,
+ "elapsed_ms": 6849,
+ "channel": "xiaohongshu",
"action": "read",
- "at": "2026-10-20T20:01:01Z",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "site",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:30:26.092628+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "boss-agent-cli",
+ "backend": "opencli",
+ "item_count": 2,
+ "text_chars": 0,
+ "elapsed_ms": 5289,
+ "channel": "xiaohongshu",
+ "action": "search",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 1,
- "text_chars": 525,
- "elapsed_ms": 565,
+ "acceptance_scope": "site",
"error": null
},
{
- "channel": "xueqiu",
- "action": "hot_posts",
- "at": "2026-10-20T20:01:11Z",
+ "method": "configuration-preflight",
+ "channel": "xiaoyuzhou",
+ "action": "transcribe",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": false,
+ "acceptance_scope": "configuration-preflight",
+ "error": {
+ "code": "NOT_EXECUTED"
+ }
+ },
+ {
+ "at": "2026-10-21T07:34:31.712247+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
"backend": "xueqiu-api",
- "passed": true,
"item_count": 2,
"text_chars": 274,
- "elapsed_ms": 1563,
+ "elapsed_ms": 1634,
+ "channel": "xueqiu",
+ "action": "hot_posts",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "site",
"error": null
},
{
+ "at": "2026-10-21T07:34:33.723705+00:00",
+ "method": "real-cli",
+ "backend": "xueqiu-api",
+ "item_count": 2,
+ "text_chars": 39,
+ "elapsed_ms": 1967,
"channel": "xueqiu",
"action": "hot_stocks",
- "at": "2026-10-20T20:01:20Z",
"os": "macOS",
- "method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "xueqiu-api",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 2,
- "text_chars": 41,
- "elapsed_ms": 477,
+ "acceptance_scope": "site",
"error": null
},
{
- "channel": "bilibili",
- "action": "subtitle",
- "at": "2026-10-20T20:01:29Z",
- "os": "macOS",
+ "at": "2026-10-21T07:30:08.862012+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "bili-cli",
+ "backend": "tencent",
+ "item_count": 1,
+ "text_chars": 21,
+ "elapsed_ms": 184,
+ "channel": "xueqiu",
+ "action": "quote",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
+ "acceptance_scope": "public-execute",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:34:30.065470+00:00",
+ "method": "real-cli",
+ "backend": "tencent",
"item_count": 1,
- "text_chars": 979,
- "elapsed_ms": 1261,
+ "text_chars": 0,
+ "elapsed_ms": 196,
+ "channel": "xueqiu",
+ "action": "search",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "public-native",
"error": null
},
{
- "channel": "linkedin",
+ "at": "2026-10-21T07:34:05.758741+00:00",
+ "method": "real-cli",
+ "backend": "yt-dlp",
+ "item_count": 1,
+ "text_chars": 3844,
+ "elapsed_ms": 7993,
+ "channel": "youtube",
"action": "read",
- "at": "2026-10-20T20:01:56Z",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "public-native",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:33:57.765221+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
- "backend": "opencli",
+ "backend": "yt-dlp",
+ "item_count": 2,
+ "text_chars": 256,
+ "elapsed_ms": 3919,
+ "channel": "youtube",
+ "action": "search",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
"passed": true,
- "item_count": 1,
- "text_chars": 4783,
- "elapsed_ms": 18682,
+ "acceptance_scope": "public-native",
"error": null
},
{
- "channel": "instagram",
- "action": "profile",
- "at": "2026-10-21T00:58:55Z",
+ "at": "2026-10-21T07:34:18.521783+00:00",
+ "method": "real-cli",
+ "backend": "yt-dlp",
+ "item_count": 1,
+ "text_chars": 64352,
+ "elapsed_ms": 12763,
+ "channel": "youtube",
+ "action": "subtitle",
"os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": true,
+ "acceptance_scope": "public-native",
+ "error": null
+ },
+ {
+ "at": "2026-10-21T07:34:18.726640+00:00",
"method": "real-cli",
- "source_sha256": "3ac98c106151237cb8e4deff46d315b23411411e3779d70728c3c0bc756e338f",
"backend": null,
- "passed": false,
"item_count": 0,
"text_chars": 0,
- "elapsed_ms": 6920,
- "error": "NEED_LOGIN"
+ "elapsed_ms": 205,
+ "channel": "youtube",
+ "action": "transcribe",
+ "os": "macOS",
+ "source_sha256": "3de11065c99dde53e4009cca7b2bddc32b8da7f0fc968934e6c76b682e503f98",
+ "passed": false,
+ "acceptance_scope": "public-native",
+ "error": {
+ "code": "NEED_SETUP"
+ }
}
],
- "candidate": true,
- "version": "1.6.0",
- "recorded_at": "2026-10-21T02:26:14Z",
- "release_ready": false,
"pending": [
{
- "channel": "bilibili",
- "action": "hot",
- "reason": "Not accepted on this source"
- },
- {
- "channel": "bilibili",
- "action": "read",
- "reason": "Not accepted on this source"
- },
- {
- "channel": "bilibili",
- "action": "search",
- "reason": "Not accepted on this source"
- },
- {
- "channel": "github",
+ "channel": "boss",
"action": "read",
- "reason": "Not accepted on this source"
- },
- {
- "channel": "github",
- "action": "search",
- "reason": "Not accepted on this source"
+ "reason": "OpenCLI JD extraction failed; ambiguous login signal is not treated as proof of expired login"
},
{
"channel": "instagram",
"action": "posts",
- "reason": "Not requested after the source-browser API returned HTTP 429. Public post links are not a structured posts pass."
+ "reason": "Skipped after rate limit"
},
{
"channel": "instagram",
"action": "profile",
- "reason": "Refreshed site-cookie snapshot matched; formal route returned HTTP 401. The same endpoint in the logged-in source browser returned HTTP 429. No business pass."
+ "reason": "HTTP 429; paused"
},
{
"channel": "instagram",
"action": "search",
- "reason": "Earlier HTTP 404 on the search endpoint; source-browser profile API also returned HTTP 429. Not retested after that limit."
- },
- {
- "channel": "linkedin",
- "action": "jobs",
- "reason": "Job search waits for English Jobs on Chinese account UI; official CDP integration decision pending"
+ "reason": "Skipped after rate limit"
},
{
- "channel": "v2ex",
- "action": "hot",
- "reason": "Not accepted on this source"
+ "channel": "web",
+ "action": "search",
+ "reason": "Exa response transport interrupted (IncompleteRead), including one later recheck"
},
{
- "channel": "v2ex",
- "action": "node",
- "reason": "Not accepted on this source"
+ "channel": "xiaoyuzhou",
+ "action": "transcribe",
+ "reason": "No Groq Key configured"
},
{
- "channel": "v2ex",
- "action": "read",
- "reason": "Not accepted on this source"
- },
+ "channel": "youtube",
+ "action": "transcribe",
+ "reason": "No Whisper provider Key configured"
+ }
+ ],
+ "additional_required_validation": [
+ "Windows real headless startup, session reuse, cold install and channel queries",
+ "Resolve failed actions before marking this source release-ready"
+ ],
+ "privacy": "Counts, timings, source digest and error codes only; no credentials, account identifiers, queries or content URLs",
+ "route_diagnostics": [
{
- "channel": "v2ex",
- "action": "user",
- "reason": "Not accepted on this source"
+ "channel": "boss",
+ "action": "search",
+ "scope": "site",
+ "passed": true,
+ "backend": "opencli",
+ "error_code": null
},
{
- "channel": "web",
+ "channel": "boss",
"action": "read",
- "reason": "Not accepted on this source"
+ "scope": "site",
+ "passed": false,
+ "backend": null,
+ "error_code": "UPSTREAM_BROKEN"
},
{
- "channel": "web",
- "action": "search",
- "reason": "Not accepted on this source"
+ "channel": "linkedin",
+ "action": "jobs",
+ "scope": "site",
+ "passed": false,
+ "backend": null,
+ "error_code": "UPSTREAM_BROKEN"
},
{
- "channel": "xiaoyuzhou",
- "action": "transcribe",
- "reason": "Not accepted on this source"
+ "channel": "linkedin",
+ "action": "read",
+ "scope": "site",
+ "passed": true,
+ "backend": "opencli",
+ "error_code": null
},
{
- "channel": "xueqiu",
- "action": "quote",
- "reason": "Not accepted on this source"
+ "channel": "linkedin",
+ "action": "jobs",
+ "scope": "default",
+ "passed": true,
+ "backend": "public-web",
+ "error_code": null
},
{
- "channel": "xueqiu",
+ "channel": "web",
"action": "search",
- "reason": "Not accepted on this source"
+ "scope": "public-native",
+ "passed": false,
+ "backend": null,
+ "error_code": "UPSTREAM_BROKEN"
},
{
- "channel": "youtube",
+ "channel": "web",
"action": "read",
- "reason": "Not accepted on this source"
+ "scope": "public-native",
+ "passed": true,
+ "backend": "jina",
+ "error_code": null
},
{
- "channel": "youtube",
+ "channel": "web",
"action": "search",
- "reason": "Not accepted on this source"
- },
- {
- "channel": "youtube",
- "action": "subtitle",
- "reason": "Not accepted on this source"
- },
- {
- "channel": "youtube",
- "action": "transcribe",
- "reason": "Not accepted on this source"
+ "scope": "public-native-recheck",
+ "passed": false,
+ "backend": null,
+ "error_code": "UPSTREAM_BROKEN"
}
],
- "additional_required_validation": [
- "Windows headless startup, local site-session reuse, login mode switch, business actions and cleanup"
- ],
- "privacy": "Counts, timings, error codes and source digest only; no account identifiers, credentials or content URLs",
- "diagnostics": [
- {
- "channel": "instagram",
- "at": "2026-10-21T01:11:32Z",
- "method": "read-only-source-comparison",
- "formal_route_http": 401,
- "site_cookie_count": 11,
- "copied_values_matched": true,
- "source_logged_in_ui": true,
- "source_same_endpoint_http": 429,
- "source_location_unchanged": true,
- "owned_public_page_readable": true,
- "owned_public_post_links": 12,
- "owned_authenticated_session_verified": false,
- "counted_as_business_pass": false
- }
- ]
+ "verification_summary": {
+ "automated_tests": 462,
+ "real_action_passed": 33,
+ "real_action_total": 40,
+ "anonymous_github_default_passed": true,
+ "public_quote_execute_keeps_browser_closed": true
+ }
}
diff --git a/scripts/check_release_acceptance.py b/scripts/check_release_acceptance.py
index 28d1d5ea..31b7dd97 100644
--- a/scripts/check_release_acceptance.py
+++ b/scripts/check_release_acceptance.py
@@ -24,21 +24,35 @@ def source_digest(root: Path = ROOT) -> str:
def validate(data: dict, required: set[tuple[str, str]], digest: str) -> list[str]:
errors = []
+ if not isinstance(data, dict):
+ return ["Acceptance manifest must be an object"]
if data.get("source_sha256") != digest:
errors.append("Acceptance belongs to different source code")
+ if data.get("release_ready") is not True:
+ errors.append("Acceptance is not marked release_ready")
+ if data.get("pending") or data.get("additional_required_validation"):
+ errors.append("Acceptance still has pending actions or required validation")
+ if not isinstance(data.get("results"), list):
+ return errors + ["Acceptance results must be a list"]
passed = set()
for row in data.get("results", []):
+ if not isinstance(row, dict):
+ errors.append("Acceptance result must be an object")
+ continue
key = (row.get("channel"), row.get("action"))
if key not in required:
errors.append(f"Unknown acceptance action: {key}")
continue
try:
- at = datetime.fromisoformat(row["at"].replace("Z", "+00:00"))
+ stamp = row.get("at")
+ if not isinstance(stamp, str):
+ raise ValueError("Missing timestamp")
+ at = datetime.fromisoformat(stamp.replace("Z", "+00:00"))
age = (datetime.now(timezone.utc) - at).total_seconds()
except (KeyError, TypeError, ValueError):
age = float("inf")
if (row.get("source_sha256") == digest and row.get("method") == "real-cli" and row.get("passed") is True
- and isinstance(row.get("item_count"), int) and row["item_count"] > 0
+ and type(row.get("item_count")) is int and row["item_count"] > 0
and row.get("backend") and row.get("os") and 0 <= age <= 7 * 86400):
passed.add(key)
errors += [f"Missing real acceptance: {channel}/{action}" for channel, action in sorted(required - passed)]
diff --git a/tests/conftest.py b/tests/conftest.py
index 3cdb3cc2..69e3d371 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -4,6 +4,7 @@
import os
import shutil
import subprocess
+import urllib.request
from pathlib import Path
import pytest
@@ -83,6 +84,11 @@ def isolated_home(tmp_path, monkeypatch):
monkeypatch.delenv("OPENCLAW_HOME", raising=False)
# never start the background release check from tests
monkeypatch.setenv("AGENT_REACH_NO_UPDATE_CHECK", "1")
+ # Public-first routing must not turn adapter unit tests into live requests.
+ # Network tests supply their own response below this fixture.
+ def no_network(*args, **kwargs):
+ raise OSError("Unit tests require an explicit mocked HTTP response")
+ monkeypatch.setattr(urllib.request, "urlopen", no_network)
from agent_reach.runtime import bridge, cdp
monkeypatch.setattr(bridge, "status", lambda: {"ok": True, "daemonVersion": "1.8.7", "profiles": []})
@@ -94,6 +100,8 @@ def isolated_home(tmp_path, monkeypatch):
# OpenCLI uses a machine-wide port even when HOME is temporary.
if isinstance(argv, (list, tuple)) and argv:
executable = Path(argv[0])
+ if "pip" in argv and "install" in argv:
+ pytest.fail("Unmocked pip install would download real dependencies during a unit test")
if executable.name in {"opencli", "opencli.cmd"} and "--version" not in argv and home not in executable.resolve().parents:
pytest.fail("Unmocked OpenCLI command would touch the user's Bridge daemon")
return original_popen(argv, *args, **kwargs)
diff --git a/tests/test_boss_channel.py b/tests/test_boss_channel.py
index 7d151d8e..1c750f43 100644
--- a/tests/test_boss_channel.py
+++ b/tests/test_boss_channel.py
@@ -4,6 +4,18 @@
from agent_reach.channels.boss import BossChannel
+def test_ambiguous_upstream_detail_login_signal_is_not_a_login_instruction(monkeypatch):
+ import pytest
+ from agent_reach.backends import opencli
+ from agent_reach.runtime.result import ReachError
+ def broken(*a, **k):
+ raise ReachError("NEED_LOGIN", "BOSS redirected the job detail page to the login flow")
+ monkeypatch.setattr(opencli, "opencli_call", broken)
+ with pytest.raises(ReachError) as exc:
+ BossChannel()._opencli_read(target="https://www.zhipin.com/job_detail/job123.html", timeout=10)
+ assert exc.value.code == "UPSTREAM_BROKEN"
+
+
def test_can_handle_matches_zhipin_hosts():
ch = BossChannel()
for url in [
diff --git a/tests/test_native_access_errors.py b/tests/test_native_access_errors.py
new file mode 100644
index 00000000..0c6a700a
--- /dev/null
+++ b/tests/test_native_access_errors.py
@@ -0,0 +1,58 @@
+"""Local credential setup, denied requests and platform challenges stay distinct."""
+import json
+import urllib.error
+
+import pytest
+
+from agent_reach.channels import github, xueqiu, youtube
+from agent_reach.runtime.dispatch import run_action
+from agent_reach.runtime.result import ReachError, classify
+from agent_reach.runtime.run import CommandFailed
+
+
+def test_missing_gh_auth_falls_back_to_public_api_without_login(monkeypatch):
+ def no_gh(*a, **k):
+ raise CommandFailed("UPSTREAM_BROKEN", "gh exited", stderr="please run gh auth login")
+ monkeypatch.setattr(github, "run_cmd", no_gh)
+ monkeypatch.setattr(github, "http_request", lambda *a, **k: json.dumps(
+ {"items": [{"full_name": "owner/repo", "html_url": "https://github.com/owner/repo"}]}
+ ).encode())
+ out = run_action(github.GitHubChannel(), "search", {"query": "repo", "limit": 1})
+ assert out["ok"] and out["backend"] == "github-api" and len(out["items"]) == 1
+
+
[email protected]("headers,code", [({}, "UPSTREAM_BROKEN"),
+ ({"X-RateLimit-Remaining": "0"}, "RATE_LIMITED"), ({"Retry-After": "60"}, "RATE_LIMITED")])
+def test_github_403_requires_rate_limit_evidence(monkeypatch, headers, code):
+ def denied(*a, **k):
+ raise urllib.error.HTTPError("https://api.github.com/test", 403, "Forbidden", headers, None)
+ monkeypatch.setattr(github, "http_request", denied)
+ with pytest.raises(ReachError) as exc:
+ github._api_get("/test", 5)
+ assert exc.value.code == code
+
+
[email protected]("failure,code", [
+ (json.JSONDecodeError("invalid", "", 0), "UPSTREAM_BROKEN"),
+ (urllib.error.HTTPError("https://xueqiu.com/test", 403, "Forbidden", {}, None), "UPSTREAM_BROKEN"),
+ (urllib.error.HTTPError("https://xueqiu.com/test", 401, "Unauthorized", {}, None), "NEED_LOGIN"),
+])
+def test_xueqiu_only_confirmed_auth_failure_requests_login(monkeypatch, failure, code):
+ def fail(*a, **k):
+ raise failure
+ monkeypatch.setattr(xueqiu, "_get_json", fail)
+ try:
+ xueqiu._xq_json("https://xueqiu.com/test")
+ except Exception as exc:
+ assert classify(exc).code == code
+ else:
+ pytest.fail("Failure was silently accepted")
+
+
+def test_youtube_bot_challenge_does_not_instruct_a_login(monkeypatch):
+ def blocked(*a, **k):
+ raise CommandFailed("UPSTREAM_BROKEN", "YouTube rejected request", stderr="Sign in to confirm you're not a bot")
+ monkeypatch.setattr(youtube, "run_cmd", blocked)
+ with pytest.raises(ReachError) as exc:
+ youtube._run_ytdlp([], 5)
+ assert exc.value.code == "PLATFORM_BLOCKED"
diff --git a/tests/test_public_first.py b/tests/test_public_first.py
new file mode 100644
index 00000000..21dd43d5
--- /dev/null
+++ b/tests/test_public_first.py
@@ -0,0 +1,200 @@
+"""Public access precedes installation/auth, and keeps its evidence scope."""
+
+import json
+from unittest.mock import Mock
+
+import pytest
+
+from agent_reach.channels.linkedin import LinkedInChannel
+from agent_reach.channels.web import WebChannel
+from agent_reach.runtime import cli, flow, state
+from agent_reach.runtime.dispatch import run_action
+from agent_reach.runtime.result import ReachError, make_item
+
+URL = "https://www.linkedin.com/jobs/view/data-engineer-123"
+TEXT = "Design data pipelines with Python and SQL. " * 20
+
+
+def public_search(monkeypatch):
+ search = Mock(return_value=[make_item(title="Data Engineer", url=URL, text="Search excerpt")])
+ monkeypatch.setattr(WebChannel, "_exa_search", search)
+ return search
+
+
+def test_public_success_never_installs_binds_or_opens_a_browser(monkeypatch, public_search):
+ from agent_reach.runtime import browser, dispatch
+ for module, name in ((flow, "prepare"), (browser, "ensure_running"), (dispatch, "execution_lock")):
+ monkeypatch.setattr(module, name, Mock(side_effect=AssertionError("public query touched browser setup")))
+ monkeypatch.setattr(LinkedInChannel, "_jobs", Mock(side_effect=AssertionError("used site tool")))
+ out = flow.execute("linkedin", "jobs", {"query": "Data Engineer", "location": "深圳", "limit": 2})
+ assert out["ok"] and out["backend"] == "public-web" and "operation_id" not in out
+ query = public_search.call_args.kwargs["query"]
+ assert "site:linkedin.com/jobs/view/" in query and "深圳" in query
+ assert out["meta"]["access"]["scope"] == "search_results"
+ assert out["meta"]["access"]["completeness_verified"] is False
+ assert out["items"][0]["raw"]["content_scope"] == "search_results"
+
+
+def test_explicit_site_backend_bypasses_web_search(monkeypatch, public_search):
+ site = Mock(return_value=[make_item(title="Site result", url=URL)])
+ monkeypatch.setattr(LinkedInChannel, "_jobs", site)
+ out = run_action(LinkedInChannel(), "jobs", {"query": "Data"}, only_backend="opencli")
+ assert out["backend"] == "opencli" and site.call_count == 1
+ public_search.assert_not_called()
+
+
[email protected]("code", ["UPSTREAM_BROKEN", "TIMEOUT", "RATE_LIMITED"])
+def test_web_provider_failure_does_not_become_platform_login_or_cooldown(monkeypatch, code):
+ def fail(self, **kwargs):
+ raise ReachError(code, "Web provider failure")
+ monkeypatch.setattr(WebChannel, "_exa_search", fail)
+ monkeypatch.setattr(LinkedInChannel, "_jobs", lambda *a, **k: [make_item(title="Site result", url=URL)])
+ out = run_action(LinkedInChannel(), "jobs", {"query": "Data"})
+ assert out["ok"] and out["backend"] == "opencli"
+ assert not state.load().get("cooldowns", {}).get("linkedin")
+
+
[email protected]("rows", [[], [make_item(url="https://linkedin.com.evil.test/jobs/view/1")],
+ [make_item(url="https://www.linkedin.com/in/person")],
+ [make_item(url="https://[email protected]/status/1")]])
+def test_no_hits_or_wrong_scope_only_trigger_site_attempt_not_login(monkeypatch, public_search, rows):
+ public_search.return_value = rows
+ monkeypatch.setattr(LinkedInChannel, "_jobs", Mock(side_effect=ReachError("TIMEOUT", "Site timed out")))
+ monkeypatch.setattr(flow, "prepare", lambda *a, **k: {"ok": True})
+ out = flow.execute("linkedin", "jobs", {"query": "Data"})
+ assert out["error"]["code"] == "TIMEOUT"
+ assert "required_action" not in out and "operation_id" not in out
+
+
+def test_actual_site_login_wall_is_resumable_only_after_public_attempt(monkeypatch, public_search):
+ public_search.return_value = []
+ calls = []
+ def prepare(*args, **kwargs):
+ calls.append("prepare")
+ assert public_search.call_count == 1
+ return {"ok": True}
+ monkeypatch.setattr(flow, "prepare", prepare)
+ monkeypatch.setattr(LinkedInChannel, "_jobs", Mock(side_effect=ReachError("NEED_LOGIN", "Site requires login")))
+ out = flow.execute("linkedin", "jobs", {"query": "Data"})
+ assert calls == ["prepare"] and out["required_action"]["type"] == "login"
+ assert state.load()["pending"][out["operation_id"]]["params"]["query"] == "Data"
+
+
+def test_public_read_accepts_full_text_beside_a_login_link(monkeypatch):
+ monkeypatch.setattr(WebChannel, "_jina_read", lambda self, **k: [make_item(title="Data Engineer", url=URL,
+ text="Sign in to apply\n" + TEXT)])
+ monkeypatch.setattr(LinkedInChannel, "_read", Mock(side_effect=AssertionError("unnecessary browser read")))
+ out = run_action(LinkedInChannel(), "read", {"target": URL})
+ assert out["ok"] and TEXT in out["items"][0]["text"]
+ assert out["meta"]["access"]["scope"] == "page_text"
+
+
+def test_short_public_post_beside_login_link_is_still_usable(monkeypatch):
+ text = "Build SQL pipelines. Python required.\n[Sign in to apply](https://www.linkedin.com/login)"
+ monkeypatch.setattr(WebChannel, "_jina_read", lambda self, **k: [make_item(title="Data Engineer", url=URL, text=text)])
+ monkeypatch.setattr(LinkedInChannel, "_read", Mock(side_effect=AssertionError("unnecessary login path")))
+ out = run_action(LinkedInChannel(), "read", {"target": URL})
+ assert out["ok"] and out["backend"] == "public-web"
+
+
+def test_cold_preparation_does_not_consume_the_site_query_deadline(monkeypatch):
+ import time
+ monkeypatch.setattr(LinkedInChannel, "_jobs", Mock(return_value=[make_item(url=URL)]))
+ out = run_action(LinkedInChannel(), "jobs", {"query": "Data"}, only_backend="opencli",
+ timeout=0.1, before_backends=lambda: time.sleep(0.2))
+ assert out["ok"]
+
+
[email protected]("title,text", [("LinkedIn", ""), ("Sign in | LinkedIn", TEXT),
+ ("LinkedIn", "Please sign in to continue. " * 8),
+ ("Just a moment", TEXT)])
+def test_shells_and_login_pages_are_not_successful_read_results(monkeypatch, title, text):
+ monkeypatch.setattr(WebChannel, "_jina_read", lambda self, **k: [make_item(title=title, url=URL, text=text)])
+ monkeypatch.setattr(LinkedInChannel, "_read", Mock(side_effect=ReachError("NEED_LOGIN", "Site login required")))
+ out = run_action(LinkedInChannel(), "read", {"target": URL})
+ assert not out["ok"] and out["error"]["code"] == "NEED_LOGIN"
+ assert any(a["result"] == "INSUFFICIENT_CONTENT" for a in out["meta"]["attempts"])
+
+
+def test_confirmed_destination_cooldown_blocks_every_path(public_search):
+ state.mutate(lambda saved: saved.setdefault("cooldowns", {}).__setitem__("linkedin", {
+ "code": "RATE_LIMITED", "at": state.now()}))
+ out = run_action(LinkedInChannel(), "jobs", {"query": "Data"})
+ assert out["error"]["code"] == "RATE_LIMITED"
+ public_search.assert_not_called()
+
+
+def test_public_only_cli_does_not_fall_back_to_browser(monkeypatch, public_search, capsys):
+ public_search.return_value = []
+ monkeypatch.setattr(LinkedInChannel, "_jobs", Mock(side_effect=AssertionError("public-only fell back")))
+ assert cli.main(["linkedin", "jobs", "Data", "--backend", "public-web"]) == 1
+ out = json.loads(capsys.readouterr().out)
+ assert out["error"]["code"] == "UPSTREAM_BROKEN" and out["backend"] is None
+
+
+def test_read_url_uses_the_same_public_first_route(monkeypatch, capsys):
+ monkeypatch.setattr(WebChannel, "_jina_read", lambda self, **k: [make_item(title="Data Engineer", url=URL, text=TEXT)])
+ assert cli.main(["read", URL]) == 0
+ out = json.loads(capsys.readouterr().out)
+ assert out["channel"] == "linkedin" and out["backend"] == "public-web"
+
+
+def test_new_policy_leaves_comments_subtitles_and_user_search_semantics_unchanged():
+ from agent_reach.channels import get_all_channels
+ for ch in get_all_channels():
+ for action in ch.actions:
+ if action.name not in {"search", "jobs", "read"} or ch.name == "instagram":
+ assert not action.public_web, (ch.name, action.name)
+
+
+def test_resume_verifies_the_pending_site_path_instead_of_hiding_it_with_index_hits(monkeypatch, public_search):
+ public_search.return_value = []
+ monkeypatch.setattr(flow, "prepare", lambda *a, **k: {"ok": True})
+ site = Mock(side_effect=ReachError("NEED_LOGIN", "Login required"))
+ monkeypatch.setattr(LinkedInChannel, "_jobs", site)
+ waiting = flow.execute("linkedin", "jobs", {"query": "Data"})
+ public_search.return_value = [make_item(url=URL)]
+ site.side_effect = None
+ site.return_value = [make_item(url=URL, title="Verified site job")]
+ state.mutate(lambda saved: saved.get("request_starts", {}).pop("linkedin", None))
+ resumed = flow.resume(waiting["operation_id"])
+ assert resumed["backend"] == "opencli" and site.call_count == 2
+ assert public_search.call_count == 1 and not state.load()["pending"]
+
+
+def test_execute_backend_option_can_request_public_only(monkeypatch, public_search, capsys):
+ monkeypatch.setattr(flow, "prepare", Mock(side_effect=AssertionError("unexpected setup")))
+ assert cli.main(["execute", "linkedin", "jobs", "--params", '{"query":"Data"}',
+ "--backend", "public-web"]) == 0
+ assert json.loads(capsys.readouterr().out)["backend"] == "public-web"
+
+
+def test_invalid_backend_is_rejected_before_setup(monkeypatch, public_search):
+ monkeypatch.setattr(flow, "prepare", Mock(side_effect=AssertionError("unexpected setup")))
+ out = flow.execute("linkedin", "jobs", {"query": "Data"}, backend="unknown")
+ assert out["error"]["code"] == "BAD_INPUT"
+ public_search.assert_not_called()
+
+
[email protected]("target", ["https://cn.linkedin.com/jobs/view/data-engineer-4459518450",
+ "https://www.linkedin.com/jobs/view/4459518450/",
+ "https://linkedin.com/jobs/view/4459518450?tracking=public"])
+def test_linkedin_public_urls_are_normalized_for_unmodified_upstream(target, monkeypatch):
+ site = Mock(return_value=[make_item(title="JD", text=TEXT)])
+ monkeypatch.setattr(LinkedInChannel, "_opencli", site)
+ out = run_action(LinkedInChannel(), "read", {"target": target}, only_backend="opencli")
+ assert out["ok"]
+ assert site.call_args.args[0] == ["job-detail", "https://www.linkedin.com/jobs/view/4459518450"]
+
+
[email protected]("target", ["https://linkedin.com.evil.test/jobs/view/123",
+ "https://[email protected]/jobs/view/123",
+ "https://www.linkedin.com/in/person"])
+def test_invalid_job_links_fail_before_public_or_browser_access(target, monkeypatch):
+ request = Mock(side_effect=AssertionError("invalid link triggered request"))
+ monkeypatch.setattr(WebChannel, "_jina_read", request)
+ monkeypatch.setattr(LinkedInChannel, "_opencli", request)
+ out = run_action(LinkedInChannel(), "read", {"target": target})
+ assert out["error"]["code"] == "BAD_INPUT"
+ request.assert_not_called()
diff --git a/tests/test_reach_flow.py b/tests/test_reach_flow.py
index efbb405a..30bc3d9d 100644
--- a/tests/test_reach_flow.py
+++ b/tests/test_reach_flow.py
@@ -9,7 +9,10 @@ from agent_reach.runtime.result import ReachError, envelope
def test_execute_prepares_and_runs_the_actual_query_once(monkeypatch):
prepare = Mock(return_value={"ok": True, "backend": "opencli"})
- run = Mock(return_value=envelope(channel="xiaohongshu", action="search", backend="opencli", items=[{"title": "note"}]))
+ def execute(*args, **kwargs):
+ kwargs["before_backends"]()
+ return envelope(channel="xiaohongshu", action="search", backend="opencli", items=[{"title": "note"}])
+ run = Mock(side_effect=execute)
monkeypatch.setattr(flow, "prepare", prepare)
monkeypatch.setattr(flow, "run_action", run)
out = flow.execute("xiaohongshu", "search", {"query": "VLA"})
@@ -40,6 +43,20 @@ def test_unknown_resume_is_explicit_bad_input():
flow.resume("missing")
[email protected]("action,params", [("quote", {"symbol": "00700"}), ("search", {"query": "腾讯"})])
+def test_native_public_execute_never_prepares_a_browser_channel(monkeypatch, action, params):
+ from agent_reach.channels.xueqiu import XueqiuChannel
+ from agent_reach.runtime import browser, manage, tools
+ monkeypatch.setattr(manage, "is_added", lambda *a: False)
+ monkeypatch.setattr(manage, "add", lambda *a, **k: pytest.fail("public action added browser dependencies"))
+ monkeypatch.setattr(browser, "ensure_running", lambda *a, **k: pytest.fail("public action opened browser"))
+ monkeypatch.setattr(tools, "ensure", lambda *a, **k: pytest.fail("public quote installed a tool"))
+ method = "_tencent_quote" if action == "quote" else "_tencent_search"
+ monkeypatch.setattr(XueqiuChannel, method, lambda *a, **k: [{"title": "Tencent"}])
+ result = flow.execute("xueqiu", action, params)
+ assert result["ok"] and result["backend"] == "tencent"
+
+
def test_prepare_reuses_only_the_shared_dedicated_browser(monkeypatch):
from agent_reach.runtime import browser, manage, tools
monkeypatch.setattr(manage, "is_added", lambda *a: True)
diff --git a/tests/test_reddit_channel.py b/tests/test_reddit_channel.py
index 0859840b..c5d887c6 100644
--- a/tests/test_reddit_channel.py
+++ b/tests/test_reddit_channel.py
@@ -55,7 +55,7 @@ def test_bare_403_is_not_classified_as_login():
assert _opencli_error("HTTP 403 Forbidden", "").code != "NEED_LOGIN"
[email protected]("backend,expected", [(None, "web"), ("jina", "web"), ("opencli", "reddit")])
[email protected]("backend,expected", [(None, "reddit"), ("jina", "web"), ("opencli", "reddit")])
def test_read_url_defaults_to_public_web_and_preserves_explicit_browser(monkeypatch, capsys, backend, expected):
import json
diff --git a/tests/test_release_policy.py b/tests/test_release_policy.py
index 8f5afc29..1472b86f 100644
--- a/tests/test_release_policy.py
+++ b/tests/test_release_policy.py
@@ -134,7 +134,7 @@ def test_release_gate_rejects_doctor_stale_and_wrong_source():
from scripts.check_release_acceptance import validate
row = {"channel": "web", "action": "search", "passed": True, "item_count": 1,
"backend": "exa", "os": "macOS", "at": state.now(), "method": "doctor", "source_sha256": "source"}
- data = {"source_sha256": "source", "results": [row]}
+ data = {"source_sha256": "source", "release_ready": True, "results": [row]}
assert validate(data, {("web", "search")}, "source")
row["method"] = "real-cli"
assert not validate(data, {("web", "search")}, "source")
@@ -144,6 +144,46 @@ def test_release_gate_rejects_doctor_stale_and_wrong_source():
assert validate(data, {("web", "search")}, "source")
+def test_gate_cannot_ignore_release_flag_pending_validation_or_invalid_time():
+ from scripts.check_release_acceptance import validate
+ row = {"channel": "web", "action": "search", "passed": True, "item_count": 1,
+ "backend": "exa", "os": "macOS", "at": state.now(), "method": "real-cli", "source_sha256": "s"}
+ data = {"source_sha256": "s", "release_ready": True, "results": [row]}
+ required = {("web", "search")}
+ assert not validate(data, required, "s")
+ assert validate({**data, "release_ready": False}, required, "s")
+ assert validate({**data, "additional_required_validation": ["Windows"]}, required, "s")
+ assert validate({**data, "pending": ["web/read"]}, required, "s")
+ assert validate({**data, "results": [{**row, "at": None}]}, required, "s")
+ assert validate({**data, "results": [{**row, "item_count": True}]}, required, "s")
+
+
+def test_install_and_uninstall_preserve_preexisting_unrecorded_cache(monkeypatch):
+ cache = state.root() / "cache"
+ cache.mkdir(parents=True)
+ note = cache / "my-notes.txt"
+ note.write_text("keep")
+ tools.install_env()
+ assert not state.owned_path(cache)
+ assert state.owned_path(cache / "downloads")
+ monkeypatch.setattr(manage, "linked_agents", lambda: {})
+ manage.uninstall()
+ assert note.read_text() == "keep"
+ assert not (cache / "downloads").exists()
+
+
+def test_temporary_work_is_private_recorded_and_removed_on_failure():
+ from pathlib import Path
+ from agent_reach.utils.paths import private_temporary_directory
+ with pytest.raises(RuntimeError, match="work failed"):
+ with private_temporary_directory("test-") as tmp:
+ path = Path(tmp)
+ assert path.parent == state.root() and state.owned_path(path)
+ (path / "audio").write_bytes(b"private")
+ raise RuntimeError("work failed")
+ assert not path.exists() and not state.owned_path(path)
+
+
def test_existing_incompatible_bridge_is_never_restarted(monkeypatch):
monkeypatch.setattr(bridge, "launch_spec", lambda: (["node", "daemon.js"], "1.8.7"))
monkeypatch.setattr(bridge, "status", lambda: {"ok": True, "daemonVersion": "2.0.1", "pid": 123})
diff --git a/tests/test_transcribe.py b/tests/test_transcribe.py
index 56ac77b6..1996c46b 100644
--- a/tests/test_transcribe.py
+++ b/tests/test_transcribe.py
@@ -534,22 +534,11 @@ class TestOrchestrator:
fake_config.set("groq_api_key", "gsk_test")
created_work_dirs = []
- class FakeTemporaryDirectory:
- def __init__(self, prefix=None):
- self.path = tmp_path / "auto-work"
-
- def __enter__(self):
- self.path.mkdir()
- created_work_dirs.append(self.path)
- return str(self.path)
-
- def __exit__(self, *_):
- for child in self.path.iterdir():
- child.unlink()
- self.path.rmdir()
-
def fake_download(source, out_dir):
- assert Path(out_dir) == tmp_path / "auto-work"
+ from agent_reach.runtime import state
+ assert Path(out_dir).parent == state.root()
+ assert state.owned_path(Path(out_dir))
+ created_work_dirs.append(Path(out_dir))
audio = Path(out_dir) / "source.m4a"
audio.write_bytes(b"audio")
return audio
@@ -559,7 +548,6 @@ class TestOrchestrator:
compressed.write_bytes(b"x" * 1024)
return compressed
- monkeypatch.setattr(tr.tempfile, "TemporaryDirectory", FakeTemporaryDirectory)
monkeypatch.setattr(tr, "download_audio", fake_download)
monkeypatch.setattr(tr, "compress_audio", fake_compress)
monkeypatch.setattr(
diff --git a/tests/test_web_channel.py b/tests/test_web_channel.py
index d3472669..e5553fe9 100644
--- a/tests/test_web_channel.py
+++ b/tests/test_web_channel.py
@@ -8,6 +8,7 @@ URL before handing it to Jina Reader. Follow-up to #331 / #360 / #361,
completing dedicated coverage for the channels that still lacked it.
"""
+import http.client
import json
from unittest.mock import MagicMock, patch
@@ -28,6 +29,33 @@ def test_search_does_not_turn_unrecognized_payload_into_empty_success():
WebChannel()._exa_search(query="python", limit=3, timeout=5)
+def test_exa_retries_a_truncated_read_once_within_the_same_budget():
+ from agent_reach.channels.web import _exa_call
+ body = json.dumps({"result": {"content": [{"type": "text", "text": "Content"}]}}).encode()
+ with patch("agent_reach.channels.web.http_request", side_effect=[http.client.IncompleteRead(b""), body]) as request:
+ assert _exa_call("web_fetch_exa", {"urls": ["https://example.com"]}, 5) == "Content"
+ assert request.call_count == 2
+ assert 0 < request.call_args_list[1].kwargs["timeout"] <= request.call_args_list[0].kwargs["timeout"] <= 5
+
+
+def test_exa_never_loops_after_two_truncated_reads():
+ from agent_reach.channels.web import _exa_call
+ with patch("agent_reach.channels.web.http_request", side_effect=http.client.IncompleteRead(b"")) as request:
+ with pytest.raises(http.client.IncompleteRead):
+ _exa_call("web_fetch_exa", {"urls": ["https://example.com"]}, 5)
+ assert request.call_count == 2
+
+
+def test_exa_does_not_retry_http_limits_or_access_denials():
+ import urllib.error
+ from agent_reach.channels.web import _exa_call
+ for code in (429, 403):
+ with patch("agent_reach.channels.web.http_request", side_effect=urllib.error.HTTPError("https://mcp.exa.ai/mcp", code, "denied", {}, None)) as request:
+ with pytest.raises(urllib.error.HTTPError):
+ _exa_call("web_fetch_exa", {"urls": ["https://example.com"]}, 5)
+ request.assert_called_once()
+
+
@pytest.mark.parametrize(
"message",
[