@lmzhen/dsh-evolution-approval 0.3.68 → 0.3.70

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
@@ -233,7 +233,7 @@ var EvolutionApproval = class extends Service {
233
233
  await this.state().releasePendingClaim(id, claimId);
234
234
  return {
235
235
  ok: false,
236
- message: result.message
236
+ message: /changed since this plan|no entry matching|not found|no longer exists/i.test(result.message) ? `${result.message} — a sibling write from the same plan may have already changed this target, so repeated approves will keep failing. Reject this record unless the target changed again.` : result.message
237
237
  };
238
238
  }
239
239
  } catch (error) {
@@ -244,7 +244,15 @@ var EvolutionApproval = class extends Service {
244
244
  message: "Replay runner failed; the pending write remains pending."
245
245
  };
246
246
  }
247
- if (!(await this.state().tryResolvePending(id, "approved", claimId)).applied) {
247
+ const resolution = await this.state().tryResolvePending(id, "approved", claimId).catch((error) => {
248
+ this.ctx.logger.warn(error);
249
+ return `failed: ${error instanceof Error ? error.message : String(error)}`;
250
+ });
251
+ if (typeof resolution === "string") return {
252
+ ok: false,
253
+ message: `Approved write "${id}" was replayed, but resolving the record failed (${resolution.slice(8)}) — the effect has LANDED while the audit row stays "executing". Verify the write manually; approve will not re-run it.`
254
+ };
255
+ if (!resolution.applied) {
248
256
  if ((await this.state().listPending("rejected")).find((item) => item.id === id)) return {
249
257
  ok: false,
250
258
  message: `Approved write "${id}" was replayed, but the record was resolved to "rejected" concurrently — the effect has landed while the audit reads rejected. Verify the write and do NOT replay it.`
@@ -42,16 +42,18 @@ export interface ApprovalRequest {
42
42
  * (`overrideOf` → deployment `config.policy` → 'ask') and ignores this value
43
43
  * entirely; it is read only in assemblies WITHOUT that service. A caller
44
44
  * holding the session object must pass it as `session`: a bare `sessionId`
45
- * cannot be probed (the platform reads `session.events` off the object).
45
+ * cannot be probed (the platform resolves the override from the object's
46
+ * session log view).
46
47
  */
47
48
  sessionPolicy?: 'ask' | 'never';
48
49
  /** 0.3.17 (E-25): the requesting session id, kept on the record for
49
50
  * audit attribution (staged AND resolved history). */
50
51
  sessionId?: string;
51
52
  /** 0.3.40 (V6-27 fix): the requesting SESSION OBJECT. The platform
52
- * `approval.overrideOf(session: Session)` reads `session.events` a bare id
53
- * string throws a TypeError in the real implementation (`.events` on a
54
- * string is undefined `events.length`). Callers that hold the session
53
+ * `approval.overrideOf(session: Session)` needs the session's log view
54
+ * `session.events` before 0.1.5, `session.snapshotEvents()` from 0.1.5 on
55
+ * so a bare id string throws in the real implementation (a missing log view
56
+ * reads as `undefined.length`). Callers that hold the session
55
57
  * (model tools, review pipeline) MUST pass it so the session-level override
56
58
  * (`approval/policy` event) is honored; absent falls back to the id probe
57
59
  * (undefined for platform lookups) + the config chain. */
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.68",
4
+ "version": "0.3.70",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -33,17 +33,17 @@
33
33
  "@deepseek-ai/schemastery": "^3.18.1"
34
34
  },
35
35
  "peerDependencies": {
36
- "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
36
+ "@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
37
37
  "@deepseek-ai/cordis": "^4.0.1",
38
- "@lmzhen/dsh-evolution-state-storage": "^0.3.68",
39
- "@lmzhen/dsh-evolution-state": "^0.3.68"
38
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.70",
39
+ "@lmzhen/dsh-evolution-state": "^0.3.70"
40
40
  },
41
41
  "devDependencies": {
42
- "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
43
- "@lmzhen/dsh-evolution-state-storage": "^0.3.68",
44
- "@lmzhen/dsh-evolution-state": "^0.3.68",
45
- "@lmzhen/dsh-evolution-io": "^0.3.68",
46
- "@lmzhen/dsh-evolution-io-node": "^0.3.68",
47
- "@lmzhen/dsh-evolution-state-json": "^0.3.68"
42
+ "@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
43
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.70",
44
+ "@lmzhen/dsh-evolution-state": "^0.3.70",
45
+ "@lmzhen/dsh-evolution-io": "^0.3.70",
46
+ "@lmzhen/dsh-evolution-io-node": "^0.3.70",
47
+ "@lmzhen/dsh-evolution-state-json": "^0.3.70"
48
48
  }
49
49
  }