@lmzhen/dsh-evolution-core 0.3.14 → 0.3.15
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 +33 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/preset-composition.d.ts +18 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2117,6 +2117,38 @@ async function recordMutation(root, io, record, cap = 500) {
|
|
|
2117
2117
|
});
|
|
2118
2118
|
}
|
|
2119
2119
|
//#endregion
|
|
2120
|
+
//#region lib/types/preset-composition.js
|
|
2121
|
+
/**
|
|
2122
|
+
* Build the user-root Evolution preset composition from the RUNTIME platform's
|
|
2123
|
+
* `standard` preset rows plus the evolution delta rows (P1-1 follow-up,
|
|
2124
|
+
* 0.3.15): the agent-preset registry mounts ONE composition file verbatim, so
|
|
2125
|
+
* a delta-only `agent.cordis.yml` would produce an agent carrying only the
|
|
2126
|
+
* delta rows.
|
|
2127
|
+
*
|
|
2128
|
+
* Same contract as `install-layered.mjs` `generateAgentPreset` (the source
|
|
2129
|
+
* install path) — installer.spec pins byte parity between the two.
|
|
2130
|
+
*
|
|
2131
|
+
* Row ids are read from `- id:` lines; an id present in both fragments would
|
|
2132
|
+
* mount twice and could shadow the platform row, so it fails loud.
|
|
2133
|
+
* @param standardComposition - the runtime `standard` preset composition.
|
|
2134
|
+
* @param deltaComposition - the evolution delta fragment.
|
|
2135
|
+
* @returns the composed preset composition (standard rows first, then delta).
|
|
2136
|
+
*/
|
|
2137
|
+
function composePresetComposition(standardComposition, deltaComposition) {
|
|
2138
|
+
const standardIds = compositionRowIds(standardComposition);
|
|
2139
|
+
const collisions = [...compositionRowIds(deltaComposition)].filter((id) => standardIds.has(id)).sort();
|
|
2140
|
+
if (collisions.length > 0) throw new Error(`evolution preset composition: delta rows collide with runtime standard rows: ${collisions.join(", ")}`);
|
|
2141
|
+
return `${standardComposition.replace(/\s+$/, "")}\n\n${deltaComposition.trim()}\n`;
|
|
2142
|
+
}
|
|
2143
|
+
function compositionRowIds(composition) {
|
|
2144
|
+
const ids = /* @__PURE__ */ new Set();
|
|
2145
|
+
for (const line of composition.split("\n")) {
|
|
2146
|
+
const match = /^- id:\s*(\S+)/.exec(line);
|
|
2147
|
+
if (match) ids.add(match[1] ?? "");
|
|
2148
|
+
}
|
|
2149
|
+
return ids;
|
|
2150
|
+
}
|
|
2151
|
+
//#endregion
|
|
2120
2152
|
//#region lib/types/quality.js
|
|
2121
2153
|
/**
|
|
2122
2154
|
* Quality scoring and near-duplicate detection for the curated skill library.
|
|
@@ -4171,4 +4203,4 @@ function evolutionHome(env = process.env) {
|
|
|
4171
4203
|
return join(env.DSH_HOME ?? join(homedir(), ".dsh"), "evolution");
|
|
4172
4204
|
}
|
|
4173
4205
|
//#endregion
|
|
4174
|
-
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, EvolutionGateSet, 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, MUTATIONS_FILE_VERSION, MemoryStore, 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, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, duplicateHeadings, emptyRecord, evaluateThreat, eventsFile, evolutionHome, evolutionIoAdapter, findDriftSignal, foldCuratorFields, foldTurn, frontmatterBlock, frontmatterYamlUnsafeValues, getRecord, latestActivityAt, lifecycleCandidate, listEventArchives, loadMutations, loadSuppressedNames, loadUsage, markAgentCreated, memoryRoot, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, observeEvent, overlongLines, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, readEvolutionEvents, readEvolutionTimeline, recordMutation, redactSecrets, relatedSkillNames, renderCuratorReportMarkdown, resolveOrigins, retainEventArchives, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, transactIo, updateSuppressedNames, usageFile, usageObserved, validateFrontmatter, verifyPromptBundle, yamlPlainScalarNeedsQuotes };
|
|
4206
|
+
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, EvolutionGateSet, 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, MUTATIONS_FILE_VERSION, MemoryStore, 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, composePresetComposition, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, duplicateHeadings, emptyRecord, evaluateThreat, eventsFile, evolutionHome, evolutionIoAdapter, findDriftSignal, foldCuratorFields, foldTurn, frontmatterBlock, frontmatterYamlUnsafeValues, getRecord, latestActivityAt, lifecycleCandidate, listEventArchives, loadMutations, loadSuppressedNames, loadUsage, markAgentCreated, memoryRoot, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, observeEvent, overlongLines, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, readEvolutionEvents, readEvolutionTimeline, recordMutation, redactSecrets, relatedSkillNames, renderCuratorReportMarkdown, resolveOrigins, retainEventArchives, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, transactIo, updateSuppressedNames, usageFile, usageObserved, validateFrontmatter, verifyPromptBundle, yamlPlainScalarNeedsQuotes };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './io.ts';
|
|
|
15
15
|
export * from './learn-prompt.ts';
|
|
16
16
|
export * from './memory-store.ts';
|
|
17
17
|
export * from './mutations.ts';
|
|
18
|
+
export * from './preset-composition.ts';
|
|
18
19
|
export * from './prompts.ts';
|
|
19
20
|
export * from './quality.ts';
|
|
20
21
|
export * from './redact.ts';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the user-root Evolution preset composition from the RUNTIME platform's
|
|
3
|
+
* `standard` preset rows plus the evolution delta rows (P1-1 follow-up,
|
|
4
|
+
* 0.3.15): the agent-preset registry mounts ONE composition file verbatim, so
|
|
5
|
+
* a delta-only `agent.cordis.yml` would produce an agent carrying only the
|
|
6
|
+
* delta rows.
|
|
7
|
+
*
|
|
8
|
+
* Same contract as `install-layered.mjs` `generateAgentPreset` (the source
|
|
9
|
+
* install path) — installer.spec pins byte parity between the two.
|
|
10
|
+
*
|
|
11
|
+
* Row ids are read from `- id:` lines; an id present in both fragments would
|
|
12
|
+
* mount twice and could shadow the platform row, so it fails loud.
|
|
13
|
+
* @param standardComposition - the runtime `standard` preset composition.
|
|
14
|
+
* @param deltaComposition - the evolution delta fragment.
|
|
15
|
+
* @returns the composed preset composition (standard rows first, then delta).
|
|
16
|
+
*/
|
|
17
|
+
export declare function composePresetComposition(standardComposition: string, deltaComposition: string): string;
|
|
18
|
+
//# sourceMappingURL=preset-composition.d.ts.map
|
package/package.json
CHANGED