argo-search 2.9.8 → 2.10.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 +48 -35
- package/README.es.md +48 -35
- package/README.ja.md +47 -34
- package/README.ko.md +47 -34
- package/README.md +50 -35
- package/SKILL.md +5 -5
- package/backends/domain_profiles.json +76 -0
- package/backends/engine_registry.yaml +161 -5
- package/backends/quota_profiles.json +122 -2
- package/bin/argo +26 -1
- package/bin/argo.js +3 -3
- package/config.yaml +180 -26
- package/docs/ARGO_INTRO.md +7 -5
- package/docs/ENGINE_CATALOG.md +64 -44
- package/docs/MCP_SETUP.md +1 -1
- package/docs/RELEASE_NOTES_v2.10.0.md +85 -0
- package/docs/RELEASE_NOTES_v2.9.8.md +1 -1
- package/docs/RELEASE_NOTES_v2.9.9.md +78 -0
- package/docs//344/270/272/344/273/200/344/271/210/351/200/211/346/213/251argo.md +9 -9
- package/engines/specs/clawhub.yaml +16 -15
- package/engines/specs/deepseek1024.yaml +46 -0
- package/engines/specs/dsh_hub.yaml +44 -0
- package/engines/specs/dshopen.yaml +32 -0
- package/engines/specs/explainx.yaml +32 -0
- package/engines/specs/gbfs_nyc.yaml +6 -1
- package/engines/specs/metaso_doc.yaml +49 -0
- package/engines/specs/metaso_image.yaml +65 -0
- package/engines/specs/metaso_podcast.yaml +60 -0
- package/engines/specs/metaso_scholar.yaml +57 -0
- package/engines/specs/metaso_video.yaml +62 -0
- package/engines/specs/ncpssd.yaml +41 -0
- package/engines/specs/sciverse.yaml +72 -0
- package/engines/specs/skills_sh.yaml +32 -0
- package/engines/specs/skillsmp.yaml +18 -16
- package/package.json +4 -2
- package/packages/dsh-plugin/README.md +4 -2
- package/packages/dsh-plugin/dsh/client.js +98 -32
- package/packages/dsh-plugin/dsh/diagnostics.js +43 -0
- package/packages/dsh-plugin/dsh/index.js +23 -1
- package/packages/dsh-plugin/package.json +2 -2
- package/packages/dsh-plugin/test/client.test.js +2 -1
- package/packages/dsh-plugin/test/size-gate.test.js +113 -0
- package/scripts/adaptive.py +135 -48
- package/scripts/article.py +6 -1
- package/scripts/article_meta.py +151 -2
- package/scripts/bench_general_pool.py +145 -0
- package/scripts/bench_tail_ab.py +281 -0
- package/scripts/bounded_run.py +91 -49
- package/scripts/candidate_envelope.py +45 -4
- package/scripts/charset_decode.py +127 -0
- package/scripts/clock_bridge.py +22 -0
- package/scripts/content_security.py +119 -4
- package/scripts/crawl.py +240 -74
- package/scripts/crawl_frontier.py +217 -0
- package/scripts/crawl_policy.py +174 -0
- package/scripts/dispatch_result.py +9 -2
- package/scripts/engine_add.py +602 -0
- package/scripts/engine_dispatch.py +31 -15
- package/scripts/engine_failure.py +15 -0
- package/scripts/engine_validate.py +8 -0
- package/scripts/engines.py +10 -0
- package/scripts/engines_base.py +12 -0
- package/scripts/engines_builders.py +14 -0
- package/scripts/engines_builders_dsh.py +330 -0
- package/scripts/engines_builders_skill.py +314 -0
- package/scripts/evidence_loop.py +4 -0
- package/scripts/fetch_quality.py +13 -0
- package/scripts/fetch_v3.py +39 -7
- package/scripts/gen_engine_catalog.py +218 -2
- package/scripts/general_pool.py +162 -0
- package/scripts/http_client.py +62 -80
- package/scripts/image_ops.py +4 -0
- package/scripts/image_vision/vision_probe +0 -0
- package/scripts/install.ps1 +47 -19
- package/scripts/install.sh +45 -20
- package/scripts/matrix_search_eval.py +128 -2
- package/scripts/mcp_transport.py +1 -1
- package/scripts/ncpssd_bridge.py +123 -0
- package/scripts/net_proxy.py +27 -0
- package/scripts/paid_policy.py +109 -13
- package/scripts/pre-commit +19 -4
- package/scripts/query_signals.py +156 -3
- package/scripts/recovery.py +7 -3
- package/scripts/redskill/redskill_engine.py +29 -2
- package/scripts/release_check.py +209 -0
- package/scripts/retry_policy.py +22 -1
- package/scripts/robots_guard.py +26 -0
- package/scripts/route.py +11 -8
- package/scripts/route_cache.py +6 -0
- package/scripts/route_combo.py +56 -64
- package/scripts/route_domains.py +142 -13
- package/scripts/route_policy.py +6 -0
- package/scripts/safe_conn.py +52 -0
- package/scripts/search.py +9 -1
- package/scripts/search_cli.py +27 -0
- package/scripts/search_entry.py +10 -0
- package/scripts/search_output.py +29 -0
- package/scripts/search_pipeline.py +59 -3
- package/scripts/search_rank.py +7 -0
- package/scripts/serp_guard.py +23 -0
- package/scripts/social_engines/bilibili_engine.py +163 -26
- package/scripts/social_engines/reddit_engine.py +52 -51
- package/scripts/source_selection.py +302 -0
- package/scripts/tail_completion.py +212 -0
- package/scripts/url_safety.py +126 -3
- package/scripts/usage_log.py +45 -0
- package/scripts/video_fetch.py +303 -0
- package/scripts/video_meta.py +225 -0
- package/scripts/video_route.py +65 -0
- package/scripts/watch.py +123 -0
|
@@ -48,6 +48,9 @@ window.__ModuleLoader__.load({
|
|
|
48
48
|
tabAdvanced: '高级',
|
|
49
49
|
tabDashboard: '看板',
|
|
50
50
|
dashboardTitle: '运行监控与健康态看板',
|
|
51
|
+
routeHealthTitle: '路由观测',
|
|
52
|
+
routeHealthHint: '最近的路由决策与引擎状态(宿主提供时显示)。',
|
|
53
|
+
routeHealthFallback: '在终端运行 `argo stats` 或 `argo engine list` 查看路由健康、引擎成功率与配额消耗。',
|
|
51
54
|
dashboardHint: '实时监控常驻 MCP 连接池、上游搜索源拓扑与额度状态,提供一键预设与快速调优。',
|
|
52
55
|
poolTitle: '常驻 MCP 连接池监控',
|
|
53
56
|
poolStatusHealthy: '就绪(正常)',
|
|
@@ -83,6 +86,8 @@ window.__ModuleLoader__.load({
|
|
|
83
86
|
concurrency: '并发连接数',
|
|
84
87
|
toolsTitle: '原生工具',
|
|
85
88
|
toolsHint: '勾选即注册为原生一等工具(CLI 单发,不依赖 MCP)。长尾工具只在需要时开,避免每轮工具面膨胀。',
|
|
89
|
+
toolPresetTitle: '推荐组合',
|
|
90
|
+
toolPresetHint: '按场景一键套用(会覆盖当前勾选)。工具分区见下方。',
|
|
86
91
|
coreTools: '高频路径',
|
|
87
92
|
longTools: '长尾取证',
|
|
88
93
|
nativeTimeout: '单次调用超时 (ms)',
|
|
@@ -163,6 +168,9 @@ window.__ModuleLoader__.load({
|
|
|
163
168
|
tabAdvanced: 'Advanced',
|
|
164
169
|
tabDashboard: 'Dashboard',
|
|
165
170
|
dashboardTitle: 'Runtime Monitoring & Health Dashboard',
|
|
171
|
+
routeHealthTitle: 'Routing telemetry',
|
|
172
|
+
routeHealthHint: 'Recent routing decisions and engine status (when provided by the host).',
|
|
173
|
+
routeHealthFallback: 'Run `argo stats` or `argo engine list` in a terminal to inspect routing health, engine success rates and quota usage.',
|
|
166
174
|
dashboardHint: 'Real-time overview of the resident MCP connection pool, upstream search engine matrix, and quick workflow presets.',
|
|
167
175
|
poolTitle: 'Resident MCP Pool Monitoring',
|
|
168
176
|
poolStatusHealthy: 'Ready (Healthy)',
|
|
@@ -198,6 +206,8 @@ window.__ModuleLoader__.load({
|
|
|
198
206
|
concurrency: 'Concurrent connections',
|
|
199
207
|
toolsTitle: 'Native tools',
|
|
200
208
|
toolsHint: 'Checked tools register as native first-class tools (single-shot CLI, no MCP). Enable long-tail tools only when needed.',
|
|
209
|
+
toolPresetTitle: 'Recommended sets',
|
|
210
|
+
toolPresetHint: 'Apply a scenario preset in one click (replaces current selection). See the grouped tools below.',
|
|
201
211
|
coreTools: 'Hot path',
|
|
202
212
|
longTools: 'Long tail',
|
|
203
213
|
nativeTimeout: 'Per-call timeout (ms)',
|
|
@@ -259,25 +269,41 @@ window.__ModuleLoader__.load({
|
|
|
259
269
|
},
|
|
260
270
|
};
|
|
261
271
|
|
|
272
|
+
// 工具分区(场景化):核心 / 取证 / 本地 / 长尾。
|
|
273
|
+
// 旧版只有 core/long 两组,16 个长尾工具平铺,新用户不知道该开哪些;
|
|
274
|
+
// 按使用场景分组后,配合下方「推荐组合」卡可以一键套用。
|
|
262
275
|
const TOOLS = [
|
|
263
|
-
{ id: 'argo_search', group: 'core', zh: '统一搜索', en: 'Unified search' },
|
|
264
|
-
{ id: 'argo_fetch', group: 'core', zh: '智能抓取', en: 'Smart fetch' },
|
|
265
|
-
{ id: 'argo_evidence', group: '
|
|
266
|
-
{ id: '
|
|
267
|
-
{ id: '
|
|
268
|
-
{ id: '
|
|
269
|
-
{ id: '
|
|
270
|
-
{ id: '
|
|
271
|
-
{ id: '
|
|
272
|
-
{ id: '
|
|
273
|
-
{ id: '
|
|
274
|
-
{ id: '
|
|
275
|
-
{ id: '
|
|
276
|
-
{ id: '
|
|
277
|
-
{ id: '
|
|
278
|
-
{ id: 'argo_answer', group: '
|
|
279
|
-
{ id: 'argo_watch', group: '
|
|
280
|
-
{ id: 'argo_cite', group: '
|
|
276
|
+
{ id: 'argo_search', group: 'core', zh: '统一搜索', en: 'Unified search', sceneZh: '日常一问的首选', sceneEn: 'Default for everyday queries' },
|
|
277
|
+
{ id: 'argo_fetch', group: 'core', zh: '智能抓取', en: 'Smart fetch', sceneZh: '读某个具体页面', sceneEn: 'Read a specific page' },
|
|
278
|
+
{ id: 'argo_evidence', group: 'forensics', zh: '来源可信度评估', en: 'Source credibility', sceneZh: '高后果问题的证据分级', sceneEn: 'Grade evidence for high-stakes answers' },
|
|
279
|
+
{ id: 'argo_clarify', group: 'forensics', zh: '意图消歧', en: 'Intent clarification', sceneZh: '查询有歧义时先消歧', sceneEn: 'Disambiguate an ambiguous query' },
|
|
280
|
+
{ id: 'argo_crawl', group: 'forensics', zh: '站点级爬取', en: 'Site crawl', sceneZh: '整站/多页采集', sceneEn: 'Site-level or multi-page collection' },
|
|
281
|
+
{ id: 'argo_extract', group: 'forensics', zh: '结构化提取', en: 'Structured extract', sceneZh: '从页面抽表格/字段', sceneEn: 'Extract tables/fields from a page' },
|
|
282
|
+
{ id: 'argo_pdf', group: 'forensics', zh: 'PDF 提取', en: 'PDF extract', sceneZh: '读 PDF 正文', sceneEn: 'Read PDF text' },
|
|
283
|
+
{ id: 'argo_screenshot', group: 'forensics', zh: '网页截图', en: 'Screenshot', sceneZh: '取证留档/看渲染结果', sceneEn: 'Archive or inspect a rendered page' },
|
|
284
|
+
{ id: 'argo_article', group: 'forensics', zh: '公众号全文', en: 'WeChat article', sceneZh: '读公众号文章正文', sceneEn: 'Read a WeChat article' },
|
|
285
|
+
{ id: 'argo_local_search', group: 'local', zh: '本机文件搜索', en: 'Local file search', sceneZh: '搜本机笔记/代码', sceneEn: 'Search local notes/code' },
|
|
286
|
+
{ id: 'argo_local_read', group: 'local', zh: '本机文件读取', en: 'Local file read', sceneZh: '读本机文件', sceneEn: 'Read a local file' },
|
|
287
|
+
{ id: 'argo_recompute', group: 'local', zh: '可复算执行器', en: 'Recompute', sceneZh: '本地可复算任务(需授权)', sceneEn: 'Local recompute (needs authorization)' },
|
|
288
|
+
{ id: 'argo_social_search', group: 'longtail', zh: '社交平台搜索', en: 'Social search', sceneZh: '舆情/UGC 采集', sceneEn: 'Sentiment / UGC collection' },
|
|
289
|
+
{ id: 'argo_job', group: 'longtail', zh: '招聘聚合', en: 'Job aggregation', sceneZh: '招聘/岗位聚合', sceneEn: 'Job aggregation' },
|
|
290
|
+
{ id: 'argo_preflight', group: 'longtail', zh: '批量 URL 预检', en: 'URL preflight', sceneZh: '批量检查 URL 可达性', sceneEn: 'Batch-check URL reachability' },
|
|
291
|
+
{ id: 'argo_answer', group: 'longtail', zh: '带引用直答', en: 'Cited answer', sceneZh: '在给定语料里直答', sceneEn: 'Answer from a given corpus' },
|
|
292
|
+
{ id: 'argo_watch', group: 'longtail', zh: '网页变化监控', en: 'Page watch', sceneZh: '盯页面变化', sceneEn: 'Watch a page for changes' },
|
|
293
|
+
{ id: 'argo_cite', group: 'longtail', zh: 'DOI 引用生成', en: 'DOI citation', sceneZh: '生成引用条目', sceneEn: 'Generate a citation' },
|
|
294
|
+
];
|
|
295
|
+
|
|
296
|
+
// 分区展示名 + 推荐组合(场景化,让用户一键套用而不是逐个勾选)
|
|
297
|
+
const TOOL_GROUPS = [
|
|
298
|
+
{ id: 'core', zh: '高频路径', en: 'Hot path' },
|
|
299
|
+
{ id: 'forensics', zh: '取证与核验', en: 'Forensics' },
|
|
300
|
+
{ id: 'local', zh: '本机', en: 'Local' },
|
|
301
|
+
{ id: 'longtail', zh: '长尾', en: 'Long tail' },
|
|
302
|
+
];
|
|
303
|
+
const TOOL_PRESETS = [
|
|
304
|
+
{ id: 'daily', zh: '日常', en: 'Daily', tools: ['argo_search', 'argo_fetch'], descZh: '一问一搜,最快', descEn: 'Fastest for simple queries' },
|
|
305
|
+
{ id: 'research', zh: '研究', en: 'Research', tools: ['argo_search', 'argo_fetch', 'argo_evidence', 'argo_clarify'], descZh: '加证据分级与消歧', descEn: 'Add evidence grading + disambiguation' },
|
|
306
|
+
{ id: 'forensics', zh: '取证', en: 'Forensics', tools: ['argo_search', 'argo_fetch', 'argo_crawl', 'argo_pdf', 'argo_screenshot', 'argo_extract'], descZh: '整站/多页/PDF 留档', descEn: 'Site/multi-page/PDF archiving' },
|
|
281
307
|
];
|
|
282
308
|
|
|
283
309
|
const KEYS = [
|
|
@@ -617,6 +643,8 @@ window.__ModuleLoader__.load({
|
|
|
617
643
|
const [envBusy, setEnvBusy] = useState('');
|
|
618
644
|
const [engineFilter, setEngineFilter] = useState('');
|
|
619
645
|
const [keyFilter, setKeyFilter] = useState('');
|
|
646
|
+
// 路由观测(宿主经 remote 事件推送;无推送时卡片显示终端命令提示)
|
|
647
|
+
const [routeHealth, setRouteHealth] = useState(null);
|
|
620
648
|
|
|
621
649
|
const dirty = useRef(new Set());
|
|
622
650
|
// 读-改-写共享配置字段(keyRefs / nativeTools / argoEnv)时读实时快照,
|
|
@@ -672,10 +700,14 @@ window.__ModuleLoader__.load({
|
|
|
672
700
|
useEffect(() => {
|
|
673
701
|
if (props.view === 'summary') return undefined;
|
|
674
702
|
void refreshCredentials();
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
703
|
+
const offs = [];
|
|
704
|
+
if (props.remote && typeof props.remote.$on === 'function') {
|
|
705
|
+
const offCreds = props.remote.$on('credentials/reference-updated', () => { void refreshCredentials(); });
|
|
706
|
+
const offRoute = props.remote.$on('route-health/updated', (data) => { setRouteHealth(data); });
|
|
707
|
+
if (typeof offCreds === 'function') offs.push(offCreds);
|
|
708
|
+
if (typeof offRoute === 'function') offs.push(offRoute);
|
|
709
|
+
}
|
|
710
|
+
return () => { for (const off of offs) off(); };
|
|
679
711
|
}, [state]);
|
|
680
712
|
|
|
681
713
|
const edit = (key, text) => {
|
|
@@ -778,6 +810,14 @@ window.__ModuleLoader__.load({
|
|
|
778
810
|
void setField('nativeTools', ordered);
|
|
779
811
|
};
|
|
780
812
|
|
|
813
|
+
// 推荐组合:一键套用一组工具(场景化分区之上的快捷入口)。
|
|
814
|
+
// 只增不减会覆盖用户已有勾选,所以是「设为这组」而非「追加这组」。
|
|
815
|
+
const applyToolPreset = async (tools) => {
|
|
816
|
+
const ordered = TOOLS.map((tool) => tool.id).filter((toolId) => tools.includes(toolId));
|
|
817
|
+
for (const extra of tools) if (!ordered.includes(extra)) ordered.push(extra);
|
|
818
|
+
await props.set('nativeTools', ordered);
|
|
819
|
+
};
|
|
820
|
+
|
|
781
821
|
const saveKey = async (ref) => {
|
|
782
822
|
const key = asString(keyDraft[ref]).trim();
|
|
783
823
|
if (!key || !props.credentials) return;
|
|
@@ -975,8 +1015,8 @@ window.__ModuleLoader__.load({
|
|
|
975
1015
|
? h('p', { style: error ? S.error : S.notice, role: 'status' }, message)
|
|
976
1016
|
: h('p', { style: S.status }, disabled ? t('readonly') : '');
|
|
977
1017
|
|
|
978
|
-
|
|
979
|
-
const
|
|
1018
|
+
// 按 TOOL_GROUPS 顺序分组渲染(场景化分区,替代旧的 core/long 两分)
|
|
1019
|
+
const toolsByGroup = (gid) => TOOLS.filter((tool) => tool.group === gid);
|
|
980
1020
|
const toolCheckbox = (tool) => h('label', { key: tool.id, style: S.check }, [
|
|
981
1021
|
h('input', {
|
|
982
1022
|
key: 'i',
|
|
@@ -1100,6 +1140,19 @@ window.__ModuleLoader__.load({
|
|
|
1100
1140
|
]),
|
|
1101
1141
|
]));
|
|
1102
1142
|
|
|
1143
|
+
// 路由观测卡:宿主经 remote 事件推送 routeHealth 时展示最近路由决策;
|
|
1144
|
+
// 未推送时给出终端命令提示——不让面板空白,也不假装有数据。
|
|
1145
|
+
panel.push(h(Card, { key: 'route', title: t('routeHealthTitle'), hint: t('routeHealthHint') }, [
|
|
1146
|
+
routeHealth && Array.isArray(routeHealth.samples) && routeHealth.samples.length > 0
|
|
1147
|
+
? h('div', { key: 'rows', style: { display: 'flex', flexDirection: 'column', gap: 6 } },
|
|
1148
|
+
routeHealth.samples.slice(0, 5).map((row, i) =>
|
|
1149
|
+
h('div', { key: 'r' + i, style: S.keyRow }, [
|
|
1150
|
+
h('span', { key: 'q', style: S.label }, String(row.query || '').slice(0, 40)),
|
|
1151
|
+
h('span', { key: 'd', style: S.sub }, `${row.domain || '-'} · ${row.engine || '-'}`),
|
|
1152
|
+
])))
|
|
1153
|
+
: h('p', { key: 'hint', style: S.hint }, t('routeHealthFallback')),
|
|
1154
|
+
]));
|
|
1155
|
+
|
|
1103
1156
|
panel.push(h(Card, { key: 'presets', title: t('presetTitle'), hint: t('presetHint') }, [
|
|
1104
1157
|
h('div', { key: 'grid', style: S.presetGrid }, [
|
|
1105
1158
|
h('div', {
|
|
@@ -1219,15 +1272,27 @@ window.__ModuleLoader__.load({
|
|
|
1219
1272
|
}
|
|
1220
1273
|
|
|
1221
1274
|
if (tab === 'tools') {
|
|
1275
|
+
panel.push(h(Card, { key: 'presets', title: t('toolPresetTitle'), hint: t('toolPresetHint') }, [
|
|
1276
|
+
h('div', { key: 'grid', style: S.presetGrid }, TOOL_PRESETS.map((preset) =>
|
|
1277
|
+
h('button', {
|
|
1278
|
+
key: preset.id, type: 'button', disabled,
|
|
1279
|
+
style: S.presetCard(false),
|
|
1280
|
+
onClick: () => { void applyToolPreset(preset.tools); },
|
|
1281
|
+
}, [
|
|
1282
|
+
h('div', { key: 't', style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' } }, [
|
|
1283
|
+
h('span', { key: 'title', style: S.label }, lang === 'en' ? preset.en : preset.zh),
|
|
1284
|
+
h('span', { key: 'badge', style: S.badge('blue') }, String(preset.tools.length) + ' 工具'),
|
|
1285
|
+
]),
|
|
1286
|
+
h('span', { key: 'd', style: S.sub }, lang === 'en' ? preset.descEn : preset.descZh),
|
|
1287
|
+
]))),
|
|
1288
|
+
]));
|
|
1222
1289
|
panel.push(h(Card, { key: 'tools', title: t('toolsTitle'), hint: t('toolsHint') }, [
|
|
1223
|
-
|
|
1224
|
-
h('
|
|
1225
|
-
h('div', { key: '
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
h('span', { key: 'l', style: S.label }, t('longTools')),
|
|
1230
|
-
h('div', { key: 'g', style: S.toolGrid }, longTools.map(toolCheckbox)),
|
|
1290
|
+
...TOOL_GROUPS.map((grp, gi) => [
|
|
1291
|
+
gi > 0 ? h('div', { key: 'div' + gi, style: S.divider }) : null,
|
|
1292
|
+
h('div', { key: grp.id, style: { display: 'flex', flexDirection: 'column', gap: 4 } }, [
|
|
1293
|
+
h('span', { key: 'l', style: S.label }, lang === 'en' ? grp.en : grp.zh),
|
|
1294
|
+
h('div', { key: 'g', style: S.toolGrid }, toolsByGroup(grp.id).map(toolCheckbox)),
|
|
1295
|
+
]),
|
|
1231
1296
|
]),
|
|
1232
1297
|
h('div', { key: 'g2', style: S.grid }, [
|
|
1233
1298
|
h(NumberField, {
|
|
@@ -1526,6 +1591,7 @@ window.__ModuleLoader__.load({
|
|
|
1526
1591
|
// 生成产物)同名同集合,ENGINE_TOGGLES 必须与 index.js 的 ARGO_ENV_SPECS
|
|
1527
1592
|
// 同名同集合——两边任何一边增删而另一边没跟上,测试即红。
|
|
1528
1593
|
exports.TOOLS = TOOLS;
|
|
1594
|
+
exports.TOOL_GROUPS = TOOL_GROUPS;
|
|
1529
1595
|
exports.ENGINE_TOGGLES = ENGINE_TOGGLES;
|
|
1530
1596
|
|
|
1531
1597
|
return module.exports;
|
|
@@ -5,6 +5,49 @@
|
|
|
5
5
|
* 避免状态探查逻辑与核心检索逻辑耦合。
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
9
|
+
import { homedir } from 'node:os'
|
|
10
|
+
import { join } from 'node:path'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 读 argo 的本地使用日志,汇总成「路由观测」卡片数据。
|
|
14
|
+
*
|
|
15
|
+
* 数据来源与 stats_cli.py / usage_log.py 同一处(<state>/usage_log/*.jsonl),
|
|
16
|
+
* 只读、不写、不出本机。argo 未运行过(无日志)时返回 { samples: [] },
|
|
17
|
+
* 面板据此显示终端命令提示——不假装有数据。
|
|
18
|
+
*
|
|
19
|
+
* @param {string} [stateDir] - argo 状态目录;缺省用 ARGO_STATE_DIR 或平台惯例
|
|
20
|
+
* @param {number} [limit] - 最近几条
|
|
21
|
+
*/
|
|
22
|
+
export function getRouteHealth(stateDir, limit = 10) {
|
|
23
|
+
const dir = stateDir
|
|
24
|
+
|| process.env.ARGO_STATE_DIR
|
|
25
|
+
|| join(homedir(), '.cache', 'unified-search')
|
|
26
|
+
const samples = []
|
|
27
|
+
try {
|
|
28
|
+
const routePath = join(dir, 'usage_log', 'route.jsonl')
|
|
29
|
+
if (existsSync(routePath)) {
|
|
30
|
+
const lines = readFileSync(routePath, 'utf8').split('\n').filter(Boolean)
|
|
31
|
+
for (const line of lines.slice(-limit)) {
|
|
32
|
+
try {
|
|
33
|
+
const row = JSON.parse(line)
|
|
34
|
+
if (row && typeof row === 'object') {
|
|
35
|
+
samples.push({
|
|
36
|
+
query: row.query || row.original_query || '',
|
|
37
|
+
engine: row.engine || (row.decision && row.decision.engine) || '',
|
|
38
|
+
domain: row.domain || (row.decision && row.decision.domain) || '',
|
|
39
|
+
confidence: row.confidence || (row.decision && row.decision.confidence) || '',
|
|
40
|
+
reason: row.reason || (row.decision && row.decision.reason) || '',
|
|
41
|
+
ts: row.ts || row.timestamp || '',
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
} catch { /* 单行坏数据不影响其余 */ }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} catch { /* 读不到就空 */ }
|
|
48
|
+
return { samples, source: 'usage_log/route.jsonl', stateDir: dir }
|
|
49
|
+
}
|
|
50
|
+
|
|
8
51
|
/**
|
|
9
52
|
* 获取当前常驻 MCP 连接池的运行时指标。
|
|
10
53
|
*
|
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
import {
|
|
63
63
|
getMcpPoolStats,
|
|
64
64
|
resetMcpPool,
|
|
65
|
+
getRouteHealth,
|
|
65
66
|
} from './diagnostics.js'
|
|
66
67
|
|
|
67
68
|
/**
|
|
@@ -450,6 +451,18 @@ export function apply(ctx, providedConfig = {}) {
|
|
|
450
451
|
}
|
|
451
452
|
|
|
452
453
|
const nativeRegistrations = new Map()
|
|
454
|
+
// 路由观测推送:原生工具执行后读 argo 使用日志,经 remote 事件推给设置面板。
|
|
455
|
+
// 失败静默(诊断是增值,不是依赖);无 remote 事件总线时跳过。
|
|
456
|
+
const emitRouteHealth = () => {
|
|
457
|
+
try {
|
|
458
|
+
if (!ctx.remote || typeof ctx.remote.$emit !== 'function') return
|
|
459
|
+
const data = getRouteHealth()
|
|
460
|
+
if (Array.isArray(data.samples) && data.samples.length > 0) {
|
|
461
|
+
ctx.remote.$emit('route-health/updated', data)
|
|
462
|
+
}
|
|
463
|
+
} catch { /* ignore */ }
|
|
464
|
+
}
|
|
465
|
+
|
|
453
466
|
const syncNativeTools = () => {
|
|
454
467
|
const desired = asStringArray(config.nativeTools, 20)
|
|
455
468
|
for (const [kind, dispose] of nativeRegistrations) {
|
|
@@ -459,7 +472,16 @@ export function apply(ctx, providedConfig = {}) {
|
|
|
459
472
|
}
|
|
460
473
|
for (const kind of desired) {
|
|
461
474
|
if (nativeRegistrations.has(kind)) continue
|
|
462
|
-
|
|
475
|
+
const tool = makeNativeTool(config, kind)
|
|
476
|
+
const originalExecute = tool.execute
|
|
477
|
+
if (typeof originalExecute === 'function') {
|
|
478
|
+
tool.execute = async (args, exec) => {
|
|
479
|
+
const result = await originalExecute(args, exec)
|
|
480
|
+
emitRouteHealth()
|
|
481
|
+
return result
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
nativeRegistrations.set(kind, ctx.tools.register(tool))
|
|
463
485
|
}
|
|
464
486
|
}
|
|
465
487
|
syncNativeTools()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taxueseek/argo-dsh",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Argo 阿尔戈 — DSH plugin:argo 原生搜索/抓取工具 + web_search seam + wide_research 编排;自带设置页(接入/工具/API 密钥/研究/高级);argo MCP 19 工具全量面按需挂载。安装:dsh plugin --profile web add \"github:taxueseek/argo#main&path:packages/dsh-plugin\"",
|
|
3
|
+
"version": "2.10.0",
|
|
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",
|
|
7
7
|
"main": "./dsh/index.js",
|
|
@@ -122,9 +122,10 @@ test('client TOOLS mirror native-tools.mjs (drift gate)', () => {
|
|
|
122
122
|
const specNames = Object.keys(NATIVE_TOOLS).sort()
|
|
123
123
|
const toolIds = [...mod.TOOLS].map((tool) => tool.id).sort()
|
|
124
124
|
assert.deepEqual(toolIds, specNames, '面板 TOOLS 与原生工具规格表漂移,请同步两边')
|
|
125
|
+
const groupIds = new Set([...mod.TOOL_GROUPS].map((grp) => grp.id))
|
|
125
126
|
for (const tool of mod.TOOLS) {
|
|
126
127
|
assert.ok(tool.zh && tool.en, `tool ${tool.id} 缺双语标签`)
|
|
127
|
-
assert.ok(
|
|
128
|
+
assert.ok(groupIds.has(tool.group), `tool ${tool.id} 分组非法: ${tool.group}`)
|
|
128
129
|
}
|
|
129
130
|
})
|
|
130
131
|
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// size-gate.test.js — dsh-plugin 单文件体积门禁(防「千行文件」复发)。
|
|
2
|
+
//
|
|
3
|
+
// ## 为什么要这道门
|
|
4
|
+
//
|
|
5
|
+
// Python 侧自 2026-09-22 起有 tests/test_module_size_gate.py(1000 行上限 +
|
|
6
|
+
// 祖父清单),这里补的是同一条门禁的 JS 对等物:2026-10-22 拆客户端时
|
|
7
|
+
// client.js 1,533 行,到 10-26 已涨到 1,599 行——两周 +66,且**没有任何
|
|
8
|
+
// 门禁会说话**。单文件超过千行后,改一处的定位成本(读完整条渲染链)比
|
|
9
|
+
// 拆模块的迁移成本涨得更快;趋势必须先钉住,再谈拆。
|
|
10
|
+
//
|
|
11
|
+
// ## 规则(与 Python 侧逐条对齐)
|
|
12
|
+
//
|
|
13
|
+
// 1. 上限 1000 行:dsh/ 下任何生产文件不得超过;
|
|
14
|
+
// 2. 祖父清单:拆不动的大文件显式登记「上限 = 登记时的行数」,只能减不能增;
|
|
15
|
+
// 3. 新增文件天然合规:不在清单里,直接吃 1000 上限;
|
|
16
|
+
// 4. 上限不得高于实际行数(清单不许虚高),每条必须写拆不开的理由。
|
|
17
|
+
//
|
|
18
|
+
// ## 清单怎么维护
|
|
19
|
+
//
|
|
20
|
+
// 拆走一块 → 把上限改成新的行数(或整条删掉,若已 ≤ 1000);想加功能又
|
|
21
|
+
// 超上限时,正解是拆模块,不是把数字往上调;真要上调,理由写进 reason。
|
|
22
|
+
|
|
23
|
+
import { test } from 'node:test'
|
|
24
|
+
import assert from 'node:assert/strict'
|
|
25
|
+
import { readFileSync, readdirSync } from 'node:fs'
|
|
26
|
+
import { dirname, join, relative } from 'node:path'
|
|
27
|
+
import { fileURLToPath } from 'node:url'
|
|
28
|
+
|
|
29
|
+
const PKG_ROOT = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
30
|
+
const DSH_DIR = join(PKG_ROOT, 'dsh')
|
|
31
|
+
|
|
32
|
+
const HARD_LIMIT = 1000
|
|
33
|
+
|
|
34
|
+
// 路径 → [上限行数, 为什么不拆/拆到哪一步]
|
|
35
|
+
const GRANDFATHERED = new Map([
|
|
36
|
+
['dsh/client.js', [
|
|
37
|
+
1599,
|
|
38
|
+
'web 设置面板单页(接入/工具/密钥/研究/高级五段 UI + 状态机);' +
|
|
39
|
+
'2026-10-26 面板升级后 1,533 → 1,599,功能与测试同批落地;' +
|
|
40
|
+
'拆分候选:把各段表单渲染抽成 render-* 模块,状态机留在本文件',
|
|
41
|
+
]],
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
function lineCount(file) {
|
|
45
|
+
const text = readFileSync(file, 'utf8')
|
|
46
|
+
const lines = text.split('\n')
|
|
47
|
+
// 与 wc -l / Python splitlines 同口径:以换行结尾时不算多一行
|
|
48
|
+
return text.endsWith('\n') ? lines.length - 1 : lines.length
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function productionFiles() {
|
|
52
|
+
return readdirSync(DSH_DIR)
|
|
53
|
+
.filter((name) => name.endsWith('.js') || name.endsWith('.mjs'))
|
|
54
|
+
.sort()
|
|
55
|
+
.map((name) => join(DSH_DIR, name))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
test('没有生产文件超过 1000 行且未登记', () => {
|
|
59
|
+
const offenders = []
|
|
60
|
+
for (const file of productionFiles()) {
|
|
61
|
+
const rel = relative(PKG_ROOT, file)
|
|
62
|
+
if (GRANDFATHERED.has(rel)) continue
|
|
63
|
+
const n = lineCount(file)
|
|
64
|
+
if (n > HARD_LIMIT) {
|
|
65
|
+
offenders.push(`${rel}: ${n} 行(上限 ${HARD_LIMIT})`)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
assert.deepEqual(
|
|
69
|
+
offenders,
|
|
70
|
+
[],
|
|
71
|
+
'文件超过 1000 行且未登记。请先拆模块;确有必要登记时在 GRANDFATHERED 里写明理由:\n ' +
|
|
72
|
+
offenders.join('\n '),
|
|
73
|
+
)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('祖父文件只能减不能增', () => {
|
|
77
|
+
const grown = []
|
|
78
|
+
for (const [rel, [ceiling]] of GRANDFATHERED) {
|
|
79
|
+
const file = join(PKG_ROOT, rel)
|
|
80
|
+
const n = lineCount(file)
|
|
81
|
+
if (n > ceiling) grown.push(`${rel}: ${n} 行 > 登记上限 ${ceiling}`)
|
|
82
|
+
}
|
|
83
|
+
assert.deepEqual(
|
|
84
|
+
grown,
|
|
85
|
+
[],
|
|
86
|
+
'祖父文件变大了。正解是拆模块并把上限调低;确要上调请在 GRANDFATHERED 里改数字并说明理由:\n ' +
|
|
87
|
+
grown.join('\n '),
|
|
88
|
+
)
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
test('祖父上限不得高于实际行数(清单不许虚高)', () => {
|
|
92
|
+
const inflated = []
|
|
93
|
+
for (const [rel, [ceiling]] of GRANDFATHERED) {
|
|
94
|
+
const n = lineCount(join(PKG_ROOT, rel))
|
|
95
|
+
if (ceiling > n) {
|
|
96
|
+
inflated.push(`${rel}: 上限 ${ceiling} > 实际 ${n}(请下调到 ${n})`)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
assert.deepEqual(
|
|
100
|
+
inflated,
|
|
101
|
+
[],
|
|
102
|
+
'祖父清单的上限比实际行数高——把上限收到实际行数:\n ' + inflated.join('\n '),
|
|
103
|
+
)
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
test('每条祖父登记都必须写拆不开的理由', () => {
|
|
107
|
+
for (const [rel, [, reason]] of GRANDFATHERED) {
|
|
108
|
+
assert.ok(
|
|
109
|
+
typeof reason === 'string' && reason.trim().length >= 12,
|
|
110
|
+
`${rel} 的 reason 太短,写清楚卡在哪(数据表性质?缺测试?边界不清?)`,
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
})
|