argo-search 2.17.0 → 2.18.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 (70) hide show
  1. package/AGENTS.md +3 -3
  2. package/README.es.md +10 -5
  3. package/README.ja.md +10 -5
  4. package/README.ko.md +10 -5
  5. package/README.md +11 -6
  6. package/README.zh.md +11 -6
  7. package/SKILL.md +12 -11
  8. package/assets/readme/counts.json +1 -1
  9. package/assets/readme/hero.svg +3 -3
  10. package/backends/domain_profiles.json +6 -0
  11. package/backends/engine_registry.yaml +12 -0
  12. package/backends/quota_profiles.json +10 -0
  13. package/bin/argo +78 -12
  14. package/docs/CHANGELOG.md +19 -1
  15. package/docs/COMMIT_STANDARD.md +2 -2
  16. package/docs/ENGINE_CATALOG.md +7 -6
  17. package/docs/RELEASE_NOTES_v2.17.0.md +4 -2
  18. package/docs/RELEASE_NOTES_v2.18.0.md +87 -0
  19. package/docs/RELEASING.md +1 -1
  20. package/engines/specs/twitter_cli.yaml +17 -0
  21. package/engines/specs/twitter_syndication.yaml +2 -3
  22. package/package.json +2 -1
  23. package/packages/dsh-plugin/dsh/native-tools.mjs +10 -0
  24. package/packages/dsh-plugin/dsh/workbench-io.js +34 -15
  25. package/packages/dsh-plugin/dsh/workbench-search.js +66 -6
  26. package/packages/dsh-plugin/dsh/workbench.js +43 -0
  27. package/packages/dsh-plugin/package.json +1 -1
  28. package/packages/dsh-plugin/test/workbench-concurrency.test.js +9 -11
  29. package/packages/dsh-plugin/test/workbench.test.js +85 -0
  30. package/scripts/affected_tests.py +324 -0
  31. package/scripts/badcase_ledger.py +93 -2
  32. package/scripts/check_commit_report.py +13 -9
  33. package/scripts/cli_io.py +8 -3
  34. package/scripts/engine_families.py +1 -0
  35. package/scripts/engine_states.py +4 -4
  36. package/scripts/engines.py +2 -0
  37. package/scripts/engines_base.py +12 -28
  38. package/scripts/engines_builders_intl.py +20 -94
  39. package/scripts/engines_twitter_cli.py +182 -0
  40. package/scripts/fetch_cli_output.py +75 -0
  41. package/scripts/fetch_dispatch.py +248 -0
  42. package/scripts/fetch_quality.py +11 -0
  43. package/scripts/fetch_v3.py +48 -114
  44. package/scripts/intent_router.py +224 -0
  45. package/scripts/mcp_compact.py +3 -0
  46. package/scripts/mcp_handlers.py +24 -4
  47. package/scripts/mcp_tools.py +2 -0
  48. package/scripts/mcp_transport.py +1 -1
  49. package/scripts/mcp_warm.py +15 -11
  50. package/scripts/output_transparency.py +10 -0
  51. package/scripts/pre-commit +9 -1
  52. package/scripts/release_check.py +1 -2
  53. package/scripts/research_notes.py +52 -5
  54. package/scripts/retry_policy.py +17 -3
  55. package/scripts/route_combo.py +8 -3
  56. package/scripts/search.py +29 -29
  57. package/scripts/search_cli.py +104 -8
  58. package/scripts/search_output.py +4 -1
  59. package/scripts/social_research.py +8 -6
  60. package/scripts/time_utils.py +28 -0
  61. package/scripts/twitter_single_read.py +107 -0
  62. package/scripts/x_keyword_route.py +138 -0
  63. package/scripts/x_search.py +24 -33
  64. package/scripts/zhihu_answer_body.py +96 -0
  65. package/scripts/zhihu_answer_fetch.py +66 -0
  66. package/scripts/zhihu_answer_lookup.py +138 -0
  67. package/sub-skills/local-seek/SKILL.md +3 -1
  68. package/sub-skills/local-seek/scripts/seek.py +80 -109
  69. package/sub-skills/local-seek/scripts/seek_git.py +65 -0
  70. package/sub-skills/local-seek/scripts/seek_inspect.py +242 -0
@@ -6,12 +6,12 @@
6
6
 
7
7
  ## 一、总量与口径
8
8
 
9
- - **收录 313 个源**(`engines/specs/*.yaml` 声明总数)
9
+ - **收录 314 个源**(`engines/specs/*.yaml` 声明总数)
10
10
  - **开箱可用 261 个**:不需要你配任何密钥或装额外工具(其中显式专用源需 `--engine` 调用,见下方「显式专用」清单)
11
11
  - **需自备密钥 40 个**:`bocha`、`bocha_ai`、`brave`、`byted`、`deepseek_search`、`em_miaoxiang`、`felo`、`fourget`、`google_lens`、`helve`、`keenable`、`metaso`、`metaso_doc`、`metaso_image`、`metaso_podcast`、`metaso_scholar`、`metaso_video`、`octen`、`opencorporates`、`parallel`、`qweather`、`saucenao`、`sciverse`、`searxng`、`seltz`、`tavily`、`tinyfish`、`tinyfish_news`、`tinyfish_paper`、`unpaywall`、`weread`、`wolframalpha`、`you`、`yuanbao`、`zhihu`、`zhihu_global`、`zhihu_hot`、`zhihu_kb`、`zhihu_questions`、`zhihu_user`(没配也不影响搜索,路由会跳过)
12
- - **需装后端工具 4 个**:`digup`、`reddit`、`twitter`、`xiaohongshu`(装好并登录后即可用)
12
+ - **需装后端工具 5 个**:`digup`、`reddit`、`twitter`、`twitter_cli`、`xiaohongshu`(装好并登录后即可用)
13
13
  - **已停用 8 个**:`ecosia`、`jikan`、`local_bing_news`、`local_goodreads`、`nbs_stats`、`qwant`、`realtime_index`、`soilgrids`
14
- - **显式专用 44 个**:`ai_labs`、`animetrace`、`bing_rss`、`brave`、`datagov_uk`、`deepseek_search`、`digup`、`doi`、`ecosia`、`europeana`、`feed`、`felo`、`fourget`、`gdelt`、`google_lens`、`grepapp_mcp`、`helve`、`local_baidu`、`local_npm`、`local_seek`、`local_yandex`、`metaso_doc`、`metaso_image`、`metaso_podcast`、`metaso_scholar`、`metaso_video`、`ncpssd`、`opencitations`、`pixiv`、`qwant`、`saucenao`、`sciverse`、`searxng`、`tinyfish`、`tinyfish_news`、`tinyfish_paper`、`tracemoe`、`twitter_syndication`、`unpaywall`、`wolframalpha`、`x_trending`、`zbmath`、`zhihu_kb`、`zhihu_questions`(设计上不进自动路由,按 `--engine` 或交接提示调用)
14
+ - **显式专用 45 个**:`ai_labs`、`animetrace`、`bing_rss`、`brave`、`datagov_uk`、`deepseek_search`、`digup`、`doi`、`ecosia`、`europeana`、`feed`、`felo`、`fourget`、`gdelt`、`google_lens`、`grepapp_mcp`、`helve`、`local_baidu`、`local_npm`、`local_seek`、`local_yandex`、`metaso_doc`、`metaso_image`、`metaso_podcast`、`metaso_scholar`、`metaso_video`、`ncpssd`、`opencitations`、`pixiv`、`qwant`、`saucenao`、`sciverse`、`searxng`、`tinyfish`、`tinyfish_news`、`tinyfish_paper`、`tracemoe`、`twitter_cli`、`twitter_syndication`、`unpaywall`、`wolframalpha`、`x_trending`、`zbmath`、`zhihu_kb`、`zhihu_questions`(设计上不进自动路由,按 `--engine` 或交接提示调用)
15
15
 
16
16
  自己核一遍(口径不同,别混用):
17
17
 
@@ -26,7 +26,7 @@ argo search --list-engines --detail # 逐源状态/密钥/依赖
26
26
 
27
27
  ## 二、费用与密钥:哪些白用、哪些要钱
28
28
 
29
- - **免费档 290 个**(含已停用):无需密钥,或只需免费注册的密钥;其中 18 个要自备密钥(免费额度):em_miaoxiang、fourget、keenable、opencorporates、qweather、saucenao、searxng、tinyfish、tinyfish_news、tinyfish_paper、unpaywall、weread、wolframalpha、zhihu、zhihu_hot、zhihu_kb、zhihu_questions、zhihu_user
29
+ - **免费档 291 个**(含已停用):无需密钥,或只需免费注册的密钥;其中 18 个要自备密钥(免费额度):em_miaoxiang、fourget、keenable、opencorporates、qweather、saucenao、searxng、tinyfish、tinyfish_news、tinyfish_paper、unpaywall、weread、wolframalpha、zhihu、zhihu_hot、zhihu_kb、zhihu_questions、zhihu_user
30
30
  - **计费档 23 个**(下表逐个列出,档位取自各源自己的 `cost_tier` 声明)
31
31
 
32
32
  | 引擎 | 档位 | 是否进自动路由 | 需自备密钥 |
@@ -295,7 +295,7 @@ argo search --list-engines --detail # 逐源状态/密钥/依赖
295
295
  | `europeana` | 显式专用 | 免费 | 不限 | — | 语义画像命中 | 欧洲 27 国文化遗产聚合(官方公共 demo key,共享限额,故显式调用) |
296
296
  | `opencorporates` | 需自备密钥 | 免费 | 不限 | OPENCORPORATES_API_TOKEN | 域 company_search | OpenCorporates 全球公司注册(尽调/反欺诈,需 api_token) |
297
297
 
298
- ### 社区 UGC(19)
298
+ ### 社区 UGC(20)
299
299
 
300
300
  | 引擎 | 状态 | 费用 | 频率上限 | 需自备密钥 | 什么时候用到 | 说明 |
301
301
  |---|---|---|---|---|---|---|
@@ -314,6 +314,7 @@ argo search --list-engines --detail # 逐源状态/密钥/依赖
314
314
  | `weibo` | 可直接用 | 免费 | 不限 | — | 域 social、语义画像命中 | 微博 |
315
315
  | `reddit` | 需装后端工具 | 免费 | 不限 | — | 域 social、语义画像命中 | Reddit |
316
316
  | `twitter` | 需装后端工具 | 免费 | 不限 | — | 域 social、语义画像命中 | X/Twitter 关键词搜索(ego-browser 通道,原生布尔语法 from:/-is:retweet/lang:) |
317
+ | `twitter_cli` | 需装后端工具 + 显式专用 | 免费 | 不限 | — | 显式调用(--engine) | X 关键词只读搜索,按返回的作者及发布时间核验简单约束。 |
317
318
  | `twitter_syndication` | 显式专用 | 免费 | 不限 | — | 显式调用(--engine) | X/Twitter 单条推文(syndication 通道,免登录零 key,含正文/作者/时间/媒体计数) |
318
319
  | `xiaohongshu` | 需装后端工具 | 免费 | 不限 | — | 域 social、语义画像命中 | 小红书 |
319
320
  | `zhihu` | 需自备密钥 | 免费 | 5000/天 | ARGO_ZHIHU_ACCESS_SECRET | 域 shopping、域 social、域 zhihu_content、域 zhihu_hot_list、语义画像命中 | 知乎站内搜索(结构化 AuthorityLevel/赞同数/时间 + 纯问题自动下钻精选回答;需 ZHIHU_ACCESS_SECRET) |
@@ -628,7 +629,7 @@ argo search --list-engines --detail # 逐源状态/密钥/依赖
628
629
  ## 七、怎么自己查当前状态
629
630
 
630
631
  ```bash
631
- argo search --list-engines --detail | python3 -m json.tool | less # 全部 313 个源的详情
632
+ argo search --list-engines --detail | python3 -m json.tool | less # 全部 314 个源的详情
632
633
  argo search --list-engines --detail --routable-only # 只看现在能用的
633
634
  python3 scripts/matrix_search_eval.py --offline # 可达性门:有没有死源
634
635
  python3 scripts/engine_validate.py --engine <名> --stage all # 单个源的健康+质量双阶段体检
@@ -5,7 +5,9 @@
5
5
  - **What's New**:
6
6
  - **Native Query Operator Pushdown & Browser Auth Debounce**: `query_operators.py` compiles provider-native parameters (including Tavily native `language`); `browser_auth.py` and `chrome_cdp.py` add 4-state login debouncing and CDP network capture; `ego-search` adds OS-file-locked cross-process pacing (`pacing.py`), site cookie/shadow-restriction probes (`site_profiles.py`), and unifies auth state constants with `engine_states.py`.
7
7
  - **Deterministic Evidence Grounding & Isolated Source Discovery**: Added `evidence_grounding.py` (NFKC folding, ≥3-digit anti-hallucination gate, entity-window anchoring, sha1 excerpt hash) wired into `numeric_verify.py`, `CoverageStallTracker` in `research_gates.py`, and `argo engine add --probe-domain / --from-har / --discover-gaps / --verify-draft` with HAR sanitization and isolated subprocess smoke verification.
8
- - **Workbench Daily Hotspots & DSH v0.2.2-rc.5 Alignment**: Added daily real-time hotspot recommendations with zero-LLM interest re-ranking and configurable refresh schedule in Argo Workbench, `route-guard.js` TCP loopback security fence, React `PanelBoundary` fault isolation, route-aware `web_search` decorator for DSH `v0.2.2-rc.5`, and `helve` paid source (`explicit_only`; total sources 312→313).
8
+ - **Workbench Daily Hotspots & DSH v0.2.2-rc.5 Alignment**: Added daily real-time hotspot recommendations with zero-LLM interest re-ranking and configurable refresh schedule in Argo Workbench, `route-guard.js` TCP loopback security fence, React `PanelBoundary` fault isolation, route-aware `web_search` decorator for DSH `v0.2.2-rc.5`, and `helve` paid source (`explicit_only`; total sources 312→313; thanks to Owen Gallagher / `@helve-dev-mcp` via PR #50).
9
+ - **Contributors**:
10
+ - Thanks to Owen Gallagher (`@helve-dev-mcp`) for contributing the initial Helve search engine spec in [#50](https://github.com/taxueseek/argo/pull/50).
9
11
  - **Key Improvements**:
10
12
  - **Circuit-Breaker Self-Healing & Profile Ratchet**: Fixed disabled-engine cooldown recovery loop in `route_combo.py`, added `engine_fingerprint.py` environment-change auto-reset, backfilled 18 domain profiles with an empty-profile ratchet (`AUTO_EMPTY_PROFILE_BASELINE=182`), switched OpenAlex links to direct DOIs, and tightened `nan`/`inf` JSON body serialization in `engines_fields.py`.
11
13
  - **Engineering Gates & Data-Driven README Art**: Removed `# skip` exemptions from fast gates, switched `scripts/pre-commit` to 4-way parallel pytest (~12s total) including `sub-skills/ego-search/tests` and all 136 DSH plugin Node tests, extended HTTP egress attribution gates to `sub-skills/`, and replaced hand-edited README SVGs with `scripts/gen_readme_art.py` checked at release time.
@@ -23,7 +25,7 @@
23
25
  ## 这次更新有什么(通俗版)
24
26
 
25
27
  - **新源接入与画像机制收口(源 312→313)**:
26
- - 按 `paid + explicit_only` 纪律纳入 `helve` 搜索源;补齐 18 个源的域画像并建立空画像棘轮(`AUTO_EMPTY_PROFILE_BASELINE=182`),杜绝新源反复空画像。
28
+ - 按 `paid + explicit_only` 纪律纳入 `helve` 搜索源(基于外部 PR [#50](https://github.com/taxueseek/argo/pull/50),感谢外部贡献者 Owen Gallagher / `@helve-dev-mcp`);补齐 18 个源的域画像并建立空画像棘轮(`AUTO_EMPTY_PROFILE_BASELINE=182`),杜绝新源反复空画像。
27
29
  - OpenAlex 证据链接切换为 DOI 直链并完善摘要拼接;4 个源补齐 `item_upstream_authority` 透传。
28
30
  - **查询操作符原生下推与熔断自愈**:
29
31
  - `query_operators.py` 落地引擎原生参数下推(含 Tavily 原生 `language` 下发,不再静默丢失)。
@@ -0,0 +1,87 @@
1
+ # Argo v2.18.0
2
+
3
+ ## Highlights (English / TL;DR)
4
+
5
+ - **What's New**:
6
+ - **Agent-First CLI & Unified URL Dispatch**: Added `--agent` single switch and `--intent` high-level intent routing (`scripts/intent_router.py`) with Fail-Fast `--envelope` conflict checking; unified specialized URL dispatch (`scripts/fetch_dispatch.py` for WeChat, X tweets, arXiv papers, and PDFs) with tiered `--help` and pipe-friendly stdin support (`S_ISSOCK` Node libuv socketpair compatibility).
7
+ - **Exact Zhihu Answer Fetch & Verified X Keyword Search (Community PRs #54 & #55)**: `argo fetch` now reads exact Zhihu answers (`/question/{qid}/answer/{aid}`) via verified browser body first and falls back to open-platform paginated summaries with `--answer-offset` / MCP `answer_offset`; X keyword search adds auto-routing (`fxtwitter` / `twitter_cli` / `twitter` browser), `from:` + time-window verification, and single-tweet FxTwitter fallback within the shared timeout budget (total sources 313→314).
8
+ - **Local-Seek Precision Read & Workbench Integration**: Split `local-seek` into modular `seek_inspect.py` / `seek_git.py` with `--outline` span ranges, `--symbol-body` one-hop source reads, `--agent` switch, and zero-hit `handoff_hint`; wired Argo Workbench directly to `--intent`, `/argo/api/local-inspect` (with path sandbox), and `/argo/api/note-study`.
9
+ - **Contributors**:
10
+ - Thanks to **@OMSociety** (山海学社OMSociety) for four accepted PRs with full original commit authorship preserved:
11
+ - [#52](https://github.com/taxueseek/argo/pull/52): Preserve image metadata (`author`, `tags`, `similarity`, `image_url_preview`) under `--fields agent`.
12
+ - [#53](https://github.com/taxueseek/argo/pull/53): Create the state directory before acquiring its lock in DSH Workbench and isolate concurrency tests to temp directories.
13
+ - [#54](https://github.com/taxueseek/argo/pull/54): Exact Zhihu answer fetching with verified expanded body and paginated summary fallback (`--answer-offset` / `answer_offset`).
14
+ - [#55](https://github.com/taxueseek/argo/pull/55): Verified X keyword search routing (`twitter_cli` / `fxtwitter` / `twitter`) and single-tweet FxTwitter fallback.
15
+ - **Key Improvements**:
16
+ - **Reliability & Source-Side Attribution**: Eliminated silent failures and added mechanical switch-default parity gates (`test_switch_defaults_gate.py`); completed upstream error classification and HTTP status attribution, recovered transparency gaps, and moved quota pre-checks ahead of all search modes; hardened Windows/EPIPE Workbench I/O and empty-PDF explicit failure guards.
17
+ - **L2 Change-Aware Test Selection**: Landed `scripts/affected_tests.py` incremental test selection in `pre-commit` alongside `badcase_ledger.py` auto-demotion proposals and `test_help_covers_dispatch.py`.
18
+ - **Breaking Changes**: None. All CLI, MCP, sub-skill, and DSH plugin interfaces remain backward-compatible.
19
+
20
+ ---
21
+
22
+ # Argo v2.18.0 发布说明(中文)
23
+
24
+ **版本**:2.18.0
25
+ **定位**:Agent 入口收口 + 统一抓取分发 + `local-seek` 精读与工作台直连 + 社区 4 项高质量 PR 合入(知乎指定回答精确抓取、X 关键词核验与单帖补读、图片元数据保留、工作台状态锁目录修复;源 313→314)。
26
+
27
+ ---
28
+
29
+ ## 这次更新有什么(通俗版)
30
+
31
+ ### 1. 社区贡献合入(感谢 @OMSociety / 山海学社OMSociety,保留原始提交署名)
32
+
33
+ - **知乎指定回答精确抓取(PR [#54](https://github.com/taxueseek/argo/pull/54))**:
34
+ - 对 `https://www.zhihu.com/question/{问题ID}/answer/{回答ID}` 链接,`argo fetch` 与 MCP 首轮优先读取经核验的已展开回答正文,不可核验时按开放平台游标分页查摘要并做问题与回答双身份校验;新增 `--answer-offset`(MCP:`answer_offset`)显式续查,保留 `--offset` 正文切片语义,并拆出 `scripts/fetch_cli_output.py` 维持模块体积纪律。
35
+ - **X 关键词核验检索与单帖补读(PR [#55](https://github.com/taxueseek/argo/pull/55),源 313→314)**:
36
+ - X 关键词检索支持自动选路与 `engine=twitter_cli` / `fxtwitter` / `twitter` 固定单通道;对简单 `from:` 与时间窗查询按返回作者与发布时间核验(含起点、不含终点);`twitter_syndication` 单帖主通道临时失败时共用剩余预算向 FxTwitter 补读并核验 ID;MCP 同步暴露 `platforms` 与 `engine_outcomes`。
37
+ - **`--fields agent` 保留图片元数据(PR [#52](https://github.com/taxueseek/argo/pull/52))**:
38
+ - `scripts/search_output.py` 白名单补齐 `author`、`tags`、`similarity` 与 `image_url_preview`,让 Agent 在精简输出档也能读到 pixiv 与以图搜图的完整元数据。
39
+ - **DSH 工作台状态锁目录初始化修复(PR [#53](https://github.com/taxueseek/argo/pull/53))**:
40
+ - `acquireStateFileLock` 在独占创建锁文件前先 `mkdirSync` 父目录,修复干净环境下首次 `mutateWatches` 静默返回 `null` 的问题,并将并发测试隔离至临时目录。
41
+
42
+ ### 2. Agent 入口、统一 URL 分发与工作台增强
43
+
44
+ - **`--agent` 单开关与 `--intent` 高层意图路由**:
45
+ - 新增 `scripts/intent_router.py` 接入 `engines_boost` 真实垂类选源,入口 Fail-Fast 拦截 `--envelope` 冲突,并补齐 intent 引擎注册表门禁与 `bin/argo` 零依赖快启动。
46
+ - **统一 URL 专用分发与工作流管道**:
47
+ - 新增 `scripts/fetch_dispatch.py` 统一自动分发微信、X 推文、arXiv 论文与 PDF(空正文 PDF 显式失败,不再假成功);升级分层 `--help` 与 `test_help_covers_dispatch.py` 门禁;`cli_io.py` 兼容 Node libuv `S_ISSOCK` socketpair 管道输入。
48
+ - **`local-seek` 精读能力与 DSH 工作台直连**:
49
+ - `sub-skills/local-seek` 拆出 `seek_inspect.py` 与 `seek_git.py`,新增 `--outline` 起止行跨度、`--symbol-body` 一跳直读符号源码、`--agent` 单开关与零命中 `handoff_hint`。
50
+ - DSH 工作台直连 `--intent` 意图路由、`/argo/api/local-inspect`(带路径沙箱保护)与 `/argo/api/note-study` 管道沉淀,并加固 Windows 与 EPIPE 跨平台 I/O。
51
+
52
+ ### 3. 工程质量与可观测性
53
+
54
+ - **错误归因与配额前置**:补齐源头错误分类与 HTTP 状态码归因、恢复输出透视空转,并前置全模式配额预检。
55
+ - **开关默认值门禁与 L2 增量选测**:新增 `tests/test_switch_defaults_gate.py` 机械对拍开关默认值;落地 `scripts/affected_tests.py` 变更感知增量选测与 `badcase_ledger.py` 坏例自动降级提案;快门禁清单扩展至 83 项(4 片并行)。
56
+
57
+ ---
58
+
59
+ ## 社区贡献致谢(Contributors)
60
+
61
+ - **@OMSociety(山海学社OMSociety)**:贡献 4 项 PR([#52](https://github.com/taxueseek/argo/pull/52)、[#53](https://github.com/taxueseek/argo/pull/53)、[#54](https://github.com/taxueseek/argo/pull/54)、[#55](https://github.com/taxueseek/argo/pull/55)),全部以 `--no-ff` 保留原始提交与作者署名合入主干。
62
+
63
+ ---
64
+
65
+ ## 验证
66
+
67
+ - `bash scripts/pre-commit`(83 条快门禁 4 片并行 + 314 引擎派生件一致性校验 + `ego-search` 13 用例 + DSH 插件 139 项 Node 测试)全绿
68
+ - `.venv/bin/python -m pytest tests/ --splits 4`(全量 4 片并行回归)100% 通过
69
+ - `.venv/bin/python scripts/release.py check`(结构、五语 README、`ENGINE_CATALOG.md` 与 `gen_readme_art.py --check`)全绿
70
+
71
+ ---
72
+
73
+ ## 兼容性
74
+
75
+ - **无破坏性变更**:CLI、MCP、子技能与 DSH 插件接口均向后兼容;`twitter_cli` 按运行环境凭据按需启用。
76
+
77
+ ---
78
+
79
+ ## 社区广播模板(Broadcast Snippets)
80
+
81
+ **X / Twitter (280 chars)**:
82
+
83
+ Argo v2.18.0: `--agent` switch & `--intent` routing, unified `fetch_dispatch` (WeChat/X/arXiv/PDF), modular `local-seek` `--symbol-body`, plus 4 community PRs from @OMSociety (exact Zhihu answer fetch, verified X search & fallback, agent image metadata, DSH lock fix; 314 sources).
84
+
85
+ **开发者群广播**:
86
+
87
+ Argo v2.18.0 发布:新增 `--agent` 单开关与 `--intent` 意图路由、统一 URL 分发层(微信/推文/论文/PDF)、`local-seek` `--symbol-body` 一跳直读与 DSH 工作台直连;并完整吸纳社区贡献者 @OMSociety 的 4 项 PR(#52/#53/#54/#55:知乎指定回答精确抓取、X 关键词核验与单帖补读、agent 档图片元数据保留、工作台状态锁目录初始化修复,源增至 314 个),全部保留原始提交署名。83 项快门禁、139 项插件 Node 测试与全量 pytest 回归全绿。详见 docs/RELEASE_NOTES_v2.18.0.md。
package/docs/RELEASING.md CHANGED
@@ -23,7 +23,7 @@ python3 scripts/release.py publish 2.10.1 --yes
23
23
 
24
24
  管(确定性):
25
25
 
26
- - 8 处机器声明:pyproject / package.json / dsh 插件包 / server.json(顶层 + packages)/ `__version__` / SKILL.md / `ARGO_MCP_VERSION`(ZCode 插件三处随 2026-11-13 packages/argo-zcode 剥离退出)
26
+ - 8 处机器声明:pyproject / package.json / dsh 插件包 / server.json(顶层 + packages)/ `__version__` / SKILL.md / `ARGO_MCP_VERSION`
27
27
  - 五语 README 徽标、安装段「当前版本」散文、能力段标题
28
28
  - package.json 的 files 白名单补新发布说明;缺发布说明时生成带 `<!-- release-todo -->` 的骨架
29
29
  - `check`:release_check(结构)+ 内容清单 + `gen_engine_catalog.py --check`(目录计数)+ `gen_readme_art.py --check`(对外证据图)
@@ -0,0 +1,17 @@
1
+ engine_id: twitter_cli
2
+ type: twitter_cli
3
+ label: X/Twitter (twitter-cli)
4
+ desc: X 关键词只读搜索,按返回的作者及发布时间核验简单约束。
5
+ enabled: true
6
+ explicit_only: true
7
+ recommended: false
8
+ coverage: [social, english]
9
+ cost_tier: free
10
+ qps: 1
11
+ timeout: 20
12
+ canary_query: 'from:elonmusk the bird is freed since:2022-10-28 until:2022-10-29'
13
+ allowed_env: [TWITTER_AUTH_TOKEN, TWITTER_CT0, TWITTER_PROXY]
14
+ requires:
15
+ - bin: twitter
16
+ optional: true
17
+ fix: 安装 twitter-cli 0.8.5 并配置该引擎的账号环境变量。
@@ -1,9 +1,8 @@
1
1
  # X/Twitter 单条推文(syndication 免登录通道)
2
2
  #
3
3
  # 定位:按推文取单条的抽取型引擎,与 twitter(搜索型)互为补充。
4
- # 通道原理:面向第三方网页嵌入的公开接口,访问凭证由推文 ID 本地推导
5
- #(见 engines_builders_intl.syndication_token),无需任何账号或密钥——
6
- # X 网页与官方 API 对未登录请求一律拒绝,这是常年可用的第二条通道。
4
+ # 首选公开 syndication 嵌入接口;临时故障时以同一 ID 请求一次 FxTwitter。
5
+ # 补读结果来源为 twitter_syndication/fxtwitter。访问受限、已删除或 ID 不符时终止。
7
6
  #
8
7
  # 查询词形态:推文 URL(x.com / twitter.com / 分享链接带 tweet_id 参数)或裸 ID。
9
8
  # 示例:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argo-search",
3
- "version": "2.17.0",
3
+ "version": "2.18.0",
4
4
  "description": "Argo 阿尔戈 — 统一搜索与证据核验。推荐 npx -y argo-search(npm 发布版)或 install.sh 安装。多语言路由、数百个源(大部分免密钥)、影视/体育/金融等垂直源、19 个 MCP 工具(默认注入 4 个核心,全量按需开启,与 CLI 能力面对齐)。",
5
5
  "keywords": [
6
6
  "mcp",
@@ -58,6 +58,7 @@
58
58
  "docs/RELEASE_NOTES_v2.10.1.md",
59
59
  "docs/RELEASE_NOTES_v2.10.2.md",
60
60
  "docs/RELEASE_NOTES_v2.11.2.md",
61
+ "docs/RELEASE_NOTES_v2.18.0.md",
61
62
  "docs/RELEASE_NOTES_v2.17.0.md",
62
63
  "docs/RELEASE_NOTES_v2.16.0.md",
63
64
  "docs/RELEASE_NOTES_v2.15.0.md",
@@ -30,6 +30,10 @@ export const NATIVE_TOOLS = {
30
30
  ],
31
31
  "description": "搜索领域:web 统一网络搜索(默认),social 社交媒体/论坛讨论,job 招聘岗位聚合,local 本机文件搜索"
32
32
  },
33
+ "platforms": {
34
+ "type": "string",
35
+ "description": "domain=social 的平台名,逗号分隔。twitter 表示 X 关键词自动选路;固定通道用 engine=fxtwitter/twitter_cli/twitter。"
36
+ },
33
37
  "engine": {
34
38
  "type": "string",
35
39
  "description": "指定搜索引擎(auto 自动选择;可选 octen/anysearch/exa/zhihu/eastmoney/arxiv/byted/bocha/tavily/deepseek_search/github/wikipedia/semantic_scholar/local_search 等,默认 auto;deepseek_search 为按次计费的官方 DeepSeek 搜索,结果带权威分级与发布时间,新闻时事类查询优先考虑)"
@@ -106,6 +110,7 @@ export const NATIVE_TOOLS = {
106
110
  "allowed": [
107
111
  "query",
108
112
  "domain",
113
+ "platforms",
109
114
  "engine",
110
115
  "max_results",
111
116
  "depth",
@@ -349,6 +354,10 @@ export const NATIVE_TOOLS = {
349
354
  "type": "integer",
350
355
  "description": "返回正文最大字符数(500-50000,默认 8000)"
351
356
  },
357
+ "answer_offset": {
358
+ "type": "integer",
359
+ "description": "知乎回答摘要查询偏移:首轮省略;仅在用户明确要求续查时传上次的 next_offset"
360
+ },
352
361
  "use_browser": {
353
362
  "type": "boolean",
354
363
  "description": "强制用反检测浏览器(HTTP 失败时已自动升级,默认关)"
@@ -369,6 +378,7 @@ export const NATIVE_TOOLS = {
369
378
  "extract_mode",
370
379
  "focus",
371
380
  "max_chars",
381
+ "answer_offset",
372
382
  "use_browser",
373
383
  "include_links"
374
384
  ]
@@ -14,11 +14,16 @@ const MONOREPO_ARGO_BIN = join(HERE, '..', '..', '..', 'bin', 'argo')
14
14
  // install.sh 默认安装根(ARGO_HOME 可改,此处只探测默认路径——探测不到就走
15
15
  // console script 的 PATH 兜底,不猜 site-packages 里的 wheel _data 布局)
16
16
  const INSTALL_VENV_ARGO_BIN = join(homedir(), '.local', 'share', 'argo', '.venv', 'bin', 'argo')
17
+ const INSTALL_VENV_ARGO_BIN_WIN = join(
18
+ process.env.LOCALAPPDATA || join(homedir(), 'AppData', 'Local'),
19
+ 'argo', '.venv', 'Scripts', 'argo.exe',
20
+ )
17
21
  export const WATCH_STORE_FILE = join(homedir(), '.config', 'argo', 'workbench-watches.json')
18
22
 
19
- export function mergedLaunchdPath(env = {}) {
23
+ export function mergedLaunchdPath(env = {}, platform = process.platform) {
24
+ const basePath = env.PATH || env.Path || process.env.PATH || process.env.Path || ''
25
+ if (platform === 'win32') return basePath
20
26
  const extraPath = ['/opt/homebrew/bin', '/usr/local/bin', join(homedir(), '.local', 'bin')].join(':')
21
- const basePath = env.PATH || process.env.PATH || ''
22
27
  return basePath ? `${extraPath}:${basePath}` : extraPath
23
28
  }
24
29
 
@@ -26,19 +31,31 @@ export function mergedLaunchdPath(env = {}) {
26
31
  // 裸名 'argo' 又依赖 PATH——launchd/受限 PATH 下 venv console script 可能不可达。
27
32
  // 修法加候选不重排:显式 ARGO_BIN 最优先(用户指路零猜测),其次 monorepo、
28
33
  // install.sh 默认 venv,最后裸名走 PATH。
29
- export function resolveArgoBin(env = {}) {
34
+ export function resolveArgoBin(env = {}, platform = process.platform) {
30
35
  const explicit = env.ARGO_BIN || process.env.ARGO_BIN
31
36
  if (explicit) return explicit
32
37
  if (existsSync(MONOREPO_ARGO_BIN)) return MONOREPO_ARGO_BIN
38
+ if (platform === 'win32' && existsSync(INSTALL_VENV_ARGO_BIN_WIN)) return INSTALL_VENV_ARGO_BIN_WIN
33
39
  if (existsSync(INSTALL_VENV_ARGO_BIN)) return INSTALL_VENV_ARGO_BIN
34
40
  return 'argo'
35
41
  }
36
42
 
43
+ // Windows CreateProcess 不识别 shebang:若解析到无后缀 bin/argo 或 .py 脚本,自动用 Python 解释器包装
44
+ export function resolveSpawnCommand(bin, args = [], env = {}, platform = process.platform) {
45
+ if (platform === 'win32' && (/[\\/]bin[\\/]argo$/i.test(bin) || /\.py$/i.test(bin))) {
46
+ const py = env.ARGO_PYTHON || process.env.ARGO_PYTHON || 'python'
47
+ return { cmd: py, argv: [bin, ...args] }
48
+ }
49
+ return { cmd: bin, argv: args }
50
+ }
51
+
37
52
  export function runArgoCli(args, { env = {}, stdin = null, timeoutMs = 30000, signal = null } = {}) {
38
53
  const mergedPath = mergedLaunchdPath(env)
39
54
  return new Promise((resolve, reject) => {
40
55
  if (signal?.aborted) { reject(new Error('aborted')); return }
41
- const child = spawn(resolveArgoBin({ ...env, PATH: mergedPath }), args, {
56
+ const bin = resolveArgoBin({ ...env, PATH: mergedPath })
57
+ const { cmd, argv } = resolveSpawnCommand(bin, args, env)
58
+ const child = spawn(cmd, argv, {
42
59
  env: { ...process.env, ...env, PATH: mergedPath },
43
60
  stdio: ['pipe', 'pipe', 'pipe'],
44
61
  })
@@ -78,6 +95,7 @@ export function runArgoCli(args, { env = {}, stdin = null, timeoutMs = 30000, si
78
95
  reject(new Error(`invalid json from argo ${args[0] || ''}`))
79
96
  }
80
97
  })
98
+ child.stdin.on('error', () => {})
81
99
  if (stdin !== null && stdin !== undefined) {
82
100
  child.stdin.end(typeof stdin === 'string' ? stdin : JSON.stringify(stdin))
83
101
  } else {
@@ -99,9 +117,9 @@ export function readStaticAssetCached(filePath) {
99
117
  return text
100
118
  }
101
119
 
102
- export function loadWatches() {
120
+ export function loadWatches(file = WATCH_STORE_FILE) {
103
121
  try {
104
- const raw = readFileSync(WATCH_STORE_FILE, 'utf8')
122
+ const raw = readFileSync(file, 'utf8')
105
123
  const parsed = JSON.parse(raw)
106
124
  return Array.isArray(parsed) ? parsed : []
107
125
  } catch {
@@ -109,13 +127,13 @@ export function loadWatches() {
109
127
  }
110
128
  }
111
129
 
112
- export function saveWatches(items) {
130
+ export function saveWatches(items, file = WATCH_STORE_FILE) {
113
131
  try {
114
- mkdirSync(dirname(WATCH_STORE_FILE), { recursive: true })
132
+ mkdirSync(dirname(file), { recursive: true })
115
133
  const uniq = `${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 6)}`
116
- const tmp = `${WATCH_STORE_FILE}.tmp.${uniq}`
134
+ const tmp = `${file}.tmp.${uniq}`
117
135
  writeFileSync(tmp, JSON.stringify(items, null, 2), 'utf8')
118
- renameSync(tmp, WATCH_STORE_FILE)
136
+ renameSync(tmp, file)
119
137
  } catch { /* ignore */ }
120
138
  }
121
139
 
@@ -124,6 +142,7 @@ export function saveWatches(items) {
124
142
  // 热榜与 watches 共用同一实现,消灭各自手抄(2026-11-21 审计:锁方案四家并存)。
125
143
  export function acquireStateFileLock(file, staleMs = 5 * 60 * 1000) {
126
144
  try {
145
+ mkdirSync(dirname(file), { recursive: true })
127
146
  return { fd: openSync(file, 'wx'), lockFile: file }
128
147
  } catch (err) {
129
148
  if (err?.code !== 'EEXIST') return null
@@ -146,13 +165,13 @@ export function releaseStateFileLock(lock) {
146
165
  // watches 唯一真源是磁盘文件:读-改-写全程持锁,内存副本只作缓存。
147
166
  // 旧「内存快照 + 全量覆盖写」在多宿主下互相抹改(2026-11-21 审计 P1)。
148
167
  // 返回 null 表示锁被占(另一宿主写盘中),调用方按忙处理。
149
- export function mutateWatches(mutator) {
150
- const lock = acquireStateFileLock(`${WATCH_STORE_FILE}.lock`)
168
+ export function mutateWatches(mutator, file = WATCH_STORE_FILE) {
169
+ const lock = acquireStateFileLock(`${file}.lock`)
151
170
  if (!lock) return null
152
171
  try {
153
- const next = mutator(loadWatches())
154
- if (Array.isArray(next)) saveWatches(next)
155
- return Array.isArray(next) ? next : loadWatches()
172
+ const next = mutator(loadWatches(file))
173
+ if (Array.isArray(next)) saveWatches(next, file)
174
+ return Array.isArray(next) ? next : loadWatches(file)
156
175
  } finally {
157
176
  releaseStateFileLock(lock)
158
177
  }
@@ -3,8 +3,9 @@
3
3
  * 自 workbench.js 拆出以守 1000 行门禁(2026-11-21);HTTP 骨架与宿主 handler 留在 workbench.js。
4
4
  */
5
5
 
6
+ import { realpathSync } from 'node:fs'
6
7
  import { homedir } from 'node:os'
7
- import { join } from 'node:path'
8
+ import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'
8
9
  import { DEFAULTS, stripBoundary } from './runner.js'
9
10
  import { runArgoCli } from './workbench-io.js'
10
11
  import { boundedMap } from './wide-research.js'
@@ -17,11 +18,11 @@ export const CITATION_RULE = [
17
18
 
18
19
  export const MODE_SPECS = {
19
20
  general: { label: '全网搜索', searchArgs: { max_results: 12, verify: 2, depth: 'balanced' }, prompt: '当前模式为「全网搜索」:先用 2 到 3 句话给出直接结论,再用清晰小标题展开关键依据与延伸信息。' },
20
- hotspot: { label: '热点分析', searchArgs: { max_results: 14, sort: 'newest', since: '14d', depth: 'balanced', verify: 2 }, socialSupplement: true, prompt: '当前模式为「热点分析」:按「一、核心结论与现状」「二、事件脉络」「三、核心争议与各方立场」「四、影响与后续关注点」组织输出。' },
21
+ hotspot: { label: '热点分析', searchArgs: { max_results: 14, intent: 'news', sort: 'newest', since: '14d', depth: 'balanced', verify: 2 }, socialSupplement: true, prompt: '当前模式为「热点分析」:按「一、核心结论与现状」「二、事件脉络」「三、核心争议与各方立场」「四、影响与后续关注点」组织输出。' },
21
22
  verify: { label: '真假核验', searchArgs: { max_results: 12, verify: 5, depth: 'deep', mode: 'deep' }, prompt: '当前模式为「真假核验」:按「一、核验结论(明确给出可信度判断:可信 / 存疑 / 失实 / 证据不足)」「二、关键证据链(优先引用已核验正文)」「三、冲突点与核验边界」组织输出。' },
22
23
  research: { label: '深度研究', searchArgs: { max_results: 16, verify: 5, depth: 'deep', mode: 'deep' }, prompt: '当前模式为「深度研究」:按「一、执行摘要」「二、多维拆解与关键发现」「三、数据与案例支撑」「四、风险、局限与待验证项」组织详尽研究报告。' },
23
24
  compare: { label: '选型对比', searchArgs: { max_results: 14, verify: 3, depth: 'balanced' }, prompt: '当前模式为「选型对比」:按「一、选型结论与推荐」「二、核心维度对比表(Markdown 表格)」「三、各自优缺点与适用人群」「四、替代方案与踩坑提示」组织输出。' },
24
- academic: { label: '学术文献', searchArgs: { max_results: 14, domain: 'academic', depth: 'deep', mode: 'deep', verify: 3 }, prompt: '当前模式为「学术文献」:按「一、核心研究结论与共识」「二、代表性论文与方法拆解」「三、实验证据与关键数据」「四、局限性与延伸方向」组织输出。' },
25
+ academic: { label: '学术文献', searchArgs: { max_results: 14, intent: 'academic', depth: 'deep', mode: 'deep', verify: 3 }, prompt: '当前模式为「学术文献」:按「一、核心研究结论与共识」「二、代表性论文与方法拆解」「三、实验证据与关键数据」「四、局限性与延伸方向」组织输出。' },
25
26
  plugin: { label: '插件评测', searchArgs: { max_results: 14, domain: 'dsh_plugin_search', verify: 3, depth: 'balanced' }, socialSupplement: true, prompt: '当前模式为「插件评测」:按「一、是否值得安装(结论)」「二、核心能力与亮点」「三、社区真实反馈与局限」「四、替代方案与安装配置注意」组织输出。' },
26
27
  local: { label: '本机检索', searchArgs: { max_results: 16 }, prompt: '当前模式为「本机检索」:基于本机文件与代码命中证据回答,标明文件路径、行号与上下文关联,禁止编造未命中的本地文件。' },
27
28
  }
@@ -219,9 +220,9 @@ export async function callArgoSearch(config, env, query, mode, refresh, signal,
219
220
  const primaryTask = runArgoCli(buildSearchCliArgs(query, mode, refresh), { env, timeoutMs, signal })
220
221
  .then(payload => ({ payload, cards: normalizeCandidates(payload) }))
221
222
 
222
- // 热点分析与插件评测并行补充社区/社交域召回,避免单靠网页引擎错过一手讨论
223
+ // 热点分析与插件评测并行补充社区/社交域召回(走 --intent social 驱动真实社交选源)
223
224
  const socialTask = MODE_SPECS[mode]?.socialSupplement
224
- ? runArgoCli(buildSearchCliArgs(query, 'general', refresh, { domain: 'social', max_results: 6, verify: 0 }), { env, timeoutMs: Math.min(timeoutMs, 15000), signal })
225
+ ? runArgoCli(buildSearchCliArgs(query, 'general', refresh, { intent: 'social', max_results: 6, verify: 0 }), { env, timeoutMs: Math.min(timeoutMs, 15000), signal })
225
226
  .then(payload => normalizeCandidates(payload))
226
227
  .catch(() => [])
227
228
  : Promise.resolve([])
@@ -368,10 +369,12 @@ export function extractCitations(text, cards) {
368
369
  export function buildSearchCliArgs(query, mode, refresh = false, overrides = {}) {
369
370
  const spec = MODE_SPECS[mode] || MODE_SPECS.general
370
371
  const merged = { ...spec.searchArgs, ...overrides }
371
- const args = ['search', '--json', '--envelope']
372
+ const args = ['search', '--json']
373
+ if (merged.envelope) args.push('--envelope')
372
374
  if (merged.max_results) args.push('-n', String(merged.max_results))
373
375
  if (merged.depth) args.push('--depth', String(merged.depth))
374
376
  if (merged.mode) args.push('--mode', String(merged.mode))
377
+ if (merged.intent) args.push('--intent', String(merged.intent))
375
378
  if (merged.domain) args.push('--domain', String(merged.domain))
376
379
  if (merged.since) args.push('--since', String(merged.since))
377
380
  if (merged.sort) args.push('--sort', String(merged.sort))
@@ -383,3 +386,60 @@ export function buildSearchCliArgs(query, mode, refresh = false, overrides = {})
383
386
  args.push('--', query)
384
387
  return args
385
388
  }
389
+
390
+ function _safeRealpath(p) {
391
+ const abs = resolve(p)
392
+ try {
393
+ return realpathSync(abs)
394
+ } catch {
395
+ // 文件尚未存在时对其父目录解析符号链接,避免通过目录 symlink 越界
396
+ const parent = dirname(abs)
397
+ if (parent && parent !== abs) {
398
+ try {
399
+ return join(realpathSync(parent), relative(parent, abs))
400
+ } catch { /* ignore */ }
401
+ }
402
+ return abs
403
+ }
404
+ }
405
+
406
+ export function isPathWithinRoot(targetPath, allowedRoot) {
407
+ if (!targetPath || !allowedRoot) return false
408
+ const rootReal = _safeRealpath(allowedRoot)
409
+ const resolvedTarget = isAbsolute(targetPath) ? targetPath : join(rootReal, targetPath)
410
+ const targetReal = _safeRealpath(resolvedTarget)
411
+ const rel = relative(rootReal, targetReal)
412
+ return rel === '' || (!rel.startsWith('..' + sep) && rel !== '..' && !isAbsolute(rel))
413
+ }
414
+
415
+ // 本地代码卡片一跳精读:复用 local-seek 的 --symbol-body / --lines / --outline JSON 输出
416
+ export async function inspectLocalFile(
417
+ env,
418
+ { filePath, allowedRoot = '', symbol = '', lines = '', signal = null, runner = runArgoCli } = {},
419
+ ) {
420
+ const target = String(filePath || '').replace(/^file:\/\//, '').trim()
421
+ if (!target || target.includes('\0')) return { ok: false, error: 'invalid_path' }
422
+ const root = String(allowedRoot || '').trim() || resolveLocalSearchPath({})
423
+ if (!isPathWithinRoot(target, root)) {
424
+ return { ok: false, error: 'path_outside_root' }
425
+ }
426
+ const resolvedTarget = isAbsolute(target) ? resolve(target) : resolve(root, target)
427
+ const cliArgs = ['seek', '--json']
428
+ if (symbol && String(symbol).trim()) {
429
+ cliArgs.push('--symbol-body', String(symbol).trim())
430
+ } else if (lines && String(lines).trim()) {
431
+ cliArgs.push('--lines', String(lines).trim())
432
+ } else {
433
+ cliArgs.push('--outline')
434
+ }
435
+ cliArgs.push('--', resolvedTarget)
436
+ return runner(cliArgs, { env, timeoutMs: 8000, signal })
437
+ }
438
+
439
+ // 工作台一键沉淀研报:通过 stdin JSON 管道直连 `argo note study --from-json`
440
+ export async function saveNoteStudy(env, { payload, title = '', signal = null, runner = runArgoCli } = {}) {
441
+ if (!payload || typeof payload !== 'object') return { ok: false, error: 'missing_payload' }
442
+ const cliArgs = ['note', 'study', '--from-json']
443
+ if (title && String(title).trim()) cliArgs.push('--title', String(title).trim())
444
+ return runner(cliArgs, { env, stdin: payload, timeoutMs: 10000, signal })
445
+ }
@@ -19,11 +19,13 @@ import {
19
19
  buildSystemPrompt,
20
20
  callArgoSearch,
21
21
  extractCitations,
22
+ inspectLocalFile,
22
23
  MODES,
23
24
  MODE_LABELS,
24
25
  resolveLocalSearchPath,
25
26
  runClarifyIfShort,
26
27
  runEvidenceScoring,
28
+ saveNoteStudy,
27
29
  streamLlmAnswer,
28
30
  } from './workbench-search.js'
29
31
  import {
@@ -341,6 +343,45 @@ export function createWorkbenchHandler(ctx, config, getCredentials, options = {}
341
343
  return
342
344
  }
343
345
 
346
+ if (path === '/argo/api/local-inspect' && req.method === 'POST') {
347
+ const body = await readJsonBody(req)
348
+ const filePath = String(body.path || body.filePath || '').trim()
349
+ if (!filePath) { sendJson(res, 400, { error: 'missing_path' }); return }
350
+ try {
351
+ const env = await resolveArgoEnv(config, { credentials: getCredentials?.() })
352
+ const out = await inspectLocalFile(env, {
353
+ filePath,
354
+ allowedRoot: resolveLocalSearchPath(config),
355
+ symbol: body.symbol || '',
356
+ lines: body.lines || '',
357
+ runner: options.runInspectCli || runArgoCli,
358
+ })
359
+ const status = out?.error === 'path_outside_root' ? 403 : (out?.ok === false ? 400 : 200)
360
+ sendJson(res, status, out)
361
+ } catch (err) {
362
+ sendJson(res, 500, { ok: false, error: String(err?.message ?? err) })
363
+ }
364
+ return
365
+ }
366
+
367
+ if (path === '/argo/api/note-study' && req.method === 'POST') {
368
+ const body = await readJsonBody(req)
369
+ const payload = body.payload || (body.results || body.url ? body : null)
370
+ if (!payload) { sendJson(res, 400, { error: 'missing_payload' }); return }
371
+ try {
372
+ const env = await resolveArgoEnv(config, { credentials: getCredentials?.() })
373
+ const out = await saveNoteStudy(env, {
374
+ payload,
375
+ title: body.title || '',
376
+ runner: options.runNoteCli || runArgoCli,
377
+ })
378
+ sendJson(res, 200, { ok: true, ...out })
379
+ } catch (err) {
380
+ sendJson(res, 500, { ok: false, error: String(err?.message ?? err) })
381
+ }
382
+ return
383
+ }
384
+
344
385
  if (path === '/argo/api/health' && req.method === 'GET') {
345
386
  const hasLlm = Boolean(ctx.get?.('llm') && ctx.get?.('agentDefaultModel')?.currentSelection?.()?.model)
346
387
  const hs = loadHotspotStore()
@@ -493,6 +534,8 @@ export function createWorkbenchHandler(ctx, config, getCredentials, options = {}
493
534
  cards,
494
535
  funnel: payload?.funnel || null,
495
536
  engines: [...new Set(cards.map(c => c.source))],
537
+ intentResolution: payload?.intent_resolution || null,
538
+ warnings: Array.isArray(payload?.warnings) ? payload.warnings : [],
496
539
  })
497
540
  if (ac.signal.aborted) return
498
541
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taxueseek/argo-dsh",
3
- "version": "2.17.0",
3
+ "version": "2.18.0",
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",
@@ -5,7 +5,7 @@ import assert from 'node:assert/strict'
5
5
  import { openSync, closeSync, unlinkSync, mkdtempSync, rmSync, existsSync } from 'node:fs'
6
6
  import { tmpdir } from 'node:os'
7
7
  import { join } from 'node:path'
8
- import { acquireStateFileLock, releaseStateFileLock, mutateWatches, WATCH_STORE_FILE } from '../dsh/workbench-io.js'
8
+ import { acquireStateFileLock, releaseStateFileLock, mutateWatches } from '../dsh/workbench-io.js'
9
9
  import { refreshDailyHotspots, createHotspotRefresher } from '../dsh/workbench-suggestions.js'
10
10
  import { evaluateGates } from '../dsh/wide-research.js'
11
11
 
@@ -36,24 +36,22 @@ test('state file lock: mutual exclusion, release and stale takeover', () => {
36
36
  releaseStateFileLock(again)
37
37
  })
38
38
 
39
- test('mutateWatches is single-truth read-modify-write under lock', () => {
40
- // WATCH_STORE_FILE 是模块级常量(~/.config/argo/workbench-watches.json),
41
- // 本测试直接用它并自清理:测的就是真实文件上的合并语义
42
- const added = mutateWatches(list => { list.unshift({ id: 'w_test_a', query: 'a' }); return list })
39
+ test('mutateWatches is single-truth read-modify-write under lock', withTempStateDir(async (dir) => {
40
+ const file = join(dir, 'config', 'workbench-watches.json')
41
+ const added = mutateWatches(list => { list.unshift({ id: 'w_test_a', query: 'a' }); return list }, file)
43
42
  assert.ok(Array.isArray(added), 'mutate returns list when lock acquired')
44
- const after = mutateWatches(list => { list.unshift({ id: 'w_test_b', query: 'b' }); return list })
43
+ const after = mutateWatches(list => { list.unshift({ id: 'w_test_b', query: 'b' }); return list }, file)
45
44
  assert.ok(after.some(w => w.id === 'w_test_a'), 'second mutate preserves first-host change (no overwrite)')
46
45
  assert.ok(after.some(w => w.id === 'w_test_b'), 'second mutate applies its own change')
47
46
  // 锁被占时返回 null(忙语义)
48
- const lock = acquireStateFileLock(`${WATCH_STORE_FILE}.lock`)
47
+ const lock = acquireStateFileLock(`${file}.lock`)
48
+ assert.ok(lock)
49
49
  try {
50
- assert.equal(mutateWatches(list => list), null, 'mutateWatches yields null while lock held')
50
+ assert.equal(mutateWatches(list => list, file), null, 'mutateWatches yields null while lock held')
51
51
  } finally {
52
52
  releaseStateFileLock(lock)
53
53
  }
54
- // 清理测试数据
55
- mutateWatches(list => list.filter(w => w.id !== 'w_test_a' && w.id !== 'w_test_b'))
56
- })
54
+ }))
57
55
 
58
56
  test('refreshDailyHotspots reports skipped=lock_busy instead of fake success', withTempStateDir(async (dir) => {
59
57
  // 先让另一「宿主」持锁