@lmzhen/dsh-evolution-core 0.57.0 → 0.59.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 (86) hide show
  1. package/README.md +4 -2
  2. package/lib/authority-plugin.js +1 -1
  3. package/lib/composition/index.js +2 -2
  4. package/lib/{composition-B-gKqiBY.js → composition-B_F4TYOD.js} +1 -1
  5. package/lib/{ensure-BLmEW0Ju.js → ensure-BpVDuDnA.js} +1 -1
  6. package/lib/http-routes.js +1 -1
  7. package/lib/index.js +12 -10
  8. package/lib/{mutation-authority-DQfpXs1O.js → mutation-authority-Du-ON0NY.js} +1 -1
  9. package/lib/policy.js +1 -1
  10. package/lib/restrictor.js +1 -2
  11. package/lib/result.js +2 -33
  12. package/lib/{review-context-70XYS11J.js → review-context-CW_kJAzn.js} +1 -1
  13. package/lib/runtime/plugin.js +72 -55
  14. package/lib/{session-projection-CbIKvDfJ.js → session-projection-DM15fsRp.js} +8 -16
  15. package/lib/skills.js +2 -2
  16. package/lib/subagent/index.js +1 -1
  17. package/lib/types/authority.d.ts +1 -1
  18. package/lib/types/authority.js +1 -1
  19. package/lib/types/composition/ensure.js +1 -1
  20. package/lib/types/events.d.ts +15 -1
  21. package/lib/types/http-routes.js +1 -1
  22. package/lib/types/opt-in.js +2 -2
  23. package/lib/types/params.js +1 -1
  24. package/lib/types/platform-line.generated.d.ts +4 -2
  25. package/lib/types/platform-line.generated.js +6 -2
  26. package/lib/types/policy.js +1 -1
  27. package/lib/types/prompts.js +1 -1
  28. package/lib/types/restrictor.js +2 -2
  29. package/lib/types/result.d.ts +3 -31
  30. package/lib/types/result.js +6 -24
  31. package/lib/types/runtime/coherence.js +1 -1
  32. package/lib/types/runtime/llm.d.ts +1 -1
  33. package/lib/types/runtime/llm.js +1 -1
  34. package/lib/types/runtime/minimal-preset.d.ts +17 -0
  35. package/lib/types/runtime/minimal-preset.js +81 -0
  36. package/lib/types/runtime/platform.d.ts +8 -58
  37. package/lib/types/runtime/platform.js +7 -61
  38. package/lib/types/runtime/plugin.js +3 -4
  39. package/lib/types/runtime/projections.d.ts +1 -1
  40. package/lib/types/scope.js +1 -1
  41. package/lib/types/session-projection.d.ts +1 -1
  42. package/lib/types/signals.d.ts +8 -2
  43. package/lib/types/signals.js +7 -18
  44. package/lib/types/skill-stats.d.ts +37 -0
  45. package/lib/types/subagent/run.d.ts +1 -1
  46. package/lib/types/subagent/types.d.ts +4 -4
  47. package/package.json +7 -32
  48. package/lib/connection-DAJy7Xjm.js +0 -28
  49. package/lib/platform/index.js +0 -5
  50. package/lib/platform-UL-djjz9.js +0 -244
  51. package/lib/presets-C8vuCuNA.js +0 -27
  52. package/lib/tools-BrUswg8v.js +0 -22
  53. package/lib/types/platform/agents.d.ts +0 -32
  54. package/lib/types/platform/agents.js +0 -26
  55. package/lib/types/platform/commands.d.ts +0 -14
  56. package/lib/types/platform/commands.js +0 -9
  57. package/lib/types/platform/connection.d.ts +0 -26
  58. package/lib/types/platform/connection.js +0 -27
  59. package/lib/types/platform/index.d.ts +0 -55
  60. package/lib/types/platform/index.js +0 -29
  61. package/lib/types/platform/llm.d.ts +0 -47
  62. package/lib/types/platform/llm.js +0 -76
  63. package/lib/types/platform/platformView.d.ts +0 -21
  64. package/lib/types/platform/platformView.js +0 -29
  65. package/lib/types/platform/presets.d.ts +0 -31
  66. package/lib/types/platform/presets.js +0 -31
  67. package/lib/types/platform/profileContext.d.ts +0 -16
  68. package/lib/types/platform/profileContext.js +0 -14
  69. package/lib/types/platform/projections.d.ts +0 -35
  70. package/lib/types/platform/projections.js +0 -34
  71. package/lib/types/platform/settings.d.ts +0 -22
  72. package/lib/types/platform/settings.js +0 -14
  73. package/lib/types/platform/skills.d.ts +0 -16
  74. package/lib/types/platform/skills.js +0 -9
  75. package/lib/types/platform/storageDomain.d.ts +0 -13
  76. package/lib/types/platform/storageDomain.js +0 -9
  77. package/lib/types/platform/subagents.d.ts +0 -25
  78. package/lib/types/platform/subagents.js +0 -17
  79. package/lib/types/platform/systemPrompt.d.ts +0 -16
  80. package/lib/types/platform/systemPrompt.js +0 -13
  81. package/lib/types/platform/tools.d.ts +0 -27
  82. package/lib/types/platform/tools.js +0 -23
  83. package/lib/types/platform/userQuestions.d.ts +0 -33
  84. package/lib/types/platform/userQuestions.js +0 -9
  85. package/lib/types/platform/workingDirectory.d.ts +0 -14
  86. package/lib/types/platform/workingDirectory.js +0 -9
@@ -1,25 +1,7 @@
1
- export function ok(value) {
2
- return { ok: true, value };
3
- }
4
- export function err(error) {
5
- return { ok: false, error };
6
- }
7
- export function isOk(result) {
8
- return result.ok;
9
- }
10
- export function isErr(result) {
11
- return !result.ok;
12
- }
13
- /** The value, or the supplied fallback when the result is an error. */
14
- export function unwrapOr(result, fallback) {
15
- return result.ok ? result.value : fallback;
16
- }
17
- /** Coerce a caught value into the family error shape. */
18
- export function familyError(code, cause) {
19
- return {
20
- code,
21
- message: cause instanceof Error ? cause.message : String(cause),
22
- ...(cause === undefined ? {} : { cause }),
23
- };
24
- }
1
+ /**
2
+ * Compatibility re-export of the family Result vocabulary.
3
+ *
4
+ * @module @lmzhen/dsh-evolution-core/result
5
+ */
6
+ export * from '@lmzhen/dsh-evolution-platform-contract/result';
25
7
  //# sourceMappingURL=result.js.map
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import { existsSync, readFileSync } from 'node:fs';
15
15
  import { join } from 'node:path';
16
- import { profileContextPort } from "../platform/profileContext.js";
16
+ import { profileContextPort } from '@lmzhen/dsh-evolution-adapter/ports';
17
17
  function packageTail(name) {
18
18
  return name.slice(name.lastIndexOf('/') + 1);
19
19
  }
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { Service } from '@deepseek-ai/cordis';
6
6
  import type { Context } from '@deepseek-ai/cordis';
7
- import { type EvolutionLlmRequest, type ModelRoute, type StreamChunk } from '../platform/index.ts';
7
+ import type { EvolutionLlmRequest, ModelRoute, StreamChunk } from '@lmzhen/dsh-evolution-platform-contract';
8
8
  export interface EvolutionLlmInput {
9
9
  readonly purpose: EvolutionLlmRequest['purpose'];
10
10
  readonly messages: EvolutionLlmRequest['messages'];
@@ -3,7 +3,7 @@
3
3
  * model calls. Feature-specific retries and parsing stay in their features.
4
4
  */
5
5
  import { Service } from '@deepseek-ai/cordis';
6
- import { EvolutionLlmError, modelRoute } from "../platform/index.js";
6
+ import { EvolutionLlmError, modelRoute } from '@lmzhen/dsh-evolution-adapter/ports';
7
7
  /** Domain service for every auxiliary LLM request in the family. */
8
8
  export class EvolutionLlm extends Service {
9
9
  static inject = [];
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Keep the family's model-facing surface out of the platform's minimal preset.
3
+ *
4
+ * The platform minimal preset deliberately has no skill loader or skill
5
+ * catalog. `evolution-all` mounts its model rows at profile root, which would
6
+ * otherwise leak memory/skill management into that preset. The public runtime
7
+ * API can hide those tools per agent scope without unloading the family's
8
+ * infrastructure; UI panels and commands remain profile-level.
9
+ *
10
+ * @module @lmzhen/dsh-evolution-core/runtime/minimal-preset
11
+ */
12
+ import type { Context } from '@deepseek-ai/cordis';
13
+ /** Family tools that must never be model-visible in the minimal preset. */
14
+ export declare const MINIMAL_PRESET_DENY_TOOLS: readonly ["memory", "skill_manage", "skill_search", "skill", "maintenance_probe", "merge_stage"];
15
+ /** Install the per-agent minimal-preset guard. */
16
+ export declare function installMinimalPresetGuard(ctx: Context): void;
17
+ //# sourceMappingURL=minimal-preset.d.ts.map
@@ -0,0 +1,81 @@
1
+ // platform-declaration anchor: sessionProjections is declared in core PLATFORM_SERVICE_PROBES.
2
+ /** Family tools that must never be model-visible in the minimal preset. */
3
+ export const MINIMAL_PRESET_DENY_TOOLS = [
4
+ 'memory',
5
+ 'skill_manage',
6
+ 'skill_search',
7
+ 'skill',
8
+ 'maintenance_probe',
9
+ 'merge_stage',
10
+ ];
11
+ function activePreset(ctx, agent) {
12
+ const registry = ctx.get('sessionProjections');
13
+ const projected = registry?.snapshot?.(agent.session, ['agentPreset'])?.values?.agentPreset;
14
+ if (typeof projected === 'string')
15
+ return projected;
16
+ const headerPreset = agent.session?.header?.agentPreset;
17
+ return typeof headerPreset === 'string' ? headerPreset : undefined;
18
+ }
19
+ /** Install the per-agent minimal-preset guard. */
20
+ export function installMinimalPresetGuard(ctx) {
21
+ const disposers = new Map();
22
+ const sync = (agent) => {
23
+ const key = agent.id;
24
+ if (activePreset(ctx, agent) !== 'minimal') {
25
+ disposers.get(key)?.();
26
+ disposers.delete(key);
27
+ return;
28
+ }
29
+ if (disposers.has(key))
30
+ return;
31
+ const tools = agent.ctx?.tools;
32
+ if (tools?.restrict === undefined)
33
+ return;
34
+ const known = MINIMAL_PRESET_DENY_TOOLS.filter(name => {
35
+ try {
36
+ return tools.get?.(name, agent) !== undefined;
37
+ }
38
+ catch {
39
+ return false;
40
+ }
41
+ });
42
+ if (known.length === 0)
43
+ return;
44
+ try {
45
+ disposers.set(key, tools.restrict({ deny: known }));
46
+ }
47
+ catch (error) {
48
+ // A guard failure must never veto agent creation; the next sync retries.
49
+ ctx.logger.warn('dsh-evolution-core: minimal preset tool restriction failed: ' + (error instanceof Error ? error.message : String(error)));
50
+ }
51
+ };
52
+ ctx.inject(['agents'], child => {
53
+ const events = child;
54
+ const created = events.on('agent/created', payload => {
55
+ const agent = payload?.agent;
56
+ if (agent !== undefined)
57
+ sync(agent);
58
+ });
59
+ const selected = events.on('agent-preset/selected', (sessionId) => {
60
+ const agent = events.agents?.get(sessionId);
61
+ if (agent !== undefined)
62
+ sync(agent);
63
+ });
64
+ const disposed = events.on('agent/disposed', payload => {
65
+ const agent = payload?.agent;
66
+ if (agent === undefined)
67
+ return;
68
+ disposers.get(agent.id)?.();
69
+ disposers.delete(agent.id);
70
+ });
71
+ child.effect(() => () => {
72
+ created();
73
+ selected();
74
+ disposed();
75
+ for (const dispose of disposers.values())
76
+ dispose();
77
+ disposers.clear();
78
+ });
79
+ });
80
+ }
81
+ //# sourceMappingURL=minimal-preset.js.map
@@ -1,62 +1,12 @@
1
1
  /**
2
- * The family's host capability service: one place that resolves the platform
3
- * ports and reports which halves are available. Feature code reads ports from
4
- * this service; the port modules remain the only @deepseek-ai/dsh-* importers.
2
+ * Compatibility re-export of the adapter service.
5
3
  *
6
- * The table is resolved on every read. A missing optional service is not a
7
- * permanent capability loss: it may mount after this service initializes, and
8
- * the next read must see it.
4
+ * The concrete `EvolutionPlatform` service lives in
5
+ * `@lmzhen/dsh-evolution-adapter`; core runtime still mounts it while P0
6
+ * keeps the existing composition order.
7
+ *
8
+ * @module @lmzhen/dsh-evolution-core/runtime/platform
9
9
  */
10
- import { Service } from '@deepseek-ai/cordis';
11
- import type { Context } from '@deepseek-ai/cordis';
12
- import type { AgentIdentity, AgentsPort } from '../platform/agents.ts';
13
- import type { CommandsPort } from '../platform/commands.ts';
14
- import type { ProfileContextPort } from '../platform/profileContext.ts';
15
- import type { PluginManagerPort, PluginInventoryPort, ConfigEditorPort } from '../platform/platformView.ts';
16
- import type { WorkingDirectoryPort } from '../platform/workingDirectory.ts';
17
- import type { SkillsPort } from '../platform/skills.ts';
18
- import type { SettingsPort } from '../platform/settings.ts';
19
- import type { StorageDomainPort } from '../platform/storageDomain.ts';
20
- import type { ConnectionPort } from '../platform/connection.ts';
21
- import type { SystemPromptPort } from '../platform/systemPrompt.ts';
22
- import type { SubagentsPort } from '../platform/subagents.ts';
23
- import type { UserQuestionsPort } from '../platform/userQuestions.ts';
24
- import type { LlmPort } from '../platform/llm.ts';
25
- import type { PresetsPort } from '../platform/presets.ts';
26
- import type { ProjectionPort } from '../platform/projections.ts';
27
- import type { ToolsPort } from '../platform/tools.ts';
28
- /** Resolved host ports and their availability. */
29
- export interface HostPlatformPorts {
30
- readonly agents: AgentsPort | undefined;
31
- readonly connection: ConnectionPort | undefined;
32
- readonly settings: SettingsPort | undefined;
33
- readonly storageDomain: StorageDomainPort | undefined;
34
- readonly workingDirectory: WorkingDirectoryPort | undefined;
35
- readonly pluginManager: PluginManagerPort | undefined;
36
- readonly pluginInventory: PluginInventoryPort | undefined;
37
- readonly configEditor: ConfigEditorPort | undefined;
38
- readonly profileContext: ProfileContextPort | undefined;
39
- readonly skills: SkillsPort | undefined;
40
- readonly commands: CommandsPort | undefined;
41
- readonly systemPrompt: SystemPromptPort | undefined;
42
- readonly subagents: SubagentsPort | undefined;
43
- readonly userQuestions: UserQuestionsPort | undefined;
44
- readonly projections: ProjectionPort | undefined;
45
- readonly llm: LlmPort | undefined;
46
- readonly tools: ToolsPort | undefined;
47
- readonly presets: PresetsPort | undefined;
48
- }
49
- /** Domain service owning the host port table. */
50
- export declare class EvolutionPlatform extends Service {
51
- static inject: never[];
52
- constructor(ctx: Context);
53
- /**
54
- * Resolve the host ports now. Consumers read this one table; they never fall
55
- * back to a direct platform import (the second resolution D7 removed).
56
- * Deliberately uncached: `ctx.get` is the capability lifecycle.
57
- */
58
- get ports(): HostPlatformPorts;
59
- /** Whether an exact live root agent is available for this id. */
60
- isRootAgent(agent: AgentIdentity): boolean;
61
- }
10
+ export { EvolutionPlatform } from '@lmzhen/dsh-evolution-adapter/service';
11
+ export type { HostPlatformPorts } from '@lmzhen/dsh-evolution-adapter/service';
62
12
  //# sourceMappingURL=platform.d.ts.map
@@ -1,65 +1,11 @@
1
1
  /**
2
- * The family's host capability service: one place that resolves the platform
3
- * ports and reports which halves are available. Feature code reads ports from
4
- * this service; the port modules remain the only @deepseek-ai/dsh-* importers.
2
+ * Compatibility re-export of the adapter service.
5
3
  *
6
- * The table is resolved on every read. A missing optional service is not a
7
- * permanent capability loss: it may mount after this service initializes, and
8
- * the next read must see it.
4
+ * The concrete `EvolutionPlatform` service lives in
5
+ * `@lmzhen/dsh-evolution-adapter`; core runtime still mounts it while P0
6
+ * keeps the existing composition order.
7
+ *
8
+ * @module @lmzhen/dsh-evolution-core/runtime/platform
9
9
  */
10
- import { Service } from '@deepseek-ai/cordis';
11
- import { agentsPort } from "../platform/agents.js";
12
- import { commandsPort } from "../platform/commands.js";
13
- import { settingsPort } from "../platform/settings.js";
14
- import { profileContextPort } from "../platform/profileContext.js";
15
- import { pluginManagerPort, pluginInventoryPort, configEditorPort } from "../platform/platformView.js";
16
- import { workingDirectoryPort } from "../platform/workingDirectory.js";
17
- import { skillsPort } from "../platform/skills.js";
18
- import { storageDomainPort } from "../platform/storageDomain.js";
19
- import { connectionPort } from "../platform/connection.js";
20
- import { systemPromptPort } from "../platform/systemPrompt.js";
21
- import { subagentsPort } from "../platform/subagents.js";
22
- import { userQuestionsPort } from "../platform/userQuestions.js";
23
- import { presetsPort } from "../platform/presets.js";
24
- import { projectionPort } from "../platform/projections.js";
25
- import { toolsPort } from "../platform/tools.js";
26
- import { llmPort } from "../platform/llm.js";
27
- /** Domain service owning the host port table. */
28
- export class EvolutionPlatform extends Service {
29
- static inject = [];
30
- constructor(ctx) {
31
- super(ctx, 'evolutionPlatform');
32
- }
33
- /**
34
- * Resolve the host ports now. Consumers read this one table; they never fall
35
- * back to a direct platform import (the second resolution D7 removed).
36
- * Deliberately uncached: `ctx.get` is the capability lifecycle.
37
- */
38
- get ports() {
39
- return {
40
- agents: agentsPort(this.ctx),
41
- connection: connectionPort(this.ctx),
42
- settings: settingsPort(this.ctx),
43
- storageDomain: storageDomainPort(this.ctx),
44
- workingDirectory: workingDirectoryPort(this.ctx),
45
- pluginManager: pluginManagerPort(this.ctx),
46
- pluginInventory: pluginInventoryPort(this.ctx),
47
- configEditor: configEditorPort(this.ctx),
48
- profileContext: profileContextPort(this.ctx),
49
- skills: skillsPort(this.ctx),
50
- commands: commandsPort(this.ctx),
51
- systemPrompt: systemPromptPort(this.ctx),
52
- subagents: subagentsPort(this.ctx),
53
- userQuestions: userQuestionsPort(this.ctx),
54
- projections: projectionPort(this.ctx),
55
- llm: llmPort(this.ctx),
56
- tools: toolsPort(this.ctx),
57
- presets: presetsPort(this.ctx),
58
- };
59
- }
60
- /** Whether an exact live root agent is available for this id. */
61
- isRootAgent(agent) {
62
- return this.ports.agents?.isRoot(agent) === true;
63
- }
64
- }
10
+ export { EvolutionPlatform } from '@lmzhen/dsh-evolution-adapter/service';
65
11
  //# sourceMappingURL=platform.js.map
@@ -1,15 +1,14 @@
1
1
  import { warnIfFamilyMixed } from "./coherence.js";
2
2
  import { EvolutionLlm } from "./llm.js";
3
- import { EvolutionPlatform } from "./platform.js";
4
3
  import { EvolutionProjections } from "./projections.js";
4
+ import { installMinimalPresetGuard } from "./minimal-preset.js";
5
5
  export const name = 'evolution-core-runtime';
6
6
  /** @param ctx - the composition context that owns the runtime services. */
7
7
  export async function apply(ctx) {
8
- // Ports resolve from the platform service now, so the platform must be mounted
9
- // before the consumers initialize; sequential plugin mounts make that order real.
10
- await ctx.plugin(EvolutionPlatform);
8
+ // The adapter row owns `evolutionPlatform` and mounts before this row.
11
9
  await ctx.plugin(EvolutionProjections);
12
10
  await ctx.plugin(EvolutionLlm);
11
+ installMinimalPresetGuard(ctx);
13
12
  warnIfFamilyMixed(ctx);
14
13
  }
15
14
  //# sourceMappingURL=plugin.js.map
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { Service } from '@deepseek-ai/cordis';
8
8
  import type { Context } from '@deepseek-ai/cordis';
9
- import { type Session } from '../platform/index.ts';
9
+ import type { Session } from '@lmzhen/dsh-evolution-platform-contract';
10
10
  import { type EvolutionActivityState, type EvolutionEvidenceState, type EvolutionProjectionHistoryState, type EvolutionReadsState, type EvolutionSignalsState } from '../session-projection.ts';
11
11
  /** Domain service owning the family's projection registrations. */
12
12
  export declare class EvolutionProjections extends Service {
@@ -1,4 +1,4 @@
1
- import { scopeOf } from "./platform/index.js";
1
+ import { scopeOf } from '@lmzhen/dsh-evolution-adapter/values';
2
2
  export function callingScope(ctx, held) {
3
3
  if (held !== undefined)
4
4
  return held;
@@ -1,5 +1,5 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
- import type { EvolutionProjectionDefinition, Session } from './platform/index.ts';
2
+ import type { EvolutionProjectionDefinition, Session } from '@lmzhen/dsh-evolution-platform-contract';
3
3
  import { type EvidenceIndex } from './evidence.ts';
4
4
  import { type TurnFoldState, type TurnSignals } from './signals.ts';
5
5
  /** Time of the newest event folded for one session; 0 for a log with no event. */
@@ -5,8 +5,14 @@
5
5
  * is spent. `turn/end` calls `observeEvent`; the returned review kind is
6
6
  * accumulated until a configured interval fires.
7
7
  */
8
- import type { SessionEvent } from './platform/index.ts';
8
+ import type { SessionEvent } from '@lmzhen/dsh-evolution-platform-contract';
9
9
  export type ReviewKind = 'memory' | 'skill' | 'combined';
10
+ /** Review work due at one turn boundary. The delivery channel decides whether
11
+ * to combine memory/skill (foreground) or schedule them independently (aux). */
12
+ export interface ReviewDebt {
13
+ readonly memory: boolean;
14
+ readonly skill: boolean;
15
+ }
10
16
  export interface SignalConfig {
11
17
  memoryInterval: number;
12
18
  skillInterval: number;
@@ -67,7 +73,7 @@ export declare function foldTurnEvent(state: TurnFoldState, event: SessionEvent)
67
73
  */
68
74
  export declare function observeEvent(signal: TurnSignals, event: SessionEvent): void;
69
75
  /** Compute review cadence after `turn/end`. */
70
- export declare function advanceReview(state: ReviewState, turn: number, signal: TurnSignals, config: SignalConfig): ReviewKind | null;
76
+ export declare function advanceReview(state: ReviewState, turn: number, signal: TurnSignals, config: SignalConfig): ReviewDebt | null;
71
77
  /**
72
78
  * Fold a log slice into one turn window, purely.
73
79
  *
@@ -160,28 +160,17 @@ export function advanceReview(state, turn, signal, config) {
160
160
  state.turnsSinceSkill += signal.skillSignal ? 1 : Math.max(1, signal.toolCalls);
161
161
  const memoryDue = state.turnsSinceMemory >= config.memoryInterval;
162
162
  const skillDue = state.turnsSinceSkill >= config.skillInterval;
163
+ if (!memoryDue && !skillDue)
164
+ return null;
163
165
  // 0.3.40: with resetOnFire=false the counters stay monotonic — the caller
164
- // resets them at its injection point (the counting window is inject→inject).
165
- const zero = () => {
166
- state.turnsSinceMemory = 0;
167
- state.turnsSinceSkill = 0;
168
- };
169
- if (memoryDue && skillDue) {
170
- if (config.resetOnFire !== false)
171
- zero();
172
- return 'combined';
173
- }
174
- if (memoryDue) {
175
- if (config.resetOnFire !== false)
166
+ // resets them at its consumption point (the counting window is consume→consume).
167
+ if (config.resetOnFire !== false) {
168
+ if (memoryDue)
176
169
  state.turnsSinceMemory = 0;
177
- return 'memory';
178
- }
179
- if (skillDue) {
180
- if (config.resetOnFire !== false)
170
+ if (skillDue)
181
171
  state.turnsSinceSkill = 0;
182
- return 'skill';
183
172
  }
184
- return null;
173
+ return { memory: memoryDue, skill: skillDue };
185
174
  }
186
175
  /**
187
176
  * Fold a log slice into one turn window, purely.
@@ -97,11 +97,48 @@ export interface SkillStatsGovernance {
97
97
  readonly mode: string | null;
98
98
  readonly resultRef: string | null;
99
99
  }
100
+ /** One recent automatic review, as the activity sidecar records it. */
101
+ export interface SkillStatsReview {
102
+ readonly reviewId: string;
103
+ readonly kind: 'memory' | 'skill' | 'combined';
104
+ readonly status: 'completed' | 'partial' | 'failed' | 'timeout' | 'aborted';
105
+ readonly startedAt: number;
106
+ readonly finishedAt: number;
107
+ readonly partialReason?: string;
108
+ readonly hitRoundLimit?: boolean;
109
+ readonly requests?: number;
110
+ readonly toolCalls?: number;
111
+ readonly waitCount?: number;
112
+ readonly toolMode?: 'native' | 'ptc';
113
+ readonly preset?: string;
114
+ readonly report?: {
115
+ readonly summary: string;
116
+ readonly memoryChanged: boolean;
117
+ readonly skillsChanged: readonly string[];
118
+ readonly unresolved: readonly string[];
119
+ };
120
+ }
121
+ /** Library-wide automatic-review health summary; absent when no reviews are retained. */
122
+ export interface SkillStatsReviewSummary {
123
+ readonly total: number;
124
+ readonly completed: number;
125
+ readonly partial: number;
126
+ readonly timeout: number;
127
+ readonly failed: number;
128
+ readonly aborted: number;
129
+ readonly hitRoundLimit: number;
130
+ readonly avgRequests: number | null;
131
+ readonly avgToolCalls: number | null;
132
+ }
100
133
  /** Library-wide facts. These never belong in a single-skill detail view. */
101
134
  export interface SkillStatsGlobal {
102
135
  readonly totals: SkillStatsTotals;
103
136
  readonly counts: SkillStatsCounts | null;
104
137
  readonly governance: readonly SkillStatsGovernance[];
138
+ /** Recent automatic reviews; absent means this deployment did not report them. */
139
+ readonly reviews?: readonly SkillStatsReview[];
140
+ /** Health summary over all retained reviews; absent when none are retained. */
141
+ readonly reviewSummary?: SkillStatsReviewSummary;
105
142
  /** Label keys for the three success counters; the browser never imports core runtime. */
106
143
  readonly operations?: readonly {
107
144
  readonly id: SkillOperationId;
@@ -4,7 +4,7 @@
4
4
  * handle owns the continuation lifecycle and the end-event wait.
5
5
  */
6
6
  import type { Context } from '@deepseek-ai/cordis';
7
- import type { Agent, ContentBlock, SessionId, SubagentStopReason } from '../platform/index.ts';
7
+ import type { Agent, ContentBlock, SessionId, SubagentStopReason } from '@lmzhen/dsh-evolution-platform-contract';
8
8
  export interface ActivationResultLike {
9
9
  readonly output?: unknown;
10
10
  readonly structured?: unknown;
@@ -1,7 +1,7 @@
1
- import type { Agent, AgentIdentity, AgentOptions } from '../platform/index.ts';
2
- import type { SessionId } from '../platform/index.ts';
3
- import type { SubagentStopReason } from '../platform/index.ts';
4
- import type { ObjectJsonSchema } from '../platform/index.ts';
1
+ import type { Agent, AgentIdentity, AgentOptions } from '@lmzhen/dsh-evolution-platform-contract';
2
+ import type { SessionId } from '@lmzhen/dsh-evolution-platform-contract';
3
+ import type { SubagentStopReason } from '@lmzhen/dsh-evolution-platform-contract';
4
+ import type { ObjectJsonSchema } from '@lmzhen/dsh-evolution-platform-contract';
5
5
  export type ChannelCode = 'E-323' | 'E-324';
6
6
  export type ChannelKind = 'reviewer' | 'maintainer' | 'governance';
7
7
  export interface PresetStatus {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-core",
3
3
  "description": "Shared stores, prompts, signals and lifecycle logic for the dsh-evolution plugin family (community build)",
4
- "version": "0.57.0",
4
+ "version": "0.59.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -34,10 +34,6 @@
34
34
  "types": "./lib/types/runtime/plugin.d.ts",
35
35
  "default": "./lib/runtime/plugin.js"
36
36
  },
37
- "./platform": {
38
- "types": "./lib/types/platform/index.d.ts",
39
- "default": "./lib/platform/index.js"
40
- },
41
37
  "./restrictor": {
42
38
  "types": "./lib/types/restrictor.d.ts",
43
39
  "default": "./lib/restrictor.js"
@@ -98,43 +94,22 @@
98
94
  ],
99
95
  "license": "MIT",
100
96
  "dependencies": {
101
- "@deepseek-ai/dsh-atomic-write": "^0.2.2-rc.5",
102
97
  "js-yaml": "^4.1.0",
103
98
  "yaml": "^2.4.2",
104
99
  "zod": "^4.4.3",
105
- "@deepseek-ai/schemastery": "^3.18.5"
100
+ "@deepseek-ai/schemastery": "^3.18.5",
101
+ "@lmzhen/dsh-evolution-adapter": "0.59.0",
102
+ "@lmzhen/dsh-evolution-platform-contract": "0.59.0"
106
103
  },
107
104
  "peerDependencies": {
108
- "@deepseek-ai/cordis": "^4.0.5",
109
- "@deepseek-ai/dsh-scope": "^0.2.2-rc.5",
110
- "@deepseek-ai/dsh-session": "^0.2.2-rc.5",
111
- "@deepseek-ai/dsh-skill": "^0.2.2-rc.5",
112
- "@deepseek-ai/dsh-session-projection": "^0.2.2-rc.5",
113
- "@deepseek-ai/dsh-agent": "^0.2.2-rc.5",
114
- "@deepseek-ai/dsh-subagent": "^0.2.2-rc.5",
115
- "@deepseek-ai/dsh-tools": "^0.2.2-rc.5",
116
- "@deepseek-ai/dsh-commands": "^0.2.2-rc.5",
117
- "@deepseek-ai/dsh-llm": "^0.2.2-rc.5",
118
- "@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.5",
119
- "@deepseek-ai/dsh-storage-domain": "^0.2.2-rc.5"
105
+ "@deepseek-ai/cordis": "^4.0.5"
120
106
  },
121
107
  "devDependencies": {
122
108
  "@deepseek-ai/cordis": "^4.0.5",
123
- "@deepseek-ai/dsh-scope": "^0.2.2-rc.5",
124
- "@deepseek-ai/dsh-session": "^0.2.2-rc.5",
125
- "@deepseek-ai/dsh-skill": "^0.2.2-rc.5",
126
- "@deepseek-ai/dsh-session-projection": "^0.2.2-rc.5",
127
- "@deepseek-ai/dsh-agent": "^0.2.2-rc.5",
128
- "@deepseek-ai/dsh-subagent": "^0.2.2-rc.5",
129
- "@deepseek-ai/dsh-tools": "^0.2.2-rc.5",
130
109
  "@types/js-yaml": "^4.0.9",
131
- "js-yaml": "^4.1.0",
132
- "@deepseek-ai/dsh-commands": "^0.2.2-rc.5",
133
- "@deepseek-ai/dsh-llm": "^0.2.2-rc.5",
134
- "@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.5",
135
- "@deepseek-ai/dsh-storage-domain": "^0.2.2-rc.5"
110
+ "js-yaml": "^4.1.0"
136
111
  },
137
112
  "engines": {
138
- "dsh": ">=0.2.2-rc.5 <0.2.3-0"
113
+ "dsh": "0.2.2-rc.5"
139
114
  }
140
115
  }
@@ -1,28 +0,0 @@
1
- import { err, ok } from "./result.js";
2
- //#region lib/types/platform/connection.js
3
- const REGISTER_REQUIRED = "connection.fetch.register() is required to register family host routes (platform >= 0.2.2-rc.1); no fallback admission path exists";
4
- /** Resolve the connection port; undefined means the host has no connection service. */
5
- function connectionPort(ctx) {
6
- const connection = ctx.get("connection");
7
- if (connection === void 0) return void 0;
8
- const register = (route) => {
9
- if (connection.fetch === void 0 || typeof connection.fetch.register !== "function") throw new Error(REGISTER_REQUIRED);
10
- return connection.fetch.register.call(connection.fetch, route);
11
- };
12
- return {
13
- allowsRemoteAuthorities: connection.allowsRemoteAuthorities === true,
14
- register,
15
- tryRegister: (route) => {
16
- try {
17
- return ok(register(route));
18
- } catch (error) {
19
- return err({
20
- code: "E-325",
21
- message: error instanceof Error ? error.message : String(error)
22
- });
23
- }
24
- }
25
- };
26
- }
27
- //#endregion
28
- export { connectionPort as t };
@@ -1,5 +0,0 @@
1
- import { t as connectionPort } from "../connection-DAJy7Xjm.js";
2
- import { C as configEditorPort, D as commandsPort, E as profileContextPort, S as workingDirectoryPort, T as pluginManagerPort, _ as agentsPort, a as createUserMessage, b as storageDomainPort, c as domainTable, d as EvolutionLlmError, f as llmPort, g as subagentsPort, h as userQuestionsPort, i as createToolResultMessage, l as escapeText, m as projectionPort, n as DomainError, o as defineDomain, p as modelRoute, r as SessionId, s as defineTool, t as BlockAssembler, u as scopeOf, v as systemPromptPort, w as pluginInventoryPort, x as skillsPort, y as settingsPort } from "../platform-UL-djjz9.js";
3
- import { t as presetsPort } from "../presets-C8vuCuNA.js";
4
- import { n as toolsPort, t as registerEvolutionTool } from "../tools-BrUswg8v.js";
5
- export { BlockAssembler, DomainError, EvolutionLlmError, SessionId, agentsPort, commandsPort, configEditorPort, connectionPort, createToolResultMessage, createUserMessage, defineDomain, defineTool, domainTable, escapeText, llmPort, modelRoute, pluginInventoryPort, pluginManagerPort, presetsPort, profileContextPort, projectionPort, registerEvolutionTool, scopeOf, settingsPort, skillsPort, storageDomainPort, subagentsPort, systemPromptPort, toolsPort, userQuestionsPort, workingDirectoryPort };