@lmzhen/dsh-tool-skill-manage 0.50.0 → 0.51.1
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/lib/index.js +137 -25
- package/lib/types/index.d.ts +4 -0
- package/lib/types/skill-actions.d.ts +3 -1
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -1,75 +1,94 @@
|
|
|
1
1
|
import { defineTool, registerEvolutionTool, settingsPort, skillsPort } from "@lmzhen/dsh-evolution-core/platform";
|
|
2
|
-
import { DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_CITATION_POLICY, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_VERSION_KEEP, DEFAULT_SUPPORT_FILE_CHAR_POLICY, DEFAULT_WRITE_CONFIRM_MODE, DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, DSH_AUTHORING_STANDARDS, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, authorityFrom, callingScope, clampOnce, computeDedupGroups, contentHash, createSubagentChannel, evolutionIoAdapter, fuzzyPatch, isPresent, isUnknown, liveBool, nearDuplicateSummaries, paramRowId, policyStageLimits, probePresent, probeUnknown, protectedSkillNamesOf, runWriteGates, skillWriteGateContext, unwrapLive, userSetKeys } from "@lmzhen/dsh-evolution-core";
|
|
2
|
+
import { DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_CITATION_POLICY, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_VERSION_KEEP, DEFAULT_SUPPORT_FILE_CHAR_POLICY, DEFAULT_WRITE_CONFIRM_MODE, DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, DSH_AUTHORING_STANDARDS, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, authorityFrom, callingScope, clampOnce, computeDedupGroups, contentHash, createSubagentChannel, currentReviewContext, evolutionIoAdapter, fuzzyPatch, isPresent, isUnknown, liveBool, nearDuplicateSummaries, paramRowId, policyStageLimits, probePresent, probeUnknown, protectedSkillNamesOf, runWriteGates, skillWriteGateContext, unwrapLive, userSetKeys } from "@lmzhen/dsh-evolution-core";
|
|
3
3
|
import { effectiveSessionPolicy } from "@lmzhen/dsh-evolution-approval";
|
|
4
4
|
import z from "@deepseek-ai/schemastery";
|
|
5
|
-
import { DEFAULT_HEALTH_THRESHOLDS, anchorVerdict, authoringFeedback, newSkillLibrary, normalizeFrontmatter, parseFrontmatter, resolveExecOrigins, sessionReadSkillNames, sessionReadSupportFiles } from "@lmzhen/dsh-evolution-core/skills";
|
|
5
|
+
import { DEFAULT_HEALTH_THRESHOLDS, DEFAULT_SKILL_WRITE_SUMMARY_CHARS, anchorVerdict, authoringFeedback, newSkillLibrary, normalizeChangeSummary, normalizeFrontmatter, parseFrontmatter, resolveExecOrigins, sessionReadSkillNames, sessionReadSupportFiles } from "@lmzhen/dsh-evolution-core/skills";
|
|
6
6
|
import { EXTRACT_PROMPT_V1, buildExtractPlanFromLibrary, ownerCandidatesFromSummaries, ownerDecisionText, projectExtractBodies, proposalFromPlan, readProposalReport, writeProposalReport } from "@lmzhen/dsh-evolution-core/extract";
|
|
7
7
|
//#region lib/types/skill-actions.js
|
|
8
8
|
const SKILL_ACTIONS = Object.freeze({
|
|
9
9
|
list: {
|
|
10
10
|
mutates: false,
|
|
11
11
|
needsName: false,
|
|
12
|
-
gate: "none"
|
|
12
|
+
gate: "none",
|
|
13
|
+
summary: "none"
|
|
13
14
|
},
|
|
14
15
|
review: {
|
|
15
16
|
mutates: false,
|
|
16
17
|
needsName: false,
|
|
17
|
-
gate: "none"
|
|
18
|
+
gate: "none",
|
|
19
|
+
summary: "none"
|
|
18
20
|
},
|
|
19
21
|
create: {
|
|
20
22
|
mutates: true,
|
|
21
23
|
needsName: true,
|
|
22
|
-
gate: "write"
|
|
24
|
+
gate: "write",
|
|
25
|
+
summary: "host"
|
|
23
26
|
},
|
|
24
27
|
edit: {
|
|
25
28
|
mutates: true,
|
|
26
29
|
needsName: true,
|
|
27
|
-
gate: "write"
|
|
30
|
+
gate: "write",
|
|
31
|
+
summary: "host"
|
|
28
32
|
},
|
|
29
33
|
update: {
|
|
30
34
|
mutates: true,
|
|
31
35
|
needsName: true,
|
|
32
|
-
gate: "write"
|
|
36
|
+
gate: "write",
|
|
37
|
+
summary: "host"
|
|
33
38
|
},
|
|
34
39
|
patch: {
|
|
35
40
|
mutates: true,
|
|
36
41
|
needsName: true,
|
|
37
|
-
gate: "write"
|
|
42
|
+
gate: "write",
|
|
43
|
+
summary: "host"
|
|
38
44
|
},
|
|
39
45
|
delete: {
|
|
40
46
|
mutates: true,
|
|
41
47
|
needsName: true,
|
|
42
|
-
gate: "approval"
|
|
48
|
+
gate: "approval",
|
|
49
|
+
summary: "required"
|
|
43
50
|
},
|
|
44
51
|
write_file: {
|
|
45
52
|
mutates: true,
|
|
46
53
|
needsName: true,
|
|
47
|
-
gate: "write"
|
|
54
|
+
gate: "write",
|
|
55
|
+
summary: "host"
|
|
48
56
|
},
|
|
49
57
|
remove_file: {
|
|
50
58
|
mutates: true,
|
|
51
59
|
needsName: true,
|
|
52
|
-
gate: "write"
|
|
60
|
+
gate: "write",
|
|
61
|
+
summary: "host"
|
|
53
62
|
},
|
|
54
63
|
restructure: {
|
|
55
64
|
mutates: true,
|
|
56
65
|
needsName: true,
|
|
57
|
-
gate: "write"
|
|
66
|
+
gate: "write",
|
|
67
|
+
summary: "required"
|
|
58
68
|
},
|
|
59
69
|
extract: {
|
|
60
70
|
mutates: true,
|
|
61
71
|
needsName: false,
|
|
62
|
-
gate: "write"
|
|
72
|
+
gate: "write",
|
|
73
|
+
summary: "required"
|
|
74
|
+
},
|
|
75
|
+
feedback: {
|
|
76
|
+
mutates: false,
|
|
77
|
+
needsName: true,
|
|
78
|
+
gate: "none",
|
|
79
|
+
summary: "none"
|
|
63
80
|
},
|
|
64
81
|
pin: {
|
|
65
82
|
mutates: false,
|
|
66
83
|
needsName: true,
|
|
67
|
-
gate: "none"
|
|
84
|
+
gate: "none",
|
|
85
|
+
summary: "none"
|
|
68
86
|
},
|
|
69
87
|
unpin: {
|
|
70
88
|
mutates: false,
|
|
71
89
|
needsName: true,
|
|
72
|
-
gate: "none"
|
|
90
|
+
gate: "none",
|
|
91
|
+
summary: "none"
|
|
73
92
|
}
|
|
74
93
|
});
|
|
75
94
|
function skillActionOf(action) {
|
|
@@ -136,6 +155,7 @@ const Config = z.object({
|
|
|
136
155
|
threatExemptLabels: z.array(z.string()).default([]),
|
|
137
156
|
strictCrossSource: z.boolean().default(false).volatile(),
|
|
138
157
|
skillVersionKeep: z.number().min(1).default(DEFAULT_SKILL_LIMITS.versionKeep ?? DEFAULT_SKILL_VERSION_KEEP),
|
|
158
|
+
skillWriteSummaryChars: z.number().min(1).default(DEFAULT_SKILL_WRITE_SUMMARY_CHARS),
|
|
139
159
|
skillWriteConfirm: z.union([
|
|
140
160
|
z.const("auto"),
|
|
141
161
|
z.const("ask"),
|
|
@@ -695,7 +715,22 @@ function apply(ctx, rawConfig = {}) {
|
|
|
695
715
|
applyLimits();
|
|
696
716
|
const action = args.action;
|
|
697
717
|
const name = args.name ?? "";
|
|
698
|
-
|
|
718
|
+
const actionMeta = skillActionOf(action);
|
|
719
|
+
let change;
|
|
720
|
+
if (args.summary !== void 0) {
|
|
721
|
+
const summaryChars = limit("skillWriteSummaryChars", rawConfig.skillWriteSummaryChars, DEFAULT_SKILL_WRITE_SUMMARY_CHARS);
|
|
722
|
+
const normalized = normalizeChangeSummary(args.summary, summaryChars);
|
|
723
|
+
if (!normalized.ok) return {
|
|
724
|
+
ok: false,
|
|
725
|
+
message: normalized.reason === "length" ? `摘要为 ${normalized.length} 个字符,超过上限 ${summaryChars}。` : normalized.reason === "multiline" ? "摘要必须是单行。" : "摘要不能为空。",
|
|
726
|
+
skills: []
|
|
727
|
+
};
|
|
728
|
+
change = {
|
|
729
|
+
text: normalized.text,
|
|
730
|
+
source: "model"
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
if (actionMeta?.needsName === true && name === "") return {
|
|
699
734
|
ok: false,
|
|
700
735
|
message: `动作「${action}」需要 name。`,
|
|
701
736
|
skills: []
|
|
@@ -705,6 +740,11 @@ function apply(ctx, rawConfig = {}) {
|
|
|
705
740
|
message: "背景审查不能执行 extract:review 只提议;提取必须由显式前台工具/命令执行。",
|
|
706
741
|
skills: []
|
|
707
742
|
};
|
|
743
|
+
if ((action === "restructure" || action === "extract" || action === "delete") && origin !== "foreground" && change === void 0) return {
|
|
744
|
+
ok: false,
|
|
745
|
+
message: `动作「${action}」的后台写入必须提供 summary(一句变更原因)。`,
|
|
746
|
+
skills: []
|
|
747
|
+
};
|
|
708
748
|
if (action === "review") try {
|
|
709
749
|
return {
|
|
710
750
|
ok: true,
|
|
@@ -732,6 +772,20 @@ function apply(ctx, rawConfig = {}) {
|
|
|
732
772
|
skills: []
|
|
733
773
|
};
|
|
734
774
|
}
|
|
775
|
+
if (action === "feedback") {
|
|
776
|
+
const service = ctx.get("evolutionFeedback");
|
|
777
|
+
if (service?.record === void 0) return {
|
|
778
|
+
ok: false,
|
|
779
|
+
message: "反馈服务未挂载,未记录。",
|
|
780
|
+
skills: []
|
|
781
|
+
};
|
|
782
|
+
service.record(name, "negative", args.problem ?? "unspecified", "skill");
|
|
783
|
+
return {
|
|
784
|
+
ok: true,
|
|
785
|
+
message: `已记录对「${name}」的问题反馈。`,
|
|
786
|
+
skills: []
|
|
787
|
+
};
|
|
788
|
+
}
|
|
735
789
|
const refusal = await runWriteGates(skillWriteGateContext({
|
|
736
790
|
policy: ctx.get("evolutionPolicy"),
|
|
737
791
|
confirm: void 0,
|
|
@@ -772,8 +826,21 @@ function apply(ctx, rawConfig = {}) {
|
|
|
772
826
|
},
|
|
773
827
|
edit: () => library.update(name, args.content ?? "", origin, stagedAnchor),
|
|
774
828
|
update: () => library.update(name, args.content ?? "", origin, stagedAnchor),
|
|
775
|
-
patch: () =>
|
|
776
|
-
|
|
829
|
+
patch: async () => {
|
|
830
|
+
const section = args.section;
|
|
831
|
+
if (section === void 0) return await library.patch(name, args.old_string ?? "", args.new_string ?? "", args.file_path ?? "", args.replace_all === true, origin);
|
|
832
|
+
if (typeof section.heading !== "string" || typeof section.content !== "string") return {
|
|
833
|
+
ok: false,
|
|
834
|
+
message: "patch.section 需要 heading 与 content。"
|
|
835
|
+
};
|
|
836
|
+
return await library.patchSection(name, {
|
|
837
|
+
heading: section.heading,
|
|
838
|
+
content: section.content,
|
|
839
|
+
...typeof section.start === "string" ? { start: section.start } : {},
|
|
840
|
+
...typeof section.end === "string" ? { end: section.end } : {}
|
|
841
|
+
}, origin);
|
|
842
|
+
},
|
|
843
|
+
delete: () => library.archive(name, args.absorbed_into ? { absorbedInto: args.absorbed_into } : {}, void 0, change),
|
|
777
844
|
write_file: () => library.writeSupportFile(name, args.file_path ?? "", args.file_content ?? "", origin, stagedAnchor),
|
|
778
845
|
remove_file: () => library.removeSupportFile(name, args.file_path ?? "", origin, stagedAnchor),
|
|
779
846
|
pin: () => library.setPinned(name, true, origin),
|
|
@@ -789,8 +856,10 @@ function apply(ctx, rawConfig = {}) {
|
|
|
789
856
|
};
|
|
790
857
|
return library.restructure(name, moves.map((move) => ({
|
|
791
858
|
heading: typeof move.heading === "string" ? move.heading : "",
|
|
859
|
+
...typeof move.start === "string" ? { start: move.start } : {},
|
|
860
|
+
...typeof move.end === "string" ? { end: move.end } : {},
|
|
792
861
|
toFile: typeof move.to_file === "string" ? move.to_file : ""
|
|
793
|
-
})), origin);
|
|
862
|
+
})), origin, change);
|
|
794
863
|
},
|
|
795
864
|
extract: async () => {
|
|
796
865
|
let result;
|
|
@@ -853,7 +922,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
853
922
|
result = args.dry_run === true ? {
|
|
854
923
|
ok: true,
|
|
855
924
|
message: "提取计划(未写入):" + plan.parts.map((part) => "## " + part.heading).join(", ") + " -> " + plan.target.name + "\n" + decisionLine + (candidateLines.length === 0 ? "" : "\n候选 owner:\n" + candidateLines.join("\n"))
|
|
856
|
-
} : await library.extract(plan, origin);
|
|
925
|
+
} : await library.extract(plan, origin, change);
|
|
857
926
|
if (result.ok && built.warnings !== void 0 && built.warnings.length > 0) result = {
|
|
858
927
|
...result,
|
|
859
928
|
message: result.message + "\n" + built.warnings.join("\n")
|
|
@@ -971,6 +1040,14 @@ function apply(ctx, rawConfig = {}) {
|
|
|
971
1040
|
}));
|
|
972
1041
|
const dedup = computeDedupGroups({ contents });
|
|
973
1042
|
const groups = dedup.groups;
|
|
1043
|
+
const sizedLines = lines.map((line, index) => {
|
|
1044
|
+
const body = contents.get(list[index]?.name ?? "");
|
|
1045
|
+
if (body === void 0) return line;
|
|
1046
|
+
const oversize = body.length >= DEFAULT_HEALTH_THRESHOLDS.softBodyChars ? " [oversize]" : "";
|
|
1047
|
+
return `${line} chars:${body.length}${oversize}`;
|
|
1048
|
+
});
|
|
1049
|
+
const oversizeNames = list.filter((summary) => (contents.get(summary.name)?.length ?? 0) >= DEFAULT_HEALTH_THRESHOLDS.softBodyChars).map((summary) => summary.name);
|
|
1050
|
+
const oversizeLine = oversizeNames.length === 0 ? "" : `\nOversize skills (${oversizeNames.length}): ${oversizeNames.join(", ")} — offload whole sections to references/ before adding more body.`;
|
|
974
1051
|
const dedupLines = groups.slice(0, MAX_DEDUP_GROUPS_IN_REVIEW).map((group) => `- ${group.join(" ~ ")}`);
|
|
975
1052
|
if (dedup.truncated) dedupLines.push(`- note: dedup scan truncated at the pair-comparison budget (${groups.length} group(s) so far); groups may be incomplete`);
|
|
976
1053
|
const excludedLine = excludedBodies === 0 ? "" : `\n${excludedBodies} skill bodies were empty and excluded from dedup grouping.`;
|
|
@@ -978,18 +1055,19 @@ function apply(ctx, rawConfig = {}) {
|
|
|
978
1055
|
const warned = list.filter((summary) => warnedFlag(summary.name)).map((summary) => summary.name);
|
|
979
1056
|
const warningLine = warned.length === 0 ? "" : `\nWarning skills (${warned.length}): ${warned.join(", ")} — low quality; consider consolidating them before authoring new skills.`;
|
|
980
1057
|
return [
|
|
981
|
-
list.length === 0 ? "No skills yet. Create one with action=create, or it is safe to author a new class-level umbrella." : `Skills: ${list.length} total. Below each name: state, use/view/patch counts, quality (0-1, ⚠ = low) and
|
|
1058
|
+
list.length === 0 ? "No skills yet. Create one with action=create, or it is safe to author a new class-level umbrella." : `Skills: ${list.length} total. Below each name: state, use/view/patch counts, quality (0-1, ⚠ = low), protection, and body chars when readable ([oversize] = at or over the health soft line).${groups.length > 0 ? `\n\nNear-duplicate groups (${groups.length}):` : ""}`,
|
|
982
1059
|
"",
|
|
983
|
-
...
|
|
1060
|
+
...sizedLines,
|
|
984
1061
|
...dedupLines,
|
|
985
1062
|
...excludedBodies > 0 ? [excludedLine] : [],
|
|
986
1063
|
...unreadableBodies > 0 ? [unreadableLine] : [],
|
|
987
|
-
warningLine
|
|
1064
|
+
warningLine,
|
|
1065
|
+
oversizeLine
|
|
988
1066
|
].join("\n");
|
|
989
1067
|
}
|
|
990
1068
|
registerEvolutionTool(ctx, defineTool({
|
|
991
1069
|
name: "skill_manage",
|
|
992
|
-
description: "Manage reusable skills. review returns the library review text (state/usage/quality per skill); list returns names only; create/edit/update take full SKILL.md content (edit is an alias of update); 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. write_file needs name + file_path + file_content; remove_file needs name + file_path; create/edit/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.Prefer patching an umbrella over creating narrow skills. restructure moves entire body sections (by their exact \"## heading\" line, via restructure: [{heading, 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,
|
|
1070
|
+
description: "Manage reusable skills. review returns the library review text (state/usage/quality per skill); list returns names only; create/edit/update take full SKILL.md content (edit is an alias of update); 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/edit/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.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,
|
|
993
1071
|
parameters: {
|
|
994
1072
|
action: {
|
|
995
1073
|
type: "string",
|
|
@@ -1006,6 +1084,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1006
1084
|
"remove_file",
|
|
1007
1085
|
"restructure",
|
|
1008
1086
|
"extract",
|
|
1087
|
+
"feedback",
|
|
1009
1088
|
"pin",
|
|
1010
1089
|
"unpin"
|
|
1011
1090
|
]
|
|
@@ -1018,6 +1097,30 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1018
1097
|
file_path: { type: "string" },
|
|
1019
1098
|
file_content: { type: "string" },
|
|
1020
1099
|
absorbed_into: { type: "string" },
|
|
1100
|
+
summary: {
|
|
1101
|
+
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."
|
|
1103
|
+
},
|
|
1104
|
+
problem: {
|
|
1105
|
+
type: "string",
|
|
1106
|
+
enum: [
|
|
1107
|
+
"wrong",
|
|
1108
|
+
"outdated",
|
|
1109
|
+
"incomplete",
|
|
1110
|
+
"unsafe"
|
|
1111
|
+
],
|
|
1112
|
+
description: "feedback only: why the loaded skill did not help."
|
|
1113
|
+
},
|
|
1114
|
+
section: {
|
|
1115
|
+
type: "object",
|
|
1116
|
+
additionalProperties: false,
|
|
1117
|
+
properties: {
|
|
1118
|
+
heading: { type: "string" },
|
|
1119
|
+
start: { type: "string" },
|
|
1120
|
+
end: { type: "string" },
|
|
1121
|
+
content: { type: "string" }
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1021
1124
|
restructure: {
|
|
1022
1125
|
type: "array",
|
|
1023
1126
|
items: {
|
|
@@ -1025,6 +1128,8 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1025
1128
|
additionalProperties: false,
|
|
1026
1129
|
properties: {
|
|
1027
1130
|
heading: { type: "string" },
|
|
1131
|
+
start: { type: "string" },
|
|
1132
|
+
end: { type: "string" },
|
|
1028
1133
|
to_file: { type: "string" }
|
|
1029
1134
|
}
|
|
1030
1135
|
}
|
|
@@ -1103,7 +1208,14 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1103
1208
|
args,
|
|
1104
1209
|
origin: libraryOrigin,
|
|
1105
1210
|
protectedNames: protectedSkillNamesOf(ctx.get("evolutionPolicy")),
|
|
1106
|
-
readNames:
|
|
1211
|
+
readNames: (() => {
|
|
1212
|
+
const run = currentReviewContext()?.reads;
|
|
1213
|
+
if (run === void 0) return sessionReadSkillNames(ctx, exec.agent?.session);
|
|
1214
|
+
const merged = /* @__PURE__ */ new Set();
|
|
1215
|
+
sessionReadSkillNames(ctx, exec.agent?.session)?.forEach((name) => merged.add(name));
|
|
1216
|
+
run.forEach((name) => merged.add(name));
|
|
1217
|
+
return merged;
|
|
1218
|
+
})(),
|
|
1107
1219
|
readSupportFiles: sessionReadSupportFiles(ctx, exec.agent?.session, { root: library.root }),
|
|
1108
1220
|
confirm: async (request) => confirmSkillWrite(request, exec),
|
|
1109
1221
|
confirmMode: approvalSeam !== void 0 && approvalSeam.isEnabled !== false && sessionPolicy !== "never" && (libraryOrigin === "background_review" || approvalSeam.stageForeground !== false) ? "auto" : settings().skillWriteConfirm,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ export interface Config {
|
|
|
57
57
|
* like the four caps above — the settings layer deliberately has no card for it (retention is
|
|
58
58
|
* storage policy, not an authoring knob). */
|
|
59
59
|
skillVersionKeep?: number;
|
|
60
|
+
/** Hard cap for the one-line change summary; E2 internal (restart-only), no settings card. */
|
|
61
|
+
skillWriteSummaryChars?: number;
|
|
60
62
|
/** What the ONE confirmation before a create or a bare delete does (registry `skillWriteConfirm`).
|
|
61
63
|
* Default `auto`: an unattended run must not park a tool call on a question nobody will answer. */
|
|
62
64
|
skillWriteConfirm?: Volatile<WriteConfirmMode>;
|
|
@@ -75,6 +77,7 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
75
77
|
threatExemptLabels: z<string[], string[], "defined">;
|
|
76
78
|
strictCrossSource: z<boolean, boolean, "volatile-defined">;
|
|
77
79
|
skillVersionKeep: z<number, number, "defined">;
|
|
80
|
+
skillWriteSummaryChars: z<number, number, "defined">;
|
|
78
81
|
skillWriteConfirm: z<"auto" | "ask" | "timeout", "auto" | "ask" | "timeout", "volatile-defined">;
|
|
79
82
|
skillWriteConfirmTimeoutSeconds: z<number, number, "volatile-defined">;
|
|
80
83
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
@@ -89,6 +92,7 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
89
92
|
threatExemptLabels: z<string[], string[], "defined">;
|
|
90
93
|
strictCrossSource: z<boolean, boolean, "volatile-defined">;
|
|
91
94
|
skillVersionKeep: z<number, number, "defined">;
|
|
95
|
+
skillWriteSummaryChars: z<number, number, "defined">;
|
|
92
96
|
skillWriteConfirm: z<"auto" | "ask" | "timeout", "auto" | "ask" | "timeout", "volatile-defined">;
|
|
93
97
|
skillWriteConfirmTimeoutSeconds: z<number, number, "volatile-defined">;
|
|
94
98
|
}>>, "plain">;
|
|
@@ -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' | 'edit' | 'update' | 'patch' | 'delete' | 'write_file' | 'remove_file' | 'restructure' | 'extract' | 'pin' | 'unpin';
|
|
8
|
+
export type SkillActionId = 'list' | 'review' | 'create' | 'edit' | '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;
|
|
@@ -13,6 +13,8 @@ export interface SkillActionMeta {
|
|
|
13
13
|
readonly needsName: boolean;
|
|
14
14
|
/** none = read-only; write = SkillLibrary write path; approval = staged gate. */
|
|
15
15
|
readonly gate: 'none' | 'write' | 'approval';
|
|
16
|
+
/** Whether the user-facing change summary is model-required, host-derived, or absent. */
|
|
17
|
+
readonly summary: 'required' | 'host' | 'none';
|
|
16
18
|
}
|
|
17
19
|
export declare const SKILL_ACTIONS: Readonly<Record<SkillActionId, SkillActionMeta>>;
|
|
18
20
|
export declare function skillActionOf(action: unknown): SkillActionMeta | undefined;
|
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.51.1",
|
|
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.51.1",
|
|
33
|
+
"@lmzhen/dsh-evolution-core": "^0.51.1",
|
|
34
|
+
"@lmzhen/dsh-evolution-skill-discovery": "^0.51.1"
|
|
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.51.1"
|
|
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.51.1",
|
|
48
|
+
"@lmzhen/dsh-evolution-skill-discovery": "^0.51.1"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"dsh": ">=0.2.2-rc.3 <0.2.3-0"
|