@lmzhen/dsh-tool-skill-manage 0.53.0 → 0.55.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.
Files changed (2) hide show
  1. package/lib/index.js +9 -7
  2. package/package.json +7 -7
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
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, currentReviewContext, 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, TEXT_BUDGETS, authorityFrom, callingScope, clampOnce, compareTextBudget, computeDedupGroups, contentHash, createSubagentChannel, currentReviewContext, evolutionIoAdapter, fuzzyPatch, isPresent, isUnknown, liveBool, measureUnit, 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, DEFAULT_SKILL_WRITE_SUMMARY_CHARS, anchorVerdict, authoringFeedback, newSkillLibrary, normalizeChangeSummary, normalizeFrontmatter, parseFrontmatter, resolveExecOrigins, sessionReadSkillNames, sessionReadSupportFiles } from "@lmzhen/dsh-evolution-core/skills";
5
+ import { 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({
@@ -784,9 +784,10 @@ function apply(ctx, rawConfig = {}) {
784
784
  skills: []
785
785
  };
786
786
  const note = typeof args.note === "string" ? args.note.trim() : "";
787
- if ([...note].length > 20) return {
787
+ const noteLength = compareTextBudget(note, TEXT_BUDGETS.feedbackNote).value;
788
+ if (noteLength > TEXT_BUDGETS.feedbackNote.limit) return {
788
789
  ok: false,
789
- message: `报错说明为 ${[...note].length} 个字符,超过 20 上限。`,
790
+ message: `报错说明为 ${noteLength} 个字符,超过 ${TEXT_BUDGETS.feedbackNote.limit} 上限。`,
790
791
  skills: []
791
792
  };
792
793
  service.record(name, "negative", note === "" ? args.problem : note, "skill");
@@ -964,7 +965,8 @@ function apply(ctx, rawConfig = {}) {
964
965
  if (result.ok) {
965
966
  if (name !== void 0 && name !== "" && (action === "create" || action === "update" || action === "patch")) {
966
967
  const body = action === "create" ? args.content ?? null : await library.read(name);
967
- if (body !== null && body.length > DEFAULT_HEALTH_THRESHOLDS.softBodyChars) feedbackLines.push(`正文 ${body.length} 字符,超过 ${DEFAULT_HEALTH_THRESHOLDS.softBodyChars} 字符软线;保持不改是合法的。`);
968
+ const bodyTokens = body === null ? null : measureUnit(body, "tokens");
969
+ if (bodyTokens !== null && bodyTokens > TEXT_BUDGETS.bodySoft.limit) feedbackLines.push(`正文约 ${bodyTokens} tokens,超过 ${TEXT_BUDGETS.bodySoft.limit} tokens 软线;保持不改是合法的。`);
968
970
  }
969
971
  if (result.normalizedFrontmatterFields && result.normalizedFrontmatterFields.length > 0) feedbackLines.push(`frontmatter auto-quoted (YAML compatibility): ${result.normalizedFrontmatterFields.join(", ")}`);
970
972
  const mutating = !isReadOnlyAction(action) && !(action === "extract" && args.dry_run === true);
@@ -1052,10 +1054,10 @@ function apply(ctx, rawConfig = {}) {
1052
1054
  const sizedLines = lines.map((line, index) => {
1053
1055
  const body = contents.get(list[index]?.name ?? "");
1054
1056
  if (body === void 0) return line;
1055
- const oversize = body.length >= DEFAULT_HEALTH_THRESHOLDS.softBodyChars ? " [oversize]" : "";
1057
+ const oversize = measureUnit(body, "tokens") >= TEXT_BUDGETS.bodySoft.limit ? " [oversize]" : "";
1056
1058
  return `${line} chars:${body.length}${oversize}`;
1057
1059
  });
1058
- const oversizeNames = list.filter((summary) => (contents.get(summary.name)?.length ?? 0) >= DEFAULT_HEALTH_THRESHOLDS.softBodyChars).map((summary) => summary.name);
1060
+ const oversizeNames = list.filter((summary) => measureUnit(contents.get(summary.name) ?? "", "tokens") >= TEXT_BUDGETS.bodySoft.limit).map((summary) => summary.name);
1059
1061
  const oversizeLine = oversizeNames.length === 0 ? "" : `\nOversize skills (${oversizeNames.length}): ${oversizeNames.join(", ")} — offload whole sections to references/ before adding more body.`;
1060
1062
  const dedupLines = groups.slice(0, MAX_DEDUP_GROUPS_IN_REVIEW).map((group) => `- ${group.join(" ~ ")}`);
1061
1063
  if (dedup.truncated) dedupLines.push(`- note: dedup scan truncated at the pair-comparison budget (${groups.length} group(s) so far); groups may be incomplete`);
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.53.0",
4
+ "version": "0.55.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.53.0",
33
- "@lmzhen/dsh-evolution-core": "^0.53.0",
34
- "@lmzhen/dsh-evolution-skill-discovery": "^0.53.0"
32
+ "@lmzhen/dsh-evolution-approval": "0.55.0",
33
+ "@lmzhen/dsh-evolution-core": "0.55.0",
34
+ "@lmzhen/dsh-evolution-skill-discovery": "0.55.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.53.0"
41
+ "@lmzhen/dsh-evolution-skill-discovery": "^0.55.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.53.0",
48
- "@lmzhen/dsh-evolution-skill-discovery": "^0.53.0"
47
+ "@lmzhen/dsh-evolution-core": "^0.55.0",
48
+ "@lmzhen/dsh-evolution-skill-discovery": "^0.55.0"
49
49
  },
50
50
  "engines": {
51
51
  "dsh": ">=0.2.2-rc.3 <0.2.3-0"