@lmzhen/dsh-tool-skill-manage 0.16.1 → 0.17.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/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { effectiveSessionPolicy } from "@lmzhen/dsh-evolution-approval";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { defineTool } from "@deepseek-ai/dsh-tools";
4
- import { DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_CITATION_POLICY, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_VERSION_KEEP, DEFAULT_SUPPORT_FILE_CHAR_POLICY, DSH_AUTHORING_STANDARDS, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, anchorVerdict, authoringFeedback, callingScope, clampedNumber, computeDedupGroups, contentHash, errorText, evolutionIoAdapter, fuzzyPatch, installParamSection, isPresent, isUnknown, isUnreadWrite, nearDuplicateSummaries, newSkillLibrary, normalizeFrontmatter, paramNamespace, parseFrontmatter, policyStageLimits, probePresent, probeUnknown, readNumberParam, resolveExecOrigins, sessionReadSkillNames } from "@lmzhen/dsh-evolution-core";
4
+ import { DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_CITATION_POLICY, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_VERSION_KEEP, DEFAULT_SUPPORT_FILE_CHAR_POLICY, DSH_AUTHORING_STANDARDS, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, anchorVerdict, authoringFeedback, callingScope, clampedNumber, computeDedupGroups, contentHash, errorText, evolutionIoAdapter, fuzzyPatch, isPresent, isUnknown, isUnreadWrite, nearDuplicateSummaries, newSkillLibrary, normalizeFrontmatter, paramRowId, parseFrontmatter, policyStageLimits, probePresent, probeUnknown, resolveExecOrigins, sessionReadSkillNames } from "@lmzhen/dsh-evolution-core";
5
5
  //#region lib/types/write-gates.js
6
6
  /**
7
7
  * The write-admission sequence: ONE ordered table of the reasons a skill write is refused.
@@ -245,38 +245,23 @@ const PROTECTED_SKILLS_INLINE_MAX = 12;
245
245
  const GUIDANCE_WITH_GUARD = `${SKILLS_GUIDANCE}{{${PROTECTED_SKILLS_VARIABLE}}}`;
246
246
  const Config = z.object({
247
247
  root: z.string().default(""),
248
- maxSkillNameLength: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxNameLength),
249
- maxDescriptionLength: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxDescriptionLength),
248
+ maxSkillNameLength: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxNameLength).volatile(),
249
+ maxDescriptionLength: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxDescriptionLength).volatile(),
250
+ skillContentChars: z.number().min(1).volatile(),
251
+ citationPolicy: z.union([z.const("verify"), z.const("refuse")]).volatile(),
252
+ supportFileCharPolicy: z.union([z.const("report"), z.const("enforce")]).volatile(),
250
253
  maxSkillContentChars: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxSkillContentChars),
251
- maxSkillFileBytes: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxSkillFileBytes),
252
- descriptionStrict: z.boolean().default(false),
254
+ maxSkillFileBytes: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxSkillFileBytes).volatile(),
255
+ descriptionStrict: z.boolean().default(false).volatile(),
253
256
  threatExemptLabels: z.array(z.string()).default([]),
254
- strictCrossSource: z.boolean().default(false),
257
+ strictCrossSource: z.boolean().default(false).volatile(),
255
258
  skillVersionKeep: z.number().min(1).default(DEFAULT_SKILL_LIMITS.versionKeep ?? DEFAULT_SKILL_VERSION_KEEP),
256
259
  skillWriteConfirm: z.union([
257
260
  z.const("auto"),
258
261
  z.const("ask"),
259
262
  z.const("timeout")
260
- ]).default(DEFAULT_WRITE_CONFIRM_MODE),
261
- skillWriteConfirmTimeoutSeconds: z.number().min(1).default(120)
262
- });
263
- /** Schema the platform validates the user layer against; defaults mirror the core
264
- * constants and the row schema, so an empty document resolves to today's behaviour. */
265
- const SKILLS_SETTINGS_SCHEMA = z.object({
266
- skillContentChars: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxSkillContentChars),
267
- maxSkillFileBytes: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxSkillFileBytes),
268
- maxSkillNameLength: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxNameLength),
269
- maxDescriptionLength: z.number().min(1).default(DEFAULT_SKILL_LIMITS.maxDescriptionLength),
270
- descriptionStrict: z.boolean().default(false),
271
- strictCrossSource: z.boolean().default(false),
272
- citationPolicy: z.union([z.const("verify"), z.const("refuse")]).default(DEFAULT_CITATION_POLICY),
273
- supportFileCharPolicy: z.union([z.const("report"), z.const("enforce")]).default(DEFAULT_SUPPORT_FILE_CHAR_POLICY),
274
- skillWriteConfirm: z.union([
275
- z.const("auto"),
276
- z.const("ask"),
277
- z.const("timeout")
278
- ]).default(DEFAULT_WRITE_CONFIRM_MODE),
279
- skillWriteConfirmTimeoutSeconds: z.number().min(1).default(120)
263
+ ]).default(DEFAULT_WRITE_CONFIRM_MODE).volatile(),
264
+ skillWriteConfirmTimeoutSeconds: z.number().min(1).default(120).volatile()
280
265
  });
281
266
  /** The four caps a user may only tighten, in schema order (the sentry reads it). */
282
267
  const SKILL_SETTINGS_CAPS = [
@@ -286,14 +271,21 @@ const SKILL_SETTINGS_CAPS = [
286
271
  "maxDescriptionLength"
287
272
  ];
288
273
  /**
289
- * Refuse a resolved section whose cap sits ABOVE the deployment's allocation.
274
+ * Refuse a candidate config whose cap sits ABOVE the value in effect.
290
275
  * Windows have no single-field bound the schema could express, and a user who
291
- * widened one would spend a budget the deployment set for the whole library.
292
- * @param value - the resolved section the platform hands the owner.
293
- * @param ceilings - the deployment values (the plugin row, after its clamps).
276
+ * widened one would spend a budget the deployment set for the whole library. The
277
+ * platform runs this rule through the config waterfall on every candidate BEFORE it
278
+ * is written (config-editor/src/index.ts:103), so a widening write is refused
279
+ * instead of stored, and the ceiling is the value in effect at that moment.
280
+ * @param candidate - the caps of the candidate config; an absent key is unconstrained.
281
+ * @param ceilings - the caps in effect before the write.
282
+ * @throws when a candidate cap exceeds its ceiling.
294
283
  */
295
- function validateSkillSettings(value, ceilings) {
296
- for (const key of SKILL_SETTINGS_CAPS) if (value[key] > ceilings[key]) throw new Error(`${key} may only be tightened: ${value[key]} exceeds the deployment value ${ceilings[key]}`);
284
+ function validateSkillSettings(candidate, ceilings) {
285
+ for (const key of SKILL_SETTINGS_CAPS) {
286
+ const next = candidate[key];
287
+ if (next !== void 0 && next > ceilings[key]) throw new Error(`${key} may only be tightened: ${next} exceeds the deployment value ${ceilings[key]}`);
288
+ }
297
289
  }
298
290
  /**
299
291
  * What the staged skill write WOULD store, resolved WITHOUT writing.
@@ -429,6 +421,12 @@ function policySnapshotOf(source) {
429
421
  return source?.get?.();
430
422
  }
431
423
  function apply(ctx, rawConfig = {}) {
424
+ ctx.inject(["settings"], (injected) => {
425
+ const settings = injected.settings;
426
+ if (typeof settings?.configure !== "function") return;
427
+ const disposer = settings.configure({ auto: false });
428
+ if (typeof disposer === "function") ctx.effect(() => disposer, "tool-skill-manage: settings presentation");
429
+ });
432
430
  const systemPrompt = ctx.get("systemPrompt");
433
431
  if (systemPrompt) ctx.effect(() => {
434
432
  const disposeVariable = systemPrompt.variable(PROTECTED_SKILLS_VARIABLE, () => protectedSkillsLine());
@@ -511,18 +509,72 @@ function apply(ctx, rawConfig = {}) {
511
509
  }
512
510
  };
513
511
  const io = evolutionIoAdapter(() => ctx.evolutionIo.provider());
514
- const numericClamped = [];
512
+ const clampedKeys = /* @__PURE__ */ new Set();
515
513
  const limit = (name, value, fallback) => {
516
- const result = clampedNumber(value, fallback, { min: 1 });
517
- if (value !== void 0 && result !== value) numericClamped.push(name);
514
+ const current = typeof value === "object" ? value.get() : value;
515
+ const result = clampedNumber(current, fallback, { min: 1 });
516
+ if (current !== void 0 && result !== current && !clampedKeys.has(name)) {
517
+ clampedKeys.add(name);
518
+ ctx.logger.warn(`tool-skill-manage: ${name} provided an invalid value; falling back to the default`);
519
+ }
518
520
  return result;
519
521
  };
520
- const libraryLimits = {
521
- ...policyStageLimits(policySnapshotOf(ctx.get("evolutionPolicy"))),
522
- maxNameLength: limit("maxSkillNameLength", rawConfig.maxSkillNameLength, DEFAULT_SKILL_LIMITS.maxNameLength),
523
- maxDescriptionLength: limit("maxDescriptionLength", rawConfig.maxDescriptionLength, DEFAULT_SKILL_LIMITS.maxDescriptionLength),
524
- maxSkillContentChars: limit("maxSkillContentChars", readNumberParam(rawConfig, "skillContentChars"), DEFAULT_SKILL_LIMITS.maxSkillContentChars),
522
+ /**
523
+ * This row's write knobs as they stand RIGHT NOW (G1 §8.3) — the base layer of the
524
+ * precedence chain. The ten E3 keys are live references the platform updates in
525
+ * place, and the deprecated `maxSkillContentChars` alias stays the fallback spelling
526
+ * of `skillContentChars`. Every numeric field is clamped (V6-06).
527
+ * @returns the row layer of the write settings.
528
+ */
529
+ const rowSettings = () => ({
530
+ skillContentChars: limit("maxSkillContentChars", rawConfig.skillContentChars?.get() ?? rawConfig.maxSkillContentChars, DEFAULT_SKILL_LIMITS.maxSkillContentChars),
525
531
  maxSkillFileBytes: limit("maxSkillFileBytes", rawConfig.maxSkillFileBytes, DEFAULT_SKILL_LIMITS.maxSkillFileBytes),
532
+ maxSkillNameLength: limit("maxSkillNameLength", rawConfig.maxSkillNameLength, DEFAULT_SKILL_LIMITS.maxNameLength),
533
+ maxDescriptionLength: limit("maxDescriptionLength", rawConfig.maxDescriptionLength, DEFAULT_SKILL_LIMITS.maxDescriptionLength),
534
+ descriptionStrict: rawConfig.descriptionStrict?.get() ?? false,
535
+ strictCrossSource: rawConfig.strictCrossSource?.get() ?? false,
536
+ citationPolicy: rawConfig.citationPolicy?.get() ?? DEFAULT_CITATION_POLICY,
537
+ supportFileCharPolicy: rawConfig.supportFileCharPolicy?.get() ?? DEFAULT_SUPPORT_FILE_CHAR_POLICY,
538
+ skillWriteConfirm: rawConfig.skillWriteConfirm?.get() ?? "auto",
539
+ skillWriteConfirmTimeoutSeconds: limit("skillWriteConfirmTimeoutSeconds", rawConfig.skillWriteConfirmTimeoutSeconds, 120)
540
+ });
541
+ /**
542
+ * The keys the user set in this row's namespace (G1 §8.4-A). This is the ONLY
543
+ * remaining read of the settings user layer, and it reads KEY NAMES, never values:
544
+ * the platform resolves the user layer into the row's live fields, so the value
545
+ * comes from `rowSettings()`.
546
+ * @returns the keys present in this row's user layer.
547
+ */
548
+ const userSetKeys = () => {
549
+ const entry = ctx.get("settings")?.describe?.({ redactSecrets: false }).find((item) => item.ns === paramRowId("tool-skill-manage"));
550
+ return new Set(Object.keys(entry?.user ?? {}));
551
+ };
552
+ /**
553
+ * G3/S3.4 + G1: the USER layer sits above the deployment carriers. `settings()` is
554
+ * the one reader of this group's knobs — a key the user set (whose value arrived
555
+ * through the row's live field), then the policy STAGES, then this row. Consumers
556
+ * read it at USE time, so a committed change takes effect at the NEXT write with no
557
+ * restart.
558
+ * @returns the resolved write settings.
559
+ */
560
+ const settings = () => {
561
+ const row = rowSettings();
562
+ const stages = policyStageLimits(policySnapshotOf(ctx.get("evolutionPolicy")));
563
+ const userSet = userSetKeys();
564
+ return {
565
+ ...row,
566
+ citationPolicy: userSet.has("citationPolicy") ? row.citationPolicy : stages.citationPolicy ?? row.citationPolicy,
567
+ supportFileCharPolicy: userSet.has("supportFileCharPolicy") ? row.supportFileCharPolicy : stages.supportFileCharPolicy ?? row.supportFileCharPolicy
568
+ };
569
+ };
570
+ const libraryLimits = {
571
+ maxNameLength: DEFAULT_SKILL_LIMITS.maxNameLength,
572
+ maxDescriptionLength: DEFAULT_SKILL_LIMITS.maxDescriptionLength,
573
+ maxSkillContentChars: DEFAULT_SKILL_LIMITS.maxSkillContentChars,
574
+ maxSkillFileBytes: DEFAULT_SKILL_LIMITS.maxSkillFileBytes,
575
+ referenceRewrite: DEFAULT_REFERENCE_REWRITE_POLICY,
576
+ archiveRetention: DEFAULT_ARCHIVE_RETENTION_POLICY,
577
+ supportFileCharPolicy: DEFAULT_SUPPORT_FILE_CHAR_POLICY,
526
578
  versionKeep: limit("skillVersionKeep", rawConfig.skillVersionKeep, DEFAULT_SKILL_LIMITS.versionKeep ?? DEFAULT_SKILL_VERSION_KEEP)
527
579
  };
528
580
  const library = newSkillLibrary({
@@ -532,38 +584,7 @@ function apply(ctx, rawConfig = {}) {
532
584
  ctx,
533
585
  threatExemptLabels: rawConfig.threatExemptLabels
534
586
  });
535
- if (numericClamped.length > 0) ctx.logger.warn(`tool-skill-manage: ${numericClamped.join(", ")} provided an invalid value; falling back to the default`);
536
- const settingsBase = {
537
- skillContentChars: libraryLimits.maxSkillContentChars,
538
- maxSkillFileBytes: libraryLimits.maxSkillFileBytes,
539
- maxSkillNameLength: libraryLimits.maxNameLength,
540
- maxDescriptionLength: libraryLimits.maxDescriptionLength,
541
- descriptionStrict: rawConfig.descriptionStrict ?? false,
542
- strictCrossSource: rawConfig.strictCrossSource ?? false,
543
- citationPolicy: libraryLimits.citationPolicy ?? DEFAULT_CITATION_POLICY,
544
- supportFileCharPolicy: libraryLimits.supportFileCharPolicy ?? DEFAULT_SUPPORT_FILE_CHAR_POLICY,
545
- skillWriteConfirm: rawConfig.skillWriteConfirm ?? "auto",
546
- skillWriteConfirmTimeoutSeconds: rawConfig.skillWriteConfirmTimeoutSeconds ?? 120
547
- };
548
- const section = {};
549
- const settings = () => {
550
- const stages = policyStageLimits(policySnapshotOf(ctx.get("evolutionPolicy")));
551
- const overridden = (key) => section.overrides?.get(key);
552
- const pick = (key) => overridden(key) ?? settingsBase[key];
553
- const cap = (value, lower) => clampedNumber(value, lower, { min: 1 });
554
- return {
555
- skillContentChars: cap(pick("skillContentChars"), settingsBase.skillContentChars),
556
- maxSkillFileBytes: cap(pick("maxSkillFileBytes"), settingsBase.maxSkillFileBytes),
557
- maxSkillNameLength: cap(pick("maxSkillNameLength"), settingsBase.maxSkillNameLength),
558
- maxDescriptionLength: cap(pick("maxDescriptionLength"), settingsBase.maxDescriptionLength),
559
- descriptionStrict: pick("descriptionStrict"),
560
- strictCrossSource: pick("strictCrossSource"),
561
- citationPolicy: overridden("citationPolicy") ?? stages.citationPolicy ?? settingsBase.citationPolicy,
562
- supportFileCharPolicy: overridden("supportFileCharPolicy") ?? stages.supportFileCharPolicy ?? settingsBase.supportFileCharPolicy,
563
- skillWriteConfirm: pick("skillWriteConfirm"),
564
- skillWriteConfirmTimeoutSeconds: pick("skillWriteConfirmTimeoutSeconds")
565
- };
566
- };
587
+ /** Write the CURRENT resolved settings into the library's live limits object. */
567
588
  const applyLimits = () => {
568
589
  const resolved = settings();
569
590
  const stages = policyStageLimits(policySnapshotOf(ctx.get("evolutionPolicy")));
@@ -578,21 +599,17 @@ function apply(ctx, rawConfig = {}) {
578
599
  supportFileCharPolicy: resolved.supportFileCharPolicy
579
600
  });
580
601
  };
581
- section.overrides = installParamSection(ctx, paramNamespace("tool-skill-manage"), SKILLS_SETTINGS_SCHEMA, settingsBase, {
582
- warn: (message) => {
583
- ctx.logger.warn("dsh-evolution-skills: " + message);
584
- },
585
- validate: (value) => {
586
- validateSkillSettings(value, {
587
- skillContentChars: settingsBase.skillContentChars,
588
- maxSkillFileBytes: settingsBase.maxSkillFileBytes,
589
- maxSkillNameLength: settingsBase.maxSkillNameLength,
590
- maxDescriptionLength: settingsBase.maxDescriptionLength
591
- });
592
- },
593
- onChange: () => {
594
- applyLimits();
595
- }
602
+ ctx.on("internal/config", function(_previous, next) {
603
+ const value = next();
604
+ if (this !== ctx.fiber) return value;
605
+ const ceilings = rowSettings();
606
+ validateSkillSettings(value, {
607
+ skillContentChars: ceilings.skillContentChars,
608
+ maxSkillFileBytes: ceilings.maxSkillFileBytes,
609
+ maxSkillNameLength: ceilings.maxSkillNameLength,
610
+ maxDescriptionLength: ceilings.maxDescriptionLength
611
+ });
612
+ return value;
596
613
  });
597
614
  applyLimits();
598
615
  let crossSourceViewWarned = false;
@@ -877,6 +894,7 @@ function apply(ctx, rawConfig = {}) {
877
894
  },
878
895
  isConcurrencySafe: () => false,
879
896
  async execute(args, exec) {
897
+ applyLimits();
880
898
  let operation = args;
881
899
  const origins = resolveExecOrigins(exec);
882
900
  const reviewOrigin = origins.approval;
@@ -895,7 +913,7 @@ function apply(ctx, rawConfig = {}) {
895
913
  args,
896
914
  origin: libraryOrigin,
897
915
  protectedNames: protectedSkillNamesOf(),
898
- readNames: sessionReadSkillNames(exec.agent?.session),
916
+ readNames: sessionReadSkillNames(ctx, exec.agent?.session),
899
917
  confirm: async (request) => confirmSkillWrite(request, exec),
900
918
  confirmMode: settings().skillWriteConfirm,
901
919
  confirmTimeoutSeconds: settings().skillWriteConfirmTimeoutSeconds,
@@ -977,4 +995,4 @@ function apply(ctx, rawConfig = {}) {
977
995
  });
978
996
  }
979
997
  //#endregion
980
- export { Config, SKILLS_SETTINGS_SCHEMA, SKILL_SETTINGS_CAPS, apply, inject, name, validateSkillSettings };
998
+ export { Config, SKILL_SETTINGS_CAPS, apply, inject, name, validateSkillSettings };
@@ -17,7 +17,7 @@
17
17
  * documented in the README Safety model section.
18
18
  * @module @lmzhen/dsh-tool-skill-manage
19
19
  */
20
- import type { Context } from '@deepseek-ai/cordis';
20
+ import type { Context, Volatile } from '@deepseek-ai/cordis';
21
21
  import z from '@deepseek-ai/schemastery';
22
22
  import type { CitationPolicy, SupportFileCharPolicy } from '@lmzhen/dsh-evolution-core';
23
23
  import { type WriteConfirmMode } from './write-gates.ts';
@@ -26,17 +26,26 @@ export declare const inject: string[];
26
26
  export interface Config {
27
27
  /** Skill tree root; empty uses $DSH_HOME/skills. Align with skill-usage/catalog rows. */
28
28
  root?: string;
29
- maxSkillNameLength?: number;
30
- maxDescriptionLength?: number;
31
- /** Read cap for SKILL.md writes. Same semantic as the policy row's
32
- * `skillContentChars` (the canonical id, G0/S0.2) — but NO automatic
33
- * shadowing today: this row's value is what the write paths use, which is
34
- * what the G3 unification has to close. Deprecated alias (G0/S0.3): still
35
- * readable, refused by writes; removed in 0.7.0. */
29
+ maxSkillNameLength?: Volatile<number>;
30
+ maxDescriptionLength?: Volatile<number>;
31
+ /** Read cap for SKILL.md writes — the CANONICAL registry id (G1) and a LIVE row
32
+ * field; the deprecated alias below is the fallback spelling. No schema default:
33
+ * the alias carries it, and a default on the canonical key would fill it and make
34
+ * the alias unreachable. */
35
+ skillContentChars?: Volatile<number | undefined>;
36
+ /** Refuse a move that would leave a dangling reference, or verify it — the
37
+ * CANONICAL registry id (G1). The user layer sits above the policy stages,
38
+ * which sit above this row. */
39
+ citationPolicy?: Volatile<CitationPolicy | undefined>;
40
+ /** Warn about an oversize support file, or refuse the write — the CANONICAL
41
+ * registry id (G1). */
42
+ supportFileCharPolicy?: Volatile<SupportFileCharPolicy | undefined>;
43
+ /** Deprecated alias of `skillContentChars` (G0/S0.3): still readable, refused
44
+ * by writes; removed in 0.7.0. */
36
45
  maxSkillContentChars?: number;
37
- maxSkillFileBytes?: number;
46
+ maxSkillFileBytes?: Volatile<number>;
38
47
  /** When true, create/update refuse a description over the 60-char authoring bar (default: advisory feedback only). */
39
- descriptionStrict?: boolean;
48
+ descriptionStrict?: Volatile<boolean>;
40
49
  /** V10-03 (P2-18): threat-scan exemption labels forwarded to the skill
41
50
  * write path (core `ScanOptions.excludeLabels`). Default empty — the
42
51
  * strict ANY-hit-blocks behavior is unchanged; deployments opt in per
@@ -46,18 +55,48 @@ export interface Config {
46
55
  * catalog resolves to a NON-family source (project/custom sources outrank
47
56
  * the family tree) is REFUSED instead of warned about. Default false —
48
57
  * warn only, keeping the family tree an autonomous evolution zone. */
49
- strictCrossSource?: boolean;
58
+ strictCrossSource?: Volatile<boolean>;
50
59
  /** Content versions retained per skill (skill-history.ts). E2: a deployment value on this row,
51
60
  * like the four caps above — the settings layer deliberately has no card for it (retention is
52
61
  * storage policy, not an authoring knob). */
53
62
  skillVersionKeep?: number;
54
63
  /** What the ONE confirmation before a create or a bare delete does (registry `skillWriteConfirm`).
55
64
  * Default `auto`: an unattended run must not park a tool call on a question nobody will answer. */
56
- skillWriteConfirm?: WriteConfirmMode;
65
+ skillWriteConfirm?: Volatile<WriteConfirmMode>;
57
66
  /** Seconds a `timeout`-mode prompt waits for an answer before the write is cancelled. */
58
- skillWriteConfirmTimeoutSeconds?: number;
67
+ skillWriteConfirmTimeoutSeconds?: Volatile<number>;
59
68
  }
60
- export declare const Config: z<Config>;
69
+ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
70
+ root: z<string, string, "defined">;
71
+ maxSkillNameLength: z<number, number, "volatile-defined">;
72
+ maxDescriptionLength: z<number, number, "volatile-defined">;
73
+ skillContentChars: z<number, number, "volatile">;
74
+ citationPolicy: z<"verify" | "refuse", "verify" | "refuse", "volatile">;
75
+ supportFileCharPolicy: z<"report" | "enforce", "report" | "enforce", "volatile">;
76
+ maxSkillContentChars: z<number, number, "defined">;
77
+ maxSkillFileBytes: z<number, number, "volatile-defined">;
78
+ descriptionStrict: z<boolean, boolean, "volatile-defined">;
79
+ threatExemptLabels: z<string[], string[], "defined">;
80
+ strictCrossSource: z<boolean, boolean, "volatile-defined">;
81
+ skillVersionKeep: z<number, number, "defined">;
82
+ skillWriteConfirm: z<"auto" | "ask" | "timeout", "auto" | "ask" | "timeout", "volatile-defined">;
83
+ skillWriteConfirmTimeoutSeconds: z<number, number, "volatile-defined">;
84
+ }>>, Schemastery.ObjectT<NoInfer<{
85
+ root: z<string, string, "defined">;
86
+ maxSkillNameLength: z<number, number, "volatile-defined">;
87
+ maxDescriptionLength: z<number, number, "volatile-defined">;
88
+ skillContentChars: z<number, number, "volatile">;
89
+ citationPolicy: z<"verify" | "refuse", "verify" | "refuse", "volatile">;
90
+ supportFileCharPolicy: z<"report" | "enforce", "report" | "enforce", "volatile">;
91
+ maxSkillContentChars: z<number, number, "defined">;
92
+ maxSkillFileBytes: z<number, number, "volatile-defined">;
93
+ descriptionStrict: z<boolean, boolean, "volatile-defined">;
94
+ threatExemptLabels: z<string[], string[], "defined">;
95
+ strictCrossSource: z<boolean, boolean, "volatile-defined">;
96
+ skillVersionKeep: z<number, number, "defined">;
97
+ skillWriteConfirm: z<"auto" | "ask" | "timeout", "auto" | "ask" | "timeout", "volatile-defined">;
98
+ skillWriteConfirmTimeoutSeconds: z<number, number, "volatile-defined">;
99
+ }>>, "plain">;
61
100
  /** Write behaviour a user may change (G3/S3.4). Field names are the CANONICAL
62
101
  * parameter ids from the registry. The four caps are TIGHTEN-ONLY: the settings
63
102
  * `validate` hook refuses a value above what the deployment allocated, because
@@ -84,18 +123,19 @@ export interface SkillSettings {
84
123
  /** Seconds a `timeout`-mode confirmation waits before the write is cancelled. */
85
124
  skillWriteConfirmTimeoutSeconds: number;
86
125
  }
87
- /** Schema the platform validates the user layer against; defaults mirror the core
88
- * constants and the row schema, so an empty document resolves to today's behaviour. */
89
- export declare const SKILLS_SETTINGS_SCHEMA: z<SkillSettings>;
90
126
  /** The four caps a user may only tighten, in schema order (the sentry reads it). */
91
127
  export declare const SKILL_SETTINGS_CAPS: readonly ["skillContentChars", "maxSkillFileBytes", "maxSkillNameLength", "maxDescriptionLength"];
92
128
  /**
93
- * Refuse a resolved section whose cap sits ABOVE the deployment's allocation.
129
+ * Refuse a candidate config whose cap sits ABOVE the value in effect.
94
130
  * Windows have no single-field bound the schema could express, and a user who
95
- * widened one would spend a budget the deployment set for the whole library.
96
- * @param value - the resolved section the platform hands the owner.
97
- * @param ceilings - the deployment values (the plugin row, after its clamps).
131
+ * widened one would spend a budget the deployment set for the whole library. The
132
+ * platform runs this rule through the config waterfall on every candidate BEFORE it
133
+ * is written (config-editor/src/index.ts:103), so a widening write is refused
134
+ * instead of stored, and the ceiling is the value in effect at that moment.
135
+ * @param candidate - the caps of the candidate config; an absent key is unconstrained.
136
+ * @param ceilings - the caps in effect before the write.
137
+ * @throws when a candidate cap exceeds its ceiling.
98
138
  */
99
- export declare function validateSkillSettings(value: SkillSettings, ceilings: Pick<SkillSettings, (typeof SKILL_SETTINGS_CAPS)[number]>): void;
139
+ export declare function validateSkillSettings(candidate: Partial<Pick<SkillSettings, (typeof SKILL_SETTINGS_CAPS)[number]>>, ceilings: Pick<SkillSettings, (typeof SKILL_SETTINGS_CAPS)[number]>): void;
100
140
  export declare function apply(ctx: Context, rawConfig?: Config): void;
101
141
  //# sourceMappingURL=index.d.ts.map
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.16.1",
4
+ "version": "0.17.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.1",
30
- "@lmzhen/dsh-evolution-approval": "^0.16.1",
31
- "@lmzhen/dsh-evolution-core": "^0.16.1"
30
+ "@lmzhen/dsh-evolution-approval": "^0.17.0",
31
+ "@lmzhen/dsh-evolution-core": "^0.17.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@deepseek-ai/cordis": "^4.0.1",
35
- "@deepseek-ai/dsh-skill": "^0.1.5-rc.2",
36
- "@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.2",
37
- "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
38
- "@lmzhen/dsh-evolution-io": "^0.16.1",
39
- "@lmzhen/dsh-skill-usage": "^0.16.1"
35
+ "@deepseek-ai/dsh-skill": "^0.2.0-rc.1",
36
+ "@deepseek-ai/dsh-system-prompt": "^0.2.0-rc.1",
37
+ "@deepseek-ai/dsh-tools": "^0.2.0-rc.1",
38
+ "@lmzhen/dsh-evolution-io": "^0.17.0",
39
+ "@lmzhen/dsh-skill-usage": "^0.17.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@deepseek-ai/dsh-agent-loop-testkit": "^0.1.5-rc.2",
43
- "@deepseek-ai/dsh-skill": "^0.1.5-rc.2",
44
- "@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.2",
45
- "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
46
- "@lmzhen/dsh-evolution-core": "^0.16.1",
47
- "@lmzhen/dsh-evolution-io": "^0.16.1",
48
- "@lmzhen/dsh-skill-usage": "^0.16.1"
42
+ "@deepseek-ai/dsh-agent-loop-testkit": "^0.2.0-rc.1",
43
+ "@deepseek-ai/dsh-skill": "^0.2.0-rc.1",
44
+ "@deepseek-ai/dsh-system-prompt": "^0.2.0-rc.1",
45
+ "@deepseek-ai/dsh-tools": "^0.2.0-rc.1",
46
+ "@lmzhen/dsh-evolution-core": "^0.17.0",
47
+ "@lmzhen/dsh-evolution-io": "^0.17.0",
48
+ "@lmzhen/dsh-skill-usage": "^0.17.0"
49
49
  }
50
50
  }