argo-search 2.10.2 → 2.11.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.
Files changed (45) hide show
  1. package/README.en.md +22 -11
  2. package/README.es.md +22 -11
  3. package/README.ja.md +22 -11
  4. package/README.ko.md +21 -10
  5. package/README.md +22 -11
  6. package/SKILL.md +16 -15
  7. package/backends/domain_profiles.json +18 -6
  8. package/backends/engine_registry.yaml +38 -13
  9. package/backends/quota_profiles.json +30 -10
  10. package/bin/argo +6 -0
  11. package/config.yaml +16 -17
  12. package/docs/ENGINE_CATALOG.md +11 -8
  13. package/docs/RELEASE_NOTES_v2.11.2.md +50 -0
  14. package/engines/specs/animetrace.yaml +35 -0
  15. package/engines/specs/google_lens.yaml +50 -0
  16. package/engines/specs/saucenao.yaml +45 -0
  17. package/package.json +3 -2
  18. package/packages/dsh-plugin/dsh/index.js +5 -0
  19. package/packages/dsh-plugin/dsh/runner.js +7 -1
  20. package/packages/dsh-plugin/package.json +1 -1
  21. package/packages/dsh-plugin/test/index.test.js +21 -0
  22. package/scripts/budget.py +13 -3
  23. package/scripts/engine_dispatch.py +2 -1
  24. package/scripts/engine_families.py +7 -3
  25. package/scripts/engines.py +10 -2
  26. package/scripts/engines_builders.py +0 -1
  27. package/scripts/engines_builders_intl.py +4 -4
  28. package/scripts/engines_builders_reverse_image.py +783 -0
  29. package/scripts/engines_builders_tech.py +0 -78
  30. package/scripts/extend_route_labels_by_language.py +306 -0
  31. package/scripts/image_vision/vision_probe +0 -0
  32. package/scripts/job.py +2 -1
  33. package/scripts/lint_spec_contracts.py +110 -0
  34. package/scripts/lint_stub_targets.py +130 -0
  35. package/scripts/local_image.py +3 -3
  36. package/scripts/mcp_compact.py +5 -0
  37. package/scripts/mcp_transport.py +1 -1
  38. package/scripts/net_proxy.py +47 -0
  39. package/scripts/plan.py +11 -0
  40. package/scripts/pre-commit +21 -13
  41. package/scripts/quota.py +109 -10
  42. package/scripts/search.py +13 -12
  43. package/scripts/search_pipeline.py +15 -15
  44. package/scripts/social_engines/twitter_engine.py +35 -2
  45. package/scripts/social_engines/xiaohongshu_engine.py +25 -0
@@ -0,0 +1,50 @@
1
+ # Google Lens · 通用视觉同源反查(SerpAPI 托管)
2
+ #
3
+ # 输入形态特殊:query 是一张图(公网图片 URL 或本地图片路径),不是关键词。上游
4
+ # 拿这张图做视觉匹配,分三档回来:exact_matches(就是这张图)、visual_matches
5
+ # (长得像的图与同源商品/帖子)、organic_results(讲到这张图的网页)。结果条目
6
+ # 各自带 `metadata.match_type` 标注归属哪一档——三档混成一列而不标注,调用方会
7
+ # 把「另一张相似的图」当成这张图的出处。
8
+ #
9
+ # 本地图片先 POST 到 SerpAPI Image API(`https://serpapi.com/image`,multipart,
10
+ # 只收 JPEG/PNG/WebP、单张 ≤500KB)换 `image_id`,再用 `image_id` 检索;该 id
11
+ # 10 分钟内有效,故上传后立即用掉。超限的本地图先缩到 1024px,仍超再退 768/512。
12
+ #
13
+ # 为什么走 SerpAPI:Google Lens 官方没有公开 API,免 key 的
14
+ # `lens.google.com/uploadbyurl` 只回壳页(2026-11-04 实测 200 但无结果 JSON)。
15
+ # SerpAPI 的 `engine=google_lens` 是文档最全的托管通道:`url` 传图片直链或
16
+ # `image_id` 传上传图,`type` 选 all/exact_matches/visual_matches,返回结构见
17
+ # https://serpapi.com/google-lens-api 。
18
+ #
19
+ # 计费:paid 档,按次扣费(Free 计划 250 次/月、50 次/小时);1 小时内完全相同
20
+ # 的参数走 SerpAPI 缓存、不计次。cost_per_call 按 Developer 计划 $75/5000 次
21
+ # ≈ ¥0.11/次折算,仅用于预算面板估算,不代表实扣金额。
22
+ #
23
+ # 路由形态:explicit_only —— 没有图片的普通查询落进来只会得到错误条目,
24
+ # 故不进自动路由候选池;用法是 `argo search "<图片URL或本地路径>" --engine google_lens`。
25
+ #
26
+ # 验证:
27
+ # python3 scripts/engine_validate.py --engine google_lens --stage all --admit --write-doc
28
+
29
+ engine_id: google_lens
30
+ type: google_lens
31
+ enabled: true
32
+ explicit_only: true
33
+ cost_tier: paid
34
+ cost_per_call: 0.11
35
+ cost_unit: cny
36
+ timeout: 30
37
+ num_results: 8
38
+ search_type: all
39
+ hl: zh-CN
40
+ country: cn
41
+ canary_query: "https://files.yande.re/image/2555de7669c169cd98a6c9da7da27edd/yande.re%20447155%20bigxixi%20feet%20pantyhose%20see_through.jpg"
42
+ label: Google Lens 反搜图
43
+ family: misc_vertical
44
+ priority: 37
45
+ required_env:
46
+ - ARGO_SERPAPI_API_KEY
47
+
48
+ coverage: [image, reverse_image]
49
+
50
+ desc: Google Lens 通用视觉反查(query 为公网图片 URL 或本地图片路径,本地图经 SerpAPI Image API 上传,付费档 250 次/月免费额度,回精确匹配/视觉相似/相关网页三档);cost_per_call ¥0.11 按 Developer 计划 $75/5000 次折算,仅面板估算,不代表实扣
@@ -0,0 +1,45 @@
1
+ # SauceNAO · 二次元图源反查
2
+ #
3
+ # 输入形态特殊:query 必须是**公网可访问的图片 URL**,不是关键词。上游拿这张图
4
+ # 做指纹比对,返回它出自哪个库(Pixiv / Danbooru / Twitter / 游戏 CG 等),
5
+ # 以及相似度、作者、出处页。
6
+ #
7
+ # 为什么必须配 key:匿名档已关闭 API 调用(2026-11-04 实测不带 api_key 返回
8
+ # {"header":{"status":-1,"message":"The anonymous account type does not permit
9
+ # API usage."}})。saucenao.com 免费注册后每天 150 次;没有 key 时本引擎
10
+ # 在自动路由里被跳过,显式调用返回一条「缺 key」的 error 条目。
11
+ #
12
+ # 出口:站点在 Cloudflare 之后,urllib 直连吃 403 挑战页;取数走 TLS 指纹伪造
13
+ # (curl_cffi impersonate),代理仍按 net_proxy 的域规则/全局配置解析。
14
+ #
15
+ # 路由形态:explicit_only —— 没有图片 URL 的普通查询落进来只会得到错误条目,
16
+ # 故不进自动路由候选池;用法是 `argo search "<图片URL>" --engine saucenao`。
17
+ #
18
+ # 验证:
19
+ # python3 scripts/engine_validate.py --engine saucenao --stage all --admit --write-doc
20
+
21
+ engine_id: saucenao
22
+ type: saucenao
23
+ enabled: true
24
+ explicit_only: true
25
+ cost_tier: free
26
+ timeout: 20
27
+ num_results: 5
28
+ min_similarity: 30
29
+ # hide:0 全显示 / 1 隐藏露骨 / 2 再隐藏疑似露骨 / 3 只留安全内容。群聊默认 1——
30
+ # Pixiv、Kemono 这类库本身就带成人内容,等回传后再由调用方筛已经晚了。
31
+ hide: 1
32
+ # dedupe:0 不去重 / 1 按条目去重 / 2 连系列一起并(SauceNAO 默认 2)。
33
+ dedupe: 2
34
+ # db=999 搜全部索引;要限定库时换成 dbs: [5, 43](索引号列表,与 db 互斥)。
35
+ db: 999
36
+ canary_query: "https://files.yande.re/image/2555de7669c169cd98a6c9da7da27edd/yande.re%20447155%20bigxixi%20feet%20pantyhose%20see_through.jpg"
37
+ label: SauceNAO 反搜图
38
+ family: misc_vertical
39
+ priority: 35
40
+ required_env:
41
+ - ARGO_SAUCENAO_API_KEY
42
+
43
+ coverage: [image, reverse_image]
44
+
45
+ desc: SauceNAO 二次元图源反查(query 为图片 URL 或本地图片路径,免费 key 150 次/日,给相似度与 Pixiv 等出处页)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "argo-search",
3
- "version": "2.10.2",
4
- "description": "Argo 阿尔戈 — 统一搜索与证据核验。推荐 npx -y argo-search(npm 发布版)或 install.sh 安装。多语言路由、284 个源(240 个免密钥开箱可用)、影视/体育/金融等垂直源、19 个 MCP 工具(与 CLI 能力面对齐)。",
3
+ "version": "2.11.2",
4
+ "description": "Argo 阿尔戈 — 统一搜索与证据核验。推荐 npx -y argo-search(npm 发布版)或 install.sh 安装。多语言路由、286 个源(240 个免密钥开箱可用)、影视/体育/金融等垂直源、19 个 MCP 工具(与 CLI 能力面对齐)。",
5
5
  "keywords": [
6
6
  "mcp",
7
7
  "mcp-server",
@@ -55,6 +55,7 @@
55
55
  "docs/RELEASE_NOTES_v2.9.0.md",
56
56
  "docs/RELEASE_NOTES_v2.10.1.md",
57
57
  "docs/RELEASE_NOTES_v2.10.2.md",
58
+ "docs/RELEASE_NOTES_v2.11.2.md",
58
59
  "docs/RELEASE_NOTES_v2.10.0.md",
59
60
  "docs/RELEASE_NOTES_v2.9.9.md",
60
61
  "docs/RELEASE_NOTES_v2.9.8.md",
@@ -427,6 +427,9 @@ export function apply(ctx, providedConfig = {}) {
427
427
  idleMs: config.searchIdleMs,
428
428
  max: config.searchConcurrency,
429
429
  config,
430
+ // issue #41:显式带上宿主凭证服务,否则池内连接 envResolver 解析
431
+ // keyRefs 时 provider 为 undefined,所有需 key 引擎静默 skipped。
432
+ credentials: hostCredentials,
430
433
  })
431
434
  },
432
435
  })
@@ -444,6 +447,8 @@ export function apply(ctx, providedConfig = {}) {
444
447
  max: config.searchConcurrency,
445
448
  maxChars: config.fetchMaxChars,
446
449
  config,
450
+ // issue #41:与 search 同理,fetch 池连接也要带上凭证服务。
451
+ credentials: hostCredentials,
447
452
  })
448
453
  },
449
454
  })
@@ -472,13 +472,19 @@ export async function searchViaArgoMCP(query, maxResults = 5, signal, options =
472
472
  const timeoutMs = options.timeoutMs ?? DEFAULTS.searchTimeoutMs
473
473
  const count = clamp(maxResults ?? 5, 5, 1, 20)
474
474
 
475
+ // 关键(issue #41):search 走 MCP 池,但池的连接此前只把 config 交给
476
+ // envResolver,没有把 caller 的 credentials 带上——而 web 搜索 provider
477
+ // 是经 registerSearchProvider 进来的,手里有 config 却没有 credentials 服务,
478
+ // 于是 resolveArgoEnv 的 provider 恒为 undefined,keyRefs 一个都解析不出来,
479
+ // 所有需 API key 的引擎长期 skipped-missing-env。这里把 config.credentials
480
+ // 显式并入,让「池内连接」与「单发兜底」两条路径解析出同一份 key。
475
481
  const conn = await acquireMcp({
476
482
  command,
477
483
  args,
478
484
  idleMs: options.idleMs ?? DEFAULTS.searchIdleMs,
479
485
  max: options.max ?? DEFAULTS.searchConcurrency,
480
486
  initMs: timeoutMs,
481
- credentials: options.credentials,
487
+ credentials: options.credentials ?? options.config?.credentials,
482
488
  config: options.config,
483
489
  }, signal)
484
490
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taxueseek/argo-dsh",
3
- "version": "2.10.2",
3
+ "version": "2.11.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",
@@ -396,6 +396,27 @@ function makeCtx() {
396
396
  }
397
397
  return { ctx, registered, providers, fetchProviders, guards }}
398
398
 
399
+ test('searchViaArgoMCP: pool path resolves keyRefs from caller credentials (issue #41)', async () => {
400
+ // 回归:search 走 MCP 池,连接 envResolver 只认 options.config/env。web 搜索
401
+ // provider 经 registerSearchProvider 进来,手里有 config、无独立顶层
402
+ // credentials;此前 acquireMcp 只传 options.credentials(undefined),于是
403
+ // resolveArgoEnv 的 provider 恒为 undefined,keyRefs 解析不出来,所有需
404
+ // API key 的引擎长期 skipped-missing-env。锁住 config.credentials 这条路径:
405
+ // 记录凭据被解析过 + 池确实按该 config 开了一条连接(桩不回 JSON,忽略载荷)。
406
+ stubEnv()
407
+ let resolved = 0
408
+ const fake = { resolve: async (ref) => { resolved += 1; return ref === 'DEEPSEEK_API_KEY' ? { value: 'sk-host', source: 'file' } : undefined } }
409
+ const fakeConn = { release() {}, request: async () => ({ content: [{ type: 'text', text: '{"success":true,"results":[]}' }] }) }
410
+ try {
411
+ await searchViaArgoMCP('hello', 5, undefined, {
412
+ command: process.execPath, args: [STUB_SERVER], timeoutMs: 5000,
413
+ credentials: fake, config: { keyRefs: ['DEEPSEEK_API_KEY'] },
414
+ })
415
+ } catch { /* 桩载荷非 JSON,忽略;只验凭据解析 */ }
416
+ assert.ok(resolved >= 1, 'caller 传入的 credentials 应被用来解析 keyRefs')
417
+ assert.equal(spawnCount(), 1, '应按该 config 开一条池连接')
418
+ })
419
+
399
420
  test('providerSupportsStructured: rc.2 capabilities no longer include toolFilter', () => {
400
421
  assert.equal(providerSupportsStructured({
401
422
  capabilities: { agentOptions: true, agentPreset: true, outputSchema: true, depthLimit: true }
package/scripts/budget.py CHANGED
@@ -170,7 +170,16 @@ def budget_for(engine: str) -> dict[str, Any] | None:
170
170
 
171
171
 
172
172
  def apply_to_profiles(profiles: dict[str, dict[str, Any]]) -> None:
173
- """把预算挂到 quota profile(就地)。只覆盖存在的引擎,拼错不生效。"""
173
+ """把预算挂到 quota profile(就地)。只覆盖存在的引擎,拼错不生效。
174
+
175
+ **只写 budget_*,不碰 `period`**(issue #42):`period` 是本地记账/限频的
176
+ 重置口径(quota._period_elapsed 读它:second/minute 限频、day/month 计费),
177
+ 而预算条目里的 period 是「预算多久清零一次」。两者此前共用一个字段,导致
178
+ DeepSeek 的 period 从 `second`(限频语义)被预算覆写成 `month`——远端一次
179
+ 402 余额不足就按 `month` 熔断 30 天。现在拆开:预算周期只落在
180
+ `budget_period`,配额记账周期保留 spec 声明值。远端 402 冷却也不再读
181
+ profile.period,见 quota._quota_cooldown_seconds。
182
+ """
174
183
  active = load_budgets()
175
184
  for engine, spec in profiles.items():
176
185
  if not isinstance(spec, dict) or str(engine).startswith("_"):
@@ -179,11 +188,12 @@ def apply_to_profiles(profiles: dict[str, dict[str, Any]]) -> None:
179
188
  if entry is not None:
180
189
  spec["budget_amount"] = entry["amount"]
181
190
  spec["budget_currency"] = entry["currency"]
182
- # 预算周期即重置周期;与 limit 共用同一条 `period`,避免两套时钟。
183
- spec["period"] = entry["period"]
191
+ # 预算清零周期独立成 budget_period,绝不覆写 quota 记账用的 period
192
+ spec["budget_period"] = entry["period"]
184
193
  else:
185
194
  spec.pop("budget_amount", None)
186
195
  spec.pop("budget_currency", None)
196
+ spec.pop("budget_period", None)
187
197
 
188
198
 
189
199
  def _write(data: dict[str, Any]) -> None:
@@ -422,7 +422,8 @@ def run_dispatch(*, query: str, retrieval_query: str, engines: list[str],
422
422
  _until_s = (time.strftime("%m-%d %H:%M", time.localtime(_until))
423
423
  if _until else "未知")
424
424
  outcome["detail"] = (
425
- f"远端配额耗尽,跳过调用(自愈至 {_until_s}):"
425
+ f"远端配额耗尽,跳过调用(自愈至 {_until_s};已充值或换 Key 可执行 "
426
+ f"`quota.py reset {eng}` 立即恢复):"
426
427
  f"{str(_mark.get('reason') or '')[:80]}")
427
428
  return eng, [], outcome, lat
428
429
 
@@ -73,10 +73,14 @@ _ENGINE_FAMILY_OVERRIDES: dict[str, str] = {
73
73
  "qwant": "web_general",
74
74
  "shenma": "web_general",
75
75
  "so": "web_general",
76
- # 批次十(2026-09-26):bing_rss 是 local_bing 的 RSS 稳定出口;
77
- # tineye 反搜图不属于任何既有能力族,归 misc_vertical。
76
+ # 批次十(2026-09-26):bing_rss 是 local_bing 的 RSS 稳定出口。
78
77
  "bing_rss": "web_general",
79
- "tineye": "misc_vertical",
78
+ # 反搜图三条(SauceNAO / AnimeTrace / Google Lens)都吃图片 URL:
79
+ # SauceNAO 查二次元图源,AnimeTrace 认动漫角色,Google Lens 查通用视觉同源;
80
+ # 归 misc_vertical。
81
+ "saucenao": "misc_vertical",
82
+ "animetrace": "misc_vertical",
83
+ "google_lens": "misc_vertical",
80
84
  # 学术
81
85
  "arxiv": "academic",
82
86
  "openalex": "academic",
@@ -103,7 +103,6 @@ from engines_builders import (
103
103
  _build_stackoverflow_engine,
104
104
  _build_google_scholar_engine,
105
105
  _build_v2ex_engine,
106
- _build_tineye_engine,
107
106
  _build_bing_rss_engine,
108
107
  _build_ths_hot_engine,
109
108
  _build_cls_telegraph_engine,
@@ -226,6 +225,13 @@ from engines_builders_batch10 import ( # noqa: F401
226
225
  from engines_builders_batch11 import ( # noqa: F401
227
226
  _build_wikimedia_commons_engine,
228
227
  )
228
+ # 反搜图(engines_builders_reverse_image):query 是公网图片 URL 而非关键词,
229
+ # 取数与解析都与关键词引擎不同,独立成模块。
230
+ from engines_builders_reverse_image import ( # noqa: F401
231
+ _build_animetrace_engine,
232
+ _build_google_lens_engine,
233
+ _build_saucenao_engine,
234
+ )
229
235
 
230
236
 
231
237
 
@@ -438,7 +444,9 @@ _BUILDERS = {
438
444
  "clawhub": _build_clawhub_engine,
439
445
  "google_scholar": _build_google_scholar_engine,
440
446
  "v2ex": _build_v2ex_engine,
441
- "tineye": _build_tineye_engine,
447
+ "saucenao": _build_saucenao_engine,
448
+ "animetrace": _build_animetrace_engine,
449
+ "google_lens": _build_google_lens_engine,
442
450
  "bing_rss": _build_bing_rss_engine,
443
451
  "ths_hot": _build_ths_hot_engine,
444
452
  "cls_telegraph": _build_cls_telegraph_engine,
@@ -42,7 +42,6 @@ from engines_builders_tech import (
42
42
  _build_endoflife_engine,
43
43
  _build_v2ex_engine,
44
44
  _build_github_engine,
45
- _build_tineye_engine,
46
45
  _build_bing_rss_engine,
47
46
  )
48
47
  from engines_builders_cn import (
@@ -981,12 +981,12 @@ def _build_qq_music_engine(spec: dict[str, Any]) -> Any:
981
981
 
982
982
  # ── X/Twitter 单条推文(syndication 免登录通道)─────────────────────────────
983
983
 
984
- # 推文 URL / 裸 ID 提取。链接形态覆盖 x.com 与 twitter.com 两代域名,
985
- # 以及 /statuses/ 老路径与移动端分享链接的 query 参数形态。
984
+ # 推文 URL / 裸 ID 提取:覆盖两代域名、/statuses/ 老路径与 query 参数形态;
985
+ # URL/query 允许 1~25 位早期短 ID,裸数字仍按 10~20 位防普通数字误判。
986
986
  _TWEET_URL_RE = re.compile(
987
- r"(?:x\.com|twitter\.com)/[^/\s]+/(?:status|statuses)/(\d{10,20})", re.I)
987
+ r"(?:x\.com|twitter\.com)/[^/\s]+/(?:status|statuses)/(\d{1,25})", re.I)
988
988
  _TWEET_BARE_ID_RE = re.compile(r"^\d{10,20}$")
989
- _TWEET_QUERY_ID_RE = re.compile(r"[?&](?:tweet_id|status_id|id)=(\d{10,20})")
989
+ _TWEET_QUERY_ID_RE = re.compile(r"[?&](?:tweet_id|status_id|id)=(\d{1,25})")
990
990
 
991
991
 
992
992
  def extract_tweet_id(text: str) -> str | None: