argo-search 2.14.0 → 2.15.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.
Files changed (207) hide show
  1. package/AGENTS.md +8 -6
  2. package/README.es.md +56 -824
  3. package/README.ja.md +55 -825
  4. package/README.ko.md +55 -823
  5. package/README.md +128 -868
  6. package/README.zh.md +206 -0
  7. package/SKILL.md +17 -18
  8. package/assets/readme/counts.json +1 -1
  9. package/assets/readme/hero.svg +23 -23
  10. package/backends/concept_vectors.bin +0 -0
  11. package/backends/domain_profiles.json +66 -0
  12. package/backends/engine_concept_vectors.json +1525 -1525
  13. package/backends/engine_registry.yaml +193 -46
  14. package/backends/quota_profiles.json +110 -0
  15. package/bin/argo +30 -17
  16. package/config.yaml +196 -36
  17. package/docs/ADDING_NEW_ENGINE.md +10 -0
  18. package/docs/ARGO_INTRO.md +1 -1
  19. package/docs/CHANGELOG.md +45 -0
  20. package/docs/ENGINE_CATALOG.md +128 -112
  21. package/docs/MCP_SETUP.md +2 -2
  22. package/docs/RELEASE_NOTES_v2.14.0.md +12 -1
  23. package/docs/RELEASE_NOTES_v2.14.1.md +80 -0
  24. package/docs/RELEASE_NOTES_v2.15.0.md +50 -0
  25. package/docs/RELEASING.md +53 -1
  26. package/engines/specs/ai_labs.yaml +89 -0
  27. package/engines/specs/artic.yaml +11 -1
  28. package/engines/specs/bilibili_hot.yaml +11 -1
  29. package/engines/specs/brave.yaml +3 -3
  30. package/engines/specs/cisa_alerts.yaml +40 -0
  31. package/engines/specs/cleveland.yaml +15 -1
  32. package/engines/specs/clinicaltrials.yaml +16 -1
  33. package/engines/specs/cn_ai_news.yaml +10 -8
  34. package/engines/specs/cnii.yaml +15 -4
  35. package/engines/specs/deezer.yaml +12 -1
  36. package/engines/specs/digup.yaml +11 -6
  37. package/engines/specs/doaj.yaml +14 -1
  38. package/engines/specs/douyin_hot.yaml +11 -1
  39. package/engines/specs/dw_news.yaml +4 -2
  40. package/engines/specs/endoflife.yaml +16 -1
  41. package/engines/specs/eng_blogs.yaml +63 -0
  42. package/engines/specs/eu_opendata.yaml +11 -1
  43. package/engines/specs/europeana.yaml +22 -5
  44. package/engines/specs/feed.yaml +62 -0
  45. package/engines/specs/felo.yaml +3 -3
  46. package/engines/specs/figshare.yaml +12 -1
  47. package/engines/specs/firecrawl.yaml +3 -0
  48. package/engines/specs/fourget.yaml +5 -2
  49. package/engines/specs/france24.yaml +6 -4
  50. package/engines/specs/fxtwitter.yaml +29 -6
  51. package/engines/specs/grepapp_mcp.yaml +62 -0
  52. package/engines/specs/guardian_rss.yaml +6 -4
  53. package/engines/specs/hackernews.yaml +17 -2
  54. package/engines/specs/hal.yaml +19 -1
  55. package/engines/specs/hf_datasets.yaml +59 -0
  56. package/engines/specs/hf_papers.yaml +17 -1
  57. package/engines/specs/itotii.yaml +13 -1
  58. package/engines/specs/jikan.yaml +12 -10
  59. package/engines/specs/kaggle.yaml +5 -3
  60. package/engines/specs/lobsters.yaml +41 -0
  61. package/engines/specs/local_seek.yaml +6 -0
  62. package/engines/specs/maven.yaml +61 -0
  63. package/engines/specs/nasa_cmr.yaml +12 -1
  64. package/engines/specs/nuget.yaml +57 -0
  65. package/engines/specs/open_meteo.yaml +1 -1
  66. package/engines/specs/redskill.yaml +2 -0
  67. package/engines/specs/searxng.yaml +4 -2
  68. package/engines/specs/sec_edgar.yaml +8 -3
  69. package/engines/specs/tatoeba.yaml +14 -1
  70. package/engines/specs/tinyfish.yaml +2 -0
  71. package/engines/specs/tinyfish_news.yaml +2 -0
  72. package/engines/specs/tinyfish_paper.yaml +2 -0
  73. package/engines/specs/toutiao_hot.yaml +11 -1
  74. package/engines/specs/train.yaml +3 -0
  75. package/engines/specs/tvmaze.yaml +5 -1
  76. package/engines/specs/twitter.yaml +4 -0
  77. package/engines/specs/unpaywall.yaml +6 -0
  78. package/engines/specs/usda.yaml +14 -1
  79. package/engines/specs/vam.yaml +17 -3
  80. package/engines/specs/weibo_hot.yaml +11 -1
  81. package/engines/specs/wolframalpha.yaml +3 -3
  82. package/engines/specs/xiaohongshu.yaml +2 -0
  83. package/engines/specs/zhihu.yaml +3 -18
  84. package/engines/specs/zhihu_kb.yaml +18 -0
  85. package/engines/specs/zhihu_questions.yaml +19 -0
  86. package/package.json +4 -2
  87. package/packages/dsh-plugin/README.md +9 -14
  88. package/packages/dsh-plugin/dsh/client.js +467 -1024
  89. package/packages/dsh-plugin/dsh/diagnostics.js +71 -20
  90. package/packages/dsh-plugin/dsh/native-tools.mjs +61 -113
  91. package/packages/dsh-plugin/dsh/runner.js +2 -0
  92. package/packages/dsh-plugin/dsh/wide-research.js +1 -1
  93. package/packages/dsh-plugin/package.json +8 -3
  94. package/packages/dsh-plugin/scripts/sync-local.mjs +87 -0
  95. package/packages/dsh-plugin/scripts/sync-local.sh +13 -1
  96. package/packages/dsh-plugin/test/diagnostics.test.js +38 -1
  97. package/packages/dsh-plugin/test/size-gate.test.js +2 -9
  98. package/scripts/adaptive.py +7 -1
  99. package/scripts/archive_run.py +112 -53
  100. package/scripts/argo_paths.py +40 -3
  101. package/scripts/badcase_ledger.py +153 -10
  102. package/scripts/build_concept_table.py +112 -55
  103. package/scripts/build_release_assets.sh +43 -15
  104. package/scripts/cache.py +5 -1
  105. package/scripts/caliber_isolation.py +60 -23
  106. package/scripts/circuit_breaker.py +56 -8
  107. package/scripts/cli_io.py +20 -2
  108. package/scripts/config_cache.py +31 -0
  109. package/scripts/daemon.py +146 -51
  110. package/scripts/dormant_ledger.py +239 -0
  111. package/scripts/engine_dispatch.py +3 -3
  112. package/scripts/engine_env.py +182 -1
  113. package/scripts/engine_families.py +50 -7
  114. package/scripts/engine_states.py +9 -51
  115. package/scripts/engine_validate.py +150 -6
  116. package/scripts/engines.py +15 -67
  117. package/scripts/engines_base.py +68 -124
  118. package/scripts/engines_builders.py +0 -51
  119. package/scripts/engines_builders_batch10.py +346 -100
  120. package/scripts/engines_builders_batch11.py +2 -75
  121. package/scripts/engines_builders_batch9.py +15 -228
  122. package/scripts/engines_builders_cn.py +0 -194
  123. package/scripts/engines_builders_feeds.py +203 -35
  124. package/scripts/engines_builders_intl.py +15 -443
  125. package/scripts/engines_builders_pixiv.py +2 -16
  126. package/scripts/engines_builders_science.py +0 -85
  127. package/scripts/engines_builders_search.py +7 -14
  128. package/scripts/engines_builders_tech.py +5 -112
  129. package/scripts/engines_builders_weather.py +236 -0
  130. package/scripts/engines_fields.py +91 -0
  131. package/scripts/engines_http.py +135 -0
  132. package/scripts/engines_mcp.py +383 -0
  133. package/scripts/engines_parsers.py +196 -27
  134. package/scripts/engines_schema_drift.py +260 -0
  135. package/scripts/evidence.py +13 -0
  136. package/scripts/evidence_loop.py +93 -5
  137. package/scripts/fetch_jsrun.py +15 -11
  138. package/scripts/fetch_v3.py +28 -28
  139. package/scripts/fulltext_store.py +42 -1
  140. package/scripts/fxtwitter_api.py +8 -7
  141. package/scripts/gen_engine_catalog.py +4 -4
  142. package/scripts/gen_native_tools.py +2 -1
  143. package/scripts/general_pool.py +15 -4
  144. package/scripts/health_check.py +1 -1
  145. package/scripts/link_source.py +65 -24
  146. package/scripts/local_intent.py +51 -15
  147. package/scripts/local_seek.py +37 -4
  148. package/scripts/local_seek_adapter.py +57 -17
  149. package/scripts/mcp_handlers.py +173 -99
  150. package/scripts/mcp_handlers_surface.py +6 -18
  151. package/scripts/mcp_server.py +1 -1
  152. package/scripts/mcp_tools.py +143 -61
  153. package/scripts/mcp_transport.py +42 -10
  154. package/scripts/min_version_scan.py +7 -3
  155. package/scripts/network_aware.py +7 -13
  156. package/scripts/pre-commit +57 -31
  157. package/scripts/query_understanding.py +30 -6
  158. package/scripts/quota.py +6 -1
  159. package/scripts/rank_signals.py +9 -0
  160. package/scripts/recompute.py +15 -5
  161. package/scripts/recovery.py +21 -15
  162. package/scripts/release.py +29 -32
  163. package/scripts/release_check.py +6 -26
  164. package/scripts/replay_eval.py +2 -2
  165. package/scripts/research_cli.py +40 -0
  166. package/scripts/research_notes.py +368 -0
  167. package/scripts/route.py +32 -70
  168. package/scripts/route_audit.py +259 -0
  169. package/scripts/route_combo.py +10 -4
  170. package/scripts/route_domains.py +150 -23
  171. package/scripts/route_lang.py +20 -7
  172. package/scripts/route_log.py +26 -9
  173. package/scripts/route_policy.py +91 -7
  174. package/scripts/route_telemetry_export.py +199 -0
  175. package/scripts/rrf_classic.py +5 -22
  176. package/scripts/search.py +2 -1
  177. package/scripts/search_attribution.py +33 -10
  178. package/scripts/search_cli.py +44 -7
  179. package/scripts/search_entry.py +5 -1
  180. package/scripts/search_output.py +5 -4
  181. package/scripts/search_pipeline.py +12 -0
  182. package/scripts/search_rank.py +21 -11
  183. package/scripts/secret_guard.py +106 -0
  184. package/scripts/semantic_evidence.py +539 -117
  185. package/scripts/settings_page.py +83 -11
  186. package/scripts/social_engines/xiaohongshu_engine.py +2 -1
  187. package/scripts/social_engines/zhihu_engine.py +251 -43
  188. package/scripts/sogou_weixin_browser.py +5 -6
  189. package/scripts/source_audit.py +77 -0
  190. package/scripts/source_ledger.py +2 -15
  191. package/scripts/source_selection.py +45 -20
  192. package/scripts/straggler_policy.py +1 -2
  193. package/scripts/sync_backends.py +24 -0
  194. package/scripts/tfidf_router.py +23 -11
  195. package/scripts/time_utils.py +54 -1
  196. package/scripts/train.py +68 -2
  197. package/scripts/usage_log.py +26 -1
  198. package/sub-skills/argo-wide-research/SKILL.md +68 -0
  199. package/sub-skills/ego-search/SKILL.md +1 -1
  200. package/sub-skills/local-seek/scripts/seek_fts.py +67 -4
  201. package/README.en.md +0 -826
  202. package/scripts/caliber_dedupe.py +0 -66
  203. package/scripts/engines_builders_batch16.py +0 -186
  204. package/scripts/health_probe.py +0 -253
  205. package/scripts/image_vision/vision_probe +0 -0
  206. package/scripts/social_engines/twitter_engine.py +0 -514
  207. package/scripts/sync_installs.py +0 -29
@@ -5,15 +5,23 @@
5
5
  extract/preflight/answer/watch/cite 补齐);mcp_transport 的 tools/list 与
6
6
  mcp_server 的兼容导出均从本模块取。改 schema 只动这一个文件。
7
7
 
8
- tools/list 默认只注入 CORE 三件套(search/fetch/local_search,约 3.6KB/轮);
9
- 全量设 ARGO_MCP_TOOLS=all。execute_tool / --call / DSH 原生规格仍吃全量 TOOLS,
10
- 能力不删。未知名单不回退成全量(同类:过滤失败吐全量)。
8
+ tools/list 默认只注入 CORE 4 个正交集(search/fetch/research/screenshot,
9
+ 约 5KB/轮);全量设 ARGO_MCP_TOOLS=all。execute_tool / --call / DSH 原生规格
10
+ 仍吃全量 TOOLS,能力不删。未知名单不回退成全量(同类:过滤失败吐全量)。
11
11
 
12
- schema 设计原则(质量第一,token 第二):
12
+ CORE 集合的变更必须同步四处(少一处就有一处文案在骗人):本文件的
13
+ CORE_TOOL_NAMES、mcp_transport 的 initialize instructions、
14
+ references/operations.md 的工具清单节、docs/MCP_SETUP.md 的状态行。
15
+ 机械对拍见 tests/test_mcp_consolidated_tools.py::test_instructions_matches_core。
16
+
17
+ schema 设计原则(质量第一,token 第二,严格兼容):
13
18
  - 工具 description:第一句「做什么」,第二句「何时用 / 关键注意」。
14
19
  删除内部实现机制(引擎数、TF-IDF/RRF、协议文件引用)——模型不靠这些决策。
15
- - 参数 description:语义 + 何时用。默认值由 schema 的 default 字段表达,
16
- 不在 description 里重复;删除「下推到引擎」类实现细节。
20
+ - 参数 description:语义 + 何时用 + 默认值与范围(如需)。
21
+ 第一性原理与奥卡姆剃刀(issue #46):MaaS / OpenAI 严格网关会拦截 JSON Schema
22
+ 中的 default、minimum、maximum、minItems 等非标注解(报 400 The request is invalid)。
23
+ 因此默认值与范围一律在 description 明确说明,schema 只保留最纯粹的
24
+ type / description / enum / properties / required / items。
17
25
  - 调试/运行配置(pretty / skip_cache / timeout)不暴露给模型:
18
26
  这些不是模型决策输入,由 server 层环境变量接管(见 mcp_handlers.execute_tool:
19
27
  ARGO_MCP_PRETTY / ARGO_MCP_SKIP_CACHE / ARGO_MCP_TIMEOUT[_CRAWL|_FETCH])。
@@ -22,30 +30,104 @@ schema 设计原则(质量第一,token 第二):
22
30
 
23
31
  from __future__ import annotations
24
32
 
33
+ import copy
25
34
  import os
35
+ from typing import Any
36
+
37
+ # 日常高频与核心闭环工具(极简 3+1 正交集:Search 统一检索、Fetch 统一抓取/解析、Research 深度取证、Screenshot 视觉快照)
38
+ CORE_TOOL_NAMES = ("argo_search", "argo_fetch", "argo_research", "argo_screenshot")
39
+
40
+ # MaaS / OpenAI Function Calling 严格网关禁止的校验与注解键(见 issue #46:
41
+ # 火山引擎方舟/腾讯云 MaaS 等严格网关遇到即报 400 The request is invalid)。
42
+ FORBIDDEN_SCHEMA_KEYS = frozenset({
43
+ "default",
44
+ "minimum",
45
+ "maximum",
46
+ "exclusiveMinimum",
47
+ "exclusiveMaximum",
48
+ "minItems",
49
+ "maxItems",
50
+ "minLength",
51
+ "maxLength",
52
+ "pattern",
53
+ })
54
+
55
+
56
+ def sanitize_schema(schema: dict[str, Any]) -> dict[str, Any]:
57
+ """将 JSON Schema 净化为严格兼容 OpenAI / MaaS 网关的标准形式。
58
+
59
+ 第一性原理与奥卡姆剃刀:
60
+ 网关是白名单式语法解析器,非标注解(default/minimum/maximum/minItems 等)
61
+ 会被严格网关直接判 400 阻断(issue #46)。模型阅读参数语义依赖
62
+ description 与 enum,默认值与范围已内嵌于 description 中,后端
63
+ 执行层(mcp_handlers)自带默认值与 _clamp_int 兜底。
64
+
65
+ 本函数做纯函数递归净化:
66
+ 1. 剥离 FORBIDDEN_SCHEMA_KEYS 中所有非核心校验注解;
67
+ 2. 若 type == 'object',确保 properties 为 dict、required 为 list
68
+ (无必填项时显式补齐 required: [],防止网关报缺少字段);
69
+ 3. 递归清洗 properties 内每个字段及 items 结构。
70
+
71
+ **必须挂在 tools/list 出口**(mcp_transport.handle_rpc):只在源头写干净
72
+ schema 是「现在没问题」,挂上净化是「以后有人加回 default 也不会打到
73
+ 严格网关」。本函数曾只被自己的测试调用——宣称修了 MaaS 兼容,实际是
74
+ 一个没人调用的纯函数(2026-11-11 审计)。接线检查见
75
+ tests/test_mcp_schema_maas_compliance.py::test_sanitize_schema_is_wired。
76
+ """
77
+ if not isinstance(schema, dict):
78
+ return schema
79
+ out: dict[str, Any] = {}
80
+ for k, v in schema.items():
81
+ if k in FORBIDDEN_SCHEMA_KEYS:
82
+ continue
83
+ if k == "properties" and isinstance(v, dict):
84
+ out[k] = {pk: sanitize_schema(pv) for pk, pv in v.items()}
85
+ elif k == "items" and isinstance(v, dict):
86
+ out[k] = sanitize_schema(v)
87
+ else:
88
+ out[k] = v
89
+ if out.get("type") == "object":
90
+ if "properties" not in out:
91
+ out["properties"] = {}
92
+ if "required" not in out:
93
+ out["required"] = []
94
+ return out
95
+
96
+
97
+ def sanitize_tool(tool: dict[str, Any]) -> dict[str, Any]:
98
+ """单个工具的净化出口:只动 inputSchema,其余键原样。
99
+
100
+ 单独成函数是为了让「接线」在 tools/list 里是一行可读的调用,而不是一段
101
+ 内联的字典推导——内联形态下「有没有真的净化」要靠读代码判断。
102
+ """
103
+ if not isinstance(tool, dict):
104
+ return tool
105
+ schema = tool.get("inputSchema")
106
+ if not isinstance(schema, dict):
107
+ return tool
108
+ return {**tool, "inputSchema": sanitize_schema(schema)}
26
109
 
27
- # 日常 90% 调用只需要这 3 个;顺序即 tools/list 默认顺序。
28
- CORE_TOOL_NAMES = ("argo_search", "argo_fetch", "argo_local_search")
29
110
 
30
111
  TOOLS = [
31
112
  {
32
113
  "name": "argo_search",
33
- "description": "统一网络搜索:多引擎融合、支持时间过滤与域名过滤,返回带来源与摘要的结果。查资料、找答案、搜新闻/学术/代码/多语言内容等通用场景的首选工具。",
114
+ "description": "统一搜索(网络/社交/招聘/本地):多引擎融合、支持时间过滤与域名过滤。默认网络搜索;按 domain 可切换社交 UGC、岗位招聘或本机文件。查资料、找答案、找人找帖的首选工具。",
34
115
  "inputSchema": {
35
116
  "type": "object",
36
117
  "properties": {
37
118
  "query": {"type": "string", "description": "搜索查询词"},
38
- "engine": {"type": "string", "description": "指定搜索引擎(auto 自动选择;可选 octen/anysearch/exa/zhihu/eastmoney/arxiv/byted/bocha/tavily/deepseek_search/github/wikipedia/semantic_scholar/local_search 等;deepseek_search 为按次计费的官方 DeepSeek 搜索,结果带权威分级与发布时间,新闻时事类查询优先考虑)", "default": "auto"},
39
- "max_results": {"type": "integer", "description": "返回结果条数", "default": 5, "minimum": 1, "maximum": 20},
40
- "depth": {"type": "string", "enum": ["fast", "balanced", "deep"], "description": "搜索深度:fast 快、deep 全(慢)", "default": "fast"},
41
- "mode": {"type": "string", "enum": ["fast", "auto", "deep", "budget"], "description": "预算模式:fast=免费优先, auto=成本感知, deep=质量优先, budget=配额控制", "default": "auto"},
119
+ "domain": {"type": "string", "enum": ["web", "social", "job", "local"], "description": "搜索领域:web 统一网络搜索(默认),social 社交媒体/论坛讨论,job 招聘岗位聚合,local 本机文件搜索"},
120
+ "engine": {"type": "string", "description": "指定搜索引擎(auto 自动选择;可选 octen/anysearch/exa/zhihu/eastmoney/arxiv/byted/bocha/tavily/deepseek_search/github/wikipedia/semantic_scholar/local_search 等,默认 auto;deepseek_search 为按次计费的官方 DeepSeek 搜索,结果带权威分级与发布时间,新闻时事类查询优先考虑)"},
121
+ "max_results": {"type": "integer", "description": "返回结果条数(1-20,默认 5)"},
122
+ "depth": {"type": "string", "enum": ["fast", "balanced", "deep"], "description": "搜索深度:fast 快、deep 全(慢),默认 fast"},
123
+ "mode": {"type": "string", "enum": ["fast", "auto", "deep", "budget", "sentiment"], "description": "预算模式:fast=免费优先, auto=成本感知, deep=质量优先, budget=配额控制,默认 auto;仅 domain=social 时可写 sentiment(舆情聚合),其余 domain 不认"},
42
124
  "since": {"type": "string", "description": "发布时间下限,如 7d / 2026-08-01"},
43
125
  "until": {"type": "string", "description": "发布时间上限,如 7d / 2026-08-01"},
44
- "sort": {"type": "string", "enum": ["relevance", "oldest", "newest"], "description": "排序:relevance=相关度, oldest=最早在前, newest=最新在前", "default": "relevance"},
45
- "include_domains": {"type": "array", "items": {"type": "string"}, "description": "仅保留这些域名(含子域),如 [\"github.com\"]", "default": []},
46
- "exclude_domains": {"type": "array", "items": {"type": "string"}, "description": "排除这些域名(含子域),如 [\"pinterest.com\"]", "default": []},
47
- "include_local": {"type": "boolean", "description": "并入本机文件命中(seek 结果尾部,source=local_files,不参与融合评分;默认开)", "default": True},
48
- "summary": {"type": "boolean", "description": "精简输出:截断摘要、去掉重字段,省 token", "default": True},
126
+ "sort": {"type": "string", "enum": ["relevance", "oldest", "newest"], "description": "排序:relevance=相关度, oldest=最早在前, newest=最新在前,默认 relevance"},
127
+ "include_domains": {"type": "array", "items": {"type": "string"}, "description": "仅保留这些域名(含子域),如 [\"github.com\"]"},
128
+ "exclude_domains": {"type": "array", "items": {"type": "string"}, "description": "排除这些域名(含子域),如 [\"pinterest.com\"]"},
129
+ "include_local": {"type": "boolean", "description": "并入本机文件命中(seek 结果尾部,source=local_files,不参与融合评分;默认开)"},
130
+ "summary": {"type": "boolean", "description": "精简输出:截断摘要、去掉重字段,省 token(默认开)"},
49
131
  },
50
132
  "required": ["query"],
51
133
  },
@@ -57,9 +139,9 @@ TOOLS = [
57
139
  "type": "object",
58
140
  "properties": {
59
141
  "query": {"type": "string", "description": "搜索查询词(中文自动扩展召回)"},
60
- "path": {"type": "string", "description": "搜索目录;缩小范围更快更准", "default": "~"},
61
- "max_results": {"type": "integer", "description": "返回结果条数", "default": 5, "minimum": 1, "maximum": 20},
62
- "exact": {"type": "boolean", "description": "精确匹配,关闭中文扩展", "default": False},
142
+ "path": {"type": "string", "description": "搜索目录;缩小范围更快更准(默认 \"~\")"},
143
+ "max_results": {"type": "integer", "description": "返回结果条数(1-20,默认 5)"},
144
+ "exact": {"type": "boolean", "description": "精确匹配,关闭中文扩展(默认关)"},
63
145
  },
64
146
  "required": ["query"],
65
147
  },
@@ -71,8 +153,8 @@ TOOLS = [
71
153
  "type": "object",
72
154
  "properties": {
73
155
  "path": {"type": "string", "description": "文件路径(必须位于白名单目录内)"},
74
- "max_chars": {"type": "integer", "description": "预览字符数上限", "default": 4000, "minimum": 200, "maximum": 20000},
75
- "line_start": {"type": "integer", "description": "起始行号(1 基,可选)", "minimum": 1},
156
+ "max_chars": {"type": "integer", "description": "预览字符数上限(200-20000,默认 4000)"},
157
+ "line_start": {"type": "integer", "description": "起始行号(1 基,可选)"},
76
158
  "line_end": {"type": "integer", "description": "结束行号(可选)"},
77
159
  },
78
160
  "required": ["path"],
@@ -86,9 +168,9 @@ TOOLS = [
86
168
  "properties": {
87
169
  "script": {"type": "string", "description": "要运行的计算代码(Python)"},
88
170
  "file_inputs": {"type": "string", "description": "白名单输入文件 JSON 数组:[{\"path\":\"...\",\"role\":\"原始数据\"}]"},
89
- "timeout_s": {"type": "integer", "description": "超时秒数", "default": 30, "minimum": 1, "maximum": 120},
90
- "max_mem_mb": {"type": "integer", "description": "内存上限 MB(尽力而为)", "default": 512},
91
- "allow_exec": {"type": "boolean", "description": "是否授权运行(不授权就不执行;未授权时返回 skipped_reason)", "default": False},
171
+ "timeout_s": {"type": "integer", "description": "超时秒数(1-120,默认 30)"},
172
+ "max_mem_mb": {"type": "integer", "description": "内存上限 MB(尽力而为,默认 512)"},
173
+ "allow_exec": {"type": "boolean", "description": "是否授权运行(不授权就不执行;未授权时返回 skipped_reason,默认关)"},
92
174
  },
93
175
  "required": ["script"],
94
176
  },
@@ -101,15 +183,15 @@ TOOLS = [
101
183
  "properties": {
102
184
  "query": {"type": "string", "description": "研究问题(可以是复杂、多步骤的)"},
103
185
  "topic": {"type": "string", "description": "选题 profile:ai/investment/finance/academic/tech/tool/internet/social;省略则自动推断"},
104
- "auto_topic": {"type": "boolean", "description": "无 topic 时是否自动推断", "default": True},
105
- "num_sub_queries": {"type": "integer", "description": "子查询数量;有 work_packages 时忽略", "minimum": 2, "maximum": 8},
106
- "max_results": {"type": "integer", "description": "每个子查询的结果条数", "default": 5},
107
- "depth": {"type": "string", "enum": ["fast", "balanced", "deep"], "description": "搜索深度", "default": "balanced"},
108
- "mode": {"type": "string", "enum": ["fast", "auto", "deep", "budget", "social-sentiment"], "description": "预算/模式;社交舆情用 social-sentiment", "default": "auto"},
186
+ "auto_topic": {"type": "boolean", "description": "无 topic 时是否自动推断(默认开)"},
187
+ "num_sub_queries": {"type": "integer", "description": "子查询数量(2-8;有 work_packages 时忽略)"},
188
+ "max_results": {"type": "integer", "description": "每个子查询的结果条数(默认 5)"},
189
+ "depth": {"type": "string", "enum": ["fast", "balanced", "deep"], "description": "搜索深度(默认 balanced)"},
190
+ "mode": {"type": "string", "enum": ["fast", "auto", "deep", "budget", "social-sentiment"], "description": "预算/模式;社交舆情用 social-sentiment,默认 auto"},
109
191
  "work_packages": {"type": "string", "description": "工作包 JSON 数组:id, question, query?, file_inputs?(本地一手数据, 白名单制), recompute?({script,budget{timeout_s,max_mem_mb}}), depends_on?。有则跳过扩词,按依赖分阶段取证"},
110
- "allow_recompute": {"type": "boolean", "description": "授权执行工作包 recompute 计算脚本(不授权就不执行;未授权时 recompute 跳过并触发 recompute_skipped 门禁)", "default": False},
192
+ "allow_recompute": {"type": "boolean", "description": "授权执行工作包 recompute 计算脚本(不授权就不执行;未授权时 recompute 跳过并触发 recompute_skipped 门禁,默认关)"},
111
193
  "platforms": {"type": "string", "description": "social-sentiment 平台列表,逗号分隔"},
112
- "summary": {"type": "boolean", "description": "精简研究包,省 token", "default": True},
194
+ "summary": {"type": "boolean", "description": "精简研究包,省 token(默认开)"},
113
195
  },
114
196
  "required": ["query"],
115
197
  },
@@ -122,7 +204,7 @@ TOOLS = [
122
204
  "properties": {
123
205
  "query": {"type": "string", "description": "搜索查询词(用于交叉验证)"},
124
206
  "results_json": {"type": "string", "description": "待评估的搜索结果 JSON(为空时自动搜索)。格式:{\"results\": [{\"title\":\"...\",\"url\":\"...\",\"snippet\":\"...\",\"source\":\"...\",\"score\":0.8}]}"},
125
- "max_results": {"type": "integer", "description": "自动搜索时的结果条数", "default": 10},
207
+ "max_results": {"type": "integer", "description": "自动搜索时的结果条数(默认 10)"},
126
208
  },
127
209
  "required": ["query"],
128
210
  },
@@ -145,26 +227,26 @@ TOOLS = [
145
227
  "type": "object",
146
228
  "properties": {
147
229
  "url": {"type": "string", "description": "站点根 URL"},
148
- "strategy": {"type": "string", "enum": ["sitemap", "bfs"], "description": "爬取策略", "default": "bfs"},
149
- "max_pages": {"type": "integer", "description": "最大抓取页数", "default": 10, "minimum": 1, "maximum": 50},
150
- "max_depth": {"type": "integer", "description": "BFS 最大深度", "default": 2, "minimum": 1, "maximum": 5},
230
+ "strategy": {"type": "string", "enum": ["sitemap", "bfs"], "description": "爬取策略,默认 bfs"},
231
+ "max_pages": {"type": "integer", "description": "最大抓取页数(1-50,默认 10)"},
232
+ "max_depth": {"type": "integer", "description": "BFS 最大深度(1-5,默认 2)"},
151
233
  },
152
234
  "required": ["url"],
153
235
  },
154
236
  },
155
237
  {
156
238
  "name": "argo_fetch",
157
- "description": "智能页面抓取:HTTP 优先,遇 Cloudflare/JS 渲染自动升级反检测浏览器。支持 BM25 聚焦提取(focus 省 80%+ token)与结构化提取(mode=extract 抽表格/元数据/JSON-LD)。",
239
+ "description": "智能页面/长文/PDF抓取:HTTP 优先,遇反爬自动升级反检测浏览器;微信公众号文章(mp.weixin.qq.com)与 PDF 自动感知适配解析;支持 BM25 聚焦提取(focus 省 80%+ token)与结构化提取(mode=extract 抽表格/元数据/JSON-LD)。通读正文与获取文档的首选工具。",
158
240
  "inputSchema": {
159
241
  "type": "object",
160
242
  "properties": {
161
- "url": {"type": "string", "description": "目标 URL"},
162
- "mode": {"type": "string", "enum": ["text", "extract"], "description": "text=正文/聚焦文本, extract=结构化提取", "default": "text"},
163
- "extract_mode": {"type": "string", "enum": ["tables", "metadata", "jsonld", "all"], "description": "mode=extract 时的提取子模式", "default": "all"},
243
+ "url": {"type": "string", "description": "目标 URL 或本地 PDF 路径"},
244
+ "mode": {"type": "string", "enum": ["text", "extract", "article", "pdf"], "description": "抓取模式:text=正文/聚焦文本(默认 text), extract=结构化提取, article=公众号全文, pdf=PDF解析。微信与PDF链接自动识别"},
245
+ "extract_mode": {"type": "string", "enum": ["tables", "metadata", "jsonld", "all"], "description": "mode=extract 时的提取子模式,默认 all"},
164
246
  "focus": {"type": "string", "description": "BM25 聚焦查询词:只返回相关段落,省 token(仅 mode=text)"},
165
- "max_chars": {"type": "integer", "description": "返回正文最大字符数", "default": 8000, "minimum": 500, "maximum": 50000},
166
- "use_browser": {"type": "boolean", "description": "强制用反检测浏览器(HTTP 失败时已自动升级)", "default": False},
167
- "include_links": {"type": "boolean", "description": "附带正文内链接(最多 30 条;默认只回 links_count,省 token)", "default": False},
247
+ "max_chars": {"type": "integer", "description": "返回正文最大字符数(500-50000,默认 8000)"},
248
+ "use_browser": {"type": "boolean", "description": "强制用反检测浏览器(HTTP 失败时已自动升级,默认关)"},
249
+ "include_links": {"type": "boolean", "description": "附带正文内链接(最多 30 条;默认只回 links_count,省 token,默认关)"},
168
250
  },
169
251
  "required": ["url"],
170
252
  },
@@ -176,7 +258,7 @@ TOOLS = [
176
258
  "type": "object",
177
259
  "properties": {
178
260
  "url": {"type": "string", "description": "目标 URL"},
179
- "full_page": {"type": "boolean", "description": "全页截图(默认仅当前视口)", "default": False},
261
+ "full_page": {"type": "boolean", "description": "全页截图(默认仅当前视口,默认关)"},
180
262
  "output_path": {"type": "string", "description": "输出路径(默认写入系统临时目录:<temp>/argo_screenshot_<timestamp>.png)"},
181
263
  },
182
264
  "required": ["url"],
@@ -202,9 +284,9 @@ TOOLS = [
202
284
  "type": "object",
203
285
  "properties": {
204
286
  "query": {"type": "string", "description": "搜索查询词"},
205
- "mode": {"type": "string", "enum": ["text", "sentiment"], "description": "text=帖子列表, sentiment=舆情聚合分析", "default": "text"},
206
- "platforms": {"type": "string", "description": "平台列表,逗号分隔;可选 hackernews,v2ex,zhihu,bilibili,twitter,reddit,xiaohongshu,weibo", "default": "hackernews,zhihu,bilibili"},
207
- "max_results": {"type": "integer", "description": "每个平台的结果条数", "default": 5, "minimum": 1, "maximum": 20},
287
+ "mode": {"type": "string", "enum": ["text", "sentiment"], "description": "text=帖子列表, sentiment=舆情聚合分析,默认 text"},
288
+ "platforms": {"type": "string", "description": "平台列表,逗号分隔;可选 hackernews,v2ex,zhihu,bilibili,twitter,reddit,xiaohongshu,weibo,默认 hackernews,zhihu,bilibili"},
289
+ "max_results": {"type": "integer", "description": "每个平台的结果条数(1-20,默认 5)"},
208
290
  },
209
291
  "required": ["query"],
210
292
  },
@@ -216,7 +298,7 @@ TOOLS = [
216
298
  "type": "object",
217
299
  "properties": {
218
300
  "url": {"type": "string", "description": "mp.weixin.qq.com 文章链接"},
219
- "max_chars": {"type": "integer", "description": "返回正文最大字符数", "default": 20000, "minimum": 500, "maximum": 50000},
301
+ "max_chars": {"type": "integer", "description": "返回正文最大字符数(500-50000,默认 20000)"},
220
302
  },
221
303
  "required": ["url"],
222
304
  },
@@ -229,10 +311,10 @@ TOOLS = [
229
311
  "properties": {
230
312
  "query": {"type": "string", "description": "职位关键词,如:工艺工程师、会计、电工"},
231
313
  "city": {"type": "string", "description": "地区:省/市/县或海外城市(成都、昆山、新加坡…),空=不过滤地区"},
232
- "num": {"type": "integer", "description": "每后端条数", "default": 5, "minimum": 1, "maximum": 20},
233
- "platforms": {"type": "string", "description": "逗号分隔平台: zhipin,liepin,zhaopin,51job,597,jrzp;空=全部", "default": ""},
234
- "loose": {"type": "boolean", "description": "宽松:异地岗位也保留;默认严格地区过滤", "default": False},
235
- "fetch_detail": {"type": "integer", "description": "对前 N 条高命中结果抓详情页补全结构化字段(0=仅 snippet 提取)", "default": 0, "minimum": 0, "maximum": 10},
314
+ "num": {"type": "integer", "description": "每后端条数(1-20,默认 5)"},
315
+ "platforms": {"type": "string", "description": "逗号分隔平台: zhipin,liepin,zhaopin,51job,597,jrzp;空=全部"},
316
+ "loose": {"type": "boolean", "description": "宽松:异地岗位也保留;默认严格地区过滤(默认关)"},
317
+ "fetch_detail": {"type": "integer", "description": "对前 N 条高命中结果抓详情页补全结构化字段(0=仅 snippet 提取,范围 0-10,默认 0)"},
236
318
  },
237
319
  "required": ["query"],
238
320
  },
@@ -244,8 +326,8 @@ TOOLS = [
244
326
  "type": "object",
245
327
  "properties": {
246
328
  "url": {"type": "string", "description": "目标网页链接"},
247
- "mode": {"type": "string", "enum": ["tables", "metadata", "jsonld", "all"], "description": "提取内容:tables=HTML表格, metadata=Meta元数据, jsonld=JSON-LD, all=全部", "default": "all"},
248
- "max_chars": {"type": "integer", "description": "抓取页面最大字符数", "default": 50000, "minimum": 1000, "maximum": 200000},
329
+ "mode": {"type": "string", "enum": ["tables", "metadata", "jsonld", "all"], "description": "提取内容:tables=HTML表格, metadata=Meta元数据, jsonld=JSON-LD, all=全部,默认 all"},
330
+ "max_chars": {"type": "integer", "description": "抓取页面最大字符数(1000-200000,默认 50000)"},
249
331
  },
250
332
  "required": ["url"],
251
333
  },
@@ -256,8 +338,8 @@ TOOLS = [
256
338
  "inputSchema": {
257
339
  "type": "object",
258
340
  "properties": {
259
- "urls": {"type": "array", "items": {"type": "string"}, "description": "待预检的 URL 列表", "minItems": 1},
260
- "probe": {"type": "boolean", "description": "联网探测存活(404/410 判死;默认纯本地规则)", "default": False},
341
+ "urls": {"type": "array", "items": {"type": "string"}, "description": "待预检的 URL 列表"},
342
+ "probe": {"type": "boolean", "description": "联网探测存活(404/410 判死;默认纯本地规则,默认关)"},
261
343
  },
262
344
  "required": ["urls"],
263
345
  },
@@ -283,7 +365,7 @@ TOOLS = [
283
365
  "properties": {
284
366
  "action": {"type": "string", "enum": ["add", "check", "list", "remove"], "description": "add=登记快照, check=复查变化(可指定单个 url), list=看清单, remove=取消关注"},
285
367
  "url": {"type": "string", "description": "目标页面(add/remove 必填;check 可选=只查这一条)"},
286
- "note": {"type": "string", "description": "备注(add 可选)", "default": ""},
368
+ "note": {"type": "string", "description": "备注(add 可选,默认空)"},
287
369
  },
288
370
  "required": ["action"],
289
371
  },
@@ -294,8 +376,8 @@ TOOLS = [
294
376
  "inputSchema": {
295
377
  "type": "object",
296
378
  "properties": {
297
- "dois": {"type": "array", "items": {"type": "string"}, "description": "DOI 列表,如 [\"10.1038/s41586-024-0001-x\"]", "minItems": 1},
298
- "style": {"type": "string", "enum": ["gbt7714", "numeric", "apa", "bibtex"], "description": "引用格式", "default": "gbt7714"},
379
+ "dois": {"type": "array", "items": {"type": "string"}, "description": "DOI 列表,如 [\"10.1038/s41586-024-0001-x\"]"},
380
+ "style": {"type": "string", "enum": ["gbt7714", "numeric", "apa", "bibtex"], "description": "引用格式,默认 gbt7714"},
299
381
  },
300
382
  "required": ["dois"],
301
383
  },
@@ -304,7 +386,7 @@ TOOLS = [
304
386
 
305
387
 
306
388
  def listed_tools(spec: str | None = None) -> list[dict]:
307
- """tools/list 返回集。默认 CORE 三件套;all 全量;逗号名单按名取。
389
+ """tools/list 返回集。默认 CORE 4 个正交集;all 全量;逗号名单按名取。
308
390
 
309
391
  未知名字忽略,空结果也不回退成全量——曾经「过滤失败吐全量」把 12KB
310
392
  schema 砸进每一轮。execute_tool 不受此限制。
@@ -13,7 +13,24 @@ import sys
13
13
  from typing import Any
14
14
 
15
15
  from mcp_handlers import _warm_core_async, execute_tool
16
- from mcp_tools import listed_tools
16
+ from mcp_tools import listed_tools, sanitize_tool
17
+
18
+ try:
19
+ from secret_guard import redact_data
20
+ except ImportError: # pragma: no cover - 脱敏模块不可用时不得静默放行
21
+ def redact_data(data):
22
+ raise RuntimeError("secret_guard 不可用:拒绝输出未经脱敏的工具结果")
23
+
24
+
25
+ def _redact_response(response: dict[str, Any]) -> dict[str, Any]:
26
+ """tools/call 出口统一脱敏:覆盖所有分支,而不只是 _ok 成功路径。
27
+
28
+ _ok 内部已有一层(成功结果),但错误信息、surface 工具与兜底 except
29
+ 都是裸 return,异常里常带回上游响应体——那里恰恰最容易带凭据。
30
+ 放在 RPC 边界是唯一能一次覆盖全部出口的位置;两层叠加的代价是
31
+ 对已脱敏文本再跑一次正则,实测 <0.5ms。
32
+ """
33
+ return redact_data(response)
17
34
 
18
35
  try:
19
36
  import hot_state # 代码/配置指纹自重启(失效则退化为旧行为:进程常驻)
@@ -22,7 +39,7 @@ except Exception: # pragma: no cover
22
39
 
23
40
  # 版本来源:与 package.json / SKILL.md 保持一致(发布时统一升版;
24
41
  # tests/test_consistency_gates.py 会四端对账,漂移即红)
25
- ARGO_MCP_VERSION = "2.14.0"
42
+ ARGO_MCP_VERSION = "2.15.0"
26
43
 
27
44
  _response_format = "content-length" # 根据客户端请求自动切换
28
45
 
@@ -31,6 +48,10 @@ def handle_rpc(method: str, params: dict[str, Any]) -> dict[str, Any]:
31
48
  """处理 JSON-RPC 请求。"""
32
49
  if method == "initialize":
33
50
  _warm_core_async()
51
+ # 工具面真源在 mcp_tools.CORE_TOOL_NAMES:文案在这里只写「CORE 指哪
52
+ # 几个」的语义,不逐个列名——列名就有了第二份真源,改一处忘另一处时
53
+ # 模型会按旧名单调工具。机械对拍见 test_mcp_consolidated_tools.py::
54
+ # test_instructions_matches_core。
34
55
  return {
35
56
  "protocolVersion": "2025-06-18",
36
57
  "capabilities": {"tools": {"listChanged": False}},
@@ -40,19 +61,30 @@ def handle_rpc(method: str, params: dict[str, Any]) -> dict[str, Any]:
40
61
  },
41
62
  # 短指令:降 tools 上下文;细节在 tool schema。
42
63
  # URL 在 results[].url(默认 envelope=False,不生成 sources)。
64
+ #
65
+ # 文案只写「CORE 指哪几个」的语义,不逐个列全名单——全名单在
66
+ # tools/list 里,抄一份到这里就有了第二真源。机械对拍见
67
+ # test_mcp_consolidated_tools.py::test_instructions_matches_core。
68
+ #
69
+ # 不点名 argo_local_search:它是真工具(domain=local 也能用),但
70
+ # 已不在默认注入面,写进「日常」文案会让模型去调一个没挂的工具。
43
71
  "instructions": (
44
- "Argo:日常 argo_search(精简 JSON,URL 在 results[].url)"
45
- "、argo_fetch、argo_local_search。"
46
- "深度研究只用 argo_research(内建 academic/finance topic,不调用外部 skill)。"
47
- "其余默认不注入 schema,ARGO_MCP_TOOLS=all 打开:"
48
- "evidence/clarify/crawl/article/job/pdf/screenshot/social_search/"
49
- "local_read/recompute。"
72
+ "Argo:日常四件套见 tools/list(argo_search 统一检索,URL 在 "
73
+ "results[].url;argo_fetch 抓取;argo_research 深度取证,"
74
+ "内建 academic/finance 等 topic profile、不调外部 skill;"
75
+ "argo_screenshot 截图)。argo_search 用 domain 切社交/招聘/本机。"
76
+ "其余工具默认不注入 schema,ARGO_MCP_TOOLS=all 打开:"
77
+ "local_search/local_read/recompute/evidence/clarify/crawl/"
78
+ "extract/preflight/answer/watch/cite。"
50
79
  ),
51
80
  }
52
81
 
53
82
  elif method == "tools/list":
54
83
  _warm_core_async()
55
- return {"tools": listed_tools()}
84
+ # 出口净化(issue #46):严格网关(火山方舟/腾讯云 MaaS)会因 schema
85
+ # 里的 default/minimum/minItems 等非标注解直接 400。源头已写干净,
86
+ # 这里再兜一层——以后有人加回违规键时,拦住的是网关而不是用户。
87
+ return {"tools": [sanitize_tool(t) for t in listed_tools()]}
56
88
 
57
89
  elif method == "tools/call":
58
90
  tool_name = params.get("name", "")
@@ -63,7 +95,7 @@ def handle_rpc(method: str, params: dict[str, Any]) -> dict[str, Any]:
63
95
  # 对账)。MCP 规范里 arguments 是 object,畸形一律按空对象走
64
96
  # 正常缺参校验。
65
97
  arguments = {}
66
- return execute_tool(tool_name, arguments)
98
+ return _redact_response(execute_tool(tool_name, arguments))
67
99
 
68
100
  elif method == "ping":
69
101
  return {}
@@ -82,7 +82,9 @@ def scan_text(source: str, minver: tuple[int, int]) -> list[tuple[int, str]]:
82
82
  """
83
83
  findings: list[tuple[int, str]] = []
84
84
  if minver < (3, 12):
85
- findings.extend(_pep701_findings(source))
85
+ low = source.lower()
86
+ if 'f"' in low or "f'" in low:
87
+ findings.extend(_pep701_findings(source))
86
88
 
87
89
  try:
88
90
  tree = ast.parse(source)
@@ -94,8 +96,10 @@ def scan_text(source: str, minver: tuple[int, int]) -> list[tuple[int, str]]:
94
96
  return [(e.lineno or 0, f"语法错误:{e.msg}")]
95
97
 
96
98
  if minver < (3, 10):
97
- findings.extend(_pep604_findings(tree, _has_future_annotations(tree)))
98
- findings.extend(_match_findings(tree))
99
+ if "|" in source:
100
+ findings.extend(_pep604_findings(tree, _has_future_annotations(tree)))
101
+ if "match " in source or "match\t" in source:
102
+ findings.extend(_match_findings(tree))
99
103
  return sorted(set(findings))
100
104
 
101
105
 
@@ -119,19 +119,13 @@ def network_profile(engines: list[str]) -> dict[str, Any]:
119
119
 
120
120
 
121
121
  def _probe_latency(engines: list[str]) -> float | None:
122
- """无 adaptive 数据时,用 health_probe 的 last_latency_ms 估计。"""
123
- try:
124
- from health_probe import get_engine_status
125
- lats = []
126
- for e in engines:
127
- st = get_engine_status(e)
128
- lat = st.get("last_latency_ms")
129
- if isinstance(lat, (int, float)) and lat > 0:
130
- lats.append(float(lat))
131
- if lats:
132
- return sum(lats) / len(lats)
133
- except Exception:
134
- pass
122
+ """无 adaptive 数据时的延迟估计。
123
+
124
+ health_probe 回退已退役(2026-11-14):health.db 从建库起零行写入
125
+ (探针写路径早已被 health_check 替代),这条回退生产上永远拿不到数据,
126
+ 属「看起来有回退、实际恒 None」的死路。延迟估计现在只依赖 adaptive
127
+ 观测数据,没有数据就不估(profile 留空,超时预算走默认 1.0 档)。
128
+ """
135
129
  return None
136
130
 
137
131