argo-search 2.13.0 → 2.14.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 +93 -0
- package/README.en.md +16 -4
- package/README.es.md +16 -4
- package/README.ja.md +16 -4
- package/README.ko.md +16 -4
- package/README.md +16 -4
- package/SKILL.md +1 -1
- package/assets/readme/counts.json +1 -1
- package/backends/domain_profiles.json +66 -6
- package/backends/engine_registry.yaml +154 -15
- package/backends/env_passthrough.txt +2 -0
- package/backends/quota_profiles.json +111 -11
- package/bin/argo +3 -0
- package/config.yaml +27 -1
- package/docs/CHANGELOG.md +23 -0
- package/docs/COMMIT_STANDARD.md +98 -0
- package/docs/ENGINE_CATALOG.md +94 -79
- package/docs/RELEASE_NOTES_v2.14.0.md +77 -0
- package/engines/specs/clinicaltrials.yaml +8 -0
- package/engines/specs/cnii.yaml +5 -0
- package/engines/specs/coingecko.yaml +10 -2
- package/engines/specs/dbpedia.yaml +32 -0
- package/engines/specs/fourget.yaml +23 -0
- package/engines/specs/grep_app.yaml +19 -0
- package/engines/specs/hackernews.yaml +1 -0
- package/engines/specs/hf_papers.yaml +26 -0
- package/engines/specs/kaggle.yaml +44 -0
- package/engines/specs/local_baidu.yaml +5 -0
- package/engines/specs/local_seek.yaml +34 -0
- package/engines/specs/local_yandex.yaml +37 -0
- package/engines/specs/mojeek.yaml +31 -0
- package/engines/specs/mwmbl.yaml +39 -0
- package/engines/specs/openaire.yaml +34 -0
- package/engines/specs/repology.yaml +18 -0
- package/package.json +13 -10
- package/packages/dsh-plugin/dsh/client.js +1 -0
- package/packages/dsh-plugin/dsh/native-tools.mjs +24 -3
- package/packages/dsh-plugin/dsh/runner.js +35 -1
- package/packages/dsh-plugin/dsh/specs.js +3 -1
- package/packages/dsh-plugin/dsh/wide-research.js +4 -2
- package/packages/dsh-plugin/package.json +1 -1
- package/packages/dsh-plugin/test/client.test.js +6 -0
- package/packages/dsh-plugin/test/config.test.js +5 -1
- package/packages/dsh-plugin/test/index.test.js +3 -1
- package/packages/dsh-plugin/test/size-gate.test.js +2 -2
- package/scripts/badcase_causes.py +81 -0
- package/scripts/badcase_ledger.py +287 -14
- package/scripts/cache.py +3 -3
- package/scripts/check_commit_report.py +168 -0
- package/scripts/engine_admission.py +9 -5
- package/scripts/engine_families.py +13 -2
- package/scripts/engine_policy.py +1 -1
- package/scripts/engine_states.py +393 -8
- package/scripts/engine_status.py +31 -0
- package/scripts/engine_validate.py +47 -39
- package/scripts/engines.py +6 -0
- package/scripts/engines_base.py +26 -80
- package/scripts/engines_builders.py +5 -0
- package/scripts/engines_builders_batch12.py +168 -0
- package/scripts/engines_builders_batch16.py +186 -0
- package/scripts/engines_parsers.py +399 -0
- package/scripts/fetch_browser.py +4 -2
- package/scripts/fetch_jsrun.py +2 -1
- package/scripts/fetch_v3.py +22 -22
- package/scripts/gen_native_tools.py +44 -17
- package/scripts/local_intent.py +139 -0
- package/scripts/local_seek.py +223 -91
- package/scripts/local_seek_adapter.py +87 -0
- package/scripts/mcp_transport.py +1 -1
- package/scripts/pre-commit +44 -1
- package/scripts/recovery.py +14 -5
- package/scripts/recovery_l0.py +5 -3
- package/scripts/research.py +1 -1
- package/scripts/research_gates.py +3 -3
- package/scripts/route_lang.py +6 -1
- package/scripts/route_policy.py +21 -14
- package/scripts/search.py +33 -25
- package/scripts/search_cli.py +10 -1
- package/scripts/search_output.py +83 -16
- package/scripts/source_audit.py +331 -0
- package/scripts/sync_backends.py +31 -1
- package/scripts/wechat_article.py +5 -3
- package/scripts/wide_research.py +4 -1
- package/scripts/x_article_fetch.py +2 -1
- package/sub-skills/local-search/parsers.py +6 -1
- package/sub-skills/local-seek/scripts/seek.py +390 -24
- package/sub-skills/local-seek/scripts/seek_fts.py +20 -9
- package/sub-skills/local-seek/scripts/seek_rank.py +64 -1
- package/engines/specs/cinii.yaml +0 -44
|
@@ -52,24 +52,32 @@ _DB_NAME = "seek-fts.db"
|
|
|
52
52
|
_TTL_S = 120.0 # 索引新鲜度窗口;过期才做增量刷新
|
|
53
53
|
_REFRESH_BUDGET_S = 1.5 # 查询路径上单次刷新的墙钟上界(清单 + 改动文件重读)
|
|
54
54
|
_REBUILD_BUDGET_S = 30.0 # 显式 rebuild 的墙钟上界(大树没建完就再跑一次续做)
|
|
55
|
-
_MAX_BODY_BYTES =
|
|
56
|
-
_MAX_FILE_BYTES =
|
|
57
|
-
# (实测单个 9-33MB、mtime 天天变反复重建),
|
|
58
|
-
# 检索价值低;同样只有 rg 能搜到
|
|
55
|
+
_MAX_BODY_BYTES = 128 * 1024 # 单文件索引正文上限 128KB(瘦身治理:99.5% 源代码与文档均覆盖)
|
|
56
|
+
_MAX_FILE_BYTES = 256 * 1024 # 超过 256KB 坚决不入索引(防大 json、打包代码挤占)
|
|
59
57
|
_MAX_FILES_PER_QUERY = 160 # MATCH 按相关度取前 N 个文件再抽行
|
|
60
58
|
_MAX_LINES_PER_FILE = 200 # 单文件最多贡献的行(防单文件挤占)
|
|
61
59
|
_MAX_LINES_TOTAL = 4000 # 候选行总量上限(喂给池选择前的有界池)
|
|
62
60
|
_BUSY_TIMEOUT_MS = 8000
|
|
63
61
|
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
# 白名单扩展名:仅对源代码、规范与关键文档建索引(奥卡姆剃刀:从源头杜绝大体积数据/日志入库)
|
|
63
|
+
_INDEXABLE_EXTS = frozenset({
|
|
64
|
+
".py", ".ts", ".js", ".jsx", ".tsx", ".rs", ".go", ".c", ".cpp", ".h", ".hpp",
|
|
65
|
+
".java", ".kt", ".swift", ".md", ".markdown", ".mdx", ".yaml", ".yml", ".toml",
|
|
66
|
+
".sh", ".bash", ".zsh", ".sql", ".html", ".css", ".json", ".txt", ".rst"
|
|
67
|
+
})
|
|
68
|
+
_NON_INDEXABLE_EXTS = frozenset({
|
|
69
|
+
".jsonl", ".csv", ".tsv", ".npy", ".npz", ".pkl", ".png", ".jpg",
|
|
70
|
+
".jpeg", ".gif", ".webp", ".pdf", ".zip", ".tar", ".gz", ".db", ".sqlite",
|
|
71
|
+
".sqlite3", ".min.js", ".min.css", ".map", ".bundle.js"
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
# 扩展排除目录:过滤机器输出、会话转写与缓存临时目录
|
|
68
75
|
_SKIP_DIRS = frozenset({
|
|
69
76
|
".git", "node_modules", "__pycache__", ".venv", "venv", ".tox",
|
|
70
77
|
".mypy_cache", ".ruff_cache", ".pytest_cache", ".trash", "dist",
|
|
71
78
|
"build", "target", ".gradle", ".idea", ".vscode", ".mimosa",
|
|
72
|
-
"rollout", "logs", "log", "backups",
|
|
79
|
+
"rollout", "logs", "log", "backups", "tmp", "temp", ".cache",
|
|
80
|
+
"transcript", "brain", "datasets", "data", "site-packages",
|
|
73
81
|
})
|
|
74
82
|
|
|
75
83
|
_TEXT_SNIFF_BYTES = 8192
|
|
@@ -232,6 +240,9 @@ def refresh(root: str, dots: bool = False, budget_s: float | None = None,
|
|
|
232
240
|
continue
|
|
233
241
|
if size == 0 or size > _MAX_FILE_BYTES:
|
|
234
242
|
continue
|
|
243
|
+
ext = os.path.splitext(p)[1].lower()
|
|
244
|
+
if ext in _NON_INDEXABLE_EXTS:
|
|
245
|
+
continue
|
|
235
246
|
path_obj = Path(p)
|
|
236
247
|
if _is_binary(path_obj):
|
|
237
248
|
continue
|
|
@@ -58,6 +58,7 @@ _CJK_ONLY_RE = re.compile("^" + _CJK_RUN + "$")
|
|
|
58
58
|
# BM25 常数(与 local-search/bm25.py 同口径:Okapi k1=1.5 b=0.75)
|
|
59
59
|
_K1 = 1.5
|
|
60
60
|
_DELTA = 1.0 # BM25+ 下界(Lv & Zhai 2011)
|
|
61
|
+
_ACRONYM_BONUS = 3.5 # 驼峰/下划线首字母缩写命中加成(如 hrc 匹配 HedgedRacingCache)
|
|
61
62
|
|
|
62
63
|
# 字段权重与长度归一化强度:文件名命中最值钱(「文件恰好叫这个」是强意图
|
|
63
64
|
# 信号);目录段最弱(scripts/tests 这类段名人人都有,IDF 会自动压它)。
|
|
@@ -225,6 +226,44 @@ def _tokens(text: str, *, camel: bool = False) -> list[str]:
|
|
|
225
226
|
return out
|
|
226
227
|
|
|
227
228
|
|
|
229
|
+
def _term_stem(w: str) -> str:
|
|
230
|
+
"""轻量英文词干归一:剥离常见复数与时态后缀(长度 >= 4 时生效,纯规则零依赖)。"""
|
|
231
|
+
if len(w) < 4 or not w.isascii() or not w.isalpha():
|
|
232
|
+
return w
|
|
233
|
+
if w.endswith("ies") and len(w) >= 5:
|
|
234
|
+
return w[:-3] + "y"
|
|
235
|
+
if w.endswith("es") and len(w) >= 5 and w[-3] in "shxz":
|
|
236
|
+
return w[:-2]
|
|
237
|
+
if w.endswith("s") and not w.endswith("ss") and len(w) >= 4:
|
|
238
|
+
return w[:-1]
|
|
239
|
+
if w.endswith("ing") and len(w) >= 6:
|
|
240
|
+
base = w[:-3]
|
|
241
|
+
if len(base) >= 3 and base[-1] == base[-2]:
|
|
242
|
+
return base[:-1]
|
|
243
|
+
return base
|
|
244
|
+
if w.endswith("ed") and len(w) >= 5:
|
|
245
|
+
base = w[:-2]
|
|
246
|
+
if len(base) >= 3 and base[-1] == base[-2]:
|
|
247
|
+
return base[:-1]
|
|
248
|
+
return base
|
|
249
|
+
return w
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def _acronyms_of(name: str) -> set[str]:
|
|
253
|
+
"""提取文件名/标识符的首字母缩写与内嵌缩写段(如 HedgedRacingCache -> hrc, cache_key_vdom -> ckv, FTS5Index -> fts)。"""
|
|
254
|
+
name_clean = name.rsplit(".", 1)[0]
|
|
255
|
+
runs = _CAMEL_RE.findall(name_clean)
|
|
256
|
+
out = set()
|
|
257
|
+
if len(runs) >= 2:
|
|
258
|
+
acr = "".join(r[0].lower() for r in runs if r and r[0].isalpha())
|
|
259
|
+
if 2 <= len(acr) <= 8:
|
|
260
|
+
out.add(acr)
|
|
261
|
+
for r in runs:
|
|
262
|
+
if r.isupper() and 2 <= len(r) <= 8:
|
|
263
|
+
out.add(r.lower())
|
|
264
|
+
return out
|
|
265
|
+
|
|
266
|
+
|
|
228
267
|
def _row_fields(fp: str, text: str) -> dict[str, Counter]:
|
|
229
268
|
"""一行命中在三字段下的词频表。fp 无目录段时 dir 为空表。"""
|
|
230
269
|
fp = fp.rstrip("/")
|
|
@@ -259,6 +298,15 @@ def rank_rows(rows: list[tuple[str, int, str]], raw_query: str,
|
|
|
259
298
|
if en not in q_eff:
|
|
260
299
|
q_eff[en] = 0.65
|
|
261
300
|
|
|
301
|
+
# 形态词形归一词元(降权 0.55,使 queries 命中 query,caching 命中 cache)
|
|
302
|
+
for qt in list(q_tf):
|
|
303
|
+
stem = _term_stem(qt)
|
|
304
|
+
if stem != qt and stem not in q_eff and len(stem) >= 3:
|
|
305
|
+
q_eff[stem] = 0.55
|
|
306
|
+
|
|
307
|
+
# 查询中的潜在首字母缩写候选(2~8 位纯 ASCII 字母)
|
|
308
|
+
q_acronyms = {qt for qt in q_tf if 2 <= len(qt) <= 8 and qt.isalpha() and qt.isascii()}
|
|
309
|
+
|
|
262
310
|
# 逐字短语表:完整 CJK 连续串 + 较长 ASCII 连续串(行文本做子串检查用)
|
|
263
311
|
phrases = [m.group(0).lower()
|
|
264
312
|
for m in re.finditer(r"[A-Za-z0-9_\-+#.]{3,}|" + _CJK_RUN,
|
|
@@ -324,6 +372,11 @@ def rank_rows(rows: list[tuple[str, int, str]], raw_query: str,
|
|
|
324
372
|
total += w * qtf * (sat + _DELTA) * idf
|
|
325
373
|
fp = rows[i][0]
|
|
326
374
|
total += _TOPIC_PRIOR_WEIGHT * math.log1p(file_hits[fp])
|
|
375
|
+
# 首字母缩写加成(如查询含 hrc 且文件名缩写为 hrc)
|
|
376
|
+
if q_acronyms:
|
|
377
|
+
fname = fp.rsplit("/", 1)[-1]
|
|
378
|
+
if _acronyms_of(fname) & q_acronyms:
|
|
379
|
+
total += _ACRONYM_BONUS
|
|
327
380
|
# 单行三字段协同覆盖度(name ∪ dir ∪ line 覆盖了多少查询词/跨语言映射词)
|
|
328
381
|
row_voc = set(f_tf["name"]) | set(f_tf["dir"]) | set(f_tf["line"])
|
|
329
382
|
covered = sum(1.0 for qt in q_tf if qt in row_voc or any(
|
|
@@ -362,10 +415,20 @@ def rank_rows(rows: list[tuple[str, int, str]], raw_query: str,
|
|
|
362
415
|
pass # 注入的加成失败不拖累打分本体
|
|
363
416
|
scores.append(total)
|
|
364
417
|
|
|
365
|
-
#
|
|
418
|
+
# 邻近行聚簇(Locality Clustering):同文件内行号差 <= 4 的相邻命中构成连续语义块,赋予局部性协同加成
|
|
366
419
|
by_fp: dict[str, list[int]] = {}
|
|
367
420
|
for idx, (fp, _ln, _txt) in enumerate(rows):
|
|
368
421
|
by_fp.setdefault(fp, []).append(idx)
|
|
422
|
+
for idxs in by_fp.values():
|
|
423
|
+
if len(idxs) >= 2:
|
|
424
|
+
line_nums = sorted((rows[idx][1], idx) for idx in idxs if rows[idx][1] > 0)
|
|
425
|
+
for j in range(len(line_nums) - 1):
|
|
426
|
+
if line_nums[j + 1][0] - line_nums[j][0] <= 4:
|
|
427
|
+
idx_a, idx_b = line_nums[j][1], line_nums[j + 1][1]
|
|
428
|
+
scores[idx_a] += 1.5
|
|
429
|
+
scores[idx_b] += 1.5
|
|
430
|
+
|
|
431
|
+
# 同文件多行命中边际递减(第 3 条起温和衰减,防单文件 8 行霸屏 Top-5)
|
|
369
432
|
for idxs in by_fp.values():
|
|
370
433
|
if len(idxs) > 2:
|
|
371
434
|
idxs.sort(key=lambda idx: (-scores[idx], rows[idx][1]))
|
package/engines/specs/cinii.yaml
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# CiNii Research — 日本学术总库(免 key,NII 官方)
|
|
2
|
-
#
|
|
3
|
-
# 补的盲区:**亚洲学术**。argo 的 academic 域此前全是欧美源
|
|
4
|
-
# (arxiv/openalex/crossref/semantic_scholar/dblp/europepmc/biorxiv/
|
|
5
|
-
# openreview/core),日文论文与日本学会刊没有任何直采通道。
|
|
6
|
-
#
|
|
7
|
-
# 实测(2026-09-21):OpenSearch JSON,免 appid 可用;「AI」158741 条命中,
|
|
8
|
-
# 返回 9230B / 2 条。条目含 dc:creator / dc:publisher / prism:publicationDate
|
|
9
|
-
# / description,字段密度与 crossref 同档。
|
|
10
|
-
#
|
|
11
|
-
# 形态:检索式(query 参与检索),与 ndl(日本国会图书馆书目)互补——
|
|
12
|
-
# ndl 查「有什么书」,cinii 查「有什么论文/研究项目」。
|
|
13
|
-
#
|
|
14
|
-
# 验证:
|
|
15
|
-
# python3 scripts/engine_validate.py --engine cinii --stage all --admit
|
|
16
|
-
|
|
17
|
-
engine_id: cinii
|
|
18
|
-
type: http
|
|
19
|
-
enabled: true
|
|
20
|
-
cost_tier: free
|
|
21
|
-
method: GET
|
|
22
|
-
url: https://cir.nii.ac.jp/opensearch/all
|
|
23
|
-
timeout: 15
|
|
24
|
-
query_param: q
|
|
25
|
-
canary_query: "人工知能"
|
|
26
|
-
family: academic
|
|
27
|
-
langs:
|
|
28
|
-
- ja
|
|
29
|
-
coverage: [academic, paper, japan]
|
|
30
|
-
desc: "CiNii Research 日本学术总库(论文/博士论文/科研项目,免 key)"
|
|
31
|
-
recommended: false
|
|
32
|
-
extra_params:
|
|
33
|
-
format: json
|
|
34
|
-
count: "{n}"
|
|
35
|
-
output_map:
|
|
36
|
-
items: items
|
|
37
|
-
item_title: title
|
|
38
|
-
item_url: link.@id
|
|
39
|
-
item_summary: description
|
|
40
|
-
item_published_at: prism:publicationDate
|
|
41
|
-
|
|
42
|
-
quality_queries:
|
|
43
|
-
- query: "人工知能"
|
|
44
|
-
- query: "機械学習"
|