@capyclaw/skills-service 0.1.0 → 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.
Files changed (2) hide show
  1. package/package.json +8 -2
  2. package/server.mjs +32 -4
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
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 瘦客户端访问。",
3
+ "version": "0.1.2",
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",
7
+ "engines": {
8
+ "node": ">=18"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
7
13
  "files": [
8
14
  "server.mjs",
9
15
  "README.md"
package/server.mjs CHANGED
@@ -67,16 +67,44 @@ 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
+ /** 候选技能目录:三种布局都要覆盖。
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/ 下。 */
72
76
  function defaultProviderDirs() {
73
- const roots = [path.resolve(HERE, '..', 'plugin'), path.resolve(HERE, '..')]
77
+ const roots = [
78
+ path.resolve(HERE, '..', 'plugin'),
79
+ path.resolve(HERE, '..'),
80
+ path.resolve(HERE, '..', '..'),
81
+ path.resolve(HERE, '..', '..', 'node_modules'),
82
+ path.resolve(HERE, '..', 'node_modules'),
83
+ path.resolve(HERE, 'node_modules'),
84
+ path.resolve(HERE, '..', '..', '..', '..'),
85
+ ]
86
+ const seen = new Set()
74
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
+ }
75
92
  for (const root of roots) {
76
93
  let entries = []
77
94
  try { entries = fs.readdirSync(root, { withFileTypes: true }) } catch { continue }
78
95
  for (const e of entries) {
79
- if (e.isDirectory() && e.name.startsWith('dsh-ppt-skill-')) dirs.push(path.join(root, e.name))
96
+ if (!e.isDirectory()) continue
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))
100
+ } else if (e.name === '@capyclaw') {
101
+ // 作用域目录:扫一层,收 ppt-skill-*
102
+ let scoped = []
103
+ try { scoped = fs.readdirSync(path.join(root, e.name), { withFileTypes: true }) } catch { continue }
104
+ for (const s of scoped) {
105
+ if (s.isDirectory() && s.name.startsWith('ppt-skill-')) add(path.join(root, e.name, s.name))
106
+ }
107
+ }
80
108
  }
81
109
  }
82
110
  return dirs