@lmzhen/dsh-evolution-commands 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.
Files changed (2) hide show
  1. package/lib/index.js +11 -8
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
3
- import { SkillLibrary, appendEvolutionEvent, buildLearnPrompt, eventsFile } from "@lmzhen/dsh-evolution-core";
3
+ import { SkillLibrary, appendEvolutionEvent, buildLearnPrompt, composePresetComposition, eventsFile } from "@lmzhen/dsh-evolution-core";
4
4
  import { buildEnrichment, buildMaintainFacts, runMaintain, snapshotFromLibrary } from "@lmzhen/dsh-evolution-maintenance";
5
- import { copyFileSync, existsSync, mkdirSync } from "node:fs";
5
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
6
  import { homedir } from "node:os";
7
7
  import { dirname, join } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
@@ -245,13 +245,16 @@ function apply(ctx, rawConfig = {}) {
245
245
  const target = join(process.env.DSH_HOME ?? join(homedir(), ".dsh"), ".agent-presets", "evolution");
246
246
  try {
247
247
  const source = resolveAgentPresetDir(import.meta.url);
248
+ const deltaPath = join(source, "agent.cordis.yml");
249
+ const presetPath = join(source, "preset.yml");
250
+ if (!existsSync(deltaPath) || !existsSync(presetPath)) return err(`Preset file missing from ${source} — is the dsh-evolution-agent-preset package installed?`);
251
+ const registry = ctx.get("agentPresets");
252
+ if (!registry) return err("Agent preset registry not mounted — cannot compose the Evolution preset against the runtime standard.");
253
+ const composition = composePresetComposition(await registry.read("standard"), readFileSync(deltaPath, "utf8"));
248
254
  mkdirSync(target, { recursive: true });
249
- for (const file of ["agent.cordis.yml", "preset.yml"]) {
250
- const from = join(source, file);
251
- if (!existsSync(from)) return err(`Preset file missing from ${source}/${file} — is @lmzhen/dsh-evolution-agent-preset installed?`);
252
- copyFileSync(from, join(target, file));
253
- }
254
- return ok(`Evolution agent preset installed to ${target} (agent.cordis.yml, preset.yml). Restart the session switcher to select it.`);
255
+ writeFileSync(join(target, "agent.cordis.yml"), composition);
256
+ copyFileSync(presetPath, join(target, "preset.yml"));
257
+ return ok(`Evolution agent preset installed to ${target} (runtime standard + delta). Restart the session switcher to select it.`);
255
258
  } catch (error) {
256
259
  return err(`Preset install failed: ${error instanceof Error ? error.message : String(error)}`);
257
260
  }
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.14",
4
+ "version": "0.3.15",
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.14",
37
- "@lmzhen/dsh-evolution-maintenance": "^0.3.14"
36
+ "@lmzhen/dsh-evolution-core": "^0.3.15",
37
+ "@lmzhen/dsh-evolution-maintenance": "^0.3.15"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@deepseek-ai/cordis": "^4.0.1",