argo-search 2.15.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -1
- package/README.es.md +32 -5
- package/README.ja.md +32 -5
- package/README.ko.md +32 -5
- package/README.md +73 -19
- package/README.zh.md +73 -19
- package/SKILL.md +7 -7
- package/assets/readme/counts.json +1 -1
- package/assets/readme/hero.svg +3 -3
- package/assets/readme/hero.template.svg +121 -0
- package/assets/readme/proof-routes.svg +17 -16
- package/backends/domain_profiles.json +222 -24
- package/backends/engine_registry.yaml +26 -2
- package/backends/env_passthrough.txt +2 -0
- package/backends/quota_profiles.json +23 -3
- package/bin/argo +3 -0
- package/config.yaml +16 -0
- package/docs/CHANGELOG.md +31 -0
- package/docs/COMMIT_STANDARD.md +10 -0
- package/docs/ENGINE_CATALOG.md +40 -37
- package/docs/MCP_SETUP.md +9 -0
- package/docs/RELEASE_NOTES_v2.16.0.md +58 -0
- package/docs/RELEASE_NOTES_v2.17.0.md +64 -0
- package/docs/RELEASING.md +1 -1
- package/engines/specs/archive_org.yaml +1 -1
- package/engines/specs/carbon_intensity.yaml +1 -1
- package/engines/specs/crates.yaml +1 -1
- package/engines/specs/crossref.yaml +6 -2
- package/engines/specs/crt_sh.yaml +1 -1
- package/engines/specs/dblp.yaml +1 -1
- package/engines/specs/devto.yaml +1 -1
- package/engines/specs/docker_hub.yaml +1 -1
- package/engines/specs/europepmc.yaml +1 -1
- package/engines/specs/fxtwitter.yaml +1 -1
- package/engines/specs/gbfs_nyc.yaml +1 -1
- package/engines/specs/gleif.yaml +1 -1
- package/engines/specs/gov_regulations.yaml +1 -1
- package/engines/specs/hackernews.yaml +2 -0
- package/engines/specs/helve.yaml +49 -0
- package/engines/specs/hf_datasets.yaml +1 -1
- package/engines/specs/hf_papers.yaml +2 -0
- package/engines/specs/huggingface.yaml +1 -1
- package/engines/specs/keenable.yaml +7 -1
- package/engines/specs/linux_do.yaml +63 -0
- package/engines/specs/local_crossref.yaml +3 -1
- package/engines/specs/local_github.yaml +1 -1
- package/engines/specs/local_npm.yaml +6 -0
- package/engines/specs/local_openstreetmap.yaml +1 -1
- package/engines/specs/maven.yaml +1 -1
- package/engines/specs/mdn.yaml +1 -1
- package/engines/specs/musicbrainz.yaml +1 -1
- package/engines/specs/nasa_images.yaml +1 -1
- package/engines/specs/nhtsa_vpic.yaml +6 -3
- package/engines/specs/npm.yaml +1 -1
- package/engines/specs/nuget.yaml +1 -1
- package/engines/specs/nvd.yaml +1 -1
- package/engines/specs/openalex.yaml +13 -4
- package/engines/specs/openreview.yaml +1 -1
- package/engines/specs/polymarket.yaml +1 -1
- package/engines/specs/sec_edgar.yaml +1 -1
- package/engines/specs/steam.yaml +1 -1
- package/engines/specs/vam.yaml +1 -1
- package/engines/specs/wikidata.yaml +1 -1
- package/engines/specs/wikipedia.yaml +1 -1
- package/engines/specs/zhihu_hot_app.yaml +1 -1
- package/package.json +3 -1
- package/packages/dsh-plugin/README.md +5 -2
- package/packages/dsh-plugin/cordis.patch.yml +4 -1
- package/packages/dsh-plugin/dsh/client.js +69 -74
- package/packages/dsh-plugin/dsh/diagnostics.js +25 -4
- package/packages/dsh-plugin/dsh/index.js +115 -21
- package/packages/dsh-plugin/dsh/route-guard.js +95 -0
- package/packages/dsh-plugin/dsh/runner.js +50 -7
- package/packages/dsh-plugin/dsh/wide-research.js +20 -18
- package/packages/dsh-plugin/dsh/workbench-client.js +895 -0
- package/packages/dsh-plugin/dsh/workbench-io.js +163 -0
- package/packages/dsh-plugin/dsh/workbench-md.js +386 -0
- package/packages/dsh-plugin/dsh/workbench-search.js +385 -0
- package/packages/dsh-plugin/dsh/workbench-suggestions.js +460 -0
- package/packages/dsh-plugin/dsh/workbench.js +703 -0
- package/packages/dsh-plugin/icon.svg +23 -0
- package/packages/dsh-plugin/package.json +6 -3
- package/packages/dsh-plugin/scripts/sync-local.mjs +4 -2
- package/packages/dsh-plugin/scripts/sync-local.sh +4 -2
- package/packages/dsh-plugin/test/client.test.js +26 -0
- package/packages/dsh-plugin/test/diagnostics.test.js +5 -2
- package/packages/dsh-plugin/test/index.test.js +150 -1
- package/packages/dsh-plugin/test/workbench-concurrency.test.js +98 -0
- package/packages/dsh-plugin/test/workbench.test.js +420 -0
- package/scripts/adaptive.py +13 -11
- package/scripts/argo_paths.py +2 -2
- package/scripts/badcase_ledger.py +9 -0
- package/scripts/browser_auth.py +178 -4
- package/scripts/cache.py +69 -70
- package/scripts/check_commit_report.py +46 -0
- package/scripts/chrome_cdp.py +71 -0
- package/scripts/circuit_breaker.py +91 -13
- package/scripts/config_cache.py +23 -10
- package/scripts/daemon.py +14 -2
- package/scripts/engine_add.py +45 -0
- package/scripts/engine_dispatch.py +32 -49
- package/scripts/engine_env.py +13 -4
- package/scripts/engine_failure.py +33 -0
- package/scripts/engine_fingerprint.py +114 -0
- package/scripts/engine_health.py +130 -0
- package/scripts/engine_states.py +50 -0
- package/scripts/engines_base.py +31 -19
- package/scripts/engines_builders_archive.py +4 -3
- package/scripts/engines_builders_batch11.py +2 -1
- package/scripts/engines_builders_batch13.py +4 -3
- package/scripts/engines_builders_batch14.py +2 -1
- package/scripts/engines_builders_batch15.py +2 -1
- package/scripts/engines_builders_batch9.py +2 -2
- package/scripts/engines_builders_cn.py +7 -7
- package/scripts/engines_builders_data.py +12 -11
- package/scripts/engines_builders_data_macro.py +5 -4
- package/scripts/engines_builders_dsh.py +2 -1
- package/scripts/engines_builders_feeds.py +34 -19
- package/scripts/engines_builders_finance.py +2 -1
- package/scripts/engines_builders_intl.py +3 -2
- package/scripts/engines_builders_media.py +59 -12
- package/scripts/engines_builders_science.py +8 -7
- package/scripts/engines_builders_search.py +19 -8
- package/scripts/engines_builders_skill.py +2 -1
- package/scripts/engines_builders_tech.py +19 -19
- package/scripts/engines_builders_weather.py +9 -4
- package/scripts/engines_fields.py +23 -0
- package/scripts/engines_http.py +50 -1
- package/scripts/engines_mcp.py +28 -6
- package/scripts/evidence_grounding.py +182 -0
- package/scripts/evidence_loop.py +15 -1
- package/scripts/extend_route_labels.py +6 -0
- package/scripts/fetch_browser.py +25 -10
- package/scripts/fetch_jina.py +98 -0
- package/scripts/fetch_v3.py +52 -93
- package/scripts/gate_manifest_check.py +75 -0
- package/scripts/gen_readme_art.py +264 -0
- package/scripts/image_vision/vision_probe +0 -0
- package/scripts/install.sh +2 -0
- package/scripts/matrix_search_eval.py +8 -10
- package/scripts/mcp_transport.py +33 -9
- package/scripts/numeric_verify.py +12 -2
- package/scripts/output_transparency.py +3 -0
- package/scripts/pre-commit +57 -8
- package/scripts/query_operators.py +229 -1
- package/scripts/quota.py +46 -63
- package/scripts/recovery.py +19 -16
- package/scripts/recovery_runner.py +29 -10
- package/scripts/redskill/redskill_engine.py +2 -1
- package/scripts/release.py +16 -1
- package/scripts/research_gates.py +85 -1
- package/scripts/route.py +8 -0
- package/scripts/route_combo.py +24 -3
- package/scripts/route_policy.py +1 -1
- package/scripts/search_attribution.py +20 -0
- package/scripts/search_entry.py +27 -0
- package/scripts/search_output.py +18 -7
- package/scripts/search_pipeline.py +3 -3
- package/scripts/semantic_evidence.py +20 -11
- package/scripts/serp_guard.py +13 -1
- package/scripts/settings_page.py +1 -0
- package/scripts/single_flight.py +1 -1
- package/scripts/social_engines/hackernews_engine.py +2 -1
- package/scripts/social_engines/reddit_engine.py +2 -1
- package/scripts/social_engines/zhihu_engine.py +2 -1
- package/scripts/source_audit.py +42 -7
- package/scripts/source_discovery.py +611 -0
- package/scripts/sync_backends.py +45 -0
- package/scripts/usage_log.py +24 -9
- package/scripts/watch.py +3 -3
- package/scripts/zhihu_quota.py +2 -1
- package/sub-skills/argo-wide-research/SKILL.md +7 -5
- package/sub-skills/ego-search/{SKILL.md → README.md} +24 -47
- package/sub-skills/ego-search/scripts/ego_search.py +195 -19
- package/sub-skills/ego-search/scripts/pacing.py +291 -0
- package/sub-skills/ego-search/scripts/quality.py +262 -6
- package/sub-skills/ego-search/scripts/runtime.py +7 -1
- package/sub-skills/ego-search/scripts/site_profiles.py +157 -0
- package/sub-skills/ego-search/scripts/webbridge_adapter.py +7 -1
- package/sub-skills/js-run/{SKILL.md → README.md} +3 -20
- package/sub-skills/local-search/{SKILL.md → README.md} +3 -8
- package/sub-skills/local-search/engine_registry.py +32 -7
- package/sub-skills/local-seek/SKILL.md +20 -22
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""围墙花园站点画像:只读登录 Cookie 探针 + 声明式同源搜索 API 预设。
|
|
4
|
+
|
|
5
|
+
设计原则(唯一真源):
|
|
6
|
+
1. auth_probe 只声明「登录态标识 Cookie 名称」,绝不读取、打印或持久化 Cookie 值;
|
|
7
|
+
在页面返回 200 推荐壳子时,依靠关键 Cookie 缺失将模糊异常精准翻转为 auth_failed
|
|
8
|
+
+ handoff_required。
|
|
9
|
+
2. inpage_api 预设让高频围墙站通过 `ego-search api --preset <site> --query <q>`
|
|
10
|
+
在真实浏览器上下文直取结构化 JSON,替代脆弱的 DOM 解析与人工拼 URL。
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import urllib.parse
|
|
15
|
+
from dataclasses import dataclass
|
|
16
|
+
from typing import Any
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass(frozen=True)
|
|
20
|
+
class SiteProfile:
|
|
21
|
+
name: str
|
|
22
|
+
domains: tuple[str, ...]
|
|
23
|
+
login_url: str
|
|
24
|
+
cookie_names: tuple[str, ...]
|
|
25
|
+
api_origin: str = ""
|
|
26
|
+
api_url_template: str = ""
|
|
27
|
+
api_default_n: int = 10
|
|
28
|
+
# L0:免登录公开检索范围(供未开 pro-mode 或触发限权/冷却时降级提示)
|
|
29
|
+
public_web_scopes: tuple[str, ...] = ()
|
|
30
|
+
# L1:静默限权(Shadow Restriction)二次懒探针端点与特征码
|
|
31
|
+
health_probe_url: str = ""
|
|
32
|
+
restricted_codes: tuple[int, ...] = ()
|
|
33
|
+
restricted_keywords: tuple[str, ...] = ()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
SITE_PROFILES: dict[str, SiteProfile] = {
|
|
37
|
+
"zhihu": SiteProfile(
|
|
38
|
+
name="zhihu",
|
|
39
|
+
domains=("zhihu.com",),
|
|
40
|
+
login_url="https://www.zhihu.com/signin",
|
|
41
|
+
cookie_names=("z_c0",),
|
|
42
|
+
api_origin="https://www.zhihu.com",
|
|
43
|
+
api_url_template="https://www.zhihu.com/api/v4/search_v3?t=general&q={q}&offset=0&limit={n}",
|
|
44
|
+
public_web_scopes=("zhihu.com/question", "zhuanlan.zhihu.com/p"),
|
|
45
|
+
health_probe_url="https://www.zhihu.com/api/v4/me",
|
|
46
|
+
restricted_codes=(40352, 40362),
|
|
47
|
+
restricted_keywords=("账号异常", "安全验证", "请完成验证"),
|
|
48
|
+
),
|
|
49
|
+
"xiaohongshu": SiteProfile(
|
|
50
|
+
name="xiaohongshu",
|
|
51
|
+
domains=("xiaohongshu.com", "xhslink.com"),
|
|
52
|
+
login_url="https://www.xiaohongshu.com/explore",
|
|
53
|
+
cookie_names=("web_session", "a1"),
|
|
54
|
+
api_origin="https://www.xiaohongshu.com",
|
|
55
|
+
api_url_template="https://www.xiaohongshu.com/search_result?keyword={q}&source=web_search_result_notes",
|
|
56
|
+
public_web_scopes=("xiaohongshu.com/explore", "xiaohongshu.com/discovery/item"),
|
|
57
|
+
health_probe_url="https://edith.xiaohongshu.com/api/sns/web/v2/user/me",
|
|
58
|
+
restricted_codes=(300011, 300012, -100),
|
|
59
|
+
restricted_keywords=("当前账号存在异常", "请切换账号", "账号异常", "安全限制"),
|
|
60
|
+
),
|
|
61
|
+
"x": SiteProfile(
|
|
62
|
+
name="x",
|
|
63
|
+
domains=("x.com", "twitter.com"),
|
|
64
|
+
login_url="https://x.com/i/flow/login",
|
|
65
|
+
cookie_names=("auth_token", "ct0"),
|
|
66
|
+
public_web_scopes=("x.com", "twitter.com"),
|
|
67
|
+
restricted_codes=(326, 64),
|
|
68
|
+
restricted_keywords=("account is temporarily locked", "suspended", "unusual activity"),
|
|
69
|
+
),
|
|
70
|
+
"xueqiu": SiteProfile(
|
|
71
|
+
name="xueqiu",
|
|
72
|
+
domains=("xueqiu.com",),
|
|
73
|
+
login_url="https://xueqiu.com/",
|
|
74
|
+
cookie_names=("xq_a_token", "u"),
|
|
75
|
+
api_origin="https://xueqiu.com",
|
|
76
|
+
api_url_template="https://xueqiu.com/query/v1/symbol/search/status.json?q={q}&count={n}&page=1",
|
|
77
|
+
public_web_scopes=("xueqiu.com",),
|
|
78
|
+
health_probe_url="https://xueqiu.com/account/status.json",
|
|
79
|
+
restricted_codes=(400016, 400018),
|
|
80
|
+
restricted_keywords=("访问过于频繁", "账号异常"),
|
|
81
|
+
),
|
|
82
|
+
"weibo": SiteProfile(
|
|
83
|
+
name="weibo",
|
|
84
|
+
domains=("weibo.com", "s.weibo.com"),
|
|
85
|
+
login_url="https://weibo.com/login.php",
|
|
86
|
+
cookie_names=("SUB", "SUBP"),
|
|
87
|
+
api_origin="https://weibo.com",
|
|
88
|
+
api_url_template="https://weibo.com/ajax/side/search?q={q}",
|
|
89
|
+
public_web_scopes=("weibo.com", "s.weibo.com"),
|
|
90
|
+
health_probe_url="https://weibo.com/ajax/profile/info",
|
|
91
|
+
restricted_codes=(100003, 20003),
|
|
92
|
+
restricted_keywords=("账号异常", "访问频次过高"),
|
|
93
|
+
),
|
|
94
|
+
"bilibili": SiteProfile(
|
|
95
|
+
name="bilibili",
|
|
96
|
+
domains=("bilibili.com",),
|
|
97
|
+
login_url="https://passport.bilibili.com/login",
|
|
98
|
+
cookie_names=("SESSDATA", "bili_jct"),
|
|
99
|
+
api_origin="https://www.bilibili.com",
|
|
100
|
+
api_url_template="https://api.bilibili.com/x/web-interface/search/all/v2?keyword={q}&page_size={n}",
|
|
101
|
+
public_web_scopes=("bilibili.com/video", "bilibili.com/read"),
|
|
102
|
+
health_probe_url="https://api.bilibili.com/x/web-interface/nav",
|
|
103
|
+
restricted_codes=(-101, -352, -412),
|
|
104
|
+
restricted_keywords=("风控", "请求被拦截", "未登录"),
|
|
105
|
+
),
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
_ALIASES: dict[str, str] = {
|
|
109
|
+
"twitter": "x",
|
|
110
|
+
"xhs": "xiaohongshu",
|
|
111
|
+
"bili": "bilibili",
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def get_profile(name: str) -> SiteProfile | None:
|
|
116
|
+
key = (name or "").strip().lower()
|
|
117
|
+
key = _ALIASES.get(key, key)
|
|
118
|
+
return SITE_PROFILES.get(key)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def match_site(url_or_host: str) -> SiteProfile | None:
|
|
122
|
+
"""根据完整 URL 或主机名匹配站点画像。"""
|
|
123
|
+
raw = (url_or_host or "").strip().lower()
|
|
124
|
+
if not raw:
|
|
125
|
+
return None
|
|
126
|
+
host = urllib.parse.urlparse(raw).hostname if "://" in raw else raw.split("/", 1)[0]
|
|
127
|
+
host = (host or "").strip(".").lower()
|
|
128
|
+
if not host:
|
|
129
|
+
return None
|
|
130
|
+
for profile in SITE_PROFILES.values():
|
|
131
|
+
for dom in profile.domains:
|
|
132
|
+
if host == dom or host.endswith("." + dom):
|
|
133
|
+
return profile
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def resolve_preset_api(preset: str, query: str, *, n: int = 10) -> dict[str, Any]:
|
|
138
|
+
"""把站点预设 + 查询词展开为同源 API URL 与 origin。"""
|
|
139
|
+
profile = get_profile(preset)
|
|
140
|
+
if profile is None:
|
|
141
|
+
valid = ", ".join(sorted(k for k, v in SITE_PROFILES.items() if v.api_url_template))
|
|
142
|
+
raise ValueError(f"未知站点预设 {preset!r};支持:{valid}")
|
|
143
|
+
if not profile.api_url_template or not profile.api_origin:
|
|
144
|
+
raise ValueError(f"站点 {profile.name} 暂无声明式同源 API 模板,请直接传入 api_url")
|
|
145
|
+
q_enc = urllib.parse.quote(query.strip())
|
|
146
|
+
limit = max(1, min(int(n), 50))
|
|
147
|
+
return {
|
|
148
|
+
"site": profile.name,
|
|
149
|
+
"origin": profile.api_origin,
|
|
150
|
+
"api_url": profile.api_url_template.format(q=q_enc, n=limit),
|
|
151
|
+
"login_url": profile.login_url,
|
|
152
|
+
"cookie_names": list(profile.cookie_names),
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def list_api_presets() -> list[str]:
|
|
157
|
+
return sorted(k for k, v in SITE_PROFILES.items() if v.api_url_template)
|
|
@@ -18,6 +18,12 @@ from datetime import datetime, timedelta
|
|
|
18
18
|
from pathlib import Path
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
+
try:
|
|
22
|
+
from net_proxy import open_url as _open_url
|
|
23
|
+
except ImportError:
|
|
24
|
+
# scripts/ 不在路径(独立打包形态)时回退裸 urlopen,行为与改动前一致
|
|
25
|
+
_open_url = urllib.request.urlopen # type: ignore[assignment]
|
|
26
|
+
|
|
21
27
|
# 同目录 safety
|
|
22
28
|
_SCRIPT_DIR = Path(__file__).resolve().parent
|
|
23
29
|
# argo 核心 scripts(全文存档等公共能力);与本目录其他模块同一解析方式
|
|
@@ -135,7 +141,7 @@ def _command(action: str, args: dict | None, session: str, timeout: int = DEFAUL
|
|
|
135
141
|
method="POST",
|
|
136
142
|
)
|
|
137
143
|
try:
|
|
138
|
-
with
|
|
144
|
+
with _open_url(req, timeout=timeout) as resp:
|
|
139
145
|
raw = resp.read().decode("utf-8", errors="replace")
|
|
140
146
|
except (urllib.error.URLError, TimeoutError, OSError) as e:
|
|
141
147
|
return {"ok": False, "error": f"webbridge_unreachable: {e}"}
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
name: js-run
|
|
3
|
-
description: >-
|
|
4
|
-
js-run 是 argo 的 JS 运行时车道子技能:不开浏览器跑网页 JS。基于 mini-racer(ISC)
|
|
5
|
-
+ 自研浏览器环境垫片,让「环境探测 + 纯计算」型网页脚本(反爬挑战通行证、混淆数据
|
|
6
|
-
解算、JS 内嵌状态提取)在毫秒级、可复现、无真实网络的沙箱里执行。定位是取数链
|
|
7
|
-
curl_cffi 与渲染级之间的「算」车道,不替代浏览器(登录态/视觉/真实网络数据不在此车道)。
|
|
8
|
-
已接入 fetch 降级链第一级 E(scripts/fetch_jsrun.py,ARGO_FETCH_JSRUN 默认开启,=0
|
|
9
|
-
关闭);能力面仍为 v0:只保「探测+计算」型脚本,不碰 DOM/真实网络/登录态/视觉。
|
|
10
|
-
Triggers include 跑网页JS、挑战脚本、通行证、JS解密、
|
|
11
|
-
逻辑时间、无浏览器执行。
|
|
12
|
-
metadata:
|
|
13
|
-
version: "0.1.0"
|
|
14
|
-
date: "2026-10-03"
|
|
15
|
-
parent: argo
|
|
16
|
-
upstream: 原创(底座 py-mini-racer ISC;设计参照 iv8 思路,未使用其代码/二进制)
|
|
17
|
-
license_note: 底座 mini-racer 为 ISC;本目录代码为原创
|
|
18
|
-
---
|
|
1
|
+
# js-run(argo 内部 V8 算车道,v0 骨架)
|
|
19
2
|
|
|
20
|
-
|
|
3
|
+
> argo 的 JS 运行时车道:不开浏览器跑网页 JS(`mini-racer` + 环境垫片),已接入 fetch 降级链第一级 E(`scripts/fetch_jsrun.py`,`ARGO_FETCH_JSRUN` 默认开启)。无独立 Skill 触发入口。
|
|
21
4
|
|
|
22
5
|
**一句话**:给 HTML 与资源,还你 JS 算完的结果——不开浏览器。
|
|
23
6
|
|
|
@@ -64,4 +47,4 @@ python3 tests/test_jsrun.py # 7 项金标测试(含速度门 <100ms,实测
|
|
|
64
47
|
2. **反爬对抗谨慎**:本车道用于已授权/自有场景的通行证计算;对第三方站点的
|
|
65
48
|
挑战绕过默认关闭,启用须单独拍板。
|
|
66
49
|
3. **考卷驱动生长**:环境面只按 tests/fixtures/ 里的真实考卷长,不为想象中的
|
|
67
|
-
|
|
50
|
+
浏览器写代码(考卷即规范)。
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
description: argo 的本地/零成本兜底子技能。封装基于公开页面/HTML/RSS/JSON/CLI 的 30 个本地搜索引擎,不单独响应触发词,仅由 argo 通过 --local-first 调用。
|
|
5
|
-
version: 1.1.0
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Local Search 子技能
|
|
1
|
+
## Local Search 内部模块(非独立 Skill)
|
|
2
|
+
|
|
3
|
+
> argo 的本地零成本兜底子模块。封装基于公开页面/HTML/RSS/JSON/CLI 的 30 个本地搜索引擎,不单独响应触发词,仅由 argo 通过 `--local-first` 调用。
|
|
9
4
|
|
|
10
5
|
Local Search 是 argo 的「零成本兜底适配器」,用于:
|
|
11
6
|
|
|
@@ -112,8 +112,13 @@ class EngineRegistry:
|
|
|
112
112
|
|
|
113
113
|
def _sync_health_path(self) -> None:
|
|
114
114
|
cur = self.health_state_path
|
|
115
|
-
|
|
115
|
+
try:
|
|
116
|
+
cur_mtime = cur.stat().st_mtime
|
|
117
|
+
except OSError:
|
|
118
|
+
cur_mtime = 0.0
|
|
119
|
+
if self._loaded_health_path != cur or getattr(self, "_loaded_health_mtime", 0.0) != cur_mtime:
|
|
116
120
|
self._health = self._load_health()
|
|
121
|
+
self._loaded_health_mtime = cur_mtime
|
|
117
122
|
|
|
118
123
|
def _load(self) -> None:
|
|
119
124
|
"""加载配置、解析映射和健康状态缓存。"""
|
|
@@ -151,22 +156,42 @@ class EngineRegistry:
|
|
|
151
156
|
try:
|
|
152
157
|
hp = self.health_state_path
|
|
153
158
|
self._loaded_health_path = hp
|
|
154
|
-
# 写回前套用与 _load_health 相同的陈旧过滤:内存快照是全量写回的,
|
|
155
|
-
# 不过滤会让 30 天未刷新的条目复活并覆盖他进程新写的条目。
|
|
156
159
|
cutoff = time.time() - _HEALTH_STALE_S
|
|
157
|
-
payload = {k: v for k, v in self._health.items()
|
|
158
|
-
if isinstance(v, dict) and v.get("last_checked", 0) >= cutoff}
|
|
159
160
|
hp.parent.mkdir(parents=True, exist_ok=True)
|
|
161
|
+
|
|
162
|
+
def _merged_payload() -> dict[str, Any]:
|
|
163
|
+
disk: dict[str, Any] = {}
|
|
164
|
+
if hp.exists():
|
|
165
|
+
try:
|
|
166
|
+
raw = json.loads(hp.read_text(encoding="utf-8"))
|
|
167
|
+
if isinstance(raw, dict):
|
|
168
|
+
disk = raw
|
|
169
|
+
except Exception:
|
|
170
|
+
pass
|
|
171
|
+
merged = {k: v for k, v in disk.items()
|
|
172
|
+
if isinstance(v, dict) and v.get("last_checked", 0) >= cutoff}
|
|
173
|
+
for k, v in self._health.items():
|
|
174
|
+
if not isinstance(v, dict) or v.get("last_checked", 0) < cutoff:
|
|
175
|
+
continue
|
|
176
|
+
prev = merged.get(k)
|
|
177
|
+
if not isinstance(prev, dict) or v.get("last_checked", 0) >= prev.get("last_checked", 0):
|
|
178
|
+
merged[k] = v
|
|
179
|
+
return merged
|
|
180
|
+
|
|
160
181
|
try:
|
|
161
182
|
_ensure_root_scripts()
|
|
162
183
|
from argo_paths import atomic_write_json, file_lock
|
|
163
184
|
with file_lock(hp):
|
|
164
|
-
atomic_write_json(hp,
|
|
185
|
+
atomic_write_json(hp, _merged_payload())
|
|
165
186
|
except ImportError:
|
|
166
187
|
tmp = hp.with_name(hp.name + f".{os.getpid()}.tmp")
|
|
167
188
|
with tmp.open("w", encoding="utf-8") as f:
|
|
168
|
-
json.dump(
|
|
189
|
+
json.dump(_merged_payload(), f, ensure_ascii=False, indent=2)
|
|
169
190
|
os.replace(tmp, hp)
|
|
191
|
+
try:
|
|
192
|
+
self._loaded_health_mtime = hp.stat().st_mtime
|
|
193
|
+
except OSError:
|
|
194
|
+
pass
|
|
170
195
|
except Exception as e:
|
|
171
196
|
logger.warning(f"保存健康状态失败: {e}")
|
|
172
197
|
|
|
@@ -23,28 +23,26 @@ description: 本机文件与代码内容搜索(rg/fd/mdfind/grep 统一入口
|
|
|
23
23
|
|
|
24
24
|
## 统一入口
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
由它选工具,不要自己拼 rg/fd 参数:
|
|
26
|
+
统一走全局命令 `argo seek`(任意目录直接可用;若未装 `argo` CLI,改用本技能目录下的 `python3 <skill-dir>/scripts/seek.py`),由它选工具,不要自己拼 rg/fd 参数:
|
|
28
27
|
|
|
29
28
|
```bash
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
python3 sub-skills/local-seek/scripts/seek.py --git-blame 12 文件路径 # 第 12 行的提交归属
|
|
29
|
+
argo seek "查询词" # 默认:当前目录全文
|
|
30
|
+
argo seek "查询词" --path ~/notes # 指定目录
|
|
31
|
+
argo seek "词" --path ~/.agents --dot # 连 . 开头目录与软链一起搜
|
|
32
|
+
argo seek "词" --path . --include-noise # 噪声目录与真源平权
|
|
33
|
+
argo seek "查询词" --count # 先数命中数
|
|
34
|
+
argo seek "查询词" --filename # 按文件名
|
|
35
|
+
argo seek "查询词" --spotlight # 全盘兜底
|
|
36
|
+
argo seek "查询词" --type py,ts
|
|
37
|
+
argo seek "查询词" --json # 结构化输出
|
|
38
|
+
argo seek "查询词" --exact # 精确匹配(关扩展)
|
|
39
|
+
argo seek "符号名" --symbol # 精确符号/词边界匹配
|
|
40
|
+
argo seek "查询词" --exclude 某文件 # 额外排除(可重复)
|
|
41
|
+
argo seek --outline 文件路径 # 文件结构(def/class/标题/顶层key)
|
|
42
|
+
argo seek --lines 10-50 文件路径 # 按行读取,替代 read_file 全文
|
|
43
|
+
argo seek "裸except" --structural # 结构搜索(空catch/裸except/装饰函数等)
|
|
44
|
+
argo seek --git-log 文件路径 # 文件的最近提交历史
|
|
45
|
+
argo seek --git-blame 12 文件路径 # 第 12 行的提交归属
|
|
48
46
|
```
|
|
49
47
|
|
|
50
48
|
内置智能行为(固定字符串回退、中文 2-gram 扩展、PCRE2 检测、结构搜索、
|
|
@@ -95,8 +93,8 @@ references/auto-behaviors.md。
|
|
|
95
93
|
|
|
96
94
|
## 配置
|
|
97
95
|
|
|
98
|
-
|
|
99
|
-
查看当前规则:`
|
|
96
|
+
排除规则与知识域:本技能目录下的 `config/domains.yaml`
|
|
97
|
+
查看当前规则:`argo seek --domains`
|
|
100
98
|
|
|
101
99
|
## 参考
|
|
102
100
|
|