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
@@ -14,10 +14,11 @@ import subprocess
14
14
  import sys
15
15
  import threading
16
16
  import engine_states as _st # 失败归因词表唯一真源
17
+ from engines_fields import _coerce_field # 字段取值原语真源在 engines_fields(无依赖底层),本模块复导出
17
18
 
18
19
  import serp_kill_log # noqa: E402 守卫接线+误杀账本(2026-10-10 拆出,stdlib 级轻量)
19
20
  import time
20
- import urllib.error
21
+ import urllib.error, urllib.parse
21
22
  from contextlib import contextmanager
22
23
  from datetime import datetime, timezone
23
24
  from pathlib import Path
@@ -196,11 +197,13 @@ def rank_score(base: float, rank: int) -> float:
196
197
  return round(b / (1.0 + r * RANK_DECAY), 4)
197
198
 
198
199
 
199
- def _run(cmd: list[str], timeout: float = 8, engine_name: str = "?") -> str:
200
+ def _run(cmd: list[str], timeout: float = 8, engine_name: str = "?",
201
+ env: dict[str, str] | None = None) -> str:
200
202
  """执行命令,超时/异常不抛。"""
201
203
  try:
202
204
  r = subprocess.run(cmd, capture_output=True, text=True,
203
- encoding="utf-8", errors="replace", timeout=timeout)
205
+ encoding="utf-8", errors="replace",
206
+ timeout=timeout, env=env)
204
207
  if r.returncode == 0:
205
208
  return r.stdout
206
209
  tail = (r.stderr or "").strip()[:200]
@@ -233,18 +236,18 @@ def _proc_uuid() -> str:
233
236
  return _PROC_UUID
234
237
 
235
238
 
236
- def _resolve(template: list[str] | str, query: str, n: int, **extra: Any) -> list[str] | str:
239
+ def _resolve(template: list[str] | str, query: str, n: int, allowed_env: frozenset[str] | set[str] | None = None, **extra: Any) -> list[str] | str:
237
240
  """替换模板占位符。"""
238
241
  if isinstance(template, list):
239
- return [_resolve(item, query, n, **extra) for item in template]
240
- s = template.replace("{query}", query).replace("{n}", str(n))
242
+ return [_resolve(item, query, n, allowed_env=allowed_env, **extra) for item in template]
243
+ s = template.replace("{query_quoted}", urllib.parse.quote(str(query))).replace("{query}", query).replace("{n}", str(n))
244
+ if "{query_slug}" in s:
245
+ _slug = next((_t for _tok in re.split(r"[\s,,。/?]+", str(query)) if (_t := _tok.strip().lower()) and re.fullmatch(r"[a-z][a-z0-9.\-_]{1,30}", _t) and not any(_w in _t for _w in ("生命周期", "支持到", "eol", "support", "lifecycle", "什么时候", "停更"))), "")
246
+ s = s.replace("{query_slug}", _slug or urllib.parse.quote(str(query)))
241
247
  s = s.replace("{TIMESTAMP}", str(int(time.time())))
242
- if "{UUID}" in s:
243
- s = s.replace("{UUID}", _proc_uuid())
244
- for key, val in extra.items():
245
- s = s.replace(f"{{{key}}}", str(val))
246
- if s.startswith("~"):
247
- s = str(Path.home() / s[1:])
248
+ if "{UUID}" in s: s = s.replace("{UUID}", _proc_uuid())
249
+ for key, val in extra.items(): s = s.replace(f"{{{key}}}", str(val))
250
+ if s.startswith("~"): s = str(Path.home() / s[1:])
248
251
  # env 占位符:缺失时替换为空串而非保留字面量。
249
252
  # 保留字面量会把 `Authorization: token {GITHUB_TOKEN}` 原样发出 → 401;
250
253
  # 空串 + 调用方过滤空头 = 未配置 key 的引擎自动退化为匿名请求。
@@ -252,16 +255,10 @@ def _resolve(template: list[str] | str, query: str, n: int, **extra: Any) -> lis
252
255
  # 历史兼容名):os.environ 优先 + ~/.config/argo/env 热读保底
253
256
  # (密钥轮换改文件即生效,无需重启)。
254
257
  try:
255
- from engine_env import PLACEHOLDER_ALIASES as _PA, get_env as _get_env
256
- return re.sub(
257
- r"\{([A-Z_][A-Z0-9_]*)\}",
258
- lambda m: _get_env(
259
- _PA.get(m.group(1), [f"ARGO_{m.group(1)}", m.group(1)]), ""
260
- ),
261
- s,
262
- )
258
+ from engine_env import resolve_env_placeholders
259
+ return resolve_env_placeholders(s, allowed_env=allowed_env)
263
260
  except ImportError:
264
- return re.sub(r"\{([A-Z_][A-Z0-9_]*)\}", lambda m: os.environ.get(m.group(1), ""), s)
261
+ return re.sub(r"\{([A-Z_][A-Z0-9_]*)\}", lambda m: os.environ.get(m.group(1), "") if (allowed_env is None or m.group(1) in allowed_env) else "", s)
265
262
 
266
263
 
267
264
  _AUTH_PREFIXES = ("Bearer", "token", "Basic", "Key", "Api-Key", "X-Key", "Secret", "Appid")
@@ -305,97 +302,37 @@ def _get_path(obj: Any, path: str) -> Any:
305
302
  return cur
306
303
 
307
304
 
308
- def _coerce_field(val: Any, *, max_len: int | None = None) -> str:
309
- """把 API 字段压成字符串:list 取首项、dict 丢弃、其余 str。"""
310
- if val is None:
311
- return ""
312
- if isinstance(val, list):
313
- if not val:
314
- return ""
315
- val = val[0]
316
- if isinstance(val, dict):
317
- return ""
318
- s = str(val).strip()
319
- if max_len is not None and len(s) > max_len:
320
- return s[:max_len]
321
- return s
322
-
323
-
324
305
  def _format_url_template(template: str, item: dict) -> str:
325
- """支持 {field} 与 {a.b.c} 点分路径的 URL 模板;任一占位为空则返回空串。"""
326
- vals = {m.group(1): _coerce_field(_get_path(item, m.group(1))) for m in re.finditer(r"\{([^}]+)\}", template)}
327
- if any(not v for v in vals.values()):
328
- return ""
329
- try:
330
- return re.sub(r"\{([^}]+)\}", lambda m: vals[m.group(1)], template)
331
- except Exception:
332
- return ""
333
-
334
-
335
- def _extract_items(data: Any, path: str) -> list:
336
- """从 JSON 按路径提取列表。path 为 . / $ / [] / 空 且 data 为 list 时直接返回。"""
337
- if path in ("", ".", "$", "[]"):
338
- return data if isinstance(data, list) else []
339
- if not isinstance(data, dict):
340
- return []
341
- obj = _get_path(data, path)
342
- if isinstance(obj, list):
343
- return obj
344
- # DBLP 等 API 在 h=1 时把 hit 收成对象而非数组
345
- if isinstance(obj, dict):
346
- return [obj]
347
- return []
306
+ """委托 engines_parsers(声明式字段映射的 URL 模板能力归属解析层)。"""
307
+ from engines_parsers import _format_url_template as _impl
308
+ return _impl(template, item)
348
309
 
349
310
 
350
311
  def _make_field_parser(path: str, fields: dict[str, str], url_template: str | None = None,
351
- max_items: int = 10) -> Callable:
352
- """构造声明式 parser。支持点分路径字段与 url_template(含嵌套占位)。"""
353
- def parser(data: Any) -> list[dict[str, Any]]:
354
- if isinstance(data, list) and path in ("", ".", "$", "[]"):
355
- items = data
356
- elif isinstance(data, dict):
357
- items = _extract_items(data, path)
358
- else:
359
- items = []
360
- results = []
361
- for item in items:
362
- if not isinstance(item, dict):
363
- continue
364
- r: dict[str, Any] = {}
365
- for ok, ik in fields.items():
366
- if not ik:
367
- continue
368
- raw = _get_path(item, ik) if "." in str(ik) else item.get(ik, "")
369
- if raw in ("", None) and "." not in str(ik):
370
- raw = item.get(ik, "")
371
- coerced = _coerce_field(raw, max_len=300 if ok == "snippet" else 500)
372
- if coerced:
373
- r[ok] = coerced
374
- if url_template and (not r.get("url") or not str(r["url"]).startswith(("http://", "https://"))):
375
- built = _format_url_template(url_template, item)
376
- if built.startswith(("http://", "https://")):
377
- r["url"] = built
378
- else:
379
- r.pop("url", None)
380
- if isinstance(r.get("url"), str) and r["url"].startswith("//"):
381
- r["url"] = "https:" + r["url"]
382
- if r.get("title") or r.get("url"):
383
- results.append(r)
384
- return results[:max_items]
385
- return parser
312
+ max_items: int = 10, templates: dict[str, str] | None = None,
313
+ url_item_template: str | None = None) -> Callable:
314
+ """委托 engines_parsers.make_field_parser(2026-11-10 拆出,见该文件说明)。
315
+
316
+ 保留本函数名是为了 engines_base 内部调用点与既有测试不变;实现已归解析层,
317
+ 避免同一套 output_map 语义在两个文件各存一份真源。
318
+ """
319
+ from engines_parsers import make_field_parser as _impl
320
+ return _impl(path, fields, url_template, max_items, templates, url_item_template)
386
321
 
387
322
 
388
323
  def _build_cli_engine(spec: dict[str, Any]) -> Any:
389
324
  cmd_template = spec.get("cmd", [])
390
325
  search_args = spec.get("search_args", [])
391
- env_overrides = spec.get("env", {})
392
326
  output_format = spec.get("output_format", "") # "yaml" | ""(JSON/文本自动)
393
327
  filter_args = spec.get("filter_args", {}) # {kwarg: [参数模板...]},kwargs 携带时追加
328
+ eng = spec.get("_name", "cli")
329
+ from engine_env import allowed_placeholders_for, build_child_env
330
+ _allowed = allowed_placeholders_for(eng, spec)
394
331
 
395
332
  @safe_search
396
333
  def _engine(query: str, n: int = 5, timeout: float = 8, mode: str = "fast", **kwargs) -> list[dict[str, Any]]:
397
- cmd = _resolve(cmd_template, query, n, mode=mode, **kwargs)
398
- args = _resolve(search_args, query, n, mode=mode, **kwargs)
334
+ cmd = _resolve(cmd_template, query, n, allowed_env=_allowed, mode=mode, **kwargs)
335
+ args = _resolve(search_args, query, n, allowed_env=_allowed, mode=mode, **kwargs)
399
336
  if not cmd:
400
337
  return []
401
338
  # 跨平台解释器:优先 sys.executable(bin/argo 已验证它带 PyYAML);
@@ -405,12 +342,10 @@ def _build_cli_engine(spec: dict[str, Any]) -> Any:
405
342
  cmd[0] = sys.executable or shutil.which("python3") or shutil.which("python")
406
343
  for key, tmpl in filter_args.items():
407
344
  if kwargs.get(key) not in (None, ""):
408
- args += _resolve(tmpl, query, n, mode=mode, **kwargs)
409
- env = os.environ.copy()
410
- env.update(env_overrides)
345
+ args += _resolve(tmpl, query, n, allowed_env=_allowed, mode=mode, **kwargs)
411
346
  return _apply_url_kind(
412
- _parse_text_output(_run(cmd + args, timeout=timeout, engine_name=spec.get("_name", "cli")),
413
- spec.get("_name", "cli"), output_format=output_format, n=n),
347
+ _parse_text_output(_run(cmd + args, timeout=timeout, engine_name=eng, env=build_child_env(eng, spec)),
348
+ eng, output_format=output_format, n=n),
414
349
  spec)
415
350
  return _engine
416
351
 
@@ -443,6 +378,8 @@ def _build_http_engine(spec: dict[str, Any]) -> Any:
443
378
  is_get = spec.get("method", "GET") == "GET"
444
379
  body_template = spec.get("body", {})
445
380
  eng = spec.get("_name", "")
381
+ from engine_env import allowed_placeholders_for, env_flag
382
+ _allowed = allowed_placeholders_for(eng, spec)
446
383
  # spec 显式节流覆盖(max_concurrency / min_interval_ms),声明即契约
447
384
  if spec.get("max_concurrency") is not None or \
448
385
  spec.get("min_interval_ms") is not None:
@@ -460,7 +397,7 @@ def _build_http_engine(spec: dict[str, Any]) -> Any:
460
397
  import urllib.parse as up
461
398
 
462
399
  if is_get:
463
- resolved_url = _resolve(url_template, query, n, **kwargs)
400
+ resolved_url = _resolve(url_template, query, n, allowed_env=_allowed, **kwargs)
464
401
  parts: list[str] = []
465
402
  if query_param: # 空字符串表示该 API 不用查询参数名(仅 extra_params)
466
403
  parts.append(f"{query_param}={up.quote(query)}")
@@ -470,7 +407,7 @@ def _build_http_engine(spec: dict[str, Any]) -> Any:
470
407
  # 语言参数动态化(v2.7):按查询主语言覆盖静态 setlang/hl/lang/mkt
471
408
  if k in ("setlang", "hl", "lang", "uselang", "mkt"):
472
409
  v = _lang_param(k, query) or v
473
- parts.append(f"{k}={up.quote(_resolve(str(v), query, n, **kwargs))}")
410
+ parts.append(f"{k}={up.quote(_resolve(str(v), query, n, allowed_env=_allowed, **kwargs))}")
474
411
  if parts:
475
412
  separator = "&" if "?" in resolved_url else "?"
476
413
  full_url = resolved_url + separator + "&".join(parts)
@@ -478,7 +415,7 @@ def _build_http_engine(spec: dict[str, Any]) -> Any:
478
415
  full_url = resolved_url
479
416
  resolved_headers = {
480
417
  k: v for k, v in (
481
- (k, _resolve(v, query, n, **kwargs))
418
+ (k, _resolve(v, query, n, allowed_env=_allowed, **kwargs))
482
419
  for k, v in headers.items()
483
420
  ) if _header_meaningful(v) # 过滤空/认证前缀残留头(未配置的 {ENV} 不发送)
484
421
  }
@@ -491,7 +428,7 @@ def _build_http_engine(spec: dict[str, Any]) -> Any:
491
428
  else:
492
429
  body: dict[str, Any] = {}
493
430
  for k, v in body_template.items():
494
- resolved = _resolve(str(v), query, n, **kwargs)
431
+ resolved = _resolve(str(v), query, n, allowed_env=_allowed, **kwargs)
495
432
  if k == "search_depth":
496
433
  body[k] = {"fast": "fast", "balanced": "basic", "deep": "advanced", "basic": "basic", "advanced": "advanced", "ultra-fast": "ultra-fast"}.get(str(depth), resolved or "basic")
497
434
  elif resolved.lower() == "true":
@@ -507,19 +444,19 @@ def _build_http_engine(spec: dict[str, Any]) -> Any:
507
444
  except ValueError:
508
445
  body[k] = resolved
509
446
  # 与 GET 路径保持一致:过滤空/认证前缀残留头;POST 默认走 HttpClient 连接池
510
- resolved_headers = {k: v for k, v in ((k, _resolve(v, query, n, **kwargs))
447
+ resolved_url = _resolve(url_template, query, n, allowed_env=_allowed, **kwargs)
448
+ resolved_headers = {k: v for k, v in ((k, _resolve(v, query, n, allowed_env=_allowed, **kwargs))
511
449
  for k, v in headers.items()) if _header_meaningful(v)}
512
- from engine_env import env_flag
513
450
  import urllib.request as _urllib_request
514
451
  if env_flag("ARGO_ENGINE_HTTP_CLIENT") and getattr(_urllib_request.urlopen, "__module__", "") == "urllib.request":
515
452
  from http_client import HttpClient
516
- resp = HttpClient(timeout=to, max_retries=0, jitter=False).post(url_template, body=body, extra_headers=resolved_headers, engine=eng)
453
+ resp = HttpClient(timeout=to, max_retries=0, jitter=False).post(resolved_url, body=body, extra_headers=resolved_headers, engine=eng)
517
454
  raw = (resp.get("text") or "") if resp.get("status") == 200 else ""
518
455
  if not raw:
519
456
  _note_http_failure(eng, resp.get("status") or 0, resp.get("text") or resp.get("error", ""))
520
457
  return []
521
458
  else:
522
- req = _urllib_request.Request(url_template, data=json.dumps(body).encode("utf-8"), headers=resolved_headers)
459
+ req = _urllib_request.Request(resolved_url, data=json.dumps(body).encode("utf-8"), headers=resolved_headers)
523
460
  try:
524
461
  with http_open(req, timeout=to, engine=eng) as resp:
525
462
  raw = resp.read().decode("utf-8")
@@ -843,7 +780,13 @@ def _parse_http_payload(raw: str, fmt: str, eng: str, n: int,
843
780
  "image_license": output_map.get("item_image_license", ""),
844
781
  # 其余图片字段(许可链接/协议版本原料/像素尺寸)见 image_ops
845
782
  **image_output_map_fields(output_map),
846
- }, url_template=output_map.get("url_template"))(data)
783
+ }, url_template=output_map.get("url_template") or spec.get("url_template"),
784
+ templates={
785
+ # 多字段拼接模板(2026-11-10):声明后覆盖同名单字段映射,
786
+ # 把原 builder 的「tombstone · 授权 CC0」这类拼接变成声明式能力。
787
+ k: output_map.get(k) for k in ("item_title_template", "item_summary_template", "item_image_template")
788
+ },
789
+ url_item_template=output_map.get("item_url_template"))(data)
847
790
  # spec 级授权常量:授权不随条目变化的源(如 NASA 公版)在 spec 上写一次
848
791
  _lic = spec.get("image_license")
849
792
  for r in parsed:
@@ -852,15 +795,14 @@ def _parse_http_payload(raw: str, fmt: str, eng: str, n: int,
852
795
  r["published_at"] = _normalize_epoch(r["published_at"])
853
796
  if _lic and r.get("image_url"):
854
797
  r.setdefault("image_license", _lic)
855
- sn = r.get("snippet")
856
- if isinstance(sn, str):
857
- if _TAGISH_RE.search(sn):
858
- sn = _TAGISH_RE.sub("", sn)
859
- if "&" in sn:
860
- sn = _htmllib.unescape(sn)
861
- if len(sn) > 300:
862
- sn = sn[:300]
863
- r["snippet"] = sn
798
+ for _fk, _cap in (("title", 500), ("snippet", 300)):
799
+ _fv = r.get(_fk)
800
+ if isinstance(_fv, str):
801
+ if _TAGISH_RE.search(_fv):
802
+ _fv = _TAGISH_RE.sub("", _fv)
803
+ if "&" in _fv:
804
+ _fv = _htmllib.unescape(_fv)
805
+ r[_fk] = (_fv.strip() if _fk == "title" else _fv)[:_cap]
864
806
  # 图片元数据收尾(尺寸转 int / 许可归一 / 商用判据)——落在这个共同
865
807
  # 出口而不是各 parser 里:图源有三条产出路径(声明式 output_map、
866
808
  # 自定义 builder、通用兜底),只覆盖一条会让契约对一半结果生效。
@@ -972,6 +914,8 @@ def _build_html_engine(spec: dict[str, Any]) -> Any:
972
914
  timeout = spec.get("timeout", 8)
973
915
  extra_params = spec.get("extra_params", {})
974
916
  engine_name = spec.get("_name", "html")
917
+ from engine_env import allowed_placeholders_for
918
+ _allowed = allowed_placeholders_for(engine_name, spec)
975
919
  # spec 显式节流覆盖(max_concurrency / min_interval_ms),声明即契约
976
920
  if spec.get("max_concurrency") is not None or \
977
921
  spec.get("min_interval_ms") is not None:
@@ -999,17 +943,17 @@ def _build_html_engine(spec: dict[str, Any]) -> Any:
999
943
  def _engine(query: str, n: int = 5, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
1000
944
  import urllib.parse as up
1001
945
  to = _timeout or timeout
1002
- resolved_url = _resolve(url_template, query, n)
946
+ resolved_url = _resolve(url_template, query, n, allowed_env=_allowed)
1003
947
  separator = "&" if "?" in resolved_url else "?"
1004
948
  full_url = f"{resolved_url}{separator}{query_param}={up.quote(query)}"
1005
949
  for k, v in extra_params.items():
1006
950
  # 语言参数动态化:按查询主语言覆盖 setlang/hl/lang/mkt(此前漏 mkt)
1007
951
  if k in ("setlang", "hl", "lang", "uselang", "mkt"):
1008
952
  v = _lang_param(k, query) or v
1009
- full_url += f"&{k}={up.quote(_resolve(str(v), query, n, **kwargs))}" # **kwargs 必传(声明式路径 :441 传了):否则 {MODE}/{DEPTH} 带字面量花括号进 URL
953
+ full_url += f"&{k}={up.quote(_resolve(str(v), query, n, allowed_env=_allowed, **kwargs))}" # **kwargs 必传(声明式路径 :441 传了):否则 {MODE}/{DEPTH} 带字面量花括号进 URL
1010
954
  resolved_headers = {
1011
955
  k: v for k, v in (
1012
- (k, _resolve(v, query, n))
956
+ (k, _resolve(v, query, n, allowed_env=_allowed))
1013
957
  for k, v in headers.items()
1014
958
  ) if _header_meaningful(v) # 过滤空/认证前缀残留头(未配置的 {ENV} 不发送)
1015
959
  }
@@ -13,11 +13,6 @@ from engines_builders_batch9 import (
13
13
  _build_jolpica_engine,
14
14
  _build_openf1_engine,
15
15
  _build_openligadb_engine,
16
- _build_artic_engine,
17
- _build_cleveland_engine,
18
- _build_tvmaze_engine,
19
- _build_jikan_engine,
20
- _build_deezer_engine,
21
16
  _build_listenbrainz_engine,
22
17
  _build_egov_law_engine,
23
18
  _build_k10plus_engine,
@@ -35,11 +30,9 @@ from engines_builders_tech import (
35
30
  _build_exa_engine,
36
31
  _build_anysearch_engine,
37
32
  _build_wechat_sogou_engine,
38
- _build_hackernews_engine,
39
33
  _build_stackoverflow_engine,
40
34
  _build_google_scholar_engine,
41
35
  _build_deps_dev_engine,
42
- _build_endoflife_engine,
43
36
  _build_v2ex_engine,
44
37
  _build_github_engine,
45
38
  _build_bing_rss_engine,
@@ -54,10 +47,7 @@ from engines_builders_cn import (
54
47
  _build_cls_telegraph_engine,
55
48
  _build_em_global_news_engine,
56
49
  _build_eastmoney_engine,
57
- _build_itotii_engine,
58
50
  _build_baidu_hot_engine,
59
- _build_toutiao_hot_engine,
60
- _build_bilibili_hot_engine,
61
51
  _build_zhihu_global_engine,
62
52
  _build_zhihu_user_engine,
63
53
  _build_bocha_engine,
@@ -71,8 +61,6 @@ from engines_builders_cn import (
71
61
  _build_people_daily_engine,
72
62
  _build_flk_law_engine,
73
63
  _build_wikisource_engine,
74
- _build_weibo_hot_engine,
75
- _build_douyin_hot_engine,
76
64
  _build_csdn_engine,
77
65
  _build_wallstreetcn_engine,
78
66
  _build_weather_cn_engine,
@@ -98,9 +86,6 @@ from engines_builders_batch14 import (
98
86
  from engines_builders_batch15 import (
99
87
  _build_yuanbao_engine,
100
88
  )
101
- from engines_builders_batch16 import (
102
- _build_hf_papers_engine,
103
- )
104
89
  from engines_builders_data import (
105
90
  _build_open_library_engine,
106
91
  _build_weread_engine,
@@ -128,8 +113,6 @@ from engines_builders_science import (
128
113
  _build_biorxiv_engine,
129
114
  _build_rcsb_pdb_engine,
130
115
  _build_usgs_engine,
131
- _build_nasa_cmr_engine,
132
- _build_clinicaltrials_engine,
133
116
  _build_openfda_engine,
134
117
  )
135
118
  from engines_builders_finance import (
@@ -162,33 +145,21 @@ from engines_builders_search import (
162
145
  _build_ecosia_engine,
163
146
  )
164
147
  from engines_builders_intl import (
165
- _build_cnii_engine,
166
148
  _build_ndl_engine,
167
149
  _build_kor_law_engine,
168
150
  _build_hatena_bookmark_engine,
169
151
  _build_dnb_engine,
170
- _build_doaj_engine,
171
- _build_europeana_engine,
172
- _build_hal_engine,
173
- _build_eu_opendata_engine,
174
152
  _build_open_meteo_engine,
175
153
  _build_twitter_syndication_engine,
176
154
  _build_searchmysite_engine,
177
155
  _build_lieu_engine,
178
156
  _build_opensky_engine,
179
157
  _build_electricity_maps_engine,
180
- _build_usda_engine,
181
- _build_tatoeba_engine,
182
- _build_figshare_engine,
183
158
  _build_tencent_kline_engine,
184
159
  _build_qq_music_engine,
185
160
  _build_google_news_engine,
186
161
  _build_met_museum_engine,
187
162
  )
188
- # vam 与 wikimedia_commons 同属图源补强模块(batch11),不进 intl 组
189
- from engines_builders_batch11 import (
190
- _build_vam_engine,
191
- )
192
163
  from engines_builders_feeds import (
193
164
  _build_rss_feed_engine,
194
165
  )
@@ -210,7 +181,6 @@ __all__ = [
210
181
  "_build_em_flow_engine",
211
182
  "_build_exa_engine",
212
183
  "_build_wechat_sogou_engine",
213
- "_build_hackernews_engine",
214
184
  "_build_stackoverflow_engine",
215
185
  "_build_std_samr_engine",
216
186
  "_build_openstd_engine",
@@ -221,14 +191,11 @@ __all__ = [
221
191
  "_build_people_daily_engine",
222
192
  "_build_flk_law_engine",
223
193
  "_build_wikisource_engine",
224
- "_build_weibo_hot_engine",
225
- "_build_douyin_hot_engine",
226
194
  "_build_csdn_engine",
227
195
  "_build_wallstreetcn_engine",
228
196
  "_build_weather_cn_engine",
229
197
  "_build_google_news_engine",
230
198
  "_build_met_museum_engine",
231
- "_build_vam_engine",
232
199
  "_build_google_scholar_engine",
233
200
  "_build_v2ex_engine",
234
201
  "_build_github_engine",
@@ -236,10 +203,7 @@ __all__ = [
236
203
  "_build_cls_telegraph_engine",
237
204
  "_build_em_global_news_engine",
238
205
  "_build_eastmoney_engine",
239
- "_build_itotii_engine",
240
206
  "_build_baidu_hot_engine",
241
- "_build_toutiao_hot_engine",
242
- "_build_bilibili_hot_engine",
243
207
  "_build_open_library_engine",
244
208
  "_build_weread_engine",
245
209
  "_build_douban_book_engine",
@@ -257,11 +221,9 @@ __all__ = [
257
221
  "_build_gutenberg_engine",
258
222
  "_build_wayback_cdx_engine",
259
223
  "_build_usgs_engine",
260
- "_build_nasa_cmr_engine",
261
224
  "_build_free_dictionary_engine",
262
225
  "_build_baidu_baike_engine",
263
226
  "_build_pypi_engine",
264
- "_build_clinicaltrials_engine",
265
227
  "_build_openfda_engine",
266
228
  "_build_juejin_engine",
267
229
  "_build_models_dev_engine",
@@ -281,24 +243,16 @@ __all__ = [
281
243
  "_build_google_patents_engine",
282
244
  "_build_marginalia_engine",
283
245
  "_build_wiby_engine",
284
- "_build_cnii_engine",
285
246
  "_build_ndl_engine",
286
247
  "_build_kor_law_engine",
287
248
  "_build_hatena_bookmark_engine",
288
249
  "_build_dnb_engine",
289
- "_build_doaj_engine",
290
- "_build_europeana_engine",
291
- "_build_hal_engine",
292
- "_build_eu_opendata_engine",
293
250
  "_build_open_meteo_engine",
294
251
  "_build_twitter_syndication_engine",
295
252
  "_build_searchmysite_engine",
296
253
  "_build_lieu_engine",
297
254
  "_build_opensky_engine",
298
255
  "_build_electricity_maps_engine",
299
- "_build_usda_engine",
300
- "_build_tatoeba_engine",
301
- "_build_figshare_engine",
302
256
  "_build_tencent_kline_engine",
303
257
  "_build_qq_music_engine",
304
258
  "_build_parallel_engine",
@@ -316,11 +270,6 @@ __all__ = [
316
270
  "_build_jolpica_engine",
317
271
  "_build_openf1_engine",
318
272
  "_build_openligadb_engine",
319
- "_build_artic_engine",
320
- "_build_cleveland_engine",
321
- "_build_tvmaze_engine",
322
- "_build_jikan_engine",
323
- "_build_deezer_engine",
324
273
  "_build_listenbrainz_engine",
325
274
  "_build_egov_law_engine",
326
275
  "_build_k10plus_engine",