skill manager 添加脚本管理功能,支持写入和删除可复用脚本

This commit is contained in:
2026-05-15 17:07:52 +08:00
parent eebf802e31
commit 3e3deaa724
7 changed files with 127 additions and 8 deletions
+14 -4
View File
@@ -9,7 +9,7 @@ const skillStore = new SkillStore();
export default tool({
description:
"维护已验证、可复用、非敏感的 workflow 或方法模式。支持 list、append_pattern、remove_pattern、write_reference、remove_reference。",
"维护已验证、可复用、非敏感的 workflow 或方法模式。支持 list、append_pattern、remove_pattern、write_reference、remove_reference、write_script、remove_script。",
args: {
action: tool.schema
.enum([
@@ -18,6 +18,8 @@ export default tool({
"remove_pattern",
"write_reference",
"remove_reference",
"write_script",
"remove_script",
])
.describe("Skill maintenance operation."),
reason: tool.schema
@@ -41,11 +43,11 @@ export default tool({
file_path: tool.schema
.string()
.optional()
.describe("Reference file path under references/, such as references/bottleneck-notes.md."),
.describe("Asset file path. For references use references/*.md; for scripts use scripts/*.py."),
content: tool.schema
.string()
.optional()
.describe("Reference markdown body used by write_reference."),
.describe("Asset content used by write_reference or write_script."),
},
async execute(args, context) {
await initializePromise;
@@ -92,7 +94,15 @@ export default tool({
args.file_path ?? "",
args.content ?? "",
)
: await skillStore.removeReference(args.skill_path, args.file_path ?? "");
: args.action === "remove_reference"
? await skillStore.removeReference(args.skill_path, args.file_path ?? "")
: args.action === "write_script"
? await skillStore.writeScript(
args.skill_path,
args.file_path ?? "",
args.content ?? "",
)
: await skillStore.removeScript(args.skill_path, args.file_path ?? "");
return JSON.stringify({
ok: true,