@lmzhen/dsh-evolution-commands 0.3.8 → 0.3.10
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 +4 -27
- package/lib/types/index.d.ts +4 -2
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
2
|
-
import { SkillLibrary, appendEvolutionEvent, buildLearnPrompt, eventsFile
|
|
3
|
-
import { buildMaintainFacts, runMaintain, snapshotFromLibrary } from "@lmzhen/dsh-evolution-maintenance";
|
|
2
|
+
import { SkillLibrary, appendEvolutionEvent, buildLearnPrompt, eventsFile } from "@lmzhen/dsh-evolution-core";
|
|
3
|
+
import { buildEnrichment, buildMaintainFacts, runMaintain, snapshotFromLibrary } from "@lmzhen/dsh-evolution-maintenance";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
//#region lib/types/index.js
|
|
@@ -8,31 +8,8 @@ import { join } from "node:path";
|
|
|
8
8
|
* Human commands for the evolution family: /evolution learn|pending|curator|restore|consolidate.
|
|
9
9
|
* @module @lmzhen/dsh-evolution-commands
|
|
10
10
|
*/
|
|
11
|
+
/** Enrichment maps shared by the full scan and the `--facts` preview (v12). */
|
|
11
12
|
const name = "evolution-commands";
|
|
12
|
-
async function buildEnrichment(ctx, library) {
|
|
13
|
-
const skillUsage = ctx.get("skillUsage");
|
|
14
|
-
const usageMap = skillUsage?.report ? await skillUsage.report() : void 0;
|
|
15
|
-
const usageObservedValue = usageMap ? usageObserved(usageMap) : void 0;
|
|
16
|
-
const descriptions = /* @__PURE__ */ new Map();
|
|
17
|
-
const supportFiles = /* @__PURE__ */ new Map();
|
|
18
|
-
const quality = /* @__PURE__ */ new Map();
|
|
19
|
-
for (const entry of await library.list()) {
|
|
20
|
-
const body = await library.read(entry.name);
|
|
21
|
-
if (body === null) continue;
|
|
22
|
-
const description = parseFrontmatter(body)?.frontmatter.description;
|
|
23
|
-
if (typeof description === "string" && description.trim().length > 0) descriptions.set(entry.name, description);
|
|
24
|
-
const files = await library.listSupportFiles(entry.name);
|
|
25
|
-
if (files.length > 0) supportFiles.set(entry.name, files);
|
|
26
|
-
const record = usageMap?.get(entry.name);
|
|
27
|
-
if (typeof record?.quality_score === "number") quality.set(entry.name, record.quality_score);
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
descriptions,
|
|
31
|
-
supportFiles,
|
|
32
|
-
quality,
|
|
33
|
-
usageObservedValue
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
13
|
function apply(ctx, rawConfig = {}) {
|
|
37
14
|
const config = rawConfig;
|
|
38
15
|
let lastMaintainAt = 0;
|
|
@@ -212,7 +189,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
212
189
|
}
|
|
213
190
|
const maintainArgs = /^maintain(?: --timeout (\d+))?\s*$/.exec(input);
|
|
214
191
|
if (maintainArgs) {
|
|
215
|
-
const runTimeoutMs = maintainArgs[1] ? Number(maintainArgs[1]) : config.maintainTimeoutMs ??
|
|
192
|
+
const runTimeoutMs = maintainArgs[1] ? Number(maintainArgs[1]) : config.maintainTimeoutMs ?? 6e5;
|
|
216
193
|
if (!Number.isSafeInteger(runTimeoutMs) || runTimeoutMs <= 0) return err("Invalid --timeout value: expected a positive integer number of milliseconds (e.g. /evolution maintain --timeout 600000).");
|
|
217
194
|
const cooldownMs = config.maintainCooldownMs ?? 3e4;
|
|
218
195
|
const sinceLast = Date.now() - lastMaintainAt;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -15,8 +15,10 @@ export interface Config {
|
|
|
15
15
|
* in-flight runs, so the old 130s ">= timeout" rationale was a comment bug.
|
|
16
16
|
* Transient (per-process). */
|
|
17
17
|
maintainCooldownMs?: number | undefined;
|
|
18
|
-
/** Subagent deadline for one maintenance scan (ms). Default
|
|
19
|
-
*
|
|
18
|
+
/** Subagent deadline for one maintenance scan (ms). Default 600s (0.3.10):
|
|
19
|
+
* the real library's full audit (bodies + support files + judgment) needs
|
|
20
|
+
* 4-8 min — the 13:38 successful run used --timeout 600000; the old 120s
|
|
21
|
+
* default deadlined bare runs mid-analysis (14:37 run aborted at 119.94s). */
|
|
20
22
|
maintainTimeoutMs?: number | undefined;
|
|
21
23
|
}
|
|
22
24
|
export declare function apply(ctx: Context, rawConfig?: Config): void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-commands",
|
|
3
3
|
"description": "Human commands for the evolution family (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.10",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
36
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
37
|
-
"@lmzhen/dsh-evolution-maintenance": "^0.3.
|
|
36
|
+
"@lmzhen/dsh-evolution-core": "^0.3.10",
|
|
37
|
+
"@lmzhen/dsh-evolution-maintenance": "^0.3.10"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@deepseek-ai/cordis": "^4.0.1",
|