dsh-mcp-ops 0.1.2 → 0.1.4
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.md +5 -5
- package/lib/error-text.js +54 -0
- package/lib/mount.js +1 -3
- package/lib/probe.js +2 -5
- package/lib/service.js +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -28,13 +28,13 @@ DeepSeek Harness(dsh)插件:在设置页管理 MCP 服务。
|
|
|
28
28
|
dsh plugin --profile web add dsh-mcp-ops
|
|
29
29
|
|
|
30
30
|
# 或本地 tarball(pnpm pack 的产物)
|
|
31
|
-
dsh plugin --profile web add /path/to/dsh-mcp-ops-0.1.
|
|
31
|
+
dsh plugin --profile web add /path/to/dsh-mcp-ops-0.1.4.tgz
|
|
32
32
|
|
|
33
33
|
# 卸载
|
|
34
34
|
dsh plugin --profile web remove dsh-mcp-ops
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
**支持的 dsh 版本**:`0.2.1-alpha.1`、`0.2.0-rc.2`(即 `0.2.0-rc.2` 起的全部 `0.2.x`)。
|
|
37
|
+
**支持的 dsh 版本**:`0.2.1-rc.2`、`0.2.1-alpha.4`、`0.2.1-alpha.2`、`0.2.1-alpha.1`、`0.2.0-rc.2`(即 `0.2.0-rc.2` 起的全部 `0.2.x`)。
|
|
38
38
|
|
|
39
39
|
本包声明了 `dsh.bundle`,官方流程会自动把依赖写进 profile 的 `package.json` 并登记进
|
|
40
40
|
`dsh.profile.bundles`,包内的 `cordis.patch.yml` 作为 bundle 层自动应用 —— 不需要手工编辑任何
|
|
@@ -70,7 +70,7 @@ docs/ 详细设计与官方依赖落点
|
|
|
70
70
|
|
|
71
71
|
```sh
|
|
72
72
|
pnpm run --config.verify-deps-before-run=false build && pnpm pack --pack-destination docker &&
|
|
73
|
-
docker build --progress=plain -t founder/dsh-mcp-ops:0.1.
|
|
73
|
+
docker build --progress=plain -t founder/dsh-mcp-ops:0.1.4 -f docker/Dockerfile docker/ &&
|
|
74
74
|
HOME=/home/ubuntu docker compose -f docker/docker-compose.yaml --project-directory docker up -d --force-recreate
|
|
75
75
|
|
|
76
76
|
node docker/verify.mjs # 容器端到端(装配终态 / 启动日志 / 服务侧 sync / locale 元数据 / 客户端产物)
|
|
@@ -99,8 +99,8 @@ npm publish --dry-run --registry=https://registry.npmjs.org/
|
|
|
99
99
|
npm publish --registry=https://registry.npmjs.org/ --access public
|
|
100
100
|
|
|
101
101
|
# 4) 发布后核对并打 tag
|
|
102
|
-
npm view dsh-mcp-ops@0.1.
|
|
103
|
-
git tag -a v0.1.
|
|
102
|
+
npm view dsh-mcp-ops@0.1.4 --registry=https://registry.npmjs.org/
|
|
103
|
+
git tag -a v0.1.4 -m "dsh-mcp-ops 0.1.4" && git push origin v0.1.4
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
72 小时内可 `npm unpublish dsh-mcp-ops@<版本>` 撤回;超时只能 `npm deprecate`。
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const ERROR_SEGMENT_MAX = 240;
|
|
2
|
+
const ERROR_DEPTH_MAX = 4;
|
|
3
|
+
const ERROR_TEXT_MAX = 600;
|
|
4
|
+
function truncate(text, max) {
|
|
5
|
+
return text.length <= max ? text : `${text.slice(0, max - 1)}\u2026`;
|
|
6
|
+
}
|
|
7
|
+
function segmentOf(value) {
|
|
8
|
+
let message;
|
|
9
|
+
let code = "";
|
|
10
|
+
if (value instanceof Error) {
|
|
11
|
+
message = value.message;
|
|
12
|
+
if (value.name !== "" && value.name !== "Error" && !message.startsWith(value.name)) {
|
|
13
|
+
message = `${value.name}: ${message}`;
|
|
14
|
+
}
|
|
15
|
+
const raw = value.code;
|
|
16
|
+
if (typeof raw === "string" && raw !== "" && !message.includes(raw)) code = raw;
|
|
17
|
+
} else if (typeof value === "string") {
|
|
18
|
+
message = value;
|
|
19
|
+
} else if (value !== null && typeof value === "object") {
|
|
20
|
+
const record = value;
|
|
21
|
+
message = typeof record.message === "string" ? record.message : String(value);
|
|
22
|
+
if (typeof record.code === "string" && record.code !== "" && !message.includes(record.code)) code = record.code;
|
|
23
|
+
} else {
|
|
24
|
+
message = String(value);
|
|
25
|
+
}
|
|
26
|
+
const text = message.trim();
|
|
27
|
+
const composed = code === "" ? text : text === "" ? `[${code}]` : `${text} [${code}]`;
|
|
28
|
+
return truncate(composed === "" ? String(value) : composed, ERROR_SEGMENT_MAX);
|
|
29
|
+
}
|
|
30
|
+
function errorText(error) {
|
|
31
|
+
const seen = /* @__PURE__ */ new Set();
|
|
32
|
+
const segments = [];
|
|
33
|
+
let current = error;
|
|
34
|
+
while (current !== null && current !== void 0) {
|
|
35
|
+
if (seen.has(current) || segments.length >= ERROR_DEPTH_MAX) {
|
|
36
|
+
segments.push("\u2026");
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
seen.add(current);
|
|
40
|
+
segments.push(segmentOf(current));
|
|
41
|
+
current = current.cause;
|
|
42
|
+
}
|
|
43
|
+
let text = "";
|
|
44
|
+
for (let index = segments.length - 1; index >= 0; index -= 1) {
|
|
45
|
+
text = index === segments.length - 1 ? segments[index] : `${segments[index]} (caused by: ${text})`;
|
|
46
|
+
}
|
|
47
|
+
return truncate(text, ERROR_TEXT_MAX);
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
ERROR_DEPTH_MAX,
|
|
51
|
+
ERROR_SEGMENT_MAX,
|
|
52
|
+
ERROR_TEXT_MAX,
|
|
53
|
+
errorText
|
|
54
|
+
};
|
package/lib/mount.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as McpClientModule from "@deepseek-ai/dsh-mcp-client";
|
|
2
2
|
import { buildChildEnv, makeLookup, resolveEnv, resolveHeaders } from "./env.js";
|
|
3
|
+
import { errorText } from "./error-text.js";
|
|
3
4
|
import { isTokenFresh, parseToken } from "./oauth.js";
|
|
4
5
|
import { probeServer } from "./probe.js";
|
|
5
6
|
import { SERVER_NAME_RE, isLegacySecretRow, oauthRef } from "./refs.js";
|
|
@@ -9,9 +10,6 @@ const McpClient = {
|
|
|
9
10
|
Config: McpClientModule.Config,
|
|
10
11
|
apply: McpClientModule.apply
|
|
11
12
|
};
|
|
12
|
-
function errorText(error) {
|
|
13
|
-
return error instanceof Error ? error.message : String(error);
|
|
14
|
-
}
|
|
15
13
|
class MountManager {
|
|
16
14
|
/** 宿主上下文。 */
|
|
17
15
|
ctx;
|
package/lib/probe.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as McpClientModule from "@deepseek-ai/dsh-mcp-client";
|
|
2
2
|
import { createScope } from "@deepseek-ai/dsh-scope";
|
|
3
|
-
|
|
3
|
+
import { errorText } from "./error-text.js";
|
|
4
|
+
const PROBE_BUDGET_MS = 6e4;
|
|
4
5
|
const PROBE_OAUTH_BUDGET_MS = 5 * 6e4;
|
|
5
6
|
const McpClient = {
|
|
6
7
|
name: McpClientModule.name,
|
|
@@ -8,10 +9,6 @@ const McpClient = {
|
|
|
8
9
|
Config: McpClientModule.Config,
|
|
9
10
|
apply: McpClientModule.apply
|
|
10
11
|
};
|
|
11
|
-
function errorText(error) {
|
|
12
|
-
if (error instanceof Error) return error.message;
|
|
13
|
-
return String(error);
|
|
14
|
-
}
|
|
15
12
|
async function withBudget(promise, budgetMs) {
|
|
16
13
|
let timer;
|
|
17
14
|
try {
|
package/lib/service.js
CHANGED
|
@@ -85,6 +85,7 @@ import {
|
|
|
85
85
|
import { resolveDshPaths, resolveLocations, samePath, sourceDirectory } from "./files/locations.js";
|
|
86
86
|
import { readManagedBlock, writeManagedBlock } from "./files/patch-writer.js";
|
|
87
87
|
import { createDocumentText, removeEntry, setEntryEnabled, setTopLevelKey, upsertEntry } from "./files/writer.js";
|
|
88
|
+
import { errorText } from "./error-text.js";
|
|
88
89
|
import { MountManager } from "./mount.js";
|
|
89
90
|
import { globalRef } from "./refs.js";
|
|
90
91
|
import { canHoldCredentialRef, legacySecretRef, legacyServerRef, resolveOAuthRef, resolveServerRef } from "./refs.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp-ops",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "MCP 服务管理:增删改查与启停、连接测试、工具按需检索与全量注入、进程级与服务级环境变量(含密钥);MCP service management: CRUD, connection tests, tool injection, environment variables and secrets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"build:client": "node scripts/build-client.mjs",
|
|
90
90
|
"check:bundle": "node scripts/check-client-bundle.mjs",
|
|
91
91
|
"build:icons": "node scripts/build-icons.mjs",
|
|
92
|
-
"test": "node scripts/test.mjs"
|
|
92
|
+
"test": "node scripts/test.mjs",
|
|
93
|
+
"verify": "node scripts/verify.mjs"
|
|
93
94
|
}
|
|
94
95
|
}
|