@lmzhen/dsh-tool-skill-manage 0.51.1 → 0.53.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 +3 -2
- package/lib/index.js +27 -15
- package/lib/types/skill-actions.d.ts +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@ Model-facing `skill_manage` tool for reading and mutating reusable skills. It sh
|
|
|
4
4
|
|
|
5
5
|
## Actions
|
|
6
6
|
|
|
7
|
-
`review`, `list`, `create`, `
|
|
7
|
+
`review`, `list`, `create`, `update`, `patch`, `delete`, `write_file`, `remove_file`, `restructure`, `extract`, `feedback`, `pin`, and `unpin`.
|
|
8
8
|
|
|
9
|
-
Create/
|
|
9
|
+
Create/update take a complete `SKILL.md`; patch replaces the first anchor unless `replace_all=true`. Support files are addressed by `file_path`. Restructure moves a body section into a support file; extract moves a reusable part into an existing owner skill. Delete archives to `.archive`, with `absorbed_into` recording an umbrella where applicable.
|
|
10
10
|
|
|
11
11
|
Created or edited skill files require valid YAML frontmatter. Protected bundled/hub skills reject mutation; pinned skills reject deletion and are read-only to background review.
|
|
12
12
|
|
|
@@ -19,3 +19,4 @@ The four authoring caps are tighten-only at the user layer: `skillContentChars`,
|
|
|
19
19
|
History keeps the configured number of content versions per skill. Older version entries leave the index, but their stored blobs currently have no automatic sweep, so long-lived libraries can retain historical bytes.
|
|
20
20
|
|
|
21
21
|
`maxSkillContentChars` remains a readable deprecated alias of `skillContentChars`; writes to the old name are refused (G0/S0.3).
|
|
22
|
+
|
package/lib/index.js
CHANGED
|
@@ -24,12 +24,6 @@ const SKILL_ACTIONS = Object.freeze({
|
|
|
24
24
|
gate: "write",
|
|
25
25
|
summary: "host"
|
|
26
26
|
},
|
|
27
|
-
edit: {
|
|
28
|
-
mutates: true,
|
|
29
|
-
needsName: true,
|
|
30
|
-
gate: "write",
|
|
31
|
-
summary: "host"
|
|
32
|
-
},
|
|
33
27
|
update: {
|
|
34
28
|
mutates: true,
|
|
35
29
|
needsName: true,
|
|
@@ -40,7 +34,7 @@ const SKILL_ACTIONS = Object.freeze({
|
|
|
40
34
|
mutates: true,
|
|
41
35
|
needsName: true,
|
|
42
36
|
gate: "write",
|
|
43
|
-
summary: "
|
|
37
|
+
summary: "required"
|
|
44
38
|
},
|
|
45
39
|
delete: {
|
|
46
40
|
mutates: true,
|
|
@@ -740,6 +734,11 @@ function apply(ctx, rawConfig = {}) {
|
|
|
740
734
|
message: "背景审查不能执行 extract:review 只提议;提取必须由显式前台工具/命令执行。",
|
|
741
735
|
skills: []
|
|
742
736
|
};
|
|
737
|
+
if (action === "patch" && change === void 0) return {
|
|
738
|
+
ok: false,
|
|
739
|
+
message: "插件升级后,动作「patch」必须提供 summary(一句变更原因)。\n这是升级前的暂存记录,之后的「patch」会带有 summary。",
|
|
740
|
+
skills: []
|
|
741
|
+
};
|
|
743
742
|
if ((action === "restructure" || action === "extract" || action === "delete") && origin !== "foreground" && change === void 0) return {
|
|
744
743
|
ok: false,
|
|
745
744
|
message: `动作「${action}」的后台写入必须提供 summary(一句变更原因)。`,
|
|
@@ -779,10 +778,21 @@ function apply(ctx, rawConfig = {}) {
|
|
|
779
778
|
message: "反馈服务未挂载,未记录。",
|
|
780
779
|
skills: []
|
|
781
780
|
};
|
|
782
|
-
|
|
781
|
+
if (args.rating !== void 0) return {
|
|
782
|
+
ok: false,
|
|
783
|
+
message: "rating 已移除:feedback 只记录负向报错,不支持正反馈。",
|
|
784
|
+
skills: []
|
|
785
|
+
};
|
|
786
|
+
const note = typeof args.note === "string" ? args.note.trim() : "";
|
|
787
|
+
if ([...note].length > 20) return {
|
|
788
|
+
ok: false,
|
|
789
|
+
message: `报错说明为 ${[...note].length} 个字符,超过 20 上限。`,
|
|
790
|
+
skills: []
|
|
791
|
+
};
|
|
792
|
+
service.record(name, "negative", note === "" ? args.problem : note, "skill");
|
|
783
793
|
return {
|
|
784
794
|
ok: true,
|
|
785
|
-
message: `已记录对「${name}
|
|
795
|
+
message: `已记录对「${name}」的报错反馈。`,
|
|
786
796
|
skills: []
|
|
787
797
|
};
|
|
788
798
|
}
|
|
@@ -804,7 +814,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
804
814
|
let feedbackLines = [];
|
|
805
815
|
const stagedAnchor = typeof args.staged_from_sha256 === "string" && args.staged_from_sha256 !== "" ? args.staged_from_sha256 === "absent" ? { absent: true } : { sha256: args.staged_from_sha256 } : void 0;
|
|
806
816
|
let candidateDescription = "";
|
|
807
|
-
if ((action === "create" || action === "
|
|
817
|
+
if ((action === "create" || action === "update") && args.content) {
|
|
808
818
|
const parsed = parseFrontmatter(args.content);
|
|
809
819
|
if (parsed) {
|
|
810
820
|
const feedback = authoringFeedback(parsed.frontmatter);
|
|
@@ -824,7 +834,6 @@ function apply(ctx, rawConfig = {}) {
|
|
|
824
834
|
feedbackLines.push(...await duplicateHintLines(name, candidateDescription, crossSourceView));
|
|
825
835
|
return library.create(name, args.content ?? "", origin, { managed: origin !== "foreground" });
|
|
826
836
|
},
|
|
827
|
-
edit: () => library.update(name, args.content ?? "", origin, stagedAnchor),
|
|
828
837
|
update: () => library.update(name, args.content ?? "", origin, stagedAnchor),
|
|
829
838
|
patch: async () => {
|
|
830
839
|
const section = args.section;
|
|
@@ -1067,7 +1076,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1067
1076
|
}
|
|
1068
1077
|
registerEvolutionTool(ctx, defineTool({
|
|
1069
1078
|
name: "skill_manage",
|
|
1070
|
-
description: "Manage reusable skills. review returns the library review text (state/usage/quality per skill); list returns names only; create/
|
|
1079
|
+
description: "Manage reusable skills. review returns the library review text (state/usage/quality per skill); list returns names only; create/update take full SKILL.md content; patch applies old_string -> new_string; delete archives to .archive (absorbed_into names an umbrella skill); write_file/remove_file add or remove one support file under references/ or scripts/; pin protects a skill from deletion, background review, and the lifecycle (pin/unpin are never allowed from a background review — foreground and delegated subagents may). Per-action arguments: patch needs name + old_string + new_string and patches SKILL.md unless file_path names a support file (e.g. \"references/topic.md\"); patch replaces the FIRST occurrence only unless replace_all=true, and the result message reports how many anchors the file carried. patch also accepts section: {heading, start?, end?, content} to replace one H2 section content (or an exact sub-block) in place without resending the old text; the heading line is kept for a whole-section edit. write_file needs name + file_path + file_content; remove_file needs name + file_path; create/update need name + content; delete needs name. A rejected patch names the reason and the remedy (missing anchor, stale snapshot, frontmatter that cannot be auto-quoted, byte/char limit). Protected bundled/hub skills reject any mutation; pinned skills reject deletion and are read-only to the background review.feedback records a negative report for a loaded skill; it may include note (max 20 Unicode characters). Prefer patching an umbrella over creating narrow skills. restructure moves entire body sections (by their exact \"## heading\" line, or an optional start/end sub-block, via restructure: [{heading, start?, end?, to_file: \"references/<topic>.md\"}]) into a references/ file and replaces each with a pointer line — the skill name and directory never change. extract moves a reusable part (exact heading, optional start/end sub-block) into an existing class-level owner: extract: [{heading, start?, end?, to_skill}]. One target per call; an empty extract list returns the child-agent proposal (outcome/target/neededOwner/parts) without writing; supply extract items to apply, and use owner_covers only as an explicit override; owner-gap is reported, never auto-created.Created/edited SKILL.md MUST start with YAML frontmatter (a name/description block), or creation is rejected. " + DSH_AUTHORING_STANDARDS,
|
|
1071
1080
|
parameters: {
|
|
1072
1081
|
action: {
|
|
1073
1082
|
type: "string",
|
|
@@ -1076,7 +1085,6 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1076
1085
|
"review",
|
|
1077
1086
|
"list",
|
|
1078
1087
|
"create",
|
|
1079
|
-
"edit",
|
|
1080
1088
|
"update",
|
|
1081
1089
|
"patch",
|
|
1082
1090
|
"delete",
|
|
@@ -1099,7 +1107,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1099
1107
|
absorbed_into: { type: "string" },
|
|
1100
1108
|
summary: {
|
|
1101
1109
|
type: "string",
|
|
1102
|
-
description: "One-line change summary for the skill history. Required for restructure/extract/delete in model-origin writes; max 50 Unicode characters by default, over-limit is rejected with the current limit."
|
|
1110
|
+
description: "One-line change summary for the skill history. Required for every model patch and for restructure/extract/delete in model-origin writes; max 50 Unicode characters by default, over-limit is rejected with the current limit."
|
|
1103
1111
|
},
|
|
1104
1112
|
problem: {
|
|
1105
1113
|
type: "string",
|
|
@@ -1111,6 +1119,10 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1111
1119
|
],
|
|
1112
1120
|
description: "feedback only: why the loaded skill did not help."
|
|
1113
1121
|
},
|
|
1122
|
+
note: {
|
|
1123
|
+
type: "string",
|
|
1124
|
+
description: "feedback only: optional short explanation for the negative report; max 20 Unicode characters (runtime-enforced)."
|
|
1125
|
+
},
|
|
1114
1126
|
section: {
|
|
1115
1127
|
type: "object",
|
|
1116
1128
|
additionalProperties: false,
|
|
@@ -1243,7 +1255,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1243
1255
|
};
|
|
1244
1256
|
const approval = approvalSeam;
|
|
1245
1257
|
if (approval && !isReadOnlyAction(args.action)) {
|
|
1246
|
-
if (
|
|
1258
|
+
if (args.action === "update" && typeof args.name === "string" && args.name !== "") {
|
|
1247
1259
|
let stageCurrent;
|
|
1248
1260
|
try {
|
|
1249
1261
|
stageCurrent = await library.read(args.name);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* an action list.
|
|
6
6
|
*/
|
|
7
7
|
import type { SkillActionResult } from '@lmzhen/dsh-evolution-core/skills';
|
|
8
|
-
export type SkillActionId = 'list' | 'review' | 'create' | '
|
|
8
|
+
export type SkillActionId = 'list' | 'review' | 'create' | 'update' | 'patch' | 'delete' | 'write_file' | 'remove_file' | 'restructure' | 'extract' | 'feedback' | 'pin' | 'unpin';
|
|
9
9
|
export interface SkillActionMeta {
|
|
10
10
|
/** Does this action write skill bytes (and therefore enter usage/journal)? */
|
|
11
11
|
readonly mutates: boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-tool-skill-manage",
|
|
3
3
|
"description": "Model-facing skill_manage tool (community build)",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.53.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -29,23 +29,23 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
32
|
-
"@lmzhen/dsh-evolution-approval": "^0.
|
|
33
|
-
"@lmzhen/dsh-evolution-core": "^0.
|
|
34
|
-
"@lmzhen/dsh-evolution-skill-discovery": "^0.
|
|
32
|
+
"@lmzhen/dsh-evolution-approval": "^0.53.0",
|
|
33
|
+
"@lmzhen/dsh-evolution-core": "^0.53.0",
|
|
34
|
+
"@lmzhen/dsh-evolution-skill-discovery": "^0.53.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
38
38
|
"@deepseek-ai/dsh-skill": "^0.2.2-rc.3",
|
|
39
39
|
"@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.3",
|
|
40
40
|
"@deepseek-ai/dsh-agent": "^0.2.2-rc.3",
|
|
41
|
-
"@lmzhen/dsh-evolution-skill-discovery": "^0.
|
|
41
|
+
"@lmzhen/dsh-evolution-skill-discovery": "^0.53.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@deepseek-ai/dsh-agent-loop-testkit": "^0.2.2-rc.3",
|
|
45
45
|
"@deepseek-ai/dsh-skill": "^0.2.2-rc.3",
|
|
46
46
|
"@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.3",
|
|
47
|
-
"@lmzhen/dsh-evolution-core": "^0.
|
|
48
|
-
"@lmzhen/dsh-evolution-skill-discovery": "^0.
|
|
47
|
+
"@lmzhen/dsh-evolution-core": "^0.53.0",
|
|
48
|
+
"@lmzhen/dsh-evolution-skill-discovery": "^0.53.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"dsh": ">=0.2.2-rc.3 <0.2.3-0"
|