@capyclaw/skills-service 0.1.1 → 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/package.json +18 -18
- package/server.mjs +23 -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.3",
|
|
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,35 +67,50 @@ 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-* 是它的直接子项。
|
|
74
|
+
* pnpm 提升可见时:<profile>/node_modules/@capyclaw/ppt-skill-*(同上)。
|
|
75
|
+
* pnpm 严格布局:本包真实路径在 <profile>/node_modules/.pnpm/<pkg>/node_modules/@capyclaw/skills-service,
|
|
76
|
+
* 上溯 4 级是 .pnpm;技能包以虚拟目录 @capyclaw+ppt-skill-<x>@<ver> 平铺在 .pnpm 下,
|
|
77
|
+
* 每个虚拟目录的真实树在其 node_modules/@capyclaw/ 里。 */
|
|
73
78
|
function defaultProviderDirs() {
|
|
74
79
|
const roots = [
|
|
75
80
|
path.resolve(HERE, '..', 'plugin'),
|
|
76
81
|
path.resolve(HERE, '..'),
|
|
82
|
+
path.resolve(HERE, '..', '..'),
|
|
77
83
|
path.resolve(HERE, '..', '..', 'node_modules'),
|
|
78
84
|
path.resolve(HERE, '..', 'node_modules'),
|
|
79
85
|
path.resolve(HERE, 'node_modules'),
|
|
80
|
-
/* pnpm 安装态:本包真实路径在 <profile>/node_modules/.pnpm/<pkg>/node_modules/@capyclaw/skills-service,
|
|
81
|
-
* 上溯 4 级正好是 <profile>/node_modules(套件依赖平铺在这一层的 @capyclaw/ 下)。 */
|
|
82
86
|
path.resolve(HERE, '..', '..', '..', '..'),
|
|
83
87
|
]
|
|
88
|
+
const seen = new Set()
|
|
84
89
|
const dirs = []
|
|
90
|
+
const add = (dir) => {
|
|
91
|
+
const key = path.resolve(dir)
|
|
92
|
+
if (!seen.has(key)) { seen.add(key); dirs.push(key) }
|
|
93
|
+
}
|
|
85
94
|
for (const root of roots) {
|
|
86
95
|
let entries = []
|
|
87
96
|
try { entries = fs.readdirSync(root, { withFileTypes: true }) } catch { continue }
|
|
88
97
|
for (const e of entries) {
|
|
89
98
|
if (!e.isDirectory()) continue
|
|
90
|
-
|
|
91
|
-
|
|
99
|
+
// dev 旧目录名 dsh-ppt-skill-* 与发布名 ppt-skill-* 都认(后者只在作用域目录下出现)
|
|
100
|
+
if (e.name.startsWith('dsh-ppt-skill-') || (root.endsWith('@capyclaw') && e.name.startsWith('ppt-skill-'))) {
|
|
101
|
+
add(path.join(root, e.name))
|
|
92
102
|
} else if (e.name === '@capyclaw') {
|
|
93
103
|
// 作用域目录:扫一层,收 ppt-skill-*
|
|
94
104
|
let scoped = []
|
|
95
105
|
try { scoped = fs.readdirSync(path.join(root, e.name), { withFileTypes: true }) } catch { continue }
|
|
96
106
|
for (const s of scoped) {
|
|
97
|
-
if (s.isDirectory() && s.name.startsWith('ppt-skill-'))
|
|
107
|
+
if (s.isDirectory() && s.name.startsWith('ppt-skill-')) add(path.join(root, e.name, s.name))
|
|
98
108
|
}
|
|
109
|
+
} else if (e.name.startsWith('@capyclaw+ppt-skill-') && e.name.includes('@', '@capyclaw+ppt-skill-'.length)) {
|
|
110
|
+
// pnpm 虚拟目录:@capyclaw+ppt-skill-<x>@<version> → 真实树在 <dir>/node_modules/@capyclaw/<x>
|
|
111
|
+
const base = e.name.slice('@capyclaw+'.length).split('@')[0]
|
|
112
|
+
const real = path.join(root, e.name, 'node_modules', '@capyclaw', base)
|
|
113
|
+
if (fs.existsSync(path.join(real, 'package.json'))) add(real)
|
|
99
114
|
}
|
|
100
115
|
}
|
|
101
116
|
}
|