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
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""sync_requirements.py — 依赖派生清单生成与校验(唯一真源:pyproject.toml)
|
|
3
|
+
|
|
4
|
+
设计目标:依赖变更只改一处真源(pyproject.toml),派生清单自动生成,消灭手工同步。
|
|
5
|
+
|
|
6
|
+
派生关系:
|
|
7
|
+
pyproject.toml(唯一真源)
|
|
8
|
+
├── requirements-dev.txt 由 [dependency-groups].dev 派生(开发/测试依赖)
|
|
9
|
+
└── requirements-optional.txt 由 [project.optional-dependencies].full 派生(全量可选依赖)
|
|
10
|
+
|
|
11
|
+
用法:
|
|
12
|
+
python3 scripts/sync_requirements.py # 重新生成两份派生清单
|
|
13
|
+
python3 scripts/sync_requirements.py --check # 校验派生清单是否与真源一致(不写盘)
|
|
14
|
+
|
|
15
|
+
退出码:0=一致/生成成功,1=校验不一致(--check 模式)。
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import argparse
|
|
21
|
+
import re
|
|
22
|
+
import sys
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
if sys.version_info >= (3, 11):
|
|
26
|
+
import tomllib
|
|
27
|
+
else:
|
|
28
|
+
import tomli as tomllib
|
|
29
|
+
|
|
30
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
31
|
+
PYPROJECT = ROOT / "pyproject.toml"
|
|
32
|
+
DEV_TXT = ROOT / "requirements-dev.txt"
|
|
33
|
+
OPT_TXT = ROOT / "requirements-optional.txt"
|
|
34
|
+
|
|
35
|
+
DEV_HEADER = """# 开发与 CI 依赖(运行期不强制,这些只在测试/门禁/CI 里用)
|
|
36
|
+
#
|
|
37
|
+
# ⚠️ 本文件是**派生清单**,不是依赖真源。真源在 pyproject.toml 的
|
|
38
|
+
# [dependency-groups].dev;内容与它的对应关系由
|
|
39
|
+
# tests/test_dependency_source_gate.py 机械对账,漂移即红。
|
|
40
|
+
# 改依赖请改 pyproject.toml,再跑:
|
|
41
|
+
# python3 scripts/sync_requirements.py
|
|
42
|
+
#
|
|
43
|
+
# 为什么锁死 pytest 版本:门禁的判定标准必须可复现。pytest 大版本会改收集语义
|
|
44
|
+
# (9.x 起 subtests 内建),pytest-timeout 的默认行为也会随版本变。
|
|
45
|
+
#
|
|
46
|
+
# 版本与 pyproject.toml 一致(含 3.9 档回落):pytest 9.x 要求 Python >=3.10,
|
|
47
|
+
# 3.9 档由 lock 解析到 pytest 8.3.5。这里保持「只写 >=3.10 档」的钉版写法,
|
|
48
|
+
# 是因为 pip 用户装这份清单就是在装开发档;3.9 档请直接用 uv sync。
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
OPT_HEADER = """# 可选依赖(缺失时主流程必须仍然可用;这九件在代码里全是函数内惰性导入)
|
|
52
|
+
#
|
|
53
|
+
# ⚠️ 本文件是**派生清单**,不是依赖真源。真源在 pyproject.toml 的
|
|
54
|
+
# [project.optional-dependencies].full;内容与它的对应关系由
|
|
55
|
+
# tests/test_dependency_source_gate.py 机械对账,漂移即红。
|
|
56
|
+
# 改依赖请改 pyproject.toml,再跑:
|
|
57
|
+
# python3 scripts/sync_requirements.py
|
|
58
|
+
#
|
|
59
|
+
# CI 的 extras 作业装这一份,用来验证「装全之后仍然通过」;
|
|
60
|
+
# 「一个都不装」由 unit 作业天然覆盖,不需要另开一档。
|
|
61
|
+
#
|
|
62
|
+
# 全部带 `python_version >= '3.10'` 标记:python-jobspy 与 pymupdf 都不支持 3.9,
|
|
63
|
+
# 写进 pyproject 时按 marker 分档,所以 3.9 机器上装这份清单会少几件——这是
|
|
64
|
+
# 预期行为,缺失时主流程仍可用。
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _load_pyproject() -> dict:
|
|
69
|
+
with PYPROJECT.open("rb") as fh:
|
|
70
|
+
return tomllib.load(fh)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _clean_entry(spec: str) -> str | None:
|
|
74
|
+
"""提取适合 requirements.txt 纯净书写的 spec(过滤掉 3.9 回落的旧版钉版)。"""
|
|
75
|
+
s = spec.strip()
|
|
76
|
+
if not s or s.startswith("#"):
|
|
77
|
+
return None
|
|
78
|
+
# 过滤显式给 python_version < '3.10' 的回落行(如 pytest==8.3.5)
|
|
79
|
+
if "< '3.10'" in s or "<= '3.9'" in s:
|
|
80
|
+
return None
|
|
81
|
+
# 去除环境标记(requirements.txt 给 pip 普通用户装最新档)
|
|
82
|
+
s = re.sub(r";\s*python_version.*$", "", s).strip()
|
|
83
|
+
return s
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def generate_dev_txt(data: dict) -> str:
|
|
87
|
+
dev_deps = (data.get("dependency-groups") or {}).get("dev") or []
|
|
88
|
+
lines = [DEV_HEADER.rstrip()]
|
|
89
|
+
pinned = []
|
|
90
|
+
test_deps = []
|
|
91
|
+
for raw in dev_deps:
|
|
92
|
+
cleaned = _clean_entry(raw)
|
|
93
|
+
if not cleaned:
|
|
94
|
+
continue
|
|
95
|
+
if "==" in cleaned:
|
|
96
|
+
pinned.append(cleaned)
|
|
97
|
+
else:
|
|
98
|
+
test_deps.append(cleaned)
|
|
99
|
+
|
|
100
|
+
lines.append("")
|
|
101
|
+
lines.extend(pinned)
|
|
102
|
+
lines.append("")
|
|
103
|
+
lines.append("# 下面三件是「测试本身要用的可选依赖」,不是运行期依赖:")
|
|
104
|
+
lines.append("# curl_cffi —— 一批用例用 mock 替换 curl_cffi.requests 验 TLS 指纹与 429 停止")
|
|
105
|
+
lines.append("# 轮换,补丁目标必须真实存在;缺件时这些用例会 skip(tests/_deps.py)")
|
|
106
|
+
lines.append("# bs4 / lxml —— HTML 引擎解析链,缺件时 keep 数归零,用例会红成「解析坏了」")
|
|
107
|
+
lines.append("# 装在这里的原因:CI 的 unit 作业要跑的是**真实行为**,不是跳过版。")
|
|
108
|
+
lines.append("# 九件可选依赖全装的那档见 requirements-optional.txt 与 extras 作业。")
|
|
109
|
+
lines.extend(test_deps)
|
|
110
|
+
lines.append("")
|
|
111
|
+
return "\n".join(lines)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def generate_opt_txt(data: dict) -> str:
|
|
115
|
+
opt_deps = (data.get("project", {}).get("optional-dependencies") or {}).get("full") or []
|
|
116
|
+
lines = [OPT_HEADER.rstrip(), ""]
|
|
117
|
+
for raw in opt_deps:
|
|
118
|
+
cleaned = _clean_entry(raw)
|
|
119
|
+
if cleaned:
|
|
120
|
+
lines.append(cleaned)
|
|
121
|
+
lines.append("")
|
|
122
|
+
return "\n".join(lines)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def sync(check_only: bool = False) -> bool:
|
|
126
|
+
data = _load_pyproject()
|
|
127
|
+
dev_content = generate_dev_txt(data)
|
|
128
|
+
opt_content = generate_opt_txt(data)
|
|
129
|
+
|
|
130
|
+
current_dev = DEV_TXT.read_text(encoding="utf-8") if DEV_TXT.is_file() else ""
|
|
131
|
+
current_opt = OPT_TXT.read_text(encoding="utf-8") if OPT_TXT.is_file() else ""
|
|
132
|
+
|
|
133
|
+
dev_match = (current_dev.strip() == dev_content.strip())
|
|
134
|
+
opt_match = (current_opt.strip() == opt_content.strip())
|
|
135
|
+
|
|
136
|
+
if check_only:
|
|
137
|
+
if not dev_match:
|
|
138
|
+
print("requirements-dev.txt 与 pyproject.toml 存在漂移,请运行: python3 scripts/sync_requirements.py", file=sys.stderr)
|
|
139
|
+
if not opt_match:
|
|
140
|
+
print("requirements-optional.txt 与 pyproject.toml 存在漂移,请运行: python3 scripts/sync_requirements.py", file=sys.stderr)
|
|
141
|
+
return dev_match and opt_match
|
|
142
|
+
|
|
143
|
+
DEV_TXT.write_text(dev_content, encoding="utf-8")
|
|
144
|
+
OPT_TXT.write_text(opt_content, encoding="utf-8")
|
|
145
|
+
print(f"✔ 已由 pyproject.toml 自动派生更新: {DEV_TXT.name}, {OPT_TXT.name}")
|
|
146
|
+
return True
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def main() -> int:
|
|
150
|
+
parser = argparse.ArgumentParser(description="依赖派生清单同步与校验工具")
|
|
151
|
+
parser.add_argument("--check", action="store_true", help="校验派生清单是否与真源一致")
|
|
152
|
+
args = parser.parse_args()
|
|
153
|
+
|
|
154
|
+
ok = sync(check_only=args.check)
|
|
155
|
+
return 0 if ok else 1
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
if __name__ == "__main__":
|
|
159
|
+
sys.exit(main())
|
package/scripts/tweet.py
CHANGED
|
@@ -24,7 +24,6 @@ import os
|
|
|
24
24
|
import re
|
|
25
25
|
import sys
|
|
26
26
|
import time
|
|
27
|
-
import urllib.request
|
|
28
27
|
from datetime import datetime, timezone
|
|
29
28
|
from pathlib import Path
|
|
30
29
|
from typing import Any
|
|
@@ -32,7 +31,7 @@ from typing import Any
|
|
|
32
31
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
33
32
|
import fxtwitter_api as fx # noqa: E402
|
|
34
33
|
from cli_io import dumps, dumps_pretty # noqa: E402
|
|
35
|
-
from net_proxy import
|
|
34
|
+
from net_proxy import http_get # noqa: E402
|
|
36
35
|
from url_safety import check_url # noqa: E402
|
|
37
36
|
|
|
38
37
|
MODES = ("status", "thread", "conversation", "quotes", "reposts")
|
|
@@ -60,10 +59,8 @@ def download_file(url: str, dest: Path, *, timeout: float = 60) -> dict[str, Any
|
|
|
60
59
|
"error": f"URL 被安全策略拒绝: {reason}"}
|
|
61
60
|
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
62
61
|
try:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
with open_url(req, timeout=timeout) as resp:
|
|
66
|
-
data = resp.read()
|
|
62
|
+
data, _ = http_get(url, {"User-Agent": fx.USER_AGENT, "Accept": "*/*"},
|
|
63
|
+
timeout=timeout)
|
|
67
64
|
dest.write_bytes(data)
|
|
68
65
|
return {"ok": True, "path": str(dest), "bytes": len(data),
|
|
69
66
|
"url": url, "error": None}
|
package/scripts/usage_log.py
CHANGED
|
@@ -27,27 +27,46 @@ from engine_env import env_flag # 布尔开关统一判断(见 env_flag 的
|
|
|
27
27
|
|
|
28
28
|
_STREAM_VERSION = 1
|
|
29
29
|
|
|
30
|
-
#
|
|
30
|
+
# 单流体积上限与回缩目标。
|
|
31
31
|
#
|
|
32
32
|
# why(2026-09-17 实测):append-only 而无任何轮转,三个流已涨到 771 KB
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
33
|
+
# 且只增不减。本模块唯一的读取方是 tail(只看最近若干条),旧记录没有读者,
|
|
34
|
+
# 所以超限时直接回缩,不另存归档——归档是「留给会来取的人」,这里没有。
|
|
35
|
+
#
|
|
36
|
+
# why 改成按字节回缩(2026-11-09):原实现是「取 lines[-_KEEP_LINES:]」,
|
|
37
|
+
# 但单行实测已达 525 B,2000 行就是 1.05 MiB,早已超过 1 MiB 上限;于是
|
|
38
|
+
# 每次 emit 都判定超限、全读 1 MiB、再用同一个 2000 行原样写回——回缩成了
|
|
39
|
+
# 每次调用都做一次全量读写的空转。按字节从尾部保留才能真正把文件压下来。
|
|
36
40
|
_MAX_BYTES = 1024 * 1024
|
|
37
|
-
|
|
41
|
+
_TRIM_TO_BYTES = _MAX_BYTES // 2
|
|
38
42
|
|
|
39
43
|
|
|
40
44
|
def _trim_if_oversized(path: Path) -> None:
|
|
41
|
-
"""
|
|
45
|
+
"""超过上限就把文件回缩到约一半,保留尾部整行;任何失败静默。
|
|
42
46
|
|
|
43
|
-
先 stat 再决定要不要读:绝大多数调用只付一次 stat
|
|
47
|
+
先 stat 再决定要不要读:绝大多数调用只付一次 stat 的代价。从尾部按字节
|
|
48
|
+
累计到 _TRIM_TO_BYTES 即可,不必解析 JSON;丢弃半行前缀(第一行可能不完整)
|
|
49
|
+
保证每行仍是合法 JSONL。回缩到一半而不是贴着上限,是为了不会每写入几条
|
|
50
|
+
就又触发一次全量读写。
|
|
44
51
|
"""
|
|
45
52
|
try:
|
|
46
53
|
if path.stat().st_size <= _MAX_BYTES:
|
|
47
54
|
return
|
|
48
|
-
|
|
55
|
+
data = path.read_bytes()
|
|
56
|
+
cut = max(0, len(data) - _TRIM_TO_BYTES)
|
|
57
|
+
nl = data.find(b"\n", cut)
|
|
58
|
+
if nl >= 0:
|
|
59
|
+
start = nl + 1 # 丢掉不完整的前缀行
|
|
60
|
+
else:
|
|
61
|
+
# 切点之后到 EOF 没有换行:最后一行异常巨大或未以换行结束。
|
|
62
|
+
# 保留这完整一行,别把整个日志清空,也别写出半行非法 JSON。
|
|
63
|
+
prev = data.rfind(b"\n", 0, cut)
|
|
64
|
+
start = prev + 1
|
|
65
|
+
kept = data[start:]
|
|
66
|
+
if not kept or len(kept) >= len(data):
|
|
67
|
+
return # 压不动就不动,避免无意义全量重写
|
|
49
68
|
# 走 argo_paths 的原子写唯一来源,避免回缩中途崩溃留下半截文件
|
|
50
|
-
_paths.atomic_write_text(path,
|
|
69
|
+
_paths.atomic_write_text(path, kept.decode("utf-8", errors="replace"))
|
|
51
70
|
except Exception:
|
|
52
71
|
return
|
|
53
72
|
|
package/scripts/video_fetch.py
CHANGED
|
@@ -25,10 +25,9 @@ import re
|
|
|
25
25
|
import shlex
|
|
26
26
|
import subprocess
|
|
27
27
|
import urllib.parse
|
|
28
|
-
import urllib.request
|
|
29
28
|
from datetime import datetime, timedelta, timezone
|
|
30
29
|
|
|
31
|
-
from net_proxy import
|
|
30
|
+
from net_proxy import http_get
|
|
32
31
|
from video_meta import parse_duration_seconds, video_platform
|
|
33
32
|
|
|
34
33
|
_TZ_CN = timezone(timedelta(hours=8))
|
|
@@ -37,9 +36,7 @@ _UA = ("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
|
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
def _get(url: str, timeout: float) -> bytes:
|
|
40
|
-
|
|
41
|
-
with open_url(req, timeout=timeout) as resp:
|
|
42
|
-
return resp.read()
|
|
39
|
+
return http_get(url, {"User-Agent": _UA}, timeout=timeout)[0]
|
|
43
40
|
|
|
44
41
|
|
|
45
42
|
def _get_json(url: str, timeout: float) -> dict:
|
package/scripts/watch.py
CHANGED
|
@@ -25,6 +25,7 @@ import time
|
|
|
25
25
|
from typing import Any
|
|
26
26
|
|
|
27
27
|
from cli_io import dumps, dumps_pretty
|
|
28
|
+
import engine_states # 状态词表唯一真源(2026-11-09 收口)
|
|
28
29
|
|
|
29
30
|
_SNAP_CAP = 10 # 每个 URL 保留的快照历史上限(旧的丢弃)
|
|
30
31
|
|
|
@@ -146,7 +147,8 @@ def _block_key(block: str) -> str:
|
|
|
146
147
|
def diff_text(old: str, new: str) -> dict:
|
|
147
148
|
"""比较两版正文。返回 change_type(none/noise/substantive)与变化块样本。"""
|
|
148
149
|
if _norm(old) == _norm(new):
|
|
149
|
-
return {"change_type":
|
|
150
|
+
return {"change_type": engine_states.WATCH_CHANGE_NONE,
|
|
151
|
+
"noise_categories": [],
|
|
150
152
|
"added_blocks": [], "removed_blocks": []}
|
|
151
153
|
old_blocks = _blocks(old)
|
|
152
154
|
new_blocks = _blocks(new)
|
|
@@ -155,12 +157,14 @@ def diff_text(old: str, new: str) -> dict:
|
|
|
155
157
|
added = [b for b in new_blocks if _block_key(b) not in old_keys][:3]
|
|
156
158
|
removed = [b for b in old_blocks if _block_key(b) not in new_keys][:3]
|
|
157
159
|
if _norm(_mask_noise(old)) == _norm(_mask_noise(new)):
|
|
158
|
-
change_type =
|
|
160
|
+
change_type = engine_states.WATCH_CHANGE_NOISE
|
|
159
161
|
else:
|
|
160
|
-
change_type =
|
|
162
|
+
change_type = engine_states.WATCH_CHANGE_SUBSTANTIVE
|
|
161
163
|
return {
|
|
162
164
|
"change_type": change_type,
|
|
163
|
-
"noise_categories": _noise_categories(old, new)
|
|
165
|
+
"noise_categories": (_noise_categories(old, new)
|
|
166
|
+
if change_type == engine_states.WATCH_CHANGE_NOISE
|
|
167
|
+
else []),
|
|
164
168
|
"added_blocks": [b[:200] for b in added],
|
|
165
169
|
"removed_blocks": [b[:200] for b in removed],
|
|
166
170
|
}
|
|
@@ -246,9 +250,10 @@ def cmd_check(only_url: str | None) -> list[dict]:
|
|
|
246
250
|
diff = diff_text(prev["content"], snap["content"])
|
|
247
251
|
report.update(diff)
|
|
248
252
|
# 以正文 diff 为准:哈希只做快速路径,diff 说没变就是没变。
|
|
249
|
-
report["changed"] =
|
|
253
|
+
report["changed"] = (
|
|
254
|
+
diff["change_type"] != engine_states.WATCH_CHANGE_NONE)
|
|
250
255
|
elif report["changed"]:
|
|
251
|
-
report["change_type"] =
|
|
256
|
+
report["change_type"] = engine_states.WATCH_CHANGE_UNKNOWN
|
|
252
257
|
entry = data["urls"][url]
|
|
253
258
|
entry["snapshots"] = (entry["snapshots"] + [snap])[-_SNAP_CAP:]
|
|
254
259
|
_trim_contents(entry)
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
|
+
import engine_states
|
|
18
|
+
|
|
17
19
|
import argparse
|
|
18
20
|
import json
|
|
19
21
|
import os
|
|
@@ -21,7 +23,6 @@ import re
|
|
|
21
23
|
import subprocess
|
|
22
24
|
import sys
|
|
23
25
|
import time
|
|
24
|
-
import urllib.request
|
|
25
26
|
import html as htmllib
|
|
26
27
|
from typing import Optional
|
|
27
28
|
|
|
@@ -33,7 +34,7 @@ from article import strip_tags, fetch_article
|
|
|
33
34
|
from fetch_browser import browser_fetch
|
|
34
35
|
|
|
35
36
|
# urllib 出口唯一入口(issue #13):代理解析集中在一处;YAML 解析同理
|
|
36
|
-
from net_proxy import
|
|
37
|
+
from net_proxy import http_get
|
|
37
38
|
from yaml_load import loads
|
|
38
39
|
|
|
39
40
|
# 本脚本所在目录:子进程脚本路径必须绝对(本模块可能从任意 CWD 调起)
|
|
@@ -85,7 +86,7 @@ def _cdp_fetch(url: str, timeout: int = 15) -> dict:
|
|
|
85
86
|
"image_count": len(imgs),
|
|
86
87
|
"images": imgs,
|
|
87
88
|
"content": content,
|
|
88
|
-
"fetch_method":
|
|
89
|
+
"fetch_method": engine_states.FETCH_CHROME_CDP,
|
|
89
90
|
}
|
|
90
91
|
except Exception as e:
|
|
91
92
|
return {"ok": False, "error": f"CDP 通道异常: {e}"}
|
|
@@ -102,15 +103,13 @@ def _sogou_fallback(url: str) -> dict:
|
|
|
102
103
|
try:
|
|
103
104
|
title = ""
|
|
104
105
|
try:
|
|
105
|
-
|
|
106
|
+
raw = http_get(url, {
|
|
106
107
|
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) "
|
|
107
108
|
"AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1",
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if m:
|
|
113
|
-
title = m.group(1).strip()
|
|
109
|
+
}, timeout=5)[0].decode("utf-8", errors="ignore")
|
|
110
|
+
m = re.search(r'<meta property="og:title" content="([^"]+)"', raw)
|
|
111
|
+
if m:
|
|
112
|
+
title = m.group(1).strip()
|
|
114
113
|
except Exception:
|
|
115
114
|
pass
|
|
116
115
|
|
|
@@ -144,7 +143,7 @@ def _sogou_fallback(url: str) -> dict:
|
|
|
144
143
|
"image_count": 0,
|
|
145
144
|
"images": [],
|
|
146
145
|
"content": best.get("snippet", ""),
|
|
147
|
-
"fetch_method":
|
|
146
|
+
"fetch_method": engine_states.FETCH_SOGOU_FALLBACK,
|
|
148
147
|
"note": "通过搜狗搜索间接获取,内容可能不完整",
|
|
149
148
|
}
|
|
150
149
|
except Exception as e:
|
|
@@ -201,7 +200,7 @@ def fetch_wechat_article(url: str) -> dict:
|
|
|
201
200
|
# 通道1: HTTP 直取(快速失败)
|
|
202
201
|
result = _http_fetch(url, timeout=5)
|
|
203
202
|
if _has_content(result):
|
|
204
|
-
result["fetch_method"] =
|
|
203
|
+
result["fetch_method"] = engine_states.FETCH_HTTP_DIRECT
|
|
205
204
|
result.setdefault("char_count", len(result.get("content") or ""))
|
|
206
205
|
return result
|
|
207
206
|
|
package/scripts/wide_research.py
CHANGED
|
@@ -40,6 +40,7 @@ from urllib.parse import urlparse
|
|
|
40
40
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
41
41
|
|
|
42
42
|
from cli_io import dumps # noqa: E402
|
|
43
|
+
import engine_states # noqa: E402
|
|
43
44
|
from research_work_packages import stage_work_packages # noqa: E402
|
|
44
45
|
|
|
45
46
|
MAX_SOURCES_PER_TRACK = 8
|
|
@@ -300,7 +301,9 @@ def evaluate_gates(
|
|
|
300
301
|
"detail": f"{len(farm_hits)} sources originate from content farms or SEO scraper mirrors; evidence quality severely degraded.",
|
|
301
302
|
})
|
|
302
303
|
|
|
303
|
-
cap =
|
|
304
|
+
cap = (engine_states.CONCLUSION_CAP_LOW if failures
|
|
305
|
+
else (engine_states.CONCLUSION_CAP_MEDIUM if warnings
|
|
306
|
+
else engine_states.CONCLUSION_CAP_HIGH))
|
|
304
307
|
return {"passed": not failures, "conclusion_cap": cap, "failures": failures, "warnings": warnings}
|
|
305
308
|
|
|
306
309
|
|
package/scripts/wx.py
CHANGED
|
@@ -28,10 +28,9 @@ import json
|
|
|
28
28
|
import re
|
|
29
29
|
import sys
|
|
30
30
|
import urllib.parse as up
|
|
31
|
-
import urllib.request
|
|
32
31
|
from concurrent.futures import ThreadPoolExecutor
|
|
33
32
|
from datetime import date
|
|
34
|
-
from net_proxy import
|
|
33
|
+
from net_proxy import http_get # 出口调度唯一入口(issue #13 同类修复)
|
|
35
34
|
|
|
36
35
|
_WTTR_BASE = "https://wttr.in/"
|
|
37
36
|
_OM_BASE = "https://api.open-meteo.com/v1/forecast"
|
|
@@ -74,12 +73,6 @@ _WEATHER_EN_ZH = {
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
|
|
77
|
-
def _fetch(url: str, timeout: float = 8) -> str:
|
|
78
|
-
req = urllib.request.Request(url, headers=_HEADERS)
|
|
79
|
-
with open_url(req, timeout=timeout) as resp:
|
|
80
|
-
return resp.read().decode("utf-8", "replace")
|
|
81
|
-
|
|
82
|
-
|
|
83
76
|
_WEATHER_WORDS = re.compile(
|
|
84
77
|
r"(天气|气温|温度|多少度|预报|怎么样|如何|下雨|降水|雪|晴|今[天日晚]|明[天日晚]|后[天日]|昨[天日]|"
|
|
85
78
|
r"当前|现在|实时|weather|forecast|temperature|today|tonight|tomorrow|now|current)",
|
|
@@ -111,7 +104,7 @@ def _wttr(loc: str, query: str | None = None) -> list[dict]:
|
|
|
111
104
|
"""wttr.in 主源。标题用查询词(用户输入),避免 nearest_area 返回细分区域名。"""
|
|
112
105
|
q = (query or loc).strip() or loc
|
|
113
106
|
url = f"{_WTTR_BASE}{up.quote(loc)}?format=j1"
|
|
114
|
-
data = json.loads(
|
|
107
|
+
data = json.loads(http_get(url, _HEADERS)[0])
|
|
115
108
|
area = (data.get("nearest_area") or [{}])[0]
|
|
116
109
|
country = (area.get("country") or [{}])[0].get("value", "")
|
|
117
110
|
cur = (data.get("current_condition") or [{}])[0]
|
|
@@ -177,7 +170,7 @@ def _geocode(loc: str) -> dict | None:
|
|
|
177
170
|
params = {"name": loc, "count": 1, "language": "zh", "format": "json"}
|
|
178
171
|
url = f"{_GEO_BASE}?{up.urlencode(params)}"
|
|
179
172
|
try:
|
|
180
|
-
data = json.loads(
|
|
173
|
+
data = json.loads(http_get(url, _HEADERS, timeout=6)[0])
|
|
181
174
|
except Exception:
|
|
182
175
|
return None
|
|
183
176
|
results = data.get("results") or []
|
|
@@ -213,7 +206,7 @@ def _aqi(lat: float, lon: float) -> str | None:
|
|
|
213
206
|
"current": "pm10,pm2_5", "timezone": "auto"}
|
|
214
207
|
url = f"{_AQI_BASE}?{up.urlencode(params)}"
|
|
215
208
|
try:
|
|
216
|
-
data = json.loads(
|
|
209
|
+
data = json.loads(http_get(url, _HEADERS, timeout=6)[0])
|
|
217
210
|
cur = data.get("current") or {}
|
|
218
211
|
except Exception:
|
|
219
212
|
return None
|
|
@@ -254,9 +247,9 @@ def _open_meteo(loc: str) -> list[dict]:
|
|
|
254
247
|
# 墙钟 = geocode + max(forecast, aqi)。_aqi 内部自带容错(失败返回
|
|
255
248
|
# None),fetch 异常照旧冒泡给调用方的 _safe——两条失败语义都不变。
|
|
256
249
|
with ThreadPoolExecutor(max_workers=2) as ex:
|
|
257
|
-
f_om = ex.submit(
|
|
250
|
+
f_om = ex.submit(http_get, url, _HEADERS)
|
|
258
251
|
f_aqi = ex.submit(_aqi, lat, lon)
|
|
259
|
-
data = json.loads(f_om.result())
|
|
252
|
+
data = json.loads(f_om.result()[0])
|
|
260
253
|
aqi = f_aqi.result()
|
|
261
254
|
cur = data.get("current_weather") or {}
|
|
262
255
|
rows = []
|
|
@@ -11,6 +11,7 @@ entityMap 里 MEDIA/MARKDOWN 原子块还原为带内嵌图片 Markdown。
|
|
|
11
11
|
|
|
12
12
|
from __future__ import annotations
|
|
13
13
|
|
|
14
|
+
import engine_states
|
|
14
15
|
import json
|
|
15
16
|
import os
|
|
16
17
|
import re
|
|
@@ -124,7 +125,7 @@ def fetch_x_article(url: str, max_chars: int = 8000,
|
|
|
124
125
|
"length": min(len(content), max_chars),
|
|
125
126
|
"success": True,
|
|
126
127
|
"error": None,
|
|
127
|
-
"fetch_method":
|
|
128
|
+
"fetch_method": engine_states.FETCH_X_ARTICLE,
|
|
128
129
|
}
|
|
129
130
|
except Exception:
|
|
130
131
|
return None
|
|
@@ -19,7 +19,7 @@ Local Search 是 argo 的「零成本兜底适配器」,用于:
|
|
|
19
19
|
- **输出与主 skill 同 schema**:`results[]` / `engines_used` / `errors` / `elapsed_ms`,可直接进 evidence 与 RRF。
|
|
20
20
|
- **`local_X` 与主清单的 `X` 是别名,不是备份**:`local_arxiv`/`local_crossref`/`local_semantic_scholar`/`local_github`/`local_npm`/`local_wikipedia`/`local_stackoverflow`/`local_google_news` 与主清单同名项**打同一个上游端点**(主清单走官方 API、这里走免密钥直取),不存在「API 挂了抓取版兜底」。同上游同格式由 `tests/test_local_search_registry.py` 锁定。
|
|
21
21
|
|
|
22
|
-
### 本地引擎列表(30 个,
|
|
22
|
+
### 本地引擎列表(30 个,27 个默认启用)
|
|
23
23
|
|
|
24
24
|
| unified 名称 | 类型 | 默认启用 | 类别 | 说明 |
|
|
25
25
|
|--------------|------|----------|------|------|
|
|
@@ -33,7 +33,7 @@ Local Search 是 argo 的「零成本兜底适配器」,用于:
|
|
|
33
33
|
| local_360 | html | ✅ | chinese | 360 搜索 |
|
|
34
34
|
| local_jisilu | html | ✅ | finance/chinese | 集思录 |
|
|
35
35
|
| local_ddgs_news | cli(ddgs) | ✅ | news | ddgs news 默认后端(带日期) |
|
|
36
|
-
| local_bing_news | rss |
|
|
36
|
+
| local_bing_news | rss | ❌ | news | Bing 新闻 RSS(上游已返 HTML,默认禁用) |
|
|
37
37
|
| local_google_news | rss | ✅ | news | Google News RSS |
|
|
38
38
|
| local_duckduckgo_news | cli(ddgs) | ✅ | news | ddgs news 备用后端 |
|
|
39
39
|
| local_ddgs_images | cli(ddgs) | ✅ | images | ddgs images(bing TLS 偶发,已自动重试) |
|
|
@@ -234,7 +234,8 @@ engines:
|
|
|
234
234
|
|
|
235
235
|
local_bing_news:
|
|
236
236
|
type: rss
|
|
237
|
-
enabled:
|
|
237
|
+
enabled: false
|
|
238
|
+
disabled_reason: "Bing News RSS 三种变体(search/q、news/search+format=rss、cc=cn)均返回 HTML 页面,非合法 XML(2026-11-08 实测停用)"
|
|
238
239
|
categories: [news]
|
|
239
240
|
url: "https://www.bing.com/news/search"
|
|
240
241
|
query_param: q
|
|
@@ -132,8 +132,13 @@ def _parse_html(engine_name: str, html: str, spec: dict[str, Any],
|
|
|
132
132
|
return []
|
|
133
133
|
|
|
134
134
|
try:
|
|
135
|
-
from bs4 import BeautifulSoup
|
|
135
|
+
from bs4 import BeautifulSoup, Comment
|
|
136
136
|
soup = BeautifulSoup(html, "html.parser")
|
|
137
|
+
# 搜狗等站把内部标记写成 HTML 注释(实测 <!--awbg0--> 混进结果
|
|
138
|
+
# 标题前缀 awbg0awbg0):get_text 会拼入 Comment 节点,全页统一
|
|
139
|
+
# 剥离,一处修复所有 parse_maps HTML 引擎。
|
|
140
|
+
for c in soup.find_all(string=lambda t: isinstance(t, Comment)):
|
|
141
|
+
c.extract()
|
|
137
142
|
containers = _select_with_bs4(soup, container_sel)
|
|
138
143
|
except Exception:
|
|
139
144
|
return []
|