@lmzhen/dsh-evolution-activity 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 +44 -0
- package/lib/invariant.js +8 -0
- package/lib/types/index.d.ts +43 -0
- package/lib/types/invariant.d.ts +5 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @deepseek-ai/dsh-evolution-activity
|
|
2
|
+
|
|
3
|
+
Session projection for self-evolution activity
|
|
4
|
+
|
|
5
|
+
## Model Experience
|
|
6
|
+
|
|
7
|
+
### Indirect model surface
|
|
8
|
+
|
|
9
|
+
#### What the model sees
|
|
10
|
+
|
|
11
|
+
`@deepseek-ai/dsh-evolution-activity` 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,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region lib/types/index.js
|
|
3
|
+
/**
|
|
4
|
+
* Session projection for self-evolution activity.
|
|
5
|
+
* @module @lmzhen/dsh-evolution-activity
|
|
6
|
+
*/
|
|
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()
|
|
14
|
+
})) });
|
|
15
|
+
function applyState(state, event, maxItems = 20) {
|
|
16
|
+
if (event.type !== "evolution/plan-applied") return state;
|
|
17
|
+
const data = event.data;
|
|
18
|
+
const time = event.time;
|
|
19
|
+
return { items: [...state.items, {
|
|
20
|
+
planId: data.planId,
|
|
21
|
+
kind: "plan",
|
|
22
|
+
memoryApplied: data.memoryApplied,
|
|
23
|
+
skillApplied: data.skillApplied,
|
|
24
|
+
rejectedOps: data.rejectedOps,
|
|
25
|
+
at: time
|
|
26
|
+
}].slice(-maxItems) };
|
|
27
|
+
}
|
|
28
|
+
const name = "evolution-activity";
|
|
29
|
+
const Config = z.object({ maxItems: z.number().default(20) });
|
|
30
|
+
function apply(ctx, rawConfig = {}) {
|
|
31
|
+
const maxItems = rawConfig.maxItems ?? 20;
|
|
32
|
+
ctx.inject(["sessionProjections"], (projectionCtx) => {
|
|
33
|
+
projectionCtx.sessionProjections.register({
|
|
34
|
+
key: "evolution-activity",
|
|
35
|
+
schema: activitySchema,
|
|
36
|
+
init: () => ({ items: [] }),
|
|
37
|
+
apply: (state, event) => applyState(state, event, maxItems),
|
|
38
|
+
view: (state) => ({ items: state.items }),
|
|
39
|
+
stateVersion: 1
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Config, apply, applyState, name };
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
const PACKAGE_NAME = "@deepseek-ai/dsh-evolution-activity";
|
|
3
|
+
const name = "evolution-activity-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,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session projection for self-evolution activity.
|
|
3
|
+
* @module @deepseek-ai/dsh-evolution-activity
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export interface EvolutionActivityItem {
|
|
8
|
+
planId: string;
|
|
9
|
+
kind: string;
|
|
10
|
+
memoryApplied: number;
|
|
11
|
+
skillApplied: number;
|
|
12
|
+
rejectedOps: number;
|
|
13
|
+
at: number;
|
|
14
|
+
}
|
|
15
|
+
export interface EvolutionActivityProjection {
|
|
16
|
+
items: EvolutionActivityItem[];
|
|
17
|
+
}
|
|
18
|
+
export interface State {
|
|
19
|
+
items: EvolutionActivityItem[];
|
|
20
|
+
}
|
|
21
|
+
type SessionEventLike = {
|
|
22
|
+
type: 'evolution/plan-applied';
|
|
23
|
+
data: {
|
|
24
|
+
planId: string;
|
|
25
|
+
memoryApplied: number;
|
|
26
|
+
skillApplied: number;
|
|
27
|
+
rejectedOps: number;
|
|
28
|
+
};
|
|
29
|
+
time: number;
|
|
30
|
+
} | {
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function applyState(state: State, event: SessionEventLike, maxItems?: number): State;
|
|
34
|
+
export declare const name = "evolution-activity";
|
|
35
|
+
export interface Config {
|
|
36
|
+
maxItems?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare const Config: z.ZodObject<{
|
|
39
|
+
maxItems: z.ZodDefault<z.ZodNumber>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export declare function apply(ctx: Context, rawConfig?: Config): void;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lmzhen/dsh-evolution-activity",
|
|
3
|
+
"description": "Session projection for self-evolution activity (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-activity"
|
|
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
|
+
"zod": "^3.0.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
40
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
41
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.0-rc.6"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
45
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.0-rc.6"
|
|
46
|
+
}
|
|
47
|
+
}
|