@lmzhen/dsh-evolution-core 0.3.49 → 0.3.51
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 +35 -26
- package/lib/types/io.d.ts +7 -3
- package/lib/types/memory-store.d.ts +6 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1611,6 +1611,28 @@ function buildLearnPrompt(userRequest) {
|
|
|
1611
1611
|
].join("\n");
|
|
1612
1612
|
}
|
|
1613
1613
|
//#endregion
|
|
1614
|
+
//#region lib/types/state-store.js
|
|
1615
|
+
/**
|
|
1616
|
+
* Evolution home path helper: `$DSH_HOME/evolution` for plugin-owned sidecar
|
|
1617
|
+
* state (reports, activity store, feedback file, state-domain data).
|
|
1618
|
+
*/
|
|
1619
|
+
/**
|
|
1620
|
+
* DSH home root: `$DSH_HOME` or `~/.dsh`. Single source of the empty-string
|
|
1621
|
+
* fallback — an EMPTY or WHITESPACE-ONLY DSH_HOME resolves to the default
|
|
1622
|
+
* home, never to a CWD-relative path (0.3.19 W1.3, 0.3.22 F-207);
|
|
1623
|
+
* V8-06 (0.3.47) extends the guard to whitespace (upstream home-paths:
|
|
1624
|
+
* `trim().length > 0` is the adoption test — `DSH_HOME=" "` must not produce
|
|
1625
|
+
* a sidecar under a relative "." path).
|
|
1626
|
+
*/
|
|
1627
|
+
function evolutionRoot(env = process.env) {
|
|
1628
|
+
return env.DSH_HOME?.trim() ? env.DSH_HOME : join(homedir(), ".dsh");
|
|
1629
|
+
}
|
|
1630
|
+
/** Evolution home path helper: `$DSH_HOME/evolution` for plugin-owned sidecar
|
|
1631
|
+
* state (reports, activity store, feedback file, state-domain data). */
|
|
1632
|
+
function evolutionHome(env = process.env) {
|
|
1633
|
+
return join(evolutionRoot(env), "evolution");
|
|
1634
|
+
}
|
|
1635
|
+
//#endregion
|
|
1614
1636
|
//#region lib/types/serial.js
|
|
1615
1637
|
/**
|
|
1616
1638
|
* A process-local serial task queue: each task starts only after the previous
|
|
@@ -1788,7 +1810,7 @@ const PATTERNS = [
|
|
|
1788
1810
|
label: "ssh_backdoor",
|
|
1789
1811
|
category: "persistence",
|
|
1790
1812
|
scope: "strict",
|
|
1791
|
-
regex: /
|
|
1813
|
+
regex: /\bauthorized_keys\b/i
|
|
1792
1814
|
},
|
|
1793
1815
|
{
|
|
1794
1816
|
label: "agent_config_mod",
|
|
@@ -1961,7 +1983,7 @@ function previewEntries(entries) {
|
|
|
1961
1983
|
return `\n\nCurrent entries (preview):\n${shown.join("\n")}${more}`;
|
|
1962
1984
|
}
|
|
1963
1985
|
function memoryRoot(env = process.env) {
|
|
1964
|
-
return join(env
|
|
1986
|
+
return join(evolutionRoot(env), "memories");
|
|
1965
1987
|
}
|
|
1966
1988
|
function fileFor(root, target) {
|
|
1967
1989
|
return join(root, target === "memory" ? "MEMORY.md" : "USER.md");
|
|
@@ -2071,7 +2093,12 @@ var MemoryStore = class {
|
|
|
2071
2093
|
* never loaded just to back it up. Failure to back up does not change the
|
|
2072
2094
|
* refusal semantics. V8-23⑫ (0.3.49): ONE fixed backup name per target —
|
|
2073
2095
|
* a fresh refusal overwrites it (the previous timestamped names accumulated
|
|
2074
|
-
* per drift incident with no retention policy).
|
|
2096
|
+
* per drift incident with no retention policy). V9-08 (0.3.51) declares the
|
|
2097
|
+
* two failure shapes: (1) the pre-copy remove of the previous `.bak` fails —
|
|
2098
|
+
* harmless, because the copy contract is overwrite (`cp force`);
|
|
2099
|
+
* (2) the copy itself fails (disk/backend) — returns `null` and the refusal
|
|
2100
|
+
* message simply carries no backup suffix; the refusal semantics and the
|
|
2101
|
+
* on-disk file are untouched either way.
|
|
2075
2102
|
*/
|
|
2076
2103
|
async backupFile(target) {
|
|
2077
2104
|
const path = fileFor(this.root, target);
|
|
@@ -3056,7 +3083,7 @@ const RESTRUCTURE_TARGET_RE = /^references\/[a-z0-9](?!.*\.\.)[a-z0-9._-]*\.md$/
|
|
|
3056
3083
|
/** Extra file name carried inside a snapshot's `extras/` directory. */
|
|
3057
3084
|
const SNAPSHOT_EXTRA_NAME_RE = /^[a-z0-9][a-z0-9._-]*$/;
|
|
3058
3085
|
function skillsRoot(env = process.env) {
|
|
3059
|
-
return join(env
|
|
3086
|
+
return join(evolutionRoot(env), "skills");
|
|
3060
3087
|
}
|
|
3061
3088
|
/** 0.3.18 (S4.1, E-30): the ONE root resolution for every member that reads
|
|
3062
3089
|
* the skills tree — tool-skill-manage / evolution-skill-catalog / skill-usage
|
|
@@ -4220,6 +4247,10 @@ var SkillLibrary = class {
|
|
|
4220
4247
|
}
|
|
4221
4248
|
const archived = [];
|
|
4222
4249
|
try {
|
|
4250
|
+
if (!await this.io.readText(join(targetDir, "SKILL.md"))) return {
|
|
4251
|
+
ok: false,
|
|
4252
|
+
message: `Skill "${targetName}" not found.`
|
|
4253
|
+
};
|
|
4223
4254
|
for (const source of normalizedSources) {
|
|
4224
4255
|
const result = await this.archive(source, { absorbedInto: targetName });
|
|
4225
4256
|
if (!result.ok) throw new Error(result.message);
|
|
@@ -4847,26 +4878,4 @@ var SkillLibrary = class {
|
|
|
4847
4878
|
}
|
|
4848
4879
|
};
|
|
4849
4880
|
//#endregion
|
|
4850
|
-
//#region lib/types/state-store.js
|
|
4851
|
-
/**
|
|
4852
|
-
* Evolution home path helper: `$DSH_HOME/evolution` for plugin-owned sidecar
|
|
4853
|
-
* state (reports, activity store, feedback file, state-domain data).
|
|
4854
|
-
*/
|
|
4855
|
-
/**
|
|
4856
|
-
* DSH home root: `$DSH_HOME` or `~/.dsh`. Single source of the empty-string
|
|
4857
|
-
* fallback — an EMPTY or WHITESPACE-ONLY DSH_HOME resolves to the default
|
|
4858
|
-
* home, never to a CWD-relative path (0.3.19 W1.3, 0.3.22 F-207);
|
|
4859
|
-
* V8-06 (0.3.47) extends the guard to whitespace (upstream home-paths:
|
|
4860
|
-
* `trim().length > 0` is the adoption test — `DSH_HOME=" "` must not produce
|
|
4861
|
-
* a sidecar under a relative "." path).
|
|
4862
|
-
*/
|
|
4863
|
-
function evolutionRoot(env = process.env) {
|
|
4864
|
-
return env.DSH_HOME?.trim() ? env.DSH_HOME : join(homedir(), ".dsh");
|
|
4865
|
-
}
|
|
4866
|
-
/** Evolution home path helper: `$DSH_HOME/evolution` for plugin-owned sidecar
|
|
4867
|
-
* state (reports, activity store, feedback file, state-domain data). */
|
|
4868
|
-
function evolutionHome(env = process.env) {
|
|
4869
|
-
return join(evolutionRoot(env), "evolution");
|
|
4870
|
-
}
|
|
4871
|
-
//#endregion
|
|
4872
4881
|
export { AUTHORING_DESCRIPTION_BAR, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_HEALTH_THRESHOLDS, 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, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, EVENT_ARCHIVE_PREFIX, EVENT_LOG_RETAIN_ARCHIVES, EVENT_LOG_ROTATE_AT, EVENT_LOG_VERSION, EVOLUTION_WRITE_TOOLS, EvolutionGateSet, FORBIDDEN_CONTROL_KEYS, HEALTH_STAMP_RE, LOW_QUALITY_THRESHOLD, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_RESTRUCTURE_MOVES, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MEMORY_REVIEW_PROMPT, MIN_STAMP_BODY_CHARS, MUTATIONS_FILE_VERSION, MemoryStore, PATTERN_OVERLAP, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, QUALITY_WEIGHTS, RESTRUCTURE_TARGET_RE, SKILLS_GUIDANCE, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, SUPPORT_DIRS, SUPPRESSED_FILE_VERSION, SkillLibrary, advanceReview, appendEvolutionEvent, applyCuratorFields, applyCuratorLifecycleFields, applyCuratorMetaFields, assessStructureHealth, authoringFeedback, buildCuratorRunReport, buildLearnPrompt, bumpPatch, bumpUse, bumpView, clampedNumber, composePresetComposition, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, duplicateHeadings, emptyRecord, evaluateThreat, eventsFile, evolutionHome, evolutionIoAdapter, evolutionRoot, findDriftSignal, foldCuratorFields, foldTurn, frontmatterBlock, frontmatterYamlUnsafeValues, getRecord, latestActivityAt, lifecycleCandidate, listEventArchives, loadMutations, loadSuppressedNames, loadUsage, makeSerialQueue, markAgentCreated, markerEntryName, memoryRoot, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, observeEvent, overlongLines, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, pendingSelfCleanup, readEvolutionEvents, readEvolutionTimeline, recordMutation, redactSecrets, relatedSkillNames, renameWithRetry, renderCuratorReportMarkdown, resolveOrigins, resolveSkillsRoot, retainEventArchives, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, transactIo, updateSuppressedNames, usageFile, usageObserved, validateFrontmatter, verifyPromptBundle, yamlPlainScalarNeedsQuotes };
|
package/lib/types/io.d.ts
CHANGED
|
@@ -42,9 +42,13 @@ export interface EvolutionIoLike {
|
|
|
42
42
|
/**
|
|
43
43
|
* Optional mtime-generation probe (0.3.18, E-71): the path's mtime in
|
|
44
44
|
* milliseconds since epoch, or `null` when unknown (unsupported backend,
|
|
45
|
-
* missing path, stat failure).
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* missing path, stat failure). Intended as a cheap invalidation stamp for a
|
|
46
|
+
* cached directory listing; a backend without it keeps event-driven
|
|
47
|
+
* invalidation only. V9-07 (0.3.51): as of this release NO in-tree consumer
|
|
48
|
+
* calls it — skill-catalog invalidation is event-driven
|
|
49
|
+
* (`evolution/skill-mutated` / `evolution/skills-refresh`). The probe stays
|
|
50
|
+
* as a backend contract extension point; document it here before wiring a
|
|
51
|
+
* consumer.
|
|
48
52
|
*/
|
|
49
53
|
mtime?(this: void, path: string): Promise<number | null>;
|
|
50
54
|
}
|
|
@@ -67,7 +67,12 @@ export declare class MemoryStore {
|
|
|
67
67
|
* never loaded just to back it up. Failure to back up does not change the
|
|
68
68
|
* refusal semantics. V8-23⑫ (0.3.49): ONE fixed backup name per target —
|
|
69
69
|
* a fresh refusal overwrites it (the previous timestamped names accumulated
|
|
70
|
-
* per drift incident with no retention policy).
|
|
70
|
+
* per drift incident with no retention policy). V9-08 (0.3.51) declares the
|
|
71
|
+
* two failure shapes: (1) the pre-copy remove of the previous `.bak` fails —
|
|
72
|
+
* harmless, because the copy contract is overwrite (`cp force`);
|
|
73
|
+
* (2) the copy itself fails (disk/backend) — returns `null` and the refusal
|
|
74
|
+
* message simply carries no backup suffix; the refusal semantics and the
|
|
75
|
+
* on-disk file are untouched either way.
|
|
71
76
|
*/
|
|
72
77
|
private backupFile;
|
|
73
78
|
/**
|
package/package.json
CHANGED