@lmzhen/dsh-evolution-approval 0.3.22 → 0.3.23

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
@@ -15,6 +15,15 @@ import z from "@deepseek-ai/schemastery";
15
15
  *
16
16
  * @module @lmzhen/dsh-evolution-approval
17
17
  */
18
+ /** The requesting session's effective policy (override ?? configured default);
19
+ * undefined when the approval service is not mounted or no session is
20
+ * available — callers keep their previous behavior. Single source (G4.8,
21
+ * F-341): the model tools each copied this helper; it lives here now. */
22
+ function effectiveSessionPolicy(ctx, session) {
23
+ const approval = ctx.get("approval");
24
+ if (!approval || session === void 0) return void 0;
25
+ return approval.overrideOf(session) ?? approval.config.policy ?? "ask";
26
+ }
18
27
  var EvolutionApproval = class extends Service {
19
28
  static inject = ["evolutionState"];
20
29
  static Config = z.object({
@@ -235,4 +244,4 @@ function normalizeSummary(input) {
235
244
  return trimmed;
236
245
  }
237
246
  //#endregion
238
- export { EvolutionApproval, EvolutionApproval as default };
247
+ export { EvolutionApproval, EvolutionApproval as default, effectiveSessionPolicy };
@@ -69,6 +69,20 @@ export type ApprovalLike = {
69
69
  message: string;
70
70
  }>;
71
71
  };
72
+ /** 0.3.23 (G4.8): the ONE shape of the platform approval-policy probe that
73
+ * `effectiveSessionPolicy` reads. The model tools used to copy this view
74
+ * locally (F-341). */
75
+ export interface ApprovalPolicyLike {
76
+ overrideOf(session: unknown): 'ask' | 'never' | undefined;
77
+ config: {
78
+ policy?: 'ask' | 'never';
79
+ };
80
+ }
81
+ /** The requesting session's effective policy (override ?? configured default);
82
+ * undefined when the approval service is not mounted or no session is
83
+ * available — callers keep their previous behavior. Single source (G4.8,
84
+ * F-341): the model tools each copied this helper; it lives here now. */
85
+ export declare function effectiveSessionPolicy(ctx: Context, session: unknown): 'ask' | 'never' | undefined;
72
86
  declare module '@deepseek-ai/cordis' {
73
87
  interface Context {
74
88
  evolutionApproval: EvolutionApproval;
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.22",
4
+ "version": "0.3.23",
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.22",
39
- "@lmzhen/dsh-evolution-state": "^0.3.22"
38
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.23",
39
+ "@lmzhen/dsh-evolution-state": "^0.3.23"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
43
- "@lmzhen/dsh-evolution-state-storage": "^0.3.22",
44
- "@lmzhen/dsh-evolution-state": "^0.3.22",
45
- "@lmzhen/dsh-evolution-io": "^0.3.22",
46
- "@lmzhen/dsh-evolution-io-node": "^0.3.22",
47
- "@lmzhen/dsh-evolution-state-json": "^0.3.22"
43
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.23",
44
+ "@lmzhen/dsh-evolution-state": "^0.3.23",
45
+ "@lmzhen/dsh-evolution-io": "^0.3.23",
46
+ "@lmzhen/dsh-evolution-io-node": "^0.3.23",
47
+ "@lmzhen/dsh-evolution-state-json": "^0.3.23"
48
48
  }
49
49
  }