@lmzhen/dsh-evolution-approval 0.32.3 → 0.32.4

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
@@ -408,7 +408,9 @@ var EvolutionApproval = class extends Service {
408
408
  for (const record of await this.state().listPending("pending")) {
409
409
  const stagedAt = Date.parse(record.createdAt);
410
410
  if (!Number.isFinite(stagedAt) || stagedAt > cutoff) continue;
411
- if ((await this.state().tryResolvePending(record.id, "rejected")).applied) expired.push(record.id);
411
+ const claimId = this.newClaimId();
412
+ if (!await this.state().claimPending(record.id, claimId)) continue;
413
+ if ((await this.state().tryResolvePending(record.id, "rejected", claimId)).applied) expired.push(record.id);
412
414
  }
413
415
  if (expired.length > 0) this.ctx.logger.warn(`evolution-approval: ${expired.length} staged write(s) passed pendingTtlMs=${ttl} and were closed as rejected WITHOUT executing: ${expired.join(", ")} — stage them again if they are still wanted`);
414
416
  return expired;
@@ -418,6 +420,7 @@ var EvolutionApproval = class extends Service {
418
420
  return await this.state().listPending(status);
419
421
  }
420
422
  async approve(id, audit) {
423
+ await this.expireStale();
421
424
  return await this.dedupe(`approve:${id}`, () => this.doApprove(id, audit));
422
425
  }
423
426
  /** S2-P2-22 (0.3.80): return an ORPHANED executing record to the pending
@@ -641,11 +644,6 @@ var EvolutionApproval = class extends Service {
641
644
  message: `已批准写入「${id}」已重放,但了结记录返回空记录:请核验该写入。`
642
645
  };
643
646
  await this.recordDecision(resolution.record, audit);
644
- this.ctx.emit("evolution/approval-decided", {
645
- record: resolution.record,
646
- action: "approve",
647
- ok: true
648
- });
649
647
  return {
650
648
  ok: true,
651
649
  message: `已批准 ${record.kind} 写入「${id}」(${record.summary})。`
@@ -18,7 +18,6 @@
18
18
  */
19
19
  import { Context, Service } from '@deepseek-ai/cordis';
20
20
  import type { Volatile } from '@deepseek-ai/cordis';
21
- import { type WriteConfirmMode } from '@lmzhen/dsh-evolution-core';
22
21
  import z from '@deepseek-ai/schemastery';
23
22
  import type { PendingKind, PendingRecord, PendingStatus } from '@lmzhen/dsh-evolution-state-storage';
24
23
  import type { DecisionAudit } from '@lmzhen/dsh-evolution-core/http-routes';
@@ -157,15 +156,6 @@ declare module '@deepseek-ai/cordis' {
157
156
  evolutionApproval: EvolutionApproval;
158
157
  }
159
158
  interface Events {
160
- /**
161
- * Emitted after an approval decision has been durably recorded.
162
- * @mode emit
163
- */
164
- 'evolution/approval-decided'(payload: {
165
- readonly record: PendingRecord;
166
- readonly action: 'approve' | 'reject';
167
- readonly ok: boolean;
168
- }): void;
169
159
  }
170
160
  }
171
161
  export interface Config {
@@ -184,12 +174,12 @@ export interface Config {
184
174
  */
185
175
  pendingTtlMs?: Volatile<number>;
186
176
  /**
187
- * U-6: what the confirmation before an APPROVE does. The same three words the skill-write gate uses
188
- * (`WriteConfirmMode`, whose home is `evolution-core/src/write-authority.ts` - moved there with the
189
- * authority that carries it; the re-export from `write-gates.ts` was removed in G1/1.8) - and now the
190
- * IMPORT below is what makes that true: without it the docblock claimed an import the file did not have.
177
+ * U-6: what the confirmation before an APPROVE does: auto (execute immediately) or ask (wait for a
178
+ * human answer). Legacy `timeout` is accepted only so an old value can migrate to `ask`; it is not
179
+ * exposed and is owned by ControlPlane when that lands.
191
180
  */
192
- approvalConfirm?: Volatile<WriteConfirmMode>;
181
+ /** Legacy `timeout` is accepted only to migrate to `ask`; it is no longer exposed or implemented. */
182
+ approvalConfirm?: Volatile<'auto' | 'ask' | 'timeout'>;
193
183
  }
194
184
  export declare class EvolutionApproval extends Service {
195
185
  static inject: string[];
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.32.3",
4
+ "version": "0.32.4",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,18 +27,18 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.5",
30
- "@lmzhen/dsh-evolution-core": "^0.32.3"
30
+ "@lmzhen/dsh-evolution-core": "^0.32.4"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@deepseek-ai/cordis": "^4.0.5",
34
- "@lmzhen/dsh-evolution-core": "^0.32.3",
35
- "@lmzhen/dsh-evolution-state": "^0.32.3",
36
- "@lmzhen/dsh-evolution-state-storage": "^0.32.3"
34
+ "@lmzhen/dsh-evolution-core": "^0.32.4",
35
+ "@lmzhen/dsh-evolution-state": "^0.32.4",
36
+ "@lmzhen/dsh-evolution-state-storage": "^0.32.4"
37
37
  },
38
38
  "devDependencies": {
39
- "@lmzhen/dsh-evolution-core": "^0.32.3",
40
- "@lmzhen/dsh-evolution-state": "^0.32.3",
41
- "@lmzhen/dsh-evolution-state-storage": "^0.32.3"
39
+ "@lmzhen/dsh-evolution-core": "^0.32.4",
40
+ "@lmzhen/dsh-evolution-state": "^0.32.4",
41
+ "@lmzhen/dsh-evolution-state-storage": "^0.32.4"
42
42
  },
43
43
  "engines": {
44
44
  "dsh": ">=0.2.1-rc.2 <0.2.2-0"