@lmzhen/dsh-evolution-skill-discovery 0.30.40 → 0.30.42
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/lib/index.js +12 -13
- package/lib/types/awareness.d.ts +4 -1
- package/lib/types/domain-map-store.d.ts +1 -1
- package/lib/types/tool.d.ts +2 -1
- package/package.json +6 -5
package/lib/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
|
-
import { SessionSeq } from "@deepseek-ai/dsh-session";
|
|
5
4
|
import MiniSearch from "minisearch";
|
|
5
|
+
import { authorityFrom, evolutionIoAdapter, evolutionRoot, isRecord, newSkillLibrary, parseFrontmatter } from "@lmzhen/dsh-evolution-core";
|
|
6
6
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
7
|
-
import { authorityFrom, evolutionIoAdapter, newSkillLibrary, parseFrontmatter } from "@lmzhen/dsh-evolution-core";
|
|
8
|
-
import { homedir } from "node:os";
|
|
9
7
|
//#region lib/types/identity.js
|
|
10
8
|
function sha256(value) {
|
|
11
9
|
return createHash("sha256").update(value).digest("hex");
|
|
@@ -237,9 +235,7 @@ function renderCatalog(entries) {
|
|
|
237
235
|
function projectionPresent(agent, digest) {
|
|
238
236
|
try {
|
|
239
237
|
const visible = new Set(agent.session.surface.nodes);
|
|
240
|
-
for (
|
|
241
|
-
const event = agent.session.eventAt(SessionSeq(index));
|
|
242
|
-
if (event === void 0) return false;
|
|
238
|
+
for (const event of agent.session.snapshotEvents()) {
|
|
243
239
|
if (event.type !== "user/message") continue;
|
|
244
240
|
const data = event.data;
|
|
245
241
|
if (data?.source?.kind !== "evolution-skill-projection" || data.source.digest !== digest) continue;
|
|
@@ -572,9 +568,6 @@ function emptySnapshot() {
|
|
|
572
568
|
edges: []
|
|
573
569
|
};
|
|
574
570
|
}
|
|
575
|
-
function isRecord(value) {
|
|
576
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
577
|
-
}
|
|
578
571
|
function assertNode(node) {
|
|
579
572
|
if (!isRecord(node) || typeof node.id !== "string" || node.id.length === 0) throw new DomainMapCorruptError("domain node id is missing");
|
|
580
573
|
if (typeof node.name !== "string" || typeof node.purpose !== "string" || typeof node.description !== "string") throw new DomainMapCorruptError("domain node text fields are missing");
|
|
@@ -1167,14 +1160,17 @@ function toToolResponse(response) {
|
|
|
1167
1160
|
};
|
|
1168
1161
|
}
|
|
1169
1162
|
/**
|
|
1170
|
-
* Register skill_search on
|
|
1163
|
+
* Register skill_search on the optional tools service. The description/schema are static; the
|
|
1171
1164
|
* provider is the only dynamic dependency.
|
|
1165
|
+
* platform-declaration anchor: tools is declared in core PLATFORM_SERVICE_PROBES.
|
|
1172
1166
|
* @param ctx - plugin context.
|
|
1173
1167
|
* @param provider - search service or undefined when unavailable.
|
|
1174
1168
|
* @returns tool disposer.
|
|
1175
1169
|
*/
|
|
1176
1170
|
function registerSkillSearchTool(ctx, provider) {
|
|
1177
|
-
|
|
1171
|
+
const tools = ctx.get("tools");
|
|
1172
|
+
if (tools === void 0) return () => {};
|
|
1173
|
+
return tools.register(defineTool({
|
|
1178
1174
|
name: "skill_search",
|
|
1179
1175
|
description: SKILL_SEARCH_DESCRIPTION,
|
|
1180
1176
|
parameters: {
|
|
@@ -1952,7 +1948,10 @@ function aggregateJudge(records, expectedQueryIds) {
|
|
|
1952
1948
|
//#region lib/types/awareness.js
|
|
1953
1949
|
/** Static 1–2 sentence awareness; no domain list/tree. */
|
|
1954
1950
|
const DISCOVERY_AWARENESS = "When skill coverage for a task is uncertain, the domain cards and skill_search can reduce it; search is optional, not a required step.";
|
|
1955
|
-
/**
|
|
1951
|
+
/**
|
|
1952
|
+
* Register the static awareness section; absent systemPrompt is a no-op.
|
|
1953
|
+
* platform-declaration anchor: the optional systemPrompt service declared in core PLATFORM_SERVICE_PROBES.
|
|
1954
|
+
*/
|
|
1956
1955
|
function installDiscoveryAwareness(ctx) {
|
|
1957
1956
|
const prompt = ctx.get("systemPrompt");
|
|
1958
1957
|
if (prompt === void 0) return () => {};
|
|
@@ -2265,7 +2264,7 @@ function apply(ctx, config) {
|
|
|
2265
2264
|
ctx,
|
|
2266
2265
|
authority: authorityFrom({ origin: "foreground" })
|
|
2267
2266
|
}));
|
|
2268
|
-
const dshHome =
|
|
2267
|
+
const dshHome = evolutionRoot();
|
|
2269
2268
|
const map = new DomainMapFileStore(io, config.domainMapPath ?? join(dshHome, "evolution", "domain-map.json"));
|
|
2270
2269
|
if (config.domainGeneration !== void 0 && config.domainGenerationSkills !== void 0 && config.domainGenerationSkillKeys !== void 0) initialDomainMap(map, config.domainGeneration, config.domainGenerationSkills, config.domainGenerationSkillKeys, "0", void 0, buildDomainGenerationPrompt({
|
|
2271
2270
|
...config.domainMinDomains === void 0 ? {} : { minDomains: config.domainMinDomains },
|
package/lib/types/awareness.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
/** Static 1–2 sentence awareness; no domain list/tree. */
|
|
3
3
|
export declare const DISCOVERY_AWARENESS = "When skill coverage for a task is uncertain, the domain cards and skill_search can reduce it; search is optional, not a required step.";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Register the static awareness section; absent systemPrompt is a no-op.
|
|
6
|
+
* platform-declaration anchor: the optional systemPrompt service declared in core PLATFORM_SERVICE_PROBES.
|
|
7
|
+
*/
|
|
5
8
|
export declare function installDiscoveryAwareness(ctx: Context): () => void;
|
|
6
9
|
//# sourceMappingURL=awareness.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
|
|
2
2
|
import type { DomainMapSnapshot, DomainMapStore, DomainMapWrite } from './domain-map.ts';
|
|
3
3
|
/** File schema version supported by this store. */
|
|
4
4
|
export declare const DOMAIN_MAP_SCHEMA_VERSION = 1;
|
package/lib/types/tool.d.ts
CHANGED
|
@@ -14,8 +14,9 @@ export declare const SKILL_SEARCH_DESCRIPTION = "Search skill summaries by name,
|
|
|
14
14
|
/** @returns response or a degraded hint; never silent empty on failure. */
|
|
15
15
|
export declare function searchWithDegraded(provider: SkillSearchProvider | undefined, query: SkillSearchQuery, allowedSkillKeys?: ReadonlySet<string> | undefined, agent?: Agent | undefined): Promise<SkillSearchResponse>;
|
|
16
16
|
/**
|
|
17
|
-
* Register skill_search on
|
|
17
|
+
* Register skill_search on the optional tools service. The description/schema are static; the
|
|
18
18
|
* provider is the only dynamic dependency.
|
|
19
|
+
* platform-declaration anchor: tools is declared in core PLATFORM_SERVICE_PROBES.
|
|
19
20
|
* @param ctx - plugin context.
|
|
20
21
|
* @param provider - search service or undefined when unavailable.
|
|
21
22
|
* @returns tool disposer.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-skill-discovery",
|
|
3
3
|
"description": "Read model and view identity for evolution skill discovery (community build)",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.42",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,8 +32,9 @@
|
|
|
32
32
|
"@deepseek-ai/dsh-llm": "^0.2.1-rc.2",
|
|
33
33
|
"@deepseek-ai/dsh-session": "^0.2.1-rc.2",
|
|
34
34
|
"@deepseek-ai/dsh-tools": "^0.2.1-rc.2",
|
|
35
|
-
"@
|
|
36
|
-
"@lmzhen/dsh-evolution-
|
|
35
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.1-rc.2",
|
|
36
|
+
"@lmzhen/dsh-evolution-core": "^0.30.42",
|
|
37
|
+
"@lmzhen/dsh-evolution-io": "^0.30.42"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@deepseek-ai/dsh-skill": "^0.2.1-rc.2",
|
|
@@ -46,8 +47,8 @@
|
|
|
46
47
|
"@deepseek-ai/dsh-tools": "^0.2.1-rc.2",
|
|
47
48
|
"@deepseek-ai/dsh-skill-filesystem": "^0.2.1-rc.2",
|
|
48
49
|
"@deepseek-ai/dsh-tool-skill": "^0.2.1-rc.2",
|
|
49
|
-
"@lmzhen/dsh-evolution-core": "^0.30.
|
|
50
|
-
"@lmzhen/dsh-evolution-io": "^0.30.
|
|
50
|
+
"@lmzhen/dsh-evolution-core": "^0.30.42",
|
|
51
|
+
"@lmzhen/dsh-evolution-io": "^0.30.42"
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
53
54
|
"@deepseek-ai/dsh-llm": "^0.2.1-rc.2",
|