@lmzhen/dsh-evolution-commands 0.32.2 → 0.32.4

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
@@ -73,7 +73,7 @@ const RUNTIME_LABELS = {
73
73
  */
74
74
  const FORM_WORDS = Object.freeze({
75
75
  M1: "完整功能包",
76
- M2: "后台自动化包",
76
+ M2: "人工审批包",
77
77
  M3: "会话预设包",
78
78
  M4: "分层安装"
79
79
  });
@@ -238,7 +238,7 @@ function runtimeOf(inputs) {
238
238
  label: RUNTIME_LABELS.runs ?? "运行登记",
239
239
  status: "warn",
240
240
  detail: "running=" + String(inputs.runs.running) + ",orphaned=" + String(inputs.runs.orphaned),
241
- remedy: "运行 /evolution runs 收敛遗留运行。"
241
+ remedy: "运行 /evolution maintain status 查看并收敛遗留运行。"
242
242
  } : {
243
243
  key: "runs",
244
244
  label: RUNTIME_LABELS.runs ?? "运行登记",
@@ -392,9 +392,10 @@ async function assembleDoctorInputs(ctx, extras = {}) {
392
392
  const hasPreset = bundles.some((name) => name.endsWith("dsh-evolution-preset"));
393
393
  const hasHost = bundles.some((name) => name.endsWith("dsh-evolution-host"));
394
394
  const hasFamilyPreset = listed.some((entry) => typeof entry.id === "string" && EVOLUTION_PRESET_IDS.includes(entry.id));
395
+ const humanGated = get("evolutionApproval")?.isEnabled === true;
395
396
  const detectedForm = hasAll || hasPreset ? {
396
- id: "M1",
397
- evidence: [hasAll ? "bundle dsh-evolution-all installed" : "bundle dsh-evolution-preset installed"],
397
+ id: humanGated ? "M2" : "M1",
398
+ evidence: [hasAll ? "bundle dsh-evolution-all installed" : "bundle dsh-evolution-preset installed", ...humanGated ? ["approval.enabled: true"] : []],
398
399
  confidence: "declared"
399
400
  } : hasHost ? hasFamilyPreset ? {
400
401
  id: "M4",
@@ -1446,8 +1447,9 @@ async function diagnose(ctx, options = {}) {
1446
1447
  pendingCount = null;
1447
1448
  executingCount = null;
1448
1449
  }
1449
- const installForm = full ? "full" : preset ? "preset" : layered ? "layered" : host ? "host" : presetDirInstalled ? "preset-only" : "none";
1450
- const deploymentForm = installForm === "layered" ? "variant" : installForm === "full" || installForm === "preset" ? "attach" : installForm === "host" ? "host-only" : installForm === "preset-only" ? "preset-only" : "none";
1450
+ const humanGated = ctx.get("evolutionApproval")?.isEnabled === true;
1451
+ const installForm = full || preset ? humanGated ? "human-gated" : full ? "full" : "preset" : layered ? "layered" : host ? "host" : presetDirInstalled ? "preset-only" : "none";
1452
+ const deploymentForm = installForm === "layered" ? "variant" : installForm === "full" || installForm === "preset" || installForm === "human-gated" ? "attach" : installForm === "host" ? "host-only" : installForm === "preset-only" ? "preset-only" : "none";
1451
1453
  const mountConflicts = conflicts.filter((row) => !row.includes("DEGRADED"));
1452
1454
  const undecidable = mountConflicts.length !== conflicts.length;
1453
1455
  const scopedProbe = {
@@ -1483,7 +1485,7 @@ async function diagnose(ctx, options = {}) {
1483
1485
  if (row.status !== "differs") continue;
1484
1486
  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 (/evolution preset install) to regenerate`);
1485
1487
  }
1486
- const view = buildDoctorView(await assembleDoctorInputs(ctx));
1488
+ const view = buildDoctorView(await assembleDoctorInputs(ctx, options.runs === void 0 ? {} : { runs: options.runs }));
1487
1489
  const merge = await mergeDoctorLine(ctx);
1488
1490
  if (merge.status !== "ok" && merge.remedy !== void 0) actions.push("合并行:" + merge.remedy);
1489
1491
  return {
@@ -2270,7 +2272,10 @@ function parseCommand(defs, argv) {
2270
2272
  help: true
2271
2273
  };
2272
2274
  const candidates = defs.filter((item) => item.words.includes(verb));
2273
- const def = candidates.find((item) => rest.filter((token) => token.startsWith("--")).every((token) => item.flags.some((flag) => flag.name === token.slice(2)))) ?? candidates[0];
2275
+ const def = candidates.find((item) => rest.filter((token) => token.startsWith("--")).every((token) => {
2276
+ const name = token.slice(2).split("=")[0] ?? "";
2277
+ return item.flags.some((flag) => flag.name === name);
2278
+ })) ?? candidates[0];
2274
2279
  if (def === void 0) return {
2275
2280
  ok: false,
2276
2281
  code: "usage",
@@ -2284,15 +2289,27 @@ function parseCommand(defs, argv) {
2284
2289
  positional.push(token);
2285
2290
  continue;
2286
2291
  }
2287
- const name = token.slice(2);
2292
+ const eq = token.indexOf("=");
2293
+ const name = (eq < 0 ? token : token.slice(0, eq)).slice(2);
2294
+ const inline = eq < 0 ? void 0 : token.slice(eq + 1);
2288
2295
  const flag = def.flags.find((item) => item.name === name);
2289
2296
  if (flag === void 0) return {
2290
2297
  ok: false,
2291
2298
  code: "usage",
2292
2299
  message: "unknown flag: --" + name
2293
2300
  };
2294
- if (flag.kind === "boolean") values[name] = true;
2295
- else {
2301
+ if (flag.kind === "boolean") {
2302
+ if (inline !== void 0) return {
2303
+ ok: false,
2304
+ code: "usage",
2305
+ message: "flag does not take a value: --" + name
2306
+ };
2307
+ values[name] = true;
2308
+ } else {
2309
+ if (inline !== void 0) {
2310
+ values[name] = inline;
2311
+ continue;
2312
+ }
2296
2313
  const value = rest[index + 1];
2297
2314
  if (value === void 0 || value.startsWith("--")) return {
2298
2315
  ok: false,
@@ -2573,7 +2590,7 @@ function apply(ctx, rawConfig = {}) {
2573
2590
  };
2574
2591
  const approval = ctx.get("evolutionApproval");
2575
2592
  const pendingParsed = parseSubcommand(input);
2576
- if (!isParseFailure(pendingParsed) && pendingParsed.name === "pending") {
2593
+ if (!isParseFailure(pendingParsed) && pendingParsed.name === "pending" && pendingParsed.positionals.length === 0 && [...pendingParsed.flags.keys()].every((flag) => flag === "detail")) {
2577
2594
  if (!approval) return err(errorText("e-301-approval-service-not-mounted"));
2578
2595
  const listed = [...await approval.list("pending"), ...await approval.list("executing")];
2579
2596
  const pending = [...new Map(listed.map((row) => [row.id, row])).values()];
@@ -3331,7 +3348,7 @@ function apply(ctx, rawConfig = {}) {
3331
3348
  return ok(replay.compare().report);
3332
3349
  }
3333
3350
  const paramsParsed = parseSubcommand(input);
3334
- if (!isParseFailure(paramsParsed) && paramsParsed.name === "params") {
3351
+ if (!isParseFailure(paramsParsed) && paramsParsed.name === "params" && paramsParsed.positionals.length === 0 && [...paramsParsed.flags.keys()].every((flag) => flag === "group" || flag === "json")) {
3335
3352
  const provider = ctx.get("settings");
3336
3353
  const sections = /* @__PURE__ */ new Map();
3337
3354
  if (provider?.describe !== void 0) try {
@@ -3446,7 +3463,8 @@ function apply(ctx, rawConfig = {}) {
3446
3463
  } };
3447
3464
  const report = await diagnose(ctx, {
3448
3465
  home: evolutionRoot(),
3449
- ...mounted
3466
+ ...mounted,
3467
+ runs: doctorRuns()
3450
3468
  });
3451
3469
  if (input === "doctor --json") return ok(JSON.stringify(report.view, null, 2));
3452
3470
  return ok(renderDoctorText(report));
@@ -73,7 +73,7 @@ export interface DoctorReport {
73
73
  * per-session install reported `none` and the action ladder advised
74
74
  * installing `all` — which double-mounts the preset's model rows (the
75
75
  * exact conflict this report flags). */
76
- installForm: 'full' | 'host' | 'preset' | 'layered' | 'preset-only' | 'none';
76
+ installForm: 'full' | 'human-gated' | 'host' | 'preset' | 'layered' | 'preset-only' | 'none';
77
77
  /** The PRODUCT form the install form implies (0.3.77, C axis). `variant` =
78
78
  * session-level opt-in: the model tools live in the Evolution preset, so a
79
79
  * session on any platform original preset carries none of the family and the
@@ -166,6 +166,10 @@ export declare function diagnose(ctx: {
166
166
  }, options?: {
167
167
  home?: string;
168
168
  mounted?: MountedProfile;
169
+ runs?: {
170
+ readonly running: number;
171
+ readonly orphaned: number;
172
+ };
169
173
  }): Promise<DoctorReport>;
170
174
  /**
171
175
  * W8-S7: the doctor's text face, VIEW-FIRST.
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.32.2",
4
+ "version": "0.32.4",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,13 +27,13 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.5",
30
- "@lmzhen/dsh-evolution-approval": "^0.32.2",
31
- "@lmzhen/dsh-evolution-core": "^0.32.2",
32
- "@lmzhen/dsh-evolution-maintenance": "^0.32.2",
33
- "@lmzhen/dsh-evolution-state-storage": "^0.32.2"
30
+ "@lmzhen/dsh-evolution-approval": "^0.32.4",
31
+ "@lmzhen/dsh-evolution-core": "^0.32.4",
32
+ "@lmzhen/dsh-evolution-maintenance": "^0.32.4",
33
+ "@lmzhen/dsh-evolution-state-storage": "^0.32.4"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@lmzhen/dsh-evolution-agent-preset": "^0.32.2"
36
+ "@lmzhen/dsh-evolution-agent-preset": "^0.32.4"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/cordis": "^4.0.5",