dsh-plugin-tool-management 0.1.2 → 0.2.0

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.
@@ -2223,6 +2223,7 @@ export async function createSkill(input, log, options = {}) {
2223
2223
  const name = toKebab(requestedName);
2224
2224
  const description = String((input && input.description) || "").trim();
2225
2225
  const body = String((input && input.body) || "").trim();
2226
+ const form = String((input && input.form) || "bundle") === "flat" ? "flat" : "bundle";
2226
2227
  if (!name || !KEBAB_RE.test(name) || entryPath(root, name) === null)
2227
2228
  return {
2228
2229
  ok: false,
@@ -2252,11 +2253,19 @@ export async function createSkill(input, log, options = {}) {
2252
2253
  params: { name },
2253
2254
  };
2254
2255
  await fs.mkdir(root, { recursive: true });
2256
+ const content = `---\nname: ${name}\ndescription: ${yamlString(description)}\n---\n\n${body}\n`;
2257
+ if (form === "flat") {
2258
+ // flat 形态:直接写 <root>/<name>.md(规则/单文件技能用;bundle 见下方目录分支)
2259
+ const flatPath = resolve(root, `${name}.md`);
2260
+ await writeFileAtomically(flatPath, content);
2261
+ if (log)
2262
+ log("create", `创建 ${flatPath}`);
2263
+ return { name, path: flatPath, root: definition.key };
2264
+ }
2255
2265
  const target = entryPath(root, name);
2256
2266
  const stage = temporaryPath(target, "create");
2257
2267
  try {
2258
2268
  await fs.mkdir(stage);
2259
- const content = `---\nname: ${name}\ndescription: ${yamlString(description)}\n---\n\n${body}\n`;
2260
2269
  await fs.writeFile(join(stage, "SKILL.md"), content, "utf8");
2261
2270
  await fs.rename(stage, target);
2262
2271
  }
@@ -91,8 +91,8 @@ async function permanentlyDeleteTrashSafely(id, log) {
91
91
  }
92
92
  // ── 文件监听:外部改动自动失效 ────────────────────────────────────────────
93
93
  /**
94
- * 监听技能来源目录,200ms 防抖后失效 provider 缓存:在编辑器或其他工具里
95
- * 新增/修改/删除技能后,无需手动刷新即可出现在列表里。
94
+ * 监听目录,200ms 防抖后回调:在编辑器或其他工具里新增/修改/删除文件后,无需手动
95
+ * 刷新即可看到变化。技能来源与规则根目录共用(见 src/rules/service.ts 的场景记忆段缓存)。
96
96
  *
97
97
  * 为什么用 worker_threads:Windows 上 fs.watch(recursive) 的句柄在「被监听
98
98
  * 目录被删除」时会静默卡死事件循环(不触发 error、unref 也无效)——宿主
@@ -100,7 +100,7 @@ async function permanentlyDeleteTrashSafely(id, log) {
100
100
  * unref(),无论目录发生什么,宿主与测试进程都能正常收尾;worker 内部失败
101
101
  * 也不影响主线程。目录不存在或平台不支持递归监听时静默跳过。
102
102
  */
103
- function watchSkillRoots(paths, invalidate) {
103
+ function watchDirectories(paths, invalidate) {
104
104
  const valid = paths.filter((dir) => dir && existsSync(dir));
105
105
  if (!valid.length)
106
106
  return () => { };
@@ -350,7 +350,7 @@ export function createSkillsService(ctx) {
350
350
  }
351
351
  try {
352
352
  const watchPaths = roots.map((root) => String((root && root.path) || '')).filter(Boolean);
353
- disposers.push(watchSkillRoots(watchPaths, invalidateSkills));
353
+ disposers.push(watchDirectories(watchPaths, invalidateSkills));
354
354
  // 自定义目录在状态文件里,注册时读取一次并一并监听(后添加的目录由
355
355
  // provider 首次 list 天然覆盖,等插件重载后才有 watcher)。
356
356
  readManagerState()
@@ -359,7 +359,7 @@ export function createSkillsService(ctx) {
359
359
  .map((root) => String((root && root.path) || ''))
360
360
  .filter(Boolean);
361
361
  if (customPaths.length)
362
- disposers.push(watchSkillRoots(customPaths, invalidateSkills));
362
+ disposers.push(watchDirectories(customPaths, invalidateSkills));
363
363
  })
364
364
  .catch(() => { });
365
365
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-plugin-tool-management",
3
- "version": "0.1.2",
4
- "description": "DSH plugin: unified Skills and MCP manager — Settings UI + HTTP API + model-facing skill_mcp_manager_* / skill_manager_* tools. Install with one command: dsh plugin --profile web add dsh-plugin-tool-management@latest",
3
+ "version": "0.2.0",
4
+ "description": "DSH plugin: unified MCP, Skills, AGENTS.md presets, archived-session and scene-memory manager — Settings UI + HTTP API + model-facing skill_mcp_manager_* / skill_manager_* / rule_manager_* tools. Install with one command: dsh plugin --profile web add dsh-plugin-tool-management@latest",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/ouli-1242/dsh-plugin-tool-management"
@@ -11,6 +11,8 @@
11
11
  "exports": {
12
12
  ".": "./lib/index.js",
13
13
  "./client": "./lib/client.js",
14
+ "./workspace": "./lib/history/workspace.js",
15
+ "./projcache": "./lib/history/projcache.js",
14
16
  "./package.json": "./package.json"
15
17
  },
16
18
  "files": [
@@ -18,7 +20,9 @@
18
20
  "cordis.patch.yml",
19
21
  "README.md",
20
22
  "README_EN.md",
21
- "LICENSE"
23
+ "LICENSE",
24
+ "screenshots.json",
25
+ "docs"
22
26
  ],
23
27
  "engines": {
24
28
  "node": ">=18"
@@ -30,9 +34,6 @@
30
34
  "scripts": {
31
35
  "build": "tsc -p tsconfig.json && node scripts/sync-client.mjs",
32
36
  "build:client": "node scripts/sync-client.mjs",
33
- "test": "npm run build && node --test",
34
- "test:fast": "node --test",
35
- "test:client": "node scripts/sync-client.mjs && node --test tests/client.test.mjs",
36
37
  "prepublishOnly": "npm run build",
37
38
  "lint": "node --check lib/client.js && node --check lib/index.js"
38
39
  },
@@ -59,12 +60,21 @@
59
60
  }
60
61
  },
61
62
  "peerDependencies": {
62
- "@deepseek-ai/dsh-tools": "^0.1.2-rc.1",
63
+ "@deepseek-ai/cordis": "^4.0.1",
64
+ "@deepseek-ai/dsh-tools": ">=0.1.5-rc.2 <0.2.0-0",
65
+ "@deepseek-ai/dsh-workspace": ">=0.1.5-rc.2 <0.2.0-0",
66
+ "@deepseek-ai/dsh-spill-local": ">=0.1.5-rc.2 <0.2.0-0",
67
+ "@deepseek-ai/dsh-session-projection-cache": ">=0.1.5-rc.2 <0.2.0-0",
68
+ "@deepseek-ai/dsh-storage-domain": ">=0.1.5-rc.2 <0.2.0-0",
63
69
  "react": "^18.2.0"
64
70
  },
65
71
  "devDependencies": {
66
72
  "@deepseek-ai/cordis": "^4.0.1",
67
- "@deepseek-ai/dsh-tools": "^0.1.2-rc.1",
73
+ "@deepseek-ai/dsh-session-projection-cache": "^0.1.5-rc.2",
74
+ "@deepseek-ai/dsh-spill-local": "^0.1.5-rc.2",
75
+ "@deepseek-ai/dsh-storage-domain": "^0.1.5-rc.2",
76
+ "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
77
+ "@deepseek-ai/dsh-workspace": "^0.1.5-rc.2",
68
78
  "@types/node": "^24.0.0",
69
79
  "typescript": "^6.0.0"
70
80
  },
@@ -0,0 +1,7 @@
1
+ [
2
+ "docs/images/mcp.png",
3
+ "docs/images/skills.png",
4
+ "docs/images/agents-md.png",
5
+ "docs/images/history.png",
6
+ "docs/images/场景记忆.png"
7
+ ]