@lmzhen/dsh-evolution-approval 0.3.82 → 0.4.0

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.
Files changed (3) hide show
  1. package/README.md +23 -27
  2. package/lib/index.js +1 -1
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -1,42 +1,38 @@
1
- # @deepseek-ai/dsh-evolution-approval
1
+ # @lmzhen/dsh-evolution-approval
2
2
 
3
- Stage/pending approval service for Hermes-style self-evolution writes.
3
+ Stage/pending approval service for self-evolution writes. DSH native approval is
4
+ one-shot; this service adds the Hermes staged queue: `request()` stores background writes,
5
+ `approve()` replays them through a runner, `reject()` discards them. The model-facing write tools
6
+ register their own runners (`tool-memory` via `registerRunner('memory', …)`, `tool-skill-manage`
7
+ via `registerRunner('skill', …)`), so staged writes are replayable only when the corresponding
8
+ tool package is composed.
4
9
 
5
- DSH native approval is one-shot; this service adds the Hermes staged queue:
6
- `request()` stores background writes, `approve()` replays them through a runner,
7
- and `reject()` discards them. The model-facing write tools register their own
8
- runners — `tool-memory` via `registerRunner('memory', …)` and
9
- `tool-skill-manage` via `registerRunner('skill', …)` — so staged writes are
10
- replayable only when the corresponding tool package is composed.
11
-
12
- Run the package tests:
10
+ Tests:
13
11
 
14
12
  ```sh
15
- node node_modules/vitest/vitest.mjs run packages/evolution/evolution-approval/tests # overlay layout
16
- # flat mirror: node node_modules/vitest/vitest.mjs run packages/evolution-approval/tests
13
+ node node_modules/vitest/vitest.mjs run packages/evolution-approval/tests # overlay: packages/evolution/evolution-approval/tests
17
14
  ```
18
15
 
19
- ## Model Experience
20
-
21
- ### Indirect model surface
22
-
23
- #### What the model sees
16
+ ## Model surface
24
17
 
25
- `@deepseek-ai/dsh-evolution-approval` registers no direct prompt or tool schema itself. Model-visible effects are owned by the packages that consume this service.
18
+ - **Model-visible:** nothing of its own: a staged write's effect is what the model notices.
19
+ - **Prompt prefix / KV cache:** unchanged by this package: family-level rules single-sourced in `packages/README.md` §"Model-visible prompt prefix and the KV cache".
20
+ - **Mount it?** yes — the `evolution-approval` row, in `evolution-host`/`evolution-all`/one-click `evolution-preset` (`enabled: false` there).
26
21
 
27
- #### Token effect
22
+ ## Configuration
28
23
 
29
- Zero direct token effect from this package; consumers add any model-visible tokens.
24
+ - `enabled` (default `false`): master switch (off = ungated).
25
+ - `stageForeground` (default `true`): stage foreground writes too.
30
26
 
31
- #### KV Cache effect
27
+ ## Known limitations
32
28
 
33
- Independent of request-prefix construction. This package does not alter the assembled prompt or tool list.
29
+ - `approve()` dedupes inside one process and providers resolve the record atomically, but the replay runner executes BEFORE that resolution: two OS processes approving one id can both write while one wins the audit transition. Run approvals from one writer process, or make runners idempotent.
30
+ - **Approve + reject on one id** are not serialized inside a process: a reject can resolve a still-executing record while the runner completes and the write still lands: verify the write state, or reject only when no approve is in flight.
31
+ - **No freshness re-validation:** the staged `args` snapshot is replayed as-is (no content hash), so `approve()` never checks whether the target changed; `/evolution pending --detail` shows what will be replayed.
34
32
 
35
- ## Known Limitations and Deferred Work
33
+ **Runtime invariant:** No companion is published. The platform auto-assembles nothing and the family mounts no `<pkg>/invariant` cordis row, so a companion here would never execute (v37 S2.1 / I-3).
36
34
 
35
+ ## Notes and history
37
36
 
38
- - `approve()` deduplicates concurrent approvals inside one process, and state providers resolve the pending record atomically. However, the replay runner executes **before** that atomic resolution, so two OS processes approving the same id can each perform the write once while only one process wins the audit transition. Run approvals from a single writer process, or make replay runners idempotent when multi-process approval is required.
39
- - **Concurrent approve + reject on the same id (F-204).** Inside one process the dedupe keys are `approve:<id>` / `reject:<id>`, so the two paths are not serialized against each other. When an approve runner is slow, a reject resolves the still-executing record to `rejected` **without holding a claim**; the runner may then complete and the write can still land while the audit history reads `rejected` — the write effect, not the audit verdict, is what actually persists (`写效果以实际为准`). `reject` on an executing record reports this and asks you to verify the write state manually. Only reject a write after confirming no approve is in flight, or verify the write effect manually afterwards.
37
+ - **Concurrent approve + reject on the same id (F-204).** Inside one process the dedupe keys are `approve:<id>` / `reject:<id>`, so the two paths are not serialized against each other. When an approve runner is slow, a reject resolves the still-executing record to `rejected` **without holding a claim**; the runner may then complete and the write can still land while the audit history reads `rejected`: the write effect, not the audit verdict, is what actually persists (`写效果以实际为准`). `reject` on an executing record reports this and asks you to verify the write state manually. Only reject a write after confirming no approve is in flight, or verify the write effect manually afterwards.
40
38
  - **No staged-content freshness re-validation (F-328).** The staged record stores the `args` snapshot captured at request time and replays exactly those args, but does not record a content hash, so `approve()` does **not** re-check whether the on-disk skill/memory the write targets changed since staging. The write is applied as staged regardless. The pending surface (`/evolution pending --detail`) exposes the staged `args` so you can review what will actually be replayed before approving; there is no automatic drift warning if the target changed in the meantime.
41
-
42
- **Runtime invariant:** No companion is published. The platform auto-assembles nothing and the family mounts no `<pkg>/invariant` cordis row, so a companion here would never execute (v37 S2.1 / I-3).
package/lib/index.js CHANGED
@@ -307,7 +307,7 @@ var EvolutionApproval = class extends Service {
307
307
  await this.state().releasePendingClaim(id, claimId);
308
308
  return {
309
309
  ok: false,
310
- 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
310
+ message: /changed since this plan|no entry matching|not found|no longer exists|path traversal/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
311
311
  };
312
312
  }
313
313
  } catch (error) {
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.82",
4
+ "version": "0.4.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,16 +27,16 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.1",
30
- "@lmzhen/dsh-evolution-core": "^0.3.82"
30
+ "@lmzhen/dsh-evolution-core": "^0.4.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@deepseek-ai/cordis": "^4.0.1",
34
- "@lmzhen/dsh-evolution-state-storage": "^0.3.82",
35
- "@lmzhen/dsh-evolution-state": "^0.3.82"
34
+ "@lmzhen/dsh-evolution-state-storage": "^0.4.0",
35
+ "@lmzhen/dsh-evolution-state": "^0.4.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@lmzhen/dsh-evolution-core": "^0.3.82",
39
- "@lmzhen/dsh-evolution-state-storage": "^0.3.82",
40
- "@lmzhen/dsh-evolution-state": "^0.3.82"
38
+ "@lmzhen/dsh-evolution-core": "^0.4.0",
39
+ "@lmzhen/dsh-evolution-state-storage": "^0.4.0",
40
+ "@lmzhen/dsh-evolution-state": "^0.4.0"
41
41
  }
42
42
  }