dsh-plugin-tool-management 0.1.3 → 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.
- package/README.md +211 -151
- package/README_EN.md +216 -151
- package/docs/images/agents-md.png +0 -0
- package/docs/images/history.png +0 -0
- package/docs/images/mcp.png +0 -0
- package/docs/images/skills.png +0 -0
- package/docs/images//345/234/272/346/231/257/350/256/260/345/277/206.png +0 -0
- package/lib/client.js +2123 -1407
- package/lib/index.js +117 -1
- package/lib/rules/provider.js +121 -0
- package/lib/rules/service.js +1657 -0
- package/lib/skills/core.js +10 -1
- package/lib/skills/service.js +5 -5
- package/package.json +10 -11
- package/screenshots.json +7 -0
package/lib/skills/core.js
CHANGED
|
@@ -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
|
}
|
package/lib/skills/service.js
CHANGED
|
@@ -91,8 +91,8 @@ async function permanentlyDeleteTrashSafely(id, log) {
|
|
|
91
91
|
}
|
|
92
92
|
// ── 文件监听:外部改动自动失效 ────────────────────────────────────────────
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
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
|
|
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(
|
|
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(
|
|
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.
|
|
4
|
-
"description": "DSH plugin: unified Skills and
|
|
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"
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"cordis.patch.yml",
|
|
21
21
|
"README.md",
|
|
22
22
|
"README_EN.md",
|
|
23
|
-
"LICENSE"
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"screenshots.json",
|
|
25
|
+
"docs"
|
|
24
26
|
],
|
|
25
27
|
"engines": {
|
|
26
28
|
"node": ">=18"
|
|
@@ -32,9 +34,6 @@
|
|
|
32
34
|
"scripts": {
|
|
33
35
|
"build": "tsc -p tsconfig.json && node scripts/sync-client.mjs",
|
|
34
36
|
"build:client": "node scripts/sync-client.mjs",
|
|
35
|
-
"test": "npm run build && node --test",
|
|
36
|
-
"test:fast": "node --test",
|
|
37
|
-
"test:client": "node scripts/sync-client.mjs && node --test tests/client.test.mjs",
|
|
38
37
|
"prepublishOnly": "npm run build",
|
|
39
38
|
"lint": "node --check lib/client.js && node --check lib/index.js"
|
|
40
39
|
},
|
|
@@ -62,11 +61,11 @@
|
|
|
62
61
|
},
|
|
63
62
|
"peerDependencies": {
|
|
64
63
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
65
|
-
"@deepseek-ai/dsh-tools": "
|
|
66
|
-
"@deepseek-ai/dsh-workspace": "
|
|
67
|
-
"@deepseek-ai/dsh-spill-local": "
|
|
68
|
-
"@deepseek-ai/dsh-session-projection-cache": "
|
|
69
|
-
"@deepseek-ai/dsh-storage-domain": "
|
|
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",
|
|
70
69
|
"react": "^18.2.0"
|
|
71
70
|
},
|
|
72
71
|
"devDependencies": {
|