@lmzhen/dsh-evolution-commands 0.3.66 → 0.3.67

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 +17 -10
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -12,7 +12,8 @@ import { fileURLToPath } from "node:url";
12
12
  * `/evolution doctor` — read-only self-check (0.3.55, WB2).
13
13
  *
14
14
  * Turns "what the README would explain" into "the tool tells you directly":
15
- * install form, three-way conflict detection (all/host/preset + layered), the
15
+ * install form, three-way conflict detection (all/host/preset + layered,
16
+ * including preset-bundle × layered via the preset's delivered agent.cordis.yml), the
16
17
  * environment surfaces that bit us before (v10 P2-12/13), and which evolution
17
18
  * services are actually mounted in this runtime. Always ends with suggested
18
19
  * actions so any finding carries its next step.
@@ -62,13 +63,14 @@ async function diagnose(ctx, options = {}) {
62
63
  const full = bundles.some((name) => tailOf(name) === "dsh-evolution-all");
63
64
  const host = bundles.some((name) => tailOf(name) === "dsh-evolution-host");
64
65
  const preset = bundles.some((name) => tailOf(name) === "dsh-evolution-preset");
65
- const presetDir = join(home, ".agent-presets", "evolution");
66
- const layered = host && existsSync(presetDir);
66
+ const presetDirInstalled = existsSync(join(join(home, ".agent-presets", "evolution"), "agent.cordis.yml"));
67
+ const layered = host && presetDirInstalled;
67
68
  const conflicts = [];
68
69
  if (full && host) conflicts.push("evolution-all and evolution-host are installed together — the infra rows double-mount and startup fails loud. Keep ONE: remove the other bundle.");
69
70
  if (full && preset) conflicts.push("evolution-all and evolution-preset are installed together — the infra rows double-mount. Keep ONE.");
70
71
  if (host && preset) conflicts.push("evolution-host and evolution-preset are installed together — the infra rows double-mount. Keep ONE.");
71
72
  if (full && layered) conflicts.push("evolution-all and the layered Evolution preset are both present — the model rows double-mount. Keep ONE (use layered without all, or drop the preset).");
73
+ if (preset && presetDirInstalled) conflicts.push("evolution-preset and the layered Evolution preset are both present — the model rows double-mount (the preset bundle carries the same model rows as all). Keep ONE (drop the preset bundle, or remove the layered preset).");
72
74
  const services = {
73
75
  review: full || host || preset,
74
76
  curator: has("evolutionCurator"),
@@ -187,7 +189,7 @@ const COMMAND_ENTRIES = [
187
189
  },
188
190
  {
189
191
  usage: "replay",
190
- summary: "compare prompt-bundle replay for this session"
192
+ summary: "compare plan outcomes across sessions and restarts (backfilled from the activity store)"
191
193
  }
192
194
  ];
193
195
  /** The input-declaration hint (single line, ` | `-separated). */
@@ -229,7 +231,8 @@ function apply(ctx, rawConfig = {}) {
229
231
  recordInput: false,
230
232
  input: { hint: renderHint() },
231
233
  async handler(invocation) {
232
- const input = invocation.rawInput?.trim() ?? "";
234
+ const rawInputTrimmed = invocation.rawInput?.trim() ?? "";
235
+ const input = rawInputTrimmed.replace(/\s+/g, " ");
233
236
  const ok = (text) => ({
234
237
  kind: "success",
235
238
  text
@@ -381,7 +384,7 @@ function apply(ctx, rawConfig = {}) {
381
384
  return ok("Skill catalog refresh requested: caches dropped, catalog re-read on next lookup.");
382
385
  }
383
386
  if (input === "learn" || input.startsWith("learn ")) {
384
- const request = input === "learn" ? "" : input.slice(6).trim();
387
+ const request = rawInputTrimmed === "learn" ? "" : rawInputTrimmed.slice(6).trim();
385
388
  invocation.agent.inject(createUserMessage({
386
389
  content: [{
387
390
  type: "text",
@@ -499,9 +502,9 @@ function apply(ctx, rawConfig = {}) {
499
502
  }
500
503
  }
501
504
  if (input.startsWith("restructure ")) {
502
- const planTail = /\s--plan\s+(\S+)\s*$/.exec(input) ?? null;
505
+ const planTail = /\s--plan\s+(\S+)\s*$/.exec(rawInputTrimmed) ?? null;
503
506
  const planRunId = planTail?.[1] ?? void 0;
504
- const rest = planTail ? input.slice(0, planTail.index) : input;
507
+ const rest = planTail ? rawInputTrimmed.slice(0, planTail.index) : rawInputTrimmed;
505
508
  const match = /^restructure\s+(\S+)\s+"([^"]+)"\s+(\S+)$/.exec(rest);
506
509
  if (!match) return err("Usage: /evolution restructure <name> \"<## heading>\" <to_file>");
507
510
  const name = match[1] ?? "";
@@ -511,7 +514,8 @@ function apply(ctx, rawConfig = {}) {
511
514
  const ioRegistry = ctx.get("evolutionIo");
512
515
  if (!ioRegistry) return err("Evolution IO registry not mounted — restructure unavailable.");
513
516
  if (approval) {
514
- const sessionPolicy = effectiveSessionPolicy(ctx, void 0);
517
+ const session = invocation.agent.session;
518
+ const sessionPolicy = effectiveSessionPolicy(ctx, session);
515
519
  if (approval.isEnabled !== false && sessionPolicy !== "never" && approval.stageForeground !== false && !approval.hasRunner("skill")) return err("Restructure cannot be staged: no skill replay runner is registered — mount the tool-skill-manage row (evolution-agent preset, or evolution-all) or disable evolution-approval.");
516
520
  const decision = await approval.request({
517
521
  kind: "skill",
@@ -528,7 +532,10 @@ function apply(ctx, rawConfig = {}) {
528
532
  origin: "foreground",
529
533
  libraryOrigin: "foreground"
530
534
  },
531
- origin: "foreground"
535
+ origin: "foreground",
536
+ ...session?.id ? { sessionId: session.id } : {},
537
+ ...session ? { session } : {},
538
+ ...sessionPolicy !== void 0 ? { sessionPolicy } : {}
532
539
  });
533
540
  if (decision.action === "staged") return ok(`${decision.message}${planRunId ? `\n[audit] plan=${planRunId}` : ""}`);
534
541
  }
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 (/evolution pending|curator|maintain|doctor) (community build)",
4
- "version": "0.3.66",
4
+ "version": "0.3.67",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,12 +31,12 @@
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
33
  "@deepseek-ai/schemastery": "^3.18.1",
34
- "@lmzhen/dsh-evolution-approval": "^0.3.66",
35
- "@lmzhen/dsh-evolution-core": "^0.3.66",
36
- "@lmzhen/dsh-evolution-maintenance": "^0.3.66"
34
+ "@lmzhen/dsh-evolution-approval": "^0.3.67",
35
+ "@lmzhen/dsh-evolution-core": "^0.3.67",
36
+ "@lmzhen/dsh-evolution-maintenance": "^0.3.67"
37
37
  },
38
38
  "optionalDependencies": {
39
- "@lmzhen/dsh-evolution-agent-preset": "^0.3.66"
39
+ "@lmzhen/dsh-evolution-agent-preset": "^0.3.67"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@deepseek-ai/cordis": "^4.0.1",