@lmzhen/dsh-evolution-activity 0.1.0-rc.3 → 0.1.0-rc.30
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 +2 -1
- package/lib/index.js +21 -11
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -21,4 +21,5 @@ Independent of request-prefix construction. This package does not alter the asse
|
|
|
21
21
|
## Known Limitations and Deferred Work
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
-
|
|
24
|
+
- The projection registers BOTH contract generations — `stateSchema` + `wire.viewSchema` (DSH 0.1.1+ session-projection contract) and legacy `schema` + `view` (0.1.0-rc.6 era) — because each registry ignores the fields it does not know. When the legacy fields are removed, drop the old half of the dual registration.
|
|
25
|
+
- On 0.1.1+ hosts the cold-read path (`restore`) calls `stateSchema.parse` on checkpointed rows; a registration missing `stateSchema` would throw on the first cold read, so the new half is load-bearing, not cosmetic.
|
package/lib/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { z as z$1 } from "zod";
|
|
2
3
|
//#region lib/types/index.js
|
|
3
4
|
/**
|
|
4
5
|
* Session projection for self-evolution activity.
|
|
5
6
|
* @module @lmzhen/dsh-evolution-activity
|
|
6
7
|
*/
|
|
7
|
-
const activitySchema = z.object({ items: z.array(z.object({
|
|
8
|
-
planId: z.string(),
|
|
9
|
-
kind: z.string(),
|
|
10
|
-
memoryApplied: z.number().min(0),
|
|
11
|
-
skillApplied: z.number().min(0),
|
|
12
|
-
rejectedOps: z.number().min(0),
|
|
13
|
-
at: z.number().min(0)
|
|
8
|
+
const activitySchema = z$1.object({ items: z$1.array(z$1.object({
|
|
9
|
+
planId: z$1.string(),
|
|
10
|
+
kind: z$1.string(),
|
|
11
|
+
memoryApplied: z$1.number().min(0),
|
|
12
|
+
skillApplied: z$1.number().min(0),
|
|
13
|
+
rejectedOps: z$1.number().min(0),
|
|
14
|
+
at: z$1.number().min(0)
|
|
14
15
|
})) });
|
|
15
16
|
function applyState(state, event, maxItems = 20) {
|
|
16
17
|
if (event.type !== "evolution/plan-applied") return state;
|
|
@@ -30,12 +31,21 @@ const Config = z.object({ maxItems: z.number().default(20) });
|
|
|
30
31
|
function apply(ctx, rawConfig = {}) {
|
|
31
32
|
const maxItems = rawConfig.maxItems ?? 20;
|
|
32
33
|
ctx.inject(["sessionProjections"], (projectionCtx) => {
|
|
33
|
-
projectionCtx.sessionProjections
|
|
34
|
+
const runtime = projectionCtx.sessionProjections;
|
|
35
|
+
const init = () => ({ items: [] });
|
|
36
|
+
const apply = (state, event) => applyState(state, event, maxItems);
|
|
37
|
+
const view = (state) => ({ items: state.items });
|
|
38
|
+
runtime.register({
|
|
34
39
|
key: "evolution-activity",
|
|
40
|
+
stateSchema: activitySchema,
|
|
35
41
|
schema: activitySchema,
|
|
36
|
-
init
|
|
37
|
-
apply
|
|
38
|
-
|
|
42
|
+
init,
|
|
43
|
+
apply,
|
|
44
|
+
wire: {
|
|
45
|
+
viewSchema: activitySchema,
|
|
46
|
+
view
|
|
47
|
+
},
|
|
48
|
+
view,
|
|
39
49
|
stateVersion: 1
|
|
40
50
|
});
|
|
41
51
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-activity",
|
|
3
3
|
"description": "Session projection for self-evolution activity (community build)",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.30",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@deepseek-ai/schemastery": "^3.18.1"
|
|
35
|
+
"@deepseek-ai/schemastery": "^3.18.1",
|
|
36
|
+
"zod": "^4.4.3"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|