@lmzhen/dsh-tool-skill-manage 0.22.0 → 0.23.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 +17 -4
  2. package/package.json +8 -8
package/lib/index.js CHANGED
@@ -235,6 +235,19 @@ async function runWriteGates(context) {
235
235
  * documented in the README Safety model section.
236
236
  * @module @lmzhen/dsh-tool-skill-manage
237
237
  */
238
+ /**
239
+ * F-2 (audit v46 / G7.2): the read-only action set used to be spelled out FOUR times in this file
240
+ * (usage accounting at the patch_count bump, the cross-source directory exemption, the approval gap
241
+ * and the replay exemption). The four USES stay where they are — their neighbouring logic differs —
242
+ * but the CRITERION is this one predicate, so adding an action cannot update three of four.
243
+ */
244
+ const READ_ONLY_ACTIONS = [
245
+ "list",
246
+ "review",
247
+ "pin",
248
+ "unpin"
249
+ ];
250
+ const isReadOnlyAction = (action) => typeof action === "string" && READ_ONLY_ACTIONS.includes(action);
238
251
  const name = "tool-skill-manage";
239
252
  const inject = [
240
253
  "tools",
@@ -773,7 +786,7 @@ function apply(ctx, rawConfig = {}) {
773
786
  };
774
787
  if (result.ok) {
775
788
  if (result.normalizedFrontmatterFields && result.normalizedFrontmatterFields.length > 0) feedbackLines.push(`frontmatter auto-quoted (YAML compatibility): ${result.normalizedFrontmatterFields.join(", ")}`);
776
- const mutating = action !== "list" && action !== "review" && action !== "pin" && action !== "unpin";
789
+ const mutating = !isReadOnlyAction(action);
777
790
  if (name && action === "create") await ctx.skillUsage.ensureRecordCreated(name, origin !== "foreground");
778
791
  if (name && action === "delete") await ctx.skillUsage.markArchived(name);
779
792
  else if (name && mutating && action !== "create" && result.noop !== true) await ctx.skillUsage.record(name, "patch");
@@ -937,7 +950,7 @@ function apply(ctx, rawConfig = {}) {
937
950
  /** The approval seam this write would go through (T2-10/A25: the gate decision below reads it). */
938
951
  const approvalSeam = ctx.get("evolutionApproval");
939
952
  let crossSourceView = null;
940
- if (typeof args.name === "string" && args.name !== "" && args.action !== "list" && args.action !== "review" && args.action !== "pin" && args.action !== "unpin") {
953
+ if (typeof args.name === "string" && args.name !== "" && !isReadOnlyAction(args.action)) {
941
954
  const gate = await crossSourceRefusal(args.name);
942
955
  if (gate.refusal !== null) return {
943
956
  ok: false,
@@ -974,7 +987,7 @@ function apply(ctx, rawConfig = {}) {
974
987
  skills: []
975
988
  };
976
989
  const approval = approvalSeam;
977
- if (approval && args.action !== "list" && args.action !== "review" && args.action !== "pin" && args.action !== "unpin") {
990
+ if (approval && !isReadOnlyAction(args.action)) {
978
991
  if ((args.action === "update" || args.action === "edit") && typeof args.name === "string" && args.name !== "") {
979
992
  const stageCurrent = await library.read(args.name).catch(() => null);
980
993
  operation = {
@@ -1019,7 +1032,7 @@ function apply(ctx, rawConfig = {}) {
1019
1032
  const wrapped = args ?? {};
1020
1033
  const operation = wrapped.operation ?? {};
1021
1034
  const replayAction = operation.action;
1022
- if (replayAction !== "list" && replayAction !== "review" && replayAction !== "pin" && replayAction !== "unpin") return crossSourceRefusal(operation.name, "replay").then((gate) => {
1035
+ if (!isReadOnlyAction(replayAction)) return crossSourceRefusal(operation.name, "replay").then((gate) => {
1023
1036
  if (gate.refusal !== null) return {
1024
1037
  ok: false,
1025
1038
  message: `${gate.refusal} (re-checked at approve time: the catalog ranking changed while the write was staged)`,
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.22.0",
4
+ "version": "0.23.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,24 +27,24 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.4",
30
- "@lmzhen/dsh-evolution-approval": "^0.22.0",
31
- "@lmzhen/dsh-evolution-core": "^0.22.0"
30
+ "@lmzhen/dsh-evolution-approval": "^0.23.0",
31
+ "@lmzhen/dsh-evolution-core": "^0.23.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@deepseek-ai/cordis": "^4.0.1",
35
35
  "@deepseek-ai/dsh-skill": "^0.2.0-rc.1",
36
36
  "@deepseek-ai/dsh-system-prompt": "^0.2.0-rc.1",
37
37
  "@deepseek-ai/dsh-tools": "^0.2.0-rc.1",
38
- "@lmzhen/dsh-evolution-io": "^0.22.0",
39
- "@lmzhen/dsh-skill-usage": "^0.22.0"
38
+ "@lmzhen/dsh-evolution-io": "^0.23.0",
39
+ "@lmzhen/dsh-skill-usage": "^0.23.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@deepseek-ai/dsh-agent-loop-testkit": "^0.2.0-rc.1",
43
43
  "@deepseek-ai/dsh-skill": "^0.2.0-rc.1",
44
44
  "@deepseek-ai/dsh-system-prompt": "^0.2.0-rc.1",
45
45
  "@deepseek-ai/dsh-tools": "^0.2.0-rc.1",
46
- "@lmzhen/dsh-evolution-core": "^0.22.0",
47
- "@lmzhen/dsh-evolution-io": "^0.22.0",
48
- "@lmzhen/dsh-skill-usage": "^0.22.0"
46
+ "@lmzhen/dsh-evolution-core": "^0.23.0",
47
+ "@lmzhen/dsh-evolution-io": "^0.23.0",
48
+ "@lmzhen/dsh-skill-usage": "^0.23.0"
49
49
  }
50
50
  }