argo-search 2.11.2 → 2.12.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.
- package/README.en.md +25 -21
- package/README.es.md +24 -20
- package/README.ja.md +25 -21
- package/README.ko.md +24 -20
- package/README.md +30 -22
- package/SKILL.md +6 -6
- package/backends/domain_profiles.json +12 -0
- package/backends/engine_registry.yaml +26 -1
- package/backends/quota_profiles.json +20 -0
- package/bin/argo +7 -0
- package/config.yaml +18 -3
- package/docs/ENGINE_CATALOG.md +8 -6
- package/docs/MCP_SETUP.md +16 -4
- package/docs/RELEASE_NOTES_v2.11.2.md +116 -0
- package/docs/RELEASE_NOTES_v2.12.0.md +65 -0
- package/docs/engines/pixiv.md +27 -0
- package/engines/specs/pixiv.yaml +52 -0
- package/engines/specs/tracemoe.yaml +33 -0
- package/package.json +3 -2
- package/packages/dsh-plugin/README.md +20 -11
- package/packages/dsh-plugin/dsh/client.js +3 -3
- package/packages/dsh-plugin/dsh/index.js +22 -176
- package/packages/dsh-plugin/dsh/runner.js +12 -2
- package/packages/dsh-plugin/dsh/specs.js +133 -0
- package/packages/dsh-plugin/package.json +10 -2
- package/packages/dsh-plugin/test/client.test.js +4 -4
- package/packages/dsh-plugin/test/diagnostics.test.js +1 -1
- package/packages/dsh-plugin/test/index.test.js +28 -2
- package/scripts/adaptive.py +101 -27
- package/scripts/build_route_labels.py +122 -169
- package/scripts/caliber_dedupe.py +4 -4
- package/scripts/caliber_isolation.py +17 -17
- package/scripts/concept_lookup.py +14 -1
- package/scripts/config.py +21 -3
- package/scripts/engine_admission.py +35 -17
- package/scripts/engine_dispatch.py +16 -16
- package/scripts/engine_env.py +4 -0
- package/scripts/engine_families.py +6 -4
- package/scripts/engines.py +5 -0
- package/scripts/engines_base.py +1 -1
- package/scripts/engines_builders_data.py +10 -10
- package/scripts/engines_builders_pixiv.py +633 -0
- package/scripts/engines_builders_reverse_image.py +175 -0
- package/scripts/env_store.py +216 -0
- package/scripts/extend_route_labels_by_capability.py +4 -4
- package/scripts/extend_route_labels_full_coverage.py +329 -0
- package/scripts/fetch_v3.py +74 -5
- package/scripts/job.py +31 -6
- package/scripts/local_image.py +22 -8
- package/scripts/mcp_compact.py +9 -1
- package/scripts/mcp_launch.sh +1 -1
- package/scripts/mcp_setup.py +85 -1
- package/scripts/mcp_transport.py +1 -1
- package/scripts/plan.py +2 -2
- package/scripts/pre-commit +4 -1
- package/scripts/query_signals.py +35 -20
- package/scripts/quota.py +9 -4
- package/scripts/recovery.py +38 -13
- package/scripts/redskill/redskill_engine.py +33 -10
- package/scripts/route.py +2 -2
- package/scripts/route_accuracy_eval.py +2 -2
- package/scripts/route_combo.py +22 -3
- package/scripts/route_domains.py +182 -50
- package/scripts/search.py +0 -2
- package/scripts/search_entry.py +38 -42
- package/scripts/search_output.py +3 -0
- package/scripts/search_pipeline.py +3 -8
- package/scripts/search_rank.py +22 -7
- package/scripts/serp_guard.py +7 -16
- package/scripts/settings_page.py +486 -0
- package/scripts/straggler_policy.py +8 -4
- package/scripts/tfidf_router.py +82 -24
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Argo v2.12.0 发布说明
|
|
2
|
+
|
|
3
|
+
**版本**:2.12.0
|
|
4
|
+
**定位**:统一设置中心首发(issue #44 兑现);社区贡献 pixiv 正向搜图合入,内置 trace.moe 场景识别(源 286→288);fetch 对微信公众号文章不再零处理;调度与路由算法内部优化。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 这次更新有什么(通俗版)
|
|
9
|
+
|
|
10
|
+
### 1. 统一设置中心:一个入口配好所有客户端(issue #44,感谢 @zooyoo 提议)
|
|
11
|
+
|
|
12
|
+
**以前不行**:DSH 插件有设置面板,其他客户端(Cursor / Claude Code / Codex 等 MCP 场景)只能手工编辑 env 文件,同一把 key 在各客户端之间来回填。
|
|
13
|
+
|
|
14
|
+
**现在能行**:
|
|
15
|
+
|
|
16
|
+
- `argo settings`——生成并打开本地设置页:密钥状态(只露尾 4 位)、各客户端接入片段、常用开关现值;
|
|
17
|
+
- `argo settings --edit`——编辑表单页:页面内改值、导出变更 JSON,`argo settings apply` 写回;
|
|
18
|
+
- `argo settings set/unset/list`——命令行直改:值走 stdin 读入,不进 argv 与 shell history,明文不落任何输出;写回 `~/.config/argo/env` 后全客户端热读取,无需重启;
|
|
19
|
+
- `argo ui` 是同义别名;Agent 对话里说「argo 设置」也能唤起同一套入口。
|
|
20
|
+
|
|
21
|
+
**实现取舍**:没有做成常驻 Web 服务(当初讨论的方向),而是零服务——不开端口、没有鉴权凭证生命周期要管理、页面是单文件零依赖 HTML,改动统一走同一条写回通道(env_store:行级补丁保留注释、原子写 + 0600 + 单份 .bak)。写回面越小越安全。引擎开关的写回暂不做:`config.yaml` 处于派生链上游,直接改它要连动再生成派生件,收益低风险高,等真实需求再评估。
|
|
22
|
+
|
|
23
|
+
### 2. pixiv 正向关键词搜图(社区 PR#45,感谢 @OMSociety)
|
|
24
|
+
|
|
25
|
+
**以前不行**:`image_search` 域以开放图库为主,按角色名、作品名找插画与同人图没有合适源。
|
|
26
|
+
|
|
27
|
+
**现在能行**:单引擎双通道——未配凭据走匿名 Web Ajax(免登录);配置 `ARGO_PIXIV_REFRESH_TOKEN` 后走 App API,认证失败直接报错不静默回退。结果标 `channel`(web/app)让下游知道实际通路;默认只交付全年龄结果(`ARGO_PIXIV_ALLOW_R18=true` 放行);支持搜索目标档、日期区间、过滤 AI 作品与排序;图片直链保持原图宽高比(i.pximg.net 下载需带 Referer,spec 注释已写明)。`explicit_only` 不进自动路由。
|
|
28
|
+
|
|
29
|
+
### 3. trace.moe 动画场景识别(内置)
|
|
30
|
+
|
|
31
|
+
输入形态特殊:query 必须是**公网可访问的图片 URL**。返回图中场景所属动画作品、集数与时间点(AniList ID)与相似度;url 槽填 AniList 作品页作为下一步查证入口,不假称图源页。免 key(免费档 100 次/小时,按出口 IP 限频),`ARGO_TRACEMOE_PROXY` 可覆盖出口代理——共享机场节点的出口常被别的客户端打到 429,该 API 直连可达,默认直连。本地图片在入口返回可读错误。`explicit_only`。
|
|
32
|
+
|
|
33
|
+
### 4. fetch 对微信公众号文章不再零处理
|
|
34
|
+
|
|
35
|
+
**以前不行**:`argo fetch` 抓 mp.weixin.qq.com 文章时按普通页面处理,直接被反爬挑战页挡死,返回壳页或失败。
|
|
36
|
+
|
|
37
|
+
**现在能行**:fetch 对公众号文章走前置分流(判定按 host+path 精确匹配,r.jina.ai 代理 URL 与 query 夹带微信链接的页面不会被误分流)。
|
|
38
|
+
|
|
39
|
+
### 5. 调度与路由算法内部优化
|
|
40
|
+
|
|
41
|
+
对冲宽限窗、尾宽分层、查询信号与 TF-IDF 路由、场景桶收缩等内部算法更新(含引擎准入原子性放宽)。本版 52 项相关单元测试全绿;这些属先验设计改进,尚无线上 A/B 数据,行为异常时可按 `references/usage.md` 行为调参表的既有开关回退对照。
|
|
42
|
+
|
|
43
|
+
### 6. 插件与文档收口
|
|
44
|
+
|
|
45
|
+
- DSH 插件 specs 与入口解耦(fast-adapt 审计 100/100);
|
|
46
|
+
- 版本真源收敛到 package.json / SKILL.md,DSH 插件主包(`mcp-argo`,仅 MCP 工具面)与子包(`@taxueseek/argo-dsh`,含设置页与原生工具)的装法说明修正(#43 后续);
|
|
47
|
+
- env_store 修正:末行无换行时追加新键不再粘连、`.bak` 备份改 0600 权限。
|
|
48
|
+
|
|
49
|
+
## 验证
|
|
50
|
+
|
|
51
|
+
- 本机全量 pytest 通过(Python 3.14,含新增 pixiv 26 例、tracemoe 6 例);
|
|
52
|
+
- pixiv 匿名 Web 与 OAuth App 两通道实机搜索通过,返回图片带 Referer 可正常下载;tracemoe 实机识别返回作品/集数/时间点;
|
|
53
|
+
- CI gates / unit 四分片 / smoke 全绿(PR#45 附带分片数据)。
|
|
54
|
+
|
|
55
|
+
## 兼容性
|
|
56
|
+
|
|
57
|
+
- 源 286→288(pixiv、tracemoe),均 `explicit_only`,不改变自动路由候选池;
|
|
58
|
+
- 新增可选凭据:`ARGO_PIXIV_REFRESH_TOKEN`(pixiv App 通道;不配走匿名 Web,无需注册);
|
|
59
|
+
- 新增可选开关:`ARGO_PIXIV_ALLOW_R18`、`ARGO_TRACEMOE_PROXY`(见 `references/usage.md` 行为调参表);
|
|
60
|
+
- 零新增 Python 依赖;curl_cffi 仍为可选依赖(tracemoe/SauceNAO 共用)。
|
|
61
|
+
|
|
62
|
+
## 署名
|
|
63
|
+
|
|
64
|
+
- **@zooyoo**:统一设置中心的需求与形态建议(issue #44);
|
|
65
|
+
- **@OMSociety**:pixiv 引擎全量实现与 26 例测试(PR#45),各 commit 保留原作者署名。
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 引擎:`pixiv`
|
|
2
|
+
|
|
3
|
+
- 准入时间: 2026-11-08T07:54:19+08:00
|
|
4
|
+
- 状态: admitted
|
|
5
|
+
- cost_tier: free
|
|
6
|
+
- type: pixiv
|
|
7
|
+
- quality_score: 1.0
|
|
8
|
+
- avg_latency_ms: 935.8
|
|
9
|
+
- blocked: False
|
|
10
|
+
|
|
11
|
+
## 环境变量
|
|
12
|
+
|
|
13
|
+
| 变量 | 必填 |
|
|
14
|
+
|------|------|
|
|
15
|
+
| (无) | 否 |
|
|
16
|
+
|
|
17
|
+
## 最近验证
|
|
18
|
+
|
|
19
|
+
- health: pass · latency=1357.7ms · count=10
|
|
20
|
+
- quality: pass · score=1.0 · empty_rate=0.0
|
|
21
|
+
|
|
22
|
+
## 调用
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
python3 scripts/search.py "查询词" --engine pixiv
|
|
26
|
+
python3 scripts/engine_validate.py --engine pixiv --stage health
|
|
27
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Pixiv 公开作品检索:关键词搜索与画师作品列表,匿名 Web / OAuth App API 双通道
|
|
2
|
+
#
|
|
3
|
+
# 未配置 refresh token 时走匿名 Web Ajax;配置后只走 App API,不合并或回退。
|
|
4
|
+
# 结果 channel 标出实际取数通道(web/app),排查时用于区分内容范围差异。
|
|
5
|
+
# Web/App 均无公开稳定性承诺,Pixiv 随时可能调整接口行为。
|
|
6
|
+
#
|
|
7
|
+
# 画师作品查询:query 写 user:<画师 id>、https://www.pixiv.net/users/<id>、
|
|
8
|
+
# 五到九位纯数字,或 画师:<画师名>(经 App 用户搜索取最匹配的一位)。
|
|
9
|
+
# 画师查询后接空格分隔的标签,用于在该画师作品里收窄,如 画师:ke-ta フランドール。
|
|
10
|
+
# 画师作品列表只有 App 接口能给出可用的图片直链,匿名通道返回明确提示。
|
|
11
|
+
#
|
|
12
|
+
# 标签匹配口径:search_target 取 partial_match_for_tags(默认,Web 用 s_mode=s_tag)、
|
|
13
|
+
# exact_match_for_tags(Web 用 s_mode=s_tag_full)、title_and_caption(Web 用 s_mode=s_tc);
|
|
14
|
+
# 调用方也可在单次请求里覆盖。标签串按空格分隔多个标签,日文名与中文本地化标签都能命中。
|
|
15
|
+
#
|
|
16
|
+
# 可选环境变量:
|
|
17
|
+
# ARGO_PIXIV_REFRESH_TOKEN Pixiv OAuth refresh token(只读,勿写入仓库)
|
|
18
|
+
# ARGO_PIXIV_ALLOW_R18 true 时允许 App R-18 结果与下游预览;默认过滤
|
|
19
|
+
#
|
|
20
|
+
# 防盗链说明:i.pximg.net 的图片直链需要 Referer: https://www.pixiv.net/ 才能下载,
|
|
21
|
+
# 插件层的图片下载链路已自动补全该头部,CLI 或其他直接访问场景需手动加 Referer。
|
|
22
|
+
#
|
|
23
|
+
# 图片直链:App 通道对每条结果并发补一次作品详情,image_url 取原图(meta_single_page
|
|
24
|
+
# 或多页作品的第一张),原图宽高比与预览一致;详情失败或取不到时保持 large 档。
|
|
25
|
+
# 此时 image_url_preview 保留 large 直链,供下游在体积超限时回退。
|
|
26
|
+
#
|
|
27
|
+
# App 支持 partial_match_for_tags / exact_match_for_tags / title_and_caption、
|
|
28
|
+
# start_date / end_date(YYYY-MM-DD)、search_ai_type=0/1 与 popular_desc。
|
|
29
|
+
# 验证:
|
|
30
|
+
# python3 scripts/engine_validate.py --engine pixiv --stage all --admit --write-doc
|
|
31
|
+
|
|
32
|
+
engine_id: pixiv
|
|
33
|
+
type: pixiv
|
|
34
|
+
enabled: true
|
|
35
|
+
explicit_only: true
|
|
36
|
+
cost_tier: free
|
|
37
|
+
family: misc_vertical
|
|
38
|
+
priority: 34
|
|
39
|
+
timeout: 20
|
|
40
|
+
order: date
|
|
41
|
+
canary_query: "初音ミク"
|
|
42
|
+
label: Pixiv 公开作品
|
|
43
|
+
desc: "Pixiv 作品检索:关键词搜图或按画师(user:<id>、画师主页链接、画师:<名>)列作品;结果标通道,默认过滤 R-18"
|
|
44
|
+
coverage: [image, media, web]
|
|
45
|
+
recommended: false
|
|
46
|
+
latency_ms: 2500
|
|
47
|
+
|
|
48
|
+
image_license: "版权所有(Pixiv 作品,作者保留权利)"
|
|
49
|
+
|
|
50
|
+
quality_queries:
|
|
51
|
+
- query: "初音ミク"
|
|
52
|
+
- query: "hatsune miku"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# trace.moe · 动画场景识别
|
|
2
|
+
#
|
|
3
|
+
# 输入形态特殊:query 必须是**公网可访问的图片 URL**,不是关键词。上游返回图中
|
|
4
|
+
# 场景所属动画作品、集数与时间点(AniList ID + filename + episode + at),并给出
|
|
5
|
+
# similarity(0-1)。
|
|
6
|
+
#
|
|
7
|
+
# 免 key,但按出口 IP 限频:免费档 100 次/小时(quota 字段可见)。实测共享机场
|
|
8
|
+
# 节点出口常被别的客户端打到 429,而该 API 直连可达——故 config.yaml 的
|
|
9
|
+
# network.proxy.rules 给 api.trace.moe 配了 ${ARGO_TRACEMOE_PROXY}(未设置即直连)。
|
|
10
|
+
#
|
|
11
|
+
# 结果形态:上游只给作品名/文件名/集数/时间点,不给「这张图出自哪一页」。url 槽
|
|
12
|
+
# 填 AniList 作品页(下一步去哪儿查证的入口),不是宣称图源就是那一页。
|
|
13
|
+
#
|
|
14
|
+
# 路由形态:explicit_only —— 理由同 saucenao,只经显式调用。
|
|
15
|
+
#
|
|
16
|
+
# 验证:
|
|
17
|
+
# python3 scripts/engine_validate.py --engine tracemoe --stage all --admit --write-doc
|
|
18
|
+
|
|
19
|
+
engine_id: tracemoe
|
|
20
|
+
type: tracemoe
|
|
21
|
+
enabled: true
|
|
22
|
+
explicit_only: true
|
|
23
|
+
cost_tier: free
|
|
24
|
+
timeout: 20
|
|
25
|
+
min_similarity: 0.7
|
|
26
|
+
canary_query: "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
|
|
27
|
+
label: trace.moe 场景识别
|
|
28
|
+
family: misc_vertical
|
|
29
|
+
priority: 38
|
|
30
|
+
|
|
31
|
+
coverage: [image, reverse_image]
|
|
32
|
+
|
|
33
|
+
desc: trace.moe 动画场景识别(query 为图片 URL,免 key,给作品名+集数+时间点,按出口 IP 限频)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "argo-search",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Argo 阿尔戈 — 统一搜索与证据核验。推荐 npx -y argo-search(npm 发布版)或 install.sh 安装。多语言路由、
|
|
3
|
+
"version": "2.12.0",
|
|
4
|
+
"description": "Argo 阿尔戈 — 统一搜索与证据核验。推荐 npx -y argo-search(npm 发布版)或 install.sh 安装。多语言路由、288 个源(242 个免密钥开箱可用)、影视/体育/金融等垂直源、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.12.0.md",
|
|
58
59
|
"docs/RELEASE_NOTES_v2.11.2.md",
|
|
59
60
|
"docs/RELEASE_NOTES_v2.10.0.md",
|
|
60
61
|
"docs/RELEASE_NOTES_v2.9.9.md",
|
|
@@ -4,28 +4,35 @@ DeepSeek Harness 插件:一行同时挂上 [Argo](https://github.com/taxueseek
|
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
7
|
+
版本号以仓库根 `package.json` 的 `version` 为准(与 `argo --version`、npm 上的 `argo-search` 同步),本文不复制版本号。
|
|
8
|
+
|
|
7
9
|
```bash
|
|
8
|
-
dsh plugin --profile web add @taxueseek/argo-dsh
|
|
10
|
+
dsh plugin --profile web add @taxueseek/argo-dsh # npm 发布版
|
|
9
11
|
dsh plugin --profile web add "github:taxueseek/argo#main&path:packages/dsh-plugin" # GitHub main
|
|
10
12
|
```
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
`@taxueseek/argo-dsh` 是 DSH 插件包,`argo-search` 是 CLI 包,两者不能互换。重启 `dsh web` 后生效。
|
|
13
15
|
|
|
14
|
-
### 本地开发:改完源码必须同步进 profile
|
|
16
|
+
### 本地开发:改完源码必须同步进 profile(改动收尾固定步骤)
|
|
15
17
|
|
|
16
18
|
profile 里的依赖是 `file:` / `github:`,pnpm 安装时**复制**进
|
|
17
19
|
`node_modules/@taxueseek/argo-dsh`,不是软链。只改本仓源码、不跑同步,
|
|
18
20
|
DSH 设置页读到的仍是旧 bundle(2026-10-22 实测:缓存开关与付费额度已改,
|
|
19
|
-
|
|
21
|
+
面板仍显示旧版;2026-11-08 复核:web 与 desktop 两个 profile 均已漂移)。
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
|
-
packages/dsh-plugin/scripts/sync-local.sh --check # 比对源码与已安装 bundle
|
|
23
|
-
packages/dsh-plugin/scripts/sync-local.sh # 同步 web/desktop
|
|
24
|
-
packages/dsh-plugin/scripts/sync-local.sh --restart # 同步并重启 dsh web
|
|
24
|
+
packages/dsh-plugin/scripts/sync-local.sh --check # 1. 比对源码与已安装 bundle,有漂移退出 1
|
|
25
|
+
packages/dsh-plugin/scripts/sync-local.sh # 2. 同步 web/desktop
|
|
26
|
+
packages/dsh-plugin/scripts/sync-local.sh --restart # 3. 同步并重启 dsh web
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
**改完源码或文档后,必须跑到 `sync-local.sh --check` 输出 `[ok]` 才算交付完成**;不适用 `--check` 的场景(例如只改仓库内文档、不影响已安装 bundle)要在交付说明里写明跳过理由。同步会先备份到 `~/.dsh/backups/argo-dsh-sync-<时间>-<profile>`;浏览器如仍显示旧面板,做一次硬刷新(Cmd+Shift+R)。
|
|
30
|
+
|
|
31
|
+
### 当前启用状态(web profile)
|
|
32
|
+
|
|
33
|
+
`wide_research` 编排、原生 `argo_search` / `argo_fetch` 与 `web` 服务行的 `searchProvider: argo` 已在用户层 `~/.dsh/profiles/web/cordis.patch.yml` 默认启用,无需取消任何注释即可使用。profile patch 里 `mcp-argo` 段注释掉的「按需开启」只针对 MCP 完整工具面,不代表整个插件未启用。
|
|
34
|
+
|
|
35
|
+
该 patch 的 `fetchProviderEnabled: false` 是主动关闭 fetch seam,因此 `web` 服务行不 pin `fetchProvider`;若改为启用 fetch seam,必须按本文「web seam 的 pin 必读」一节在 `web` 服务行加 `fetchProvider: argo`,否则多个可用 provider 会触发 `WEB_PROVIDER_AMBIGUOUS`。
|
|
29
36
|
|
|
30
37
|
本 bundle 提供 **三形态接入**——同一套 argo 检索能力(同引擎、同压缩、同守卫),三种调用通道互为冗余,按宿主能力自动降级:
|
|
31
38
|
|
|
@@ -89,7 +96,7 @@ argo 的 `deepseek_search` 引擎(官方 `api.deepseek.com/v1/tools/search`,
|
|
|
89
96
|
- 安全:插件不读 key 文件、不落盘、不打日志;key 值只经内存进入 argo 子进程 env,任何输出与错误信息都不含它
|
|
90
97
|
- 旧宿主无 credentials 服务时静默跳过:argo 侧该引擎按缺 key 停用,其余 265 个源不受影响
|
|
91
98
|
- `keyRefs: []` 可整体关闭转发;后续要转发别的宿主凭证(如 `ARGO_EXA_API_KEY`),把引用名加进数组即可,entry 必须是 POSIX 标识符(apply 期 loud fail)
|
|
92
|
-
- `argoEnv`(设置页「引擎」分区写入):argo 行为开关,一行一个 `KEY=VALUE`,名字限 curated 白名单(
|
|
99
|
+
- `argoEnv`(设置页「引擎」分区写入):argo 行为开关,一行一个 `KEY=VALUE`,名字限 curated 白名单(specs.js 的 `ARGO_ENV_SPECS`,35 个;白名单外 apply 期 loud fail,防拼错静默失效);授权位与路径 / 状态类变量刻意不收。与 `keyRefs` 的分工:`keyRefs` 管密钥(凭证库),`argoEnv` 管行为开关(插件配置),两者都不落明文
|
|
93
100
|
|
|
94
101
|
## 依赖
|
|
95
102
|
|
|
@@ -100,9 +107,11 @@ argo 的 `deepseek_search` 引擎(官方 `api.deepseek.com/v1/tools/search`,
|
|
|
100
107
|
|
|
101
108
|
## Compatibility(DSH Harness 版本对照)
|
|
102
109
|
|
|
110
|
+
本机 `dsh --version` 与插件 `package.json` 的 `dsh.compatibility` 是版本真源;下表只保留历史验证记录,不声明「当前」版本。
|
|
111
|
+
|
|
103
112
|
| argo-dsh | DSH Harness | 说明 |
|
|
104
113
|
|----------|-------------|------|
|
|
105
|
-
| 2.
|
|
114
|
+
| 2.11.2(本机已装) | 0.2.2-rc.1(本机运行中) | `package.json` 的 compatibility 已含该版本;`wide_research` 与原生工具走既有工具面,插件侧无需改动 |
|
|
106
115
|
| 2.9.9(上一版,兼容) | 0.2.1-rc.2(当前,运行中) | 自带设置页(接入 / 工具 / API 密钥 / 研究 / 高级)新增路由观测卡片(getRouteHealth 只读本机 usage_log / route.jsonl 汇总最近路由决策,无日志不假装有数据)与工具推荐组合(按场景一键套用工具勾选,中英双语);双栈入口 `startActivation({provider, label, request, signal, delivery})`;rc.2 移除 `toolFilter` 启动期字段后由插件内 tool guard 阻止 worker 嵌套调用 `wide_research`;`wide_research` 端到端实测通过(planner → 2 worker → synthesis,passed=true / 14 sources) |
|
|
107
116
|
| 2.9.7(上一版,兼容) | 0.2.1-alpha.1(实测,兼容) | 旧宿主走 `start(provider, request)` 分支,`toolFilter` 启动期字段仍认;该分支由插件单测覆盖,未在 alpha.x 上重跑端到端 |
|
|
108
117
|
| 2.9.2 | 0.2.1-alpha.1(实测) | 上一轮适配验证基线;rc.2 的新入口与 tool guard 自 2.9.4 起进入 |
|
|
@@ -344,7 +344,7 @@ window.__ModuleLoader__.load({
|
|
|
344
344
|
{ id: 'zhihu', nameZh: '知乎 Zhihu', nameEn: 'Zhihu', roleZh: '中文专业问答舆情', roleEn: 'Professional Q&A / Social', ref: 'ZHIHU_ACCESS_SECRET', keyless: true },
|
|
345
345
|
];
|
|
346
346
|
|
|
347
|
-
// argo 引擎开关(argoEnv 的 KEY=VALUE 行)。与
|
|
347
|
+
// argo 引擎开关(argoEnv 的 KEY=VALUE 行)。与 specs.js 的 ARGO_ENV_SPECS
|
|
348
348
|
// 同一份名单,由 test/client.test.js 的漂移门禁核对;kind 决定控件:
|
|
349
349
|
// bool=开关、num=数字、str=文本、list=名单。def 仅作「未配置时显示什么」,
|
|
350
350
|
// 缺省即不写该行。开关文案写正向行为或明确的关闭动作,不再用 invert 反转
|
|
@@ -1318,7 +1318,7 @@ window.__ModuleLoader__.load({
|
|
|
1318
1318
|
//
|
|
1319
1319
|
// 历史 bug(2026-10-21 定位):`paid` 一度不在这个清单里,于是
|
|
1320
1320
|
// ARGO_PAID_SEARCH 与 ARGO_BUDGET_DEEPSEEK_SEARCH 两条开关在
|
|
1321
|
-
//
|
|
1321
|
+
// specs.js 白名单、client.js ENGINE_TOGGLES、双语文案三处都齐全,
|
|
1322
1322
|
// 却在面板上完全不显示——用户配好了预算却找不到入口,还以为是插件
|
|
1323
1323
|
// 没装。漂移门禁只核对「两边名单同集合、字段一致」,核对不到「这个
|
|
1324
1324
|
// 分组到底渲不渲染」;已由 test/client.test.js 的「engines tab renders
|
|
@@ -1588,7 +1588,7 @@ window.__ModuleLoader__.load({
|
|
|
1588
1588
|
exports.inject = inject;
|
|
1589
1589
|
exports.ArgoPanel = ArgoPanel;
|
|
1590
1590
|
// 静态数据导出供漂移门禁核对:TOOLS 必须与 native-tools.mjs(mcp_tools.py
|
|
1591
|
-
// 生成产物)同名同集合,ENGINE_TOGGLES 必须与
|
|
1591
|
+
// 生成产物)同名同集合,ENGINE_TOGGLES 必须与 specs.js 的 ARGO_ENV_SPECS
|
|
1592
1592
|
// 同名同集合——两边任何一边增删而另一边没跟上,测试即红。
|
|
1593
1593
|
exports.TOOLS = TOOLS;
|
|
1594
1594
|
exports.TOOL_GROUPS = TOOL_GROUPS;
|
|
@@ -22,6 +22,18 @@ import { createRequire } from 'node:module'
|
|
|
22
22
|
import { dirname, join } from 'node:path'
|
|
23
23
|
import { fileURLToPath } from 'node:url'
|
|
24
24
|
import { NATIVE_TOOLS as NATIVE_TOOL_SPECS } from './native-tools.mjs'
|
|
25
|
+
import {
|
|
26
|
+
DEFAULT_CHILD_TOOLS,
|
|
27
|
+
buildChildToolFilters,
|
|
28
|
+
ARGO_ENV_SPECS,
|
|
29
|
+
ARGO_ENV_NAMES,
|
|
30
|
+
parseArgoEnvLine,
|
|
31
|
+
resolveArgoEnv,
|
|
32
|
+
setHostCredentials,
|
|
33
|
+
setActiveConfig,
|
|
34
|
+
CREDENTIAL_REF_PATTERN,
|
|
35
|
+
asStringArray,
|
|
36
|
+
} from './specs.js'
|
|
25
37
|
|
|
26
38
|
const require = createRequire(import.meta.url)
|
|
27
39
|
|
|
@@ -29,41 +41,19 @@ import {
|
|
|
29
41
|
DEFAULTS,
|
|
30
42
|
PLUGIN_VERSION as RUNNER_PLUGIN_VERSION,
|
|
31
43
|
setEnvResolver,
|
|
32
|
-
|
|
33
|
-
resolveNativeSpawn,
|
|
44
|
+
resetEnvResolver,
|
|
34
45
|
makeNativeTool,
|
|
35
|
-
nativeViaMcpPool,
|
|
36
|
-
runNativeCall,
|
|
37
46
|
disposeSharedMcp,
|
|
38
|
-
searchViaArgoMCP,
|
|
39
47
|
fetchViaArgo,
|
|
40
48
|
mapArgoToWebResult,
|
|
41
|
-
mapArgoToWebFetch,
|
|
42
49
|
classifyFetchError,
|
|
43
|
-
argoAborted,
|
|
44
|
-
argoToolError,
|
|
45
50
|
} from './runner.js'
|
|
46
51
|
|
|
47
52
|
import {
|
|
48
|
-
normalizeTracks,
|
|
49
|
-
stageTracks,
|
|
50
|
-
evaluateGates,
|
|
51
|
-
normalizeSource,
|
|
52
|
-
normalizeSourceUrl,
|
|
53
|
-
buildLocalSources,
|
|
54
|
-
parseJsonArray,
|
|
55
|
-
parseJsonObject,
|
|
56
|
-
extractValues,
|
|
57
|
-
persistReport,
|
|
58
|
-
startStructured,
|
|
59
|
-
providerSupportsStructured,
|
|
60
|
-
recomputeViaArgoMCP,
|
|
61
53
|
createWideResearchTool,
|
|
62
54
|
} from './wide-research.js'
|
|
63
55
|
|
|
64
56
|
import {
|
|
65
|
-
getMcpPoolStats,
|
|
66
|
-
resetMcpPool,
|
|
67
57
|
getRouteHealth,
|
|
68
58
|
} from './diagnostics.js'
|
|
69
59
|
|
|
@@ -92,106 +82,11 @@ function resolvePluginVersion() {
|
|
|
92
82
|
return RUNNER_PLUGIN_VERSION || '0.0.0-unknown'
|
|
93
83
|
}
|
|
94
84
|
|
|
95
|
-
|
|
85
|
+
const PLUGIN_VERSION = resolvePluginVersion()
|
|
96
86
|
|
|
97
87
|
export const name = 'wide-research'
|
|
98
88
|
export const inject = ['tools', 'subagents', 'systemPrompt', 'web']
|
|
99
89
|
|
|
100
|
-
const MCP_CHILD_TOOLS = Object.keys(NATIVE_TOOL_SPECS).map(name => `mcp__argo__${name}`)
|
|
101
|
-
const DEFAULT_CHILD_TOOLS = Object.freeze([
|
|
102
|
-
...MCP_CHILD_TOOLS,
|
|
103
|
-
'argo_search',
|
|
104
|
-
'argo_fetch',
|
|
105
|
-
'web_search',
|
|
106
|
-
'web_fetch',
|
|
107
|
-
])
|
|
108
|
-
|
|
109
|
-
export function buildChildToolFilters(config, toolName) {
|
|
110
|
-
const base = Array.isArray(config?.childToolAllow) ? config.childToolAllow : DEFAULT_CHILD_TOOLS
|
|
111
|
-
const blocked = new Set([toolName, 'mcp__argo__argo_research'])
|
|
112
|
-
const deny = [...new Set([toolName, ...asStringArray(config?.childToolDeny, 100)])]
|
|
113
|
-
const denySet = new Set(deny)
|
|
114
|
-
const allow = [...new Set(asStringArray(base, 100).filter(tool => !blocked.has(tool) && !denySet.has(tool)))]
|
|
115
|
-
return { allow, deny }
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* 面板可露出的 argo 环境变量开关(curated 白名单)。
|
|
120
|
-
*
|
|
121
|
-
* 选录标准:日常会开合的行为开关,语义单一、默认值在 argo 侧稳定;授权位
|
|
122
|
-
* (ARGO_ALLOW_RECOMPUTE / ARGO_ALLOW_PRIVATE_URLS,argo 要求 expand=False
|
|
123
|
-
* + strict=True)与路径/状态类内部变量(ARGO_STATE_DIR / ARGO_HOME /
|
|
124
|
-
* ARGO_DAEMON 等)刻意不收——前者不该一键放行,后者改了会动摇凭证 seam 的
|
|
125
|
-
* 解析前提。每个名字都在 argo 仓 scripts/ 有读取点,由
|
|
126
|
-
* tests/test_dsh_plugin_env_gate.py 对拍,防白名单漂移成 Fiction。
|
|
127
|
-
*
|
|
128
|
-
* kind:bool=开关(值 0/1)、num=数字,str=字符串,list=名单(逗号或路径分隔符分隔,照 argo 原语义)。
|
|
129
|
-
* def=argo 侧默认值(仅面板展示用,缺省即不写该行、由 argo 自己决定)。
|
|
130
|
-
*
|
|
131
|
-
* 开关文案一律写「正向行为」或「明确的关闭动作」,**不要再用 invert 反转**:
|
|
132
|
-
* 历史 bug(2026-10-22)——`关闭搜索结果缓存` 配 invert 后,未配置时面板显示
|
|
133
|
-
* 为「开」,点一下反而把 ARGO_NO_CACHE 写成 0,缓存始终没关掉。
|
|
134
|
-
*/
|
|
135
|
-
export const ARGO_ENV_SPECS = Object.freeze([
|
|
136
|
-
{ name: 'ARGO_NO_CACHE', kind: 'bool', group: 'cache', def: false, zh: '测试模式(关闭结果缓存)', en: 'Test mode (disable result cache)', hintZh: '日常保持关闭:结果缓存 1 小时。改进 Skill/插件、需要看实时结果时再打开', hintEn: 'Off by default: results are cached for 1h. Enable only when developing the skill/plugin' },
|
|
137
|
-
{ name: 'ARGO_TFIDF_RERANK', kind: 'bool', group: 'cache', def: true, zh: 'TF-IDF 重排', en: 'TF-IDF rerank', hintZh: '多引擎结果融合前的相关性重排,默认开', hintEn: 'Relevance rerank before fusion, on by default' },
|
|
138
|
-
{ name: 'ARGO_NUMBER_CROSSCHECK', kind: 'bool', group: 'cache', def: true, zh: '数值交叉校验', en: 'Number cross-check', hintZh: '对查询里的数值主张做跨源核对,默认开', hintEn: 'Cross-check numeric claims across sources, on by default' },
|
|
139
|
-
{ name: 'ARGO_MINHASH_DEDUPE', kind: 'bool', group: 'cache', def: true, zh: 'MinHash 去重', en: 'MinHash dedupe', hintZh: '近重复结果合并,默认开', hintEn: 'Merge near-duplicate results, on by default' },
|
|
140
|
-
{ name: 'ARGO_MINHASH_THRESHOLD', kind: 'num', group: 'cache', def: 0.85, min: 0.5, max: 1, step: 0.05, zh: '去重阈值', en: 'Dedupe threshold', hintZh: '越高越严(越多判为不同),默认 0.85', hintEn: 'Higher = stricter, default 0.85' },
|
|
141
|
-
{ name: 'ARGO_SERP_GUARD', kind: 'bool', group: 'cache', def: true, zh: 'SERP 守卫', en: 'SERP guard', hintZh: '拦截壳页/风控页混入结果,默认开;误杀时先关它复现', hintEn: 'Keep shell/blocked pages out of results, on by default' },
|
|
142
|
-
{ name: 'ARGO_FETCH_JINA', kind: 'bool', group: 'fetch', def: true, zh: 'Jina 阅读器抓取', en: 'Jina reader fetch', hintZh: 'r.jina.ai 正文提取,默认开', hintEn: 'r.jina.ai text extraction, on by default' },
|
|
143
|
-
{ name: 'ARGO_FETCH_MOBILE', kind: 'bool', group: 'fetch', def: true, zh: '移动端 UA 抓取', en: 'Mobile UA fetch', hintZh: '按 host 记忆移动端身份,默认开', hintEn: 'Per-host mobile identity, on by default' },
|
|
144
|
-
{ name: 'ARGO_FETCH_PARALLEL', kind: 'bool', group: 'fetch', def: true, zh: 'Parallel 免费渲染抓取', en: 'Parallel free render fetch', hintZh: 'keyless 云端渲染兜底,默认开', hintEn: 'Keyless cloud render fallback, on by default' },
|
|
145
|
-
{ name: 'ARGO_FETCH_DEADLINE_S', kind: 'num', group: 'fetch', def: 60, min: 5, max: 300, step: 5, zh: '抓取总截止(秒)', en: 'Fetch deadline (s)', hintZh: '单次抓取全链路墙钟上限,默认 60', hintEn: 'Wall-clock cap per fetch, default 60' },
|
|
146
|
-
{ name: 'ARGO_SEMANTIC_EVIDENCE', kind: 'bool', group: 'semantic', def: false, zh: '语义证据层', en: 'Semantic evidence', hintZh: '显式核验链路的零样本判定,默认关;开启后多一次外呼', hintEn: 'Zero-shot support check on the verify path, off by default' },
|
|
147
|
-
{ name: 'ARGO_ADAPTIVE_GRACE', kind: 'bool', group: 'semantic', def: true, zh: '对冲宽限自适应', en: 'Adaptive hedge grace', hintZh: '按引擎历史 p75 收窄对冲等待窗,默认开', hintEn: 'Narrow hedge window by engine p75, on by default' },
|
|
148
|
-
{ name: 'ARGO_ADAPTIVE_TAIL', kind: 'bool', group: 'semantic', def: false, zh: '分层尾宽', en: 'Layered straggler tail', hintZh: '尾宽按未回来引擎分层取值,默认关', hintEn: 'Per-engine layered tail width, off by default' },
|
|
149
|
-
{ name: 'ARGO_STRAGGLER_GRACE_S', kind: 'num', group: 'semantic', def: 1.5, min: 0, max: 30, step: 0.5, zh: '掉队宽限(秒)', en: 'Straggler grace (s)', hintZh: '已有引擎交付后还等多久,默认 1.5;0 关闭', hintEn: 'Wait after first delivery, default 1.5; 0 disables' },
|
|
150
|
-
{ name: 'ARGO_SERIAL_STAGGER_S', kind: 'num', group: 'semantic', def: 0.8, min: 0, max: 30, step: 0.5, zh: '串行起步间隔(秒)', en: 'Serial stagger (s)', hintZh: '首引擎超时前补发备选源的提前量,默认 0.8;0 最激进', hintEn: 'Lead before firing a backup source, default 0.8; 0 = fire together' },
|
|
151
|
-
{ name: 'ARGO_ENABLE_ENGINES', kind: 'list', group: 'engines', zh: '额外启用引擎', en: 'Extra enabled engines', hintZh: '逗号分隔;叠加在 config.yaml 启用集之上', hintEn: 'Comma-separated; adds to the config.yaml enabled set' },
|
|
152
|
-
{ name: 'ARGO_DISABLE_ENGINES', kind: 'list', group: 'engines', zh: '停用引擎', en: 'Disabled engines', hintZh: '逗号分隔;优先级高于启用集,调试单引擎时用', hintEn: 'Comma-separated; wins over the enabled set' },
|
|
153
|
-
{ name: 'ARGO_PROXY', kind: 'str', group: 'net', zh: 'argo 全局代理', en: 'argo global proxy', hintZh: 'http:// 代理 URL,或 direct 强制直连;留空走环境变量', hintEn: 'http:// proxy URL, or direct; empty falls back to env' },
|
|
154
|
-
{ name: 'ARGO_GDELT_PROXY', kind: 'str', group: 'net', zh: 'GDELT 代理', en: 'GDELT proxy', hintZh: 'GDELT 按出口 IP 限流,经本地代理更稳;留空自动直连', hintEn: 'GDELT rate-limits by egress IP; empty = direct' },
|
|
155
|
-
{ name: 'ARGO_LOCAL_SEEK_ROOTS', kind: 'list', group: 'local', zh: '本机检索根目录', en: 'Local seek roots', hintZh: '路径分隔符分隔;seek.py 的候选安装根,默认用打包位置', hintEn: 'Path-separated roots for seek.py; default uses the bundled copy' },
|
|
156
|
-
{ name: 'ARGO_LOCAL_SEEK_PATH', kind: 'str', group: 'local', zh: 'seek.py 绝对路径', en: 'seek.py path', hintZh: '显式指定 seek.py,优先于根目录候选', hintEn: 'Explicit seek.py, wins over root candidates' },
|
|
157
|
-
{ name: 'ARGO_LOCAL_READ_DIRS', kind: 'list', group: 'local', zh: '本机读取白名单', en: 'Local read allowlist', hintZh: '逗号分隔;不配置则 local_read 一律不放行', hintEn: 'Comma-separated; empty means local_read allows nothing' },
|
|
158
|
-
{ name: 'ARGO_TEXT_LEXICON', kind: 'str', group: 'local', zh: '词表 JSON 路径', en: 'Lexicon JSON path', hintZh: '文本处理词表覆盖,默认用打包词表', hintEn: 'Text lexicon override; default uses the bundled one' },
|
|
159
|
-
{ name: 'ARGO_PAID_SEARCH', kind: 'str', group: 'paid', def: 'auto', zh: '付费源策略', en: 'Paid source policy', hintZh: 'auto=优势域自动使用付费源;off=只用免费源。额度见下方', hintEn: 'auto = use paid sources in proven domains; off = free sources only. See quotas below' },
|
|
160
|
-
{ name: 'ARGO_BUDGET_DEEPSEEK_SEARCH', kind: 'num', group: 'paid', def: 5, min: 0, max: 1000, step: 1, zh: 'DeepSeek 月度预算(元)', en: 'DeepSeek monthly budget (CNY)', hintZh: '0=关闭;¥5≈1000次成功调用(¥0.005/次)', hintEn: '0 = off; CNY 5 ≈ 1000 successful calls (CNY 0.005 each)' },
|
|
161
|
-
{ name: 'ARGO_BUDGET_EXA', kind: 'num', group: 'paid', def: 10, min: 0, max: 10000, step: 1, zh: 'Exa 每月预算(美元)', en: 'Exa monthly budget (USD)', hintZh: '默认 $10/月(约 1000 次);0=关闭自动使用。按成功调用计费', hintEn: 'Default $10/month (~1000 calls); 0 = off. Billed per successful call' },
|
|
162
|
-
{ name: 'ARGO_QUOTA_ANYSEARCH_LIMIT', kind: 'num', group: 'paid', def: 1000, min: 0, max: 1000000, step: 1, zh: 'AnySearch 每日次数上限', en: 'AnySearch daily call cap', hintZh: '默认 1000/日;0=不限制。改动对下一次新建连接生效', hintEn: 'Default 1000/day; 0 = unlimited. Applies to new connections' },
|
|
163
|
-
{ name: 'ARGO_QUOTA_ZHIHU_LIMIT', kind: 'num', group: 'paid', def: 5000, min: 0, max: 1000000, step: 1, zh: '知乎 每日次数上限', en: 'Zhihu daily call cap', hintZh: '默认 5000/日;0=不限制。改动对下一次新建连接生效', hintEn: 'Default 5000/day; 0 = unlimited. Applies to new connections' },
|
|
164
|
-
{ name: 'ARGO_QUOTA_YUANBAO_LIMIT', kind: 'num', group: 'paid', def: 2000, min: 0, max: 1000000, step: 1, zh: '元宝 每月次数上限', en: 'Yuanbao monthly call cap', hintZh: '默认 2000/月;0=不限制。改动对下一次新建连接生效', hintEn: 'Default 2000/month; 0 = unlimited. Applies to new connections' },
|
|
165
|
-
{ name: 'ARGO_QUOTA_TAVILY_LIMIT', kind: 'num', group: 'paid', def: 1000, min: 0, max: 1000000, step: 1, zh: 'Tavily 每月次数上限', en: 'Tavily monthly call cap', hintZh: '默认 1000/月;0=不限制。改动对下一次新建连接生效', hintEn: 'Default 1000/month; 0 = unlimited. Applies to new connections' },
|
|
166
|
-
{ name: 'ARGO_NO_PREWARM', kind: 'bool', group: 'misc', def: false, zh: '关闭连接预热', en: 'Disable prewarm', hintZh: 'MCP 握手后预热引擎注册表,默认开;开启本项即关闭预热', hintEn: 'Prewarm the engine registry after handshake, on by default; enable this to turn it off' },
|
|
167
|
-
{ name: 'ARGO_USAGE_LOG', kind: 'bool', group: 'misc', def: true, zh: '使用日志', en: 'Usage log', hintZh: 'argo 侧 JSONL 使用账本,默认开', hintEn: 'argo JSONL usage ledger, on by default' },
|
|
168
|
-
{ name: 'ARGO_ENGINE_HTTP_CLIENT', kind: 'bool', group: 'misc', def: true, zh: 'HttpClient 连接池', en: 'HttpClient pool', hintZh: '引擎 HTTP 走连接池,默认开;=0 回退 urllib(诊断用)', hintEn: 'Pooled engine HTTP, on by default; =0 falls back to urllib' },
|
|
169
|
-
{ name: 'ARGO_ADMISSION_TTL_S', kind: 'num', group: 'misc', def: 1, min: 0, max: 60, step: 0.5, zh: '准入记忆 TTL(秒)', en: 'Admission memo TTL (s)', hintZh: '引擎准入状态记忆时长,默认 1;0 每次现查', hintEn: 'Admission memo window, default 1; 0 = always fresh' },
|
|
170
|
-
{ name: 'ARGO_CONFIG_STAMP_TTL_S', kind: 'num', group: 'misc', def: 1, min: 0, max: 60, step: 0.5, zh: '配置戳记忆 TTL(秒)', en: 'Config stamp memo TTL (s)', hintZh: '外部引擎扫描记忆时长,默认 1;0 每次现扫', hintEn: 'External engine scan memo window, default 1; 0 = always rescan' },
|
|
171
|
-
])
|
|
172
|
-
|
|
173
|
-
const ARGO_ENV_NAMES = new Set(ARGO_ENV_SPECS.map(spec => spec.name))
|
|
174
|
-
const ARGO_ENV_BY_NAME = new Map(ARGO_ENV_SPECS.map(spec => [spec.name, spec]))
|
|
175
|
-
|
|
176
|
-
function parseArgoEnvLine(line) {
|
|
177
|
-
const eq = line.indexOf('=')
|
|
178
|
-
if (eq <= 0) return null
|
|
179
|
-
const name = line.slice(0, eq).trim()
|
|
180
|
-
const value = line.slice(eq + 1)
|
|
181
|
-
if (!CREDENTIAL_REF_PATTERN.test(name)) return null
|
|
182
|
-
return { name, value }
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export function argoEnvOverlay(config = activeConfig) {
|
|
186
|
-
const overlay = {}
|
|
187
|
-
for (const entry of asStringArray(config?.argoEnv, 64)) {
|
|
188
|
-
const parsed = parseArgoEnvLine(entry)
|
|
189
|
-
if (parsed === null || !ARGO_ENV_NAMES.has(parsed.name)) continue
|
|
190
|
-
overlay[parsed.name] = parsed.value
|
|
191
|
-
}
|
|
192
|
-
return overlay
|
|
193
|
-
}
|
|
194
|
-
|
|
195
90
|
const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
196
91
|
|
|
197
92
|
const VOLATILE_WRITE = Symbol.for('cosmokit.volatile.write')
|
|
@@ -303,8 +198,6 @@ export const Config = Schema === undefined ? undefined : Schema.object({
|
|
|
303
198
|
.volatile(),
|
|
304
199
|
})
|
|
305
200
|
|
|
306
|
-
const CREDENTIAL_REF_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/
|
|
307
|
-
|
|
308
201
|
function readHostCredentials(ctx) {
|
|
309
202
|
try {
|
|
310
203
|
const service = typeof ctx?.get === 'function' ? ctx.get('credentials') : ctx?.credentials
|
|
@@ -321,34 +214,11 @@ function runEffect(ctx, fn) {
|
|
|
321
214
|
return ctx.effect(fn)
|
|
322
215
|
}
|
|
323
216
|
|
|
324
|
-
let hostCredentials = undefined
|
|
325
|
-
let activeConfig = DEFAULTS
|
|
326
|
-
|
|
327
|
-
export async function resolveArgoEnv(config = activeConfig, options = {}) {
|
|
328
|
-
const overlay = argoEnvOverlay(config)
|
|
329
|
-
const refs = asStringArray(config?.keyRefs, 20)
|
|
330
|
-
if (refs.length > 0) {
|
|
331
|
-
const provider = options.credentials ?? config?.credentials ?? hostCredentials
|
|
332
|
-
if (provider !== undefined) {
|
|
333
|
-
for (const ref of refs) {
|
|
334
|
-
try {
|
|
335
|
-
const resolved = await provider.resolve(ref)
|
|
336
|
-
if (typeof resolved?.value === 'string' && resolved.value !== '') overlay[ref] = resolved.value
|
|
337
|
-
} catch { /* ignore */ }
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return Object.keys(overlay).length > 0 ? { ...process.env, ...overlay } : undefined
|
|
342
|
-
}
|
|
343
|
-
|
|
344
217
|
const asString = (value, fallback = '') => typeof value === 'string' ? value.trim() : fallback
|
|
345
|
-
const asStringArray = (value, maximum) => Array.isArray(value)
|
|
346
|
-
? value.filter(entry => typeof entry === 'string').map(entry => entry.trim()).filter(Boolean).slice(0, maximum)
|
|
347
|
-
: []
|
|
348
218
|
|
|
349
219
|
// 注入执行器的动态环境变量解析逻辑
|
|
350
220
|
setEnvResolver(async (options, config) => {
|
|
351
|
-
return resolveArgoEnv(config
|
|
221
|
+
return resolveArgoEnv(config, options)
|
|
352
222
|
})
|
|
353
223
|
|
|
354
224
|
export function apply(ctx, providedConfig = {}) {
|
|
@@ -388,13 +258,14 @@ export function apply(ctx, providedConfig = {}) {
|
|
|
388
258
|
}
|
|
389
259
|
}
|
|
390
260
|
|
|
391
|
-
hostCredentials = readHostCredentials(ctx)
|
|
392
|
-
|
|
261
|
+
const hostCredentials = readHostCredentials(ctx)
|
|
262
|
+
setHostCredentials(hostCredentials)
|
|
263
|
+
setActiveConfig(config)
|
|
393
264
|
|
|
394
265
|
runEffect(ctx, () => () => {
|
|
395
266
|
disposeSharedMcp()
|
|
396
|
-
|
|
397
|
-
|
|
267
|
+
setHostCredentials(undefined)
|
|
268
|
+
setActiveConfig(DEFAULTS)
|
|
398
269
|
})
|
|
399
270
|
|
|
400
271
|
const childIds = new Set()
|
|
@@ -498,6 +369,8 @@ export function apply(ctx, providedConfig = {}) {
|
|
|
498
369
|
try { dispose?.() } catch { /* ignore */ }
|
|
499
370
|
}
|
|
500
371
|
nativeRegistrations.clear()
|
|
372
|
+
resetEnvResolver()
|
|
373
|
+
disposeSharedMcp()
|
|
501
374
|
})
|
|
502
375
|
|
|
503
376
|
ctx.tools.register(createWideResearchTool(ctx, config, {
|
|
@@ -525,30 +398,3 @@ export function apply(ctx, providedConfig = {}) {
|
|
|
525
398
|
|
|
526
399
|
return { childIds, syncNativeTools }
|
|
527
400
|
}
|
|
528
|
-
|
|
529
|
-
export {
|
|
530
|
-
normalizeTracks,
|
|
531
|
-
stageTracks,
|
|
532
|
-
evaluateGates,
|
|
533
|
-
normalizeSource,
|
|
534
|
-
normalizeSourceUrl,
|
|
535
|
-
buildLocalSources,
|
|
536
|
-
parseJsonArray,
|
|
537
|
-
parseJsonObject,
|
|
538
|
-
extractValues,
|
|
539
|
-
nativeViaMcpPool,
|
|
540
|
-
runNativeCall,
|
|
541
|
-
resolveNativeSpawn,
|
|
542
|
-
makeNativeTool,
|
|
543
|
-
disposeSharedMcp,
|
|
544
|
-
startStructured,
|
|
545
|
-
providerSupportsStructured,
|
|
546
|
-
fetchViaArgo,
|
|
547
|
-
mapArgoToWebResult,
|
|
548
|
-
mapArgoToWebFetch,
|
|
549
|
-
classifyFetchError,
|
|
550
|
-
searchViaArgoMCP,
|
|
551
|
-
persistReport,
|
|
552
|
-
getMcpPoolStats,
|
|
553
|
-
resetMcpPool,
|
|
554
|
-
}
|
|
@@ -110,6 +110,10 @@ export function setEnvResolver(fn) {
|
|
|
110
110
|
activeEnvResolver = fn
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
export function resetEnvResolver() {
|
|
114
|
+
activeEnvResolver = null
|
|
115
|
+
}
|
|
116
|
+
|
|
113
117
|
export async function resolveEnv(options = {}, config = undefined) {
|
|
114
118
|
if (typeof activeEnvResolver === 'function') {
|
|
115
119
|
return activeEnvResolver(options, config)
|
|
@@ -274,7 +278,8 @@ export function createMcpConnection(options) {
|
|
|
274
278
|
} catch { /* ignore */ }
|
|
275
279
|
}
|
|
276
280
|
},
|
|
277
|
-
close
|
|
281
|
+
close,
|
|
282
|
+
dispose: close,
|
|
278
283
|
}
|
|
279
284
|
return conn
|
|
280
285
|
}
|
|
@@ -350,7 +355,12 @@ export async function acquireMcp(options, signal) {
|
|
|
350
355
|
}
|
|
351
356
|
|
|
352
357
|
export function disposeSharedMcp() {
|
|
353
|
-
for (const conn of [...mcpPool])
|
|
358
|
+
for (const conn of [...mcpPool]) {
|
|
359
|
+
try {
|
|
360
|
+
if (typeof conn.dispose === 'function') conn.dispose()
|
|
361
|
+
else conn.close()
|
|
362
|
+
} catch { /* ignore */ }
|
|
363
|
+
}
|
|
354
364
|
mcpPool.length = 0
|
|
355
365
|
}
|
|
356
366
|
|