@lmzhen/dsh-evolution-core 0.3.55 → 0.3.56
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 +28 -5
- package/lib/types/env.d.ts +18 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1325,6 +1325,28 @@ async function readEvolutionTimeline(io, path) {
|
|
|
1325
1325
|
};
|
|
1326
1326
|
}
|
|
1327
1327
|
//#endregion
|
|
1328
|
+
//#region lib/types/env.js
|
|
1329
|
+
/**
|
|
1330
|
+
* Evolution environment-variable reading, single-source (WC, 0.3.56).
|
|
1331
|
+
*
|
|
1332
|
+
* Every `DSH_EVOLUTION_*` value the PLUGIN code reads goes through this module
|
|
1333
|
+
* so the trim/whitelist patterns (v10 P2-12/13) live in exactly one place and
|
|
1334
|
+
* the generated env reference can point at one behavior. Configuration-layer
|
|
1335
|
+
* reads inside patch YAML `!!js` expressions (session-query path/openAt) stay
|
|
1336
|
+
* in the profile config evaluation — they are NOT migrated (they are resolved
|
|
1337
|
+
* at cordis config time, not plugin time) but are documented in the README
|
|
1338
|
+
* env table.
|
|
1339
|
+
*/
|
|
1340
|
+
/** Plugin-side DSH_EVOLUTION_* keys (config-layer keys are documented separately). */
|
|
1341
|
+
const EVOLUTION_ENV_KEYS = ["DSH_EVOLUTION_ALLOW_ROW_COLLISIONS"];
|
|
1342
|
+
const ALLOW_ROW_COLLISIONS = "1";
|
|
1343
|
+
/** N-5 escape: `DSH_EVOLUTION_ALLOW_ROW_COLLISIONS=1` downgrades a delta-row
|
|
1344
|
+
* collision from fail-loud to warn+keep-both. Any other value (including an
|
|
1345
|
+
* EMPTY/whitespace string — a set-but-unset variable) keeps the fail-loud. */
|
|
1346
|
+
function allowRowCollisions(env = process.env) {
|
|
1347
|
+
return env.DSH_EVOLUTION_ALLOW_ROW_COLLISIONS === ALLOW_ROW_COLLISIONS;
|
|
1348
|
+
}
|
|
1349
|
+
//#endregion
|
|
1328
1350
|
//#region lib/types/prompts.js
|
|
1329
1351
|
/**
|
|
1330
1352
|
* Review and curation prompts adapted from Hermes Agent
|
|
@@ -2081,14 +2103,15 @@ function scanMemoryThreats(text, maxScanChars = 65536, options = NO_SCAN_OPTIONS
|
|
|
2081
2103
|
const { blocked, findings } = evaluateThreat(text, "strict", maxScanChars, options);
|
|
2082
2104
|
if (!blocked) return null;
|
|
2083
2105
|
const pattern = findings.find((f) => f.category !== "unicode_obfuscation");
|
|
2084
|
-
|
|
2085
|
-
return
|
|
2106
|
+
const exemptionHint = " A deployment that needs a specific label can exempt it via threatExemptLabels (see the README env/dial reference).";
|
|
2107
|
+
if (pattern) return `Blocked by security scan (${pattern.label}). Rephrase without instruction-like language.${exemptionHint}`;
|
|
2108
|
+
return `Blocked by security scan: invisible or potentially malicious Unicode detected.${exemptionHint}`;
|
|
2086
2109
|
}
|
|
2087
2110
|
/** User-facing block message for skill content writes. */
|
|
2088
2111
|
function scanContentThreats(text, maxScanChars = 65536, options = NO_SCAN_OPTIONS) {
|
|
2089
2112
|
const { blocked, findings } = evaluateThreat(text, "strict", maxScanChars, options);
|
|
2090
2113
|
if (!blocked) return null;
|
|
2091
|
-
return `Blocked by security scan (${findings[0]?.label ?? "unknown"}). This content appears to contain potentially malicious instructions.`;
|
|
2114
|
+
return `Blocked by security scan (${findings[0]?.label ?? "unknown"}). This content appears to contain potentially malicious instructions. Installations with a known-innocent label can exempt it via threatExemptLabels (README dial reference).`;
|
|
2092
2115
|
}
|
|
2093
2116
|
/**
|
|
2094
2117
|
* V10-03 (P2-18): suffix the SkillLibrary/MemoryStore write gates append to a
|
|
@@ -2736,7 +2759,7 @@ async function recordMutation(root, io, record, cap = 500) {
|
|
|
2736
2759
|
function composePresetComposition(standardComposition, deltaComposition) {
|
|
2737
2760
|
const standardIds = compositionRowIds(standardComposition);
|
|
2738
2761
|
const collisions = [...compositionRowIds(deltaComposition)].filter((id) => standardIds.has(id)).sort();
|
|
2739
|
-
if (collisions.length > 0 &&
|
|
2762
|
+
if (collisions.length > 0 && !allowRowCollisions()) throw new Error(`evolution preset composition: delta rows collide with runtime standard rows: ${collisions.join(", ")}`);
|
|
2740
2763
|
if (collisions.length > 0) console.warn(`evolution preset composition: warning — delta rows collide with standard rows (${collisions.join(", ")}); keeping both (DSH_EVOLUTION_ALLOW_ROW_COLLISIONS=1)`);
|
|
2741
2764
|
return injectCatalogDescriptionCap(`${standardComposition.replace(/\s+$/, "")}\n\n${deltaComposition.trim()}\n`);
|
|
2742
2765
|
}
|
|
@@ -5214,4 +5237,4 @@ var SkillLibrary = class {
|
|
|
5214
5237
|
}
|
|
5215
5238
|
};
|
|
5216
5239
|
//#endregion
|
|
5217
|
-
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_OUTPUT_INSTRUCTION, 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, THREAT_EXEMPT_HINT, 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, writeDurableTmp, yamlPlainScalarNeedsQuotes };
|
|
5240
|
+
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_ENV_KEYS, EVOLUTION_WRITE_TOOLS, EvolutionGateSet, FORBIDDEN_CONTROL_KEYS, HEALTH_STAMP_RE, LOW_QUALITY_THRESHOLD, MAINTAIN_OUTPUT_INSTRUCTION, 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, THREAT_EXEMPT_HINT, advanceReview, allowRowCollisions, 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, writeDurableTmp, yamlPlainScalarNeedsQuotes };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evolution environment-variable reading, single-source (WC, 0.3.56).
|
|
3
|
+
*
|
|
4
|
+
* Every `DSH_EVOLUTION_*` value the PLUGIN code reads goes through this module
|
|
5
|
+
* so the trim/whitelist patterns (v10 P2-12/13) live in exactly one place and
|
|
6
|
+
* the generated env reference can point at one behavior. Configuration-layer
|
|
7
|
+
* reads inside patch YAML `!!js` expressions (session-query path/openAt) stay
|
|
8
|
+
* in the profile config evaluation — they are NOT migrated (they are resolved
|
|
9
|
+
* at cordis config time, not plugin time) but are documented in the README
|
|
10
|
+
* env table.
|
|
11
|
+
*/
|
|
12
|
+
/** Plugin-side DSH_EVOLUTION_* keys (config-layer keys are documented separately). */
|
|
13
|
+
export declare const EVOLUTION_ENV_KEYS: readonly ["DSH_EVOLUTION_ALLOW_ROW_COLLISIONS"];
|
|
14
|
+
/** N-5 escape: `DSH_EVOLUTION_ALLOW_ROW_COLLISIONS=1` downgrades a delta-row
|
|
15
|
+
* collision from fail-loud to warn+keep-both. Any other value (including an
|
|
16
|
+
* EMPTY/whitespace string — a set-but-unset variable) keeps the fail-loud. */
|
|
17
|
+
export declare function allowRowCollisions(env?: NodeJS.ProcessEnv): boolean;
|
|
18
|
+
//# sourceMappingURL=env.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './curator.ts';
|
|
|
13
13
|
export * from './evolution-events.ts';
|
|
14
14
|
export * from './gates.ts';
|
|
15
15
|
export * from './events.ts';
|
|
16
|
+
export * from './env.ts';
|
|
16
17
|
export * from './io.ts';
|
|
17
18
|
export * from './learn-prompt.ts';
|
|
18
19
|
export * from './memory-store.ts';
|
package/package.json
CHANGED