@lmzhen/dsh-evolution-core 0.46.0 → 0.48.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 (101) hide show
  1. package/lib/authority-plugin.js +1 -1
  2. package/lib/composition/index.js +3 -3
  3. package/lib/{composition-Da8NfRI7.js → composition-Cqjbho0t.js} +1 -1
  4. package/lib/{ensure-C5Mo1dbB.js → ensure-CAjLGd9f.js} +1 -2
  5. package/lib/http-routes.js +21 -96
  6. package/lib/index.js +47 -246
  7. package/lib/{io-AmUf4lVY.js → io-GxghO3Ip.js} +30 -70
  8. package/lib/io-node.js +1 -1
  9. package/lib/io-registry.js +1 -35
  10. package/lib/{mutation-authority-DeJ_Wz14.js → mutation-authority-l57R626O.js} +17 -15
  11. package/lib/{mutations-DwvbjRHF.js → mutations-DQXddSJd.js} +1 -1
  12. package/lib/{numeric-DLeLvvGb.js → numeric-D8js3sqC.js} +1 -5
  13. package/lib/platform/index.js +1 -1
  14. package/lib/{platform-CFA12Jam.js → platform-Cc9cNt5j.js} +4 -28
  15. package/lib/policy.js +1 -1
  16. package/lib/runtime/plugin.js +21 -43
  17. package/lib/{session-projection-EB7mUOlJ.js → session-projection-DSXnUNZG.js} +3 -21
  18. package/lib/{skill-health-D1pZGk5V.js → skill-health-DP8z9TPf.js} +4 -25
  19. package/lib/{skill-history-CjypdYqv.js → skill-history-CxrDE3Rb.js} +54 -102
  20. package/lib/skills.js +166 -184
  21. package/lib/subagent/index.js +4 -10
  22. package/lib/types/authority.d.ts +2 -0
  23. package/lib/types/authority.js +5 -0
  24. package/lib/types/composition/preset-ids.d.ts +0 -1
  25. package/lib/types/composition/preset-ids.js +0 -1
  26. package/lib/types/constants.d.ts +0 -4
  27. package/lib/types/constants.js +0 -4
  28. package/lib/types/contract.d.ts +0 -5
  29. package/lib/types/curator.d.ts +0 -1
  30. package/lib/types/curator.js +0 -1
  31. package/lib/types/document-body.d.ts +0 -12
  32. package/lib/types/document-body.js +0 -14
  33. package/lib/types/health-baseline.d.ts +0 -13
  34. package/lib/types/health-baseline.js +0 -20
  35. package/lib/types/home-fence.d.ts +2 -0
  36. package/lib/types/home-fence.js +11 -1
  37. package/lib/types/http-routes.d.ts +9 -4
  38. package/lib/types/http-routes.js +36 -116
  39. package/lib/types/index.d.ts +0 -3
  40. package/lib/types/index.js +0 -3
  41. package/lib/types/io-registry.d.ts +0 -16
  42. package/lib/types/io-registry.js +0 -27
  43. package/lib/types/io.d.ts +6 -54
  44. package/lib/types/io.js +35 -65
  45. package/lib/types/journal-protocol.d.ts +0 -15
  46. package/lib/types/journal-protocol.js +1 -19
  47. package/lib/types/lease-store.d.ts +1 -1
  48. package/lib/types/lease-store.js +4 -15
  49. package/lib/types/live.d.ts +0 -12
  50. package/lib/types/live.js +0 -18
  51. package/lib/types/memory-store.d.ts +0 -1
  52. package/lib/types/memory-store.js +13 -6
  53. package/lib/types/mutation-authority.js +5 -0
  54. package/lib/types/mutation-unit.d.ts +1 -1
  55. package/lib/types/mutation-unit.js +14 -31
  56. package/lib/types/params.d.ts +11 -29
  57. package/lib/types/params.js +13 -60
  58. package/lib/types/platform/llm.d.ts +2 -3
  59. package/lib/types/platform/llm.js +3 -10
  60. package/lib/types/platform/projections.d.ts +4 -5
  61. package/lib/types/platform/projections.js +4 -18
  62. package/lib/types/probe.d.ts +0 -3
  63. package/lib/types/probe.js +0 -7
  64. package/lib/types/run-registry.js +10 -12
  65. package/lib/types/runtime/llm.js +2 -2
  66. package/lib/types/runtime/platform.d.ts +7 -11
  67. package/lib/types/runtime/platform.js +13 -19
  68. package/lib/types/runtime/plugin.d.ts +1 -1
  69. package/lib/types/runtime/plugin.js +6 -4
  70. package/lib/types/runtime/projections.js +1 -2
  71. package/lib/types/session-fold.d.ts +0 -8
  72. package/lib/types/session-fold.js +0 -5
  73. package/lib/types/session-projection.js +2 -2
  74. package/lib/types/skill-discovery.d.ts +0 -2
  75. package/lib/types/skill-discovery.js +1 -2
  76. package/lib/types/skill-health.d.ts +29 -1
  77. package/lib/types/skill-history.d.ts +0 -24
  78. package/lib/types/skill-history.js +0 -41
  79. package/lib/types/skill-lint.d.ts +0 -3
  80. package/lib/types/skill-lint.js +0 -12
  81. package/lib/types/skill-store.d.ts +6 -0
  82. package/lib/types/skill-store.js +130 -142
  83. package/lib/types/subagent/readiness.d.ts +0 -1
  84. package/lib/types/subagent/readiness.js +2 -8
  85. package/lib/types/tool-dispatch.d.ts +1 -16
  86. package/lib/types/tool-dispatch.js +0 -18
  87. package/lib/types/unit-journal.d.ts +1 -1
  88. package/lib/types/unit-journal.js +20 -15
  89. package/lib/types/unit-storage.d.ts +1 -1
  90. package/lib/types/unit-storage.js +5 -16
  91. package/lib/types/write-inventory.d.ts +0 -4
  92. package/lib/types/write-inventory.js +0 -9
  93. package/lib/types/write-kernel.d.ts +3 -4
  94. package/lib/types/write-kernel.js +13 -25
  95. package/lib/write.js +2 -2
  96. package/package.json +1 -1
  97. package/persisted-write-inventory.json +72 -9
  98. package/lib/types/fold-untrusted.d.ts +0 -35
  99. package/lib/types/fold-untrusted.js +0 -44
  100. package/lib/types/unit-recovery.d.ts +0 -5
  101. package/lib/types/unit-recovery.js +0 -12
@@ -668,47 +668,6 @@ export function textDiffFacts(before, after, path, maxLines = TEXT_DIFF_MAX_LINE
668
668
  truncated: oldWindow.cut || newWindow.cut,
669
669
  };
670
670
  }
671
- /** Characters one generated summary may carry. */
672
- export const VERSION_SUMMARY_MAX_CHARS = 80;
673
- /**
674
- * The fixed prompt the optional per-write summarizer runs (registry `skillVersionSummary`).
675
- *
676
- * Model-visible, so it is written from the model’s perspective and pinned: the tests assert that it
677
- * carries the skill name, the character cap and both bodies, because a silent change to a prompt is a
678
- * silent change to what every recorded version says.
679
- * @param input - the skill, the action, and the two bodies (null when absent).
680
- * @returns the prompt text.
681
- */
682
- export function versionSummaryPrompt(input) {
683
- return [
684
- 'You are writing ONE line that tells a reader what this single edit to the agent skill',
685
- '"' + input.name + '" changed. The edit action was "' + input.action + '".',
686
- 'Rules: at most ' + String(VERSION_SUMMARY_MAX_CHARS) + ' characters; the same language as the body;',
687
- 'name the decision, number or section that moved (for example "keeps 30 days instead of 90 days");',
688
- 'never say merely that something changed; no preamble, quotes, markdown or trailing period.',
689
- '',
690
- 'Body BEFORE the edit:',
691
- input.before ?? '(the skill did not exist before this edit)',
692
- '',
693
- 'Body AFTER the edit:',
694
- input.after ?? '(the skill does not exist after this edit)',
695
- ].join('\n');
696
- }
697
- /**
698
- * Reduce a model answer to the one line the index stores.
699
- * @param raw - the model’s answer, whatever shape it came in.
700
- * @param maxChars - the character cap.
701
- * @returns the one line, or undefined when there is nothing usable (callers store no summary).
702
- */
703
- export function normalizeVersionSummary(raw, maxChars = VERSION_SUMMARY_MAX_CHARS) {
704
- const firstLine = raw.split('\n').map(line => line.trim()).find(line => line !== '');
705
- if (firstLine === undefined)
706
- return undefined;
707
- const stripped = firstLine.replace(/^["'`*•s]+/u, '').replace(/["'`*s]+$/u, '').replace(/[。.]$/u, '').trim();
708
- if (stripped === '')
709
- return undefined;
710
- return stripped.length > maxChars ? stripped.slice(0, maxChars - 1) + '…' : stripped;
711
- }
712
671
  /**
713
672
  * How long ago an ISO timestamp was, as a bucket plus a count — never as a sentence.
714
673
  *
@@ -54,8 +54,5 @@ export declare function diffFindings(before: readonly LintFinding[], after: read
54
54
  worsened: LintFinding[];
55
55
  resolved: string[];
56
56
  };
57
- /** Support files = markdown files under references/ (contract §4: unit frozen, underscore-prefixed
58
- * excluded). Paths are supplied by the caller — this module never touches the filesystem. */
59
- export declare function countReferenceFiles(paths: readonly string[]): number;
60
57
  export {};
61
58
  //# sourceMappingURL=skill-lint.d.ts.map
@@ -108,16 +108,4 @@ export function diffFindings(before, after) {
108
108
  const resolved = before.filter(f => !afterByRule.has(f.rule)).map(f => f.rule);
109
109
  return { introduced, worsened, resolved };
110
110
  }
111
- /** Support files = markdown files under references/ (contract §4: unit frozen, underscore-prefixed
112
- * excluded). Paths are supplied by the caller — this module never touches the filesystem. */
113
- export function countReferenceFiles(paths) {
114
- return paths.filter((p) => {
115
- const n = p.replace(/\\/g, '/');
116
- const inReferences = n.includes('/references/') || n.startsWith('references/');
117
- if (!inReferences || !n.endsWith('.md'))
118
- return false;
119
- const base = n.slice(n.lastIndexOf('/') + 1);
120
- return !base.startsWith('_');
121
- }).length;
122
- }
123
111
  //# sourceMappingURL=skill-lint.js.map
@@ -365,6 +365,10 @@ export declare class SkillLibrary {
365
365
  */
366
366
  private unitHeadForOps;
367
367
  private withMutationLock;
368
+ /** The one MutationUnit constructor: storage ports are fixed here, callers pass the rest. */
369
+ private commitUnit;
370
+ /** The one frontmatter pipeline for create/update/patch; patch keeps its cap checks outside. */
371
+ private prepareBody;
368
372
  private lockPort;
369
373
  private recovery;
370
374
  /** Run the boot recovery once per library instance, before the first write. */
@@ -628,6 +632,7 @@ export declare class SkillLibrary {
628
632
  /** Mark merge-absorbed sources archived in the usage sidecar (FR-DATA-07). */
629
633
  private foldArchivedUsage;
630
634
  archive(rawName: string, options?: ArchiveOptions, origin?: WriteOrigin): Promise<SkillActionResult>;
635
+ private archiveCore;
631
636
  /**
632
637
  * Commit one merge plan as a single multi-skill transaction.
633
638
  *
@@ -719,6 +724,7 @@ export declare class SkillLibrary {
719
724
  * path back. The `.archive-reason` marker is dropped on restore.
720
725
  */
721
726
  restoreFromArchive(rawName: string, origin?: WriteOrigin): Promise<SkillActionResult>;
727
+ private restoreFromArchiveCore;
722
728
  writeSupportFile(rawName: string, filePath: string, content: string, origin?: WriteOrigin, anchor?: WriteAnchor): Promise<SkillActionResult>;
723
729
  private writeSupportFileCore;
724
730
  removeSupportFile(rawName: string, filePath: string, origin?: WriteOrigin, anchor?: WriteAnchor, unitId?: string): Promise<SkillActionResult>;