@lmzhen/dsh-evolution-commands 0.56.0 → 0.58.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/index.js +7 -29
- package/lib/types/doctor-view.d.ts +1 -0
- package/lib/types/doctor.d.ts +1 -5
- package/lib/types/host-commands/approval-commands.d.ts +1 -1
- package/lib/types/host-commands/curator-command.d.ts +1 -1
- package/lib/types/host-commands/doctor-command.d.ts +1 -1
- package/lib/types/host-commands/handlers.d.ts +1 -1
- package/lib/types/host-commands/params-command.d.ts +1 -1
- package/lib/types/host-commands/restore-commands.d.ts +1 -1
- package/lib/types/host-commands/skill-history-commands.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +12 -10
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { commandsPort, configEditorPort,
|
|
2
|
+
import { commandsPort, configEditorPort, pluginInventoryPort, pluginManagerPort, profileContextPort, settingsPort, toolsPort } from "@lmzhen/dsh-evolution-adapter/ports";
|
|
3
3
|
import { DEFAULT_SKILL_LIMITS, DIAGNOSTICS_FACT_KEYS, DIAGNOSTICS_RUNTIME_KEYS, DIAGNOSTICS_VIEW_SCHEMA_VERSION, EVOLUTION_PRESET_IDS, GOVERNANCE_PROMPT_TEMPLATE, HOST_LOCALES, MAINTAINER_PRESET_ID, MAX_TIMER_DELAY_MS, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PLATFORM_LINE, REVIEWER_PRESET_ID, absentHostServices, appendEvolutionEvent, applyNamespaceMigration, asRecord, atomicWriteFiles, authorityFrom, buildLearnPrompt, clampedNumber, classifyNamespaceMigration, createSubagentChannel, errorText, errorTextIn, eventsFile, evolutionHome, evolutionRoot, hostSurface, isDeprecatedParamId, isPresent, isRecord, isUnknown, liveBool, markReviewChannel, mutationLockFrom, newRunRegistry, paramSettingsId, planNamespaceMigration, policyStageLimits, probeMtime, probeText, reportsSweepLockTarget, resolveParamId, reviewPrompt, scopedPackageName, scopedProbeReport, sweepReports, transactIo, withReviewContext } from "@lmzhen/dsh-evolution-core";
|
|
4
4
|
import { HOST_ROUTES, json, methodNotAllowed, registerHostRoutes } from "@lmzhen/dsh-evolution-core/http-routes";
|
|
5
5
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
@@ -7,6 +7,7 @@ import { dirname, join } from "node:path";
|
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import z from "@deepseek-ai/schemastery";
|
|
9
9
|
import { effectiveSessionPolicy } from "@lmzhen/dsh-evolution-approval";
|
|
10
|
+
import { createUserMessage } from "@lmzhen/dsh-evolution-adapter/values";
|
|
10
11
|
import { buildEnrichment, buildMaintainFacts, enrichmentSnapshotOptions, runMaintain, snapshotFromLibrary } from "@lmzhen/dsh-evolution-maintenance";
|
|
11
12
|
import { composePresetEntry, presetRowBlock, presetRowBody, presetRowId, resolveBasePresetPatch } from "@lmzhen/dsh-evolution-core/composition";
|
|
12
13
|
import { processScopeViolations } from "@lmzhen/dsh-evolution-state";
|
|
@@ -97,7 +98,7 @@ const FORM_WORDS = Object.freeze({
|
|
|
97
98
|
*/
|
|
98
99
|
function factsOf(inputs) {
|
|
99
100
|
const values = {
|
|
100
|
-
"platform-line": inputs.platformLine.version + "
|
|
101
|
+
"platform-line": inputs.platformLine.version + "(cohort " + (inputs.platformLine.cohort?.join(" / ") ?? inputs.platformLine.floor) + ";最低兼容 " + inputs.platformLine.floor + ")",
|
|
101
102
|
"family-version": inputs.familyVersion,
|
|
102
103
|
"install-form": FORM_WORDS[inputs.form.id] + "(" + (inputs.form.confidence === "declared" ? "安装内容已确认" : "按已安装内容推断") + ")",
|
|
103
104
|
"preset-ids": "审阅、维护各有一个只读模式;另有 " + String(EVOLUTION_PRESET_IDS.length) + " 个基础预设可选",
|
|
@@ -531,7 +532,8 @@ async function assembleDoctorInputs(ctx, extras = {}) {
|
|
|
531
532
|
now: extras.now ?? /* @__PURE__ */ new Date(),
|
|
532
533
|
platformLine: {
|
|
533
534
|
version: PLATFORM_LINE.version,
|
|
534
|
-
floor: PLATFORM_LINE.floor
|
|
535
|
+
floor: PLATFORM_LINE.floor,
|
|
536
|
+
cohort: PLATFORM_LINE.cohort
|
|
535
537
|
},
|
|
536
538
|
familyVersion: familyVersion(),
|
|
537
539
|
hostVersion: extras.hostVersion ?? platformVersion,
|
|
@@ -3078,7 +3080,7 @@ async function diagnose(ctx, options = {}) {
|
|
|
3078
3080
|
if (full && host) conflicts.push("evolution-all and evolution-host are installed together — the infra rows double-mount and startup fails loud. Keep ONE: remove the other bundle.");
|
|
3079
3081
|
if (full && preset) conflicts.push("evolution-all and evolution-preset are installed together — the infra rows double-mount. Keep ONE.");
|
|
3080
3082
|
if (host && preset) conflicts.push("evolution-host and evolution-preset are installed together — the infra rows double-mount. Keep ONE.");
|
|
3081
|
-
if (full && presetDirInstalled) conflicts.push(`evolution-all and the layered Evolution preset (${layeredArtifactLabel}) are both present — the
|
|
3083
|
+
if (full && presetDirInstalled) conflicts.push(`evolution-all and the layered Evolution preset (${layeredArtifactLabel}) are both present — the three model rows AND the systemPrompt sections double-instance across the profile and preset layers; the preset loader does not fail on it, shadowing semantics take the nearest layer, so an Evolution-preset session silently runs the preset's copies of everything. Keep ONE (use layered without all, or drop the preset).`);
|
|
3082
3084
|
if (preset && presetDirInstalled) conflicts.push(`evolution-preset and the layered Evolution preset (${layeredArtifactLabel}) are both present — the preset bundle carries the same model rows as all, so the four model rows AND the systemPrompt sections double-instance and shadowing semantics take the nearest layer (the preset loader does not fail on it). Keep ONE (drop the preset bundle, or remove the layered preset).`);
|
|
3083
3085
|
const reviewRow = platform.plugins === void 0 ? void 0 : familyRow(platform.plugins, "evolution-review");
|
|
3084
3086
|
const reviewMounted = reviewRow?.enabled ?? (full || host || preset);
|
|
@@ -3137,8 +3139,6 @@ async function diagnose(ctx, options = {}) {
|
|
|
3137
3139
|
if (legacy.state === "pending") actions.push(`The legacy settings document still holds ${legacy.pending.length} family value(s) — the boot migration moves them onto their rows when the settings service is available (the document itself is left alone, so nothing is lost)`);
|
|
3138
3140
|
const budgetIssues = memoryBudgetIssues(ctx);
|
|
3139
3141
|
const paramIssues = paramDivergences(platform);
|
|
3140
|
-
const queryIssues = await sessionQueryIssues(ctx);
|
|
3141
|
-
if (queryIssues.length > 0) actions.push("Session search is degraded: isolate the session named above (or wait for the platform fix described in the family maintenance notes) before retrying the same query");
|
|
3142
3142
|
if (paramIssues.length > 0) actions.push("Review the parameter divergences above: /evolution params shows every row with its source, /evolution policy set writes a user value, and a declared-but-unreachable row needs its owning plugin row mounted in this profile.");
|
|
3143
3143
|
if (budgetIssues.length > 0) actions.push("Align the memory budget: leave memory-files memoryChars/userChars UNSET so the store follows evolution-policy, or set both surfaces to the same value (the review plans against the policy value while the store enforces its own)");
|
|
3144
3144
|
if (scopedProbe.rows !== null && scopedProbe.rows.length > 0 && scopedProbe.verdict === "never-hit") actions.push("The session-scoped rows are mounted but the family-tool probe has never matched in this process — review injection and skill-usage telemetry skipped every session observed. HOST-ONLY install: the model rows (tool-memory / tool-skill-manage) sit in evolution-host devDependencies, so no session carries them; install a bundle that mounts them (see INSTALL.md). VARIANT install: only a session on the Evolution preset matches, so open one — a session on a platform original preset is the intended skip, not a fault. Either way, check that no profile overlay disables those two rows.");
|
|
@@ -3165,7 +3165,6 @@ async function diagnose(ctx, options = {}) {
|
|
|
3165
3165
|
conflicts,
|
|
3166
3166
|
budgetIssues,
|
|
3167
3167
|
paramIssues,
|
|
3168
|
-
queryIssues,
|
|
3169
3168
|
services,
|
|
3170
3169
|
capabilityAbsence,
|
|
3171
3170
|
pendingCount,
|
|
@@ -3269,26 +3268,6 @@ async function probeBounded(work, label) {
|
|
|
3269
3268
|
if (timer !== void 0) clearTimeout(timer);
|
|
3270
3269
|
return outcome;
|
|
3271
3270
|
}
|
|
3272
|
-
/**
|
|
3273
|
-
* S4/P-1+P-2 (platform report P-1/P-2, family mitigation) — the session-query
|
|
3274
|
-
* index can fail AS A WHOLE: a concurrent writer leaves the persistence
|
|
3275
|
-
* observation unstable ('did not stabilize after one retry') and ONE
|
|
3276
|
-
* header-conflicting session aborts the same try block, which the tool surface
|
|
3277
|
-
* folds into 'storage is unavailable'. Doctor cannot read the index's row count
|
|
3278
|
-
* or the last stabilization result (the platform exposes no such API — recorded
|
|
3279
|
-
* in the platform report), but it CAN exercise the corpus listing and report the
|
|
3280
|
-
* verbatim failure with the actionable half: isolate the offending session.
|
|
3281
|
-
*
|
|
3282
|
-
* @param ctx - the runtime service view (`get(name)`).
|
|
3283
|
-
* @returns one or two messages; empty when the service is absent or healthy.
|
|
3284
|
-
*/
|
|
3285
|
-
async function sessionQueryIssues(ctx) {
|
|
3286
|
-
const list = sessionQueryPort(ctx)?.listSessions;
|
|
3287
|
-
if (list === void 0) return [];
|
|
3288
|
-
const outcome = await probeBounded(() => list(), "session-query listing");
|
|
3289
|
-
if (!outcome.ok) return [outcome.message, "isolate the offending session — move it OUT of the corpus with a manifest (never delete it) and re-run; the platform already retries the observation once, so retrying first is not the answer"];
|
|
3290
|
-
return Array.isArray(outcome.value) ? [] : ["session-query answered a listing with a non-list value — the service is mounted but not honouring its read contract"];
|
|
3291
|
-
}
|
|
3292
3271
|
function memoryBudgetIssues(ctx) {
|
|
3293
3272
|
const budget = ctx.get("evolutionMemoryBudget");
|
|
3294
3273
|
const policy = ctx.get("evolutionPolicy")?.get?.();
|
|
@@ -3337,7 +3316,7 @@ function legacyLine(row) {
|
|
|
3337
3316
|
* report now contributes only the facts the view does not represent yet: cross-profile bundles,
|
|
3338
3317
|
* the family service inference, capability absence, the scoped-row probe, the legacy settings
|
|
3339
3318
|
* document, pending/executing audit records, preset freshness, and the conflict/env/budget/
|
|
3340
|
-
* parameter
|
|
3319
|
+
* parameter and budget findings + next steps. This is the W8-S7 rewrite branch: the text face
|
|
3341
3320
|
* has real consumers (the `/evolution doctor` command, README/INSTALL, doctor.spec), so the legacy
|
|
3342
3321
|
* rendering was rewritten instead of deleted — but every fact the view owns renders from the view
|
|
3343
3322
|
* exactly once (the legacy install-form line is gone).
|
|
@@ -3372,7 +3351,6 @@ function renderDoctorText(report, locale = "zh") {
|
|
|
3372
3351
|
if (report.conflicts.length > 0) extras.push("conflicts:", ...report.conflicts.map((line) => ` ! ${line}`));
|
|
3373
3352
|
if (report.budgetIssues.length > 0) extras.push("memory budget:", ...report.budgetIssues.map((line) => ` ! ${line}`));
|
|
3374
3353
|
if (report.paramIssues.length > 0) extras.push("parameters:", ...report.paramIssues.map((line) => ` ! ${line}`));
|
|
3375
|
-
if (report.queryIssues.length > 0) extras.push("session search:", ...report.queryIssues.map((line) => ` ! ${line}`));
|
|
3376
3354
|
if (report.actions.length > 0) extras.push("next steps:", ...report.actions.map((line) => ` → ${line}`));
|
|
3377
3355
|
return renderDiagnosticsText(report.view, locale).trimEnd() + "\n\n" + hostCommandText(locale, "doctor.supplement") + "\n" + extras.join("\n");
|
|
3378
3356
|
}
|
package/lib/types/doctor.d.ts
CHANGED
|
@@ -88,10 +88,6 @@ export interface DoctorReport {
|
|
|
88
88
|
* list is what makes that difference visible instead of mysterious. */
|
|
89
89
|
foreignProfiles: string[];
|
|
90
90
|
conflicts: string[];
|
|
91
|
-
/** S4/P-1+P-2 (platform gap, family mitigation): the session-query corpus
|
|
92
|
-
* listing failed — reported verbatim, with the isolation recipe. Empty when the
|
|
93
|
-
* service is absent or answering. */
|
|
94
|
-
queryIssues: string[];
|
|
95
91
|
/** S2-12③ (FLOW5-4): the memory budget's two configuration surfaces disagree —
|
|
96
92
|
* `memory-files`' store limit vs `evolution-policy`'s planning value. Empty
|
|
97
93
|
* when either surface is absent (nothing to compare) or they agree. */
|
|
@@ -173,7 +169,7 @@ export declare function diagnose(ctx: {
|
|
|
173
169
|
* report now contributes only the facts the view does not represent yet: cross-profile bundles,
|
|
174
170
|
* the family service inference, capability absence, the scoped-row probe, the legacy settings
|
|
175
171
|
* document, pending/executing audit records, preset freshness, and the conflict/env/budget/
|
|
176
|
-
* parameter
|
|
172
|
+
* parameter and budget findings + next steps. This is the W8-S7 rewrite branch: the text face
|
|
177
173
|
* has real consumers (the `/evolution doctor` command, README/INSTALL, doctor.spec), so the legacy
|
|
178
174
|
* rendering was rewritten instead of deleted — but every fact the view owns renders from the view
|
|
179
175
|
* exactly once (the legacy install-form line is gone).
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module evolution-commands/src/host-commands/approval-commands
|
|
5
5
|
*/
|
|
6
6
|
import type { ApprovalLike } from '@lmzhen/dsh-evolution-approval';
|
|
7
|
-
import type { CommandResult } from '@lmzhen/dsh-evolution-
|
|
7
|
+
import type { CommandResult } from '@lmzhen/dsh-evolution-platform-contract';
|
|
8
8
|
import type { HostLocale } from '@lmzhen/dsh-evolution-core';
|
|
9
9
|
import type { ParsedCommand } from '../parse.ts';
|
|
10
10
|
/** What the approval handlers need from the command body. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module evolution-commands/src/host-commands/curator-command
|
|
5
5
|
*/
|
|
6
6
|
import type { HostLocale } from '@lmzhen/dsh-evolution-core';
|
|
7
|
-
import type { CommandResult } from '@lmzhen/dsh-evolution-
|
|
7
|
+
import type { CommandResult } from '@lmzhen/dsh-evolution-platform-contract';
|
|
8
8
|
/** What the curator handler needs from the command body. */
|
|
9
9
|
export interface CuratorCommandContext {
|
|
10
10
|
readonly input: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The read-only doctor surface: the CLI view and its --json form. */
|
|
2
2
|
import type { HostLocale } from '@lmzhen/dsh-evolution-core';
|
|
3
|
-
import type { CommandResult } from '@lmzhen/dsh-evolution-
|
|
3
|
+
import type { CommandResult } from '@lmzhen/dsh-evolution-platform-contract';
|
|
4
4
|
import { diagnose } from '../doctor.ts';
|
|
5
5
|
/** What the doctor handler needs. */
|
|
6
6
|
export interface DoctorCommandContext {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Extracted command handlers; the legacy chain answers whatever is not here. */
|
|
2
|
-
import type { CommandResult } from '@lmzhen/dsh-evolution-
|
|
2
|
+
import type { CommandResult } from '@lmzhen/dsh-evolution-platform-contract';
|
|
3
3
|
import type { SettingsProviderLike } from '@lmzhen/dsh-evolution-core';
|
|
4
4
|
import { type ApprovalCommandContext } from './approval-commands.ts';
|
|
5
5
|
/** What every extracted handler receives. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The read-only `params` surface: provider rows filtered by group, text or JSON. */
|
|
2
2
|
import type { HostLocale, SettingsProviderLike } from '@lmzhen/dsh-evolution-core';
|
|
3
|
-
import type { CommandResult } from '@lmzhen/dsh-evolution-
|
|
3
|
+
import type { CommandResult } from '@lmzhen/dsh-evolution-platform-contract';
|
|
4
4
|
import type { ParsedCommand } from '../parse.ts';
|
|
5
5
|
/** What the params handler needs. */
|
|
6
6
|
export interface ParamsCommandContext {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The two whole/single-tree restore commands, both behind the same replayability refusal. */
|
|
2
2
|
import type { HostLocale } from '@lmzhen/dsh-evolution-core';
|
|
3
|
-
import type { CommandResult } from '@lmzhen/dsh-evolution-
|
|
3
|
+
import type { CommandResult } from '@lmzhen/dsh-evolution-platform-contract';
|
|
4
4
|
/** What the restore handlers need. */
|
|
5
5
|
export interface RestoreCommandContext {
|
|
6
6
|
readonly input: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The read-only skill history and its undo (the undo write stays behind the refusal seam). */
|
|
2
2
|
import type { HostLocale } from '@lmzhen/dsh-evolution-core';
|
|
3
|
-
import type { CommandResult } from '@lmzhen/dsh-evolution-
|
|
3
|
+
import type { CommandResult } from '@lmzhen/dsh-evolution-platform-contract';
|
|
4
4
|
/** What the two handlers need. */
|
|
5
5
|
export interface SkillHistoryCommandContext {
|
|
6
6
|
readonly input: string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { Context, Volatile } from '@deepseek-ai/cordis';
|
|
6
6
|
import z from '@deepseek-ai/schemastery';
|
|
7
|
-
import type { ContextFormed } from '@lmzhen/dsh-evolution-
|
|
7
|
+
import type { ContextFormed } from '@lmzhen/dsh-evolution-platform-contract';
|
|
8
8
|
declare module '@deepseek-ai/dsh-llm' {
|
|
9
9
|
interface MessageSourceMap {
|
|
10
10
|
'evolution-commands': {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-commands",
|
|
3
3
|
"description": "Human commands for the evolution family (/evolution pending|curator|maintain|doctor) (community build)",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.58.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -29,23 +29,25 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
32
|
-
"@lmzhen/dsh-evolution-approval": "0.
|
|
33
|
-
"@lmzhen/dsh-evolution-core": "0.
|
|
34
|
-
"@lmzhen/dsh-evolution-maintenance": "0.
|
|
35
|
-
"@lmzhen/dsh-evolution-state": "0.
|
|
32
|
+
"@lmzhen/dsh-evolution-approval": "0.58.0",
|
|
33
|
+
"@lmzhen/dsh-evolution-core": "0.58.0",
|
|
34
|
+
"@lmzhen/dsh-evolution-maintenance": "0.58.0",
|
|
35
|
+
"@lmzhen/dsh-evolution-state": "0.58.0",
|
|
36
|
+
"@lmzhen/dsh-evolution-platform-contract": "0.58.0",
|
|
37
|
+
"@lmzhen/dsh-evolution-adapter": "0.58.0"
|
|
36
38
|
},
|
|
37
39
|
"optionalDependencies": {
|
|
38
|
-
"@lmzhen/dsh-evolution-agent-preset": "0.
|
|
40
|
+
"@lmzhen/dsh-evolution-agent-preset": "0.58.0"
|
|
39
41
|
},
|
|
40
42
|
"peerDependencies": {
|
|
41
43
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
42
|
-
"@deepseek-ai/dsh-commands": "
|
|
43
|
-
"@deepseek-ai/dsh-llm": "
|
|
44
|
+
"@deepseek-ai/dsh-commands": "0.2.2-rc.5",
|
|
45
|
+
"@deepseek-ai/dsh-llm": "0.2.2-rc.5"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
|
-
"@deepseek-ai/dsh-commands": "
|
|
48
|
+
"@deepseek-ai/dsh-commands": "0.2.2-rc.5"
|
|
47
49
|
},
|
|
48
50
|
"engines": {
|
|
49
|
-
"dsh": "
|
|
51
|
+
"dsh": "0.2.2-rc.5"
|
|
50
52
|
}
|
|
51
53
|
}
|