@lmzhen/dsh-evolution-approval 0.3.39 → 0.3.40

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 CHANGED
@@ -89,7 +89,7 @@ var EvolutionApproval = class extends Service {
89
89
  action: "allow",
90
90
  message: "Approval disabled."
91
91
  };
92
- if ((this.deriveSessionPolicy(input.sessionId) ?? (this.ctx.get("approval") ? void 0 : input.sessionPolicy)) === "never") return {
92
+ if ((this.deriveSessionPolicy(input.sessionId, input.session) ?? (this.ctx.get("approval") ? void 0 : input.sessionPolicy)) === "never") return {
93
93
  action: "allow",
94
94
  message: "Session approval policy is \"never\"; write allowed without staging."
95
95
  };
@@ -162,11 +162,11 @@ var EvolutionApproval = class extends Service {
162
162
  * `effectiveSessionPolicy`, overrideOf ?? config.policy ?? 'ask'). The mount
163
163
  * check is lazy: the platform service can start before or after this plugin.
164
164
  */
165
- deriveSessionPolicy(sessionId) {
166
- if (!sessionId) return void 0;
165
+ deriveSessionPolicy(sessionId, session) {
166
+ if (!sessionId && !session) return void 0;
167
167
  const platformApproval = this.ctx.get("approval");
168
168
  if (!platformApproval) return void 0;
169
- const override = platformApproval.overrideOf(sessionId);
169
+ const override = session !== void 0 ? platformApproval.overrideOf(session) : void 0;
170
170
  if (override === "never" || override === "ask") return override;
171
171
  return platformApproval.config?.policy ?? "ask";
172
172
  }
@@ -36,6 +36,14 @@ export interface ApprovalRequest {
36
36
  /** 0.3.17 (E-25): the requesting session id, kept on the record for
37
37
  * audit attribution (staged AND resolved history). */
38
38
  sessionId?: string;
39
+ /** 0.3.40 (V6-27 fix): the requesting SESSION OBJECT. The platform
40
+ * `approval.overrideOf(session: Session)` reads `session.events` — a bare id
41
+ * string throws a TypeError in the real implementation (`.events` on a
42
+ * string is undefined → `events.length`). Callers that hold the session
43
+ * (model tools, review pipeline) MUST pass it so the session-level override
44
+ * (`approval/policy` event) is honored; absent falls back to the id probe
45
+ * (undefined for platform lookups) + the config chain. */
46
+ session?: unknown;
39
47
  }
40
48
  export interface ApprovalDecision {
41
49
  action: 'allow' | 'staged';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-approval",
3
3
  "description": "Stage/pending approval service for Hermes-style self-evolution writes (community build)",
4
- "version": "0.3.39",
4
+ "version": "0.3.40",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -35,15 +35,15 @@
35
35
  "peerDependencies": {
36
36
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
37
37
  "@deepseek-ai/cordis": "^4.0.1",
38
- "@lmzhen/dsh-evolution-state-storage": "^0.3.39",
39
- "@lmzhen/dsh-evolution-state": "^0.3.39"
38
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.40",
39
+ "@lmzhen/dsh-evolution-state": "^0.3.40"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
43
- "@lmzhen/dsh-evolution-state-storage": "^0.3.39",
44
- "@lmzhen/dsh-evolution-state": "^0.3.39",
45
- "@lmzhen/dsh-evolution-io": "^0.3.39",
46
- "@lmzhen/dsh-evolution-io-node": "^0.3.39",
47
- "@lmzhen/dsh-evolution-state-json": "^0.3.39"
43
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.40",
44
+ "@lmzhen/dsh-evolution-state": "^0.3.40",
45
+ "@lmzhen/dsh-evolution-io": "^0.3.40",
46
+ "@lmzhen/dsh-evolution-io-node": "^0.3.40",
47
+ "@lmzhen/dsh-evolution-state-json": "^0.3.40"
48
48
  }
49
49
  }