argo-search 1.0.1 → 2.9.8
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 +735 -0
- package/README.es.md +777 -0
- package/README.ja.md +777 -0
- package/README.ko.md +777 -0
- package/README.md +778 -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/why-better.svg +104 -0
- package/assets/readme/workflow.svg +83 -0
- package/backends/domain_profiles.json +2356 -96
- package/backends/engine_registry.yaml +3428 -503
- package/backends/query_synonyms_cn.json +35 -0
- package/backends/quota_profiles.json +2488 -160
- package/backends/source_types_cn.json +109 -0
- package/backends/text_lexicon.json +44 -0
- package/bin/argo +772 -0
- package/bin/argo.js +102 -39
- package/config.yaml +5139 -367
- 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 +575 -0
- package/docs/MCP_SETUP.md +108 -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/RELEASE_NOTES_v2.9.8.md +73 -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/cfets.yaml +41 -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/defillama.yaml +38 -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 +36 -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/gleif.yaml +55 -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/hkex.yaml +40 -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/keenable_free.yaml +36 -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/shfe.yaml +39 -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/tavily_free.yaml +56 -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/yuanbao.yaml +93 -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 +106 -0
- package/package.json +55 -12
- package/packages/dsh-plugin/README.md +152 -0
- package/packages/dsh-plugin/cordis.patch.yml +48 -0
- package/packages/dsh-plugin/dsh/client.js +1533 -0
- package/packages/dsh-plugin/dsh/diagnostics.js +54 -0
- package/packages/dsh-plugin/dsh/index.js +527 -0
- package/packages/dsh-plugin/dsh/native-tools.mjs +749 -0
- package/packages/dsh-plugin/dsh/runner.js +666 -0
- package/packages/dsh-plugin/dsh/wide-research.js +878 -0
- package/packages/dsh-plugin/package.json +38 -0
- package/packages/dsh-plugin/scripts/sync-local.sh +70 -0
- package/packages/dsh-plugin/test/client.test.js +406 -0
- package/packages/dsh-plugin/test/config.test.js +30 -0
- package/packages/dsh-plugin/test/diagnostics.test.js +28 -0
- package/packages/dsh-plugin/test/index.test.js +1382 -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 +294 -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/article_meta.py +131 -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/budget.py +247 -0
- package/scripts/budget_cli.py +93 -0
- package/scripts/build_release_assets.sh +65 -0
- package/scripts/burstiness_detector.py +147 -0
- package/scripts/cache.py +1066 -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/ci_drift_gate.py +90 -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_boundary.py +46 -0
- package/scripts/content_security.py +685 -0
- package/scripts/content_signals.py +751 -0
- package/scripts/crawl.py +74 -35
- package/scripts/cross_lingual_trace.py +293 -0
- package/scripts/daemon.py +866 -0
- package/scripts/digup_bridge.py +214 -0
- package/scripts/dispatch_result.py +98 -0
- package/scripts/engine_admission.py +366 -0
- package/scripts/engine_dispatch.py +982 -0
- package/scripts/engine_env.py +539 -0
- package/scripts/engine_failure.py +411 -0
- package/scripts/engine_families.py +738 -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 +799 -294
- package/scripts/engines_base.py +1521 -0
- package/scripts/engines_builders.py +310 -0
- package/scripts/engines_builders_batch10.py +204 -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_batch14.py +656 -0
- package/scripts/engines_builders_batch15.py +249 -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_keyless.py +111 -0
- package/scripts/engines_builders_search.py +440 -0
- package/scripts/engines_builders_tech.py +1359 -0
- package/scripts/evidence.py +620 -166
- package/scripts/evidence_loop.py +624 -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 +1804 -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 +195 -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.swift +126 -0
- package/scripts/install.ps1 +166 -0
- package/scripts/install.sh +221 -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_image.py +970 -0
- package/scripts/local_seek.py +402 -0
- package/scripts/macro_countries.py +97 -0
- package/scripts/matrix_search_eval.py +1187 -0
- package/scripts/mcp_compact.py +234 -0
- package/scripts/mcp_diag.py +8 -3
- package/scripts/mcp_handlers.py +492 -0
- package/scripts/mcp_handlers_surface.py +157 -0
- package/scripts/mcp_launch.sh +124 -0
- package/scripts/mcp_local.py +241 -0
- package/scripts/mcp_server.py +125 -419
- package/scripts/mcp_setup.py +431 -0
- package/scripts/mcp_tools.py +331 -0
- package/scripts/mcp_transport.py +191 -0
- package/scripts/mcp_warm.py +127 -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/output_transparency.py +200 -0
- package/scripts/paid_policy.py +98 -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 +633 -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/recovery_runner.py +150 -0
- package/scripts/redskill/redskill_engine.py +332 -0
- package/scripts/regression_p0p1.py +318 -0
- package/scripts/replay_eval.py +658 -0
- package/scripts/rerank_tfidf.py +225 -0
- package/scripts/research.py +607 -403
- package/scripts/research_cli.py +361 -0
- package/scripts/research_dossier.py +492 -0
- package/scripts/research_expand.py +169 -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/retry_policy.py +76 -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 +243 -0
- package/scripts/route_combo.py +917 -0
- package/scripts/route_domains.py +341 -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 +886 -406
- package/scripts/search_attribution.py +185 -0
- package/scripts/search_benchmark.py +407 -0
- package/scripts/search_cli.py +640 -0
- package/scripts/search_entry.py +395 -0
- package/scripts/search_output.py +690 -0
- package/scripts/search_pipeline.py +926 -0
- package/scripts/search_rank.py +991 -0
- package/scripts/search_types.py +129 -16
- package/scripts/seek_locator.py +68 -0
- package/scripts/semantic_evidence.py +391 -0
- package/scripts/serp_guard.py +336 -0
- package/scripts/serp_kill_log.py +74 -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 +107 -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 +447 -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/scripts/zhihu_quota.py +139 -0
- package/sub-skills/ego-search/SKILL.md +253 -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/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/local-search/SKILL.md +50 -53
- package/sub-skills/local-search/bm25.py +186 -0
- package/sub-skills/local-search/cli_runner.py +331 -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/parsers.py +328 -0
- package/sub-skills/local-search/search_v3.py +716 -242
- 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/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 +197 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""research_cli.py — 深度研究 CLI(从 research.py 拆出,压文件规模)。"""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
import sys
|
|
9
|
+
from typing import Any
|
|
10
|
+
from cli_io import dumps, ensure_utf8_stdio
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _load_work_packages(raw: str | None) -> Any:
|
|
14
|
+
if not raw:
|
|
15
|
+
return None
|
|
16
|
+
text = raw.strip()
|
|
17
|
+
if text.startswith("[") or text.startswith("{"):
|
|
18
|
+
return text
|
|
19
|
+
with open(text, encoding="utf-8") as fh:
|
|
20
|
+
return fh.read()
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main() -> None:
|
|
24
|
+
ensure_utf8_stdio() # 入口第一件事:钉住 stdout/stderr 编码(见 cli_io)
|
|
25
|
+
parser = argparse.ArgumentParser(description="深度研究取证")
|
|
26
|
+
parser.add_argument("query", nargs="?", default=None, help="研究查询(--topic help 时可省略)")
|
|
27
|
+
parser.add_argument("--sub-queries", type=int, default=None, help="扩词数量(有工作包时忽略)")
|
|
28
|
+
parser.add_argument("-n", "--max-results", type=int, default=None, help="每个子查询最大结果数")
|
|
29
|
+
parser.add_argument("--timeout", type=int, default=15, help="超时秒数")
|
|
30
|
+
parser.add_argument("--depth", choices=["fast", "balanced", "deep"], default=None)
|
|
31
|
+
parser.add_argument(
|
|
32
|
+
"--mode",
|
|
33
|
+
choices=["fast", "auto", "deep", "budget", "social-sentiment"],
|
|
34
|
+
default="auto",
|
|
35
|
+
)
|
|
36
|
+
parser.add_argument("--budget", type=int, default=None, help="子查询工具调用上限")
|
|
37
|
+
parser.add_argument(
|
|
38
|
+
"--route-strategy",
|
|
39
|
+
choices=["local_first", "cost_aware", "full"],
|
|
40
|
+
default=None,
|
|
41
|
+
)
|
|
42
|
+
parser.add_argument(
|
|
43
|
+
"--work-packages",
|
|
44
|
+
default=None,
|
|
45
|
+
help="工作包 JSON 文件路径或内联 JSON 数组;有则跳过扩词、按 depends_on 分阶段",
|
|
46
|
+
)
|
|
47
|
+
parser.add_argument(
|
|
48
|
+
"--broaden", action="store_true",
|
|
49
|
+
help="第一轮来源不足 15 个时自动追加英文/学术方向补充搜索",
|
|
50
|
+
)
|
|
51
|
+
parser.add_argument("--platforms", type=str, default=None, help="社交平台,逗号分隔")
|
|
52
|
+
parser.add_argument(
|
|
53
|
+
"--topic",
|
|
54
|
+
type=str,
|
|
55
|
+
default=None,
|
|
56
|
+
help="选题类型。--topic help 列出全部",
|
|
57
|
+
)
|
|
58
|
+
parser.add_argument("--no-auto-topic", action="store_true")
|
|
59
|
+
parser.add_argument("--json", action="store_true")
|
|
60
|
+
parser.add_argument("--no-archive", action="store_true")
|
|
61
|
+
parser.add_argument("--archive-dir", type=str, default=None)
|
|
62
|
+
parser.add_argument("--archive-tag", default=None)
|
|
63
|
+
parser.add_argument("--archive-note", default=None)
|
|
64
|
+
parser.add_argument(
|
|
65
|
+
"--verify", nargs="?", const=3, type=int, default=None, metavar="TOP_K",
|
|
66
|
+
)
|
|
67
|
+
parser.add_argument(
|
|
68
|
+
"--deep-read", action="store_true",
|
|
69
|
+
help="对 top 3-5 结果 fetch 全文摘要写入 fulltext_excerpts",
|
|
70
|
+
)
|
|
71
|
+
parser.add_argument(
|
|
72
|
+
"--allow-recompute", action="store_true",
|
|
73
|
+
help="授权执行工作包 recompute 计算脚本(默认拒绝:没明确授权就不执行)",
|
|
74
|
+
)
|
|
75
|
+
parser.add_argument(
|
|
76
|
+
"--search-archive", metavar="主题词",
|
|
77
|
+
help="检索已有研究/搜索归档(成果复用):按主题词列出历史 run",
|
|
78
|
+
)
|
|
79
|
+
parser.add_argument("--archive-since", default=None, help="归档检索起始日期")
|
|
80
|
+
parser.add_argument("--archive-until", default=None, help="归档检索截止日期")
|
|
81
|
+
args = parser.parse_args()
|
|
82
|
+
do_archive = not args.no_archive
|
|
83
|
+
|
|
84
|
+
if args.search_archive:
|
|
85
|
+
try:
|
|
86
|
+
from archive_run import search_archive
|
|
87
|
+
hits = search_archive(
|
|
88
|
+
args.search_archive,
|
|
89
|
+
since=args.archive_since, until=args.archive_until,
|
|
90
|
+
)
|
|
91
|
+
except Exception as e:
|
|
92
|
+
print(f"[search-archive] {type(e).__name__}: {e}")
|
|
93
|
+
return
|
|
94
|
+
if not hits:
|
|
95
|
+
print(
|
|
96
|
+
f"未找到归档命中:{args.search_archive}"
|
|
97
|
+
f"(根目录见 archive_run.resolve_archive_root;"
|
|
98
|
+
"先跑带 --archive 的研究/搜索生成索引)"
|
|
99
|
+
)
|
|
100
|
+
return
|
|
101
|
+
print(f"归档命中 {len(hits)} 条(主题:{args.search_archive})\n")
|
|
102
|
+
for h in hits:
|
|
103
|
+
print(f"[{h['run_id']}] {h['packed_at']}_{h['query']}")
|
|
104
|
+
print(f" tag={h['tag']} source={h['source']} "
|
|
105
|
+
f"counts={h['counts']}")
|
|
106
|
+
print(f" → {h['run_dir']}")
|
|
107
|
+
return
|
|
108
|
+
|
|
109
|
+
from research import (
|
|
110
|
+
deep_research,
|
|
111
|
+
social_sentiment_research,
|
|
112
|
+
_print_social_report,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
profile_obj: dict[str, Any] | None = None
|
|
116
|
+
profile_applied = None
|
|
117
|
+
profile_key = None
|
|
118
|
+
try:
|
|
119
|
+
from topic_research_profiles import (
|
|
120
|
+
get_profile, list_profiles, detect_topic_from_query, list_triggers,
|
|
121
|
+
)
|
|
122
|
+
except ImportError:
|
|
123
|
+
get_profile = list_profiles = detect_topic_from_query = list_triggers = None # type: ignore
|
|
124
|
+
|
|
125
|
+
if args.topic and str(args.topic).lower() in ("help", "list", "--help"):
|
|
126
|
+
if list_profiles:
|
|
127
|
+
print("可用选题类型(--topic):")
|
|
128
|
+
print(f" {'键名':15s} {'名称':14s} {'深度':8s} {'领域':10s} {'引擎':36s}")
|
|
129
|
+
print(f" {'-'*15} {'-'*14} {'-'*8} {'-'*10} {'-'*36}")
|
|
130
|
+
for p in list_profiles():
|
|
131
|
+
engines = ", ".join(p["engines"][:3])
|
|
132
|
+
print(
|
|
133
|
+
f" {p['key']:15s} {p['name']:14s} {p['depth']:8s} "
|
|
134
|
+
f"{p.get('discipline', ''):10s} {engines}"
|
|
135
|
+
)
|
|
136
|
+
print()
|
|
137
|
+
if list_triggers:
|
|
138
|
+
trig = list_triggers()
|
|
139
|
+
print("深度研究触发词(示例):", "、".join(trig["deep_research_triggers"][:8]), "…")
|
|
140
|
+
print("主斜杠:", trig.get("main_slash") or "/argo")
|
|
141
|
+
print("子技能斜杠:", " ".join(trig.get("slash_commands") or []))
|
|
142
|
+
print("深度研究斜杠:", " ".join(trig.get("research_slash_commands") or [])[:120])
|
|
143
|
+
print()
|
|
144
|
+
print("示例:")
|
|
145
|
+
print(" python3 research.py \"Claude Opus 5\" --topic ai")
|
|
146
|
+
print(" python3 research.py \"固态电池\" --work-packages '[{\"id\":\"d\",\"question\":\"定义\"}]'")
|
|
147
|
+
sys.exit(0)
|
|
148
|
+
|
|
149
|
+
if not args.query:
|
|
150
|
+
parser.error("需要研究查询;或使用 --topic help 查看选题与触发词")
|
|
151
|
+
|
|
152
|
+
if args.topic and get_profile and list_profiles:
|
|
153
|
+
profile_obj = get_profile(args.topic)
|
|
154
|
+
if not profile_obj:
|
|
155
|
+
available = ", ".join(p["key"] for p in list_profiles())
|
|
156
|
+
print(f"⚠️ 未知选题类型 '{args.topic}'。可用: {available}", file=sys.stderr)
|
|
157
|
+
sys.exit(1)
|
|
158
|
+
profile_key = args.topic.strip().lower()
|
|
159
|
+
from topic_research_profiles import ALIASES
|
|
160
|
+
profile_key = ALIASES.get(args.topic.strip()) or ALIASES.get(profile_key) or profile_key
|
|
161
|
+
elif not args.no_auto_topic and detect_topic_from_query and get_profile:
|
|
162
|
+
auto_key = detect_topic_from_query(args.query)
|
|
163
|
+
if auto_key:
|
|
164
|
+
profile_obj = get_profile(auto_key)
|
|
165
|
+
profile_key = auto_key
|
|
166
|
+
if profile_obj and not args.json:
|
|
167
|
+
print(f" [topic auto] → {auto_key}({profile_obj['name']})", file=sys.stderr)
|
|
168
|
+
|
|
169
|
+
if profile_obj:
|
|
170
|
+
if args.sub_queries is None:
|
|
171
|
+
args.sub_queries = int(profile_obj.get("sub_queries") or 4)
|
|
172
|
+
if args.max_results is None:
|
|
173
|
+
args.max_results = int(profile_obj.get("max_results") or 5)
|
|
174
|
+
if args.depth is None:
|
|
175
|
+
args.depth = str(profile_obj.get("depth") or "balanced")
|
|
176
|
+
profile_applied = profile_obj["name"]
|
|
177
|
+
|
|
178
|
+
if args.sub_queries is None:
|
|
179
|
+
args.sub_queries = 4
|
|
180
|
+
if args.max_results is None:
|
|
181
|
+
args.max_results = 5
|
|
182
|
+
if args.depth is None:
|
|
183
|
+
args.depth = "balanced"
|
|
184
|
+
|
|
185
|
+
try:
|
|
186
|
+
work_packages = _load_work_packages(args.work_packages)
|
|
187
|
+
except (OSError, ValueError, json.JSONDecodeError) as e:
|
|
188
|
+
parser.error(f"work-packages 无法解析: {e}")
|
|
189
|
+
|
|
190
|
+
if args.mode == "social-sentiment":
|
|
191
|
+
platforms = [p.strip() for p in args.platforms.split(",")] if args.platforms else None
|
|
192
|
+
report = social_sentiment_research(args.query, platforms, args.max_results)
|
|
193
|
+
else:
|
|
194
|
+
report = deep_research(
|
|
195
|
+
args.query, args.sub_queries, args.max_results,
|
|
196
|
+
args.timeout, args.depth, args.mode,
|
|
197
|
+
profile=profile_obj,
|
|
198
|
+
budget=args.budget,
|
|
199
|
+
route_strategy=args.route_strategy,
|
|
200
|
+
work_packages=work_packages,
|
|
201
|
+
allow_recompute=args.allow_recompute,
|
|
202
|
+
broaden=args.broaden,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
if profile_applied:
|
|
206
|
+
report["topic_profile"] = profile_applied
|
|
207
|
+
if profile_key:
|
|
208
|
+
report["topic_profile_key"] = profile_key
|
|
209
|
+
|
|
210
|
+
if args.verify:
|
|
211
|
+
try:
|
|
212
|
+
from evidence_loop import verify_results
|
|
213
|
+
targets = []
|
|
214
|
+
for c in report.get("citations") or report.get("sources") or []:
|
|
215
|
+
if isinstance(c, dict) and c.get("url"):
|
|
216
|
+
targets.append({
|
|
217
|
+
"url": c.get("url"),
|
|
218
|
+
"title": c.get("title") or "",
|
|
219
|
+
"snippet": c.get("snippet") or "",
|
|
220
|
+
})
|
|
221
|
+
if not targets:
|
|
222
|
+
for block in report.get("key_findings") or []:
|
|
223
|
+
if not isinstance(block, dict):
|
|
224
|
+
continue
|
|
225
|
+
top = block.get("top_result") or {}
|
|
226
|
+
if top.get("url"):
|
|
227
|
+
targets.append({
|
|
228
|
+
"url": top.get("url"),
|
|
229
|
+
"title": top.get("title") or "",
|
|
230
|
+
"snippet": top.get("snippet") or "",
|
|
231
|
+
})
|
|
232
|
+
v = verify_results(targets[:args.verify], args.query, top_k=args.verify)
|
|
233
|
+
report["verify"] = v
|
|
234
|
+
from research_gates import evaluate_dossier_gates
|
|
235
|
+
report["quality_gate_results"] = evaluate_dossier_gates(report)
|
|
236
|
+
report["conclusion_cap"] = report["quality_gate_results"]["conclusion_cap"]
|
|
237
|
+
if not args.json:
|
|
238
|
+
rs = v.get("revision_summary") or {}
|
|
239
|
+
print(
|
|
240
|
+
f" [verify] 核验 {rs.get('n', 0)} 条,"
|
|
241
|
+
f"improved={rs.get('improved', 0)} unchanged={rs.get('unchanged', 0)} "
|
|
242
|
+
f"degraded={rs.get('degraded', 0)} mean_delta={rs.get('mean_delta', 0)}",
|
|
243
|
+
file=sys.stderr,
|
|
244
|
+
)
|
|
245
|
+
except Exception as e:
|
|
246
|
+
print(f" [verify error] {type(e).__name__}: {e}", file=sys.stderr)
|
|
247
|
+
|
|
248
|
+
if args.deep_read:
|
|
249
|
+
try:
|
|
250
|
+
from fetch import fetch_pages_parallel
|
|
251
|
+
targets = []
|
|
252
|
+
for c in report.get("citations") or report.get("sources") or []:
|
|
253
|
+
if isinstance(c, dict) and c.get("url"):
|
|
254
|
+
targets.append({
|
|
255
|
+
"url": c.get("url"),
|
|
256
|
+
"title": c.get("title") or "",
|
|
257
|
+
"snippet": c.get("snippet") or "",
|
|
258
|
+
"score": c.get("score", 0),
|
|
259
|
+
})
|
|
260
|
+
targets.sort(key=lambda x: x.get("score", 0), reverse=True)
|
|
261
|
+
urls = [t["url"] for t in targets[:5]]
|
|
262
|
+
if urls:
|
|
263
|
+
results = fetch_pages_parallel(urls, max_chars=8000, timeout=8, max_workers=3)
|
|
264
|
+
excerpts = []
|
|
265
|
+
for r in results:
|
|
266
|
+
excerpts.append({
|
|
267
|
+
"url": r.get("url", ""),
|
|
268
|
+
"title": next((t["title"] for t in targets if t["url"] == r.get("url")), ""),
|
|
269
|
+
"content_excerpt": (r.get("content") or "")[:2000],
|
|
270
|
+
"length": r.get("length", 0),
|
|
271
|
+
"success": r.get("success", False),
|
|
272
|
+
})
|
|
273
|
+
report["fulltext_excerpts"] = excerpts
|
|
274
|
+
from research_gates import evaluate_dossier_gates
|
|
275
|
+
report["quality_gate_results"] = evaluate_dossier_gates(report)
|
|
276
|
+
report["conclusion_cap"] = report["quality_gate_results"]["conclusion_cap"]
|
|
277
|
+
if not args.json:
|
|
278
|
+
ok = sum(1 for e in excerpts if e.get("success"))
|
|
279
|
+
print(f" [deep-read] fetch {len(excerpts)} 篇,成功 {ok} 篇", file=sys.stderr)
|
|
280
|
+
except Exception as e:
|
|
281
|
+
print(f" [deep-read error] {type(e).__name__}: {e}", file=sys.stderr)
|
|
282
|
+
|
|
283
|
+
if do_archive:
|
|
284
|
+
try:
|
|
285
|
+
from archive_run import write_search_archive, resolve_archive_root
|
|
286
|
+
flat_results = []
|
|
287
|
+
for c in report.get("citations") or report.get("sources") or []:
|
|
288
|
+
if isinstance(c, dict) and c.get("url"):
|
|
289
|
+
flat_results.append({
|
|
290
|
+
"title": c.get("title") or c.get("url"),
|
|
291
|
+
"url": c.get("url"),
|
|
292
|
+
"snippet": c.get("snippet") or "",
|
|
293
|
+
"source": c.get("source") or c.get("engine") or "research",
|
|
294
|
+
"score": c.get("score"),
|
|
295
|
+
})
|
|
296
|
+
if not flat_results:
|
|
297
|
+
for block in report.get("key_findings") or []:
|
|
298
|
+
if not isinstance(block, dict):
|
|
299
|
+
continue
|
|
300
|
+
top = block.get("top_result") or {}
|
|
301
|
+
if top.get("url"):
|
|
302
|
+
flat_results.append({
|
|
303
|
+
"title": top.get("title") or top.get("url"),
|
|
304
|
+
"url": top.get("url"),
|
|
305
|
+
"snippet": top.get("snippet") or "",
|
|
306
|
+
"source": top.get("source") or "research",
|
|
307
|
+
})
|
|
308
|
+
envelope = {
|
|
309
|
+
"query": report.get("query") or args.query,
|
|
310
|
+
"status": "completed",
|
|
311
|
+
"mode": report.get("mode") or args.mode,
|
|
312
|
+
"depth": args.depth,
|
|
313
|
+
"engine": "research",
|
|
314
|
+
"engines": report.get("engines_used") or ["research"],
|
|
315
|
+
"results": flat_results,
|
|
316
|
+
"count": len(flat_results),
|
|
317
|
+
"sources": report.get("sources") or [],
|
|
318
|
+
"citations": report.get("citations") or [],
|
|
319
|
+
"input_kind": "keyword",
|
|
320
|
+
"limitations": [
|
|
321
|
+
"research archive: dossier; snippets not verified body",
|
|
322
|
+
],
|
|
323
|
+
"research_meta": {
|
|
324
|
+
"kind": report.get("kind"),
|
|
325
|
+
"sub_queries": report.get("sub_queries"),
|
|
326
|
+
"work_packages": report.get("work_packages"),
|
|
327
|
+
"gaps": report.get("gaps"),
|
|
328
|
+
"quality_gate_results": report.get("quality_gate_results"),
|
|
329
|
+
"topic_profile": report.get("topic_profile"),
|
|
330
|
+
"key_findings": report.get("key_findings"),
|
|
331
|
+
},
|
|
332
|
+
"errors": report.get("errors") or [],
|
|
333
|
+
}
|
|
334
|
+
root = resolve_archive_root(args.archive_dir) if args.archive_dir else None
|
|
335
|
+
meta = write_search_archive(
|
|
336
|
+
envelope,
|
|
337
|
+
root=root,
|
|
338
|
+
tag=args.archive_tag or "research",
|
|
339
|
+
note=args.archive_note,
|
|
340
|
+
source="argo_research",
|
|
341
|
+
)
|
|
342
|
+
report["archive"] = meta
|
|
343
|
+
if not args.json:
|
|
344
|
+
print(f" [archive] {meta.get('run_id')} → {meta.get('run_dir')}", file=sys.stderr)
|
|
345
|
+
except Exception as e:
|
|
346
|
+
print(f" [archive error] {type(e).__name__}: {e}", file=sys.stderr)
|
|
347
|
+
|
|
348
|
+
if args.json:
|
|
349
|
+
print(dumps(report))
|
|
350
|
+
else:
|
|
351
|
+
if profile_applied:
|
|
352
|
+
print(f"📋 选题类型:{profile_applied}", file=sys.stderr)
|
|
353
|
+
if report.get("mode") == "social-sentiment":
|
|
354
|
+
_print_social_report(report)
|
|
355
|
+
else:
|
|
356
|
+
from research_report import print_deep_report
|
|
357
|
+
print_deep_report(report)
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
if __name__ == "__main__":
|
|
361
|
+
main()
|