@capyclaw/skills-service 0.1.0 → 0.1.1

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 (2) hide show
  1. package/package.json +18 -12
  2. package/server.mjs +24 -4
package/package.json CHANGED
@@ -1,12 +1,18 @@
1
- {
2
- "name": "@capyclaw/skills-service",
3
- "version": "0.1.0",
4
- "description": "DSH 独立技能服务:聚合 dsh-ppt-skill-* 的 SKILL.md 内容,HTTP 面暴露(GET /healthz、/skills、/skills/:name)。服务解耦标准形态:技能内容不再进程内注册,dsh 侧经 broker 的 skills 瘦客户端访问。",
5
- "type": "module",
6
- "main": "./server.mjs",
7
- "files": [
8
- "server.mjs",
9
- "README.md"
10
- ],
11
- "license": "MIT"
12
- }
1
+ {
2
+ "name": "@capyclaw/skills-service",
3
+ "version": "0.1.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
+ }
package/server.mjs CHANGED
@@ -67,16 +67,36 @@ async function loadProviders(dirs) {
67
67
  return providers
68
68
  }
69
69
 
70
- /** 候选技能目录:dev 树(../plugin/dsh-ppt-skill-*)+ 安装态(本目录同级
71
- * node_modules 里的 dsh-ppt-skill-*,套件捆绑布局)。 */
70
+ /** 候选技能目录:dev 树(../plugin/dsh-ppt-skill-*,磁盘目录保留旧名)+
71
+ * 安装态(node_modules 里的 @capyclaw/ppt-skill-*,套件捆绑布局)。
72
+ * 两种形态都要扫:包名已迁到 @capyclaw 作用域,但 dev 目录名未改。 */
72
73
  function defaultProviderDirs() {
73
- const roots = [path.resolve(HERE, '..', 'plugin'), path.resolve(HERE, '..')]
74
+ const roots = [
75
+ path.resolve(HERE, '..', 'plugin'),
76
+ path.resolve(HERE, '..'),
77
+ path.resolve(HERE, '..', '..', 'node_modules'),
78
+ path.resolve(HERE, '..', 'node_modules'),
79
+ path.resolve(HERE, 'node_modules'),
80
+ /* pnpm 安装态:本包真实路径在 <profile>/node_modules/.pnpm/<pkg>/node_modules/@capyclaw/skills-service,
81
+ * 上溯 4 级正好是 <profile>/node_modules(套件依赖平铺在这一层的 @capyclaw/ 下)。 */
82
+ path.resolve(HERE, '..', '..', '..', '..'),
83
+ ]
74
84
  const dirs = []
75
85
  for (const root of roots) {
76
86
  let entries = []
77
87
  try { entries = fs.readdirSync(root, { withFileTypes: true }) } catch { continue }
78
88
  for (const e of entries) {
79
- if (e.isDirectory() && e.name.startsWith('dsh-ppt-skill-')) dirs.push(path.join(root, e.name))
89
+ if (!e.isDirectory()) continue
90
+ if (e.name.startsWith('dsh-ppt-skill-')) {
91
+ dirs.push(path.join(root, e.name))
92
+ } else if (e.name === '@capyclaw') {
93
+ // 作用域目录:扫一层,收 ppt-skill-*
94
+ let scoped = []
95
+ try { scoped = fs.readdirSync(path.join(root, e.name), { withFileTypes: true }) } catch { continue }
96
+ for (const s of scoped) {
97
+ if (s.isDirectory() && s.name.startsWith('ppt-skill-')) dirs.push(path.join(root, e.name, s.name))
98
+ }
99
+ }
80
100
  }
81
101
  }
82
102
  return dirs