argo-search 2.14.1 → 2.16.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.
Files changed (245) hide show
  1. package/AGENTS.md +8 -6
  2. package/README.es.md +57 -813
  3. package/README.ja.md +56 -814
  4. package/README.ko.md +56 -812
  5. package/README.md +160 -754
  6. package/README.zh.md +152 -872
  7. package/SKILL.md +22 -23
  8. package/assets/readme/counts.json +1 -1
  9. package/assets/readme/hero.svg +23 -23
  10. package/backends/concept_vectors.bin +0 -0
  11. package/backends/domain_profiles.json +149 -6
  12. package/backends/engine_concept_vectors.json +1525 -1525
  13. package/backends/engine_registry.yaml +139 -30
  14. package/backends/quota_profiles.json +83 -3
  15. package/bin/argo +33 -17
  16. package/config.yaml +189 -33
  17. package/docs/ADDING_NEW_ENGINE.md +10 -0
  18. package/docs/ARGO_INTRO.md +1 -1
  19. package/docs/CHANGELOG.md +38 -0
  20. package/docs/ENGINE_CATALOG.md +102 -89
  21. package/docs/MCP_SETUP.md +10 -1
  22. package/docs/RELEASE_NOTES_v2.14.1.md +4 -4
  23. package/docs/RELEASE_NOTES_v2.15.0.md +50 -0
  24. package/docs/RELEASE_NOTES_v2.16.0.md +58 -0
  25. package/docs/RELEASING.md +1 -1
  26. package/engines/specs/ai_labs.yaml +89 -0
  27. package/engines/specs/archive_org.yaml +1 -1
  28. package/engines/specs/bilibili_hot.yaml +11 -1
  29. package/engines/specs/brave.yaml +3 -3
  30. package/engines/specs/carbon_intensity.yaml +1 -1
  31. package/engines/specs/cisa_alerts.yaml +40 -0
  32. package/engines/specs/cn_ai_news.yaml +10 -8
  33. package/engines/specs/crates.yaml +1 -1
  34. package/engines/specs/crossref.yaml +4 -2
  35. package/engines/specs/crt_sh.yaml +1 -1
  36. package/engines/specs/dblp.yaml +1 -1
  37. package/engines/specs/devto.yaml +1 -1
  38. package/engines/specs/digup.yaml +11 -6
  39. package/engines/specs/docker_hub.yaml +1 -1
  40. package/engines/specs/douyin_hot.yaml +11 -1
  41. package/engines/specs/dw_news.yaml +4 -2
  42. package/engines/specs/eng_blogs.yaml +63 -0
  43. package/engines/specs/europeana.yaml +3 -4
  44. package/engines/specs/europepmc.yaml +1 -1
  45. package/engines/specs/felo.yaml +3 -3
  46. package/engines/specs/firecrawl.yaml +3 -0
  47. package/engines/specs/fourget.yaml +5 -2
  48. package/engines/specs/france24.yaml +6 -4
  49. package/engines/specs/fxtwitter.yaml +30 -7
  50. package/engines/specs/gbfs_nyc.yaml +1 -1
  51. package/engines/specs/gleif.yaml +1 -1
  52. package/engines/specs/gov_regulations.yaml +1 -1
  53. package/engines/specs/grepapp_mcp.yaml +62 -0
  54. package/engines/specs/guardian_rss.yaml +6 -4
  55. package/engines/specs/hf_datasets.yaml +1 -1
  56. package/engines/specs/huggingface.yaml +1 -1
  57. package/engines/specs/itotii.yaml +13 -1
  58. package/engines/specs/keenable.yaml +7 -1
  59. package/engines/specs/linux_do.yaml +63 -0
  60. package/engines/specs/lobsters.yaml +41 -0
  61. package/engines/specs/local_crossref.yaml +3 -1
  62. package/engines/specs/local_github.yaml +1 -1
  63. package/engines/specs/local_npm.yaml +6 -0
  64. package/engines/specs/local_openstreetmap.yaml +1 -1
  65. package/engines/specs/local_seek.yaml +6 -0
  66. package/engines/specs/maven.yaml +1 -1
  67. package/engines/specs/mdn.yaml +1 -1
  68. package/engines/specs/musicbrainz.yaml +1 -1
  69. package/engines/specs/nasa_images.yaml +1 -1
  70. package/engines/specs/nhtsa_vpic.yaml +6 -3
  71. package/engines/specs/npm.yaml +1 -1
  72. package/engines/specs/nuget.yaml +1 -1
  73. package/engines/specs/nvd.yaml +1 -1
  74. package/engines/specs/open_meteo.yaml +1 -1
  75. package/engines/specs/openalex.yaml +4 -2
  76. package/engines/specs/openreview.yaml +1 -1
  77. package/engines/specs/polymarket.yaml +1 -1
  78. package/engines/specs/redskill.yaml +2 -0
  79. package/engines/specs/searxng.yaml +4 -2
  80. package/engines/specs/sec_edgar.yaml +9 -4
  81. package/engines/specs/steam.yaml +1 -1
  82. package/engines/specs/tinyfish.yaml +2 -0
  83. package/engines/specs/tinyfish_news.yaml +2 -0
  84. package/engines/specs/tinyfish_paper.yaml +2 -0
  85. package/engines/specs/toutiao_hot.yaml +11 -1
  86. package/engines/specs/train.yaml +3 -0
  87. package/engines/specs/twitter.yaml +4 -0
  88. package/engines/specs/unpaywall.yaml +6 -0
  89. package/engines/specs/vam.yaml +17 -3
  90. package/engines/specs/weibo_hot.yaml +11 -1
  91. package/engines/specs/wikidata.yaml +1 -1
  92. package/engines/specs/wikipedia.yaml +1 -1
  93. package/engines/specs/wolframalpha.yaml +3 -3
  94. package/engines/specs/xiaohongshu.yaml +2 -0
  95. package/engines/specs/zhihu.yaml +3 -18
  96. package/engines/specs/zhihu_hot_app.yaml +1 -1
  97. package/engines/specs/zhihu_kb.yaml +18 -0
  98. package/engines/specs/zhihu_questions.yaml +19 -0
  99. package/package.json +4 -2
  100. package/packages/dsh-plugin/README.md +9 -14
  101. package/packages/dsh-plugin/dsh/client.js +481 -1037
  102. package/packages/dsh-plugin/dsh/diagnostics.js +71 -20
  103. package/packages/dsh-plugin/dsh/index.js +6 -0
  104. package/packages/dsh-plugin/dsh/runner.js +3 -1
  105. package/packages/dsh-plugin/dsh/workbench-client.js +796 -0
  106. package/packages/dsh-plugin/dsh/workbench-md.js +386 -0
  107. package/packages/dsh-plugin/dsh/workbench-suggestions.js +148 -0
  108. package/packages/dsh-plugin/dsh/workbench.js +966 -0
  109. package/packages/dsh-plugin/icon.svg +23 -0
  110. package/packages/dsh-plugin/package.json +10 -3
  111. package/packages/dsh-plugin/scripts/sync-local.mjs +87 -0
  112. package/packages/dsh-plugin/scripts/sync-local.sh +13 -1
  113. package/packages/dsh-plugin/test/diagnostics.test.js +38 -1
  114. package/packages/dsh-plugin/test/size-gate.test.js +2 -9
  115. package/packages/dsh-plugin/test/workbench.test.js +92 -0
  116. package/scripts/adaptive.py +7 -1
  117. package/scripts/archive_run.py +112 -53
  118. package/scripts/argo_paths.py +42 -5
  119. package/scripts/badcase_ledger.py +117 -9
  120. package/scripts/build_concept_table.py +112 -55
  121. package/scripts/cache.py +6 -2
  122. package/scripts/caliber_isolation.py +60 -23
  123. package/scripts/circuit_breaker.py +72 -11
  124. package/scripts/cli_io.py +20 -2
  125. package/scripts/config_cache.py +44 -1
  126. package/scripts/daemon.py +151 -51
  127. package/scripts/dormant_ledger.py +23 -9
  128. package/scripts/engine_dispatch.py +8 -5
  129. package/scripts/engine_env.py +191 -1
  130. package/scripts/engine_families.py +50 -7
  131. package/scripts/engine_states.py +3 -50
  132. package/scripts/engine_validate.py +13 -45
  133. package/scripts/engines.py +15 -31
  134. package/scripts/engines_base.py +66 -61
  135. package/scripts/engines_builders.py +0 -15
  136. package/scripts/engines_builders_archive.py +4 -3
  137. package/scripts/engines_builders_batch10.py +346 -100
  138. package/scripts/engines_builders_batch11.py +4 -76
  139. package/scripts/engines_builders_batch13.py +4 -3
  140. package/scripts/engines_builders_batch14.py +2 -1
  141. package/scripts/engines_builders_batch15.py +2 -1
  142. package/scripts/engines_builders_batch9.py +16 -25
  143. package/scripts/engines_builders_cn.py +7 -201
  144. package/scripts/engines_builders_data.py +12 -11
  145. package/scripts/engines_builders_data_macro.py +5 -4
  146. package/scripts/engines_builders_dsh.py +2 -1
  147. package/scripts/engines_builders_feeds.py +76 -11
  148. package/scripts/engines_builders_finance.py +2 -1
  149. package/scripts/engines_builders_intl.py +18 -117
  150. package/scripts/engines_builders_media.py +59 -12
  151. package/scripts/engines_builders_pixiv.py +2 -16
  152. package/scripts/engines_builders_science.py +8 -7
  153. package/scripts/engines_builders_search.py +7 -14
  154. package/scripts/engines_builders_skill.py +2 -1
  155. package/scripts/engines_builders_tech.py +8 -17
  156. package/scripts/engines_builders_weather.py +241 -0
  157. package/scripts/engines_fields.py +91 -0
  158. package/scripts/engines_http.py +184 -0
  159. package/scripts/engines_mcp.py +405 -0
  160. package/scripts/engines_parsers.py +13 -369
  161. package/scripts/engines_schema_drift.py +260 -0
  162. package/scripts/evidence.py +13 -0
  163. package/scripts/evidence_loop.py +19 -4
  164. package/scripts/extend_route_labels.py +6 -0
  165. package/scripts/fetch_jina.py +98 -0
  166. package/scripts/fetch_jsrun.py +15 -11
  167. package/scripts/fetch_v3.py +79 -120
  168. package/scripts/fulltext_store.py +42 -1
  169. package/scripts/fxtwitter_api.py +8 -7
  170. package/scripts/gen_engine_catalog.py +2 -2
  171. package/scripts/general_pool.py +15 -4
  172. package/scripts/health_check.py +1 -1
  173. package/scripts/image_vision/vision_probe +0 -0
  174. package/scripts/install.sh +2 -0
  175. package/scripts/link_source.py +65 -24
  176. package/scripts/local_seek_adapter.py +57 -17
  177. package/scripts/matrix_search_eval.py +8 -10
  178. package/scripts/mcp_handlers.py +53 -31
  179. package/scripts/mcp_handlers_surface.py +6 -18
  180. package/scripts/mcp_transport.py +10 -5
  181. package/scripts/min_version_scan.py +7 -3
  182. package/scripts/network_aware.py +7 -13
  183. package/scripts/numeric_verify.py +3 -2
  184. package/scripts/output_transparency.py +3 -0
  185. package/scripts/pre-commit +45 -43
  186. package/scripts/query_understanding.py +30 -6
  187. package/scripts/quota.py +36 -30
  188. package/scripts/rank_signals.py +9 -0
  189. package/scripts/recompute.py +15 -5
  190. package/scripts/recovery.py +38 -29
  191. package/scripts/recovery_runner.py +29 -10
  192. package/scripts/redskill/redskill_engine.py +2 -1
  193. package/scripts/release.py +14 -26
  194. package/scripts/release_check.py +5 -25
  195. package/scripts/replay_eval.py +2 -2
  196. package/scripts/research_cli.py +40 -0
  197. package/scripts/research_notes.py +368 -0
  198. package/scripts/route.py +40 -70
  199. package/scripts/route_audit.py +259 -0
  200. package/scripts/route_combo.py +21 -6
  201. package/scripts/route_domains.py +150 -23
  202. package/scripts/route_lang.py +20 -7
  203. package/scripts/route_log.py +26 -9
  204. package/scripts/route_policy.py +85 -6
  205. package/scripts/route_telemetry_export.py +199 -0
  206. package/scripts/rrf_classic.py +5 -22
  207. package/scripts/search.py +2 -1
  208. package/scripts/search_attribution.py +53 -10
  209. package/scripts/search_entry.py +32 -1
  210. package/scripts/search_output.py +23 -11
  211. package/scripts/search_pipeline.py +15 -3
  212. package/scripts/search_rank.py +21 -11
  213. package/scripts/semantic_evidence.py +394 -178
  214. package/scripts/serp_guard.py +13 -1
  215. package/scripts/settings_page.py +4 -3
  216. package/scripts/single_flight.py +1 -1
  217. package/scripts/social_engines/hackernews_engine.py +2 -1
  218. package/scripts/social_engines/reddit_engine.py +2 -1
  219. package/scripts/social_engines/xiaohongshu_engine.py +2 -1
  220. package/scripts/social_engines/zhihu_engine.py +252 -43
  221. package/scripts/sogou_weixin_browser.py +5 -6
  222. package/scripts/source_audit.py +44 -9
  223. package/scripts/source_ledger.py +2 -15
  224. package/scripts/source_selection.py +45 -20
  225. package/scripts/straggler_policy.py +1 -2
  226. package/scripts/sync_backends.py +17 -0
  227. package/scripts/tfidf_router.py +23 -11
  228. package/scripts/time_utils.py +54 -1
  229. package/scripts/train.py +68 -2
  230. package/scripts/usage_log.py +50 -10
  231. package/scripts/watch.py +3 -3
  232. package/scripts/zhihu_quota.py +2 -1
  233. package/sub-skills/argo-wide-research/SKILL.md +70 -0
  234. package/sub-skills/ego-search/{SKILL.md → README.md} +15 -47
  235. package/sub-skills/ego-search/scripts/ego_search.py +13 -4
  236. package/sub-skills/js-run/{SKILL.md → README.md} +3 -20
  237. package/sub-skills/local-search/{SKILL.md → README.md} +3 -8
  238. package/sub-skills/local-search/engine_registry.py +32 -7
  239. package/sub-skills/local-seek/SKILL.md +20 -22
  240. package/sub-skills/local-seek/scripts/seek_fts.py +58 -3
  241. package/scripts/caliber_dedupe.py +0 -66
  242. package/scripts/engines_builders_batch16.py +0 -13
  243. package/scripts/health_probe.py +0 -253
  244. package/scripts/social_engines/twitter_engine.py +0 -514
  245. package/scripts/sync_installs.py +0 -29
@@ -12,6 +12,7 @@ from search_rank import filter_results_by_domains
12
12
  from search_types import slot_record as dataclass
13
13
  from snippet_clean import clean_snippet
14
14
  import engine_states # 状态词表唯一真源(2026-11-09 收口)
15
+ from except_sets import OPT_IMPORT, SHAPE_BENIGN # 收窄词汇表(2026-11-13 裸吞收口)
15
16
  from typing import Any
16
17
  from output_transparency import ( # noqa: F401
17
18
  _AGGREGATOR_HOSTS,
@@ -276,7 +277,8 @@ def _strip_for_agent(payload: dict[str, Any]) -> dict[str, Any]:
276
277
 
277
278
 
278
279
  def build_funnel(routed: int, called: int, returned: int,
279
- deduped: int, filtered: int, kept: int) -> dict[str, int]:
280
+ deduped: int, filtered: int, kept: int,
281
+ serp_dropped: int = 0) -> dict[str, int]:
280
282
  """阶段漏斗账:一次调用在管线每一层还剩多少条。
281
283
 
282
284
  why(GLM 密集反馈那篇的核心):端到端指标只能说明「变差了」,说明不了
@@ -291,17 +293,26 @@ def build_funnel(routed: int, called: int, returned: int,
291
293
  routed = 路由选出的引擎数(engines_combo)
292
294
  called = 实际发起调用的引擎数(早停时小于 routed)
293
295
  returned = 引擎返回的原始条数(跨引擎去重前)
294
- deduped = 跨引擎合并 + 近重复去重后(SERP/跳转页过滤的损耗已计入本格
295
- 之差,取值点在 SERP 过滤之前、minhash 之后;此前取值点在
296
- minhash 之后,把 SERP 丢弃也算成「去重削掉了」,会让 0 结果
297
- 的首要诊断入口给出错误归因)
296
+ deduped = 跨引擎合并后(取值点在 SERP 过滤之前;此前取值点在 minhash
297
+ 之后,把 SERP 丢弃也算成「去重削掉了」,会让 0 结果的首要
298
+ 诊断入口给出错误归因)
298
299
  filtered = 否定词过滤 + 时间窗过滤后
299
300
  kept = 最终输出条数
301
+ serp_dropped = SERP/跳转页守卫丢弃的条数(损耗计数,0 是好事)。
302
+ 2026-11-17 增设:此前 SERP 丢弃只体现为 deduped→filtered 的
303
+ 无名差值,外部实测 wechat_sogou fast 档「returned 10 →
304
+ deduped 10 → filtered 0 → kept 0」无一格指明真凶。注意它是
305
+ 损耗不是存活数,语义与其余六格相反,故不入 funnel_collapse
306
+ 的塌陷归因(0 在那里会被误读成塌陷点)。
300
307
  """
301
308
  return {"routed": routed, "called": called, "returned": returned,
302
- "deduped": deduped, "filtered": filtered, "kept": kept}
309
+ "deduped": deduped, "serp_dropped": serp_dropped,
310
+ "filtered": filtered, "kept": kept}
303
311
 
304
312
 
313
+ # 注意:serp_dropped 刻意不在此列——它是损耗计数(0 = 没丢任何条目,正常),
314
+ # 混进存活数序列会被 funnel_collapse 把「没丢条目」误报成塌陷点;describe_funnel
315
+ # 展示时按管线顺序临时插在 deduped 与 filtered 之间。
305
316
  FUNNEL_STAGES = ("routed", "called", "returned", "deduped", "filtered", "kept")
306
317
 
307
318
 
@@ -309,7 +320,8 @@ def describe_funnel(funnel: dict[str, Any] | None) -> str:
309
320
  """把漏斗压成一行 `routed 2→called 2→returned 0→…`(给局限声明用)。"""
310
321
  if not isinstance(funnel, dict):
311
322
  return ""
312
- return "→".join(f"{k} {funnel.get(k)}" for k in FUNNEL_STAGES
323
+ stages = list(FUNNEL_STAGES[:4]) + ["serp_dropped"] + list(FUNNEL_STAGES[4:])
324
+ return "→".join(f"{k} {funnel.get(k)}" for k in stages
313
325
  if k in funnel)
314
326
 
315
327
 
@@ -712,7 +724,7 @@ def shape_response(ctx: _ShapeContext, result: dict[str, Any]) -> dict[str, Any]
712
724
  result.setdefault("limitations", []).append(
713
725
  f"证据门控本次跳过({type(e).__name__}):fetch_required/"
714
726
  "evidence_loop 不可用,高后果域结论请自行核验")
715
- except Exception:
727
+ except SHAPE_BENIGN:
716
728
  pass
717
729
 
718
730
  # 上游权威等级回填(DeepSeek 0-4):单引擎/对冲路径不走五维精排,
@@ -768,7 +780,7 @@ def shape_response(ctx: _ShapeContext, result: dict[str, Any]) -> dict[str, Any]
768
780
  from local_seek import local_seek_last_skipped
769
781
  if local_seek_last_skipped():
770
782
  result["local_seek_skipped"] = True
771
- except Exception:
783
+ except OPT_IMPORT + SHAPE_BENIGN:
772
784
  pass
773
785
  if local_hits:
774
786
  _seen_urls = {r.get("url") for r in (result.get("results") or [])
@@ -848,7 +860,7 @@ def shape_response(ctx: _ShapeContext, result: dict[str, Any]) -> dict[str, Any]
848
860
  sanitize_results_boundary)
849
861
  sanitize_results_boundary(result.get("results"))
850
862
  result["content_trust"] = CONTENT_TRUST_UNTRUSTED
851
- except Exception:
863
+ except OPT_IMPORT + SHAPE_BENIGN:
852
864
  pass
853
865
  # 搜索期告警(issue #34 第 7 条):--json 下告警不能留在 stderr(调用方
854
866
  # 2>&1 合并会破坏 JSON 解析),统一收进响应的 warnings[] 字段。住在
@@ -858,6 +870,6 @@ def shape_response(ctx: _ShapeContext, result: dict[str, Any]) -> dict[str, Any]
858
870
  warns = [w.strip() for w in drain_search_warnings() if w.strip()]
859
871
  if warns:
860
872
  result.setdefault("warnings", []).extend(warns)
861
- except Exception:
873
+ except OPT_IMPORT + SHAPE_BENIGN:
862
874
  pass
863
875
  return result
@@ -79,6 +79,7 @@ import engine_states
79
79
  from stage_timing import tick as _tick, tock as _tock
80
80
  from time_utils import apply_time_window as _apply_time_window
81
81
  from time_utils import sort_results_by_time as _sort_results
82
+ from time_utils import weather_chronological
82
83
 
83
84
 
84
85
  @dataclass(frozen=True)
@@ -387,11 +388,11 @@ def postprocess(req: _SearchRequest, run: _SearchRun, hooks: Any) -> _SearchRun:
387
388
  if merged:
388
389
  try:
389
390
  from serp_guard import is_unusable_row as _is_unusable_row # SERP + 内容农场,标定见 test_content_farm_guard.py
390
- # url_kind: none(issue #29 口径 B):spec 显式声明条目不以 url 为身份,
391
- # 缺 url 的题录/语义片段不再被当壳页整批吞
391
+ # url_kind: none(issue #29 口径 B):spec 显式声明条目不以 url 为身份,缺 url 的题录/语义片段不再被当壳页整批吞;serp_dropped 丢弃落账见 build_funnel docstring
392
392
  merged = [r for r in merged if not _is_unusable_row(r)]
393
393
  except ImportError:
394
394
  pass # serp_guard 不可用时跳过(本地五维 rerank 已对 SERP 降权)
395
+ _funnel_serp_dropped = _funnel_deduped - len(merged)
395
396
 
396
397
  # ── minhash 近重复去重(结果级,RRF 后 / SERP 后)─────────────────────
397
398
  # max_keep 与下方放宽截断同源:去重只需要保证「前 N 条非重复」正确,
@@ -641,6 +642,17 @@ def postprocess(req: _SearchRequest, run: _SearchRun, hooks: Any) -> _SearchRun:
641
642
 
642
643
  if merged:
643
644
  merged = _apply_consensus_and_sort(merged, max_results)
645
+ # 天气结果按时间序收口:当前天气在前,逐日预报升序。放在最终截断
646
+ # 之后,避免五维 rerank 的新颖性把最远一天顶到最前(见函数 docstring)。
647
+ # 显式 `--engine open_meteo` 时 domain 会被置成 general,所以判据同时
648
+ # 看域、引擎列表与结果来源,不能只认 domain。
649
+ _weather_scope = (
650
+ domain == "weather_query"
651
+ or "open_meteo" in (engines or [])
652
+ or (bool(merged) and all(r.get("source") == "open_meteo" for r in merged))
653
+ )
654
+ if _weather_scope:
655
+ merged = weather_chronological(merged)
644
656
 
645
657
  _attach_selection_signals(merged, mode, depth)
646
658
 
@@ -677,7 +689,7 @@ def postprocess(req: _SearchRequest, run: _SearchRun, hooks: Any) -> _SearchRun:
677
689
  sum(1 for items in raw_results.values() if isinstance(items, list)
678
690
  for it in items
679
691
  if isinstance(it, dict) and "error" not in it),
680
- _funnel_deduped, _funnel_filtered, len(merged),
692
+ _funnel_deduped, _funnel_filtered, len(merged), serp_dropped=_funnel_serp_dropped,
681
693
  )
682
694
 
683
695
  result_payload = {
@@ -28,6 +28,7 @@ import engine_states # 状态词表唯一真源(2026-11-09 收口)
28
28
 
29
29
  from engine_env import env_flag, get_env
30
30
  from url_canon import canonical_url as _canonical_url_impl
31
+ from except_sets import IO_BENIGN, SHAPE_BENIGN # 收窄词汇表(2026-11-13 裸吞收口)
31
32
 
32
33
  # cache 延迟到首次真正需要相似度时再导入(2026-09-27,方案 B3):顶层 import
33
34
  # 会把 cache.py 连带 sqlite3/shutil/tempfile 整条拉进每次 import search 的
@@ -72,6 +73,7 @@ from rank_signals import ( # noqa: E402,F401
72
73
  score_completeness as _score_completeness,
73
74
  score_relevance as _score_relevance,
74
75
  title_stuffing_penalty as _title_stuffing_penalty,
76
+ upstream_score_boost as _upstream_score_boost,
75
77
  )
76
78
 
77
79
  # 中文/英文混合分词用的正则,延迟编译(首次 _tokens 时建)
@@ -281,8 +283,12 @@ def _content_similarity(a: str, b: str) -> float:
281
283
  if _sim_fn is not None:
282
284
  try:
283
285
  return float(_sim_fn(a, b))
284
- except Exception:
285
- pass # 单条相似度计算失败按「无相似度」处理,回退 Jaccard
286
+ except Exception as e:
287
+ # 单条相似度计算失败按「无相似度」处理,回退 Jaccard;相似度查
288
+ # cache 的 sqlite(OperationalError 不在词汇表),保持宽口径仅可见化。
289
+ import logging
290
+ logging.getLogger("unified_search").debug(
291
+ f"query 相似度计算跳过: {type(e).__name__}")
286
292
  import re as _re
287
293
  sa, sb = set(_re.findall(r"[\u4e00-\u9fff]|[a-zA-Z0-9]+", a.lower())), set(_re.findall(r"[\u4e00-\u9fff]|[a-zA-Z0-9]+", b.lower()))
288
294
  if not sa or not sb:
@@ -339,7 +345,7 @@ def minhash_dedupe(
339
345
  try:
340
346
  thr = float(os.environ.get("ARGO_MINHASH_THRESHOLD", str(threshold)))
341
347
  threshold = max(0.5, min(0.98, thr))
342
- except Exception:
348
+ except SHAPE_BENIGN:
343
349
  pass
344
350
  pool = sorted(
345
351
  results,
@@ -470,7 +476,7 @@ def _note_rerank_failure(breaker, category: str, detail: str) -> None:
470
476
  attribution={"category": category,
471
477
  "reason": "语义精排端点不可用", "detail": detail},
472
478
  )
473
- except Exception:
479
+ except IO_BENIGN + SHAPE_BENIGN:
474
480
  pass
475
481
 
476
482
  def rerank_results(query: str, results: list[dict[str, Any]],
@@ -498,8 +504,13 @@ def rerank_results(query: str, results: list[dict[str, Any]],
498
504
  from quota import get_quota_manager
499
505
  if get_quota_manager().is_remote_exhausted("bocha"):
500
506
  return results, engine_states.RERANK_SKIPPED_QUOTA
501
- except Exception:
502
- pass
507
+ except Exception as e:
508
+ # quota 联动是侧信道:fail-open 是被测契约(test_quota_gate_fails_open
509
+ # _when_quota_unavailable 用 RuntimeError 桩验证),不收窄——except_sets
510
+ # 判定规则看 try 块失败的代价,quota 层可抛任意异常。
511
+ import logging
512
+ logging.getLogger("unified_search").debug(
513
+ f"quota 联动检查跳过(fail-open): {type(e).__name__}")
503
514
 
504
515
  # 端点熔断:先问「还该不该打这一枪」。
505
516
  #
@@ -546,7 +557,7 @@ def rerank_results(query: str, results: list[dict[str, Any]],
546
557
  if breaker is not None:
547
558
  try:
548
559
  breaker.record_success(_RERANK_BREAKER_KEY)
549
- except Exception:
560
+ except IO_BENIGN + SHAPE_BENIGN:
550
561
  pass
551
562
  rerank_results_list = data.get("data", {}).get("results", [])
552
563
  if not rerank_results_list:
@@ -758,10 +769,9 @@ def local_five_dim_rerank(query: str, results: list[dict[str, Any]],
758
769
  # prior——浮点加法顺序与改造前一致,金标对拍才可能零差异。
759
770
  pool = enriched[:]
760
771
  for e in pool:
761
- e["_static4"] = (w["relevance"] * e["relevance"]
762
- + w["authority"] * e["authority"]
763
- + w["freshness"] * e["freshness"]
764
- + w["completeness"] * e["completeness"])
772
+ e["_static4"] = (w["relevance"] * e["relevance"] + w["authority"] * e["authority"]
773
+ + w["freshness"] * e["freshness"] + w["completeness"] * e["completeness"]
774
+ + _upstream_score_boost(e["r"]))
765
775
  # 来源侧惩罚(域级集中 / 跨域同质)作为静态分乘子(≤1)在**贪心之前**
766
776
  # 应用:① 无需事后重排,且惩罚表为空时本行是 ×1.0、浮点上逐位无操作,
767
777
  # 「无惩罚时与旧实现逐位一致」的不变式不被破坏;② K 剪枝上界