dsh-mcp-ops 0.1.2 → 0.1.3

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 CHANGED
@@ -28,7 +28,7 @@ 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.2.tgz
31
+ dsh plugin --profile web add /path/to/dsh-mcp-ops-0.1.3.tgz
32
32
 
33
33
  # 卸载
34
34
  dsh plugin --profile web remove dsh-mcp-ops
@@ -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.2 -f docker/Dockerfile docker/ &&
73
+ docker build --progress=plain -t founder/dsh-mcp-ops:0.1.3 -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.2 --registry=https://registry.npmjs.org/
103
- git tag -a v0.1.2 -m "dsh-mcp-ops 0.1.2" && git push origin v0.1.2
102
+ npm view dsh-mcp-ops@0.1.3 --registry=https://registry.npmjs.org/
103
+ git tag -a v0.1.3 -m "dsh-mcp-ops 0.1.3" && git push origin v0.1.3
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
- const PROBE_BUDGET_MS = 15e3;
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.2",
3
+ "version": "0.1.3",
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",