@lmzhen/dsh-evolution-activity 0.1.0-rc.2 → 0.1.0-rc.20

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 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
- - No known durable consumer gaps at this time. Runtime contracts are covered by package and boundary tests.
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
- import { z } from "zod";
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().int().nonnegative(),
11
- skillApplied: z.number().int().nonnegative(),
12
- rejectedOps: z.number().int().nonnegative(),
13
- at: z.number().nonnegative()
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.register({
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: () => ({ items: [] }),
37
- apply: (state, event) => applyState(state, event, maxItems),
38
- view: (state) => ({ items: state.items }),
42
+ init,
43
+ apply,
44
+ wire: {
45
+ viewSchema: activitySchema,
46
+ view
47
+ },
48
+ view,
39
49
  stateVersion: 1
40
50
  });
41
51
  });
@@ -3,7 +3,7 @@
3
3
  * @module @deepseek-ai/dsh-evolution-activity
4
4
  */
5
5
  import type { Context } from '@deepseek-ai/cordis';
6
- import { z } from 'zod';
6
+ import z from '@deepseek-ai/schemastery';
7
7
  export interface EvolutionActivityItem {
8
8
  planId: string;
9
9
  kind: string;
@@ -35,9 +35,7 @@ export declare const name = "evolution-activity";
35
35
  export interface Config {
36
36
  maxItems?: number;
37
37
  }
38
- export declare const Config: z.ZodObject<{
39
- maxItems: z.ZodDefault<z.ZodNumber>;
40
- }, z.core.$strip>;
38
+ export declare const Config: z<Config>;
41
39
  export declare function apply(ctx: Context, rawConfig?: Config): void;
42
40
  export {};
43
41
  //# sourceMappingURL=index.d.ts.map
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.2",
4
+ "version": "0.1.0-rc.20",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -33,7 +33,7 @@
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
35
  "@deepseek-ai/schemastery": "^3.18.1",
36
- "zod": "^3.0.0"
36
+ "zod": "^4.4.3"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",