@lmzhen/dsh-evolution-approval 0.3.21 → 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
@@ -9,10 +9,21 @@ import z from "@deepseek-ai/schemastery";
9
9
  * Hermes-style staged queue: background review/curator writes are stored in
10
10
  * `ctx.evolutionState`, and a human approves or rejects them later. A runner
11
11
  * registry replays the exact mutation without passing through the gate a
12
- * second time. Resolved records are KEPT as audit history.
12
+ * second time. Resolved records are kept as audit history up to
13
+ * PENDING_RESOLVED_CAP (the most recent N; the state provider archives the
14
+ * older ones to pending-state-archive.json).
13
15
  *
14
16
  * @module @lmzhen/dsh-evolution-approval
15
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
+ }
16
27
  var EvolutionApproval = class extends Service {
17
28
  static inject = ["evolutionState"];
18
29
  static Config = z.object({
@@ -233,4 +244,4 @@ function normalizeSummary(input) {
233
244
  return trimmed;
234
245
  }
235
246
  //#endregion
236
- export { EvolutionApproval, EvolutionApproval as default };
247
+ export { EvolutionApproval, EvolutionApproval as default, effectiveSessionPolicy };
@@ -5,7 +5,9 @@
5
5
  * Hermes-style staged queue: background review/curator writes are stored in
6
6
  * `ctx.evolutionState`, and a human approves or rejects them later. A runner
7
7
  * registry replays the exact mutation without passing through the gate a
8
- * second time. Resolved records are KEPT as audit history.
8
+ * second time. Resolved records are kept as audit history up to
9
+ * PENDING_RESOLVED_CAP (the most recent N; the state provider archives the
10
+ * older ones to pending-state-archive.json).
9
11
  *
10
12
  * @module @lmzhen/dsh-evolution-approval
11
13
  */
@@ -67,6 +69,20 @@ export type ApprovalLike = {
67
69
  message: string;
68
70
  }>;
69
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;
70
86
  declare module '@deepseek-ai/cordis' {
71
87
  interface Context {
72
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.21",
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.21",
39
- "@lmzhen/dsh-evolution-state": "^0.3.21"
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.21",
44
- "@lmzhen/dsh-evolution-state": "^0.3.21",
45
- "@lmzhen/dsh-evolution-io": "^0.3.21",
46
- "@lmzhen/dsh-evolution-io-node": "^0.3.21",
47
- "@lmzhen/dsh-evolution-state-json": "^0.3.21"
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
  }