@lmzhen/dsh-evolution-core 0.53.0 → 0.54.0
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/runtime/plugin.js
CHANGED
|
@@ -3,7 +3,97 @@ import { t as connectionPort } from "../connection-DAJy7Xjm.js";
|
|
|
3
3
|
import { C as workingDirectoryPort, D as profileContextPort, E as pluginManagerPort, O as commandsPort, S as skillsPort, T as pluginInventoryPort, _ as agentsPort, b as storageDomainPort, d as EvolutionLlmError, f as llmPort, g as subagentsPort, h as userQuestionsPort, m as projectionPort, p as modelRoute, v as systemPromptPort, w as configEditorPort, x as sessionQueryPort, y as settingsPort } from "../platform-DyHnHUmQ.js";
|
|
4
4
|
import { t as presetsPort } from "../presets-C8vuCuNA.js";
|
|
5
5
|
import { n as toolsPort } from "../tools-BrUswg8v.js";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
6
8
|
import { Service } from "@deepseek-ai/cordis";
|
|
9
|
+
//#region lib/types/runtime/coherence.js
|
|
10
|
+
/**
|
|
11
|
+
* Family version coherence probe.
|
|
12
|
+
*
|
|
13
|
+
* A profile can contain one bundle whose implementation packages come from
|
|
14
|
+
* different family releases: the bundle row updates while a directly pinned
|
|
15
|
+
* sibling stays behind, or old hand-copied packages shadow the pnpm tree. The
|
|
16
|
+
* loader then runs an old client against a new host, which looks like a UI
|
|
17
|
+
* regression rather than a mixed install. This probe names that state at
|
|
18
|
+
* startup; it never repairs a live profile (a package-manager write while the
|
|
19
|
+
* host runs is unsafe and needs a restart).
|
|
20
|
+
*
|
|
21
|
+
* @module @lmzhen/dsh-evolution-core/runtime/coherence
|
|
22
|
+
*/
|
|
23
|
+
function packageTail(name) {
|
|
24
|
+
return name.slice(name.lastIndexOf("/") + 1);
|
|
25
|
+
}
|
|
26
|
+
/** Family implementation tails; external @deepseek-ai packages stay out. */
|
|
27
|
+
function isFamilyPackage(name) {
|
|
28
|
+
const tail = packageTail(name);
|
|
29
|
+
return tail.startsWith("dsh-evolution-") || tail === "dsh-memory" || tail === "dsh-memory-files" || tail === "dsh-skill-usage" || tail === "dsh-tool-memory" || tail === "dsh-tool-skill-manage";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Compare every implementation package with the installed `all` bundle.
|
|
33
|
+
* Missing packages count as a mismatch because the old loader would fall back
|
|
34
|
+
* to an unrelated copy or fail at load.
|
|
35
|
+
* @param profileDir - profile directory containing `package.json` and `node_modules`.
|
|
36
|
+
* @returns The coherence result, or undefined when the profile has no readable `all` bundle.
|
|
37
|
+
*/
|
|
38
|
+
function checkFamilyCoherence(profileDir) {
|
|
39
|
+
if (!existsSync(join(profileDir, "package.json"))) return void 0;
|
|
40
|
+
const resolveManifest = (name) => {
|
|
41
|
+
const path = join(profileDir, "node_modules", name, "package.json");
|
|
42
|
+
return existsSync(path) ? path : void 0;
|
|
43
|
+
};
|
|
44
|
+
const allPath = resolveManifest("@lmzhen/dsh-evolution-all") ?? resolveManifest("@lmzhen/dsh-evolution-all");
|
|
45
|
+
if (allPath === void 0) return void 0;
|
|
46
|
+
let all;
|
|
47
|
+
try {
|
|
48
|
+
all = JSON.parse(readFileSync(allPath, "utf8"));
|
|
49
|
+
} catch {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (typeof all.version !== "string") return void 0;
|
|
53
|
+
const components = [];
|
|
54
|
+
const visited = /* @__PURE__ */ new Set();
|
|
55
|
+
const queue = Object.keys(all.dependencies ?? {}).filter(isFamilyPackage);
|
|
56
|
+
while (queue.length > 0) {
|
|
57
|
+
const name = queue.shift();
|
|
58
|
+
if (name === void 0 || visited.has(name)) continue;
|
|
59
|
+
visited.add(name);
|
|
60
|
+
const manifestPath = resolveManifest(name);
|
|
61
|
+
if (manifestPath === void 0) {
|
|
62
|
+
components.push({ name });
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
67
|
+
components.push({
|
|
68
|
+
name,
|
|
69
|
+
...typeof manifest.version === "string" ? { version: manifest.version } : {}
|
|
70
|
+
});
|
|
71
|
+
for (const child of [...Object.keys(manifest.dependencies ?? {}), ...Object.keys(manifest.optionalDependencies ?? {})]) if (isFamilyPackage(child) && !visited.has(child)) queue.push(child);
|
|
72
|
+
} catch {
|
|
73
|
+
components.push({ name });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
allVersion: all.version,
|
|
78
|
+
components,
|
|
79
|
+
mismatched: components.filter((component) => component.version !== all.version)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Warn once when the running profile is a mixed family install.
|
|
84
|
+
* @param ctx - the running host context; a bare library mount has no profile and is skipped.
|
|
85
|
+
* @returns The detected mismatch, or undefined when no profile/all bundle is present.
|
|
86
|
+
*/
|
|
87
|
+
function warnIfFamilyMixed(ctx) {
|
|
88
|
+
const profile = profileContextPort(ctx);
|
|
89
|
+
if (profile === void 0) return void 0;
|
|
90
|
+
const coherence = checkFamilyCoherence(profile.dir);
|
|
91
|
+
if (coherence === void 0 || coherence.mismatched.length === 0) return void 0;
|
|
92
|
+
const details = coherence.mismatched.map((component) => `${component.name}@${component.version ?? "missing"}`).join(", ");
|
|
93
|
+
console.warn(`[dsh-evolution] mixed family install: all@${coherence.allVersion} but ${details}; the loaded client may be an older release. Run the profile repair in INSTALL.md before restarting.`);
|
|
94
|
+
return coherence;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
7
97
|
//#region lib/types/runtime/llm.js
|
|
8
98
|
/**
|
|
9
99
|
* The family's LLM runtime: one route/purpose/transport path for auxiliary
|
|
@@ -231,6 +321,7 @@ async function apply(ctx) {
|
|
|
231
321
|
await ctx.plugin(EvolutionPlatform);
|
|
232
322
|
await ctx.plugin(EvolutionProjections);
|
|
233
323
|
await ctx.plugin(EvolutionLlm);
|
|
324
|
+
warnIfFamilyMixed(ctx);
|
|
234
325
|
}
|
|
235
326
|
//#endregion
|
|
236
327
|
export { apply, name };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
/** One family package as found in the profile. */
|
|
3
|
+
export interface FamilyComponent {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly version?: string;
|
|
6
|
+
}
|
|
7
|
+
/** The family coherence result for one profile. */
|
|
8
|
+
export interface FamilyCoherence {
|
|
9
|
+
readonly allVersion: string;
|
|
10
|
+
readonly components: readonly FamilyComponent[];
|
|
11
|
+
readonly mismatched: readonly FamilyComponent[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Compare every implementation package with the installed `all` bundle.
|
|
15
|
+
* Missing packages count as a mismatch because the old loader would fall back
|
|
16
|
+
* to an unrelated copy or fail at load.
|
|
17
|
+
* @param profileDir - profile directory containing `package.json` and `node_modules`.
|
|
18
|
+
* @returns The coherence result, or undefined when the profile has no readable `all` bundle.
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkFamilyCoherence(profileDir: string): FamilyCoherence | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Warn once when the running profile is a mixed family install.
|
|
23
|
+
* @param ctx - the running host context; a bare library mount has no profile and is skipped.
|
|
24
|
+
* @returns The detected mismatch, or undefined when no profile/all bundle is present.
|
|
25
|
+
*/
|
|
26
|
+
export declare function warnIfFamilyMixed(ctx: Context): FamilyCoherence | undefined;
|
|
27
|
+
//# sourceMappingURL=coherence.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Family version coherence probe.
|
|
3
|
+
*
|
|
4
|
+
* A profile can contain one bundle whose implementation packages come from
|
|
5
|
+
* different family releases: the bundle row updates while a directly pinned
|
|
6
|
+
* sibling stays behind, or old hand-copied packages shadow the pnpm tree. The
|
|
7
|
+
* loader then runs an old client against a new host, which looks like a UI
|
|
8
|
+
* regression rather than a mixed install. This probe names that state at
|
|
9
|
+
* startup; it never repairs a live profile (a package-manager write while the
|
|
10
|
+
* host runs is unsafe and needs a restart).
|
|
11
|
+
*
|
|
12
|
+
* @module @lmzhen/dsh-evolution-core/runtime/coherence
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
15
|
+
import { join } from 'node:path';
|
|
16
|
+
import { profileContextPort } from "../platform/profileContext.js";
|
|
17
|
+
function packageTail(name) {
|
|
18
|
+
return name.slice(name.lastIndexOf('/') + 1);
|
|
19
|
+
}
|
|
20
|
+
/** Family implementation tails; external @deepseek-ai packages stay out. */
|
|
21
|
+
function isFamilyPackage(name) {
|
|
22
|
+
const tail = packageTail(name);
|
|
23
|
+
return tail.startsWith('dsh-evolution-')
|
|
24
|
+
|| tail === 'dsh-memory'
|
|
25
|
+
|| tail === 'dsh-memory-files'
|
|
26
|
+
|| tail === 'dsh-skill-usage'
|
|
27
|
+
|| tail === 'dsh-tool-memory'
|
|
28
|
+
|| tail === 'dsh-tool-skill-manage';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Compare every implementation package with the installed `all` bundle.
|
|
32
|
+
* Missing packages count as a mismatch because the old loader would fall back
|
|
33
|
+
* to an unrelated copy or fail at load.
|
|
34
|
+
* @param profileDir - profile directory containing `package.json` and `node_modules`.
|
|
35
|
+
* @returns The coherence result, or undefined when the profile has no readable `all` bundle.
|
|
36
|
+
*/
|
|
37
|
+
export function checkFamilyCoherence(profileDir) {
|
|
38
|
+
const profileManifest = join(profileDir, 'package.json');
|
|
39
|
+
if (!existsSync(profileManifest))
|
|
40
|
+
return undefined;
|
|
41
|
+
// Resolve ONLY inside this profile. A createRequire fallback can walk the
|
|
42
|
+
// test/launcher NODE_PATH and report the build tree's packages as installed,
|
|
43
|
+
// which would hide exactly the mixed profile this probe exists to catch.
|
|
44
|
+
const resolveManifest = (name) => {
|
|
45
|
+
const path = join(profileDir, 'node_modules', name, 'package.json');
|
|
46
|
+
return existsSync(path) ? path : undefined;
|
|
47
|
+
};
|
|
48
|
+
const allPath = resolveManifest('@lmzhen/dsh-evolution-all') ?? resolveManifest('@lmzhen/dsh-evolution-all');
|
|
49
|
+
if (allPath === undefined)
|
|
50
|
+
return undefined;
|
|
51
|
+
let all;
|
|
52
|
+
try {
|
|
53
|
+
all = JSON.parse(readFileSync(allPath, 'utf8'));
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
if (typeof all.version !== 'string')
|
|
59
|
+
return undefined;
|
|
60
|
+
const components = [];
|
|
61
|
+
const visited = new Set();
|
|
62
|
+
const queue = Object.keys(all.dependencies ?? {}).filter(isFamilyPackage);
|
|
63
|
+
while (queue.length > 0) {
|
|
64
|
+
const name = queue.shift();
|
|
65
|
+
if (name === undefined || visited.has(name))
|
|
66
|
+
continue;
|
|
67
|
+
visited.add(name);
|
|
68
|
+
const manifestPath = resolveManifest(name);
|
|
69
|
+
if (manifestPath === undefined) {
|
|
70
|
+
components.push({ name });
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
75
|
+
components.push({ name, ...(typeof manifest.version === 'string' ? { version: manifest.version } : {}) });
|
|
76
|
+
// The family is a dependency graph, not only the bundle's direct list:
|
|
77
|
+
// client-kit arrives through evolution-ui, merge-engine through merge.
|
|
78
|
+
for (const child of [
|
|
79
|
+
...Object.keys(manifest.dependencies ?? {}),
|
|
80
|
+
...Object.keys(manifest.optionalDependencies ?? {}),
|
|
81
|
+
]) {
|
|
82
|
+
if (isFamilyPackage(child) && !visited.has(child))
|
|
83
|
+
queue.push(child);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
components.push({ name });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
allVersion: all.version,
|
|
92
|
+
components,
|
|
93
|
+
mismatched: components.filter(component => component.version !== all.version),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Warn once when the running profile is a mixed family install.
|
|
98
|
+
* @param ctx - the running host context; a bare library mount has no profile and is skipped.
|
|
99
|
+
* @returns The detected mismatch, or undefined when no profile/all bundle is present.
|
|
100
|
+
*/
|
|
101
|
+
export function warnIfFamilyMixed(ctx) {
|
|
102
|
+
const profile = profileContextPort(ctx);
|
|
103
|
+
if (profile === undefined)
|
|
104
|
+
return undefined;
|
|
105
|
+
const coherence = checkFamilyCoherence(profile.dir);
|
|
106
|
+
if (coherence === undefined || coherence.mismatched.length === 0)
|
|
107
|
+
return undefined;
|
|
108
|
+
const details = coherence.mismatched
|
|
109
|
+
.map(component => `${component.name}@${component.version ?? 'missing'}`)
|
|
110
|
+
.join(', ');
|
|
111
|
+
console.warn(`[dsh-evolution] mixed family install: all@${coherence.allVersion} but ${details}; `
|
|
112
|
+
+ 'the loaded client may be an older release. Run the profile repair in INSTALL.md before restarting.');
|
|
113
|
+
return coherence;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=coherence.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { warnIfFamilyMixed } from "./coherence.js";
|
|
1
2
|
import { EvolutionLlm } from "./llm.js";
|
|
2
3
|
import { EvolutionPlatform } from "./platform.js";
|
|
3
4
|
import { EvolutionProjections } from "./projections.js";
|
|
@@ -9,5 +10,6 @@ export async function apply(ctx) {
|
|
|
9
10
|
await ctx.plugin(EvolutionPlatform);
|
|
10
11
|
await ctx.plugin(EvolutionProjections);
|
|
11
12
|
await ctx.plugin(EvolutionLlm);
|
|
13
|
+
warnIfFamilyMixed(ctx);
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=plugin.js.map
|
package/package.json
CHANGED