@lmzhen/dsh-evolution-core 0.1.0-rc.11 → 0.1.0-rc.12
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 +53 -14
- package/lib/types/constants.d.ts +46 -0
- package/lib/types/curator.d.ts +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/memory-store.d.ts +1 -1
- package/lib/types/skill-store.d.ts +0 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -152,12 +152,63 @@ function latestActivityAt(record) {
|
|
|
152
152
|
return values.sort().reverse()[0] ?? null;
|
|
153
153
|
}
|
|
154
154
|
//#endregion
|
|
155
|
+
//#region lib/types/constants.js
|
|
156
|
+
/**
|
|
157
|
+
* Shared constants for the dsh-evolution plugin family.
|
|
158
|
+
*
|
|
159
|
+
* Two classes of value live here, deliberately separated by section so future
|
|
160
|
+
* edits do not blur the semantic boundary:
|
|
161
|
+
*
|
|
162
|
+
* 1. **Fixed protocol/format/security invariants** — changing these breaks an
|
|
163
|
+
* on-disk format, a naming/format contract, a path-security boundary, or a
|
|
164
|
+
* cross-component invariant. They are NOT exposed as deployment config.
|
|
165
|
+
*
|
|
166
|
+
* 2. **Cross-package shared tunable defaults** — the same semantic default is
|
|
167
|
+
* read (with a config override path) by more than one package (e.g.
|
|
168
|
+
* `evolution-policy` and `evolution-curator` both default `staleAfterDays`
|
|
169
|
+
* to 30). Centralizing them here means one authoritative default: a config
|
|
170
|
+
* override still applies per package, but the fallback is single-sourced.
|
|
171
|
+
*
|
|
172
|
+
* Package-private tunables (used by exactly one package) stay in that package,
|
|
173
|
+
* not here — see evolution-replay's `DEFAULT_WEIGHTS` and evolution-feedback's
|
|
174
|
+
* threshold, which are intentionally left where they are used.
|
|
175
|
+
* @module @lmzhen/dsh-evolution-core
|
|
176
|
+
*/
|
|
177
|
+
/** Skill frontmatter `name` validated for the file name (lowercase + hyphen). */
|
|
178
|
+
const SKILL_NAME_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
179
|
+
/** Allowed skill support-file subdirectories (path-traversal boundary). */
|
|
180
|
+
const SUPPORT_DIRS = [
|
|
181
|
+
"references",
|
|
182
|
+
"templates",
|
|
183
|
+
"scripts",
|
|
184
|
+
"assets"
|
|
185
|
+
];
|
|
186
|
+
/** Delimiter between durable memory entries (on-disk storage format). */
|
|
187
|
+
const ENTRY_DELIMITER = "\n§\n";
|
|
188
|
+
/** Built-in skill names the curator must never lifecycle-manage. */
|
|
189
|
+
const PROTECTED_BUILTIN_SKILLS = new Set(["plan"]);
|
|
190
|
+
const MAX_SKILL_NAME_LENGTH = 64;
|
|
191
|
+
const MAX_DESCRIPTION_LENGTH = 1024;
|
|
192
|
+
const MAX_SKILL_CONTENT_CHARS = 1e5;
|
|
193
|
+
const MAX_SKILL_FILE_BYTES = 1048576;
|
|
194
|
+
const DEFAULT_REVIEW_MEMORY_INTERVAL = 10;
|
|
195
|
+
const DEFAULT_REVIEW_SKILL_INTERVAL = 10;
|
|
196
|
+
const DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS = 3;
|
|
197
|
+
const DEFAULT_SUBSTANTIVE_MIN_USER_CHARS = 200;
|
|
198
|
+
const DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS = 500;
|
|
199
|
+
const DEFAULT_MAX_OPS_PER_PLAN = 32;
|
|
200
|
+
const DEFAULT_CURATOR_INTERVAL_HOURS = 168;
|
|
201
|
+
const DEFAULT_STALE_AFTER_DAYS = 30;
|
|
202
|
+
const DEFAULT_ARCHIVE_AFTER_DAYS = 90;
|
|
203
|
+
const DEFAULT_MEMORY_CHAR_LIMIT = 2200;
|
|
204
|
+
const DEFAULT_USER_CHAR_LIMIT = 1375;
|
|
205
|
+
const DEFAULT_SKILL_CONTENT_CHARS = 1e5;
|
|
206
|
+
//#endregion
|
|
155
207
|
//#region lib/types/curator.js
|
|
156
208
|
/**
|
|
157
209
|
* Deterministic skill curator: active → stale → archived transitions.
|
|
158
210
|
* Pure function; file moves are performed by SkillLibrary.
|
|
159
211
|
*/
|
|
160
|
-
const PROTECTED_BUILTIN_SKILLS = new Set(["plan"]);
|
|
161
212
|
function buildCuratorRunReport(input) {
|
|
162
213
|
return {
|
|
163
214
|
runId: input.runId,
|
|
@@ -471,7 +522,6 @@ function scanContentThreats(text, maxScanChars = 65536, options = NO_SCAN_OPTION
|
|
|
471
522
|
* File-backed durable memory with Hermes-compatible semantics.
|
|
472
523
|
* Stores are MEMORY.md and USER.md under $DSH_HOME/memories (~/.dsh/memories).
|
|
473
524
|
*/
|
|
474
|
-
const ENTRY_DELIMITER = "\n§\n";
|
|
475
525
|
function memoryRoot(env = process.env) {
|
|
476
526
|
return join(env.DSH_HOME ?? join(homedir(), ".dsh"), "memories");
|
|
477
527
|
}
|
|
@@ -1002,23 +1052,12 @@ function foldTurn(session, fromSeq) {
|
|
|
1002
1052
|
* it created unless a `.hermes-managed` marker opts a skill in. Archival is a
|
|
1003
1053
|
* move to `.archive/` — never a hard delete.
|
|
1004
1054
|
*/
|
|
1005
|
-
const SKILL_NAME_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
1006
|
-
const MAX_SKILL_NAME_LENGTH = 64;
|
|
1007
|
-
const MAX_DESCRIPTION_LENGTH = 1024;
|
|
1008
|
-
const MAX_SKILL_CONTENT_CHARS = 1e5;
|
|
1009
|
-
const MAX_SKILL_FILE_BYTES = 1048576;
|
|
1010
1055
|
const DEFAULT_SKILL_LIMITS = {
|
|
1011
1056
|
maxNameLength: 64,
|
|
1012
1057
|
maxDescriptionLength: MAX_DESCRIPTION_LENGTH,
|
|
1013
1058
|
maxSkillContentChars: MAX_SKILL_CONTENT_CHARS,
|
|
1014
1059
|
maxSkillFileBytes: MAX_SKILL_FILE_BYTES
|
|
1015
1060
|
};
|
|
1016
|
-
const SUPPORT_DIRS = [
|
|
1017
|
-
"references",
|
|
1018
|
-
"templates",
|
|
1019
|
-
"scripts",
|
|
1020
|
-
"assets"
|
|
1021
|
-
];
|
|
1022
1061
|
function skillsRoot(env = process.env) {
|
|
1023
1062
|
return join(env.DSH_HOME ?? join(homedir(), ".dsh"), "skills");
|
|
1024
1063
|
}
|
|
@@ -1590,4 +1629,4 @@ var JsonState = class JsonState {
|
|
|
1590
1629
|
}
|
|
1591
1630
|
};
|
|
1592
1631
|
//#endregion
|
|
1593
|
-
export { COMBINED_REVIEW_PROMPT, CURATOR_PROMPT, DEFAULT_SKILL_LIMITS, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, JsonState, MAX_DESCRIPTION_LENGTH, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MEMORY_REVIEW_PROMPT, MemoryStore, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROTECTED_BUILTIN_SKILLS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, SUPPORT_DIRS, SkillLibrary, advanceReview, buildCuratorRunReport, bumpPatch, bumpUse, bumpView, computeLifecycleTransitions, emptyRecord, evaluateThreat, evolutionHome, evolutionIoAdapter, foldTurn, getRecord, latestActivityAt, loadUsage, markAgentCreated, memoryRoot, nodeEvolutionIo, observeEvent, parseFrontmatter, reviewPrompt, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, usageFile, validateFrontmatter, verifyPromptBundle };
|
|
1632
|
+
export { COMBINED_REVIEW_PROMPT, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, 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, MAX_DESCRIPTION_LENGTH, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MEMORY_REVIEW_PROMPT, MemoryStore, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROTECTED_BUILTIN_SKILLS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, SUPPORT_DIRS, SkillLibrary, advanceReview, buildCuratorRunReport, bumpPatch, bumpUse, bumpView, computeLifecycleTransitions, emptyRecord, evaluateThreat, evolutionHome, evolutionIoAdapter, foldTurn, getRecord, latestActivityAt, loadUsage, markAgentCreated, memoryRoot, nodeEvolutionIo, observeEvent, parseFrontmatter, reviewPrompt, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, usageFile, validateFrontmatter, verifyPromptBundle };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for the dsh-evolution plugin family.
|
|
3
|
+
*
|
|
4
|
+
* Two classes of value live here, deliberately separated by section so future
|
|
5
|
+
* edits do not blur the semantic boundary:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Fixed protocol/format/security invariants** — changing these breaks an
|
|
8
|
+
* on-disk format, a naming/format contract, a path-security boundary, or a
|
|
9
|
+
* cross-component invariant. They are NOT exposed as deployment config.
|
|
10
|
+
*
|
|
11
|
+
* 2. **Cross-package shared tunable defaults** — the same semantic default is
|
|
12
|
+
* read (with a config override path) by more than one package (e.g.
|
|
13
|
+
* `evolution-policy` and `evolution-curator` both default `staleAfterDays`
|
|
14
|
+
* to 30). Centralizing them here means one authoritative default: a config
|
|
15
|
+
* override still applies per package, but the fallback is single-sourced.
|
|
16
|
+
*
|
|
17
|
+
* Package-private tunables (used by exactly one package) stay in that package,
|
|
18
|
+
* not here — see evolution-replay's `DEFAULT_WEIGHTS` and evolution-feedback's
|
|
19
|
+
* threshold, which are intentionally left where they are used.
|
|
20
|
+
* @module @deepseek-ai/dsh-evolution-core
|
|
21
|
+
*/
|
|
22
|
+
/** Skill frontmatter `name` validated for the file name (lowercase + hyphen). */
|
|
23
|
+
export declare const SKILL_NAME_RE: RegExp;
|
|
24
|
+
/** Allowed skill support-file subdirectories (path-traversal boundary). */
|
|
25
|
+
export declare const SUPPORT_DIRS: readonly ["references", "templates", "scripts", "assets"];
|
|
26
|
+
/** Delimiter between durable memory entries (on-disk storage format). */
|
|
27
|
+
export declare const ENTRY_DELIMITER = "\n\u00A7\n";
|
|
28
|
+
/** Built-in skill names the curator must never lifecycle-manage. */
|
|
29
|
+
export declare const PROTECTED_BUILTIN_SKILLS: ReadonlySet<string>;
|
|
30
|
+
export declare const MAX_SKILL_NAME_LENGTH = 64;
|
|
31
|
+
export declare const MAX_DESCRIPTION_LENGTH = 1024;
|
|
32
|
+
export declare const MAX_SKILL_CONTENT_CHARS = 100000;
|
|
33
|
+
export declare const MAX_SKILL_FILE_BYTES = 1048576;
|
|
34
|
+
export declare const DEFAULT_REVIEW_MEMORY_INTERVAL = 10;
|
|
35
|
+
export declare const DEFAULT_REVIEW_SKILL_INTERVAL = 10;
|
|
36
|
+
export declare const DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS = 3;
|
|
37
|
+
export declare const DEFAULT_SUBSTANTIVE_MIN_USER_CHARS = 200;
|
|
38
|
+
export declare const DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS = 500;
|
|
39
|
+
export declare const DEFAULT_MAX_OPS_PER_PLAN = 32;
|
|
40
|
+
export declare const DEFAULT_CURATOR_INTERVAL_HOURS = 168;
|
|
41
|
+
export declare const DEFAULT_STALE_AFTER_DAYS = 30;
|
|
42
|
+
export declare const DEFAULT_ARCHIVE_AFTER_DAYS = 90;
|
|
43
|
+
export declare const DEFAULT_MEMORY_CHAR_LIMIT = 2200;
|
|
44
|
+
export declare const DEFAULT_USER_CHAR_LIMIT = 1375;
|
|
45
|
+
export declare const DEFAULT_SKILL_CONTENT_CHARS = 100000;
|
|
46
|
+
//# sourceMappingURL=constants.d.ts.map
|
package/lib/types/curator.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Pure function; file moves are performed by SkillLibrary.
|
|
4
4
|
*/
|
|
5
5
|
import type { UsageMap } from './usage.ts';
|
|
6
|
+
export { PROTECTED_BUILTIN_SKILLS } from './constants.ts';
|
|
6
7
|
export interface CuratorConfig {
|
|
7
8
|
staleAfterDays: number;
|
|
8
9
|
archiveAfterDays: number;
|
|
@@ -25,7 +26,6 @@ export interface CuratorResult {
|
|
|
25
26
|
reactivate: string[];
|
|
26
27
|
markStale: string[];
|
|
27
28
|
}
|
|
28
|
-
export declare const PROTECTED_BUILTIN_SKILLS: ReadonlySet<string>;
|
|
29
29
|
export interface CuratorArchivedSkill {
|
|
30
30
|
name: string;
|
|
31
31
|
path: string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Stores are MEMORY.md and USER.md under $DSH_HOME/memories (~/.dsh/memories).
|
|
4
4
|
*/
|
|
5
5
|
import { type EvolutionIoLike } from './io.ts';
|
|
6
|
-
export
|
|
6
|
+
export { ENTRY_DELIMITER } from './constants.ts';
|
|
7
7
|
export type MemoryTarget = 'memory' | 'user';
|
|
8
8
|
export interface MemoryOperation {
|
|
9
9
|
action: 'add' | 'replace' | 'remove';
|
|
@@ -7,11 +7,6 @@
|
|
|
7
7
|
* move to `.archive/` — never a hard delete.
|
|
8
8
|
*/
|
|
9
9
|
import { type EvolutionIoLike } from './io.ts';
|
|
10
|
-
export declare const SKILL_NAME_RE: RegExp;
|
|
11
|
-
export declare const MAX_SKILL_NAME_LENGTH = 64;
|
|
12
|
-
export declare const MAX_DESCRIPTION_LENGTH = 1024;
|
|
13
|
-
export declare const MAX_SKILL_CONTENT_CHARS = 100000;
|
|
14
|
-
export declare const MAX_SKILL_FILE_BYTES = 1048576;
|
|
15
10
|
export interface SkillLimits {
|
|
16
11
|
maxNameLength: number;
|
|
17
12
|
maxDescriptionLength: number;
|
|
@@ -19,7 +14,6 @@ export interface SkillLimits {
|
|
|
19
14
|
maxSkillFileBytes: number;
|
|
20
15
|
}
|
|
21
16
|
export declare const DEFAULT_SKILL_LIMITS: SkillLimits;
|
|
22
|
-
export declare const SUPPORT_DIRS: readonly ["references", "templates", "scripts", "assets"];
|
|
23
17
|
export interface SkillSummary {
|
|
24
18
|
name: string;
|
|
25
19
|
description: string;
|
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.12",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|