argo-search 2.12.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 +35 -12
- package/README.es.md +35 -12
- package/README.ja.md +38 -13
- package/README.ko.md +35 -12
- package/README.md +69 -42
- package/SKILL.md +4 -4
- package/assets/readme/counts.json +1 -0
- package/assets/readme/hero.svg +1 -1
- package/backends/domain_profiles.json +78 -6
- package/backends/engine_registry.yaml +188 -22
- package/backends/env_passthrough.txt +75 -0
- package/backends/quota_profiles.json +132 -12
- package/bin/argo +3 -0
- package/config.yaml +34 -3524
- package/docs/ARGO_INTRO.md +4 -3
- package/docs/CHANGELOG.md +337 -0
- package/docs/COMMIT_STANDARD.md +98 -0
- package/docs/ENGINE_CATALOG.md +65 -48
- package/docs/QUALITY_OF_SLOW_SOURCES.md +115 -0
- package/docs/RELEASE_NOTES_v2.13.0.md +66 -0
- package/docs/RELEASE_NOTES_v2.14.0.md +77 -0
- package/docs/RELEASING.md +47 -0
- package/docs//344/270/272/344/273/200/344/271/210/351/200/211/346/213/251argo.md +7 -7
- package/engines/specs/anysearch.yaml +33 -0
- package/engines/specs/archive_org.yaml +31 -0
- package/engines/specs/arxiv.yaml +18 -0
- package/engines/specs/baidu_baike.yaml +16 -0
- package/engines/specs/baidu_hot.yaml +19 -0
- package/engines/specs/bilibili.yaml +33 -0
- package/engines/specs/bilibili_hot.yaml +19 -0
- package/engines/specs/bing_rss.yaml +17 -0
- package/engines/specs/biorxiv.yaml +2 -0
- package/engines/specs/bocha.yaml +26 -0
- package/engines/specs/bocha_ai.yaml +27 -0
- package/engines/specs/brave.yaml +20 -0
- package/engines/specs/byted.yaml +33 -0
- package/engines/specs/clinicaltrials.yaml +23 -0
- package/engines/specs/cls_telegraph.yaml +19 -0
- package/engines/specs/cnii.yaml +21 -0
- package/engines/specs/cninfo.yaml +14 -0
- package/engines/specs/coingecko.yaml +33 -0
- package/engines/specs/courtlistener.yaml +15 -0
- package/engines/specs/crates.yaml +30 -0
- package/engines/specs/crossref.yaml +27 -0
- package/engines/specs/csdn.yaml +18 -0
- package/engines/specs/dblp.yaml +29 -0
- package/engines/specs/dbpedia.yaml +32 -0
- package/engines/specs/devto.yaml +26 -0
- package/engines/specs/dnb.yaml +17 -0
- package/engines/specs/doaj.yaml +17 -0
- package/engines/specs/docker_hub.yaml +30 -0
- package/engines/specs/douban_book.yaml +14 -0
- package/engines/specs/douyin_hot.yaml +21 -0
- package/engines/specs/eastmoney.yaml +16 -0
- package/engines/specs/ecosia.yaml +18 -0
- package/engines/specs/electricity_maps.yaml +17 -0
- package/engines/specs/em_flow.yaml +14 -0
- package/engines/specs/em_global_news.yaml +17 -0
- package/engines/specs/em_miaoxiang.yaml +14 -0
- package/engines/specs/eu_opendata.yaml +16 -0
- package/engines/specs/europeana.yaml +19 -0
- package/engines/specs/europepmc.yaml +29 -0
- package/engines/specs/eurostat.yaml +14 -0
- package/engines/specs/exa.yaml +20 -0
- package/engines/specs/felo.yaml +25 -0
- package/engines/specs/figshare.yaml +17 -0
- package/engines/specs/finviz.yaml +15 -0
- package/engines/specs/fourget.yaml +23 -0
- package/engines/specs/fr_opendata.yaml +28 -0
- package/engines/specs/frankfurter.yaml +21 -0
- package/engines/specs/fred.yaml +15 -0
- package/engines/specs/free_dictionary.yaml +16 -0
- package/engines/specs/fx_rate.yaml +14 -0
- package/engines/specs/gbfs_nyc.yaml +3 -0
- package/engines/specs/gbif.yaml +15 -0
- package/engines/specs/github.yaml +25 -0
- package/engines/specs/google_patents.yaml +16 -0
- package/engines/specs/google_scholar.yaml +16 -0
- package/engines/specs/gov_policy.yaml +31 -0
- package/engines/specs/grep_app.yaml +19 -0
- package/engines/specs/gutenberg.yaml +15 -0
- package/engines/specs/hackernews.yaml +18 -0
- package/engines/specs/hal.yaml +16 -0
- package/engines/specs/hatena_bookmark.yaml +20 -0
- package/engines/specs/hf_papers.yaml +26 -0
- package/engines/specs/huggingface.yaml +31 -0
- package/engines/specs/imdb.yaml +18 -0
- package/engines/specs/itotii.yaml +17 -0
- package/engines/specs/itunes.yaml +19 -0
- package/engines/specs/jin10.yaml +15 -0
- package/engines/specs/juejin.yaml +16 -0
- package/engines/specs/kaggle.yaml +44 -0
- package/engines/specs/know_your_meme.yaml +18 -0
- package/engines/specs/kor_law.yaml +17 -0
- package/engines/specs/lieu.yaml +18 -0
- package/engines/specs/listenbrainz.yaml +4 -0
- package/engines/specs/local_arxiv.yaml +18 -0
- package/engines/specs/local_baidu.yaml +35 -0
- package/engines/specs/local_bing.yaml +16 -0
- package/engines/specs/local_bing_news.yaml +22 -0
- package/engines/specs/local_crossref.yaml +23 -0
- package/engines/specs/local_github.yaml +27 -0
- package/engines/specs/local_gitlab.yaml +23 -0
- package/engines/specs/local_goodreads.yaml +16 -0
- package/engines/specs/local_google_news.yaml +15 -0
- package/engines/specs/local_imdb.yaml +17 -0
- package/engines/specs/local_npm.yaml +25 -0
- package/engines/specs/local_openstreetmap.yaml +36 -0
- package/engines/specs/local_pubmed.yaml +21 -0
- package/engines/specs/local_search.yaml +22 -0
- package/engines/specs/local_seek.yaml +34 -0
- package/engines/specs/local_semantic_scholar.yaml +23 -0
- package/engines/specs/local_sogou.yaml +15 -0
- package/engines/specs/local_stackoverflow.yaml +26 -0
- package/engines/specs/local_wikipedia.yaml +26 -0
- package/engines/specs/local_wikiquote.yaml +26 -0
- package/engines/specs/local_wiktionary.yaml +26 -0
- package/engines/specs/local_yandex.yaml +37 -0
- package/engines/specs/marginalia.yaml +22 -0
- package/engines/specs/mdn.yaml +32 -0
- package/engines/specs/met_museum.yaml +4 -2
- package/engines/specs/metaso.yaml +19 -0
- package/engines/specs/models_dev.yaml +16 -0
- package/engines/specs/moegirl.yaml +19 -0
- package/engines/specs/mojeek.yaml +31 -0
- package/engines/specs/musicbrainz.yaml +31 -0
- package/engines/specs/mwmbl.yaml +39 -0
- package/engines/specs/nasa_cmr.yaml +15 -0
- package/engines/specs/nbs_stats.yaml +16 -0
- package/engines/specs/ndl.yaml +17 -0
- package/engines/specs/noaa_swpc.yaml +3 -0
- package/engines/specs/npm.yaml +62 -0
- package/engines/specs/octen.yaml +16 -0
- package/engines/specs/open_library.yaml +15 -0
- package/engines/specs/open_meteo.yaml +17 -0
- package/engines/specs/openaire.yaml +34 -0
- package/engines/specs/openalex.yaml +27 -0
- package/engines/specs/opencitations.yaml +4 -1
- package/engines/specs/opencorporates.yaml +19 -0
- package/engines/specs/openfda.yaml +15 -0
- package/engines/specs/opensky.yaml +17 -0
- package/engines/specs/openverse.yaml +42 -0
- package/engines/specs/parallel.yaml +22 -0
- package/engines/specs/parallel_free.yaml +20 -0
- package/engines/specs/polymarket.yaml +26 -0
- package/engines/specs/pubchem.yaml +15 -0
- package/engines/specs/pypi.yaml +16 -0
- package/engines/specs/qiita.yaml +28 -0
- package/engines/specs/qq_music.yaml +17 -0
- package/engines/specs/qwant.yaml +19 -0
- package/engines/specs/qweather.yaml +14 -0
- package/engines/specs/rcsb_pdb.yaml +15 -0
- package/engines/specs/reddit.yaml +28 -0
- package/engines/specs/redskill.yaml +24 -0
- package/engines/specs/repology.yaml +18 -0
- package/engines/specs/rfc_editor.yaml +15 -0
- package/engines/specs/satnogs.yaml +5 -1
- package/engines/specs/searchmysite.yaml +18 -0
- package/engines/specs/searxng.yaml +18 -0
- package/engines/specs/sec_companyfacts.yaml +22 -0
- package/engines/specs/seeking_alpha.yaml +15 -0
- package/engines/specs/seltz.yaml +39 -0
- package/engines/specs/semantic_scholar.yaml +18 -0
- package/engines/specs/shenma.yaml +13 -0
- package/engines/specs/sina_quote.yaml +15 -0
- package/engines/specs/so.yaml +13 -0
- package/engines/specs/stackoverflow.yaml +18 -0
- package/engines/specs/steam.yaml +30 -0
- package/engines/specs/tatoeba.yaml +17 -0
- package/engines/specs/tavily.yaml +26 -0
- package/engines/specs/tencent_kline.yaml +18 -0
- package/engines/specs/tencent_quote.yaml +14 -0
- package/engines/specs/thesportsdb.yaml +18 -0
- package/engines/specs/ths_hot.yaml +19 -0
- package/engines/specs/tinyfish.yaml +36 -0
- package/engines/specs/tinyfish_news.yaml +34 -0
- package/engines/specs/tinyfish_paper.yaml +34 -0
- package/engines/specs/toutiao_hot.yaml +19 -0
- package/engines/specs/twitter.yaml +36 -0
- package/engines/specs/uapi.yaml +18 -0
- package/engines/specs/uniprot.yaml +16 -0
- package/engines/specs/urban_dictionary.yaml +25 -0
- package/engines/specs/usda.yaml +17 -0
- package/engines/specs/usgs.yaml +15 -0
- package/engines/specs/v2ex.yaml +33 -0
- package/engines/specs/vam.yaml +34 -0
- package/engines/specs/wallhaven.yaml +51 -0
- package/engines/specs/wallstreetcn.yaml +31 -0
- package/engines/specs/wayback_cdx.yaml +15 -0
- package/engines/specs/weather_cn.yaml +33 -0
- package/engines/specs/wechat_sogou.yaml +13 -0
- package/engines/specs/weibo.yaml +21 -0
- package/engines/specs/weibo_hot.yaml +21 -0
- package/engines/specs/wenshu.yaml +14 -0
- package/engines/specs/weread.yaml +14 -0
- package/engines/specs/wiby.yaml +18 -0
- package/engines/specs/wikidata.yaml +33 -0
- package/engines/specs/wikipedia.yaml +36 -0
- package/engines/specs/wolframalpha.yaml +18 -0
- package/engines/specs/worldbank.yaml +15 -0
- package/engines/specs/xiaohongshu.yaml +25 -0
- package/engines/specs/yahoo_finance.yaml +22 -0
- package/engines/specs/you.yaml +22 -0
- package/engines/specs/zh_wikipedia.yaml +35 -0
- package/engines/specs/zhihu.yaml +33 -0
- package/engines/specs/zhihu_global.yaml +18 -0
- package/engines/specs/zhihu_hot.yaml +36 -0
- package/engines/specs/zhihu_user.yaml +14 -0
- package/package.json +25 -22
- package/packages/dsh-plugin/README.md +11 -6
- package/packages/dsh-plugin/cordis.patch.yml +6 -2
- package/packages/dsh-plugin/dsh/client.js +65 -116
- package/packages/dsh-plugin/dsh/index.js +2 -2
- 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/scripts/sync-local.sh +13 -11
- package/packages/dsh-plugin/test/client.test.js +22 -5
- 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/ab_eval_p0p1.py +10 -4
- package/scripts/archive_run.py +4 -2
- package/scripts/badcase_causes.py +81 -0
- package/scripts/badcase_ledger.py +290 -15
- package/scripts/batch_probe.py +10 -8
- package/scripts/build_release_assets.sh +17 -5
- package/scripts/cache.py +8 -8
- package/scripts/cache_guard.py +10 -5
- package/scripts/candidate_envelope.py +7 -3
- package/scripts/check_commit_report.py +168 -0
- package/scripts/circuit_breaker.py +220 -36
- package/scripts/config.py +9 -10
- package/scripts/daemon.py +11 -2
- package/scripts/engine_add.py +32 -0
- package/scripts/engine_admission.py +9 -5
- package/scripts/engine_dispatch.py +49 -46
- package/scripts/engine_failure.py +14 -18
- package/scripts/engine_families.py +13 -2
- package/scripts/engine_health.py +184 -0
- package/scripts/engine_policy.py +1 -1
- package/scripts/engine_states.py +989 -0
- package/scripts/engine_status.py +49 -11
- package/scripts/engine_validate.py +47 -39
- package/scripts/engines.py +8 -0
- package/scripts/engines_base.py +34 -88
- package/scripts/engines_builders.py +36 -19
- package/scripts/engines_builders_archive.py +303 -0
- package/scripts/engines_builders_batch11.py +63 -1
- package/scripts/engines_builders_batch12.py +168 -0
- package/scripts/engines_builders_batch16.py +186 -0
- package/scripts/engines_builders_batch9.py +9 -1
- package/scripts/engines_builders_data.py +69 -2090
- package/scripts/engines_builders_finance.py +354 -0
- package/scripts/engines_builders_intl.py +4 -1
- package/scripts/engines_builders_media.py +724 -0
- package/scripts/engines_builders_science.py +784 -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 +38 -38
- package/scripts/gen_engine_catalog.py +58 -153
- package/scripts/gen_native_tools.py +44 -17
- package/scripts/gen_routing_snapshot.py +8 -6
- package/scripts/health_check.py +37 -4
- package/scripts/health_probe.py +28 -8
- package/scripts/install.ps1 +31 -15
- package/scripts/install.sh +266 -142
- package/scripts/job.py +8 -70
- package/scripts/lint_spec_contracts.py +7 -12
- 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_launch.sh +9 -17
- package/scripts/mcp_transport.py +1 -1
- package/scripts/net_proxy.py +47 -0
- package/scripts/numeric_verify.py +20 -9
- package/scripts/output_transparency.py +21 -13
- package/scripts/plan.py +8 -5
- package/scripts/pre-commit +93 -23
- package/scripts/quota.py +11 -7
- package/scripts/recovery.py +14 -5
- package/scripts/recovery_l0.py +5 -3
- package/scripts/redskill/redskill_engine.py +3 -9
- package/scripts/release.py +60 -24
- package/scripts/release_check.py +20 -3
- package/scripts/research.py +1 -1
- package/scripts/research_dossier.py +10 -5
- package/scripts/research_gates.py +8 -4
- package/scripts/retry_policy.py +8 -7
- package/scripts/route.py +2 -24
- package/scripts/route_combo.py +11 -26
- package/scripts/route_lang.py +6 -1
- package/scripts/route_policy.py +21 -14
- package/scripts/search.py +36 -35
- package/scripts/search_attribution.py +34 -3
- package/scripts/search_cli.py +22 -12
- package/scripts/search_entry.py +15 -3
- package/scripts/search_output.py +87 -18
- package/scripts/search_pipeline.py +14 -10
- package/scripts/search_rank.py +23 -62
- package/scripts/search_types.py +5 -0
- package/scripts/social_engines/bilibili_engine.py +2 -30
- package/scripts/social_engines/hackernews_engine.py +4 -12
- package/scripts/social_engines/reddit_engine.py +4 -13
- package/scripts/social_engines/v2ex_engine.py +3 -12
- package/scripts/social_engines/weibo_engine.py +2 -30
- package/scripts/social_engines/zhihu_engine.py +4 -5
- package/scripts/source_audit.py +331 -0
- package/scripts/stats_cli.py +17 -1
- package/scripts/sync_backends.py +241 -8
- package/scripts/sync_requirements.py +159 -0
- package/scripts/tweet.py +3 -6
- package/scripts/usage_log.py +28 -9
- package/scripts/video_fetch.py +2 -5
- package/scripts/watch.py +11 -6
- package/scripts/wechat_article.py +11 -12
- package/scripts/wide_research.py +4 -1
- package/scripts/wx.py +6 -13
- package/scripts/x_article_fetch.py +2 -1
- package/sub-skills/local-search/SKILL.md +2 -2
- package/sub-skills/local-search/config.yaml +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/docs/DATA_SOURCE_GAPS.md +0 -81
- package/docs/DESIGN_LOCAL_DATA_FUSION.md +0 -90
- package/docs/PLATFORM_PATHS.md +0 -111
- package/docs/engines/bangumi.md +0 -27
- package/docs/engines/biorxiv.md +0 -27
- package/docs/engines/clawhub.md +0 -27
- package/docs/engines/crt_sh.md +0 -27
- package/docs/engines/datacite.md +0 -27
- package/docs/engines/deps_dev.md +0 -27
- package/docs/engines/douban_movie.md +0 -27
- package/docs/engines/endoflife.md +0 -27
- package/docs/engines/flk_law.md +0 -27
- package/docs/engines/fxtwitter.md +0 -27
- package/docs/engines/google_news.md +0 -27
- package/docs/engines/gov_regulations.md +0 -27
- package/docs/engines/guqian.md +0 -27
- package/docs/engines/hackernews.md +0 -27
- package/docs/engines/iplant.md +0 -27
- package/docs/engines/keenable.md +0 -27
- package/docs/engines/met_museum.md +0 -27
- package/docs/engines/nasa_images.md +0 -27
- package/docs/engines/netease_music.md +0 -27
- package/docs/engines/npm.md +0 -27
- package/docs/engines/nvd.md +0 -27
- package/docs/engines/openreview.md +0 -27
- package/docs/engines/openstd.md +0 -27
- package/docs/engines/parallel_free.md +0 -27
- package/docs/engines/people_daily.md +0 -27
- package/docs/engines/pixiv.md +0 -27
- package/docs/engines/realtime_index.md +0 -27
- package/docs/engines/sec_edgar.md +0 -27
- package/docs/engines/seltz.md +0 -27
- package/docs/engines/skillsmp.md +0 -27
- package/docs/engines/sspai.md +0 -27
- package/docs/engines/std_samr.md +0 -27
- package/docs/engines/train.md +0 -27
- package/docs/engines/un_comtrade.md +0 -27
- package/docs/engines/wikisource.md +0 -27
- package/docs/engines/zdic.md +0 -27
- package/docs/engines/zenodo.md +0 -27
- package/docs/engines/zhihu_hot_app.md +0 -27
- package/engines/specs/cinii.yaml +0 -44
package/scripts/search_cli.py
CHANGED
|
@@ -18,6 +18,7 @@ import time
|
|
|
18
18
|
from typing import Any
|
|
19
19
|
|
|
20
20
|
from cli_io import dumps, ensure_utf8_stdio
|
|
21
|
+
import engine_states # 状态词表唯一真源(2026-11-09 收口)
|
|
21
22
|
from engine_env import env_flag
|
|
22
23
|
from stage_timing import StageTiming
|
|
23
24
|
from time_utils import WINDOW_FORMATS_HINT, is_valid_time_window
|
|
@@ -282,26 +283,26 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
282
283
|
# 不可自动路由的成因,顺序即优先级:一个源可能同时缺 env 又缺依赖,若把每种
|
|
283
284
|
# 成立的理由都计一次,分组之和会大于「不可路由总数」,自相矛盾。只认第一个。
|
|
284
285
|
_ENGINE_BLOCK_REASONS: tuple[tuple[str, str], ...] = (
|
|
285
|
-
(
|
|
286
|
-
(
|
|
287
|
-
(
|
|
288
|
-
(
|
|
289
|
-
(
|
|
286
|
+
(engine_states.ENGINE_BLOCK_DISABLED, "enabled=False(未启用)"),
|
|
287
|
+
(engine_states.ENGINE_BLOCK_MISSING_ENV, "缺环境变量(配好密钥即可用)"),
|
|
288
|
+
(engine_states.ENGINE_BLOCK_MISSING_DEPS, "缺可选依赖(装好即可用)"),
|
|
289
|
+
(engine_states.ENGINE_BLOCK_QUOTA_EXHAUSTED, "配额耗尽(等窗口重置)"),
|
|
290
|
+
(engine_states.ENGINE_BLOCK_NOT_ROUTABLE, "其它不可路由(见 --engine <名> 全量行)"),
|
|
290
291
|
)
|
|
291
292
|
|
|
292
293
|
|
|
293
294
|
def _engine_block_reason(row: dict[str, Any]) -> str | None:
|
|
294
295
|
"""一条引擎记录「不可自动路由」的成因;可自动路由返回 None。"""
|
|
295
296
|
if not row.get("enabled", True):
|
|
296
|
-
return
|
|
297
|
+
return engine_states.ENGINE_BLOCK_DISABLED
|
|
297
298
|
if row.get("missing_env"):
|
|
298
|
-
return
|
|
299
|
+
return engine_states.ENGINE_BLOCK_MISSING_ENV
|
|
299
300
|
if row.get("missing_deps"):
|
|
300
|
-
return
|
|
301
|
+
return engine_states.ENGINE_BLOCK_MISSING_DEPS
|
|
301
302
|
if row.get("quota_exhausted"):
|
|
302
|
-
return
|
|
303
|
+
return engine_states.ENGINE_BLOCK_QUOTA_EXHAUSTED
|
|
303
304
|
if not row.get("routable", True):
|
|
304
|
-
return
|
|
305
|
+
return engine_states.ENGINE_BLOCK_NOT_ROUTABLE
|
|
305
306
|
return None
|
|
306
307
|
|
|
307
308
|
|
|
@@ -420,6 +421,7 @@ def main():
|
|
|
420
421
|
try:
|
|
421
422
|
from engine_status import (list_engines_detail,
|
|
422
423
|
compact_engine_row,
|
|
424
|
+
compact_engine_table,
|
|
423
425
|
format_engines_table)
|
|
424
426
|
rows = list_engines_detail(routable_only=args.routable_only,
|
|
425
427
|
engines=_wanted)
|
|
@@ -451,7 +453,15 @@ def main():
|
|
|
451
453
|
print(f"[list-engines] 未收录的引擎: {', '.join(_missing)}",
|
|
452
454
|
file=sys.stderr)
|
|
453
455
|
if args.json_output:
|
|
454
|
-
|
|
456
|
+
# --all 的 JSON 走列式投影(2026-11-10):逐条对象在 301 个
|
|
457
|
+
# 引擎上重复 15 个键名,键名本身就 70 KB,超过 64 KB 上限。
|
|
458
|
+
# 列式把键名降到 1 份,实测 67.7 KB → 25.8 KB。
|
|
459
|
+
# 单引擎诊断(--engine <名>)仍给逐条全量对象——那一档
|
|
460
|
+
# 只有 1 条,键名成本可忽略,且需要嵌套的 runtime/admission。
|
|
461
|
+
if not _wanted:
|
|
462
|
+
print(dumps(compact_engine_table(rows)))
|
|
463
|
+
else:
|
|
464
|
+
print(dumps(rows))
|
|
455
465
|
else:
|
|
456
466
|
print(format_engines_table(rows))
|
|
457
467
|
except Exception as e:
|
|
@@ -597,7 +607,7 @@ def main():
|
|
|
597
607
|
# 本地命中并入已上移进 super_search(shape_response 统一出口,L1 并行),
|
|
598
608
|
# 这里不再串行补合并——双份合并会让同一批命中出现两次。
|
|
599
609
|
|
|
600
|
-
if args.archive and results.get("status") !=
|
|
610
|
+
if args.archive and results.get("status") != engine_states.PLAN_HANDOFF_REQUIRED:
|
|
601
611
|
try:
|
|
602
612
|
from archive_run import write_search_archive, resolve_archive_root
|
|
603
613
|
root = resolve_archive_root(args.archive_dir) if args.archive_dir else None
|
package/scripts/search_entry.py
CHANGED
|
@@ -36,6 +36,8 @@ from usage_log import emit as _emit_usage
|
|
|
36
36
|
from search_output import _collect_errors
|
|
37
37
|
from search_pipeline import _SearchRequest, _SearchRun
|
|
38
38
|
from search_types import Stage
|
|
39
|
+
# 状态词表唯一真源:缓存层级 / 精排结局(2026-11-09 收口)
|
|
40
|
+
import engine_states
|
|
39
41
|
from stage_timing import StageTiming, tick as _tick, tock as _tock
|
|
40
42
|
from time_utils import (
|
|
41
43
|
is_time_capable as _is_time_capable,
|
|
@@ -190,7 +192,8 @@ def prepare(query: str, decision: dict[str, Any], max_results: int,
|
|
|
190
192
|
if hit:
|
|
191
193
|
cache_elapsed = int((time.time() - t_cache_start) * 1000)
|
|
192
194
|
if on_progress:
|
|
193
|
-
on_progress(Stage.CACHE_HIT, {"cache_level": hit.get(
|
|
195
|
+
on_progress(Stage.CACHE_HIT, {"cache_level": hit.get(
|
|
196
|
+
"_cache_level", engine_states.CACHE_LEVEL_UNKNOWN)})
|
|
194
197
|
tfidf_scores = decision.get("tfidf_scores", [])
|
|
195
198
|
if tfidf_scores and all(s.get("score", 0) == 0 for s in tfidf_scores):
|
|
196
199
|
tfidf_scores = []
|
|
@@ -207,7 +210,8 @@ def prepare(query: str, decision: dict[str, Any], max_results: int,
|
|
|
207
210
|
"query": query, "engine": (cached_combo or engines)[0],
|
|
208
211
|
"engines": cached_combo,
|
|
209
212
|
"engines_combo": cached_combo, "cached": True,
|
|
210
|
-
"cache_level": hit.get(
|
|
213
|
+
"cache_level": hit.get(
|
|
214
|
+
"_cache_level", engine_states.CACHE_LEVEL_UNKNOWN),
|
|
211
215
|
"domain": domain, "elapsed_ms": cache_elapsed,
|
|
212
216
|
"tfidf_scores": tfidf_scores,
|
|
213
217
|
"route_reason": hit.get("route_reason") or decision.get("reason"),
|
|
@@ -216,7 +220,7 @@ def prepare(query: str, decision: dict[str, Any], max_results: int,
|
|
|
216
220
|
"count": len(hit_results),
|
|
217
221
|
"engines_used": hit.get("engines_used") or engines,
|
|
218
222
|
"mode": mode, "depth": depth,
|
|
219
|
-
"reranker":
|
|
223
|
+
"reranker": engine_states.RERANK_SKIPPED_CACHE,
|
|
220
224
|
"engine_outcomes": hit.get("engine_outcomes") or [],
|
|
221
225
|
"errors": _collect_errors({}, hit.get("engine_outcomes") or []),
|
|
222
226
|
"time_filtered": 0,
|
|
@@ -238,6 +242,14 @@ def prepare(query: str, decision: dict[str, Any], max_results: int,
|
|
|
238
242
|
_hit["funnel"] = hit["funnel"]
|
|
239
243
|
if timing is not None:
|
|
240
244
|
_hit["timing"] = timing.summary()
|
|
245
|
+
# 缓存命中同样是「一次搜索的结束」:进度契约要求每次运行以
|
|
246
|
+
# DONE/ERROR 收尾(见 search_types.Stage)。此前这里直接 return,
|
|
247
|
+
# 消费方在命中路径上永远等不到终态事件——冷路径有、热路径没有,
|
|
248
|
+
# 而热路径恰恰是常驻进程里最常见的那种。
|
|
249
|
+
if on_progress:
|
|
250
|
+
on_progress(Stage.DONE, {"count": len(hit_results),
|
|
251
|
+
"elapsed_ms": cache_elapsed,
|
|
252
|
+
"cached": True})
|
|
241
253
|
return _Prepared(cached=_hit)
|
|
242
254
|
|
|
243
255
|
# 缓存未命中才拉起查询理解、词形规范化与网络感知超时(缓存命中热路径零开销)
|
package/scripts/search_output.py
CHANGED
|
@@ -11,6 +11,7 @@ from __future__ import annotations
|
|
|
11
11
|
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
|
+
import engine_states # 状态词表唯一真源(2026-11-09 收口)
|
|
14
15
|
from typing import Any
|
|
15
16
|
from output_transparency import ( # noqa: F401
|
|
16
17
|
_AGGREGATOR_HOSTS,
|
|
@@ -61,6 +62,8 @@ def _warn(message: str) -> None:
|
|
|
61
62
|
_AGENT_RESULT_FIELDS = (
|
|
62
63
|
"title", "url", "snippet", "source", "score", "ref",
|
|
63
64
|
"published_at", "fetch_suggested", "full_text_url",
|
|
65
|
+
# 本地命中标记:明确区分本地文件与联网结果,供 Agent 分面过滤
|
|
66
|
+
"is_local",
|
|
64
67
|
# 离散权威等级(0-4,≥3 极权威):Agent 的廉价可信闸门——连续 authority
|
|
65
68
|
# 分不知道该在哪切,等级才能直接当门用(DeepSeek Search 同款语义)。
|
|
66
69
|
# 整数字段约 6 字节,剥掉它等于把「先信谁」重新推回给调用方猜。
|
|
@@ -226,6 +229,8 @@ def _strip_for_agent(payload: dict[str, Any]) -> dict[str, Any]:
|
|
|
226
229
|
# 信任级别:网页文本一律是不可信外部数据,随答案一起到达,
|
|
227
230
|
# 避免调用方把摘要里的指令当任务执行(输出层声明,非提示词)。
|
|
228
231
|
"content_trust",
|
|
232
|
+
# 本地与公网分面契约(方案三):通道隔离,避免本地命中与联网结果在同一列表里混淆
|
|
233
|
+
"local_results", "web_results", "local_seek_skipped", "local_seek_skip_reason", "facets",
|
|
229
234
|
# 核验产出:verify/evidence_reorder 是**花了墙钟换来的**,且是
|
|
230
235
|
# 「该不该引用这批结果」的直接依据。此前被整块剥掉,调用方付了
|
|
231
236
|
# 几秒核验却只看到 verified_count 一个数(2026-10-22 实测)。
|
|
@@ -255,6 +260,18 @@ def _strip_for_agent(payload: dict[str, Any]) -> dict[str, Any]:
|
|
|
255
260
|
slim_results.append(slim)
|
|
256
261
|
out["results"] = slim_results
|
|
257
262
|
out["count"] = len(slim_results)
|
|
263
|
+
|
|
264
|
+
# 分面通道:对 local_results 与 web_results 按同一字段白名单瘦身
|
|
265
|
+
if "local_results" in payload:
|
|
266
|
+
out["local_results"] = [
|
|
267
|
+
{k: r[k] for k in _AGENT_RESULT_FIELDS if r.get(k) is not None}
|
|
268
|
+
for r in (payload.get("local_results") or []) if isinstance(r, dict)
|
|
269
|
+
]
|
|
270
|
+
if "web_results" in payload:
|
|
271
|
+
out["web_results"] = [
|
|
272
|
+
{k: r[k] for k in _AGENT_RESULT_FIELDS if r.get(k) is not None}
|
|
273
|
+
for r in (payload.get("web_results") or []) if isinstance(r, dict)
|
|
274
|
+
]
|
|
258
275
|
return out
|
|
259
276
|
|
|
260
277
|
|
|
@@ -383,7 +400,7 @@ def format_timing(t: dict[str, Any]) -> str:
|
|
|
383
400
|
def format_text_output(results: dict[str, Any]) -> str:
|
|
384
401
|
"""日常搜索人读格式:条目正文 + 底部「相关信源」链接(类传统 SERP)。"""
|
|
385
402
|
lines = []
|
|
386
|
-
if results.get("status") ==
|
|
403
|
+
if results.get("status") == engine_states.PLAN_HANDOFF_REQUIRED:
|
|
387
404
|
ho = results.get("handoff") or {}
|
|
388
405
|
lines.append("=== HANDOFF (known-url, search skipped) ===")
|
|
389
406
|
lines.append(f" url: {ho.get('url')}")
|
|
@@ -391,7 +408,8 @@ def format_text_output(results: dict[str, Any]) -> str:
|
|
|
391
408
|
for lim in (results.get("limitations") or [])[:4]:
|
|
392
409
|
lines.append(f" ! {lim}")
|
|
393
410
|
return "\n".join(lines)
|
|
394
|
-
if results.get("status")
|
|
411
|
+
if results.get("status") == engine_states.PLAN_READY \
|
|
412
|
+
and results.get("steps") and not results.get("results"):
|
|
395
413
|
# plan-only
|
|
396
414
|
lines.append(f"=== PLAN {results.get('status')} kind={results.get('input_kind')} ===")
|
|
397
415
|
route = results.get("route") or {}
|
|
@@ -422,7 +440,7 @@ def format_text_output(results: dict[str, Any]) -> str:
|
|
|
422
440
|
for err in results.get("errors", [])[:3]:
|
|
423
441
|
lines.append(f" [ERROR] {err}")
|
|
424
442
|
|
|
425
|
-
#
|
|
443
|
+
# 正文区:分桶呈现【本地搜索】与【联网搜索】,避免来源混淆
|
|
426
444
|
sources = results.get("sources")
|
|
427
445
|
if not isinstance(sources, list) or not sources:
|
|
428
446
|
sources = build_sources(results.get("results") or [])
|
|
@@ -430,15 +448,19 @@ def format_text_output(results: dict[str, Any]) -> str:
|
|
|
430
448
|
# 用 URL 保持一致 ref
|
|
431
449
|
url_to_ref = {s.get("url"): s.get("ref") for s in sources if isinstance(s, dict)}
|
|
432
450
|
body_items = [r for r in (results.get("results") or []) if isinstance(r, dict)]
|
|
433
|
-
|
|
451
|
+
|
|
452
|
+
def _is_local_item(it: dict[str, Any]) -> bool:
|
|
453
|
+
return bool(it.get("is_local") or it.get("source") == "local_files"
|
|
454
|
+
or str(it.get("url", "")).startswith("file://")
|
|
455
|
+
or str(it.get("source", "")).startswith("local_"))
|
|
456
|
+
|
|
457
|
+
local_items = [r for r in body_items if _is_local_item(r)]
|
|
458
|
+
web_items = [r for r in body_items if not _is_local_item(r)]
|
|
459
|
+
|
|
460
|
+
def _render_item(r: dict[str, Any], is_local_sec: bool = False) -> None:
|
|
434
461
|
url = (r.get("url") or "").strip()
|
|
435
462
|
ref = url_to_ref.get(url)
|
|
436
463
|
if ref is None:
|
|
437
|
-
# 未进 sources 时临时编号。分两种:有 URL 但没被收进 sources
|
|
438
|
-
# (编号未知,用 ?);以及**本就没有 URL** 的条目——天气/行情/
|
|
439
|
-
# 宏观这类结构化快照走的就是这条。此前两种情况共用一个分支,
|
|
440
|
-
# 且分支条件是 `and url`,于是无 URL 的条目 ref 保持 None,
|
|
441
|
-
# 正文里直接打成 `[None]`(2026-09-19 实测「北京天气」复现)。
|
|
442
464
|
ref = "?" if url else "—"
|
|
443
465
|
score = r.get("score", 0)
|
|
444
466
|
title = (r.get("title") or "?")[:80]
|
|
@@ -449,21 +471,33 @@ def format_text_output(results: dict[str, Any]) -> str:
|
|
|
449
471
|
lines.append(f" {snippet[:140]}")
|
|
450
472
|
elif score:
|
|
451
473
|
lines.append(f" (score={score_s})")
|
|
474
|
+
if is_local_sec and url.startswith("file://"):
|
|
475
|
+
lines.append(f" {url}")
|
|
452
476
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
477
|
+
if local_items:
|
|
478
|
+
lines.append("")
|
|
479
|
+
lines.append(f"【本地搜索】({len(local_items)} 项命中)")
|
|
480
|
+
for r in local_items:
|
|
481
|
+
_render_item(r, is_local_sec=True)
|
|
482
|
+
|
|
483
|
+
if web_items:
|
|
484
|
+
lines.append("")
|
|
485
|
+
lines.append(f"【联网搜索】({len(web_items)} 项命中)")
|
|
486
|
+
for r in web_items:
|
|
487
|
+
_render_item(r, is_local_sec=False)
|
|
488
|
+
|
|
489
|
+
# 底部相关信源(仅呈现联网 URL)
|
|
490
|
+
web_sources = [s for s in sources if isinstance(s, dict)
|
|
491
|
+
and not str(s.get("url", "")).startswith("file://")]
|
|
492
|
+
if web_sources:
|
|
456
493
|
lines.append("")
|
|
457
|
-
lines.append("──
|
|
494
|
+
lines.append("── 联网信源 ──")
|
|
458
495
|
_results_list = results.get("results") or []
|
|
459
|
-
for s in
|
|
460
|
-
if not isinstance(s, dict):
|
|
461
|
-
continue
|
|
496
|
+
for s in web_sources:
|
|
462
497
|
ref = s.get("ref", "?")
|
|
463
498
|
eng = s.get("engine") or ""
|
|
464
499
|
url = s.get("url") or ""
|
|
465
500
|
eng_s = f" · {eng}" if eng else ""
|
|
466
|
-
# 通过 ref 回查 results 获取 title(A2:sources 不再重复 title)
|
|
467
501
|
_title = ""
|
|
468
502
|
if isinstance(ref, int) and 1 <= ref <= len(_results_list):
|
|
469
503
|
_title = (_results_list[ref - 1].get("title") or "")[:60]
|
|
@@ -709,12 +743,33 @@ def shape_response(ctx: _ShapeContext, result: dict[str, Any]) -> dict[str, Any]
|
|
|
709
743
|
#(宽根守卫 + 3s 超时兜底),--include-local / MCP include_local 显式开,
|
|
710
744
|
# --no-local / include_local=false 关。按 URL 去重后并入,防止与既有
|
|
711
745
|
# 结果(或未来评分变化)产生双份条目。
|
|
746
|
+
# 内容形态约束优先于双轨并发:--video / --min-duration 是用户对「结果形态」
|
|
747
|
+
# 的硬要求,本机文件(.md/.py/.txt…)永远不满足。此前不判形态直接并入,
|
|
748
|
+
# 实测 --video 的 3 条视频会被 3 条本机 markdown 挤成 6 条混合结果。
|
|
749
|
+
# 判据与 search_pipeline 的视频过滤同源(decision 的 video_only/min/max_duration)。
|
|
750
|
+
_video_scope = bool((decision or {}).get("video_only")) \
|
|
751
|
+
or (decision or {}).get("min_duration") is not None \
|
|
752
|
+
or (decision or {}).get("max_duration") is not None
|
|
753
|
+
if include_local and _video_scope:
|
|
754
|
+
result["local_seek_skipped"] = True
|
|
755
|
+
result["local_seek_skip_reason"] = "content_shape_video"
|
|
756
|
+
include_local = False
|
|
757
|
+
|
|
712
758
|
if include_local:
|
|
713
759
|
try:
|
|
714
760
|
local_hits = _run_local_seek(query, n)
|
|
715
761
|
except Exception as e:
|
|
716
762
|
local_hits = []
|
|
717
763
|
_log(f"[include-local] {type(e).__name__}: {e}")
|
|
764
|
+
# 本地轨意图预判跳过了(公域答案型查询 + 无本地信号):显式标记,
|
|
765
|
+
# 让调用方看到「本地轨没跑」而不是误以为「本地没有匹配」。
|
|
766
|
+
# 与 local_seek_skipped 的另两个来源(宽根守卫 / seek.py 缺失)同义。
|
|
767
|
+
try:
|
|
768
|
+
from local_seek import local_seek_last_skipped
|
|
769
|
+
if local_seek_last_skipped():
|
|
770
|
+
result["local_seek_skipped"] = True
|
|
771
|
+
except Exception:
|
|
772
|
+
pass
|
|
718
773
|
if local_hits:
|
|
719
774
|
_seen_urls = {r.get("url") for r in (result.get("results") or [])
|
|
720
775
|
if isinstance(r, dict)}
|
|
@@ -722,8 +777,22 @@ def shape_response(ctx: _ShapeContext, result: dict[str, Any]) -> dict[str, Any]
|
|
|
722
777
|
if isinstance(h, dict) and h.get("url") not in _seen_urls]
|
|
723
778
|
if _fresh_local:
|
|
724
779
|
result.setdefault("results", []).extend(_fresh_local)
|
|
725
|
-
result["local_results"] = _fresh_local
|
|
726
780
|
result["include_local"] = True
|
|
781
|
+
|
|
782
|
+
# ── 来源分桶:构建独立的 local_results 与 web_results,杜绝来源混淆 ──────────
|
|
783
|
+
_all_res = [r for r in (result.get("results") or []) if isinstance(r, dict)]
|
|
784
|
+
_loc_b = [r for r in _all_res if r.get("is_local") or r.get("source") == "local_files"
|
|
785
|
+
or str(r.get("url", "")).startswith("file://") or str(r.get("source", "")).startswith("local_")]
|
|
786
|
+
_web_b = [r for r in _all_res if r not in _loc_b]
|
|
787
|
+
for _lr in _loc_b:
|
|
788
|
+
_lr["is_local"] = True
|
|
789
|
+
result["local_results"] = _loc_b
|
|
790
|
+
result["web_results"] = _web_b
|
|
791
|
+
result["facets"] = {
|
|
792
|
+
"web_count": len(_web_b),
|
|
793
|
+
"local_count": len(_loc_b),
|
|
794
|
+
"total_count": len(_all_res),
|
|
795
|
+
}
|
|
727
796
|
# ── 收口:重算一切「由 results 派生」的字段 ────────────────────────────────
|
|
728
797
|
#
|
|
729
798
|
# why:本函数**后置**改 results 的地方不止一处(域过滤裁剪、本地命中并入),
|
|
@@ -74,6 +74,8 @@ from search_rank import (
|
|
|
74
74
|
rrf_merge,
|
|
75
75
|
)
|
|
76
76
|
from search_types import Stage
|
|
77
|
+
# 状态词表唯一真源:精排结局 / 缓存层级(2026-11-09 收口)
|
|
78
|
+
import engine_states
|
|
77
79
|
from stage_timing import tick as _tick, tock as _tock
|
|
78
80
|
from time_utils import apply_time_window as _apply_time_window
|
|
79
81
|
from time_utils import sort_results_by_time as _sort_results
|
|
@@ -140,7 +142,7 @@ class _SearchRun:
|
|
|
140
142
|
time_filter_warning: str | None = None
|
|
141
143
|
recovery_info: dict[str, Any] | None = None
|
|
142
144
|
rank_method: str = "none"
|
|
143
|
-
reranker_status: str =
|
|
145
|
+
reranker_status: str = engine_states.RERANK_SKIPPED_SHORT
|
|
144
146
|
local_rerank_on: bool = False
|
|
145
147
|
fact_alignment: dict[str, Any] | None = None
|
|
146
148
|
number_conflict: dict[str, Any] | None = None
|
|
@@ -580,14 +582,14 @@ def postprocess(req: _SearchRequest, run: _SearchRun, hooks: Any) -> _SearchRun:
|
|
|
580
582
|
_tock(timing, "recovery", _tk_recovery)
|
|
581
583
|
_tk_rerank = _tick(timing)
|
|
582
584
|
local_rerank_on = env_flag("ARGO_LOCAL_RERANK")
|
|
583
|
-
reranker_status =
|
|
585
|
+
reranker_status = engine_states.RERANK_SKIPPED_SHORT
|
|
584
586
|
rank_method = "none"
|
|
585
587
|
if mode == "fast" or depth == "fast":
|
|
586
|
-
reranker_status =
|
|
588
|
+
reranker_status = engine_states.RERANK_SKIPPED_FAST
|
|
587
589
|
elif merged and len(merged) > 1:
|
|
588
590
|
# 全量重排(top_n=len),由最终输出统一截断 max_results
|
|
589
591
|
merged, reranker_status = rerank_results(query, merged, top_n=len(merged))
|
|
590
|
-
if reranker_status ==
|
|
592
|
+
if reranker_status == engine_states.RERANK_OK:
|
|
591
593
|
rank_method = "bocha"
|
|
592
594
|
|
|
593
595
|
# 本地五维 rerank 保底:受 ARGO_LOCAL_RERANK 开关控制(可观测 rank_method)。
|
|
@@ -824,7 +826,9 @@ def finalize(req: _SearchRequest, run: _SearchRun, hooks: Any) -> dict[str, Any]
|
|
|
824
826
|
st = (outcome or {}).get("status")
|
|
825
827
|
success = bool(res and any(isinstance(r, dict) and "error" not in r for r in res))
|
|
826
828
|
# 空结果说明查询与源不匹配而非源故障,单独统计不拉低成功率(见 adaptive.get_score)。
|
|
827
|
-
empty = (not success) and st in (
|
|
829
|
+
empty = (not success) and st in (
|
|
830
|
+
engine_states.OUTCOME_NO_RESULTS,
|
|
831
|
+
engine_states.OUTCOME_NO_RESULTS_CACHED)
|
|
828
832
|
latency = engine_latency.get(eng, elapsed / max(len(raw_results), 1))
|
|
829
833
|
cost = get_cost_factor(eng)
|
|
830
834
|
quality = _shares.get(eng) if success else None
|
|
@@ -887,11 +891,11 @@ def finalize(req: _SearchRequest, run: _SearchRun, hooks: Any) -> dict[str, Any]
|
|
|
887
891
|
"count": len(merged),
|
|
888
892
|
"elapsed_ms": round(elapsed),
|
|
889
893
|
"engines_used": list(raw_results.keys())[:8],
|
|
890
|
-
#
|
|
891
|
-
#
|
|
892
|
-
#
|
|
893
|
-
#
|
|
894
|
-
|
|
894
|
+
# 曾写 top_urls(头部 5 条结果 URL,「留作采纳回放地基」)。实测
|
|
895
|
+
# 全仓零消费者:stats_cli 只读 count/elapsed_ms/engines_used/query,
|
|
896
|
+
# 该字段却占 query 流 26.8% 体积(3121 个 URL / 213 KB),且
|
|
897
|
+
# 9c60ded 又在同一行追加 engine_results,越堆越胖。日志只记有人
|
|
898
|
+
# 读的事实;真要回放从 --archive 落盘,别在每条查询里带全文。
|
|
895
899
|
**usage_log_attribution(engine_latency, engine_outcomes=engine_outcomes),
|
|
896
900
|
"errors": len(_collect_errors(raw_results, engine_outcomes)),
|
|
897
901
|
"recovered": bool(recovery_info.get("recovered")) if recovery_info else False,
|