@lmzhen/dsh-evolution-state-domain 0.25.9 → 0.26.26
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 +38 -1
- package/lib/types/compatibility.d.ts +40 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { DomainError, defineDomain, domainTable } from "@deepseek-ai/dsh-storage-domain";
|
|
3
3
|
import { CURATOR_STATE_KEY, CURATOR_STATE_TABLE, PENDING_KINDS, PENDING_RESOLVED_CAP, PENDING_STATUSES, PENDING_TABLE, PROVIDER_DOMAIN, REVIEW_STATE_SESSION_CAP, REVIEW_STATE_TABLE, assertCloneable, canClaimPending, canResolvePending, cloneRecord, recordIssue, releasedStatus, selectPendingOverflow, selectSessionOverflow } from "@lmzhen/dsh-evolution-state-storage";
|
|
4
|
+
//#region lib/types/compatibility.js
|
|
5
|
+
/**
|
|
6
|
+
* G2b/2b.4: the domain compatibility declaration (S1-07).
|
|
7
|
+
*
|
|
8
|
+
* A domain spec says WHAT is stored; nothing said what happens to records the CURRENT schema rejects,
|
|
9
|
+
* nor which earlier versions stay readable. Today the answer is implicit and unstated: 0 declared
|
|
10
|
+
* compatibility surface. This file is the ONE place that states it.
|
|
11
|
+
*
|
|
12
|
+
* MIGRATION NOTE: upstream P2-E1 (docs/v33-no-action-register.md) asks storage-domain to add optional
|
|
13
|
+
* `layout` / `compatibleVersions` / `invalidRecords` fields to `DomainSpec`. When that lands, this
|
|
14
|
+
* declaration MOVES onto the platform spec - the fields exist precisely so a domain can state this once.
|
|
15
|
+
* It must not then live in two places.
|
|
16
|
+
*
|
|
17
|
+
* @module @lmzhen/dsh-evolution-state-domain/compatibility
|
|
18
|
+
*/
|
|
19
|
+
/** The evolution domain's statement. Absence of this constant is what the criterion calls red. */
|
|
20
|
+
const EVOLUTION_DOMAIN_COMPATIBILITY = {
|
|
21
|
+
invalidRecords: [
|
|
22
|
+
{
|
|
23
|
+
table: "review_state",
|
|
24
|
+
tier: "regenerable",
|
|
25
|
+
why: "turn counters are observations of a session; a lost row costs one session its counters and the next run rewrites it"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
table: "curator_state",
|
|
29
|
+
tier: "regenerable",
|
|
30
|
+
why: "run bookkeeping only — runCount/lastRunAt are re-derived from the run records on the next run"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
table: "pending",
|
|
34
|
+
tier: "irreplaceable",
|
|
35
|
+
why: "a staged write is the ONLY copy of an approved-but-unapplied change; losing it loses the operator decision"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
compatibleVersions: [1]
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
4
41
|
//#region lib/types/index.js
|
|
5
42
|
/**
|
|
6
43
|
* storage-domain provider for evolution state.
|
|
@@ -337,4 +374,4 @@ function apply(ctx) {
|
|
|
337
374
|
}, "evolution-state-domain.provider");
|
|
338
375
|
}
|
|
339
376
|
//#endregion
|
|
340
|
-
export { EVOLUTION_DOMAIN, apply, curatorStateSchema, inject, name, pendingSchema, reviewStateSchema };
|
|
377
|
+
export { EVOLUTION_DOMAIN, EVOLUTION_DOMAIN_COMPATIBILITY, apply, curatorStateSchema, inject, name, pendingSchema, reviewStateSchema };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* G2b/2b.4: the domain compatibility declaration (S1-07).
|
|
3
|
+
*
|
|
4
|
+
* A domain spec says WHAT is stored; nothing said what happens to records the CURRENT schema rejects,
|
|
5
|
+
* nor which earlier versions stay readable. Today the answer is implicit and unstated: 0 declared
|
|
6
|
+
* compatibility surface. This file is the ONE place that states it.
|
|
7
|
+
*
|
|
8
|
+
* MIGRATION NOTE: upstream P2-E1 (docs/v33-no-action-register.md) asks storage-domain to add optional
|
|
9
|
+
* `layout` / `compatibleVersions` / `invalidRecords` fields to `DomainSpec`. When that lands, this
|
|
10
|
+
* declaration MOVES onto the platform spec - the fields exist precisely so a domain can state this once.
|
|
11
|
+
* It must not then live in two places.
|
|
12
|
+
*
|
|
13
|
+
* @module @lmzhen/dsh-evolution-state-domain/compatibility
|
|
14
|
+
*/
|
|
15
|
+
/** How bad it is to lose one record of a table, by whether the data can come back. */
|
|
16
|
+
export type RecordLossTier = 'regenerable' | 'irreplaceable';
|
|
17
|
+
/** One table's answer to "what if a stored record fails the current schema?". */
|
|
18
|
+
export interface InvalidRecordPolicy {
|
|
19
|
+
readonly table: string;
|
|
20
|
+
/** `regenerable`: the record can be rebuilt from another surface. `irreplaceable`: it cannot. */
|
|
21
|
+
readonly tier: RecordLossTier;
|
|
22
|
+
/** Why that tier, in one line — the claim a reader can check. */
|
|
23
|
+
readonly why: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The declaration. `compatibleVersions` and `layout` are ALTERNATIVES, not complements: a domain either
|
|
27
|
+
* states which earlier format versions it still reads, or states the layout it expects - declaring both
|
|
28
|
+
* would leave the reader two answers to one question. Exactly one must be present.
|
|
29
|
+
*/
|
|
30
|
+
export interface DomainCompatibility {
|
|
31
|
+
/** One entry per declared table; a table with no entry is an unstated loss policy. */
|
|
32
|
+
readonly invalidRecords: readonly InvalidRecordPolicy[];
|
|
33
|
+
/** Earlier domain versions this build still opens. */
|
|
34
|
+
readonly compatibleVersions?: readonly number[] | undefined;
|
|
35
|
+
/** The layout this build expects on the medium, when version compatibility is not the axis. */
|
|
36
|
+
readonly layout?: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
/** The evolution domain's statement. Absence of this constant is what the criterion calls red. */
|
|
39
|
+
export declare const EVOLUTION_DOMAIN_COMPATIBILITY: DomainCompatibility;
|
|
40
|
+
//# sourceMappingURL=compatibility.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-state-domain",
|
|
3
3
|
"description": "storage-domain provider for evolution state (community build)",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.26",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
33
33
|
"@deepseek-ai/dsh-storage-domain": "^0.2.0-rc.1",
|
|
34
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.
|
|
34
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.26.26"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@deepseek-ai/dsh-storage-domain": "^0.2.0-rc.1",
|
|
38
38
|
"@deepseek-ai/dsh-storage": "^0.2.0-rc.1",
|
|
39
39
|
"@deepseek-ai/dsh-storage-json": "^0.2.0-rc.1",
|
|
40
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.
|
|
40
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.26.26"
|
|
41
41
|
}
|
|
42
42
|
}
|