@capyclaw/skills-service 0.1.1 → 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/package.json +18 -18
- package/server.mjs +16 -8
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@capyclaw/skills-service",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "DSH 独立技能服务:聚合 @capyclaw/ppt-skill-* 的 SKILL.md 内容,HTTP 面暴露(GET /healthz、/skills、/skills/:name)。服务解耦标准形态:技能内容不再进程内注册,dsh 侧经 broker 的 skills 瘦客户端访问。",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./server.mjs",
|
|
7
|
-
"engines": {
|
|
8
|
-
"node": ">=18"
|
|
9
|
-
},
|
|
10
|
-
"publishConfig": {
|
|
11
|
-
"access": "public"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"server.mjs",
|
|
15
|
-
"README.md"
|
|
16
|
-
],
|
|
17
|
-
"license": "MIT"
|
|
18
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@capyclaw/skills-service",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "DSH 独立技能服务:聚合 @capyclaw/ppt-skill-* 的 SKILL.md 内容,HTTP 面暴露(GET /healthz、/skills、/skills/:name)。服务解耦标准形态:技能内容不再进程内注册,dsh 侧经 broker 的 skills 瘦客户端访问。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./server.mjs",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"server.mjs",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT"
|
|
18
|
+
}
|
package/server.mjs
CHANGED
|
@@ -67,34 +67,42 @@ async function loadProviders(dirs) {
|
|
|
67
67
|
return providers
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
70
|
+
/** 候选技能目录:三种布局都要覆盖。
|
|
71
|
+
* dev 树:../plugin/dsh-ppt-skill-*(磁盘目录保留旧名)。
|
|
72
|
+
* npm 扁平安装:node_modules/@capyclaw/ppt-skill-*——注意父目录本身就是 @capyclaw
|
|
73
|
+
* 作用域目录,ppt-skill-* 是它的直接子项,不是再嵌一层 @capyclaw。
|
|
74
|
+
* pnpm 安装:本包真实路径在 <profile>/node_modules/.pnpm/<pkg>/node_modules/@capyclaw/skills-service,
|
|
75
|
+
* 上溯 4 级是 <profile>/node_modules,套件依赖平铺在其 @capyclaw/ 下。 */
|
|
73
76
|
function defaultProviderDirs() {
|
|
74
77
|
const roots = [
|
|
75
78
|
path.resolve(HERE, '..', 'plugin'),
|
|
76
79
|
path.resolve(HERE, '..'),
|
|
80
|
+
path.resolve(HERE, '..', '..'),
|
|
77
81
|
path.resolve(HERE, '..', '..', 'node_modules'),
|
|
78
82
|
path.resolve(HERE, '..', 'node_modules'),
|
|
79
83
|
path.resolve(HERE, 'node_modules'),
|
|
80
|
-
/* pnpm 安装态:本包真实路径在 <profile>/node_modules/.pnpm/<pkg>/node_modules/@capyclaw/skills-service,
|
|
81
|
-
* 上溯 4 级正好是 <profile>/node_modules(套件依赖平铺在这一层的 @capyclaw/ 下)。 */
|
|
82
84
|
path.resolve(HERE, '..', '..', '..', '..'),
|
|
83
85
|
]
|
|
86
|
+
const seen = new Set()
|
|
84
87
|
const dirs = []
|
|
88
|
+
const add = (dir) => {
|
|
89
|
+
const key = path.resolve(dir)
|
|
90
|
+
if (!seen.has(key)) { seen.add(key); dirs.push(key) }
|
|
91
|
+
}
|
|
85
92
|
for (const root of roots) {
|
|
86
93
|
let entries = []
|
|
87
94
|
try { entries = fs.readdirSync(root, { withFileTypes: true }) } catch { continue }
|
|
88
95
|
for (const e of entries) {
|
|
89
96
|
if (!e.isDirectory()) continue
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
// dev 旧目录名 dsh-ppt-skill-* 与发布名 ppt-skill-* 都认(后者只在作用域目录下出现)
|
|
98
|
+
if (e.name.startsWith('dsh-ppt-skill-') || (root.endsWith('@capyclaw') && e.name.startsWith('ppt-skill-'))) {
|
|
99
|
+
add(path.join(root, e.name))
|
|
92
100
|
} else if (e.name === '@capyclaw') {
|
|
93
101
|
// 作用域目录:扫一层,收 ppt-skill-*
|
|
94
102
|
let scoped = []
|
|
95
103
|
try { scoped = fs.readdirSync(path.join(root, e.name), { withFileTypes: true }) } catch { continue }
|
|
96
104
|
for (const s of scoped) {
|
|
97
|
-
if (s.isDirectory() && s.name.startsWith('ppt-skill-'))
|
|
105
|
+
if (s.isDirectory() && s.name.startsWith('ppt-skill-')) add(path.join(root, e.name, s.name))
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
}
|