argo-search 1.0.1 → 2.9.7
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/LICENSE +201 -21
- package/README.en.md +822 -0
- package/README.es.md +864 -0
- package/README.ja.md +864 -0
- package/README.ko.md +864 -0
- package/README.md +867 -320
- package/SKILL.md +135 -0
- package/assets/readme/hero.svg +121 -0
- package/assets/readme/made-with-beautify.svg +10 -0
- package/assets/readme/proof-routes.svg +73 -0
- package/assets/readme/settings-keys.png +0 -0
- package/assets/readme/settings-tools.png +0 -0
- package/assets/readme/why-better.svg +104 -0
- package/assets/readme/workflow.svg +83 -0
- package/backends/domain_profiles.json +2308 -96
- package/backends/engine_registry.yaml +3314 -503
- package/backends/query_synonyms_cn.json +35 -0
- package/backends/quota_profiles.json +2409 -161
- package/backends/source_types_cn.json +83 -0
- package/backends/text_lexicon.json +44 -0
- package/bin/argo +703 -0
- package/bin/argo.js +71 -39
- package/config.yaml +4976 -363
- package/cordis.patch.yml +21 -0
- package/data/countries.json +40 -0
- package/data/lang_matrix/lang_capability.json +842 -0
- package/data/lang_matrix/matrix_2026-09-10.json +11921 -0
- package/data/regions_cn.json +1 -0
- package/docs/ADDING_NEW_ENGINE.md +184 -0
- package/docs/ARGO_INTRO.md +124 -0
- package/docs/DATA_SOURCE_GAPS.md +81 -0
- package/docs/DESIGN_LOCAL_DATA_FUSION.md +90 -0
- package/docs/ENGINE_CATALOG.md +564 -0
- package/docs/MCP_SETUP.md +106 -0
- package/docs/PLATFORM_PATHS.md +111 -0
- package/docs/RELEASE_NOTES_v2.8.0.md +71 -0
- package/docs/RELEASE_NOTES_v2.8.2.md +63 -0
- package/docs/RELEASE_NOTES_v2.8.3.md +55 -0
- package/docs/RELEASE_NOTES_v2.8.4.md +79 -0
- package/docs/RELEASE_NOTES_v2.8.5.md +102 -0
- package/docs/RELEASE_NOTES_v2.8.6.md +66 -0
- package/docs/RELEASE_NOTES_v2.8.7.md +65 -0
- package/docs/RELEASE_NOTES_v2.8.8.md +67 -0
- package/docs/RELEASE_NOTES_v2.8.9.md +67 -0
- package/docs/RELEASE_NOTES_v2.9.0.md +64 -0
- package/docs/SEARCH_ARCHIVE.md +115 -0
- package/docs/assets/architecture.svg +104 -0
- package/docs/assets/hero.svg +98 -0
- package/docs/engines/bangumi.md +27 -0
- package/docs/engines/biorxiv.md +27 -0
- package/docs/engines/clawhub.md +27 -0
- package/docs/engines/crt_sh.md +27 -0
- package/docs/engines/datacite.md +27 -0
- package/docs/engines/deps_dev.md +27 -0
- package/docs/engines/douban_movie.md +27 -0
- package/docs/engines/endoflife.md +27 -0
- package/docs/engines/flk_law.md +27 -0
- package/docs/engines/fxtwitter.md +27 -0
- package/docs/engines/google_news.md +27 -0
- package/docs/engines/gov_regulations.md +27 -0
- package/docs/engines/guqian.md +27 -0
- package/docs/engines/hackernews.md +27 -0
- package/docs/engines/iplant.md +27 -0
- package/docs/engines/keenable.md +27 -0
- package/docs/engines/met_museum.md +27 -0
- package/docs/engines/nasa_images.md +27 -0
- package/docs/engines/netease_music.md +27 -0
- package/docs/engines/npm.md +27 -0
- package/docs/engines/nvd.md +27 -0
- package/docs/engines/openreview.md +27 -0
- package/docs/engines/openstd.md +27 -0
- package/docs/engines/parallel_free.md +27 -0
- package/docs/engines/people_daily.md +27 -0
- package/docs/engines/realtime_index.md +27 -0
- package/docs/engines/sec_edgar.md +27 -0
- package/docs/engines/seltz.md +27 -0
- package/docs/engines/skillsmp.md +27 -0
- package/docs/engines/sspai.md +27 -0
- package/docs/engines/std_samr.md +27 -0
- package/docs/engines/train.md +27 -0
- package/docs/engines/un_comtrade.md +27 -0
- package/docs/engines/wikisource.md +27 -0
- package/docs/engines/zdic.md +27 -0
- package/docs/engines/zenodo.md +27 -0
- package/docs/engines/zhihu_hot_app.md +27 -0
- package/docs//344/270/272/344/273/200/344/271/210/351/200/211/346/213/251argo.md +176 -0
- package/engines/README.md +10 -0
- package/engines/_template_cli.yaml +39 -0
- package/engines/_template_http.yaml +37 -0
- package/engines/plugins/_template_plugin.py +50 -0
- package/engines/specs/_cisa_kev.yaml +54 -0
- package/engines/specs/_osv.yaml +63 -0
- package/engines/specs/aljazeera.yaml +43 -0
- package/engines/specs/antara.yaml +43 -0
- package/engines/specs/artic.yaml +20 -0
- package/engines/specs/aviation_weather.yaml +39 -0
- package/engines/specs/bangumi.yaml +21 -0
- package/engines/specs/biorxiv.yaml +24 -0
- package/engines/specs/carbon_intensity.yaml +32 -0
- package/engines/specs/cinii.yaml +44 -0
- package/engines/specs/clawhub.yaml +49 -0
- package/engines/specs/cleveland.yaml +19 -0
- package/engines/specs/cn_ai_news.yaml +43 -0
- package/engines/specs/core.yaml +35 -0
- package/engines/specs/crt_sh.yaml +38 -0
- package/engines/specs/ct24.yaml +43 -0
- package/engines/specs/datacite.yaml +27 -0
- package/engines/specs/datagov_uk.yaml +41 -0
- package/engines/specs/ddgs_images.yaml +45 -0
- package/engines/specs/deepseek_search.yaml +74 -0
- package/engines/specs/deezer.yaml +20 -0
- package/engines/specs/deps_dev.yaml +21 -0
- package/engines/specs/digup.yaml +36 -0
- package/engines/specs/doi.yaml +39 -0
- package/engines/specs/douban_movie.yaml +22 -0
- package/engines/specs/dw_news.yaml +47 -0
- package/engines/specs/egov_law.yaml +21 -0
- package/engines/specs/elpais.yaml +43 -0
- package/engines/specs/endoflife.yaml +21 -0
- package/engines/specs/energy_charts.yaml +21 -0
- package/engines/specs/factcheck_org.yaml +52 -0
- package/engines/specs/faz.yaml +43 -0
- package/engines/specs/federal_register.yaml +57 -0
- package/engines/specs/firecrawl.yaml +53 -0
- package/engines/specs/flk_law.yaml +24 -0
- package/engines/specs/folha.yaml +43 -0
- package/engines/specs/france24.yaml +44 -0
- package/engines/specs/full_fact.yaml +47 -0
- package/engines/specs/fxtwitter.yaml +31 -0
- package/engines/specs/gbfs_nyc.yaml +32 -0
- package/engines/specs/gdacs.yaml +21 -0
- package/engines/specs/gdelt.yaml +64 -0
- package/engines/specs/google_news.yaml +22 -0
- package/engines/specs/gov_regulations.yaml +38 -0
- package/engines/specs/guardian_rss.yaml +59 -0
- package/engines/specs/hurriyet.yaml +43 -0
- package/engines/specs/iplant.yaml +25 -0
- package/engines/specs/jikan.yaml +24 -0
- package/engines/specs/jolpica.yaml +20 -0
- package/engines/specs/k10plus.yaml +20 -0
- package/engines/specs/keenable.yaml +44 -0
- package/engines/specs/lefigaro.yaml +43 -0
- package/engines/specs/listenbrainz.yaml +19 -0
- package/engines/specs/matichon.yaml +43 -0
- package/engines/specs/met_museum.yaml +21 -0
- package/engines/specs/nasa_images.yaml +45 -0
- package/engines/specs/netease_music.yaml +38 -0
- package/engines/specs/nhk.yaml +43 -0
- package/engines/specs/nhtsa_vpic.yaml +20 -0
- package/engines/specs/noaa_swpc.yaml +20 -0
- package/engines/specs/nvd.yaml +38 -0
- package/engines/specs/obis.yaml +20 -0
- package/engines/specs/opencitations.yaml +52 -0
- package/engines/specs/openf1.yaml +21 -0
- package/engines/specs/openfoodfacts.yaml +45 -0
- package/engines/specs/openligadb.yaml +20 -0
- package/engines/specs/openreview.yaml +37 -0
- package/engines/specs/openstd.yaml +21 -0
- package/engines/specs/people_daily.yaml +22 -0
- package/engines/specs/realtime_index.yaml +34 -0
- package/engines/specs/ror.yaml +20 -0
- package/engines/specs/satnogs.yaml +20 -0
- package/engines/specs/sec_edgar.yaml +46 -0
- package/engines/specs/skillsmp.yaml +50 -0
- package/engines/specs/sogou_weixin_browser.yaml +30 -0
- package/engines/specs/soilgrids.yaml +25 -0
- package/engines/specs/sspai.yaml +36 -0
- package/engines/specs/stackexchange.yaml +46 -0
- package/engines/specs/std_samr.yaml +21 -0
- package/engines/specs/tass.yaml +43 -0
- package/engines/specs/tle_mirror.yaml +21 -0
- package/engines/specs/train.yaml +37 -0
- package/engines/specs/tvmaze.yaml +20 -0
- package/engines/specs/twitter_syndication.yaml +31 -0
- package/engines/specs/un_comtrade.yaml +23 -0
- package/engines/specs/unpaywall.yaml +54 -0
- package/engines/specs/vnpress.yaml +43 -0
- package/engines/specs/weather.yaml +32 -0
- package/engines/specs/who_don.yaml +21 -0
- package/engines/specs/who_gho.yaml +20 -0
- package/engines/specs/wikimedia_commons.yaml +34 -0
- package/engines/specs/wikisource.yaml +22 -0
- package/engines/specs/worms.yaml +19 -0
- package/engines/specs/x_trending.yaml +34 -0
- package/engines/specs/yna.yaml +43 -0
- package/engines/specs/ynet.yaml +43 -0
- package/engines/specs/zbmath.yaml +40 -0
- package/engines/specs/zdic.yaml +22 -0
- package/engines/specs/zenodo.yaml +27 -0
- package/engines/specs/zhihu_hot_app.yaml +35 -0
- package/mcp/clients.yaml +74 -0
- package/package.json +51 -12
- package/packages/dsh-plugin/README.md +134 -0
- package/packages/dsh-plugin/cordis.patch.yml +48 -0
- package/packages/dsh-plugin/dsh/client.js +1244 -0
- package/packages/dsh-plugin/dsh/index.js +2290 -0
- package/packages/dsh-plugin/dsh/native-tools.mjs +743 -0
- package/packages/dsh-plugin/package.json +38 -0
- package/packages/dsh-plugin/test/client.test.js +232 -0
- package/packages/dsh-plugin/test/config.test.js +30 -0
- package/packages/dsh-plugin/test/index.test.js +1338 -0
- package/references/query-templates.md +96 -0
- package/references/query-templates.yaml +118 -0
- package/scripts/ab_eval.py +219 -0
- package/scripts/ab_eval_p0p1.py +266 -0
- package/scripts/adaptive.py +271 -70
- package/scripts/answer.py +154 -0
- package/scripts/archive_run.py +591 -0
- package/scripts/argo_engine_registry.py +172 -0
- package/scripts/argo_paths.py +728 -0
- package/scripts/article.py +136 -0
- package/scripts/arxiv_source.py +201 -0
- package/scripts/badcase_ledger.py +252 -0
- package/scripts/batch_probe.py +241 -0
- package/scripts/benchmark.py +19 -0
- package/scripts/bounded_run.py +144 -0
- package/scripts/browser_auth.py +323 -0
- package/scripts/burstiness_detector.py +147 -0
- package/scripts/cache.py +1078 -67
- package/scripts/cache_guard.py +271 -0
- package/scripts/cache_key_vdom.py +56 -0
- package/scripts/cache_similarity.py +170 -0
- package/scripts/caliber_isolation.py +195 -0
- package/scripts/calibrate_lowquality.py +210 -0
- package/scripts/candidate_envelope.py +366 -0
- package/scripts/chrome_cdp.py +871 -0
- package/scripts/circuit_breaker.py +389 -0
- package/scripts/citations.py +334 -0
- package/scripts/cite_cli.py +59 -0
- package/scripts/cjk_tokens.py +95 -0
- package/scripts/clarify.py +47 -24
- package/scripts/cli_io.py +240 -0
- package/scripts/config.py +683 -45
- package/scripts/config_cache.py +402 -0
- package/scripts/conn_pool.py +220 -0
- package/scripts/content_security.py +685 -0
- package/scripts/content_signals.py +730 -0
- package/scripts/crawl.py +74 -35
- package/scripts/daemon.py +866 -0
- package/scripts/digup_bridge.py +214 -0
- package/scripts/engine_admission.py +366 -0
- package/scripts/engine_dispatch.py +1019 -0
- package/scripts/engine_env.py +534 -0
- package/scripts/engine_failure.py +411 -0
- package/scripts/engine_families.py +732 -0
- package/scripts/engine_policy.py +218 -0
- package/scripts/engine_requires.py +190 -0
- package/scripts/engine_status.py +322 -0
- package/scripts/engine_validate.py +638 -0
- package/scripts/engines.py +778 -294
- package/scripts/engines_base.py +1521 -0
- package/scripts/engines_builders.py +298 -0
- package/scripts/engines_builders_batch10.py +159 -0
- package/scripts/engines_builders_batch11.py +174 -0
- package/scripts/engines_builders_batch12.py +103 -0
- package/scripts/engines_builders_batch13.py +340 -0
- package/scripts/engines_builders_batch9.py +1468 -0
- package/scripts/engines_builders_cn.py +2283 -0
- package/scripts/engines_builders_data.py +2923 -0
- package/scripts/engines_builders_data_macro.py +775 -0
- package/scripts/engines_builders_feeds.py +255 -0
- package/scripts/engines_builders_intl.py +1239 -0
- package/scripts/engines_builders_search.py +440 -0
- package/scripts/engines_builders_tech.py +1360 -0
- package/scripts/evidence.py +588 -162
- package/scripts/evidence_loop.py +592 -0
- package/scripts/evidence_tier.py +298 -0
- package/scripts/except_sets.py +25 -0
- package/scripts/extract.py +55 -16
- package/scripts/fact_align.py +207 -0
- package/scripts/fact_crosscheck.py +230 -0
- package/scripts/fetch.py +25 -12
- package/scripts/fetch_browser.py +87 -0
- package/scripts/fetch_jsrun.py +122 -0
- package/scripts/fetch_quality.py +225 -0
- package/scripts/fetch_render_tinyfish.py +117 -0
- package/scripts/fetch_v3.py +1779 -0
- package/scripts/focus_extract.py +350 -0
- package/scripts/fulltext_store.py +169 -0
- package/scripts/fxtwitter_api.py +325 -0
- package/scripts/gen_engine_catalog.py +364 -0
- package/scripts/gen_native_tools.py +91 -0
- package/scripts/gen_routing_snapshot.py +184 -0
- package/scripts/health_check.py +140 -402
- package/scripts/health_probe.py +23 -8
- package/scripts/hot_state.py +134 -0
- package/scripts/http_client.py +1053 -0
- package/scripts/image_ops.py +430 -0
- package/scripts/image_vision/vision_probe +0 -0
- package/scripts/image_vision/vision_probe.swift +126 -0
- package/scripts/install.ps1 +148 -0
- package/scripts/install.sh +206 -0
- package/scripts/job.py +1186 -0
- package/scripts/jump_resolver.py +235 -0
- package/scripts/lang_capability.py +150 -0
- package/scripts/lang_detect.py +289 -0
- package/scripts/lang_matrix_probe.py +329 -0
- package/scripts/lang_pref.py +311 -0
- package/scripts/link_source.py +340 -0
- package/scripts/local_engines.py +321 -0
- package/scripts/local_image.py +970 -0
- package/scripts/local_seek.py +366 -0
- package/scripts/macro_countries.py +82 -0
- package/scripts/matrix_search_eval.py +1105 -0
- package/scripts/mcp_diag.py +8 -3
- package/scripts/mcp_handlers.py +1074 -0
- package/scripts/mcp_handlers_surface.py +157 -0
- package/scripts/mcp_launch.sh +122 -0
- package/scripts/mcp_server.py +118 -417
- package/scripts/mcp_setup.py +407 -0
- package/scripts/mcp_tools.py +330 -0
- package/scripts/mcp_transport.py +191 -0
- package/scripts/min_version_scan.py +335 -0
- package/scripts/net_proxy.py +258 -0
- package/scripts/network_aware.py +152 -0
- package/scripts/paper.py +274 -0
- package/scripts/pdf_extract.py +518 -0
- package/scripts/phrase_filter.py +66 -0
- package/scripts/plan.py +422 -0
- package/scripts/postprocess_signals.py +150 -0
- package/scripts/pre-commit +48 -0
- package/scripts/query_enhance.py +157 -0
- package/scripts/query_operators.py +196 -0
- package/scripts/query_rewriter.py +116 -7
- package/scripts/query_signals.py +300 -0
- package/scripts/query_templates.py +167 -0
- package/scripts/query_understanding.py +411 -0
- package/scripts/query_variants.py +298 -0
- package/scripts/quota.py +488 -76
- package/scripts/rank_signals.py +775 -0
- package/scripts/ranking_eval.py +319 -0
- package/scripts/readability_extract.py +433 -0
- package/scripts/recompute.py +415 -0
- package/scripts/recovery.py +616 -0
- package/scripts/recovery_l0.py +160 -0
- package/scripts/redskill/redskill_engine.py +332 -0
- package/scripts/regression_p0p1.py +318 -0
- package/scripts/replay_eval.py +640 -0
- package/scripts/rerank_tfidf.py +225 -0
- package/scripts/research.py +591 -403
- package/scripts/research_cli.py +361 -0
- package/scripts/research_dossier.py +492 -0
- package/scripts/research_expand.py +146 -0
- package/scripts/research_gates.py +272 -0
- package/scripts/research_report.py +209 -0
- package/scripts/research_strategy.py +37 -0
- package/scripts/research_work_packages.py +195 -0
- package/scripts/result_lang.py +311 -0
- package/scripts/robots_guard.py +259 -0
- package/scripts/route.py +921 -254
- package/scripts/route_bangs.py +40 -0
- package/scripts/route_cache.py +225 -0
- package/scripts/route_combo.py +910 -0
- package/scripts/route_domains.py +328 -0
- package/scripts/route_lang.py +605 -0
- package/scripts/route_log.py +63 -0
- package/scripts/route_policy.py +250 -0
- package/scripts/rrf_classic.py +66 -0
- package/scripts/screenshot.py +73 -0
- package/scripts/search.py +897 -405
- package/scripts/search_attribution.py +88 -0
- package/scripts/search_benchmark.py +407 -0
- package/scripts/search_cli.py +627 -0
- package/scripts/search_entry.py +389 -0
- package/scripts/search_output.py +606 -0
- package/scripts/search_pipeline.py +1077 -0
- package/scripts/search_rank.py +991 -0
- package/scripts/search_types.py +27 -12
- package/scripts/seek_locator.py +68 -0
- package/scripts/semantic_evidence.py +215 -0
- package/scripts/serp_guard.py +228 -0
- package/scripts/serp_kill_log.py +51 -0
- package/scripts/single_flight.py +120 -0
- package/scripts/social_engines/__init__.py +10 -0
- package/scripts/social_engines/bilibili_engine.py +131 -0
- package/scripts/social_engines/hackernews_engine.py +113 -0
- package/scripts/social_engines/reddit_engine.py +172 -0
- package/scripts/social_engines/twitter_engine.py +397 -0
- package/scripts/social_engines/v2ex_engine.py +101 -0
- package/scripts/social_engines/weibo_engine.py +128 -0
- package/scripts/social_engines/xiaohongshu_engine.py +137 -0
- package/scripts/social_engines/zhihu_engine.py +139 -0
- package/scripts/social_research.py +201 -0
- package/scripts/sogou_weixin_browser.py +318 -0
- package/scripts/source_ledger.py +249 -0
- package/scripts/stage_timing.py +58 -0
- package/scripts/stats_cli.py +95 -0
- package/scripts/straggler_policy.py +60 -0
- package/scripts/stylometry_detector.py +231 -0
- package/scripts/sync_backends.py +353 -0
- package/scripts/sync_installs.py +29 -0
- package/scripts/template_cli.py +127 -0
- package/scripts/text_lexicon.py +72 -0
- package/scripts/tfidf_router.py +109 -37
- package/scripts/time_utils.py +233 -0
- package/scripts/topic_research_profiles.py +643 -0
- package/scripts/train.py +737 -0
- package/scripts/tweet.py +596 -0
- package/scripts/url_canon.py +217 -0
- package/scripts/url_optimize.py +56 -0
- package/scripts/url_safety.py +236 -0
- package/scripts/usage_log.py +116 -0
- package/scripts/usage_log_clean.py +113 -0
- package/scripts/v2ex_nodes.py +311 -0
- package/scripts/variant_recall.py +188 -0
- package/scripts/watch.py +205 -0
- package/scripts/wechat_article.py +258 -0
- package/scripts/wide_research.py +402 -0
- package/scripts/wx.py +349 -0
- package/scripts/x_article_fetch.py +141 -0
- package/scripts/x_search.py +234 -0
- package/scripts/x_trending.py +189 -0
- package/scripts/yaml_load.py +67 -0
- package/sub-skills/ego-search/SKILL.md +253 -0
- package/sub-skills/ego-search/references/browser-runtime.md +43 -0
- package/sub-skills/ego-search/references/install.md +67 -0
- package/sub-skills/ego-search/references/original-ego-upgrade.md +51 -0
- package/sub-skills/ego-search/scripts/ego_search.py +800 -0
- package/sub-skills/ego-search/scripts/merge.py +226 -0
- package/sub-skills/ego-search/scripts/quality.py +64 -0
- package/sub-skills/ego-search/scripts/runtime.py +172 -0
- package/sub-skills/ego-search/scripts/safety.py +109 -0
- package/sub-skills/ego-search/scripts/serp_spec.py +109 -0
- package/sub-skills/ego-search/scripts/webbridge_adapter.py +374 -0
- package/sub-skills/ego-search/tests/test_query_normalize.py +68 -0
- package/sub-skills/js-run/SKILL.md +67 -0
- package/sub-skills/js-run/scripts/jsrun.py +112 -0
- package/sub-skills/js-run/scripts/shim.js +188 -0
- package/sub-skills/js-run/tests/fixtures/challenge_like.js +27 -0
- package/sub-skills/js-run/tests/test_jsrun.py +165 -0
- package/sub-skills/local-search/SKILL.md +50 -53
- package/sub-skills/local-search/bm25.py +162 -0
- package/sub-skills/local-search/config.yaml +152 -55
- package/sub-skills/local-search/engine_registry.py +91 -26
- package/sub-skills/local-search/{health_check.py → local_health_check.py} +140 -10
- package/sub-skills/local-search/local_search_adapter.py +13 -2
- package/sub-skills/local-search/parse_maps.yaml +40 -42
- package/sub-skills/local-search/search_v3.py +1182 -65
- package/sub-skills/local-search/smart_router.py +47 -7
- package/sub-skills/local-seek/SKILL.md +110 -0
- package/sub-skills/local-seek/config/domains.yaml +20 -0
- package/sub-skills/local-seek/references/auto-behaviors.md +24 -0
- package/sub-skills/local-seek/references/fd-mdfind-recipes.md +62 -0
- package/sub-skills/local-seek/references/git-integration.md +54 -0
- package/sub-skills/local-seek/references/remote-handoff.md +46 -0
- package/sub-skills/local-seek/references/rg-recipes.md +96 -0
- package/sub-skills/local-seek/references/strategies.md +52 -0
- package/sub-skills/local-seek/references/structural-search.md +59 -0
- package/sub-skills/local-seek/scripts/eval_rank.py +216 -0
- package/sub-skills/local-seek/scripts/eval_seek.py +224 -0
- package/sub-skills/local-seek/scripts/seek.py +1465 -0
- package/sub-skills/local-seek/scripts/seek_frecency.py +126 -0
- package/sub-skills/local-seek/scripts/seek_fts.py +430 -0
- package/sub-skills/local-seek/scripts/seek_rank.py +193 -0
- package/sub-skills/local-seek/tests/test_content_rank.py +222 -0
- package/sub-skills/local-seek/tests/test_determinism_20261006.py +145 -0
- package/sub-skills/local-seek/tests/test_noise_tier.py +101 -0
- package/sub-skills/local-seek/tests/test_pcre2_probe.py +136 -0
- package/sub-skills/local-seek/tests/test_rank_pinyin.py +77 -0
- package/sub-skills/local-seek/tests/test_regression_20261003.py +169 -0
- package/sub-skills/local-seek/tests/test_regression_20261006.py +146 -0
- package/sub-skills/local-seek/tests/test_seek_degradation.py +111 -0
- package/sub-skills/local-seek/tests/test_seek_fts.py +313 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"""seek_fts 单元测试:索引生命周期、CJK 短语、降级契约与结果 parity。
|
|
2
|
+
|
|
3
|
+
契约基线见 seek_fts 模块 docstring;行抽取口径对齐 rg 恒定 -i。
|
|
4
|
+
"""
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
import pytest
|
|
12
|
+
|
|
13
|
+
SCRIPTS = Path(__file__).resolve().parent.parent / "scripts"
|
|
14
|
+
sys.path.insert(0, str(SCRIPTS))
|
|
15
|
+
|
|
16
|
+
import seek_fts # noqa: E402
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@pytest.fixture()
|
|
20
|
+
def fts_env(tmp_path, monkeypatch):
|
|
21
|
+
"""独立索引库 + 开关打开;返回 (状态目录, 搜索树)。"""
|
|
22
|
+
state = tmp_path / "state"
|
|
23
|
+
tree = tmp_path / "tree"
|
|
24
|
+
state.mkdir()
|
|
25
|
+
tree.mkdir()
|
|
26
|
+
monkeypatch.setenv("ARGO_STATE_DIR", str(state))
|
|
27
|
+
monkeypatch.setenv("ARGO_LOCAL_FTS", "1")
|
|
28
|
+
return state, tree
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _write(tree: Path, rel: str, text: str) -> Path:
|
|
32
|
+
p = tree / rel
|
|
33
|
+
p.parent.mkdir(parents=True, exist_ok=True)
|
|
34
|
+
p.write_text(text, encoding="utf-8")
|
|
35
|
+
return p
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _build(tree):
|
|
39
|
+
info = seek_fts.refresh(str(tree))
|
|
40
|
+
assert info["complete"] == 1, f"首建必须完成: {info}"
|
|
41
|
+
return info
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# ── 建库与查询 ────────────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
def test_build_and_english_query(fts_env):
|
|
47
|
+
_state, tree = fts_env
|
|
48
|
+
_write(tree, "a.py", "def alpha(x):\n return StateRoot(x)\n")
|
|
49
|
+
_write(tree, "b.md", "plain text without the term\n")
|
|
50
|
+
_build(tree)
|
|
51
|
+
rows = seek_fts.content_candidates("stateroot", str(tree))
|
|
52
|
+
assert rows == [(str(tree / "a.py"), 2, "return StateRoot(x)")]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_cjk_two_char_phrase(fts_env):
|
|
56
|
+
"""wechat-digger 实战坑回归:2 字中文必须以逐字短语命中。"""
|
|
57
|
+
_state, tree = fts_env
|
|
58
|
+
_write(tree, "n.md", "前面若干字,迁移完成于此。\n英文行 migration done\n")
|
|
59
|
+
_build(tree)
|
|
60
|
+
rows = seek_fts.content_candidates("迁移", str(tree))
|
|
61
|
+
assert rows == [(str(tree / "n.md"), 1, "前面若干字,迁移完成于此。")]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_case_insensitive_matches_rg(fts_env):
|
|
65
|
+
"""rg 恒定 -i:小写查询必须命中大写原文。"""
|
|
66
|
+
_state, tree = fts_env
|
|
67
|
+
_write(tree, "c.py", "USE UPPER CASE HERE\n")
|
|
68
|
+
_build(tree)
|
|
69
|
+
assert seek_fts.content_candidates("upper case", str(tree)) == [
|
|
70
|
+
(str(tree / "c.py"), 1, "USE UPPER CASE HERE")]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_line_truncation_matches_seek_truncate(fts_env):
|
|
74
|
+
_state, tree = fts_env
|
|
75
|
+
long_line = "x" * 200 + " needle " + "y" * 200
|
|
76
|
+
_write(tree, "l.txt", long_line + "\n")
|
|
77
|
+
_build(tree)
|
|
78
|
+
rows = seek_fts.content_candidates("needle", str(tree))
|
|
79
|
+
assert rows[0][2] == "x" * 119 + "…"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# ── 降级契约 ─────────────────────────────────────────────────────────────────
|
|
83
|
+
|
|
84
|
+
def test_disabled_flag_returns_none(fts_env, monkeypatch):
|
|
85
|
+
_state, tree = fts_env
|
|
86
|
+
_write(tree, "a.py", "needle here\n")
|
|
87
|
+
_build(tree)
|
|
88
|
+
monkeypatch.setenv("ARGO_LOCAL_FTS", "0")
|
|
89
|
+
assert seek_fts.content_candidates("needle", str(tree)) is None
|
|
90
|
+
assert not seek_fts.query_suitable("needle")
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def test_regex_metachars_rejected(fts_env):
|
|
94
|
+
_state, tree = fts_env
|
|
95
|
+
assert not seek_fts.query_suitable("foo.*bar")
|
|
96
|
+
assert not seek_fts.query_suitable("interface{}")
|
|
97
|
+
assert not seek_fts.query_suitable("a|b")
|
|
98
|
+
assert seek_fts.query_suitable("plain_words")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def test_incomplete_index_falls_back(fts_env):
|
|
102
|
+
"""未建成(complete=0)宁可慢不可漏:返回 None 走 rg。"""
|
|
103
|
+
_state, tree = fts_env
|
|
104
|
+
_write(tree, "a.py", "needle here\n")
|
|
105
|
+
seek_fts.refresh(str(tree), budget_s=0.0) # 0 预算:清单都不走完
|
|
106
|
+
assert seek_fts.content_candidates("needle", str(tree)) is None
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_zero_hit_on_complete_index_is_truthy_empty(fts_env):
|
|
110
|
+
"""索引完整时零命中是真没有([]),不再回退 rg 空扫。"""
|
|
111
|
+
_state, tree = fts_env
|
|
112
|
+
_write(tree, "a.py", "something\n")
|
|
113
|
+
_build(tree)
|
|
114
|
+
assert seek_fts.content_candidates("zzzznothing", str(tree)) == []
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def test_subdir_query_uses_parent_index(fts_env):
|
|
118
|
+
_state, tree = fts_env
|
|
119
|
+
_write(tree, "sub/deep.py", "needle in subdir\n")
|
|
120
|
+
_write(tree, "top.py", "needle at top\n")
|
|
121
|
+
_build(tree)
|
|
122
|
+
rows = seek_fts.content_candidates("needle", str(tree / "sub"))
|
|
123
|
+
assert rows == [(str(tree / "sub" / "deep.py"), 1, "needle in subdir")]
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# ── 增量生命周期 ─────────────────────────────────────────────────────────────
|
|
127
|
+
|
|
128
|
+
def test_incremental_add_modify_delete(fts_env):
|
|
129
|
+
_state, tree = fts_env
|
|
130
|
+
f = _write(tree, "a.py", "old content needle\n")
|
|
131
|
+
_write(tree, "gone.py", "needle will vanish\n")
|
|
132
|
+
_build(tree)
|
|
133
|
+
f.write_text("changed entirely\n", encoding="utf-8")
|
|
134
|
+
_write(tree, "new.py", "fresh needle lands\n", )
|
|
135
|
+
(tree / "gone.py").unlink()
|
|
136
|
+
_build(tree) # 再次 refresh 收齐增删改
|
|
137
|
+
assert seek_fts.content_candidates("needle", str(tree)) == [
|
|
138
|
+
(str(tree / "new.py"), 1, "fresh needle lands")]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def test_gitignore_respected_via_rg_listing(fts_env):
|
|
142
|
+
"""覆盖面 parity:git 仓里 .gitignore 的文件不进索引(rg --files 的语义)。
|
|
143
|
+
|
|
144
|
+
非 git 目录 rg 本来就不应用 .gitignore(搜索与清单同一行为,parity 成立),
|
|
145
|
+
所以这里必须建真仓。
|
|
146
|
+
"""
|
|
147
|
+
_state, tree = fts_env
|
|
148
|
+
subprocess.run(["git", "init", "-q", str(tree)], check=True, timeout=30)
|
|
149
|
+
(tree / ".gitignore").write_text("ignored*\n", encoding="utf-8")
|
|
150
|
+
_write(tree, "kept.py", "needle kept\n")
|
|
151
|
+
_write(tree, "ignored.py", "needle hidden by gitignore\n")
|
|
152
|
+
_build(tree)
|
|
153
|
+
assert seek_fts.content_candidates("needle", str(tree)) == [
|
|
154
|
+
(str(tree / "kept.py"), 1, "needle kept")]
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def test_binary_files_skipped(fts_env):
|
|
158
|
+
_state, tree = fts_env
|
|
159
|
+
(tree / "bin.dat").write_bytes(b"needle\x00binary")
|
|
160
|
+
_write(tree, "text.py", "needle text\n")
|
|
161
|
+
_build(tree)
|
|
162
|
+
assert seek_fts.content_candidates("needle", str(tree)) == [
|
|
163
|
+
(str(tree / "text.py"), 1, "needle text")]
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def test_large_body_capped(fts_env):
|
|
167
|
+
"""正文截到 _MAX_BODY_BYTES:更深行不在索引(已知偏差),截内行可命中。"""
|
|
168
|
+
_state, tree = fts_env
|
|
169
|
+
head = "needle in head\n"
|
|
170
|
+
body = "x" * seek_fts._MAX_BODY_BYTES + "\n" # 超界大行,挤掉 tail
|
|
171
|
+
tail = "needle in tail\n"
|
|
172
|
+
_write(tree, "big.log", head + body + tail)
|
|
173
|
+
_build(tree)
|
|
174
|
+
rows = seek_fts.content_candidates("needle", str(tree))
|
|
175
|
+
assert [r[2] for r in rows] == ["needle in head"]
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def test_oversized_file_skipped_entirely(fts_env, monkeypatch):
|
|
179
|
+
"""超过 _MAX_FILE_BYTES 的文件整体不入索引(2026-10-11:992MB 索引主因
|
|
180
|
+
是 9-33MB 会话转写被全文入库);限额调小便于测试,正文行 rg 兜底。"""
|
|
181
|
+
_state, tree = fts_env
|
|
182
|
+
monkeypatch.setattr(seek_fts, "_MAX_FILE_BYTES", 64)
|
|
183
|
+
_write(tree, "small.py", "needle small\n")
|
|
184
|
+
_write(tree, "rollout.jsonl", "x" * 200 + "\nneedle hidden\n")
|
|
185
|
+
_build(tree)
|
|
186
|
+
assert seek_fts.content_candidates("needle", str(tree)) == [
|
|
187
|
+
(str(tree / "small.py"), 1, "needle small")]
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def test_machine_output_dirs_excluded(fts_env):
|
|
191
|
+
"""rollout/logs/backups 目录不入索引(机器输出非知识文件,rg 主路仍在)。"""
|
|
192
|
+
_state, tree = fts_env
|
|
193
|
+
_write(tree, "keep.md", "needle kept\n")
|
|
194
|
+
_write(tree, "cli/rollout/sess.jsonl", "needle rollout\n")
|
|
195
|
+
_write(tree, "cli/log/app.jsonl", "needle log\n")
|
|
196
|
+
_write(tree, "v2/logs/run.txt", "needle logs\n")
|
|
197
|
+
_write(tree, "backups/dump.sql", "needle backup\n")
|
|
198
|
+
_build(tree)
|
|
199
|
+
assert seek_fts.content_candidates("needle", str(tree)) == [
|
|
200
|
+
(str(tree / "keep.md"), 1, "needle kept")]
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
# ── 一致性与健壮性 ───────────────────────────────────────────────────────────
|
|
204
|
+
|
|
205
|
+
def test_determinism_two_runs_same_order(fts_env):
|
|
206
|
+
_state, tree = fts_env
|
|
207
|
+
for i in range(6):
|
|
208
|
+
_write(tree, f"f{i}.py", f"needle {i}\n")
|
|
209
|
+
_build(tree)
|
|
210
|
+
first = seek_fts.content_candidates("needle", str(tree))
|
|
211
|
+
assert first == seek_fts.content_candidates("needle", str(tree))
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def test_corrupt_db_falls_back_to_rg(fts_env):
|
|
215
|
+
_state, tree = fts_env
|
|
216
|
+
_write(tree, "a.py", "needle here\n")
|
|
217
|
+
_build(tree)
|
|
218
|
+
seek_fts.index_db_path().write_bytes(b"not a sqlite file at all")
|
|
219
|
+
assert seek_fts.content_candidates("needle", str(tree)) is None
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def test_mtime_window_filters_files(fts_env):
|
|
223
|
+
import time as _t
|
|
224
|
+
_state, tree = fts_env
|
|
225
|
+
p = _write(tree, "a.py", "needle here\n")
|
|
226
|
+
_build(tree)
|
|
227
|
+
future = _t.time() + 3600
|
|
228
|
+
os.utime(p, (future, future))
|
|
229
|
+
seek_fts.refresh(str(tree)) # 把新 mtime 收进索引
|
|
230
|
+
rows = seek_fts.content_candidates("needle", str(tree),
|
|
231
|
+
until_ts=_t.time())
|
|
232
|
+
assert rows == [] # 文件 mtime 在窗口外 → 不命中
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def test_cli_rebuild_and_status(fts_env):
|
|
236
|
+
_state, tree = fts_env
|
|
237
|
+
_write(tree, "a.py", "needle\n")
|
|
238
|
+
env = dict(os.environ)
|
|
239
|
+
r = subprocess.run(
|
|
240
|
+
[sys.executable, str(SCRIPTS / "seek_fts.py"), "rebuild", str(tree)],
|
|
241
|
+
capture_output=True, text=True, env=env, timeout=60)
|
|
242
|
+
assert r.returncode == 0, r.stderr
|
|
243
|
+
assert json.loads(r.stdout)["complete"] == 1
|
|
244
|
+
r = subprocess.run(
|
|
245
|
+
[sys.executable, str(SCRIPTS / "seek_fts.py"), "status", str(tree)],
|
|
246
|
+
capture_output=True, text=True, env=env, timeout=60)
|
|
247
|
+
assert json.loads(r.stdout)["indexed"] == 1
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def test_seek_integration_fts_and_rg_parity(fts_env):
|
|
251
|
+
"""端到端:同一条查询,FTS 开与关(rg 主路)结果集一致。"""
|
|
252
|
+
_state, tree = fts_env
|
|
253
|
+
_write(tree, "x.py", "alpha does stateroot things\nsecond line\n")
|
|
254
|
+
_write(tree, "y.md", "另一段:状态根相关\nstateroot mentioned\n")
|
|
255
|
+
_build(tree)
|
|
256
|
+
env = dict(os.environ)
|
|
257
|
+
cmd = [sys.executable, str(SCRIPTS / "seek.py"), "stateroot",
|
|
258
|
+
"--path", str(tree), "--json", "--include-noise"]
|
|
259
|
+
on = json.loads(subprocess.run(cmd, capture_output=True, text=True,
|
|
260
|
+
env={**env, "ARGO_LOCAL_FTS": "1"},
|
|
261
|
+
timeout=60).stdout)["results"]
|
|
262
|
+
off = json.loads(subprocess.run(cmd, capture_output=True, text=True,
|
|
263
|
+
env={**env, "ARGO_LOCAL_FTS": "0"},
|
|
264
|
+
timeout=60).stdout)["results"]
|
|
265
|
+
assert [(r["path"], r["line"]) for r in on] == \
|
|
266
|
+
[(r["path"], r["line"]) for r in off]
|
|
267
|
+
assert on, "两条路都必须命中"
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def test_type_filter_bypasses_fts_fastpath(fts_env):
|
|
271
|
+
"""带 --type 时不得走 FTS 快路(快路不做扩展名过滤,会静默混入范围外结果)。
|
|
272
|
+
|
|
273
|
+
回归(2026-10-12):此前 --type py 在 ARGO_LOCAL_FTS=1 下仍命中 .md 文件。
|
|
274
|
+
"""
|
|
275
|
+
_state, tree = fts_env
|
|
276
|
+
_write(tree, "hit.py", "stateroot in python\n")
|
|
277
|
+
_write(tree, "noise.md", "stateroot in markdown\n")
|
|
278
|
+
_build(tree)
|
|
279
|
+
env = dict(os.environ)
|
|
280
|
+
cmd = [sys.executable, str(SCRIPTS / "seek.py"), "stateroot",
|
|
281
|
+
"--path", str(tree), "--type", "py", "--json", "--include-noise"]
|
|
282
|
+
r = subprocess.run(cmd, capture_output=True, text=True,
|
|
283
|
+
env={**env, "ARGO_LOCAL_FTS": "1"}, timeout=60)
|
|
284
|
+
results = json.loads(r.stdout)["results"]
|
|
285
|
+
assert results, "py 文件必须命中"
|
|
286
|
+
assert all(x["path"].endswith(".py") for x in results), \
|
|
287
|
+
f"--type py 下混入了非 py 结果: {[x['path'] for x in results]}"
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def test_exclude_filter_bypasses_fts_fastpath(fts_env):
|
|
291
|
+
"""带 --exclude 时不得走 FTS 快路(快路不做排除,会绕掉自污染守卫)。"""
|
|
292
|
+
_state, tree = fts_env
|
|
293
|
+
_write(tree, "keep.py", "stateroot keep\n")
|
|
294
|
+
_write(tree, "skip.py", "stateroot skip\n")
|
|
295
|
+
_build(tree)
|
|
296
|
+
env = dict(os.environ)
|
|
297
|
+
cmd = [sys.executable, str(SCRIPTS / "seek.py"), "stateroot",
|
|
298
|
+
"--path", str(tree), "--exclude", "skip.py", "--json",
|
|
299
|
+
"--include-noise"]
|
|
300
|
+
r = subprocess.run(cmd, capture_output=True, text=True,
|
|
301
|
+
env={**env, "ARGO_LOCAL_FTS": "1"}, timeout=60)
|
|
302
|
+
results = json.loads(r.stdout)["results"]
|
|
303
|
+
assert results and all(not x["path"].endswith("skip.py") for x in results)
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def test_like_prefix_dir_boundary(tmp_path):
|
|
307
|
+
"""_like_prefix 目录语义:/a/b 不得匹配 /a/bc(兄弟树误配回归)。"""
|
|
308
|
+
(tmp_path / "a" / "b").mkdir(parents=True)
|
|
309
|
+
(tmp_path / "a" / "bc").mkdir(parents=True)
|
|
310
|
+
pat = seek_fts._like_prefix(str(tmp_path / "a" / "b"))
|
|
311
|
+
assert pat.endswith(os.sep + "%")
|
|
312
|
+
# 根路径特判://% 永不匹配(静默假空回归)
|
|
313
|
+
assert seek_fts._like_prefix("/") == "/%"
|