dsh-model-health 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -43
- package/package.json +4 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 oxlyn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,81 +1,112 @@
|
|
|
1
1
|
# dsh-model-health
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-model-health)
|
|
4
|
+
[](#license)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
| # | 形式 | 入口 | 说明 |
|
|
10
|
-
|---|------|------|------|
|
|
11
|
-
| 1 | 设置页面板「模型健康」 | Web UI → 设置 → 模型健康 | React 表格:Provider / 模型 ID / 名称 / 上下文窗口 / 最大输出 / 输入模态 / API 协议 / BaseURL 等列(可选列可切换显示) |
|
|
12
|
-
| 2 | 一键测试全部 | 面板内「测试全部」按钮 | 并发(上限 6)对每个模型发一次 `max_tokens=1` 的最小 chat completions 请求,10s 超时;逐行显示 可用 / 不可用 / 跳过 / 延迟,失败原因悬停查看,结果持久化到 localStorage |
|
|
13
|
-
| 3 | Tool 插件 `list_models` | 对话中调用 | 返回 Markdown 表格,供模型在对话中查看模型清单 |
|
|
6
|
+
> DeepSeek Harness (DSH) 插件:在设置页提供「模型健康」面板——列出所有已配置模型,并一键批量测试可用性与延迟。
|
|
7
|
+
>
|
|
8
|
+
> English documentation: [README_EN](README_EN.md)
|
|
14
9
|
|
|
15
|
-
|
|
10
|
+

|
|
16
11
|
|
|
17
12
|
## 安装 / Install
|
|
18
13
|
|
|
19
|
-
|
|
14
|
+
### npm 安装(推荐)
|
|
20
15
|
|
|
21
16
|
```sh
|
|
22
|
-
dsh plugin --profile
|
|
17
|
+
dsh plugin --profile web add dsh-model-health
|
|
23
18
|
```
|
|
24
19
|
|
|
25
|
-
|
|
20
|
+
### 源码安装
|
|
26
21
|
|
|
27
22
|
```sh
|
|
28
|
-
git clone https://github.com
|
|
23
|
+
git clone https://github.com/oxlyn/dsh-model-health.git
|
|
29
24
|
cd dsh-model-health
|
|
30
25
|
pnpm install
|
|
31
26
|
pnpm run build # tsc → dist/index.js (pure ESM) + dist/client.js
|
|
32
27
|
|
|
33
28
|
# 在插件的父目录执行(dsh plugin add 的相对路径锚定调用目录):
|
|
34
29
|
cd ..
|
|
35
|
-
dsh plugin --profile
|
|
36
|
-
dsh
|
|
30
|
+
dsh plugin --profile web add ./dsh-model-health
|
|
31
|
+
dsh web
|
|
37
32
|
# 启动日志应出现:[dsh-model-health] ready — tool "list_models" + routes GET /api/model-health/json, POST /api/model-health/test
|
|
38
33
|
```
|
|
39
34
|
|
|
40
|
-
|
|
35
|
+
### 验证 / Verify
|
|
36
|
+
|
|
37
|
+
安装后打开 `dsh web` → 设置 → 模型健康,应能看到已配置模型表格。无 API key 也可验证插件加载:
|
|
41
38
|
|
|
42
39
|
```sh
|
|
43
|
-
dsh --profile
|
|
40
|
+
dsh --profile web --dump-config | grep dsh-model-health # 配置层含本行
|
|
44
41
|
```
|
|
45
42
|
|
|
46
|
-
##
|
|
43
|
+
## 功能 / Features
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
读取 `$DSH_HOME/settings.yaml`(默认 `~/.dsh/settings.yaml`),提供三种使用方式:
|
|
46
|
+
|
|
47
|
+
| # | 形式 | 入口 | 说明 |
|
|
48
|
+
|---|------|------|------|
|
|
49
|
+
| 1 | 「模型健康」面板 | Web UI → 设置 → 模型健康 | React 表格:Provider / 模型 ID / 名称 / 上下文窗口 / 最大输出 / 输入模态 / API 协议 / BaseURL,可选列可切换显示 |
|
|
50
|
+
| 2 | 测试全部 | 面板内「测试全部」按钮 | 并发(上限 6)对每个模型发一次 `max_tokens=1` 的最小 chat completions 请求,10s 超时;逐行显示 可用 / 不可用 / 跳过 / 延迟,失败原因悬停查看,结果持久化到 localStorage |
|
|
51
|
+
| 3 | Tool 插件 `list_models` | 对话中调用 | 返回 Markdown 表格,供模型在对话中查看模型清单 |
|
|
52
|
+
|
|
53
|
+
**特性一览:**
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
- 支持 `llm-pi-ai`(多协议自定义提供商)与 `llm-deepseek`(官方)两类配置来源
|
|
56
|
+
- 可用性测试支持 `openai-completions` 与 `deepseek` 协议,其余协议自动标记「跳过」
|
|
57
|
+
- API Key 通过 DSH credential service(`ctx.credentials.resolve`)解析,密钥不会输出到浏览器
|
|
58
|
+
- 测试结果(状态/延迟/错误)持久化到 localStorage,刷新页面后仍可见
|
|
52
59
|
|
|
53
|
-
|
|
54
|
-
- Node 版本:DSH 要求 ^22.19.0 || >=24.0.0。旧版本(如 v22.17)只告警 EBADENGINE,不阻断,但建议升级。
|
|
60
|
+
## 实现方式 / How it works
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
插件分为 host 侧与 client 侧两部分(`package.json` 的 `dsh.client` 字段声明 client 入口):
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
┌─ host 侧 src/index.ts → dist/index.js ─────────────────────────┐
|
|
66
|
+
│ - ctx.tools.register:注册 list_models 工具(Markdown 表格输出) │
|
|
67
|
+
│ - ctx.webServer.register: │
|
|
68
|
+
│ GET /api/model-health/json 读取并解析 settings.yaml → JSON │
|
|
69
|
+
│ POST /api/model-health/test 对单模型发最小请求测可用性/延迟 │
|
|
70
|
+
│ - 解析 DSH credential service 获取 API Key │
|
|
71
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
72
|
+
│ fetch
|
|
73
|
+
┌─ client 侧 src/client.js(浏览器端模块)──────────────────────────┐
|
|
74
|
+
│ - 通过 settings.section slot 注入「模型健康」面板 │
|
|
75
|
+
│ - React(宿主提供)渲染表格 + 状态徽章 + hover 错误提示 │
|
|
76
|
+
│ - 「测试全部」:worker pool 限并发 6,逐个更新行状态 │
|
|
77
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
78
|
+
```
|
|
58
79
|
|
|
59
|
-
|
|
60
|
-
- 版本线对齐:所有 @deepseek-ai/dsh-* 包统一用同一 0.1.0-rc.x 线,避免 pnpm 装两份模块。
|
|
80
|
+
技术要点:纯 ESM(`"type": "module"`)、cordis 作为 peerDependency 由宿主提供(仅编译期 import type)、服务依赖通过 `export const inject = ['tools', 'webServer', 'credentials']` 声明。
|
|
61
81
|
|
|
62
|
-
|
|
63
|
-
- @deepseek-ai/cordis 是 peerDep:只 import type(编译期擦除),运行时 ctx 由宿主传入。
|
|
82
|
+
## 环境要求 / Requirements
|
|
64
83
|
|
|
65
|
-
|
|
66
|
-
|
|
84
|
+
- Node `^22.19.0 || >=24.0.0`(DSH 宿主要求)
|
|
85
|
+
- pnpm(源码构建用)
|
|
67
86
|
|
|
68
|
-
|
|
69
|
-
- dsh plugin add <dir> 的相对路径锚定调用目录——要在插件的父目录执行。
|
|
87
|
+
## 开发 / Development
|
|
70
88
|
|
|
71
|
-
|
|
72
|
-
|
|
89
|
+
```sh
|
|
90
|
+
pnpm install
|
|
91
|
+
pnpm run typecheck # 类型检查
|
|
92
|
+
pnpm run build # 构建 dist/
|
|
93
|
+
```
|
|
73
94
|
|
|
74
|
-
|
|
75
|
-
|
|
95
|
+
项目结构:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
dsh-model-health/
|
|
99
|
+
├── src/index.ts # host 侧:tool + HTTP 路由
|
|
100
|
+
├── src/client.js # client 侧:设置页面板(浏览器模块)
|
|
101
|
+
├── cordis.patch.yml # bundle 层声明(id/name 走包名解析)
|
|
102
|
+
└── dist/ # 构建产物(发布包含在 files 字段中)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 依赖锁定 / Dependencies
|
|
106
|
+
|
|
107
|
+
- `@deepseek-ai/dsh-tools`: `0.1.0-rc.8` (exact — the **`next`**-tag line; npm `latest` is stale).
|
|
108
|
+
- `@deepseek-ai/cordis`: `^4.0.1` (peerDependency — host provides it; types-only in code).
|
|
76
109
|
|
|
77
|
-
|
|
78
|
-
- 加载顺序靠服务依赖(inject),不靠文件顺序。
|
|
110
|
+
## License
|
|
79
111
|
|
|
80
|
-
|
|
81
|
-
- 端到端(模型真正调工具)需 DEEPSEEK_API_KEY;无 key 时 --verify 只能证明加载/列出/事件,模型调用会 MISSING_CREDENTIAL。
|
|
112
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-model-health",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "DSH plugin that lists all configured models with availability/latency testing, by reading $DSH_HOME/settings.yaml.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,14 +32,15 @@
|
|
|
32
32
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@deepseek-ai/dsh-tools": "0.1.0-rc.8",
|
|
36
35
|
"js-yaml": "^4.1.0"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
39
|
-
"@deepseek-ai/cordis": "^4.0.1"
|
|
38
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
39
|
+
"@deepseek-ai/dsh-tools": "0.1.0-rc.8"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
43
|
+
"@deepseek-ai/dsh-tools": "0.1.0-rc.8",
|
|
43
44
|
"@types/js-yaml": "^4.0.9",
|
|
44
45
|
"@types/node": "^22.10.0",
|
|
45
46
|
"typescript": "^5.6.0"
|