@lmzhen/dsh-evolution-skill-catalog 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 +26 -0
- package/lib/index.js +92 -0
- package/lib/invariant.js +8 -0
- package/lib/types/index.d.ts +29 -0
- package/lib/types/invariant.d.ts +5 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @deepseek-ai/dsh-evolution-skill-catalog
|
|
2
|
+
|
|
3
|
+
Native ctx.skills provider for the evolution-managed skill tree
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Model Experience
|
|
7
|
+
|
|
8
|
+
### Indirect model surface
|
|
9
|
+
|
|
10
|
+
#### What the model sees
|
|
11
|
+
|
|
12
|
+
`@deepseek-ai/dsh-evolution-skill-catalog` registers no direct prompt or tool schema itself. Model-visible effects are owned by the packages that consume this service.
|
|
13
|
+
|
|
14
|
+
#### Token effect
|
|
15
|
+
|
|
16
|
+
Zero direct token effect from this package; consumers add any model-visible tokens.
|
|
17
|
+
|
|
18
|
+
#### KV Cache effect
|
|
19
|
+
|
|
20
|
+
Independent of request-prefix construction. This package does not alter the assembled prompt or tool list.
|
|
21
|
+
|
|
22
|
+
## Known Limitations and Deferred Work
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
- - Read-only native `ctx.skills` catalog. Skill mutations still happen through `tool-skill-manage`.
|
|
26
|
+
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { SkillLibrary, evolutionIoAdapter } from "@lmzhen/dsh-evolution-core";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
//#region lib/types/index.js
|
|
5
|
+
/**
|
|
6
|
+
* Native `ctx.skills` provider for the evolution-managed skill tree.
|
|
7
|
+
*
|
|
8
|
+
* `tool-skill-manage` writes skills through `ctx.evolutionIo`; this provider
|
|
9
|
+
* publishes the same tree into DSH's skill registry and invalidates its
|
|
10
|
+
* catalog synchronously on `evolution/skill-mutated`, removing the
|
|
11
|
+
* filesystem-watcher latency/window from the write → visible loop.
|
|
12
|
+
* @module @lmzhen/dsh-evolution-skill-catalog
|
|
13
|
+
*/
|
|
14
|
+
const name = "evolution-skill-catalog";
|
|
15
|
+
const inject = ["skills", "evolutionIo"];
|
|
16
|
+
const Config = z.object({
|
|
17
|
+
root: z.string().default(""),
|
|
18
|
+
modelInvocable: z.boolean().default(true),
|
|
19
|
+
userInvocable: z.boolean().default(true),
|
|
20
|
+
includeSkillNames: z.array(z.string()).default([]),
|
|
21
|
+
excludeSkillNames: z.array(z.string()).default([])
|
|
22
|
+
});
|
|
23
|
+
/** Below filesystem's user rank so the evolution-owned tree wins duplicates. */
|
|
24
|
+
const EVOLUTION_SKILL_RANK = 390;
|
|
25
|
+
function apply(ctx, rawConfig = {}) {
|
|
26
|
+
const invocation = {
|
|
27
|
+
modelInvocable: rawConfig.modelInvocable ?? true,
|
|
28
|
+
userInvocable: rawConfig.userInvocable ?? true
|
|
29
|
+
};
|
|
30
|
+
const io = evolutionIoAdapter(() => ctx.evolutionIo.provider());
|
|
31
|
+
const library = new SkillLibrary(rawConfig.root || void 0, io);
|
|
32
|
+
const included = new Set(rawConfig.includeSkillNames ?? []);
|
|
33
|
+
const excluded = new Set(rawConfig.excludeSkillNames ?? []);
|
|
34
|
+
const visible = (name) => (included.size === 0 || included.has(name)) && !excluded.has(name);
|
|
35
|
+
let control;
|
|
36
|
+
const provider = {
|
|
37
|
+
name: "dsh-evolution",
|
|
38
|
+
async list(_options) {
|
|
39
|
+
return (await library.list()).filter((summary) => visible(summary.name)).map((summary) => ({
|
|
40
|
+
name: summary.name,
|
|
41
|
+
description: summary.description,
|
|
42
|
+
invocation,
|
|
43
|
+
source: "user-dsh",
|
|
44
|
+
provider: "dsh-evolution",
|
|
45
|
+
rank: 390,
|
|
46
|
+
locator: { name: summary.name },
|
|
47
|
+
path: join(summary.path, "SKILL.md"),
|
|
48
|
+
resourceBase: {
|
|
49
|
+
kind: "directory",
|
|
50
|
+
path: summary.path
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
},
|
|
54
|
+
async get(candidate) {
|
|
55
|
+
const name = candidate.name;
|
|
56
|
+
if (!visible(name)) return void 0;
|
|
57
|
+
const content = await library.read(name);
|
|
58
|
+
if (content === null) return void 0;
|
|
59
|
+
const summary = (await library.list()).find((item) => item.name === name);
|
|
60
|
+
if (!summary) return void 0;
|
|
61
|
+
return {
|
|
62
|
+
name,
|
|
63
|
+
description: summary.description,
|
|
64
|
+
invocation,
|
|
65
|
+
source: "user-dsh",
|
|
66
|
+
provider: "dsh-evolution",
|
|
67
|
+
resourceBase: {
|
|
68
|
+
kind: "directory",
|
|
69
|
+
path: summary.path
|
|
70
|
+
},
|
|
71
|
+
content,
|
|
72
|
+
path: join(summary.path, "SKILL.md")
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
ctx.effect(() => {
|
|
77
|
+
const unregister = ctx.skills.registerProvider((providerControl) => {
|
|
78
|
+
control = providerControl;
|
|
79
|
+
return provider;
|
|
80
|
+
});
|
|
81
|
+
const disposeEvent = ctx.on("evolution/skill-mutated", () => {
|
|
82
|
+
control?.invalidate();
|
|
83
|
+
});
|
|
84
|
+
return () => {
|
|
85
|
+
disposeEvent();
|
|
86
|
+
unregister();
|
|
87
|
+
control = void 0;
|
|
88
|
+
};
|
|
89
|
+
}, "evolution-skill-catalog.provider");
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { Config, EVOLUTION_SKILL_RANK, apply, inject, name };
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
const PACKAGE_NAME = "@deepseek-ai/dsh-evolution-skill-catalog";
|
|
3
|
+
const name = "evolution-skill-catalog-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,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native `ctx.skills` provider for the evolution-managed skill tree.
|
|
3
|
+
*
|
|
4
|
+
* `tool-skill-manage` writes skills through `ctx.evolutionIo`; this provider
|
|
5
|
+
* publishes the same tree into DSH's skill registry and invalidates its
|
|
6
|
+
* catalog synchronously on `evolution/skill-mutated`, removing the
|
|
7
|
+
* filesystem-watcher latency/window from the write → visible loop.
|
|
8
|
+
* @module @deepseek-ai/dsh-evolution-skill-catalog
|
|
9
|
+
*/
|
|
10
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
11
|
+
import z from '@deepseek-ai/schemastery';
|
|
12
|
+
export declare const name = "evolution-skill-catalog";
|
|
13
|
+
export declare const inject: string[];
|
|
14
|
+
export interface Config {
|
|
15
|
+
root?: string;
|
|
16
|
+
/** Whether catalog skills are advertised/loadable by the model. */
|
|
17
|
+
modelInvocable?: boolean;
|
|
18
|
+
/** Whether catalog skills are advertised/loadable from user surfaces. */
|
|
19
|
+
userInvocable?: boolean;
|
|
20
|
+
/** Restrict the published catalog to these skill names (empty = all). */
|
|
21
|
+
includeSkillNames?: string[];
|
|
22
|
+
/** Hide these skill names from the published catalog. */
|
|
23
|
+
excludeSkillNames?: string[];
|
|
24
|
+
}
|
|
25
|
+
export declare const Config: z<Config>;
|
|
26
|
+
/** Below filesystem's user rank so the evolution-owned tree wins duplicates. */
|
|
27
|
+
export declare const EVOLUTION_SKILL_RANK = 390;
|
|
28
|
+
export declare function apply(ctx: Context, rawConfig?: Config): void;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lmzhen/dsh-evolution-skill-catalog",
|
|
3
|
+
"description": "Native ctx.skills provider for the evolution-managed skill tree (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-skill-catalog"
|
|
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
|
+
"@lmzhen/dsh-evolution-core": "^0.1.0-rc.1"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
40
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
41
|
+
"@deepseek-ai/dsh-skill": "^0.1.0-rc.6",
|
|
42
|
+
"@lmzhen/dsh-evolution-io": "^0.1.0-rc.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
46
|
+
"@deepseek-ai/dsh-skill": "^0.1.0-rc.6",
|
|
47
|
+
"@lmzhen/dsh-evolution-core": "^0.1.0-rc.1",
|
|
48
|
+
"@lmzhen/dsh-evolution-io": "^0.1.0-rc.1"
|
|
49
|
+
}
|
|
50
|
+
}
|