@lmzhen/dsh-evolution-state-json 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 +18 -20
  2. package/lib/index.js +7 -4
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -1,30 +1,28 @@
1
- # @deepseek-ai/dsh-evolution-state-json
1
+ # @lmzhen/dsh-evolution-state-json
2
2
 
3
- JSON-file evolution state provider over the IO seam
3
+ JSON-file evolution state provider over the IO seam: review, curator and pending records are JSON
4
+ files under the state root, so the medium behind `ctx.evolutionIo` can change without a format
5
+ change.
4
6
 
7
+ ## Model surface
5
8
 
6
- ## Model Experience
9
+ - **Model-visible:** nothing of its own: the rows that read this state own the injection.
10
+ - **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".
11
+ - **Mount it?** yes — the `evolution-state-json` row, in `evolution-host`/`evolution-all`/one-click `evolution-preset` (it is the medium they pin).
7
12
 
8
- ### Indirect model surface
13
+ ## Configuration
9
14
 
10
- #### What the model sees
15
+ - `root`: the directory the state files live in; `''` means the evolution home.
11
16
 
12
- `@deepseek-ai/dsh-evolution-state-json` registers no direct prompt or tool schema itself. Model-visible effects are owned by the packages that consume this service.
17
+ ## Known limitations
13
18
 
14
- #### Token effect
15
-
16
- Zero direct token effect from this package; consumers add any model-visible tokens.
17
-
18
- #### KV Cache effect
19
-
20
- Independent of request-prefix construction. This package does not alter the assembled prompt or tool list.
21
-
22
- ## Known Limitations and Deferred Work
23
-
24
-
25
- - P2-4 (v15): the live pending map is BOUNDED — resolved (approved/rejected) records are kept to the most recent `PENDING_RESOLVED_CAP` (200, seam constant in `evolution-state-storage`); the oldest by `resolvedAt` rotate into the `pending-state-archive.json` sidecar (with `.bak` rotation), which is JSON-provider-specific. The DOMAIN provider enforces the same live cap but has no sidecar: past the cap its resolved records are deleted, not archived.
26
- - V25-11 (v25): the review-state table is likewise BOUNDED — `REVIEW_STATE_SESSION_CAP` (500, seam constant) rows keyed by session; on every save the least-recently-active sessions (provider-stamped `updatedAt`, stored on disk only) are pruned. The stamp is stripped on read, so the consumer-facing record shape is unchanged.
27
- - JSON provider serializes writers inside one process AND through the IO backend's cross-process transact lock (an internal transact wrapper — not public API, audit v10 S-03 — wraps every mutation, 0.3.20/0.3.27) — this provider is NOT limited to single-process safety. The caveat below is about the DSH storage-domain providers (`storage-json` documents no cross-process write locking) when the DOMAIN provider is used instead; multi-process deployments should route the evolution domain to a backend with cross-process semantics such as SQLite or remote storage.
19
+ - Both tables are capped (200 pending, 500 sessions), and past the pending cap the DOMAIN provider deletes instead of archiving: this provider keeps an audit sidecar. The `updatedAt` stamp is stripped on read, so the consumer-facing record shape is unchanged.
20
+ - The one medium without cross-process write locking is the `storage-json` store behind the DOMAIN provider: route multi-process deployments to a backend with cross-process semantics such as SQLite or remote storage.
28
21
 
29
22
  **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).
30
23
 
24
+ ## Notes and history
25
+
26
+ - P2-4 (v15): the live pending map is BOUNDED — resolved (approved/rejected) records are kept to the most recent `PENDING_RESOLVED_CAP` (200, seam constant in `evolution-state-storage`); the oldest by `resolvedAt` rotate into the `pending-state-archive.json` sidecar (with `.bak` rotation), which is JSON-provider-specific.
27
+ - V25-11 (v25): the review-state table is likewise BOUNDED: `REVIEW_STATE_SESSION_CAP` (500, seam constant) rows keyed by session; on every save the least-recently-active sessions (provider-stamped `updatedAt`, stored on disk only) are pruned.
28
+ - JSON provider serializes writers inside one process AND through the IO backend's cross-process transact lock (an internal transact wrapper (not public API, audit v10 S-03) wraps every mutation, 0.3.20/0.3.27) — this provider is NOT limited to single-process safety.
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
2
  import { evolutionHome, makeSerialQueue, transactIo, transactTaskGuard } from "@lmzhen/dsh-evolution-core";
3
- import { CURATOR_STATE_FILE, CURATOR_STATE_KEY, CURATOR_STATE_TABLE, PENDING_ARCHIVE_BAK_FILE, PENDING_ARCHIVE_FILE, PENDING_LEGACY_FILE, PENDING_RESOLVED_CAP, PENDING_STATE_FILE, PENDING_TABLE, PROVIDER_JSON, REVIEW_STATE_FILE, REVIEW_STATE_SESSION_CAP, REVIEW_STATE_TABLE, assertCloneable, canClaimPending, canResolvePending, recordIssue, releasedStatus, selectPendingOverflow, selectSessionOverflow } from "@lmzhen/dsh-evolution-state-storage";
3
+ import { CURATOR_STATE_FILE, CURATOR_STATE_KEY, CURATOR_STATE_TABLE, PENDING_ARCHIVE_BAK_FILE, PENDING_ARCHIVE_FILE, PENDING_LEGACY_FILE, PENDING_RESOLVED_CAP, PENDING_STATE_FILE, PENDING_TABLE, PROVIDER_JSON, REVIEW_STATE_FILE, REVIEW_STATE_SESSION_CAP, REVIEW_STATE_TABLE, assertCloneable, canClaimPending, canResolvePending, cloneRecord, recordIssue, releasedStatus, selectPendingOverflow, selectSessionOverflow } from "@lmzhen/dsh-evolution-state-storage";
4
4
  import { basename, dirname, isAbsolute, join } from "node:path";
5
5
  //#region lib/types/index.js
6
6
  /**
@@ -540,14 +540,17 @@ function apply(ctx, rawConfig = {}) {
540
540
  },
541
541
  async transactCuratorState(task) {
542
542
  await mutate(async () => {
543
- await jsonTransact(ctx, io, root, CURATOR_STATE_FILE, (current) => {
544
- const next = task(current?.[CURATOR_STATE_KEY] ?? null);
543
+ const guard = transactTaskGuard(`curator state transact (${CURATOR_STATE_FILE})`);
544
+ await jsonTransact(ctx, io, root, CURATOR_STATE_FILE, guard.wrap((current) => {
545
+ const stored = current?.[CURATOR_STATE_KEY] ?? null;
546
+ const next = task(stored === null ? null : cloneRecord(stored));
545
547
  if (next === null) return current;
546
548
  return {
547
549
  ...current ?? {},
548
550
  [CURATOR_STATE_KEY]: next
549
551
  };
550
- });
552
+ }));
553
+ guard.assertInvoked();
551
554
  });
552
555
  },
553
556
  async listPending(status = "pending") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-state-json",
3
3
  "description": "JSON-file evolution state provider over the IO seam (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-io": "^0.3.82",
35
- "@lmzhen/dsh-evolution-state-storage": "^0.3.82"
34
+ "@lmzhen/dsh-evolution-io": "^0.4.0",
35
+ "@lmzhen/dsh-evolution-state-storage": "^0.4.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@lmzhen/dsh-evolution-io": "^0.3.82",
39
- "@lmzhen/dsh-evolution-state-storage": "^0.3.82",
40
- "@lmzhen/dsh-evolution-io-node": "^0.3.82"
38
+ "@lmzhen/dsh-evolution-io": "^0.4.0",
39
+ "@lmzhen/dsh-evolution-state-storage": "^0.4.0",
40
+ "@lmzhen/dsh-evolution-io-node": "^0.4.0"
41
41
  }
42
42
  }