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/cache.py
CHANGED
|
@@ -42,6 +42,7 @@ except ImportError:
|
|
|
42
42
|
|
|
43
43
|
# 本地状态目录唯一来源(env ARGO_STATE_DIR → config cache.db_path 父目录 → 旧路径)
|
|
44
44
|
import argo_paths
|
|
45
|
+
import engine_states # 状态词表唯一真源:缓存层级(2026-11-09 收口)
|
|
45
46
|
from cache_guard import (
|
|
46
47
|
DegradedCacheRejected,
|
|
47
48
|
RECOVERED_DEGRADED_TTL,
|
|
@@ -689,9 +690,8 @@ class SQLiteCache:
|
|
|
689
690
|
|
|
690
691
|
# ── 双层缓存入口 ───────────────────────────────────────────────────────────────
|
|
691
692
|
|
|
692
|
-
# 空结果正缓存极短 TTL(秒)—
|
|
693
|
+
# 空结果正缓存极短 TTL(秒)— 避免把失败固化成「无结果」;fetch URL 默认 1 小时
|
|
693
694
|
EMPTY_RESULT_TTL = 45
|
|
694
|
-
# fetch URL 默认 TTL
|
|
695
695
|
FETCH_DEFAULT_TTL = 3600
|
|
696
696
|
|
|
697
697
|
# 证据分在 fetch 条目里的子键名。做成模块级常量而不是类属性:类会被测试
|
|
@@ -892,7 +892,7 @@ class SearchCache:
|
|
|
892
892
|
out = dict(hit)
|
|
893
893
|
out["results"] = [dict(r) if isinstance(r, dict) else r
|
|
894
894
|
for r in (hit.get("results") or [])]
|
|
895
|
-
out["_cache_level"] =
|
|
895
|
+
out["_cache_level"] = engine_states.CACHE_LEVEL_L1
|
|
896
896
|
return out
|
|
897
897
|
self._l1.remove(key)
|
|
898
898
|
if time.monotonic() - self._miss_memo[0] < 0.05 and key in self._miss_memo[1]:
|
|
@@ -904,7 +904,7 @@ class SearchCache:
|
|
|
904
904
|
out = dict(hit)
|
|
905
905
|
out["results"] = [dict(r) if isinstance(r, dict) else r
|
|
906
906
|
for r in (hit.get("results") or [])]
|
|
907
|
-
out["_cache_level"] =
|
|
907
|
+
out["_cache_level"] = engine_states.CACHE_LEVEL_L2
|
|
908
908
|
return out
|
|
909
909
|
return None
|
|
910
910
|
|
|
@@ -987,7 +987,7 @@ class SearchCache:
|
|
|
987
987
|
sliced = self._soft_slice(s_hit, max_results)
|
|
988
988
|
if sliced is not None:
|
|
989
989
|
out = dict(sliced)
|
|
990
|
-
out["_cache_level"] =
|
|
990
|
+
out["_cache_level"] = engine_states.CACHE_LEVEL_L2
|
|
991
991
|
out["_semantic_hit"] = True
|
|
992
992
|
out["_semantic_similarity"] = cand["similarity"]
|
|
993
993
|
out["_semantic_query"] = cand["query"]
|
|
@@ -1184,9 +1184,9 @@ class SearchCache:
|
|
|
1184
1184
|
# ① 反面记录:以前抓过、结果不可用
|
|
1185
1185
|
if hit and not hit.get("success"):
|
|
1186
1186
|
err = str(hit.get("error") or "")
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
"reason": "robots" if
|
|
1187
|
+
_robots = hit.get("fetch_method") == engine_states.FETCH_ROBOTS_BLOCKED
|
|
1188
|
+
ret = {"status": "blocked" if _robots else "poor",
|
|
1189
|
+
"reason": "robots" if _robots
|
|
1190
1190
|
else (hit.get("fetch_method") or "fetch_failed")}
|
|
1191
1191
|
if err:
|
|
1192
1192
|
ret["detail"] = err[:120]
|
package/scripts/cache_guard.py
CHANGED
|
@@ -38,6 +38,7 @@ from collections.abc import Callable
|
|
|
38
38
|
from typing import Any
|
|
39
39
|
|
|
40
40
|
from except_sets import OPT_IMPORT
|
|
41
|
+
import engine_states # 状态词表唯一真源(2026-11-09 收口)
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
class DegradedCacheRejected(ValueError):
|
|
@@ -61,8 +62,11 @@ class FailedStateCacheRejected(ValueError):
|
|
|
61
62
|
# 确实混有「真的没有」,负缓存是既有设计(EMPTY_RESULT_TTL),等一会重试
|
|
62
63
|
# 由 TTL 自然兜底。本类的共同点:**换环境就能好**,缓存它没有信息量。
|
|
63
64
|
_STATE_FAIL_STATUSES = frozenset({
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
engine_states.OUTCOME_SKIPPED_MISSING_ENV,
|
|
66
|
+
engine_states.OUTCOME_SKIPPED_CIRCUIT_OPEN,
|
|
67
|
+
engine_states.OUTCOME_AUTH_FAILED,
|
|
68
|
+
engine_states.OUTCOME_QUOTA_EXHAUSTED,
|
|
69
|
+
engine_states.OUTCOME_SKIPPED_QUOTA,
|
|
66
70
|
})
|
|
67
71
|
|
|
68
72
|
# 配额耗尽错误关键词(唯一来源):classify_engine_outcome 的 quota-exhausted
|
|
@@ -71,7 +75,7 @@ _QUOTA_ERROR_KEYWORDS = ("quota", "10406", "insufficient balance",
|
|
|
71
75
|
"insufficient funds", "not enough money",
|
|
72
76
|
"余额不足", "额度不足", "配额耗尽")
|
|
73
77
|
|
|
74
|
-
# builder 路径漏到 status=
|
|
78
|
+
# builder 路径漏到 status=error 的缺密钥形态:路由层 env 拦截覆盖不到
|
|
75
79
|
# 自定义 required_env 的引擎(search.py:192-209 docstring 自认的缺口),
|
|
76
80
|
# issue #12 的 parallel/seltz/you 就读裸名——状态层 env_ready=True、执行层
|
|
77
81
|
# 取不到值。按 detail 文本兜底识别。
|
|
@@ -87,7 +91,7 @@ def is_state_failure_outcome(outcome: Any) -> bool:
|
|
|
87
91
|
status = str(outcome.get("status") or "")
|
|
88
92
|
if status in _STATE_FAIL_STATUSES:
|
|
89
93
|
return True
|
|
90
|
-
if status ==
|
|
94
|
+
if status == engine_states.OUTCOME_ERROR:
|
|
91
95
|
detail = str(outcome.get("detail") or "").lower()
|
|
92
96
|
return any(k in detail for k in _MISSING_ENV_DETAIL_KEYWORDS)
|
|
93
97
|
return False
|
|
@@ -97,7 +101,8 @@ def should_record_adaptive(outcome: dict[str, Any] | None,
|
|
|
97
101
|
res: list[dict[str, Any]]) -> bool:
|
|
98
102
|
"""单引擎结局是否应记入 adaptive 学习器(跳过早停弃置与配额/鉴权/缺密钥等状态类故障)。"""
|
|
99
103
|
st = str((outcome or {}).get("status") or "")
|
|
100
|
-
if st.startswith((
|
|
104
|
+
if st.startswith((engine_states.OUTCOME_CANCELLED, engine_states.OUTCOME_SKIPPED_PREFIX)) \
|
|
105
|
+
or is_state_failure_outcome(outcome):
|
|
101
106
|
return False
|
|
102
107
|
errors = [str(r.get("error", "")) for r in (res or ())
|
|
103
108
|
if isinstance(r, dict) and "error" in r]
|
|
@@ -23,6 +23,7 @@ from typing import Any
|
|
|
23
23
|
from urllib.parse import urlparse
|
|
24
24
|
|
|
25
25
|
from video_meta import VIDEO_PLATFORMS, parse_duration_seconds
|
|
26
|
+
import engine_states # 状态词表唯一真源(2026-11-09 收口)
|
|
26
27
|
|
|
27
28
|
_TZ_CN = timezone(timedelta(hours=8))
|
|
28
29
|
|
|
@@ -148,7 +149,8 @@ def verification_of(item: dict[str, Any]) -> dict[str, Any]:
|
|
|
148
149
|
or item.get("post_fetch_absorption") is not None
|
|
149
150
|
)
|
|
150
151
|
return {
|
|
151
|
-
"status":
|
|
152
|
+
"status": (engine_states.VERIFICATION_OPENED if opened
|
|
153
|
+
else engine_states.VERIFICATION_CANDIDATE),
|
|
152
154
|
"opened_original": opened,
|
|
153
155
|
"checked_at": None,
|
|
154
156
|
}
|
|
@@ -256,7 +258,7 @@ def build_coverage(engine_outcomes: list[dict[str, Any]] | None, max_results: in
|
|
|
256
258
|
"detail": o.get("detail"),
|
|
257
259
|
"limitations": (
|
|
258
260
|
["empty or failed backend"]
|
|
259
|
-
if status not in
|
|
261
|
+
if status not in engine_states.CONTRIBUTING_OUTCOMES
|
|
260
262
|
else []
|
|
261
263
|
),
|
|
262
264
|
})
|
|
@@ -401,7 +403,9 @@ def attach_envelope(
|
|
|
401
403
|
"engines": search_result.get("engines_combo") or search_result.get("engines"),
|
|
402
404
|
"mode": search_result.get("mode"),
|
|
403
405
|
"login_state_used": bool(route_login),
|
|
404
|
-
"status":
|
|
406
|
+
"status": (engine_states.ENVELOPE_ROUTE_COMPLETED
|
|
407
|
+
if not search_result.get("errors")
|
|
408
|
+
else engine_states.ENVELOPE_ROUTE_PARTIAL),
|
|
405
409
|
"limitations": limitations[:3],
|
|
406
410
|
}])
|
|
407
411
|
return search_result
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""check_commit_report.py — 高风险提交的检查清单检查。
|
|
3
|
+
|
|
4
|
+
## 为什么需要
|
|
5
|
+
|
|
6
|
+
argo 的 pre-commit 注释自己记着两起真实事故:`f702ee2` 把 SKILL.md 压到
|
|
7
|
+
8049B、`4a71693` 让 deepseek_search 成死源,「两笔都过了 hook 却在全量回归里
|
|
8
|
+
红」。跑了的门禁全绿,**没跑的那条门没人知道它该跑**——因为提交信息里没有
|
|
9
|
+
「未跑什么」这个位置,省略不写是默认行为。
|
|
10
|
+
|
|
11
|
+
本脚本给高风险提交加一道**轻量提示**:检查清单缺段时打警告,不硬拦。
|
|
12
|
+
理由与 pre-commit 自己的边界一致:hook 慢于 20s 就会被 `--no-verify` 绕过,
|
|
13
|
+
而一道会被绕过的硬门比没有门更坏。它只做「让省略变得可见」。
|
|
14
|
+
|
|
15
|
+
## 判定口径
|
|
16
|
+
|
|
17
|
+
高风险 = 提交标题命中 `docs/COMMIT_STANDARD.md` 里列的模式。清单三段固定
|
|
18
|
+
用 `跑了` / `在 commit` / `未跑` 三个名字;`未跑: 无` 是合法写法(确实没漏),
|
|
19
|
+
但整段省略不合法。
|
|
20
|
+
|
|
21
|
+
用法:
|
|
22
|
+
python3 scripts/check_commit_report.py --message-file .git/COMMIT_EDITMSG
|
|
23
|
+
python3 scripts/check_commit_report.py --message "feat(engines): 接入 X 源"
|
|
24
|
+
python3 scripts/check_commit_report.py --last # 检查最近一次提交
|
|
25
|
+
python3 scripts/check_commit_report.py --last --strict # 缺段即非零退出
|
|
26
|
+
|
|
27
|
+
退出码:0 通过(或仅警告);1 `--strict` 下缺段;2 读不到提交信息。
|
|
28
|
+
"""
|
|
29
|
+
from __future__ import annotations
|
|
30
|
+
|
|
31
|
+
import argparse
|
|
32
|
+
import re
|
|
33
|
+
import subprocess
|
|
34
|
+
import sys
|
|
35
|
+
from pathlib import Path
|
|
36
|
+
|
|
37
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
38
|
+
|
|
39
|
+
# 高风险模式(与 docs/COMMIT_STANDARD.md 的「哪些提交算高风险」一一对应)。
|
|
40
|
+
# 顺序无关,命中任一即高风险。
|
|
41
|
+
#
|
|
42
|
+
# scope 用白名单而非通配:2026-11-10 首次落地时漏了 `agents`,于是本次这笔
|
|
43
|
+
# 改动自己的提交信息没被门禁检查——门禁管不到自己,正是它最该管的地方。但
|
|
44
|
+
# 改成 `[a-z_]+` 通配又太宽(`feat(local-seek)` 这类子技能改动被误判),
|
|
45
|
+
# 所以此处是**显式 scope 白名单**:新增一类受影响面时往这里加,并在同一次
|
|
46
|
+
# 改动里更新 docs/COMMIT_STANDARD.md。tests/test_check_commit_report.py
|
|
47
|
+
# 的 test_standard_doc_lists_the_same_high_risk_patterns 会机械对拍两者。
|
|
48
|
+
_HIGH_RISK_SCOPES = frozenset({
|
|
49
|
+
"engines", "engine", "route", "search", "rank", "states", "state",
|
|
50
|
+
"agents", "agent", "release", "deps",
|
|
51
|
+
})
|
|
52
|
+
_HIGH_RISK = (
|
|
53
|
+
# 无 scope 的性能改动:无论改哪里都要给实测数字
|
|
54
|
+
re.compile(r"^perf\("),
|
|
55
|
+
# 发版与依赖链:动的是发布路径,错了影响所有用户
|
|
56
|
+
re.compile(r"^(fix|chore)\(release\)"),
|
|
57
|
+
re.compile(r"^build\(deps\)"),
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
# 检查清单三段。`在 commit` 允许写成 `在 commit:` 或 `在commit:`。
|
|
61
|
+
_SEGMENTS = {
|
|
62
|
+
"跑了": re.compile(r"^\s*[-*]?\s*跑了\s*[::]", re.M),
|
|
63
|
+
"在 commit": re.compile(r"^\s*[-*]?\s*在\s*commit\s*[::]", re.M),
|
|
64
|
+
"未跑": re.compile(r"^\s*[-*]?\s*未跑\s*[::]", re.M),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# 标题与正文的分界:第一个空行。标题不进正文检查。
|
|
68
|
+
_TITLE_RE = re.compile(r"^\s*([a-z]+)(\(([^)]*)\))?!?:\s*(.*)$")
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
_SCOPE_RE = re.compile(r"^([a-z]+)(?:\(([^)]*)\))?!?:\s*(.*)$")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def is_high_risk(title: str) -> bool:
|
|
75
|
+
"""标题是否命中高风险模式。
|
|
76
|
+
|
|
77
|
+
判据有两条,命中任一即高风险:
|
|
78
|
+
1. scope 在 `_HIGH_RISK_SCOPES` 白名单里(带 scope 的常规提交)
|
|
79
|
+
2. 命中 `_HIGH_RISK` 里的特殊模式(无 scope 的 perf/build 等)
|
|
80
|
+
"""
|
|
81
|
+
m = _SCOPE_RE.match(title.strip())
|
|
82
|
+
if m and m.group(2) and m.group(2).strip() in _HIGH_RISK_SCOPES:
|
|
83
|
+
return True
|
|
84
|
+
return any(p.search(title.strip()) for p in _HIGH_RISK)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def missing_segments(body: str) -> list[str]:
|
|
88
|
+
"""检查清单里缺哪几段(跑了 / 在 commit / 未跑)。"""
|
|
89
|
+
return [name for name, pat in _SEGMENTS.items() if not pat.search(body)]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def parse_message(text: str) -> tuple[str, str]:
|
|
93
|
+
"""拆成 (标题, 正文)。注释行(# 开头)剔除。"""
|
|
94
|
+
lines = [ln for ln in text.splitlines()
|
|
95
|
+
if not ln.lstrip().startswith("#")]
|
|
96
|
+
if not lines:
|
|
97
|
+
return "", ""
|
|
98
|
+
title = lines[0].strip()
|
|
99
|
+
body = "\n".join(lines[1:])
|
|
100
|
+
return title, body
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def check(text: str) -> dict:
|
|
104
|
+
"""检查一条提交信息,返回结构化结果。"""
|
|
105
|
+
title, body = parse_message(text)
|
|
106
|
+
high = is_high_risk(title)
|
|
107
|
+
missing = missing_segments(body) if high else []
|
|
108
|
+
return {
|
|
109
|
+
"title": title,
|
|
110
|
+
"high_risk": high,
|
|
111
|
+
"missing": missing,
|
|
112
|
+
"ok": not missing,
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _read_git_message(ref: str) -> str | None:
|
|
117
|
+
r = subprocess.run(["git", "-C", str(ROOT), "log", "-1", "--format=%B", ref],
|
|
118
|
+
capture_output=True, text=True,
|
|
119
|
+
encoding="utf-8", errors="replace")
|
|
120
|
+
return r.stdout if r.returncode == 0 else None
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def main(argv: list[str] | None = None) -> int:
|
|
124
|
+
ap = argparse.ArgumentParser(description="高风险提交的检查清单检查")
|
|
125
|
+
g = ap.add_mutually_exclusive_group(required=True)
|
|
126
|
+
g.add_argument("--message-file", help="提交信息文件(如 .git/COMMIT_EDITMSG)")
|
|
127
|
+
g.add_argument("--message", help="直接给提交信息文本")
|
|
128
|
+
g.add_argument("--last", action="store_true", help="检查最近一次提交")
|
|
129
|
+
ap.add_argument("--strict", action="store_true",
|
|
130
|
+
help="缺段即非零退出(默认只警告)")
|
|
131
|
+
args = ap.parse_args(argv)
|
|
132
|
+
|
|
133
|
+
if args.message_file:
|
|
134
|
+
p = Path(args.message_file)
|
|
135
|
+
if not p.exists():
|
|
136
|
+
print(f"[commit-report] 读不到 {p}", file=sys.stderr)
|
|
137
|
+
return 2
|
|
138
|
+
text = p.read_text(encoding="utf-8")
|
|
139
|
+
elif args.message is not None:
|
|
140
|
+
text = args.message
|
|
141
|
+
elif args.last:
|
|
142
|
+
text = _read_git_message("HEAD") or ""
|
|
143
|
+
if not text:
|
|
144
|
+
print("[commit-report] 读不到 HEAD 的提交信息", file=sys.stderr)
|
|
145
|
+
return 2
|
|
146
|
+
else: # pragma: no cover - 互斥组保证三者必居其一
|
|
147
|
+
print("[commit-report] 未指定提交信息来源", file=sys.stderr)
|
|
148
|
+
return 2
|
|
149
|
+
|
|
150
|
+
report = check(text)
|
|
151
|
+
if not report["high_risk"]:
|
|
152
|
+
print(f"[commit-report] 非高风险提交,跳过:{report['title'][:60]}")
|
|
153
|
+
return 0
|
|
154
|
+
if report["ok"]:
|
|
155
|
+
print(f"[commit-report] 检查清单完整:{report['title'][:60]}")
|
|
156
|
+
return 0
|
|
157
|
+
print(f"[commit-report] 高风险提交缺检查清单段:{report['missing']}",
|
|
158
|
+
file=sys.stderr)
|
|
159
|
+
print(" 按 docs/COMMIT_STANDARD.md,三段固定为:跑了 / 在 commit / 未跑。",
|
|
160
|
+
file=sys.stderr)
|
|
161
|
+
print(" 没漏就写「未跑: 无」——省略不写是默认行为,而默认行为正是两起",
|
|
162
|
+
file=sys.stderr)
|
|
163
|
+
print(" 「过了 hook 却在全量回归里红」事故的成因。", file=sys.stderr)
|
|
164
|
+
return 1 if args.strict else 0
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
if __name__ == "__main__":
|
|
168
|
+
sys.exit(main())
|