@lmzhen/dsh-evolution-commands 0.3.80 → 0.3.81

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 -7
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -516,6 +516,8 @@ function apply(ctx, rawConfig = {}) {
516
516
  kind: "error",
517
517
  text
518
518
  });
519
+ const invocationAgent = invocation.agent;
520
+ const agentMissing = (need) => invocationAgent === void 0 ? err(`E-305: this invocation carries no agent — \`${need}\` needs a session-backed call (run it from a session in the GUI or the CLI).`) : void 0;
519
521
  const approval = ctx.get("evolutionApproval");
520
522
  const pendingMatch = /^pending(?: --detail)?$/.exec(input);
521
523
  if (pendingMatch) {
@@ -685,9 +687,15 @@ function apply(ctx, rawConfig = {}) {
685
687
  summary: "learn request"
686
688
  }
687
689
  });
688
- const woke = typeof invocation.agent.followup === "function";
689
- if (woke) invocation.agent.followup(message);
690
- else invocation.agent.inject(message);
690
+ const missingAgent = agentMissing("learn");
691
+ if (missingAgent) return missingAgent;
692
+ const agent = invocationAgent;
693
+ let woke = false;
694
+ if (typeof agent.followup === "function") {
695
+ agent.followup(message);
696
+ woke = true;
697
+ } else if (typeof agent.inject === "function") agent.inject(message);
698
+ else return err("E-305: the invocation agent exposes neither `followup` nor `inject` — this learn request has no delivery channel.");
691
699
  const eventIo = ctx.get("evolutionIo")?.provider();
692
700
  if (eventIo) appendEvolutionEvent(eventIo, eventsFile(evolutionRoot()), {
693
701
  type: "learn",
@@ -848,9 +856,9 @@ function apply(ctx, rawConfig = {}) {
848
856
  const ioRegistry = ctx.get("evolutionIo");
849
857
  if (!ioRegistry) return err("Evolution IO registry not mounted — restructure unavailable.");
850
858
  if (approval) {
851
- const session = invocation.agent.session;
859
+ const session = invocationAgent?.session;
852
860
  const sessionPolicy = effectiveSessionPolicy(ctx, session);
853
- 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.");
861
+ if (session !== void 0 && 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.");
854
862
  const decision = await approval.request({
855
863
  kind: "skill",
856
864
  summary: `/evolution restructure ${name}${planRunId ? ` (plan ${planRunId})` : ""}`,
@@ -867,8 +875,10 @@ function apply(ctx, rawConfig = {}) {
867
875
  libraryOrigin: "foreground"
868
876
  },
869
877
  origin: "foreground",
870
- ...session.id ? { sessionId: session.id } : {},
871
- session,
878
+ ...session !== void 0 ? {
879
+ sessionId: session.id,
880
+ session
881
+ } : {},
872
882
  ...sessionPolicy !== void 0 ? { sessionPolicy } : {}
873
883
  });
874
884
  if (decision.action === "staged") return ok(`${decision.message}${planRunId ? `\n[audit] plan=${planRunId}` : ""}`);
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.80",
4
+ "version": "0.3.81",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,12 +27,12 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.1",
30
- "@lmzhen/dsh-evolution-approval": "^0.3.80",
31
- "@lmzhen/dsh-evolution-core": "^0.3.80",
32
- "@lmzhen/dsh-evolution-maintenance": "^0.3.80"
30
+ "@lmzhen/dsh-evolution-approval": "^0.3.81",
31
+ "@lmzhen/dsh-evolution-core": "^0.3.81",
32
+ "@lmzhen/dsh-evolution-maintenance": "^0.3.81"
33
33
  },
34
34
  "optionalDependencies": {
35
- "@lmzhen/dsh-evolution-agent-preset": "^0.3.80"
35
+ "@lmzhen/dsh-evolution-agent-preset": "^0.3.81"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@deepseek-ai/cordis": "^4.0.1",