@lmzhen/dsh-evolution-commands 0.49.0 → 0.50.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.
Files changed (2) hide show
  1. package/lib/index.js +16 -19
  2. package/package.json +10 -10
package/lib/index.js CHANGED
@@ -1,12 +1,13 @@
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, 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";
2
+ import { commandsPort, configEditorPort, createUserMessage, pluginInventoryPort, pluginManagerPort, profileContextPort, sessionQueryPort, settingsPort, toolsPort } from "@lmzhen/dsh-evolution-core/platform";
3
+ 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, buildLearnPrompt, clampedNumber, classifyNamespaceMigration, createSubagentChannel, errorText, errorTextIn, eventsFile, evolutionHome, evolutionRoot, hostSurface, isDeprecatedParamId, isPresent, isRecord, isUnknown, liveBool, mutationLockFrom, newRunRegistry, paramSettingsId, planNamespaceMigration, policyStageLimits, probeMtime, probeText, reportsSweepLockTarget, resolveParamId, scopedPackageName, scopedProbeReport, sweepReports, transactIo } from "@lmzhen/dsh-evolution-core";
3
4
  import { HOST_ROUTES, json, methodNotAllowed, registerHostRoutes } from "@lmzhen/dsh-evolution-core/http-routes";
4
5
  import { existsSync, readFileSync, readdirSync } from "node:fs";
5
6
  import { dirname, join } from "node:path";
6
7
  import { fileURLToPath } from "node:url";
7
8
  import z from "@deepseek-ai/schemastery";
8
9
  import { effectiveSessionPolicy } from "@lmzhen/dsh-evolution-approval";
9
- import { createUserMessage } from "@lmzhen/dsh-evolution-core/platform";
10
+ import { buildExtractPlanFromLibrary, ownerDecisionText, proposalFromPlan, readProposalReport, writeProposalReport } from "@lmzhen/dsh-evolution-core/extract";
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";
@@ -1501,7 +1502,7 @@ const HOST_COMMANDS = {
1501
1502
  */
1502
1503
  function resolveHostLocale(ctx) {
1503
1504
  try {
1504
- const value = ctx.get("settings")?.describe?.({ redactSecrets: false })?.find((entry) => entry.ns === "locale")?.value;
1505
+ const value = settingsPort(ctx)?.describe?.({ redactSecrets: false })?.find((entry) => entry.ns === "locale")?.value;
1505
1506
  const preference = typeof value === "object" && value !== null ? value.preference : void 0;
1506
1507
  if (preference === void 0 || preference === null) return "zh";
1507
1508
  return HOST_LOCALES.includes(preference) ? preference : "en";
@@ -2404,9 +2405,9 @@ async function objectOf(read) {
2404
2405
  * @returns the view; each member is undefined when its surface is not mounted or did not answer.
2405
2406
  */
2406
2407
  async function readPlatformView(ctx) {
2407
- const manager = ctx.get("pluginManager");
2408
- const editor = ctx.get("configEditor");
2409
- const inventory = ctx.get("pluginInventory");
2408
+ const manager = pluginManagerPort(ctx);
2409
+ const editor = configEditorPort(ctx);
2410
+ const inventory = pluginInventoryPort(ctx);
2410
2411
  const listed = await objectOf(inventory?.list === void 0 ? void 0 : () => inventory.list?.());
2411
2412
  const plugins = await arrayOf(manager?.listPlugins === void 0 ? void 0 : () => manager.listPlugins?.());
2412
2413
  return {
@@ -2445,7 +2446,7 @@ const PROFILE_PATCH_FILENAME$1 = "cordis.patch.yml";
2445
2446
  * @returns the target, or undefined when no profile is mounted.
2446
2447
  */
2447
2448
  function presetProfileTarget(ctx) {
2448
- const profile = ctx.get("profileContext");
2449
+ const profile = profileContextPort(ctx);
2449
2450
  if (profile === void 0 || typeof profile.dir !== "string" || profile.dir === "") return void 0;
2450
2451
  return {
2451
2452
  profile: profile.name,
@@ -3005,7 +3006,7 @@ function probePresetFreshness(home, servicePresent) {
3005
3006
  * @returns the row the report renders.
3006
3007
  */
3007
3008
  async function legacyMigrationRow(ctx, home) {
3008
- const settings = ctx.get("settings");
3009
+ const settings = settingsPort(ctx);
3009
3010
  const io = ctx.get("evolutionIo")?.provider?.();
3010
3011
  if (settings?.describe === void 0 || io === void 0) return {
3011
3012
  state: "unavailable",
@@ -3280,8 +3281,7 @@ async function probeBounded(work, label) {
3280
3281
  * @returns one or two messages; empty when the service is absent or healthy.
3281
3282
  */
3282
3283
  async function sessionQueryIssues(ctx) {
3283
- const service = ctx.get("sessionQuery");
3284
- const list = service?.listSessions?.bind(service);
3284
+ const list = sessionQueryPort(ctx)?.listSessions;
3285
3285
  if (list === void 0) return [];
3286
3286
  const outcome = await probeBounded(() => list(), "session-query listing");
3287
3287
  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"];
@@ -3759,10 +3759,6 @@ function aliasRegistration(version, def) {
3759
3759
  }
3760
3760
  //#endregion
3761
3761
  //#region lib/types/index.js
3762
- /**
3763
- * Human commands for the evolution family: /evolution learn|pending|curator|restore|consolidate|skills refresh.
3764
- * @module @lmzhen/dsh-evolution-commands
3765
- */
3766
3762
  /** Enrichment maps shared by the full scan and the `--facts` preview (v12). */
3767
3763
  const name = "evolution-commands";
3768
3764
  const Config = z.object({
@@ -3928,8 +3924,8 @@ function apply(ctx, rawConfig = {}) {
3928
3924
  assertSkillsRootAliasRetired(rawConfig);
3929
3925
  const skillsRootValue = resolveRootConfig(rawConfig).root;
3930
3926
  ctx.inject(["settings"], (scope) => {
3931
- const settings = scope.settings;
3932
- if (typeof settings?.configure !== "function") return;
3927
+ const settings = settingsPort(scope);
3928
+ if (settings?.configure === void 0) return;
3933
3929
  const disposer = settings.configure({ auto: false }, ctx.fiber);
3934
3930
  if (typeof disposer === "function") scope.effect(() => disposer, "evolution-commands: settings presentation");
3935
3931
  });
@@ -3974,7 +3970,8 @@ function apply(ctx, rawConfig = {}) {
3974
3970
  }
3975
3971
  };
3976
3972
  ctx.inject(["commands"], (commandCtx) => {
3977
- const commands = commandCtx.commands;
3973
+ const commands = commandsPort(commandCtx);
3974
+ if (commands === void 0) return;
3978
3975
  const commandBody = { run: async (invocation) => {
3979
3976
  const rawInputTrimmed = invocation.rawInput.trim();
3980
3977
  const input = rawInputTrimmed.replace(/\s+/g, " ");
@@ -4025,7 +4022,7 @@ function apply(ctx, rawConfig = {}) {
4025
4022
  command,
4026
4023
  approval,
4027
4024
  locale: hostLocale,
4028
- provider: ctx.get("settings"),
4025
+ provider: settingsPort(ctx),
4029
4026
  ctx,
4030
4027
  runs: doctorRuns,
4031
4028
  refusal: unreplayableWriteRefusal
@@ -4478,7 +4475,7 @@ function apply(ctx, rawConfig = {}) {
4478
4475
  channel,
4479
4476
  parent: invocation.agent,
4480
4477
  evolutionPolicy: { get: () => ctx.get("evolutionPolicy")?.get() },
4481
- tools: { get: (name) => ctx.get("tools")?.get(name) },
4478
+ tools: { get: (name) => toolsPort(ctx)?.get(name) },
4482
4479
  logger: { warn: (message) => {
4483
4480
  ctx.logger.warn(message);
4484
4481
  } },
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.49.0",
4
+ "version": "0.50.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -29,23 +29,23 @@
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
31
  "@deepseek-ai/schemastery": "^3.18.5",
32
- "@lmzhen/dsh-evolution-approval": "^0.49.0",
33
- "@lmzhen/dsh-evolution-core": "^0.49.0",
34
- "@lmzhen/dsh-evolution-maintenance": "^0.49.0",
35
- "@lmzhen/dsh-evolution-state": "^0.49.0"
32
+ "@lmzhen/dsh-evolution-approval": "^0.50.0",
33
+ "@lmzhen/dsh-evolution-core": "^0.50.0",
34
+ "@lmzhen/dsh-evolution-maintenance": "^0.50.0",
35
+ "@lmzhen/dsh-evolution-state": "^0.50.0"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@lmzhen/dsh-evolution-agent-preset": "^0.49.0"
38
+ "@lmzhen/dsh-evolution-agent-preset": "^0.50.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@deepseek-ai/cordis": "^4.0.5",
42
- "@deepseek-ai/dsh-commands": "^0.2.2-rc.0",
43
- "@deepseek-ai/dsh-llm": "^0.2.2-rc.0"
42
+ "@deepseek-ai/dsh-commands": "^0.2.2-rc.3",
43
+ "@deepseek-ai/dsh-llm": "^0.2.2-rc.3"
44
44
  },
45
45
  "devDependencies": {
46
- "@deepseek-ai/dsh-commands": "^0.2.2-rc.0"
46
+ "@deepseek-ai/dsh-commands": "^0.2.2-rc.3"
47
47
  },
48
48
  "engines": {
49
- "dsh": ">=0.2.2-rc.0 <0.2.3-0"
49
+ "dsh": ">=0.2.2-rc.3 <0.2.3-0"
50
50
  }
51
51
  }