@lmzhen/dsh-evolution-state 0.1.0-rc.1
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/README.md +24 -0
- package/lib/index.js +53 -0
- package/lib/invariant.js +8 -0
- package/lib/types/index.d.ts +40 -0
- package/lib/types/invariant.d.ts +5 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @deepseek-ai/dsh-evolution-state
|
|
2
|
+
|
|
3
|
+
Durable storage-domain-backed evolution state with JSON fallback
|
|
4
|
+
|
|
5
|
+
## Model Experience
|
|
6
|
+
|
|
7
|
+
### Indirect model surface
|
|
8
|
+
|
|
9
|
+
#### What the model sees
|
|
10
|
+
|
|
11
|
+
`@deepseek-ai/dsh-evolution-state` registers no direct prompt or tool schema itself. Model-visible effects are owned by the packages that consume this service.
|
|
12
|
+
|
|
13
|
+
#### Token effect
|
|
14
|
+
|
|
15
|
+
Zero direct token effect from this package; consumers add any model-visible tokens.
|
|
16
|
+
|
|
17
|
+
#### KV Cache effect
|
|
18
|
+
|
|
19
|
+
Independent of request-prefix construction. This package does not alter the assembled prompt or tool list.
|
|
20
|
+
|
|
21
|
+
## Known Limitations and Deferred Work
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
- No known durable consumer gaps at this time. Runtime contracts are covered by package and boundary tests.
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Service } from "@deepseek-ai/cordis";
|
|
2
|
+
import z from "@deepseek-ai/schemastery";
|
|
3
|
+
import { EVOLUTION_DOMAIN, curatorStateSchema, pendingSchema, reviewStateSchema } from "@lmzhen/dsh-evolution-state-domain";
|
|
4
|
+
//#region lib/types/index.js
|
|
5
|
+
/**
|
|
6
|
+
* Durable evolution state consumer.
|
|
7
|
+
*
|
|
8
|
+
* The service owns no medium and performs no IO. It resolves the mounted
|
|
9
|
+
* provider from `ctx.evolutionStateStorage` (see evolution-state-json and
|
|
10
|
+
* evolution-state-domain); `provider` config may pin one by name.
|
|
11
|
+
* @module @lmzhen/dsh-evolution-state
|
|
12
|
+
*/
|
|
13
|
+
var EvolutionState = class extends Service {
|
|
14
|
+
static inject = ["evolutionStateStorage"];
|
|
15
|
+
static Config = z.object({ provider: z.string().default("") });
|
|
16
|
+
providerName;
|
|
17
|
+
constructor(ctx, config = {}) {
|
|
18
|
+
super(ctx, "evolutionState");
|
|
19
|
+
this.providerName = config.provider ?? "";
|
|
20
|
+
}
|
|
21
|
+
storage() {
|
|
22
|
+
return this.ctx.evolutionStateStorage.provider(this.providerName || void 0);
|
|
23
|
+
}
|
|
24
|
+
loadReviewState(sessionId) {
|
|
25
|
+
return this.storage().loadReviewState(sessionId);
|
|
26
|
+
}
|
|
27
|
+
saveReviewState(sessionId, record) {
|
|
28
|
+
return this.storage().saveReviewState(sessionId, record);
|
|
29
|
+
}
|
|
30
|
+
loadCuratorState() {
|
|
31
|
+
return this.storage().loadCuratorState();
|
|
32
|
+
}
|
|
33
|
+
saveCuratorState(record) {
|
|
34
|
+
return this.storage().saveCuratorState(record);
|
|
35
|
+
}
|
|
36
|
+
listPending(status = "pending") {
|
|
37
|
+
return this.storage().listPending(status);
|
|
38
|
+
}
|
|
39
|
+
savePending(record) {
|
|
40
|
+
return this.storage().savePending(record);
|
|
41
|
+
}
|
|
42
|
+
tryResolvePending(id, status) {
|
|
43
|
+
return this.storage().tryResolvePending(id, status);
|
|
44
|
+
}
|
|
45
|
+
claimPending(id, claimId) {
|
|
46
|
+
return this.storage().claimPending(id, claimId);
|
|
47
|
+
}
|
|
48
|
+
releasePendingClaim(id, claimId) {
|
|
49
|
+
return this.storage().releasePendingClaim(id, claimId);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { EVOLUTION_DOMAIN, EvolutionState, EvolutionState as default, curatorStateSchema, pendingSchema, reviewStateSchema };
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
const PACKAGE_NAME = "@deepseek-ai/dsh-evolution-state";
|
|
3
|
+
const name = "evolution-state-invariant";
|
|
4
|
+
const inject = ["invariants"];
|
|
5
|
+
const install = () => {};
|
|
6
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
7
|
+
//#endregion
|
|
8
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable evolution state consumer.
|
|
3
|
+
*
|
|
4
|
+
* The service owns no medium and performs no IO. It resolves the mounted
|
|
5
|
+
* provider from `ctx.evolutionStateStorage` (see evolution-state-json and
|
|
6
|
+
* evolution-state-domain); `provider` config may pin one by name.
|
|
7
|
+
* @module @deepseek-ai/dsh-evolution-state
|
|
8
|
+
*/
|
|
9
|
+
import { Context, Service } from '@deepseek-ai/cordis';
|
|
10
|
+
import type Schema from '@deepseek-ai/schemastery';
|
|
11
|
+
import type { CuratorStateRecord, PendingRecord, PendingStatus, ReviewStateRecord } from '@deepseek-ai/dsh-evolution-state-storage';
|
|
12
|
+
export type { CuratorStateRecord, EvolutionStateStorage, PendingRecord, PendingStatus, ReviewStateRecord, } from '@deepseek-ai/dsh-evolution-state-storage';
|
|
13
|
+
export { curatorStateSchema, EVOLUTION_DOMAIN, pendingSchema, reviewStateSchema, } from '@deepseek-ai/dsh-evolution-state-domain';
|
|
14
|
+
declare module '@deepseek-ai/cordis' {
|
|
15
|
+
interface Context {
|
|
16
|
+
evolutionState: EvolutionState;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export interface Config {
|
|
20
|
+
/** Pin a provider by name; empty = first registered provider. */
|
|
21
|
+
provider?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class EvolutionState extends Service {
|
|
24
|
+
static inject: string[];
|
|
25
|
+
static Config: Schema<Config>;
|
|
26
|
+
private readonly providerName;
|
|
27
|
+
constructor(ctx: Context, config?: Config);
|
|
28
|
+
private storage;
|
|
29
|
+
loadReviewState(sessionId: string): Promise<ReviewStateRecord | null>;
|
|
30
|
+
saveReviewState(sessionId: string, record: ReviewStateRecord): Promise<void>;
|
|
31
|
+
loadCuratorState(): Promise<CuratorStateRecord | null>;
|
|
32
|
+
saveCuratorState(record: CuratorStateRecord): Promise<void>;
|
|
33
|
+
listPending(status?: PendingStatus): Promise<PendingRecord[]>;
|
|
34
|
+
savePending(record: PendingRecord): Promise<void>;
|
|
35
|
+
tryResolvePending(id: string, status: 'approved' | 'rejected'): Promise<import("@deepseek-ai/dsh-evolution-state-storage").PendingResolution>;
|
|
36
|
+
claimPending(id: string, claimId: string): Promise<PendingRecord | null>;
|
|
37
|
+
releasePendingClaim(id: string, claimId: string): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export default EvolutionState;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lmzhen/dsh-evolution-state",
|
|
3
|
+
"description": "Durable evolution state consumer over pluggable storage providers (community build)",
|
|
4
|
+
"version": "0.1.0-rc.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/lmzhen/dsh-evolution.git",
|
|
11
|
+
"directory": "packages/dsh-evolution-state"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"lib/index.js",
|
|
29
|
+
"lib/invariant.js",
|
|
30
|
+
"lib/types/**/*.d.ts",
|
|
31
|
+
"lib/types/invariant.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
39
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
40
|
+
"@deepseek-ai/dsh-storage-domain": "^0.1.0-rc.6",
|
|
41
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.1.0-rc.1",
|
|
42
|
+
"@lmzhen/dsh-evolution-state-domain": "^0.1.0-rc.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
46
|
+
"@deepseek-ai/dsh-storage-domain": "^0.1.0-rc.6",
|
|
47
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.1.0-rc.1",
|
|
48
|
+
"@lmzhen/dsh-evolution-state-domain": "^0.1.0-rc.1",
|
|
49
|
+
"@lmzhen/dsh-evolution-io": "^0.1.0-rc.1",
|
|
50
|
+
"@lmzhen/dsh-evolution-io-node": "^0.1.0-rc.1",
|
|
51
|
+
"@lmzhen/dsh-evolution-state-json": "^0.1.0-rc.1"
|
|
52
|
+
}
|
|
53
|
+
}
|