@capyclaw/skills-service 0.1.4 → 0.2.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.
Files changed (68) hide show
  1. package/README.md +3 -3
  2. package/node_modules/@capyclaw/foundation/README.md +51 -0
  3. package/node_modules/@capyclaw/foundation/abi/bridge.mjs +86 -0
  4. package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
  5. package/node_modules/@capyclaw/foundation/abi/index.mjs +35 -0
  6. package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
  7. package/node_modules/@capyclaw/foundation/abi/loader.mjs +345 -0
  8. package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
  9. package/node_modules/@capyclaw/foundation/abi/spec.mjs +255 -0
  10. package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
  11. package/node_modules/@capyclaw/foundation/abi/version.mjs +82 -0
  12. package/node_modules/@capyclaw/foundation/cordis.patch.yml +5 -0
  13. package/node_modules/@capyclaw/foundation/kit/index.mjs +6 -0
  14. package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +98 -0
  15. package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +35 -0
  16. package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +69 -0
  17. package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +55 -0
  18. package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
  19. package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +68 -0
  20. package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +113 -0
  21. package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +77 -0
  22. package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +56 -0
  23. package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +50 -0
  24. package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +64 -0
  25. package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +42 -0
  26. package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +34 -0
  27. package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +85 -0
  28. package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +50 -0
  29. package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +160 -0
  30. package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
  31. package/node_modules/@capyclaw/foundation/lib/kernel.mjs +185 -0
  32. package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +87 -0
  33. package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +60 -0
  34. package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +51 -0
  35. package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +188 -0
  36. package/node_modules/@capyclaw/foundation/package.json +53 -0
  37. package/node_modules/@capyclaw/foundation/runtime/index.mjs +20 -0
  38. package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +100 -0
  39. package/node_modules/@capyclaw/plugin-kit/README.md +70 -0
  40. package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +103 -0
  41. package/node_modules/@capyclaw/plugin-kit/package.json +69 -0
  42. package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +56 -0
  43. package/node_modules/@capyclaw/plugin-kit/src/config.mjs +142 -0
  44. package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +129 -0
  45. package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +139 -0
  46. package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +219 -0
  47. package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +13 -0
  48. package/node_modules/@capyclaw/plugin-kit/src/index.mjs +13 -0
  49. package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +230 -0
  50. package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +128 -0
  51. package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +307 -0
  52. package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +45 -0
  53. package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +113 -0
  54. package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +143 -0
  55. package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +131 -0
  56. package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +82 -0
  57. package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +109 -0
  58. package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +17 -0
  59. package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +89 -0
  60. package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +41 -0
  61. package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +150 -0
  62. package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +82 -0
  63. package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +132 -0
  64. package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +130 -0
  65. package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +656 -0
  66. package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
  67. package/package.json +10 -3
  68. package/server.mjs +49 -13
@@ -0,0 +1,181 @@
1
+ /**
2
+ * 极简跨平台 ZIP 读写(store + deflate 读,store 写;无外部依赖)——全仓单一真源。
3
+ *
4
+ * 之前三处实现各持一份(plugin-development 写 / tools-plugin-release 读 /
5
+ * @capyclaw/suite-kit zip-read 读),本模块合并之。旧位置保留兼容 shim。
6
+ *
7
+ * 写入:store 模式(内容不压缩,跨平台稳定,产物可被任何标准读取器读)。
8
+ * 读取:支持 store(0) 与 deflate(8);接受 Buffer 或文件路径——本地文件与
9
+ * 远端下载源共用同一条校验/解包路径。
10
+ */
11
+ import fs from 'node:fs'
12
+ import path from 'node:path'
13
+ import zlib from 'node:zlib'
14
+
15
+ /* ------------------------------------------------------------------ 写入 */
16
+
17
+ const CRC_TABLE = (() => {
18
+ const table = new Uint32Array(256)
19
+ for (let n = 0; n < 256; n++) {
20
+ let c = n
21
+ for (let k = 0; k < 8; k++) c = (c & 1) ? (0xedb88320 ^ (c >>> 1)) : (c >>> 1)
22
+ table[n] = c >>> 0
23
+ }
24
+ return table
25
+ })()
26
+
27
+ function crc32(buffer) {
28
+ let crc = 0xffffffff
29
+ for (let i = 0; i < buffer.length; i++) crc = CRC_TABLE[(crc ^ buffer[i]) & 0xff] ^ (crc >>> 8)
30
+ return (crc ^ 0xffffffff) >>> 0
31
+ }
32
+
33
+ function dosDateTime(date = new Date()) {
34
+ const year = Math.max(1980, date.getFullYear())
35
+ const time = ((date.getHours() & 0x1f) << 11) | ((date.getMinutes() & 0x3f) << 5) | (Math.floor(date.getSeconds() / 2) & 0x1f)
36
+ const day = (((year - 1980) & 0x7f) << 9) | (((date.getMonth() + 1) & 0x0f) << 5) | (date.getDate() & 0x1f)
37
+ return { time, day }
38
+ }
39
+
40
+ function walkFiles(dir, base = dir) {
41
+ const out = []
42
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
43
+ const full = path.join(dir, entry.name)
44
+ if (entry.isDirectory()) out.push(...walkFiles(full, base))
45
+ else if (entry.isFile()) out.push(path.relative(base, full).replace(/\\/g, '/'))
46
+ }
47
+ return out.sort()
48
+ }
49
+
50
+ /** 把目录写成 store 模式 ZIP。返回打包的相对路径列表。 */
51
+ export function writeZipFromDir(sourceDir, outFile) {
52
+ const files = walkFiles(sourceDir)
53
+ const now = dosDateTime()
54
+ const localParts = []
55
+ const centralParts = []
56
+ let offset = 0
57
+
58
+ for (const name of files) {
59
+ const data = fs.readFileSync(path.join(sourceDir, name))
60
+ const nameBytes = Buffer.from(name, 'utf8')
61
+ const crc = crc32(data)
62
+
63
+ const local = Buffer.alloc(30)
64
+ local.writeUInt32LE(0x04034b50, 0)
65
+ local.writeUInt16LE(20, 4)
66
+ local.writeUInt16LE(0x0800, 6)
67
+ local.writeUInt16LE(0, 8)
68
+ local.writeUInt16LE(now.time, 10)
69
+ local.writeUInt16LE(now.day, 12)
70
+ local.writeUInt32LE(crc, 14)
71
+ local.writeUInt32LE(data.length, 18)
72
+ local.writeUInt32LE(data.length, 22)
73
+ local.writeUInt16LE(nameBytes.length, 26)
74
+ local.writeUInt16LE(0, 28)
75
+ localParts.push(local, nameBytes, data)
76
+
77
+ const central = Buffer.alloc(46)
78
+ central.writeUInt32LE(0x02014b50, 0)
79
+ central.writeUInt16LE(20, 4)
80
+ central.writeUInt16LE(20, 6)
81
+ central.writeUInt16LE(0x0800, 8)
82
+ central.writeUInt16LE(0, 10)
83
+ central.writeUInt16LE(now.time, 12)
84
+ central.writeUInt16LE(now.day, 14)
85
+ central.writeUInt32LE(crc, 16)
86
+ central.writeUInt32LE(data.length, 20)
87
+ central.writeUInt32LE(data.length, 24)
88
+ central.writeUInt16LE(nameBytes.length, 28)
89
+ central.writeUInt16LE(0, 30)
90
+ central.writeUInt16LE(0, 32)
91
+ central.writeUInt16LE(0, 34)
92
+ central.writeUInt16LE(0, 36)
93
+ central.writeUInt32LE(0, 38)
94
+ central.writeUInt32LE(offset, 42)
95
+ centralParts.push(central, nameBytes)
96
+
97
+ offset += local.length + nameBytes.length + data.length
98
+ }
99
+
100
+ const centralBuffer = Buffer.concat(centralParts)
101
+ const eocd = Buffer.alloc(22)
102
+ eocd.writeUInt32LE(0x06054b50, 0)
103
+ eocd.writeUInt16LE(0, 4)
104
+ eocd.writeUInt16LE(0, 6)
105
+ eocd.writeUInt16LE(files.length, 8)
106
+ eocd.writeUInt16LE(files.length, 10)
107
+ eocd.writeUInt32LE(centralBuffer.length, 12)
108
+ eocd.writeUInt32LE(offset, 16)
109
+ eocd.writeUInt16LE(0, 20)
110
+
111
+ fs.mkdirSync(path.dirname(outFile), { recursive: true })
112
+ fs.writeFileSync(outFile, Buffer.concat([...localParts, centralBuffer, eocd]))
113
+ return files
114
+ }
115
+
116
+ /* ------------------------------------------------------------------ 读取 */
117
+
118
+ function locateEocd(data, label) {
119
+ for (let i = data.length - 22; i >= 0; i--) {
120
+ if (data.readUInt32LE(i) === 0x06054b50) return i
121
+ }
122
+ throw new Error(`不是有效的 ZIP: ${label}`)
123
+ }
124
+
125
+ /**
126
+ * 列出 ZIP 全部条目名。
127
+ * @param {Buffer|string} input - ZIP 字节或文件路径
128
+ */
129
+ export function listZipEntryNames(input, label = 'zip') {
130
+ const data = Buffer.isBuffer(input) ? input : fs.readFileSync(input)
131
+ const eocd = locateEocd(data, label)
132
+ const count = data.readUInt16LE(eocd + 10)
133
+ let offset = data.readUInt32LE(eocd + 16)
134
+ const names = []
135
+ for (let i = 0; i < count; i++) {
136
+ if (data.readUInt32LE(offset) !== 0x02014b50) throw new Error(`ZIP 中央目录损坏: ${label}`)
137
+ const nameLength = data.readUInt16LE(offset + 28)
138
+ const extraLength = data.readUInt16LE(offset + 30)
139
+ const commentLength = data.readUInt16LE(offset + 32)
140
+ names.push(data.subarray(offset + 46, offset + 46 + nameLength).toString('utf8'))
141
+ offset += 46 + nameLength + extraLength + commentLength
142
+ }
143
+ return names
144
+ }
145
+
146
+ /**
147
+ * 从 ZIP 读单个条目的原始字节;不存在返回 undefined。
148
+ * @param {Buffer|string} input - ZIP 字节或文件路径
149
+ */
150
+ export function readZipEntryBuffer(input, entryName, label = 'zip') {
151
+ const data = Buffer.isBuffer(input) ? input : fs.readFileSync(input)
152
+ const eocd = locateEocd(data, label)
153
+ const count = data.readUInt16LE(eocd + 10)
154
+ let offset = data.readUInt32LE(eocd + 16)
155
+ for (let i = 0; i < count; i++) {
156
+ if (data.readUInt32LE(offset) !== 0x02014b50) throw new Error(`ZIP 中央目录损坏: ${label}`)
157
+ const method = data.readUInt16LE(offset + 10)
158
+ const compSize = data.readUInt32LE(offset + 20)
159
+ const nameLength = data.readUInt16LE(offset + 28)
160
+ const extraLength = data.readUInt16LE(offset + 30)
161
+ const commentLength = data.readUInt16LE(offset + 32)
162
+ const localOffset = data.readUInt32LE(offset + 42)
163
+ const name = data.subarray(offset + 46, offset + 46 + nameLength).toString('utf8')
164
+ if (name === entryName) {
165
+ const localNameLength = data.readUInt16LE(localOffset + 26)
166
+ const localExtraLength = data.readUInt16LE(localOffset + 28)
167
+ const start = localOffset + 30 + localNameLength + localExtraLength
168
+ const body = data.subarray(start, start + compSize)
169
+ if (method === 0) return body
170
+ if (method === 8) return zlib.inflateRawSync(body)
171
+ throw new Error(`不支持的 ZIP 压缩方式 ${method}: ${label}`)
172
+ }
173
+ offset += 46 + nameLength + extraLength + commentLength
174
+ }
175
+ return undefined
176
+ }
177
+
178
+ /** 读取 ZIP 中央目录条目名(文件路径版;打包自检/测试用)。 */
179
+ export function listZipEntries(file) {
180
+ return listZipEntryNames(fs.readFileSync(file), file)
181
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capyclaw/skills-service",
3
- "version": "0.1.4",
3
+ "version": "0.2.2",
4
4
  "description": "DSH 独立技能服务:聚合 @capyclaw/ppt-skill-* 的 SKILL.md 内容,HTTP 面暴露(GET /healthz、/skills、/skills/:name)。服务解耦标准形态:技能内容不再进程内注册,dsh 侧经 broker 的 skills 瘦客户端访问。",
5
5
  "type": "module",
6
6
  "main": "./server.mjs",
@@ -15,13 +15,20 @@
15
15
  "README.md"
16
16
  ],
17
17
  "license": "MIT",
18
+ "dependencies": {
19
+ "@capyclaw/foundation": "^0.1.1"
20
+ },
18
21
  "repository": {
19
22
  "type": "git",
20
23
  "url": "git+https://github.com/Maple496/capyclaw.git",
21
- "directory": "extensions/bridges/ppt-bridge/capyclaw-skills-service"
24
+ "directory": "C/packages/capyclaw-skills-service"
22
25
  },
23
26
  "bugs": {
24
27
  "url": "https://github.com/Maple496/capyclaw/issues"
25
28
  },
26
- "homepage": "https://github.com/Maple496/capyclaw/tree/main/extensions/bridges/ppt-bridge/capyclaw-skills-service#readme"
29
+ "homepage": "https://github.com/Maple496/capyclaw/tree/main/A/projects/ppt/capyclaw-skills-service#readme",
30
+ "bundledDependencies": [
31
+ "@capyclaw/foundation",
32
+ "@capyclaw/plugin-kit"
33
+ ]
27
34
  }
package/server.mjs CHANGED
@@ -8,22 +8,28 @@
8
8
  * GET /skills 全量技能清单(汇总各 provider)
9
9
  * GET /skills/:name 单技能正文(原 provider.get 形状)
10
10
  *
11
- * dsh 侧经 dsh-service-broker 的 skills 瘦客户端(ctx.skills)访问本服务。
11
+ * dsh 侧经 @capyclaw/service-broker 的 skills 瘦客户端(ctx.skills)访问本服务。
12
12
  * 技能数据源 = 各 capyclaw-ppt-skill-* 插件目录(不搬内容,按目录聚合)。
13
13
  *
14
- * 由 dsh-service-broker 按清单拉起:
14
+ * 由 @capyclaw/service-broker 按清单拉起:
15
15
  * { "id": "dsh-skills",
16
16
  * "cmd": ["node", "<本目录>/server.mjs", "--port", "${PORT}"],
17
- * "ports": { "main": 39321 },
17
+ * "ports": { "main": "auto" },
18
18
  * "url": "http://127.0.0.1:${PORT}" }
19
+ *
20
+ * 端口一律由 broker 分配(`'auto'`);独立手跑时不指定 `--port` 则由 OS 随机分配
21
+ * (默认 0),真实端口见启动日志与 `/healthz`。**不要**在这里写死数字:写死会让
22
+ * 多套件/多实例互抢,也会把用户和文档绑在一个端口上。
19
23
  */
20
24
  import http from 'node:http'
21
25
  import fs from 'node:fs'
22
26
  import path from 'node:path'
23
27
  import { fileURLToPath, pathToFileURL } from 'node:url'
28
+ import { createKernel } from '@capyclaw/foundation/runtime'
24
29
 
25
30
  const HERE = path.dirname(fileURLToPath(import.meta.url))
26
- const DEFAULT_PORT = 39321
31
+ /** 0 = 交给 OS 分配(独立运行时的默认;broker 拉起时用 `--port ${PORT}` 显式给)。 */
32
+ const DEFAULT_PORT = 0
27
33
 
28
34
  function arg(name, dflt) {
29
35
  const i = process.argv.indexOf(name)
@@ -43,7 +49,8 @@ function loopback(method, url) {
43
49
  })
44
50
  }
45
51
 
46
- /** 收集技能 provider:目录列表,每个须含 lib/index.mjs(导出 createProvider)。 */
52
+ /** 收集技能 provider:每个插件目录含 plugin.mjs(foundation ABI)。
53
+ * 宿主只提供 ctx.skills,其余能力不承诺——与 dsh 里的装配路径完全一致。 */
47
54
  async function loadProviders(dirs) {
48
55
  const providers = []
49
56
  const seen = new Set()
@@ -51,14 +58,26 @@ async function loadProviders(dirs) {
51
58
  const key = path.resolve(dir).toLowerCase()
52
59
  if (seen.has(key)) continue
53
60
  seen.add(key)
54
- const entry = path.join(dir, 'lib', 'index.mjs')
61
+ const entry = path.join(dir, 'plugin.mjs')
55
62
  if (!fs.existsSync(entry)) continue
56
63
  try {
64
+ const registered = []
65
+ const ctx = {
66
+ skills: {
67
+ registerProvider(factory) {
68
+ registered.push(factory())
69
+ return () => {}
70
+ },
71
+ },
72
+ }
73
+ const kernel = createKernel(ctx)
74
+ ctx.os = kernel.os
57
75
  const mod = await import(pathToFileURL(entry).href)
58
- if (typeof mod.createProvider !== 'function') continue
59
- const provider = mod.createProvider({})
76
+ const dispose = mod.apply(ctx, {})
77
+ const provider = registered[0]
78
+ if (!provider) throw new Error('plugin.mjs 未注册 provider')
60
79
  const skills = await provider.list()
61
- providers.push({ dir, provider, skills })
80
+ providers.push({ dir, provider, skills, dispose, kernel })
62
81
  console.log(`[dsh-skills] provider ${path.basename(dir)}: ${skills.map((s) => s.name).join(', ') || '(空)'}`)
63
82
  } catch (err) {
64
83
  console.warn(`[dsh-skills] 跳过 ${path.basename(dir)}: ${err.message}`)
@@ -68,16 +87,31 @@ async function loadProviders(dirs) {
68
87
  }
69
88
 
70
89
  /** 候选技能目录:四种布局都要覆盖。
71
- * dev 树:../plugin/capyclaw-ppt-skill-*。
90
+ * dev 树:<repo>/projects/<项目>/artifacts/plugin/capyclaw-ppt-skill-*(构建产物目录)。
72
91
  * npm 扁平安装:node_modules/@capyclaw/ppt-skill-*——父目录本身就是 @capyclaw
73
92
  * 作用域目录,ppt-skill-* 是它的直接子项。
74
93
  * pnpm 提升可见时:<profile>/node_modules/@capyclaw/ppt-skill-*(同上)。
75
94
  * pnpm 严格布局:本包真实路径在 <profile>/node_modules/.pnpm/<pkg>/node_modules/@capyclaw/skills-service,
76
95
  * 上溯 4 级是 .pnpm;技能包以虚拟目录 @capyclaw+ppt-skill-<x>@<ver> 平铺在 .pnpm 下,
77
96
  * 每个虚拟目录的真实树在其 node_modules/@capyclaw/ 里。 */
97
+
98
+ /** dev 树里的技能包根:仓库根 A/projects/<项目>/artifacts/plugin(每个项目一个,互不混放)。 */
99
+ function devPluginRoots() {
100
+ const projectsDir = path.resolve(HERE, '..', '..', '..', 'A', 'projects')
101
+ const out = []
102
+ let entries = []
103
+ try { entries = fs.readdirSync(projectsDir, { withFileTypes: true }) } catch { return out }
104
+ for (const entry of entries) {
105
+ if (!entry.isDirectory()) continue
106
+ const root = path.join(projectsDir, entry.name, 'artifacts', 'plugin')
107
+ if (fs.existsSync(root)) out.push(root)
108
+ }
109
+ return out
110
+ }
111
+
78
112
  function defaultProviderDirs() {
79
113
  const roots = [
80
- path.resolve(HERE, '..', 'plugin'),
114
+ ...devPluginRoots(),
81
115
  path.resolve(HERE, '..'),
82
116
  path.resolve(HERE, '..', '..'),
83
117
  path.resolve(HERE, '..', '..', 'node_modules'),
@@ -118,15 +152,17 @@ function defaultProviderDirs() {
118
152
  }
119
153
 
120
154
  async function main() {
121
- const port = Number(arg('--port', process.env.PORT || DEFAULT_PORT)) || DEFAULT_PORT
155
+ const raw = arg('--port', process.env.PORT || DEFAULT_PORT)
156
+ const port = Number(raw) >= 0 ? Number(raw) : DEFAULT_PORT
122
157
  const providersArg = arg('--providers', '')
123
158
  const dirs = providersArg
124
159
  ? providersArg.split(path.delimiter === ';' ? ';' : ',').map((s) => s.trim()).filter(Boolean)
125
160
  : defaultProviderDirs()
126
161
 
127
162
  // 复用优先:端口上已是本服务(healthz 自报 dsh-skills)→ 直接退出 0,
128
- // 让中间件按「已有健康实例」收编,不双开。
163
+ // 让中间件按「已有健康实例」收编,不双开。端口为 0(OS 随机)时无从复用,跳过。
129
164
  try {
165
+ if (port === 0) throw new Error('no fixed port')
130
166
  const probe = await loopback('GET', `http://127.0.0.1:${port}/healthz`)
131
167
  if (probe.status === 200 && probe.text.includes('"dsh-skills"')) {
132
168
  console.log(`[dsh-skills] 端口 ${port} 已有本服务实例,复用退出`)