@lmzhen/dsh-evolution-core 0.1.0-rc.18 → 0.1.0-rc.19
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 +18 -8
- package/lib/types/curator.d.ts +2 -0
- package/lib/types/mutations.d.ts +3 -1
- package/lib/types/usage.d.ts +2 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -155,7 +155,9 @@ function latestActivityAt(record) {
|
|
|
155
155
|
* Curator suppression sidecar: built-in skills the curator has archived stay
|
|
156
156
|
* suppressed across re-seeds, so the lifecycle never fights a re-created
|
|
157
157
|
* bundled skill. Best-effort load/save, mirroring the usage sidecar posture.
|
|
158
|
+
* Versioned shape ({ version, names }) with legacy plain-array compat.
|
|
158
159
|
*/
|
|
160
|
+
const SUPPRESSED_FILE_VERSION = 1;
|
|
159
161
|
function suppressedFile(root) {
|
|
160
162
|
return join(root, ".curator-suppressed.json");
|
|
161
163
|
}
|
|
@@ -164,14 +166,17 @@ async function loadSuppressedNames(root, io = nodeEvolutionIo()) {
|
|
|
164
166
|
if (raw === null) return /* @__PURE__ */ new Set();
|
|
165
167
|
try {
|
|
166
168
|
const parsed = JSON.parse(raw);
|
|
167
|
-
|
|
168
|
-
return new Set(
|
|
169
|
+
const names = Array.isArray(parsed) ? parsed : typeof parsed === "object" && parsed !== null && Array.isArray(parsed.names) ? parsed.names : [];
|
|
170
|
+
return new Set(names.filter((entry) => typeof entry === "string"));
|
|
169
171
|
} catch {
|
|
170
172
|
return /* @__PURE__ */ new Set();
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
175
|
async function saveSuppressedNames(root, names, io = nodeEvolutionIo()) {
|
|
174
|
-
await io.writeText(suppressedFile(root), JSON.stringify(
|
|
176
|
+
await io.writeText(suppressedFile(root), JSON.stringify({
|
|
177
|
+
version: 1,
|
|
178
|
+
names: [...names].sort()
|
|
179
|
+
}, null, 2));
|
|
175
180
|
}
|
|
176
181
|
//#endregion
|
|
177
182
|
//#region lib/types/constants.js
|
|
@@ -238,6 +243,7 @@ const DEFAULT_SKILL_CONTENT_CHARS = 1e5;
|
|
|
238
243
|
*/
|
|
239
244
|
function buildCuratorRunReport(input) {
|
|
240
245
|
return {
|
|
246
|
+
schemaVersion: 1,
|
|
241
247
|
runId: input.runId,
|
|
242
248
|
startedAt: input.startedAt,
|
|
243
249
|
finishedAt: input.finishedAt,
|
|
@@ -936,6 +942,8 @@ var MemoryStore = class {
|
|
|
936
942
|
* @module @lmzhen/dsh-evolution-core
|
|
937
943
|
*/
|
|
938
944
|
const DEFAULT_MUTATION_CAP = 500;
|
|
945
|
+
/** Version of the `.mutations.json` file shape; writers always emit the current one. */
|
|
946
|
+
const MUTATIONS_FILE_VERSION = 1;
|
|
939
947
|
function mutationsFile(root) {
|
|
940
948
|
return join(root, ".mutations.json");
|
|
941
949
|
}
|
|
@@ -947,18 +955,20 @@ async function loadMutations(root, io = nodeEvolutionIo()) {
|
|
|
947
955
|
if (raw === null) return [];
|
|
948
956
|
try {
|
|
949
957
|
const parsed = JSON.parse(raw);
|
|
950
|
-
|
|
951
|
-
return parsed.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.skillName === "string" && typeof entry.action === "string");
|
|
958
|
+
return (Array.isArray(parsed) ? parsed : typeof parsed === "object" && parsed !== null && Array.isArray(parsed.records) ? parsed.records : []).filter((entry) => typeof entry === "object" && entry !== null && typeof entry.skillName === "string" && typeof entry.action === "string");
|
|
952
959
|
} catch {
|
|
953
960
|
return [];
|
|
954
961
|
}
|
|
955
962
|
}
|
|
956
|
-
/** Append one record, trim to `cap`, and write atomically. */
|
|
963
|
+
/** Append one record, trim to `cap`, and write atomically (versioned shape). */
|
|
957
964
|
async function recordMutation(root, io, record, cap = 500) {
|
|
958
965
|
const existing = await loadMutations(root, io);
|
|
959
966
|
existing.push(record);
|
|
960
967
|
const trimmed = existing.length > cap ? existing.slice(existing.length - cap) : existing;
|
|
961
|
-
await io.writeText(mutationsFile(root), JSON.stringify(
|
|
968
|
+
await io.writeText(mutationsFile(root), JSON.stringify({
|
|
969
|
+
version: 1,
|
|
970
|
+
records: trimmed
|
|
971
|
+
}, null, 2));
|
|
962
972
|
}
|
|
963
973
|
//#endregion
|
|
964
974
|
//#region lib/types/prompts.js
|
|
@@ -1990,4 +2000,4 @@ var JsonState = class JsonState {
|
|
|
1990
2000
|
}
|
|
1991
2001
|
};
|
|
1992
2002
|
//#endregion
|
|
1993
|
-
export { COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_USER_CHAR_LIMIT, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, JsonState, LOW_QUALITY_THRESHOLD, MAX_DESCRIPTION_LENGTH, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MEMORY_REVIEW_PROMPT, MemoryStore, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, QUALITY_WEIGHTS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, SUPPORT_DIRS, SkillLibrary, advanceReview, buildCuratorRunReport, bumpPatch, bumpUse, bumpView, computeDedupGroups, computeLifecycleTransitions, computeQualityScores, contentHash, emptyRecord, evaluateThreat, evolutionHome, evolutionIoAdapter, foldTurn, getRecord, latestActivityAt, loadMutations, loadSuppressedNames, loadUsage, markAgentCreated, memoryRoot, mutationsFile, nodeEvolutionIo, observeEvent, parseCuratorNominations, parseFrontmatter, recordMutation, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, usageFile, validateFrontmatter, verifyPromptBundle };
|
|
2003
|
+
export { COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_USER_CHAR_LIMIT, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, JsonState, LOW_QUALITY_THRESHOLD, MAX_DESCRIPTION_LENGTH, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MEMORY_REVIEW_PROMPT, MUTATIONS_FILE_VERSION, MemoryStore, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, QUALITY_WEIGHTS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, SUPPORT_DIRS, SUPPRESSED_FILE_VERSION, SkillLibrary, advanceReview, buildCuratorRunReport, bumpPatch, bumpUse, bumpView, computeDedupGroups, computeLifecycleTransitions, computeQualityScores, contentHash, emptyRecord, evaluateThreat, evolutionHome, evolutionIoAdapter, foldTurn, getRecord, latestActivityAt, loadMutations, loadSuppressedNames, loadUsage, markAgentCreated, memoryRoot, mutationsFile, nodeEvolutionIo, observeEvent, parseCuratorNominations, parseFrontmatter, recordMutation, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, usageFile, validateFrontmatter, verifyPromptBundle };
|
package/lib/types/curator.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export interface CuratorFailedSkill {
|
|
|
44
44
|
reason: string;
|
|
45
45
|
}
|
|
46
46
|
export interface CuratorRunReport {
|
|
47
|
+
/** Report shape version; readers may ignore unknown fields on later versions. */
|
|
48
|
+
schemaVersion: 1;
|
|
47
49
|
runId: string;
|
|
48
50
|
startedAt: string;
|
|
49
51
|
finishedAt: string;
|
package/lib/types/mutations.d.ts
CHANGED
|
@@ -14,9 +14,11 @@ export interface MutationRecord {
|
|
|
14
14
|
at: string;
|
|
15
15
|
}
|
|
16
16
|
export declare const DEFAULT_MUTATION_CAP = 500;
|
|
17
|
+
/** Version of the `.mutations.json` file shape; writers always emit the current one. */
|
|
18
|
+
export declare const MUTATIONS_FILE_VERSION = 1;
|
|
17
19
|
export declare function mutationsFile(root: string): string;
|
|
18
20
|
export declare function contentHash(content: string): string;
|
|
19
21
|
export declare function loadMutations(root: string, io?: EvolutionIoLike): Promise<MutationRecord[]>;
|
|
20
|
-
/** Append one record, trim to `cap`, and write atomically. */
|
|
22
|
+
/** Append one record, trim to `cap`, and write atomically (versioned shape). */
|
|
21
23
|
export declare function recordMutation(root: string, io: EvolutionIoLike, record: MutationRecord, cap?: number): Promise<void>;
|
|
22
24
|
//# sourceMappingURL=mutations.d.ts.map
|
package/lib/types/usage.d.ts
CHANGED
|
@@ -34,7 +34,9 @@ export declare function latestActivityAt(record: UsageRecord): string | null;
|
|
|
34
34
|
* Curator suppression sidecar: built-in skills the curator has archived stay
|
|
35
35
|
* suppressed across re-seeds, so the lifecycle never fights a re-created
|
|
36
36
|
* bundled skill. Best-effort load/save, mirroring the usage sidecar posture.
|
|
37
|
+
* Versioned shape ({ version, names }) with legacy plain-array compat.
|
|
37
38
|
*/
|
|
39
|
+
export declare const SUPPRESSED_FILE_VERSION = 1;
|
|
38
40
|
export declare function suppressedFile(root: string): string;
|
|
39
41
|
export declare function loadSuppressedNames(root: string, io?: EvolutionIoLike): Promise<ReadonlySet<string>>;
|
|
40
42
|
export declare function saveSuppressedNames(root: string, names: ReadonlySet<string>, io?: EvolutionIoLike): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-core",
|
|
3
3
|
"description": "Shared stores, prompts, signals and lifecycle logic for the dsh-evolution plugin family (community build)",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.19",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|