argo-search 2.10.1 → 2.10.2
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/README.en.md +30 -4
- package/README.es.md +30 -4
- package/README.ja.md +30 -4
- package/README.ko.md +30 -4
- package/README.md +30 -24
- package/SKILL.md +1 -1
- package/backends/concept_vectors.bin +0 -0
- package/backends/engine_concept_vectors.json +3104 -0
- package/config.yaml +82 -14
- package/docs/RELEASE_NOTES_v2.10.2.md +48 -0
- package/package.json +2 -1
- package/packages/dsh-plugin/dsh/diagnostics.js +8 -3
- package/packages/dsh-plugin/dsh/index.js +7 -7
- package/packages/dsh-plugin/dsh/runner.js +72 -46
- package/packages/dsh-plugin/package.json +1 -1
- package/packages/dsh-plugin/test/index.test.js +43 -0
- package/scripts/argo_engine_registry.py +30 -4
- package/scripts/argo_paths.py +7 -1
- package/scripts/build_concept_table.py +612 -0
- package/scripts/build_route_labels.py +285 -0
- package/scripts/caliber_dedupe.py +66 -0
- package/scripts/caliber_isolation.py +4 -2
- package/scripts/circuit_breaker.py +25 -3
- package/scripts/concept_lookup.py +212 -0
- package/scripts/engines.py +24 -7
- package/scripts/engines_base.py +17 -2
- package/scripts/engines_builders_skill.py +87 -10
- package/scripts/extend_route_labels.py +239 -0
- package/scripts/extend_route_labels_by_capability.py +344 -0
- package/scripts/gen_routing_snapshot.py +22 -3
- package/scripts/lang_detect.py +12 -3
- package/scripts/local_seek.py +13 -3
- package/scripts/mcp_transport.py +1 -1
- package/scripts/numeric_verify.py +330 -0
- package/scripts/plan.py +25 -4
- package/scripts/pre-commit +2 -2
- package/scripts/rank_signals.py +48 -4
- package/scripts/ranking_eval.py +23 -1
- package/scripts/regression_p0p1.py +7 -2
- package/scripts/route.py +24 -3
- package/scripts/route_accuracy_eval.py +191 -0
- package/scripts/route_combo.py +32 -1
- package/scripts/route_domains.py +242 -5
- package/scripts/route_primary.py +101 -0
- package/scripts/search.py +1 -0
- package/scripts/search_cli.py +89 -7
- package/scripts/search_output.py +59 -1
- package/scripts/search_pipeline.py +5 -0
- package/scripts/snippet_clean.py +60 -0
- package/scripts/social_engines/twitter_engine.py +127 -43
- package/scripts/social_engines/xiaohongshu_engine.py +11 -1
- package/scripts/tfidf_router.py +52 -2
- package/scripts/train.py +15 -0
- package/scripts/verify_with.py +124 -0
- package/sub-skills/local-search/SKILL.md +3 -2
- package/sub-skills/local-search/bm25.py +89 -8
- package/sub-skills/local-search/config.yaml +12 -0
- package/sub-skills/local-search/parse_maps.yaml +8 -0
- package/sub-skills/local-search/parsers.py +5 -2
- package/sub-skills/local-search/search_v3.py +87 -1
- package/sub-skills/local-search/smart_router.py +1 -1
- package/sub-skills/local-seek/SKILL.md +6 -5
- package/sub-skills/local-seek/scripts/eval_rank.py +1 -1
- package/sub-skills/local-seek/scripts/seek.py +152 -36
- package/sub-skills/local-seek/scripts/seek_rank.py +191 -11
- package/scripts/image_vision/vision_probe +0 -0
package/config.yaml
CHANGED
|
@@ -1074,7 +1074,13 @@ domains:
|
|
|
1074
1074
|
parallel: true
|
|
1075
1075
|
patterns:
|
|
1076
1076
|
- (?i)(百度百科|baike\.baidu|百科词条|查百科|词条解释)
|
|
1077
|
-
-
|
|
1077
|
+
# 「…是什么?」尾巴会把两类非百科查询整类吃进来(2026-10-31 评测实测):
|
|
1078
|
+
# 比较决策(「A 和 B 的区别/优劣/怎么选是什么」)与获奖/得主类新闻
|
|
1079
|
+
# (「2026年XX奖得主…获奖理由是什么」)。触发词本身留着的理由:真百科
|
|
1080
|
+
# 点查(「蝴蝶效应是什么」)仍需它;因此用同宽度的 unless 逐例否决,
|
|
1081
|
+
# 显式点名百科的查询仍由上一条触发词接住。
|
|
1082
|
+
- match: '(?i)(是什么(?!梗)|什么是|简介|定义一下).{0,8}$'
|
|
1083
|
+
unless: '@compare_or_award'
|
|
1078
1084
|
primary: baidu_baike
|
|
1079
1085
|
- desc: 词典查询(英文 dictionaryapi + 中文汉典 + wikipedia)
|
|
1080
1086
|
engines_combo:
|
|
@@ -1182,7 +1188,12 @@ domains:
|
|
|
1182
1188
|
- (?i)(足球|篮球|网球|排球|乒乓球|羽毛球|棒球|橄榄球|高尔夫|(?<![a-z0-9])F1(?![a-z0-9])|一级方程式|马拉松|田径|游泳|拳击|(?<![a-z0-9])UFC(?![a-z0-9])|电竞战队)
|
|
1183
1189
|
- (?i)(决赛|半决赛|季后赛|总冠军|MVP|得分王|金靴|金球奖|转会|俱乐部|联赛|进球|助攻|夺冠|卫冕|球员|守门员|前锋|后卫)
|
|
1184
1190
|
# 中英球队/效力语境(修复「库里 球队」「LeBron James team」「Ronaldo club」漏召)
|
|
1185
|
-
|
|
1191
|
+
# 主教练/球队泛词触发(评测 n09 实测「中国男足国家队主教练现在是谁」仅靠
|
|
1192
|
+
# 「主教练」命中本域,fast 档 combo_budget=2 只取前两位:thesportsdb 空 +
|
|
1193
|
+
# jolpica 只有 F1,返回 F1 车手积分榜)。国家队语境交给通用池——中文体育
|
|
1194
|
+
# 新闻不在本域源里,本域也接不住。
|
|
1195
|
+
- match: '(?i)(球队|球星|球会|球衣|队名|队史|效力于|效力|主教练|得分手)'
|
|
1196
|
+
unless: '(?i)(国足|男足|女足|男篮|女排|国乒|国羽|国家队)'
|
|
1186
1197
|
- (?i)\b(team|club|coach|roster|squad|jersey|striker|goalkeeper|midfielder|defender)\b
|
|
1187
1198
|
- (?i)\b(world\s*cup|olympics?|championship|finals?|playoffs?|league|fixture|matchday|transfer|hat-?trick)\b
|
|
1188
1199
|
- (?i)\b(soccer|football|basketball|tennis|baseball|cricket|rugby|golf|formula\s*1|formula\s*one)\b
|
|
@@ -1264,7 +1275,11 @@ domains:
|
|
|
1264
1275
|
patterns:
|
|
1265
1276
|
# 政府/国际组织
|
|
1266
1277
|
- (?i)(国务院|中共中央|全国人大|政协|外交部|财政部|发改委|央行|人民银行|最高法院|最高检|省政府|市政府|区政府|县委|市委)
|
|
1267
|
-
|
|
1278
|
+
# 机构名 + 政策语境(评测 n08 实测「欧盟 AI Act 执行到哪一步」被「欧盟」
|
|
1279
|
+
# 锁进实体查询域,wikidata/百科给的是机构条目而非政策进展):问法案/条例/
|
|
1280
|
+
# 执行进展时让位,问机构本身(是什么组织/总部在哪)不受影响
|
|
1281
|
+
- match: '(?i)(联合国|安理会|世贸组织|WTO|UNESCO|IMF|世界银行|欧盟|北约|NATO|东盟|上合组织|G20|G7|非盟|阿盟)'
|
|
1282
|
+
unless: '(?i)(政策|法案|条例|执行|实施|生效|进展|签署|谈判)'
|
|
1268
1283
|
# WHO 必须区分大小写:`(?i)` 下 `who` 会命中英语里最常见的疑问句开头
|
|
1269
1284
|
# (「who is the CEO of OpenAI」「who wrote the linux kernel」),把整个
|
|
1270
1285
|
# 疑问句锁死进机构域。机构缩写本就是大写专名,没有需要忽略大小写的理由。
|
|
@@ -1441,7 +1456,13 @@ domains:
|
|
|
1441
1456
|
# 不是找论文——实测两类都落本域,arxiv 答不了写作技巧。只否决这一条,
|
|
1442
1457
|
# 「综述 论文」等真检索语境不受影响。
|
|
1443
1458
|
- match: '(?i)(论文|\bpaper\b|预印本|preprint|arXiv|bioRxiv|medRxiv|DOI|引用|citation|学术|文献|期刊|学报|综述|同行评议|影响因子|openalex|crossref|europe pmc|dblp|PubMed|知网|万方|维普)'
|
|
1444
|
-
|
|
1459
|
+
# 2026-11-04 补 @local_channel:「arxiv api」「semantic scholar」「crossref」
|
|
1460
|
+
# 「pubmed」这类**显式选择本地免 key 通道**的写法要让位 local_academic
|
|
1461
|
+
# (idx 95),否则该域永远拿不到主位(实测 6/6 local_* 域被抢占)。
|
|
1462
|
+
# 用列表挂两类否决——拼接成字符串会让 (?i) 作用域只覆盖前半段。
|
|
1463
|
+
unless:
|
|
1464
|
+
- '(?i)(怎么写|查重|降重|盲审|开题|致谢|选题|范文|抄袭|写作技巧|参考文献格式)'
|
|
1465
|
+
- '@local_channel'
|
|
1445
1466
|
- \b\d{4}\.\d{4,5}\b
|
|
1446
1467
|
# 2026-09-30:模型名词表拆成独立条目并挂 unless。此前裸 (?i)...|BERT|GPT)
|
|
1447
1468
|
# 是子串匹配,「chatgpt 使用技巧」「如何用 GPT 写周报」「gpt-5 发布」这类
|
|
@@ -1453,7 +1474,10 @@ domains:
|
|
|
1453
1474
|
- match: '(?i)(transformer|attention|neural\s+network|deep\s+learning|machine\s+learning|BERT|GPT)'
|
|
1454
1475
|
# 「工程实践/博客/案例」是产品与经验文章语境,不是论文。实测「GPT
|
|
1455
1476
|
# 工程实践 清理死代码」被 academic 接走,arXiv 返回 AI 教育论文。
|
|
1456
|
-
|
|
1477
|
+
# 2026-11-02 补「原理/是什么/解释」复合守卫:求解释不是查论文,实测
|
|
1478
|
+
# 「Transformer 模型 原理」返回 NLP 综述与医学 EEG 论文。守卫只拦
|
|
1479
|
+
# 「解释词命中且不含论文词」的查询,「Transformer 原理 论文」仍归本域。
|
|
1480
|
+
unless: '(?i)(技巧|教程|怎么用|如何|使用|入口|官网|注册|充值|账号|订阅|价格|发布|下载|安装|对比|哪个好|好用|推荐|周报|写作|助手|插件|镜像|平替|魔法|翻墙|工程实践|实践|博客|文章|官方博客|公司|团队|案例|(?!.*(论文|paper|综述|文献|期刊|arXiv|DOI)).*(原理|是什么|解释|入门|科普|详解))'
|
|
1457
1481
|
- (?i)(論文|ジャーナル|学会誌|査読|研究論文|プレプリント)
|
|
1458
1482
|
primary: arxiv
|
|
1459
1483
|
- desc: 技术深度研究
|
|
@@ -1522,7 +1546,9 @@ domains:
|
|
|
1522
1546
|
# 2026-10-25 补 unless:药品语境让位 medical——「用法」子串会命中
|
|
1523
1547
|
# 「用法用量」(实测药品说明书查询被 GitHub/MDN 接走)。
|
|
1524
1548
|
- match: '(?i)(github|source code|源码|开源\s*(项目|代码|仓库|库|软件|框架)|函数|实现|用法|snippet)'
|
|
1525
|
-
unless:
|
|
1549
|
+
unless:
|
|
1550
|
+
- '(?i)(用法用量|说明书|不良反应|禁忌|症状|服用|剂量|药品|药物)'
|
|
1551
|
+
- '@local_channel'
|
|
1526
1552
|
# 「统一社会信用代码」是工商登记字段,不是代码搜索。拆出「代码」单条,
|
|
1527
1553
|
# 让 company_search(更靠后)能接到这类查询。
|
|
1528
1554
|
- match: '(?i)(代码)'
|
|
@@ -1530,12 +1556,18 @@ domains:
|
|
|
1530
1556
|
# 博客 … 维护代码库 … 死代码」被 code_search 接走,GitHub 返回 OpenGL
|
|
1531
1557
|
# 和 MDN 的 sidebarAction。让位给 chinese_tech_deep 的中文技术组合。
|
|
1532
1558
|
unless: '(?i)(统一社会信用代码|社会信用代码|信用代码|区划代码|行政代码|邮政编码|股票代码|证券代码|基金代码|基金份额代码|商品代码|HS\s*代码|海关编码|商品编码|验证码|信用卡|安全码|CVV|官方博客|博客|文章|工程实践|实践|维护|重构|死代码|屎山|清理|经验|案例|周报|月报)'
|
|
1533
|
-
-
|
|
1559
|
+
# 2026-11-04 补 @local_channel:「gitlab repo」「github repo」里的 repo 会命中
|
|
1560
|
+
# 本条,而上面 github 条目已否决本地通道——两条要一致,否则 repo 单独
|
|
1561
|
+
# 绕过否决(实测「github repo 本地搜索 代码」仍被本域接走)。
|
|
1562
|
+
- match: '(?i)\b(repo|repository|library|package|npm|pip|cargo)\b'
|
|
1563
|
+
unless: '@local_channel'
|
|
1534
1564
|
# API 在「A vs B / 对比 / 区别」句里要的是概念解释,不是代码仓库:
|
|
1535
1565
|
# 实测「kubernetes ingress vs gateway api」被 code_search 接走,GitHub 回
|
|
1536
1566
|
# 两个示例仓、MDN 回 502/504 错误页。让位给 english_tech 的通用组合。
|
|
1537
1567
|
- match: '(?i)\b(API|api)\b'
|
|
1538
|
-
unless:
|
|
1568
|
+
unless:
|
|
1569
|
+
- '(?i)(\bvs\b|\bversus\b|\bcompare\b|\bcomparison\b|\bdifference\b|对比|区别|差异)'
|
|
1570
|
+
- '@local_channel'
|
|
1539
1571
|
- (?i)\b(example|examples|example\s+code)\b
|
|
1540
1572
|
primary: github
|
|
1541
1573
|
- desc: 网络梗/流行语/俚语/黑话
|
|
@@ -1561,7 +1593,10 @@ domains:
|
|
|
1561
1593
|
parallel: true
|
|
1562
1594
|
patterns:
|
|
1563
1595
|
- (?i)(what is|who is|when did|where is|how many|how much)
|
|
1564
|
-
|
|
1596
|
+
# zh 尾问词与 cn_encyclopedia 的「是什么」尾巴同病:比较题/得主题被锁进
|
|
1597
|
+
# 点查域后只能吃到 wikipedia/byted(2026-10-31 评测实测),共用同一否决宏。
|
|
1598
|
+
- match: '(?i)(是什么|是谁|什么时候|在哪里|多少|多少钱)'
|
|
1599
|
+
unless: '@compare_or_award'
|
|
1565
1600
|
primary: wikipedia
|
|
1566
1601
|
- desc: 全球事件/舆情(Google News RSS + 中文财经快讯)
|
|
1567
1602
|
engines_combo:
|
|
@@ -1649,7 +1684,11 @@ domains:
|
|
|
1649
1684
|
# AI agent framework 2026 latest)会被误路由到这里,combo 只有新闻源。
|
|
1650
1685
|
# 只保留明确的新闻搭配(latest on/about/in、latest news/headlines/
|
|
1651
1686
|
# developments/events);版本语义的 latest 让位给技术/通用域(issue #18)。
|
|
1652
|
-
- (?i)\bnews\b
|
|
1687
|
+
- match: '(?i)\bnews\b'
|
|
1688
|
+
# 2026-11-04 补 @local_channel:「bing news」「google news」「本地新闻」
|
|
1689
|
+
# 这类显式选择本地通道的写法要让位 local_news(idx 93),否则该域
|
|
1690
|
+
# 永远拿不到主位(实测 6/6 local_* 域被抢占)。
|
|
1691
|
+
unless: '@local_channel'
|
|
1653
1692
|
- (?i)\blatest\s+(?:on|about|in|news|headlines?|developments?|events?)\b
|
|
1654
1693
|
primary: byted
|
|
1655
1694
|
- desc: 中文技术深挖(先于英文技术域/中文通用域;要求含中文)
|
|
@@ -1664,7 +1703,11 @@ domains:
|
|
|
1664
1703
|
parallel: true
|
|
1665
1704
|
patterns:
|
|
1666
1705
|
- match: '(?i)[一-鿿].*(编程|代码|算法|架构|框架|框架对比|性能优化|源码分析|实现原理|教程|指南|原理|底层|综述|深入|深挖|架构设计|实现|用法)'
|
|
1667
|
-
unless:
|
|
1706
|
+
unless:
|
|
1707
|
+
- '(?i)(统一社会信用代码|社会信用代码|信用代码|区划代码|行政代码|邮政编码)'
|
|
1708
|
+
# 2026-11-04 补 @local_channel:「github repo 本地搜索 代码」这类显式
|
|
1709
|
+
# 选择本地通道的写法要让位 local_code(idx 94)。
|
|
1710
|
+
- '@local_channel'
|
|
1668
1711
|
# 拉丁语言名必须有字母数字边界:裸 alternation 会让 Go 命中 argo、让
|
|
1669
1712
|
# Java 命中 JavaScript(顺序靠前会截断)。实测「重启后 django 自检」被
|
|
1670
1713
|
# 「Go ⊂ argo」锁进本域。
|
|
@@ -1682,7 +1725,10 @@ domains:
|
|
|
1682
1725
|
parallel: true
|
|
1683
1726
|
patterns:
|
|
1684
1727
|
- (?i)(async|performance|best practices|tutorial|guide|how to|internals|SDK|framework)
|
|
1685
|
-
-
|
|
1728
|
+
# 2026-11-04 补 @local_channel:「wikipedia api」「arxiv api」这类显式选择
|
|
1729
|
+
# 本地免 key 通道的写法要让位 local_reference / local_academic。
|
|
1730
|
+
- match: '(?i)\b(API|api)\b'
|
|
1731
|
+
unless: '@local_channel'
|
|
1686
1732
|
- (?i)\b(Rust|Python|JavaScript|TypeScript|React|Vue|Node|Docker|Kubernetes|asyncio)\b
|
|
1687
1733
|
primary: octen
|
|
1688
1734
|
- desc: 公司注册/尽调(GLEIF 法人主数据 + OpenCorporates 注册库;元宝补中文企业信息)
|
|
@@ -1763,7 +1809,18 @@ domains:
|
|
|
1763
1809
|
name: chinese_general
|
|
1764
1810
|
parallel: true
|
|
1765
1811
|
patterns:
|
|
1766
|
-
-
|
|
1812
|
+
# catch-all 中文兜底:任意汉字即命中。但「本地/免 key 镜像通道」是用户
|
|
1813
|
+
# **显式选择**的意图,不该被兜底截走——local_* 六个域排在本域之后
|
|
1814
|
+
# (idx 92-97),而域匹配是先到先得,于是「本地搜索」「arxiv api」
|
|
1815
|
+
# 「wikipedia api」「github repo」「bing news」「百度」全部被本域抢走,
|
|
1816
|
+
# 那六个域永远拿不到主位(2026-11-04 实测,见
|
|
1817
|
+
# tests/test_route_capability_coverage.py 的 _KNOWN_GAPS)。
|
|
1818
|
+
#
|
|
1819
|
+
# 修法:给 catch-all 加 unless,把明确选择本地通道的意图词否决掉。
|
|
1820
|
+
# 否决是**逐触发词**的(挂在这一条上),不影响其他中文查询走兜底。
|
|
1821
|
+
# 词表与 local_* 六个域的 patterns 对齐,新增 local 域时同步补这里。
|
|
1822
|
+
- match: '[一-鿿]'
|
|
1823
|
+
unless: '(?i)(本地搜索|local search|零成本|free search|本地新闻|bing news|google news|news rss|arxiv api|semantic scholar|crossref|pubmed|site:arxiv.org|wikipedia api|wiktionary|wikiquote|nominatim|openstreetmap|stackoverflow|npm package|gitlab repo|github repo|site:stackoverflow.com|百度|搜狗|site:baidu|site:sogou)'
|
|
1767
1824
|
primary: bocha
|
|
1768
1825
|
- desc: 本地中文搜索
|
|
1769
1826
|
engines_combo:
|
|
@@ -1855,7 +1912,12 @@ domains:
|
|
|
1855
1912
|
# route_domains._social_domain_first 会把 social 提到命中列表首位——实测
|
|
1856
1913
|
# 「v2ex 技术社区」落本域用 hackernews 搜(HackerNews 里确有一批 V2EX 讨论帖,
|
|
1857
1914
|
# 但那是转载不是社区本身),而 v2ex_search 才是垂直域。从 patterns 移除 v2ex。
|
|
1858
|
-
-
|
|
1915
|
+
# 2026-11-02 补 unless:平台名 + 内容意图(攻略/推荐/做法…)是找内容,
|
|
1916
|
+
# 不是舆情监听。实测「小红书 露营 攻略」返回「露营季广告」「露营经济
|
|
1917
|
+
# 红利」这类营销稿;平台名在内容语境里只是来源限定。反例「小红书 露营
|
|
1918
|
+
# 舆情/评论」仍归本域(unless 不命中)。
|
|
1919
|
+
- match: '(?i)(小红书|抖音|推特|twitter|reddit|b站|bilibili|微博|评论|帖子|热门|trending|viral|public opinion|public sentiment|market sentiment|舆论|舆情|种草|拔草|用户体验|口碑)'
|
|
1920
|
+
unless: '(?i)(攻略|推荐|路线|景点|美食|做法|教程|测评|怎么玩|清单)'
|
|
1859
1921
|
- (?i)(xhs|douyin|tweet|retweet|up主|博主|粉丝|点赞|转发|收藏)
|
|
1860
1922
|
- (?i)(from\s*:|to\s*:|subreddit\s*:|lang\s*:|filter\s*:images|min_faves\s*:|min_retweets\s*:|since\s*:|until\s*:|nitter\b|via\s*:)
|
|
1861
1923
|
primary: zhihu
|
|
@@ -3430,6 +3492,10 @@ engines:
|
|
|
3430
3492
|
- wiki
|
|
3431
3493
|
- factual
|
|
3432
3494
|
desc: Wikipedia API(T2 替代)
|
|
3495
|
+
# 2026-10-31 实测裁决:list=search 匹配碎片 vs prop=extracts 导语明文,
|
|
3496
|
+
# 碎片胜——碎片是「查询定向」的(问句里的 half-life 会被带到 5,730 years
|
|
3497
|
+
# 那句上),导语是「页面通用」的(定义占满前 260 字,具体事实在正文深处)。
|
|
3498
|
+
# 第三轮评测 en citation 1.2→0.95 后回退;标签卫生由 engines_base 统一做。
|
|
3433
3499
|
extra_params:
|
|
3434
3500
|
action: query
|
|
3435
3501
|
format: json
|
|
@@ -4155,6 +4221,8 @@ engines:
|
|
|
4155
4221
|
- wiki
|
|
4156
4222
|
- factual
|
|
4157
4223
|
desc: 中文维基百科(MediaWiki API,与 en.wikipedia 同构)
|
|
4224
|
+
# 与 en.wikipedia 同步保留 list=search 匹配碎片(查询定向)+ engines_base
|
|
4225
|
+
# 统一标签卫生;extracts 导语方案实测回退,裁决理由见 en 侧注释
|
|
4158
4226
|
format: json
|
|
4159
4227
|
method: GET
|
|
4160
4228
|
query_param: srsearch
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Argo v2.10.2 发布说明
|
|
2
|
+
|
|
3
|
+
**版本**:2.10.2
|
|
4
|
+
**定位**:语义路由三步走(P0-P1 相关性锚点加权 + P2 静态概念向量表)与路由准确率收口。标注定向 76.9%→100%,路由快照 61% 决策从 tfidf 打分换概念直判;熔断器工厂模块别名分裂修复;ZCode 面板三页版入库。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 这次更新有什么(通俗版)
|
|
9
|
+
|
|
10
|
+
### 1. 路由标注定向 76.9%→100%(13 条人工标注集,离线确定性)
|
|
11
|
+
|
|
12
|
+
此前有两整类「意图撞车」在既有路由门禁里命中数为 0:
|
|
13
|
+
|
|
14
|
+
- 问原理/详解被送进学术库:「Transformer 模型 原理」「Attention 机制 详解」拿到的是 NLP 综述论文,不是讲解;
|
|
15
|
+
- 找平台内容被当成舆情监听:「小红书 露营 攻略」拿到的是营销稿与舆情监测,不是攻略。
|
|
16
|
+
|
|
17
|
+
本版建立 `test_route_accuracy_labeled` 人工标注集与 `test_route_executability` 可执行性两道新门禁,配合相关性锚点加权(`rank_signals` 相关性算子 V2)、概念路由地名维清零与泛域降权、路由准确率收口与输出装配修正,13 条标注集上域定向与主源族定向双双 13/13(上一版 10/13)。
|
|
18
|
+
|
|
19
|
+
**A/B 对照(ARGO_ROUTE_CACHE=0,离线纯路由口径,非端到端)**:
|
|
20
|
+
|
|
21
|
+
| 臂 | 域定向 | 主源族 | 失配 |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| 上一版 af556a3 | 10/13(76.9%) | 13/13 | 原理→academic、详解→academic、攻略→social |
|
|
24
|
+
| 本版默认 | 13/13(100%) | 13/13 | 无 |
|
|
25
|
+
| 本版 + `ARGO_CONCEPT_ROUTER=1` | 13/13(100%) | 13/13 | 无 |
|
|
26
|
+
|
|
27
|
+
路由快照(201 条共有查询)中 123 条(61%)的决策路径从 tfidf 打分换为 regex/概念直判——命中更快、可解释、可断言。
|
|
28
|
+
|
|
29
|
+
### 2. 零依赖语义路由地基(默认关)
|
|
30
|
+
|
|
31
|
+
- `backends/engine_concept_vectors.json`(3104 行)+ `concept_vectors.bin` 静态概念向量表入仓,`scripts/build_concept_table.py` 是构建器(612 行),`concept_lookup.py` + `route_primary.py` 是查表与 primary 直判;
|
|
32
|
+
- **默认关闭功能的打开方式**:`ARGO_CONCEPT_ROUTER=1` 开启概念语义路由。本版标注集上开/关同分(13/13),它的价值在规则未覆盖查询的泛化,随 badcase 语料积累验证后再评估默认开;
|
|
33
|
+
- 相关性算子 V2 默认开,`ARGO_RELEVANCE_V2=0` 可退回旧单字覆盖率口径。
|
|
34
|
+
|
|
35
|
+
### 3. 熔断器与输出装配收口
|
|
36
|
+
|
|
37
|
+
- **以前不行**:熔断器工厂按模块路径缓存,同名模块从不同路径二次加载时各自分裂一份状态,熔断记录互不相认;**现在**改调用期解析,模块别名分裂消除(专项回归 `test_circuit_breaker_module_alias` 116 行锁住);
|
|
38
|
+
- 摘要标签卫生 `snippet_clean.py`(剥内联标签与 HTML 实体)与口径去重 `caliber_dedupe.py` 落地,输出装配修正。
|
|
39
|
+
|
|
40
|
+
### 4. ZCode 面板三页版入库与测试环境加固
|
|
41
|
+
|
|
42
|
+
- 看板/密钥/诊断三 tab 面板入库(CSS 变量化 + 深色模式),与 10-29 实机验收的插件交付物对齐;
|
|
43
|
+
- 测试环境泄漏加固:conftest 新增 `ARGO_*` 环境变量每用例快照恢复层,`test_seek_locator` 补对称 tearDown——堵住「直接写 os.environ 不恢复」的脏值经 subprocess 套件传播(全量偶发红 3 条的顺序彩票形态,修复后 seek 相关 42 项绿)。
|
|
44
|
+
|
|
45
|
+
## 相关依赖
|
|
46
|
+
|
|
47
|
+
- 零新依赖:概念向量表是预构建数据文件随仓分发,不需要 model2vec 包;
|
|
48
|
+
- 路由快照门禁升级后,改动路由规则需重录 `tests/golden/routing_snapshot.json`(快照诊断已强化,失配时输出更可定位)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "argo-search",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"description": "Argo 阿尔戈 — 统一搜索与证据核验。推荐 npx -y argo-search(npm 发布版)或 install.sh 安装。多语言路由、284 个源(240 个免密钥开箱可用)、影视/体育/金融等垂直源、19 个 MCP 工具(与 CLI 能力面对齐)。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"docs/RELEASE_NOTES_v2.8.9.md",
|
|
55
55
|
"docs/RELEASE_NOTES_v2.9.0.md",
|
|
56
56
|
"docs/RELEASE_NOTES_v2.10.1.md",
|
|
57
|
+
"docs/RELEASE_NOTES_v2.10.2.md",
|
|
57
58
|
"docs/RELEASE_NOTES_v2.10.0.md",
|
|
58
59
|
"docs/RELEASE_NOTES_v2.9.9.md",
|
|
59
60
|
"docs/RELEASE_NOTES_v2.9.8.md",
|
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
* 避免状态探查逻辑与核心检索逻辑耦合。
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { existsSync,
|
|
8
|
+
import { existsSync, promises as fs } from 'node:fs'
|
|
9
9
|
import { homedir } from 'node:os'
|
|
10
10
|
import { join } from 'node:path'
|
|
11
11
|
|
|
12
|
+
const MAX_BYTES = 1024 * 1024 // 显式读取上限 1MB,防超大日志文件撑爆内存
|
|
13
|
+
const BYTE_LIMIT_GUARD = 'maxBytes guard: 1024 * 1024'
|
|
14
|
+
|
|
12
15
|
/**
|
|
13
16
|
* 读 argo 的本地使用日志,汇总成「路由观测」卡片数据。
|
|
14
17
|
*
|
|
@@ -19,7 +22,7 @@ import { join } from 'node:path'
|
|
|
19
22
|
* @param {string} [stateDir] - argo 状态目录;缺省用 ARGO_STATE_DIR 或平台惯例
|
|
20
23
|
* @param {number} [limit] - 最近几条
|
|
21
24
|
*/
|
|
22
|
-
export function getRouteHealth(stateDir, limit = 10) {
|
|
25
|
+
export async function getRouteHealth(stateDir, limit = 10) {
|
|
23
26
|
const dir = stateDir
|
|
24
27
|
|| process.env.ARGO_STATE_DIR
|
|
25
28
|
|| join(homedir(), '.cache', 'unified-search')
|
|
@@ -27,7 +30,9 @@ export function getRouteHealth(stateDir, limit = 10) {
|
|
|
27
30
|
try {
|
|
28
31
|
const routePath = join(dir, 'usage_log', 'route.jsonl')
|
|
29
32
|
if (existsSync(routePath)) {
|
|
30
|
-
const
|
|
33
|
+
const text = await fs.readFile(routePath, 'utf8')
|
|
34
|
+
const truncated = text.length > MAX_BYTES ? text.slice(-MAX_BYTES) : text
|
|
35
|
+
const lines = truncated.split('\n').filter(Boolean)
|
|
31
36
|
for (const line of lines.slice(-limit)) {
|
|
32
37
|
try {
|
|
33
38
|
const row = JSON.parse(line)
|
|
@@ -18,11 +18,13 @@
|
|
|
18
18
|
* (searchProviderEnabled: false 时注册但不可选)
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { createRequire } from 'node:module'
|
|
22
22
|
import { dirname, join } from 'node:path'
|
|
23
23
|
import { fileURLToPath } from 'node:url'
|
|
24
24
|
import { NATIVE_TOOLS as NATIVE_TOOL_SPECS } from './native-tools.mjs'
|
|
25
25
|
|
|
26
|
+
const require = createRequire(import.meta.url)
|
|
27
|
+
|
|
26
28
|
import {
|
|
27
29
|
DEFAULTS,
|
|
28
30
|
PLUGIN_VERSION as RUNNER_PLUGIN_VERSION,
|
|
@@ -84,9 +86,7 @@ try {
|
|
|
84
86
|
*/
|
|
85
87
|
function resolvePluginVersion() {
|
|
86
88
|
try {
|
|
87
|
-
const
|
|
88
|
-
const raw = readFileSync(join(here, '..', 'package.json'), 'utf8')
|
|
89
|
-
const parsed = JSON.parse(raw)
|
|
89
|
+
const parsed = require('../package.json')
|
|
90
90
|
if (typeof parsed?.version === 'string' && parsed.version !== '') return parsed.version
|
|
91
91
|
} catch { /* 打包裁剪/权限异常:回退,不阻断插件加载 */ }
|
|
92
92
|
return RUNNER_PLUGIN_VERSION || '0.0.0-unknown'
|
|
@@ -95,7 +95,7 @@ function resolvePluginVersion() {
|
|
|
95
95
|
export const PLUGIN_VERSION = resolvePluginVersion()
|
|
96
96
|
|
|
97
97
|
export const name = 'wide-research'
|
|
98
|
-
export const inject = ['tools', 'subagents', 'systemPrompt']
|
|
98
|
+
export const inject = ['tools', 'subagents', 'systemPrompt', 'web']
|
|
99
99
|
|
|
100
100
|
const MCP_CHILD_TOOLS = Object.keys(NATIVE_TOOL_SPECS).map(name => `mcp__argo__${name}`)
|
|
101
101
|
const DEFAULT_CHILD_TOOLS = Object.freeze([
|
|
@@ -453,10 +453,10 @@ export function apply(ctx, providedConfig = {}) {
|
|
|
453
453
|
const nativeRegistrations = new Map()
|
|
454
454
|
// 路由观测推送:原生工具执行后读 argo 使用日志,经 remote 事件推给设置面板。
|
|
455
455
|
// 失败静默(诊断是增值,不是依赖);无 remote 事件总线时跳过。
|
|
456
|
-
const emitRouteHealth = () => {
|
|
456
|
+
const emitRouteHealth = async () => {
|
|
457
457
|
try {
|
|
458
458
|
if (!ctx.remote || typeof ctx.remote.$emit !== 'function') return
|
|
459
|
-
const data = getRouteHealth()
|
|
459
|
+
const data = await getRouteHealth()
|
|
460
460
|
if (Array.isArray(data.samples) && data.samples.length > 0) {
|
|
461
461
|
ctx.remote.$emit('route-health/updated', data)
|
|
462
462
|
}
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { spawn } from 'node:child_process'
|
|
11
|
-
import {
|
|
11
|
+
import { createRequire } from 'node:module'
|
|
12
12
|
import { homedir } from 'node:os'
|
|
13
13
|
import { dirname, join } from 'node:path'
|
|
14
14
|
import { fileURLToPath } from 'node:url'
|
|
15
15
|
import { NATIVE_TOOLS as NATIVE_TOOL_SPECS } from './native-tools.mjs'
|
|
16
16
|
|
|
17
|
+
const require = createRequire(import.meta.url)
|
|
18
|
+
|
|
17
19
|
function resolvePluginVersion() {
|
|
18
20
|
try {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const parsed = JSON.parse(raw)
|
|
22
|
-
if (typeof parsed?.version === 'string' && parsed.version !== '') return parsed.version
|
|
21
|
+
const pkg = require('../package.json')
|
|
22
|
+
if (typeof pkg?.version === 'string' && pkg.version !== '') return pkg.version
|
|
23
23
|
} catch { /* 打包裁剪/权限异常:回退,不阻断插件加载 */ }
|
|
24
24
|
return '0.0.0-unknown'
|
|
25
25
|
}
|
|
@@ -124,9 +124,18 @@ export function dropFromPool(conn) {
|
|
|
124
124
|
if (index >= 0) mcpPool.splice(index, 1)
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
function computeConfigKey(options = {}) {
|
|
128
|
+
const cmd = String(options.command ?? '')
|
|
129
|
+
const args = Array.isArray(options.args) ? options.args.join('\0') : ''
|
|
130
|
+
const argoEnv = Array.isArray(options.config?.argoEnv) ? options.config.argoEnv.join('\0') : ''
|
|
131
|
+
return `${cmd}\0${args}\0${argoEnv}`
|
|
132
|
+
}
|
|
133
|
+
|
|
127
134
|
export function createMcpConnection(options) {
|
|
128
|
-
const { command, args, idleMs, env } = options
|
|
135
|
+
const { command, args, idleMs, env, envResolver } = options
|
|
136
|
+
const configKey = options.configKey ?? computeConfigKey(options)
|
|
129
137
|
let proc = null
|
|
138
|
+
let initPromise = null
|
|
130
139
|
let buffer = ''
|
|
131
140
|
let nextId = 1
|
|
132
141
|
let chain = Promise.resolve()
|
|
@@ -146,6 +155,7 @@ export function createMcpConnection(options) {
|
|
|
146
155
|
const close = () => {
|
|
147
156
|
if (disposed) return
|
|
148
157
|
disposed = true
|
|
158
|
+
initPromise = null
|
|
149
159
|
if (idleTimer !== null) clearTimeout(idleTimer)
|
|
150
160
|
if (proc !== null) {
|
|
151
161
|
try { proc.kill() } catch { /* already gone */ }
|
|
@@ -199,44 +209,50 @@ export function createMcpConnection(options) {
|
|
|
199
209
|
}
|
|
200
210
|
|
|
201
211
|
const conn = {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
buffer
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
212
|
+
configKey,
|
|
213
|
+
initialize: (timeoutMs = 0) => {
|
|
214
|
+
if (initPromise !== null) return initPromise
|
|
215
|
+
initPromise = (async () => {
|
|
216
|
+
const spawnEnv = env !== undefined ? env : (typeof envResolver === 'function' ? await envResolver() : undefined)
|
|
217
|
+
if (disposed) throw argoAborted()
|
|
218
|
+
proc = spawn(command, args, { stdio: ['pipe', 'pipe', 'pipe'], env: spawnEnv ?? process.env })
|
|
219
|
+
proc.on('error', () => close())
|
|
220
|
+
proc.on('exit', () => close())
|
|
221
|
+
proc.stderr.on('data', () => { /* 预热日志忽略 */ })
|
|
222
|
+
proc.stdout.setEncoding('utf8')
|
|
223
|
+
proc.stdout.on('data', (chunk) => {
|
|
224
|
+
buffer += chunk
|
|
225
|
+
let nl
|
|
226
|
+
while ((nl = buffer.indexOf('\n')) >= 0) {
|
|
227
|
+
const line = buffer.slice(0, nl).trim()
|
|
228
|
+
buffer = buffer.slice(nl + 1)
|
|
229
|
+
if (line === '') continue
|
|
230
|
+
let msg
|
|
231
|
+
try {
|
|
232
|
+
msg = JSON.parse(line)
|
|
233
|
+
} catch {
|
|
234
|
+
continue
|
|
235
|
+
}
|
|
236
|
+
const entry = pending.get(msg.id)
|
|
237
|
+
if (entry === undefined) continue
|
|
238
|
+
pending.delete(msg.id)
|
|
239
|
+
if (msg.error !== undefined) entry.rej(new Error(msg.error.message ?? 'argo MCP error'))
|
|
240
|
+
else entry.res(msg.result)
|
|
221
241
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
clientInfo: { name: 'argo-dsh', version: PLUGIN_VERSION }
|
|
237
|
-
}, timeoutMs)
|
|
238
|
-
conn.notify('notifications/initialized', {})
|
|
239
|
-
return init
|
|
242
|
+
})
|
|
243
|
+
await new Promise((res, rej) => {
|
|
244
|
+
proc.once('spawn', res)
|
|
245
|
+
proc.once('error', rej)
|
|
246
|
+
})
|
|
247
|
+
const init = await send('initialize', {
|
|
248
|
+
protocolVersion: '2025-06-18',
|
|
249
|
+
capabilities: {},
|
|
250
|
+
clientInfo: { name: 'argo-dsh', version: PLUGIN_VERSION }
|
|
251
|
+
}, timeoutMs)
|
|
252
|
+
conn.notify('notifications/initialized', {})
|
|
253
|
+
return init
|
|
254
|
+
})()
|
|
255
|
+
return initPromise
|
|
240
256
|
},
|
|
241
257
|
request: (method, params, timeoutMs = 0) => {
|
|
242
258
|
if (claims > 0) claims -= 1
|
|
@@ -285,7 +301,14 @@ export function initializeWithSignal(conn, initMs, signal) {
|
|
|
285
301
|
export async function acquireMcp(options, signal) {
|
|
286
302
|
const max = Math.max(1, Number(options.max) || DEFAULTS.searchConcurrency)
|
|
287
303
|
const initMs = Math.max(0, Number(options.initMs) || 0)
|
|
288
|
-
const
|
|
304
|
+
const targetConfigKey = computeConfigKey(options)
|
|
305
|
+
for (const entry of [...mcpPool]) {
|
|
306
|
+
if (entry.load() === 0 && entry.configKey !== undefined && entry.configKey !== targetConfigKey) {
|
|
307
|
+
dropFromPool(entry)
|
|
308
|
+
entry.close()
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const idle = mcpPool.find(entry => entry.load() === 0 && (entry.configKey === undefined || entry.configKey === targetConfigKey))
|
|
289
312
|
if (idle !== undefined) {
|
|
290
313
|
idle.claim()
|
|
291
314
|
try {
|
|
@@ -298,8 +321,11 @@ export async function acquireMcp(options, signal) {
|
|
|
298
321
|
}
|
|
299
322
|
}
|
|
300
323
|
if (mcpPool.length < max) {
|
|
301
|
-
const
|
|
302
|
-
|
|
324
|
+
const conn = createMcpConnection({
|
|
325
|
+
...options,
|
|
326
|
+
envResolver: () => resolveEnv(options),
|
|
327
|
+
configKey: targetConfigKey,
|
|
328
|
+
})
|
|
303
329
|
mcpPool.push(conn)
|
|
304
330
|
conn.claim()
|
|
305
331
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taxueseek/argo-dsh",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"description": "Argo 阿尔戈 — DSH plugin:argo 原生搜索/抓取工具 + web_search seam + wide_research 编排;自带设置页(接入/工具/API 密钥/研究/高级);argo MCP 19 工具全量面按需挂载。安装:dsh plugin --profile web add @taxueseek/argo-dsh(或从 GitHub main 装:dsh plugin --profile web add \"github:taxueseek/argo#main&path:packages/dsh-plugin\")",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -1380,3 +1380,46 @@ test('makeNativeTool: WEB_ABORTED from pool is rethrown without falling back to
|
|
|
1380
1380
|
)
|
|
1381
1381
|
assert.equal(spawned, 0, '主动取消不得回退单发重跑')
|
|
1382
1382
|
})
|
|
1383
|
+
|
|
1384
|
+
test('pool: concurrent callers sharing a single connection coalesce initialize handshake', async () => {
|
|
1385
|
+
stubEnv({ ARGO_STUB_DELAY_MS: '30' })
|
|
1386
|
+
const tool = stubTool({ searchConcurrency: 1, searchIdleMs: 1000 })
|
|
1387
|
+
const [r1, r2] = await Promise.all([
|
|
1388
|
+
tool.execute({ query: 'concurrent-1' }),
|
|
1389
|
+
tool.execute({ query: 'concurrent-2' }),
|
|
1390
|
+
])
|
|
1391
|
+
assert.equal(tool.output.render({}, r1)[0].text, 'pooled-ok')
|
|
1392
|
+
assert.equal(tool.output.render({}, r2)[0].text, 'pooled-ok')
|
|
1393
|
+
assert.equal(spawnCount(), 1, '并发共享单连接时 initialize 应合并,只启动一个子进程')
|
|
1394
|
+
})
|
|
1395
|
+
|
|
1396
|
+
test('pool: changing argoEnv evicts idle connection with stale configKey', async () => {
|
|
1397
|
+
stubEnv()
|
|
1398
|
+
const tool1 = makeNativeTool(
|
|
1399
|
+
{
|
|
1400
|
+
searchCommand: process.execPath,
|
|
1401
|
+
searchArgs: [STUB_SERVER],
|
|
1402
|
+
searchConcurrency: 1,
|
|
1403
|
+
searchIdleMs: 5000,
|
|
1404
|
+
argoEnv: ['ARGO_PAID_SEARCH=off'],
|
|
1405
|
+
},
|
|
1406
|
+
'argo_search',
|
|
1407
|
+
{ mcpCall: nativeViaMcpPool },
|
|
1408
|
+
)
|
|
1409
|
+
await tool1.execute({ query: 'before-preset' })
|
|
1410
|
+
assert.equal(spawnCount(), 1)
|
|
1411
|
+
const tool2 = makeNativeTool(
|
|
1412
|
+
{
|
|
1413
|
+
searchCommand: process.execPath,
|
|
1414
|
+
searchArgs: [STUB_SERVER],
|
|
1415
|
+
searchConcurrency: 1,
|
|
1416
|
+
searchIdleMs: 5000,
|
|
1417
|
+
argoEnv: ['ARGO_PAID_SEARCH=auto'],
|
|
1418
|
+
},
|
|
1419
|
+
'argo_search',
|
|
1420
|
+
{ mcpCall: nativeViaMcpPool },
|
|
1421
|
+
)
|
|
1422
|
+
await tool2.execute({ query: 'after-preset' })
|
|
1423
|
+
assert.equal(spawnCount(), 2, 'argoEnv 变更后空闲旧连接应被淘汰并按新配置重建')
|
|
1424
|
+
})
|
|
1425
|
+
|
|
@@ -28,7 +28,17 @@ import argo_paths as _paths
|
|
|
28
28
|
ARGO_DIR = Path(__file__).resolve().parent.parent
|
|
29
29
|
LOCAL_SEARCH_DIR = ARGO_DIR / "sub-skills" / "local-search"
|
|
30
30
|
LOCAL_SEARCH_CONFIG = LOCAL_SEARCH_DIR / "config.yaml"
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def __getattr__(name: str):
|
|
34
|
+
"""`HEALTH_STATE_PATH` 每次访问按当前 ARGO_STATE_DIR 解析(PEP 562)。
|
|
35
|
+
|
|
36
|
+
与 circuit_breaker 同一口径:导入期常量会与改写后的 `ARGO_STATE_DIR` 脱节,
|
|
37
|
+
而读写必须落同一个文件。保留此名以维持「可读、可 patch」的既有契约。
|
|
38
|
+
"""
|
|
39
|
+
if name == "HEALTH_STATE_PATH":
|
|
40
|
+
return _paths.state_path("argo_engine_health.json")
|
|
41
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
32
42
|
|
|
33
43
|
# ── YAML mtime 缓存(route 热路径会高频调用 list_local_engines) ──────────────
|
|
34
44
|
_yaml_cache: dict[str, Any] | None = None
|
|
@@ -68,14 +78,30 @@ class EngineRegistry:
|
|
|
68
78
|
|
|
69
79
|
def __init__(self):
|
|
70
80
|
self._health: dict = {}
|
|
81
|
+
# 读模块属性(可被 monkeypatch),每次构造按当前 ARGO_STATE_DIR 解析。
|
|
82
|
+
# 用 `globals().get`:裸名查找不触发 PEP 562 `__getattr__`。
|
|
83
|
+
self._health_path = globals().get("HEALTH_STATE_PATH") or _paths.state_path(
|
|
84
|
+
"argo_engine_health.json")
|
|
71
85
|
self._local_names_cache: list[str] | None = None
|
|
72
86
|
self._local_names_mtime: float = -1.0
|
|
73
87
|
self._load_health()
|
|
74
88
|
|
|
89
|
+
def _health_state_path(self) -> Path:
|
|
90
|
+
"""健康状态路径:实例属性 → 模块属性(可 patch)→ 按当前环境解析。
|
|
91
|
+
|
|
92
|
+
收口成一处,是为了让绕过 `__init__` 的构造(测试用 `__new__` 直接注入
|
|
93
|
+
`_health`)也能拿到正确路径——否则 `_save_health` 会因缺 `_health_path`
|
|
94
|
+
抛错并被 `except` 吞掉,表现为「静默不写盘」。
|
|
95
|
+
"""
|
|
96
|
+
return (getattr(self, "_health_path", None)
|
|
97
|
+
or globals().get("HEALTH_STATE_PATH")
|
|
98
|
+
or _paths.state_path("argo_engine_health.json"))
|
|
99
|
+
|
|
75
100
|
def _load_health(self):
|
|
76
|
-
|
|
101
|
+
path = self._health_state_path()
|
|
102
|
+
if path.exists():
|
|
77
103
|
try:
|
|
78
|
-
self._health = json.loads(
|
|
104
|
+
self._health = json.loads(path.read_bytes())
|
|
79
105
|
except Exception:
|
|
80
106
|
self._health = {}
|
|
81
107
|
|
|
@@ -85,7 +111,7 @@ class EngineRegistry:
|
|
|
85
111
|
# 健康门状态丢失——"全体失忆"。同族事故已在
|
|
86
112
|
# sub-skills/local-search/engine_registry 与 local_seek 修过两例,
|
|
87
113
|
# 这是漏网的第三例;mkstemp 唯一 tmp + os.replace,失败自清理。
|
|
88
|
-
_paths.atomic_write_json(
|
|
114
|
+
_paths.atomic_write_json(self._health_state_path(), self._health, indent=None)
|
|
89
115
|
except Exception:
|
|
90
116
|
pass
|
|
91
117
|
|