@lmzhen/dsh-evolution-commands 0.46.0 → 0.47.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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { DEFAULT_SKILL_LIMITS, DIAGNOSTICS_FACT_KEYS, DIAGNOSTICS_RUNTIME_KEYS, DIAGNOSTICS_VIEW_SCHEMA_VERSION, EVOLUTION_PRESET_IDS, HOST_LOCALES, MAINTAINER_PRESET_ID, MAX_TIMER_DELAY_MS, PARAM_EXPOSURE, PARAM_GROUP_LABELS,
|
|
2
|
+
import { DEFAULT_SKILL_LIMITS, DIAGNOSTICS_FACT_KEYS, DIAGNOSTICS_RUNTIME_KEYS, DIAGNOSTICS_VIEW_SCHEMA_VERSION, EVOLUTION_PRESET_IDS, 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, buildExtractPlanFromLibrary, buildLearnPrompt, clampedNumber, classifyNamespaceMigration, createSubagentChannel, errorText, errorTextIn, eventsFile, evolutionHome, evolutionRoot, hostSurface, isDeprecatedParamId, isPresent, isRecord, isUnknown, liveBool, mutationLockFrom, newRunRegistry, ownerDecisionText, paramSettingsId, planNamespaceMigration, policyStageLimits, probeMtime, probeText, proposalFromPlan, readProposalReport, reportsSweepLockTarget, resolveParamId, scopedPackageName, scopedProbeReport, sweepReports, transactIo, writeProposalReport } from "@lmzhen/dsh-evolution-core";
|
|
3
3
|
import { HOST_ROUTES, json, methodNotAllowed, registerHostRoutes } from "@lmzhen/dsh-evolution-core/http-routes";
|
|
4
4
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
@@ -33,7 +33,6 @@ const COMMAND_FALLBACKS = {
|
|
|
33
33
|
"skill-history": { command: "/evolution skill undo <name> [--to v<N>](查看:/evolution skill history <name>)" },
|
|
34
34
|
"skill-health": { command: "/evolution skills refresh(健康行:/evolution doctor)" },
|
|
35
35
|
merge: { command: "/evolution merge status / pending / approve <id> / report" },
|
|
36
|
-
settings: { command: "/evolution params --group deployment(写入由平台插件管理的 row 配置页承载)" },
|
|
37
36
|
diagnostics: {
|
|
38
37
|
command: "/evolution doctor",
|
|
39
38
|
platformCli: "dsh --json /evolution doctor"
|
|
@@ -70,14 +69,17 @@ const RUNTIME_LABELS = {
|
|
|
70
69
|
"install-form-detected": "实际安装方式"
|
|
71
70
|
};
|
|
72
71
|
/**
|
|
73
|
-
* The install form in reader-facing words. The
|
|
74
|
-
*
|
|
72
|
+
* The install form in reader-facing words. The ids are the SAME seven values DoctorReport
|
|
73
|
+
* carries, so the text, --json and the settings card cannot disagree about the form.
|
|
75
74
|
*/
|
|
76
75
|
const FORM_WORDS = Object.freeze({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
full: "完整功能包",
|
|
77
|
+
"human-gated": "完整功能包(人工审批)",
|
|
78
|
+
preset: "会话预设包",
|
|
79
|
+
host: "仅宿主插件(无模型工具)",
|
|
80
|
+
layered: "分层安装(会话选用)",
|
|
81
|
+
"preset-only": "仅预设行(未挂载插件包)",
|
|
82
|
+
none: "未安装"
|
|
81
83
|
});
|
|
82
84
|
/**
|
|
83
85
|
* Build the seven documentation facts. Values are READER-FACING prose: the CLI text, --json and
|
|
@@ -262,22 +264,15 @@ function pairingRow(inputs) {
|
|
|
262
264
|
}
|
|
263
265
|
function runtimeOf(inputs) {
|
|
264
266
|
const missing = inputs.missingServices ?? [];
|
|
265
|
-
const fold = inputs.sessionFoldClassifierPresent !== false;
|
|
266
267
|
return [
|
|
267
268
|
channelRow(inputs.channels),
|
|
268
269
|
presetRow(inputs.presets),
|
|
269
270
|
hostRow(inputs.host, inputs.hostRouteCount),
|
|
270
|
-
|
|
271
|
+
{
|
|
271
272
|
key: "session-fold",
|
|
272
273
|
label: RUNTIME_LABELS["session-fold"] ?? "会话事件读取",
|
|
273
274
|
status: "ok",
|
|
274
275
|
detail: "事件读取通道正常:对话内容会被读取,其余记录忽略。"
|
|
275
|
-
} : {
|
|
276
|
-
key: "session-fold",
|
|
277
|
-
label: RUNTIME_LABELS["session-fold"] ?? "会话事件读取",
|
|
278
|
-
status: "fail",
|
|
279
|
-
detail: "事件读取组件缺失,无法确认读取通道正常。",
|
|
280
|
-
remedy: "重新安装完整功能包(evolution-all)。"
|
|
281
276
|
},
|
|
282
277
|
missing.length === 0 ? {
|
|
283
278
|
key: "platform-services",
|
|
@@ -498,19 +493,19 @@ async function assembleDoctorInputs(ctx, extras = {}) {
|
|
|
498
493
|
const hasFamilyPreset = listed.some((entry) => typeof entry.id === "string" && EVOLUTION_PRESET_IDS.includes(entry.id));
|
|
499
494
|
const humanGated = get("evolutionApproval")?.isEnabled === true;
|
|
500
495
|
const detectedForm = hasAll || hasPreset ? {
|
|
501
|
-
id: humanGated ? "
|
|
496
|
+
id: humanGated ? "human-gated" : hasAll ? "full" : "preset",
|
|
502
497
|
evidence: [hasAll ? "bundle dsh-evolution-all installed" : "bundle dsh-evolution-preset installed", ...humanGated ? ["approval.enabled: true"] : []],
|
|
503
498
|
confidence: "declared"
|
|
504
499
|
} : hasHost ? hasFamilyPreset ? {
|
|
505
|
-
id: "
|
|
500
|
+
id: "layered",
|
|
506
501
|
evidence: ["bundle dsh-evolution-host installed", "family agent preset registered"],
|
|
507
502
|
confidence: "declared"
|
|
508
503
|
} : {
|
|
509
|
-
id: "
|
|
504
|
+
id: "host",
|
|
510
505
|
evidence: ["bundle dsh-evolution-host installed"],
|
|
511
506
|
confidence: "declared"
|
|
512
507
|
} : {
|
|
513
|
-
id: "
|
|
508
|
+
id: "none",
|
|
514
509
|
evidence: ["no family bundle was reported by the platform manager"],
|
|
515
510
|
confidence: "inferred"
|
|
516
511
|
};
|
|
@@ -549,7 +544,6 @@ async function assembleDoctorInputs(ctx, extras = {}) {
|
|
|
549
544
|
orphaned: 0
|
|
550
545
|
},
|
|
551
546
|
missingServices,
|
|
552
|
-
sessionFoldClassifierPresent: typeof classifySessionEvent === "function",
|
|
553
547
|
platformPairing: extras.platformPairing ?? pairingOf(extras.hostVersion ?? platformVersion, PLATFORM_LINE)
|
|
554
548
|
};
|
|
555
549
|
}
|
|
@@ -636,150 +630,6 @@ async function withBudget(pending, timeoutMs, fallback) {
|
|
|
636
630
|
}
|
|
637
631
|
}
|
|
638
632
|
//#endregion
|
|
639
|
-
//#region lib/types/settings-route.js
|
|
640
|
-
/**
|
|
641
|
-
* Family settings data plane.
|
|
642
|
-
*
|
|
643
|
-
* The platform RPC only serves its own namespace allowlist, so the browser cannot
|
|
644
|
-
* reach family namespaces through /api/settings.* even though the underlying
|
|
645
|
-
* settings service has them registered. These exact routes reuse the SAME
|
|
646
|
-
* provider (describe/mutate), so storage, schema validation, revision conflicts
|
|
647
|
-
* and redaction stay platform-owned; only the transport is family-scoped.
|
|
648
|
-
* @module @lmzhen/dsh-evolution-commands/settings-route
|
|
649
|
-
*/
|
|
650
|
-
const FAMILY_NAMESPACES = new Set(Object.keys(PARAM_NAMESPACES));
|
|
651
|
-
function normaliseValue(value) {
|
|
652
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return value;
|
|
653
|
-
const out = {};
|
|
654
|
-
for (const [key, field] of Object.entries(value)) {
|
|
655
|
-
const live = unwrapLive(field);
|
|
656
|
-
out[key] = live === void 0 ? field : live;
|
|
657
|
-
}
|
|
658
|
-
return out;
|
|
659
|
-
}
|
|
660
|
-
function snapshotOf(provider, descriptor) {
|
|
661
|
-
if (descriptor === void 0) return {
|
|
662
|
-
status: "unavailable",
|
|
663
|
-
writable: false,
|
|
664
|
-
value: void 0,
|
|
665
|
-
user: void 0,
|
|
666
|
-
base: void 0,
|
|
667
|
-
revision: void 0,
|
|
668
|
-
reason: "not-served"
|
|
669
|
-
};
|
|
670
|
-
return {
|
|
671
|
-
status: "ready",
|
|
672
|
-
writable: provider.writable,
|
|
673
|
-
value: normaliseValue(descriptor.value),
|
|
674
|
-
user: descriptor.user,
|
|
675
|
-
base: descriptor.base,
|
|
676
|
-
revision: descriptor.revision
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
function providerOf(getProvider) {
|
|
680
|
-
return getProvider();
|
|
681
|
-
}
|
|
682
|
-
/**
|
|
683
|
-
* @param getProvider - resolves the live platform settings provider per request.
|
|
684
|
-
* @returns exact routes for family settings describe/mutate.
|
|
685
|
-
*/
|
|
686
|
-
function makeSettingsRoutes(getProvider) {
|
|
687
|
-
return [{
|
|
688
|
-
path: HOST_ROUTES.settings.describe,
|
|
689
|
-
methods: ["GET"],
|
|
690
|
-
requestBody: "buffered",
|
|
691
|
-
fetch: async (request) => {
|
|
692
|
-
if (request.method !== "GET") return methodNotAllowed(["GET"]);
|
|
693
|
-
const provider = providerOf(getProvider);
|
|
694
|
-
if (provider === void 0) return json(503, {
|
|
695
|
-
ok: false,
|
|
696
|
-
error: "settings-service-unavailable"
|
|
697
|
-
});
|
|
698
|
-
try {
|
|
699
|
-
const namespaces = provider.describe({ redactSecrets: true }).filter((item) => FAMILY_NAMESPACES.has(item.ns)).map((item) => ({
|
|
700
|
-
ns: item.ns,
|
|
701
|
-
...snapshotOf(provider, item)
|
|
702
|
-
}));
|
|
703
|
-
return json(200, {
|
|
704
|
-
ok: true,
|
|
705
|
-
data: {
|
|
706
|
-
writable: provider.writable,
|
|
707
|
-
namespaces
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
} catch (error) {
|
|
711
|
-
return json(500, {
|
|
712
|
-
ok: false,
|
|
713
|
-
error: error instanceof Error ? error.message : String(error)
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}, {
|
|
718
|
-
path: HOST_ROUTES.settings.mutate,
|
|
719
|
-
methods: ["POST"],
|
|
720
|
-
requestBody: "buffered",
|
|
721
|
-
fetch: async (request) => {
|
|
722
|
-
if (request.method !== "POST") return methodNotAllowed(["POST"]);
|
|
723
|
-
const provider = providerOf(getProvider);
|
|
724
|
-
if (provider === void 0) return json(503, {
|
|
725
|
-
ok: false,
|
|
726
|
-
error: "settings-service-unavailable"
|
|
727
|
-
});
|
|
728
|
-
let body;
|
|
729
|
-
try {
|
|
730
|
-
body = await request.json();
|
|
731
|
-
} catch {
|
|
732
|
-
return json(400, {
|
|
733
|
-
ok: false,
|
|
734
|
-
error: "invalid-json"
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
if (typeof body !== "object" || body === null) return json(400, {
|
|
738
|
-
ok: false,
|
|
739
|
-
error: "invalid-body"
|
|
740
|
-
});
|
|
741
|
-
const { ns, ops, expectedRevision } = body;
|
|
742
|
-
if (typeof ns !== "string" || !FAMILY_NAMESPACES.has(ns)) return json(400, {
|
|
743
|
-
ok: false,
|
|
744
|
-
error: "namespace-not-allowed"
|
|
745
|
-
});
|
|
746
|
-
if (!Array.isArray(ops) || ops.length === 0) return json(400, {
|
|
747
|
-
ok: false,
|
|
748
|
-
error: "ops-required"
|
|
749
|
-
});
|
|
750
|
-
if (expectedRevision !== void 0 && typeof expectedRevision !== "number") return json(400, {
|
|
751
|
-
ok: false,
|
|
752
|
-
error: "invalid-revision"
|
|
753
|
-
});
|
|
754
|
-
try {
|
|
755
|
-
await provider.mutate(ns, ops, expectedRevision);
|
|
756
|
-
const descriptor = provider.describe({ redactSecrets: true }).find((item) => item.ns === ns);
|
|
757
|
-
return json(200, {
|
|
758
|
-
ok: true,
|
|
759
|
-
data: {
|
|
760
|
-
writable: provider.writable,
|
|
761
|
-
namespaces: [{
|
|
762
|
-
ns,
|
|
763
|
-
...snapshotOf(provider, descriptor)
|
|
764
|
-
}]
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
} catch (error) {
|
|
768
|
-
if (error?.code === "SETTINGS_CONFLICT") return json(409, {
|
|
769
|
-
ok: false,
|
|
770
|
-
error: "settings-conflict",
|
|
771
|
-
actual: error.actual,
|
|
772
|
-
expected: error.expected
|
|
773
|
-
});
|
|
774
|
-
return json(400, {
|
|
775
|
-
ok: false,
|
|
776
|
-
error: error instanceof Error ? error.message : String(error)
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
}];
|
|
781
|
-
}
|
|
782
|
-
//#endregion
|
|
783
633
|
//#region lib/types/generated/host-commands.js
|
|
784
634
|
/**
|
|
785
635
|
* GENERATED by packages/scripts/gen-host-commands.mjs — do not edit.
|
|
@@ -2414,7 +2264,6 @@ async function diagnose(ctx, options = {}) {
|
|
|
2414
2264
|
}
|
|
2415
2265
|
const humanGated = ctx.get("evolutionApproval")?.isEnabled === true;
|
|
2416
2266
|
const installForm = full || preset ? humanGated ? "human-gated" : full ? "full" : "preset" : layered ? "layered" : host ? "host" : presetDirInstalled ? "preset-only" : "none";
|
|
2417
|
-
const deploymentForm = installForm === "layered" ? "variant" : installForm === "full" || installForm === "preset" || installForm === "human-gated" ? "attach" : installForm === "host" ? "host-only" : installForm === "preset-only" ? "preset-only" : "none";
|
|
2418
2267
|
const mountConflicts = conflicts.filter((row) => !row.includes("DEGRADED"));
|
|
2419
2268
|
const undecidable = mountConflicts.length !== conflicts.length;
|
|
2420
2269
|
const scopedProbe = {
|
|
@@ -2446,14 +2295,21 @@ async function diagnose(ctx, options = {}) {
|
|
|
2446
2295
|
if ((executingCount ?? 0) > 0) actions.push(`${executingCount} staged write(s) are EXECUTING (an approve crashed mid-run — or one is still in flight). Inspect with /evolution pending: if you started the approve, verify the landed write and do not reject it; only reject after verifying no write is intended. For a verified orphan (this build: S2-P2-22), /evolution release <id> returns it to the pending window instead.`);
|
|
2447
2296
|
for (const row of presetFreshness) {
|
|
2448
2297
|
if (row.status !== "differs") continue;
|
|
2449
|
-
actions.push(`Preset row for base "${row.base}" in ${row.destination} DIFFERS from a fresh generation — it is an install-time snapshot; re-run the installer
|
|
2298
|
+
actions.push(`Preset row for base "${row.base}" in ${row.destination} DIFFERS from a fresh generation — it is an install-time snapshot; re-run the package installer to regenerate`);
|
|
2450
2299
|
}
|
|
2451
|
-
const
|
|
2300
|
+
const form = {
|
|
2301
|
+
id: installForm,
|
|
2302
|
+
evidence: runtimeFlags === void 0 ? ["install form read from the cross-profile manifest aggregate"] : ["platform pluginManager enabled rows"],
|
|
2303
|
+
confidence: runtimeFlags === void 0 ? "inferred" : "declared"
|
|
2304
|
+
};
|
|
2305
|
+
const view = buildDoctorView(await assembleDoctorInputs(ctx, options.runs === void 0 ? { form } : {
|
|
2306
|
+
runs: options.runs,
|
|
2307
|
+
form
|
|
2308
|
+
}));
|
|
2452
2309
|
const merge = await mergeDoctorLine(ctx);
|
|
2453
2310
|
if (merge.status !== "ok" && merge.remedy !== void 0) actions.push("合并行:" + merge.remedy);
|
|
2454
2311
|
return {
|
|
2455
2312
|
installForm,
|
|
2456
|
-
deploymentForm,
|
|
2457
2313
|
bundles,
|
|
2458
2314
|
foreignProfiles: homeProfiles(home).filter(({ profile, dir }) => mounted === void 0 || profile !== mounted.profile && dir !== mounted.dir).map(({ profile }) => profile),
|
|
2459
2315
|
conflicts,
|
|
@@ -2661,7 +2517,7 @@ function renderDoctorText(report, locale = "zh") {
|
|
|
2661
2517
|
}));
|
|
2662
2518
|
}
|
|
2663
2519
|
if (report.presetIssues.length > 0) extras.push("agent presets:", ...report.presetIssues.map((line) => ` ! ${line}`));
|
|
2664
|
-
if (report.foreignProfiles.length > 0) extras.push("profiles-foreign: " + report.foreignProfiles.join(", ") + " — not part of this plane:
|
|
2520
|
+
if (report.foreignProfiles.length > 0) extras.push("profiles-foreign: " + report.foreignProfiles.join(", ") + " — not part of this plane: the package installer ignores them, while the bundles (all profiles) line above counts them");
|
|
2665
2521
|
if (report.conflicts.length > 0) extras.push("conflicts:", ...report.conflicts.map((line) => ` ! ${line}`));
|
|
2666
2522
|
if (report.budgetIssues.length > 0) extras.push("memory budget:", ...report.budgetIssues.map((line) => ` ! ${line}`));
|
|
2667
2523
|
if (report.paramIssues.length > 0) extras.push("parameters:", ...report.paramIssues.map((line) => ` ! ${line}`));
|
|
@@ -3015,7 +2871,7 @@ const COMMAND_ENTRIES = [
|
|
|
3015
2871
|
},
|
|
3016
2872
|
{
|
|
3017
2873
|
readonly: false,
|
|
3018
|
-
usage: "extract <source> <target> \"<heading>\" [--start <line>] [--end <line>] [--outcome extract|mixed] [--apply]",
|
|
2874
|
+
usage: "extract <source> <target> \"<heading>\" [--start <line>] [--end <line>] [--outcome extract|mixed] [--proposal <id>] [--owner-covers] [--apply]",
|
|
3019
2875
|
summary: "预览把源技能的可复用部分提取到已有类级 owner;默认 plan,--apply 才写(多根一次事务)"
|
|
3020
2876
|
},
|
|
3021
2877
|
{
|
|
@@ -3036,37 +2892,38 @@ function renderHelpText(locale = "zh") {
|
|
|
3036
2892
|
...COMMAND_ENTRIES.map((entry) => ` ${entry.usage.padEnd(44)} ${HOST_COMMANDS["summary." + entryName(entry)]?.[locale] ?? entry.summary}`)
|
|
3037
2893
|
].join("\n");
|
|
3038
2894
|
}
|
|
3039
|
-
//#endregion
|
|
3040
|
-
//#region lib/types/parse.js
|
|
3041
|
-
/**
|
|
3042
|
-
* F-4/G7.4 (C7): the ONE parser for the /evolution command surface.
|
|
3043
|
-
*
|
|
3044
|
-
* The surface used to answer each subcommand with its own regex (`^params(?: --group ([a-z-]+))?(?: --json)?$`
|
|
3045
|
-
* and nine siblings), so `params --json --group review` and `params --group=review` were refused as
|
|
3046
|
-
* "not a subcommand", while a sibling regex accepted `=` — and a mistyped group name degraded into the
|
|
3047
|
-
* generic error instead of the one that lists the known groups.
|
|
3048
|
-
*
|
|
3049
|
-
* This parser is order- and `=`-tolerant, matches the subcommand name case-insensitively, keeps a flag
|
|
3050
|
-
* VALUE's case intact (the domain layer is the one that validates it), and answers a SYNTAX failure when a
|
|
3051
|
-
* declared value flag is left without its value (F-3: `extract --start 3` must not read
|
|
3052
|
-
* `--expect 3` as the value).
|
|
3053
|
-
*
|
|
3054
|
-
* @module @lmzhen/dsh-evolution-commands/parse
|
|
3055
|
-
*/
|
|
3056
|
-
/** The flags whose declared form takes a value (`--group <name>`, `--expect <revision>`, …). */
|
|
3057
2895
|
/**
|
|
3058
|
-
*
|
|
3059
|
-
*
|
|
2896
|
+
* The flags whose declared form takes a value, DERIVED from the usage text: a flag followed by
|
|
2897
|
+
* `=` or by a placeholder token (not another flag/bracket) is a value flag. Boolean flags stay
|
|
2898
|
+
* out. The parser imports this, so `--proposal p1` cannot be read as a bare boolean again.
|
|
3060
2899
|
*/
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
2900
|
+
function entryValueFlags(entry) {
|
|
2901
|
+
const found = [];
|
|
2902
|
+
const tokens = entry.usage.split(/\s+/);
|
|
2903
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
2904
|
+
const token = (tokens[index] ?? "").replace(/^\[+/, "").replace(/\]+$/, "");
|
|
2905
|
+
if (!token.startsWith("--")) continue;
|
|
2906
|
+
const name = token.slice(2).split("=")[0] ?? "";
|
|
2907
|
+
if (name === "") continue;
|
|
2908
|
+
if (token.includes("=")) {
|
|
2909
|
+
if (!found.includes(name)) found.push(name);
|
|
2910
|
+
continue;
|
|
2911
|
+
}
|
|
2912
|
+
const next = (tokens[index + 1] ?? "").replace(/^\[+/, "");
|
|
2913
|
+
if (next !== "" && !next.startsWith("--") && next !== "]" && next !== "|") {
|
|
2914
|
+
if (!found.includes(name)) found.push(name);
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
return found;
|
|
2918
|
+
}
|
|
2919
|
+
/** Union of every usage's value flags (the parse table's ONE source). */
|
|
2920
|
+
const VALUE_FLAGS = (() => {
|
|
2921
|
+
const names = [];
|
|
2922
|
+
for (const entry of COMMAND_ENTRIES) for (const name of entryValueFlags(entry)) if (!names.includes(name)) names.push(name);
|
|
2923
|
+
return names;
|
|
2924
|
+
})();
|
|
2925
|
+
//#endregion
|
|
2926
|
+
//#region lib/types/parse.js
|
|
3070
2927
|
/**
|
|
3071
2928
|
* Narrow a parse result: true when it is the syntax failure rather than a command.
|
|
3072
2929
|
* @param result - what {@link parseSubcommand} answered.
|
|
@@ -4289,7 +4146,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
4289
4146
|
...mounted,
|
|
4290
4147
|
runs: doctorRuns()
|
|
4291
4148
|
});
|
|
4292
|
-
if (input === "doctor --json") return ok(JSON.stringify(report
|
|
4149
|
+
if (input === "doctor --json") return ok(JSON.stringify(report, null, 2));
|
|
4293
4150
|
return ok(renderDoctorText(report, hostLocale));
|
|
4294
4151
|
}
|
|
4295
4152
|
if (input === "" || input === "help") return ok(hostCommandText(hostLocale, "help.header") + "\n" + renderHelpText(hostLocale));
|
|
@@ -4352,7 +4209,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
4352
4209
|
ctx.inject(["settings"], () => {
|
|
4353
4210
|
runMigrationOnce();
|
|
4354
4211
|
});
|
|
4355
|
-
registerHostRoutes(ctx, () => [...makeDiagnosticsRoutes(() => assembleDoctorInputs(ctx, { runs: doctorRuns() }))
|
|
4212
|
+
registerHostRoutes(ctx, () => [...makeDiagnosticsRoutes(() => assembleDoctorInputs(ctx, { runs: doctorRuns() }))]);
|
|
4356
4213
|
(async () => {
|
|
4357
4214
|
const loader = ctx.root.loader;
|
|
4358
4215
|
try {
|
|
@@ -15,8 +15,8 @@ export interface CommandFallbackHint {
|
|
|
15
15
|
readonly command: string;
|
|
16
16
|
readonly platformCli?: string;
|
|
17
17
|
}
|
|
18
|
-
/** The
|
|
19
|
-
export type CommandFallbackSurface = 'approval' | 'skill-history' | 'skill-health' | 'merge' | 'diagnostics'
|
|
18
|
+
/** The five Host surfaces (keyed exactly like the frozen `COMMAND_FALLBACK_SURFACES`). */
|
|
19
|
+
export type CommandFallbackSurface = 'approval' | 'skill-history' | 'skill-health' | 'merge' | 'diagnostics';
|
|
20
20
|
/**
|
|
21
21
|
* One entry per Host surface. The command column names the same service methods the routes call,
|
|
22
22
|
* so the answers (and refusal sentences) match the panel.
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { Context } from '@deepseek-ai/cordis';
|
|
12
12
|
import { type ChannelState, type DiagnosticsView } from '@lmzhen/dsh-evolution-core';
|
|
13
|
-
/** The install form the running profile was classified as (
|
|
14
|
-
export type InstallFormId = '
|
|
13
|
+
/** The install form the running profile was classified as (the seven values DoctorReport uses). */
|
|
14
|
+
export type InstallFormId = 'full' | 'human-gated' | 'preset' | 'host' | 'layered' | 'preset-only' | 'none';
|
|
15
15
|
/** One preset's probe result (reviewer/maintainer). */
|
|
16
16
|
export interface PresetFacts {
|
|
17
17
|
readonly registered: boolean;
|
|
@@ -59,7 +59,6 @@ export interface DoctorInputs {
|
|
|
59
59
|
readonly orphaned: number;
|
|
60
60
|
};
|
|
61
61
|
readonly missingServices?: readonly string[] | undefined;
|
|
62
|
-
readonly sessionFoldClassifierPresent?: boolean | undefined;
|
|
63
62
|
readonly platformPairing?: PlatformPairing | undefined;
|
|
64
63
|
/** Human-facing total of registered host routes, when the carrier reports one (12 today). */
|
|
65
64
|
readonly hostRouteCount?: {
|
package/lib/types/doctor.d.ts
CHANGED
|
@@ -75,13 +75,6 @@ export interface DoctorReport {
|
|
|
75
75
|
* installing `all` — which double-mounts the preset's model rows (the
|
|
76
76
|
* exact conflict this report flags). */
|
|
77
77
|
installForm: 'full' | 'human-gated' | 'host' | 'preset' | 'layered' | 'preset-only' | 'none';
|
|
78
|
-
/** The PRODUCT form the install form implies (0.3.77, C axis). `variant` =
|
|
79
|
-
* session-level opt-in: the model tools live in the Evolution preset, so a
|
|
80
|
-
* session on any platform original preset carries none of the family and the
|
|
81
|
-
* cross-session consumers skip it (config `sessionScoped`). `attach` =
|
|
82
|
-
* profile-level: the model rows sit at profile root and every session carries
|
|
83
|
-
* them. The two are mutually exclusive install targets (E-33). */
|
|
84
|
-
deploymentForm: 'variant' | 'attach' | 'host-only' | 'preset-only' | 'none';
|
|
85
78
|
/** Aggregated across ALL profiles under `home` (N13, v12): doctor answers
|
|
86
79
|
* "is any profile carrying an evolution bundle / which install forms exist"
|
|
87
80
|
* — not "what this runtime mounted". `services.review` is the runtime-side
|
package/lib/types/parse.d.ts
CHANGED
|
@@ -13,12 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @module @lmzhen/dsh-evolution-commands/parse
|
|
15
15
|
*/
|
|
16
|
-
/** The flags whose declared form takes a value
|
|
17
|
-
|
|
18
|
-
* Exported so the command-table gate can tie it to the table's usage lines (P2: two declarations of
|
|
19
|
-
* "which flags take a value" would otherwise be free to drift apart).
|
|
20
|
-
*/
|
|
21
|
-
export declare const VALUE_FLAGS: readonly string[];
|
|
16
|
+
/** The flags whose declared form takes a value, derived from the command table's usage lines. */
|
|
17
|
+
export { VALUE_FLAGS } from './registry.ts';
|
|
22
18
|
/** One parsed command line. */
|
|
23
19
|
export interface ParsedCommand {
|
|
24
20
|
/** The subcommand name, lower-cased (the table stores it lower-case too). */
|
package/lib/types/registry.d.ts
CHANGED
|
@@ -30,4 +30,12 @@ export declare function renderHelpText(locale?: HostLocale): string;
|
|
|
30
30
|
/** Markdown command table fragment for README surfaces (T-WD2 pins it).
|
|
31
31
|
* `|` inside a usage (curator run|pause|…) is escaped for the table cell. */
|
|
32
32
|
export declare function renderCommandTable(): string;
|
|
33
|
+
/**
|
|
34
|
+
* The flags whose declared form takes a value, DERIVED from the usage text: a flag followed by
|
|
35
|
+
* `=` or by a placeholder token (not another flag/bracket) is a value flag. Boolean flags stay
|
|
36
|
+
* out. The parser imports this, so `--proposal p1` cannot be read as a bare boolean again.
|
|
37
|
+
*/
|
|
38
|
+
export declare function entryValueFlags(entry: CommandEntry): string[];
|
|
39
|
+
/** Union of every usage's value flags (the parse table's ONE source). */
|
|
40
|
+
export declare const VALUE_FLAGS: readonly string[];
|
|
33
41
|
//# sourceMappingURL=registry.d.ts.map
|
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.47.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -29,13 +29,13 @@
|
|
|
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.47.0",
|
|
33
|
+
"@lmzhen/dsh-evolution-core": "^0.47.0",
|
|
34
|
+
"@lmzhen/dsh-evolution-maintenance": "^0.47.0",
|
|
35
|
+
"@lmzhen/dsh-evolution-state": "^0.47.0"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@lmzhen/dsh-evolution-agent-preset": "^0.
|
|
38
|
+
"@lmzhen/dsh-evolution-agent-preset": "^0.47.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ConnectionFetchRouteLike } from '@lmzhen/dsh-evolution-core/http-routes';
|
|
2
|
-
interface SettingsDescriptorLike {
|
|
3
|
-
ns: string;
|
|
4
|
-
value?: unknown;
|
|
5
|
-
user?: Record<string, unknown>;
|
|
6
|
-
base?: unknown;
|
|
7
|
-
revision?: number;
|
|
8
|
-
applies?: 'live' | 'restart';
|
|
9
|
-
}
|
|
10
|
-
interface SettingsProviderLike {
|
|
11
|
-
readonly writable: boolean;
|
|
12
|
-
describe(options?: {
|
|
13
|
-
redactSecrets?: boolean;
|
|
14
|
-
}): SettingsDescriptorLike[];
|
|
15
|
-
mutate(ns: string, ops: readonly {
|
|
16
|
-
op: 'set' | 'unset';
|
|
17
|
-
path: readonly string[];
|
|
18
|
-
value?: unknown;
|
|
19
|
-
}[], expectedRevision?: number): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @param getProvider - resolves the live platform settings provider per request.
|
|
23
|
-
* @returns exact routes for family settings describe/mutate.
|
|
24
|
-
*/
|
|
25
|
-
export declare function makeSettingsRoutes(getProvider: () => SettingsProviderLike | undefined): ConnectionFetchRouteLike[];
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=settings-route.d.ts.map
|