@lmzhen/dsh-evolution-core 0.44.0 → 0.45.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 (62) hide show
  1. package/lib/authority-plugin.js +14 -0
  2. package/lib/composition/index.js +2 -2
  3. package/lib/{composition-CVafrlEw.js → composition-Da8NfRI7.js} +2 -2
  4. package/lib/contract.js +1 -0
  5. package/lib/index.js +54 -133
  6. package/lib/{mutations-jUuOPaCn.js → io-AmUf4lVY.js} +54 -84
  7. package/lib/io-node.js +24 -0
  8. package/lib/io-registry.js +96 -0
  9. package/lib/mutation-authority-DeJ_Wz14.js +537 -0
  10. package/lib/mutations-DwvbjRHF.js +75 -0
  11. package/lib/numeric-DLeLvvGb.js +324 -0
  12. package/lib/platform/index.js +1 -1
  13. package/lib/{platform-B06_h8t-.js → platform-CFA12Jam.js} +36 -19
  14. package/lib/policy.js +99 -0
  15. package/lib/runtime/plugin.js +8 -1
  16. package/lib/{skill-health-BLGZTIv8.js → skill-health-D1pZGk5V.js} +6 -835
  17. package/lib/{skill-history-_Cssts5o.js → skill-history-CjypdYqv.js} +2 -1
  18. package/lib/skills.js +6 -3
  19. package/lib/subagent/index.js +1 -1
  20. package/lib/types/authority-plugin.d.ts +12 -0
  21. package/lib/types/authority-plugin.js +10 -0
  22. package/lib/types/authority.d.ts +96 -0
  23. package/lib/types/authority.js +237 -0
  24. package/lib/types/contract.d.ts +116 -0
  25. package/lib/types/contract.js +10 -0
  26. package/lib/types/events.d.ts +2 -2
  27. package/lib/types/home-fence.d.ts +25 -17
  28. package/lib/types/home-fence.js +42 -92
  29. package/lib/types/index.d.ts +2 -2
  30. package/lib/types/index.js +2 -2
  31. package/lib/types/io-node.d.ts +15 -0
  32. package/lib/types/io-node.js +36 -0
  33. package/lib/types/io-registry.d.ts +71 -0
  34. package/lib/types/io-registry.js +126 -0
  35. package/lib/types/io.d.ts +29 -2
  36. package/lib/types/io.js +50 -9
  37. package/lib/types/journal-protocol.d.ts +35 -0
  38. package/lib/types/journal-protocol.js +29 -0
  39. package/lib/types/lease-store.d.ts +1 -1
  40. package/lib/types/mutation-unit.d.ts +1 -1
  41. package/lib/types/params.d.ts +2 -16
  42. package/lib/types/params.js +6 -44
  43. package/lib/types/platform/llm.js +4 -1
  44. package/lib/types/platform/projections.d.ts +10 -4
  45. package/lib/types/platform/projections.js +34 -17
  46. package/lib/types/platform-services.d.ts +2 -2
  47. package/lib/types/policy.d.ts +68 -0
  48. package/lib/types/policy.js +161 -0
  49. package/lib/types/run-registry.d.ts +2 -2
  50. package/lib/types/runtime/projections.js +12 -0
  51. package/lib/types/state-store.d.ts +1 -1
  52. package/lib/types/state-store.js +1 -1
  53. package/lib/types/store-ledger.js +2 -2
  54. package/lib/types/write-inventory.js +3 -1
  55. package/lib/write.js +2 -2
  56. package/package.json +25 -4
  57. package/persisted-write-inventory.json +10 -37
  58. package/lib/types/home-owner.d.ts +0 -4
  59. package/lib/types/home-owner.js +0 -37
  60. package/lib/types/tree-lock.d.ts +0 -54
  61. package/lib/types/tree-lock.js +0 -127
  62. package/lib/{ensure-BjToTMMj.js → ensure-C5Mo1dbB.js} +1 -1
@@ -138,24 +138,10 @@ export interface ParamExposure {
138
138
  * (live); E2 = resource or identity knob that stays with the deployment.
139
139
  */
140
140
  export declare const PARAM_EXPOSURE: readonly ParamExposure[];
141
- /**
142
- * Register one family row's user layer on the platform settings service.
143
- *
144
- * The 0.2.x platform no longer turns a plugin Config into a settings section implicitly:
145
- * every row that exposes a card must call `settings.register` with its Loader entry id.
146
- * The owner argument is the row id, which is also the namespace the generated card binds.
147
- * @param ctx - host plugin context.
148
- * @param owner - Loader entry id / settings namespace.
149
- * @param schema - the row's Config schema (schemastery).
150
- */
151
- export declare function registerOwnerSettings(ctx: {
152
- inject?: (names: readonly string[], callback: (scope: unknown) => void) => unknown;
153
- }, owner: string, schema: unknown): void;
154
141
  /** The settings namespace each OWNER PACKAGE registers (design §7.2).
155
142
  *
156
- * Keyed by owner rather than by group because a namespace has exactly one
157
- * registrant (the platform refuses a second registration of the same name),
158
- * while a group may span packages — group 'memory' is served by memory-files and
143
+ * Keyed by owner rather than by group: a namespace is the settings card's scope (served by the
144
+ * platform's configForms), while a group may span packages — group 'memory' is served by memory-files and
159
145
  * tool-memory, each owning its own section. A package without an entry has no
160
146
  * user layer (its knobs stay deployment-only). */
161
147
  export declare const PARAM_NAMESPACES: Readonly<Record<string, string>>;
@@ -108,12 +108,7 @@ export const PARAM_EXPOSURE = Object.freeze([
108
108
  { id: 'reviewMode', group: 'review', tier: 'E3', authority: 'cordis', owner: 'evolution-review', applies: 'live', docAnchor: 'PARAMETERS.md#review', summary: 'Run the review in the plugin-owned auxiliary loop (aux), or as a parent-session turn (inject; debugging only).', label: '运行位置', hint: '默认在插件内辅助审查;inject 仅用于调试,会把审查写入当前会话。', control: 'select', unit: '', values: 'aux|inject', valueLabels: '插件内辅助|当前会话(调试)', card: 'evolution-review' },
109
109
  { id: 'reviewWakeInject', group: 'review', tier: 'E3', authority: 'cordis', owner: 'evolution-review', applies: 'live', docAnchor: 'PARAMETERS.md#review', summary: 'Deliver the deferred review as a waking follow-up message.', label: '延后结果发提醒', hint: '会话空闲时,把延后的检查结果作为一条提醒发给你。', control: 'switch', unit: '', values: '', card: 'evolution-review' },
110
110
  { id: 'reviewNotice', group: 'review', tier: 'E3', authority: 'cordis', owner: 'evolution-review', applies: 'live', docAnchor: 'PARAMETERS.md#review', summary: 'Deliver result notices into the parent conversation for inject mode; aux results are audit-only.', label: '结果通知', hint: 'inject 调试模式下才把结果写进对话;aux 结果只进审计记录,始终不写对话。', control: 'switch', unit: '', values: '', card: 'evolution-review' },
111
- { id: 'reviewProvider', group: 'review', tier: 'E2', authority: 'cordis', owner: 'evolution-review', applies: 'none', docAnchor: 'PARAMETERS.md#review', summary: 'LLM provider for review subagents (deployment identity).', why: 'identity' },
112
111
  { id: 'reviewTimeoutMs', group: 'review', tier: 'E2', authority: 'cordis', owner: 'evolution-review', applies: 'none', docAnchor: 'PARAMETERS.md#review', summary: 'Bound on one review subagent run and its write leg.', why: 'internal' },
113
- { id: 'reviewContextMessages', group: 'review', tier: 'E2', authority: 'cordis', owner: 'evolution-review', applies: 'none', docAnchor: 'PARAMETERS.md#review', summary: 'Messages of context handed to a review subagent.', why: 'internal' },
114
- { id: 'reviewMessageChars', group: 'review', tier: 'E2', authority: 'cordis', owner: 'evolution-review', applies: 'none', docAnchor: 'PARAMETERS.md#review', summary: 'Per-message character budget of the review context.', why: 'internal' },
115
- { id: 'reviewMaxDepth', group: 'review', tier: 'E2', authority: 'cordis', owner: 'evolution-review', applies: 'none', docAnchor: 'PARAMETERS.md#review', summary: 'Absolute delegation-depth cap of the review subagent.', why: 'internal' },
116
- { id: 'reviewToolAllow', group: 'review', tier: 'E2', authority: 'cordis', owner: 'evolution-review', applies: 'none', docAnchor: 'PARAMETERS.md#review', summary: 'Tools the review subagent may use (safety surface).', why: 'security' },
117
112
  { id: 'skillContentChars', group: 'write-caps', tier: 'E3', authority: 'cordis', owner: 'tool-skill-manage', applies: 'live', docAnchor: 'PARAMETERS.md#write-caps', summary: 'Character cap on a SKILL.md body (tighten-only).', label: '技能文件正文上限', hint: '技能 Markdown 正文最多多少字符(只能调小,不能超过出厂上限)。', control: 'number', unit: '字符', values: '', card: 'tool-skill-manage' },
118
113
  { id: 'maxSkillFileBytes', group: 'write-caps', tier: 'E3', authority: 'cordis', owner: 'tool-skill-manage', applies: 'live', docAnchor: 'PARAMETERS.md#write-caps', summary: 'Byte cap on one support file (tighten-only).', label: '附带文件大小上限', hint: '技能附带文件单个最大多少字节(只能调小,不能超过出厂上限)。', control: 'number', unit: '字节', values: '', card: 'tool-skill-manage' },
119
114
  { id: 'maxSkillNameLength', group: 'write-caps', tier: 'E3', authority: 'cordis', owner: 'tool-skill-manage', applies: 'live', docAnchor: 'PARAMETERS.md#write-caps', summary: 'Character cap on a skill name (tighten-only).', label: '技能名长度上限', hint: '技能名最多多少字符(只能调小)。', control: 'number', unit: '字符', values: '', card: 'tool-skill-manage' },
@@ -150,7 +145,7 @@ export const PARAM_EXPOSURE = Object.freeze([
150
145
  { id: 'bootGraceSeconds', group: 'curator', tier: 'E2', authority: 'cordis', owner: 'evolution-curator', applies: 'none', docAnchor: 'PARAMETERS.md#curator', summary: 'Grace period before the first automatic pass after a restart.', why: 'internal' },
151
146
  { id: 'curatorProvider', group: 'curator', tier: 'E2', authority: 'cordis', owner: 'evolution-curator', applies: 'none', docAnchor: 'PARAMETERS.md#curator', summary: 'LLM provider for curator reviews (deployment identity).', why: 'identity' },
152
147
  { id: 'curatorModel', group: 'curator', tier: 'E2', authority: 'cordis', owner: 'evolution-curator', applies: 'none', docAnchor: 'PARAMETERS.md#curator', summary: 'Model for curator reviews (deployment identity).', why: 'identity' },
153
- { id: 'protectedSkillNames', group: 'library', tier: 'E2', authority: 'cordis', owner: 'evolution-curator', applies: 'none', docAnchor: 'PARAMETERS.md#library', summary: 'Skills the lifecycle never archives or rewrites.', why: 'deployment' },
148
+ { id: 'protectedSkillNames', group: 'library', tier: 'E2', authority: 'cordis', owner: 'evolution-core', applies: 'none', docAnchor: 'PARAMETERS.md#library', summary: 'Skills the lifecycle never archives or rewrites.', why: 'deployment' },
154
149
  { id: 'manageUnmanaged', group: 'library', tier: 'E2', authority: 'cordis', owner: 'evolution-curator', applies: 'none', docAnchor: 'PARAMETERS.md#library', summary: 'Let curation touch skills with no family metadata.', why: 'deployment' },
155
150
  { id: 'pruneBuiltins', group: 'library', tier: 'E2', authority: 'cordis', owner: 'evolution-curator', applies: 'none', docAnchor: 'PARAMETERS.md#library', summary: 'Let curation nominate bundled skills for pruning.', why: 'deployment' },
156
151
  { id: 'referencedSkillNames', group: 'library', tier: 'E2', authority: 'cordis', owner: 'evolution-curator', applies: 'none', docAnchor: 'PARAMETERS.md#library', summary: 'Names treated as referenced by external docs (never retired).', why: 'deployment' },
@@ -172,7 +167,6 @@ export const PARAM_EXPOSURE = Object.freeze([
172
167
  { id: 'evolution-learning-graph.root', group: 'deployment', tier: 'E1', authority: 'cordis', owner: 'evolution-learning-graph', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Skill-tree root the learning graph reads.', why: 'path' },
173
168
  { id: 'skill-usage.root', group: 'deployment', tier: 'E1', authority: 'cordis', owner: 'skill-usage', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Skill-tree root the usage store observes.', why: 'path' },
174
169
  { id: 'skill-usage.eventsHome', group: 'deployment', tier: 'E1', authority: 'cordis', owner: 'skill-usage', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Directory holding the family event log the usage store reads.', why: 'path' },
175
- { id: 'evolution-state-json.root', group: 'deployment', tier: 'E1', authority: 'cordis', owner: 'evolution-state-json', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Directory holding the JSON state store.', why: 'path' },
176
170
  { id: 'memory-files.root', group: 'deployment', tier: 'E1', authority: 'cordis', owner: 'memory-files', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Directory holding MEMORY.md and USER.md (empty = $DSH_HOME/memories).', why: 'path' },
177
171
  { id: 'evolution-feedback.path', group: 'deployment', tier: 'E1', authority: 'cordis', owner: 'evolution-feedback', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Event log the feedback scorer reads (empty = family events file).', why: 'path' },
178
172
  { id: 'evolution-state.provider', group: 'deployment', tier: 'E2', authority: 'cordis', owner: 'evolution-state', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Registered state-store provider name.', why: 'identity' },
@@ -197,55 +191,23 @@ export const PARAM_EXPOSURE = Object.freeze([
197
191
  { id: 'evolution-maintenance.probeTimeoutMs', group: 'deployment', tier: 'E2', authority: 'cordis', owner: 'evolution-maintenance', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Model-facing budget of one maintenance_probe call — a hang guard, not a latency budget.', why: 'internal' },
198
192
  { id: 'skill-usage.supportReadToolNames', group: 'deployment', tier: 'E2', authority: 'cordis', owner: 'skill-usage', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Tool names whose file reads are attributed to support files.', why: 'internal' },
199
193
  { id: 'install.mode', group: 'deployment', tier: 'E4', authority: 'install', owner: 'scripts', applies: 'restart', docAnchor: 'PARAMETERS.md#deployment', summary: 'Install target plane (values all / host; the legacy layered preset path is internal-only).', why: 'install' },
200
- { id: 'install.basePreset', group: 'deployment', tier: 'E4', authority: 'install', owner: 'scripts', applies: 'restart', docAnchor: 'PARAMETERS.md#deployment', summary: 'Agent-preset base the layered install composes from (--base).', why: 'install' },
194
+ { id: 'install.basePreset', group: 'deployment', tier: 'E4', authority: 'install', owner: 'scripts', applies: 'restart', docAnchor: 'PARAMETERS.md#deployment', summary: 'Agent-preset base the layered install composes from (--base).', why: 'install', consumer: 'basePresetPlugins' },
201
195
  { id: 'install.home', group: 'deployment', tier: 'E4', authority: 'install', owner: 'scripts', applies: 'restart', docAnchor: 'PARAMETERS.md#deployment', summary: 'Harness home the installer writes into (--home).', why: 'install' },
202
- { id: 'install.presetRowOverrides', group: 'deployment', tier: 'E4', authority: 'install', owner: 'scripts', applies: 'restart', docAnchor: 'PARAMETERS.md#deployment', summary: 'Preset row overrides the installer injects (row-overrides.json).', why: 'install' },
203
- { id: 'timeout.gateDefault', group: 'deployment', tier: 'E2', authority: 'install', owner: 'scripts', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Gate budget: the vitest --testTimeout the gate table and the CI step carry (the number lives in testing-policy.timeouts).', why: 'internal' },
204
- { id: 'timeout.specDefault', group: 'deployment', tier: 'E2', authority: 'install', owner: 'scripts', applies: 'none', docAnchor: 'PARAMETERS.md#deployment', summary: 'Local spec budget: the vitest testTimeout the family config generates per leaf tier (the number lives in testing-policy.timeouts).', why: 'internal' },
196
+ { id: 'install.presetRowOverrides', group: 'deployment', tier: 'E4', authority: 'install', owner: 'scripts', applies: 'restart', docAnchor: 'PARAMETERS.md#deployment', summary: 'Preset row overrides the installer injects (row-overrides.json).', why: 'install', consumer: 'loadRowOverrides' },
205
197
  { id: 'mergeApproval', group: 'merge', tier: 'E3', authority: 'cordis', owner: 'evolution-merge', applies: 'live', docAnchor: 'PARAMETERS.md#merge', summary: 'Pause after round 1 and put the pair in the pending queue instead of authoring round 2 automatically.', label: '合并审批', hint: '开启后,第一轮判定完先停下、进入待批准清单;关闭则直接进入第二轮合并。', control: 'switch', unit: '', values: '', card: 'evolution-merge' },
206
198
  { id: 'mergeSkippedTtlDays', group: 'merge', tier: 'E3', authority: 'cordis', owner: 'evolution-merge', applies: 'live', docAnchor: 'PARAMETERS.md#merge', summary: 'Days a skipped pair stays out of screening; 0 means it never expires.', label: '无需合并保留天数', hint: '判定无需合并的对,多少天内不再参与筛选;0 表示一直保留。', control: 'number', unit: '天', values: '', card: 'evolution-merge' },
207
199
  { id: 'mergeRunTimeoutMinutes', group: 'merge', tier: 'E3', authority: 'cordis', owner: 'evolution-merge', applies: 'live', docAnchor: 'PARAMETERS.md#merge', summary: 'Wall-clock budget of one merge run; 0 means no limit.', label: '单次运行上限', hint: '一次合并运行最多持续多少分钟;0 表示不设上限。', control: 'number', unit: '分钟', values: '', card: 'evolution-merge' },
208
200
  { id: 'mergePairTimeoutMinutes', group: 'merge', tier: 'E2', authority: 'cordis', owner: 'evolution-merge', applies: 'none', docAnchor: 'PARAMETERS.md#merge', summary: 'Wall-clock budget of one pair round (a stuck child guard).', why: 'internal' },
209
201
  ]);
210
- /**
211
- * Register one family row's user layer on the platform settings service.
212
- *
213
- * The 0.2.x platform no longer turns a plugin Config into a settings section implicitly:
214
- * every row that exposes a card must call `settings.register` with its Loader entry id.
215
- * The owner argument is the row id, which is also the namespace the generated card binds.
216
- * @param ctx - host plugin context.
217
- * @param owner - Loader entry id / settings namespace.
218
- * @param schema - the row's Config schema (schemastery).
219
- */
220
- export function registerOwnerSettings(ctx, owner, schema) {
221
- const register = (scope) => {
222
- const settings = scope.settings;
223
- if (typeof settings?.register !== 'function')
224
- return;
225
- try {
226
- settings.register(owner, schema);
227
- }
228
- catch (error) {
229
- const logger = ctx.logger;
230
- logger?.warn?.(`evolution settings: register(${owner}) failed: ${error instanceof Error ? error.message : String(error)}`);
231
- }
232
- };
233
- const direct = ctx.get?.('settings');
234
- if (direct !== undefined) {
235
- register({ settings: direct });
236
- return;
237
- }
238
- ctx.inject?.(['settings'], register);
239
- }
240
202
  /** The settings namespace each OWNER PACKAGE registers (design §7.2).
241
203
  *
242
- * Keyed by owner rather than by group because a namespace has exactly one
243
- * registrant (the platform refuses a second registration of the same name),
244
- * while a group may span packages — group 'memory' is served by memory-files and
204
+ * Keyed by owner rather than by group: a namespace is the settings card's scope (served by the
205
+ * platform's configForms), while a group may span packages — group 'memory' is served by memory-files and
245
206
  * tool-memory, each owning its own section. A package without an entry has no
246
207
  * user layer (its knobs stay deployment-only). */
247
208
  export const PARAM_NAMESPACES = Object.freeze({
248
209
  'evolution-review': 'evolution-review',
210
+ 'memory': 'memory',
249
211
  'memory-files': 'evolution-memory',
250
212
  'tool-memory': 'evolution-tool-memory',
251
213
  'evolution-curator': 'evolution-curator',
@@ -61,7 +61,10 @@ export function modelRoute(ctx, agent, session) {
61
61
  const owned = agent?.model?.current?.();
62
62
  if (owned !== undefined)
63
63
  return { provider: owned.provider, model: owned.model };
64
- // 0.2.2 modelSelection is client-visible: snapshot() returns lastUsed/next.
64
+ // `sessionProjections.snapshot()` returns the projection's VIEW, not its state: the platform's
65
+ // modelSelection view is `{ lastUsed, next }` where `next` is already `pending ?? lastUsed`
66
+ // (packages/core/agent/src/model-selection.ts, viewSchema/view). Reading the state field `pending` here would
67
+ // always be undefined and silently pin auxiliary calls to `lastUsed`.
65
68
  if (session !== undefined) {
66
69
  const registry = ctx.get('sessionProjections');
67
70
  const value = registry?.snapshot?.(session, ['modelSelection'])?.values?.modelSelection;
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * The session-projection half of the family's host platform boundary.
3
3
  *
4
- * The target 0.2.2 registry returns an awaitable callable-thenable handle;
5
- * the 0.2.1 registry returns a disposer function and reads through
6
- * registry.stateOf. Both forms are adapted here; the legacy branch is deleted
7
- * when platform-line moves to 0.2.2.
4
+ * The platform moved this port from "a disposer plus a registry read" to an awaitable handle. Both
5
+ * are accepted here, and the port NAMES which shape it found: an unrecognised shape used to fall
6
+ * through to the legacy read and return undefined for every unit without an error (audit 06-P1),
7
+ * which reads as "the sessions have no projection data" instead of "this build cannot read them".
8
8
  */
9
9
  import type { Context } from '@deepseek-ai/cordis';
10
10
  import type { ZodType } from 'zod';
@@ -22,7 +22,13 @@ export interface ProjectionHandleLike<S> {
22
22
  stateOf(session: Session): S | undefined;
23
23
  dispose(): Promise<void>;
24
24
  }
25
+ /** Which registration contract the live registry speaks. */
26
+ export type ProjectionPortShape = 'handle' | 'legacy' | 'unrecognised';
25
27
  export interface ProjectionPort {
28
+ /** The shape this port adapted to; `unrecognised` means reads will be empty and why. */
29
+ readonly shape: ProjectionPortShape;
30
+ /** Why the port is `unrecognised`; absent while a usable shape was found. */
31
+ readonly reason?: string | undefined;
26
32
  register<K extends string, S>(definition: EvolutionProjectionDefinition<K, S>): Promise<ProjectionHandleLike<S>>;
27
33
  }
28
34
  /** Resolve the projection port; undefined means the host has no projection registry. */
@@ -1,30 +1,47 @@
1
- function isCallableThenable(value) {
2
- return typeof value === 'function' && typeof value.then === 'function';
3
- }
1
+ const isThenable = (value) =>
2
+ // A callable-thenable is a FUNCTION with \ hen\ (the deprecated shape); a plain Promise is an
3
+ // object. Both must be awaited, or the callable one falls into the legacy branch by accident.
4
+ (typeof value === 'object' || typeof value === 'function') && value !== null && typeof value.then === 'function';
5
+ const isHandle = (value) => value !== null && typeof value === 'object'
6
+ && typeof value.stateOf === 'function'
7
+ && typeof value.dispose === 'function';
4
8
  /** Resolve the projection port; undefined means the host has no projection registry. */
5
9
  export function projectionPort(ctx) {
6
10
  // platform-declaration anchor: sessionProjections is declared in core PLATFORM_SERVICE_PROBES.
7
11
  const registry = ctx.get('sessionProjections');
8
12
  if (registry === undefined)
9
13
  return undefined;
14
+ let shape = 'unrecognised';
15
+ let reason = 'sessionProjections.register has not answered yet';
10
16
  return {
17
+ get shape() { return shape; },
18
+ get reason() { return shape === 'unrecognised' ? reason : undefined; },
11
19
  async register(definition) {
12
20
  const raw = registry.register(definition);
13
- if (isCallableThenable(raw)) {
14
- const resolved = await raw;
15
- if (resolved !== null && typeof resolved === 'object' && typeof resolved.stateOf === 'function') {
16
- const handle = resolved;
17
- return {
18
- stateOf: (session) => handle.stateOf(session),
19
- dispose: () => handle.dispose(),
20
- };
21
- }
21
+ // A callable-thenable and a plain Promise are the same contract from the caller's side.
22
+ const resolved = isThenable(raw) ? await raw : raw;
23
+ if (isHandle(resolved)) {
24
+ shape = 'handle';
25
+ reason = undefined;
26
+ return {
27
+ stateOf: (session) => resolved.stateOf(session),
28
+ dispose: () => resolved.dispose(),
29
+ };
30
+ }
31
+ if (resolved === raw && typeof raw === 'function' && typeof registry.stateOf === 'function') {
32
+ shape = 'legacy';
33
+ reason = undefined;
34
+ return {
35
+ stateOf: (session) => registry.stateOf?.(session, definition.key),
36
+ dispose: async () => { raw(); },
37
+ };
22
38
  }
23
- const dispose = raw;
24
- return {
25
- stateOf: (session) => registry.stateOf?.(session, definition.key),
26
- dispose: async () => { dispose(); },
27
- };
39
+ // Neither contract: keep reads empty, but say so through `shape`/`reason` instead of
40
+ // pretending the units have no data.
41
+ shape = 'unrecognised';
42
+ reason = 'sessionProjections.register returned ' + (resolved === null ? 'null' : typeof resolved)
43
+ + ' with neither a projection handle nor a legacy disposer';
44
+ return { stateOf: () => undefined, dispose: async () => { } };
28
45
  },
29
46
  };
30
47
  }
@@ -11,8 +11,8 @@
11
11
  * `client` probes run in the browser half, where the host has no view of the seats.
12
12
  * @module @lmzhen/dsh-evolution-core
13
13
  */
14
- import type { PlatformServiceProbe } from '@lmzhen/dsh-evolution-contract';
15
- export type { PlatformServiceProbe } from '@lmzhen/dsh-evolution-contract';
14
+ import type { PlatformServiceProbe } from './contract.ts';
15
+ export type { PlatformServiceProbe } from './contract.ts';
16
16
  /** The probes, in service-name order (the guard checks this list against the tree). */
17
17
  export declare const PLATFORM_SERVICE_PROBES: readonly PlatformServiceProbe[];
18
18
  /**
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Immutable evolution policy service.
3
+ * The policy is the control plane. Model plans may not change it.
4
+ * @module @lmzhen/dsh-evolution-core/policy
5
+ */
6
+ import { Service } from '@deepseek-ai/cordis';
7
+ import type { Context as CordisContext } from '@deepseek-ai/cordis';
8
+ import type { Context as HostContext } from '@deepseek-ai/cordis/src/context.ts';
9
+ type Context = CordisContext & HostContext;
10
+ import type Schema from '@deepseek-ai/schemastery';
11
+ import { type ArchiveRetentionPolicy, type CitationPolicy, type ReferenceRewritePolicy, type SupportFileCharPolicy } from './limits.ts';
12
+ declare module '@deepseek-ai/cordis' {
13
+ interface Context {
14
+ evolutionPolicy: EvolutionPolicy;
15
+ }
16
+ }
17
+ export interface PolicySnapshot {
18
+ version: 1;
19
+ reviewMemoryInterval: number;
20
+ reviewSkillInterval: number;
21
+ substantiveMinToolCalls: number;
22
+ substantiveMinUserChars: number;
23
+ substantiveMinAgentChars: number;
24
+ reviewMode: 'inject' | 'aux';
25
+ curatorModel: string;
26
+ memoryChars: number;
27
+ userChars: number;
28
+ skillContentChars: number;
29
+ curatorIntervalHours: number;
30
+ staleAfterDays: number;
31
+ /** Write-behaviour stages (0.5.0, design §16.7) — see the Config schema. */
32
+ citationPolicy: CitationPolicy;
33
+ referenceRewrite: ReferenceRewritePolicy;
34
+ archiveRetention: ArchiveRetentionPolicy;
35
+ supportFileCharPolicy: SupportFileCharPolicy;
36
+ archiveAfterDays: number;
37
+ protectedSkillNames: readonly string[];
38
+ }
39
+ export interface Config {
40
+ reviewMemoryInterval?: number;
41
+ reviewSkillInterval?: number;
42
+ substantiveMinToolCalls?: number;
43
+ substantiveMinUserChars?: number;
44
+ substantiveMinAgentChars?: number;
45
+ reviewMode?: 'inject' | 'aux';
46
+ curatorModel?: string;
47
+ memoryChars?: number;
48
+ userChars?: number;
49
+ skillContentChars?: number;
50
+ curatorIntervalHours?: number;
51
+ staleAfterDays?: number;
52
+ archiveAfterDays?: number;
53
+ protectedSkillNames?: string[];
54
+ citationPolicy?: CitationPolicy;
55
+ referenceRewrite?: ReferenceRewritePolicy;
56
+ archiveRetention?: ArchiveRetentionPolicy;
57
+ supportFileCharPolicy?: SupportFileCharPolicy;
58
+ }
59
+ export declare const Config: Schema<Config>;
60
+ export declare class EvolutionPolicy extends Service {
61
+ static Config: Schema<Config>;
62
+ readonly snapshot: PolicySnapshot;
63
+ constructor(ctx: Context, config?: Config);
64
+ get(): PolicySnapshot;
65
+ guardReason(toolName: string, args: unknown): string | undefined;
66
+ }
67
+ export default EvolutionPolicy;
68
+ //# sourceMappingURL=policy.d.ts.map
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Immutable evolution policy service.
3
+ * The policy is the control plane. Model plans may not change it.
4
+ * @module @lmzhen/dsh-evolution-core/policy
5
+ */
6
+ import { asRecord } from "./guards.js";
7
+ import { Service } from '@deepseek-ai/cordis';
8
+ import { toolsPort } from "./platform/tools.js";
9
+ import z from '@deepseek-ai/schemastery';
10
+ import { DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, FORBIDDEN_CONTROL_KEYS, PROTECTED_BUILTIN_SKILLS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_STALE_AFTER_DAYS, EVOLUTION_WRITE_TOOLS, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_CURATOR_MODEL, } from "./constants.js";
11
+ import { DEFAULT_CITATION_POLICY, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_SUPPORT_FILE_CHAR_POLICY, POLICY_STAGE_DEFAULTS, } from "./limits.js";
12
+ import { clampedNumber } from "./numeric.js";
13
+ export const Config = z.object({
14
+ reviewMemoryInterval: z.number().min(1).default(DEFAULT_REVIEW_MEMORY_INTERVAL),
15
+ reviewSkillInterval: z.number().min(1).default(DEFAULT_REVIEW_SKILL_INTERVAL),
16
+ substantiveMinToolCalls: z.number().min(1).default(DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS),
17
+ substantiveMinUserChars: z.number().min(1).default(DEFAULT_SUBSTANTIVE_MIN_USER_CHARS),
18
+ substantiveMinAgentChars: z.number().min(1).default(DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS),
19
+ // V7-15 (0.3.44): closed union — a typo cannot silently select a fourth
20
+ // behavior. H-03 correction: schemastery REJECTS an unmatching
21
+ // value at LOADER time (the union keeps the config surface closed for
22
+ // config authors); the clamp branch below only covers DIRECT construction
23
+ // / legacy reads that bypass the loader schema. The former "strips an
24
+ // unmatching value" wording was wrong and contradicted the V5-33 comment
25
+ // inside the clamp.
26
+ // 0.3.74: mirrors the review plugin's default (inject) — the policy snapshot
27
+ // overrides the plugin config, so the two defaults must not diverge.
28
+ reviewMode: z.union([z.const('inject'), z.const('aux')]).default('aux'),
29
+ curatorModel: z.string().default(DEFAULT_CURATOR_MODEL),
30
+ memoryChars: z.number().min(1).default(DEFAULT_MEMORY_CHAR_LIMIT),
31
+ userChars: z.number().min(1).default(DEFAULT_USER_CHAR_LIMIT),
32
+ skillContentChars: z.number().min(1).default(DEFAULT_SKILL_CONTENT_CHARS),
33
+ curatorIntervalHours: z.number().min(1).default(DEFAULT_CURATOR_INTERVAL_HOURS),
34
+ staleAfterDays: z.number().min(1).default(DEFAULT_STALE_AFTER_DAYS),
35
+ archiveAfterDays: z.number().min(1).default(DEFAULT_ARCHIVE_AFTER_DAYS),
36
+ protectedSkillNames: z.array(z.string()).default([]),
37
+ // 0.5.0 (§16.7): the four write-behaviour STAGES become deployment policy, so a
38
+ // stage can be switched in cordis.yml instead of by editing a default constant.
39
+ // Closed unions: the cordis loader rejects an unknown value at load, which is the
40
+ // same posture `reviewMode` takes.
41
+ citationPolicy: z.union([z.const('verify'), z.const('refuse')]).default(POLICY_STAGE_DEFAULTS.citationPolicy),
42
+ referenceRewrite: z.union([z.const('off'), z.const('plan'), z.const('apply')]).default(POLICY_STAGE_DEFAULTS.referenceRewrite),
43
+ archiveRetention: z.union([z.const('report'), z.const('prune')]).default(POLICY_STAGE_DEFAULTS.archiveRetention),
44
+ supportFileCharPolicy: z.union([z.const('report'), z.const('enforce')]).default(POLICY_STAGE_DEFAULTS.supportFileCharPolicy),
45
+ });
46
+ export class EvolutionPolicy extends Service {
47
+ static Config = Config;
48
+ snapshot;
49
+ constructor(ctx, config = {}) {
50
+ super(ctx, 'evolutionPolicy');
51
+ // DSH-native monotonic guard: policy denials run after the extensible
52
+ // pre-execute waterfall and cannot be overridden by later listeners.
53
+ // v28 G6.1 (UP-01): the guard function uses the upstream `ToolGuard` type
54
+ // (the same anchor evolution-threat adopted for P2-13) instead of a
55
+ // hand-written structural cast — an upstream contract change now fails
56
+ // this package's compile instead of silently detyping the denial.
57
+ ctx.inject(['tools'], (toolCtx) => {
58
+ const tools = toolsPort(toolCtx);
59
+ if (tools === undefined)
60
+ return;
61
+ toolCtx.effect(() => tools.guard(exec => this.guardReason(exec.name, exec.arguments)), 'evolution-policy.tools-guard');
62
+ });
63
+ // G3.1 (0.3.23): every numeric snapshot field is clamped to at least 1.
64
+ // 0 / negative / NaN / ±Infinity fall back to the shared default (a 0 is
65
+ // never a "disabled" meaning). The schema `.min(1)` rejects 0/negative at
66
+ // config load; this clamp covers NaN/±Infinity (which schemastery lets
67
+ // through) and any value reaching the snapshot outside the schema. Warn
68
+ // once when a user-supplied value had to be corrected.
69
+ const clamped = [];
70
+ const field = (name, value, fallback) => {
71
+ const result = clampedNumber(value, fallback, { min: 1 });
72
+ if (value !== undefined && result !== value)
73
+ clamped.push(name);
74
+ return result;
75
+ };
76
+ this.snapshot = Object.freeze({
77
+ version: 1,
78
+ reviewMemoryInterval: field('reviewMemoryInterval', config.reviewMemoryInterval, DEFAULT_REVIEW_MEMORY_INTERVAL),
79
+ reviewSkillInterval: field('reviewSkillInterval', config.reviewSkillInterval, DEFAULT_REVIEW_SKILL_INTERVAL),
80
+ substantiveMinToolCalls: field('substantiveMinToolCalls', config.substantiveMinToolCalls, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS),
81
+ substantiveMinUserChars: field('substantiveMinUserChars', config.substantiveMinUserChars, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS),
82
+ substantiveMinAgentChars: field('substantiveMinAgentChars', config.substantiveMinAgentChars, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS),
83
+ reviewMode: (() => {
84
+ // V5-33 (0.3.31): an invalid reviewMode string fell silently — the
85
+ // numeric fields beside it all warn once; the string surface got the
86
+ // same posture. V7-15 (0.3.44): the type is a closed union and the
87
+ // cordis loader REJECTS an invalid value at load, so the clamp's
88
+ // mismatch branch is unreachable by construction — the fallback below
89
+ // serves direct construction / legacy reads. 0.3.74: the fallback is
90
+ // 'inject', matching the schema default (only an explicit 'subagent'
91
+ // selects the child-session split).
92
+ return config.reviewMode === 'aux' ? 'aux' : 'inject';
93
+ })(),
94
+ curatorModel: config.curatorModel ?? DEFAULT_CURATOR_MODEL,
95
+ memoryChars: field('memoryChars', config.memoryChars, DEFAULT_MEMORY_CHAR_LIMIT),
96
+ userChars: field('userChars', config.userChars, DEFAULT_USER_CHAR_LIMIT),
97
+ skillContentChars: field('skillContentChars', config.skillContentChars, DEFAULT_SKILL_CONTENT_CHARS),
98
+ curatorIntervalHours: field('curatorIntervalHours', config.curatorIntervalHours, DEFAULT_CURATOR_INTERVAL_HOURS),
99
+ staleAfterDays: field('staleAfterDays', config.staleAfterDays, DEFAULT_STALE_AFTER_DAYS),
100
+ // V5-33 posture applied to the stage unions: the loader already rejects an
101
+ // unknown value, so these branches only serve direct construction / legacy
102
+ // reads that bypass the schema.
103
+ citationPolicy: config.citationPolicy === 'refuse' ? 'refuse' : DEFAULT_CITATION_POLICY,
104
+ referenceRewrite: config.referenceRewrite === 'off' || config.referenceRewrite === 'apply'
105
+ ? config.referenceRewrite
106
+ : DEFAULT_REFERENCE_REWRITE_POLICY,
107
+ archiveRetention: config.archiveRetention === 'prune' ? 'prune' : DEFAULT_ARCHIVE_RETENTION_POLICY,
108
+ supportFileCharPolicy: config.supportFileCharPolicy === 'enforce' ? 'enforce' : DEFAULT_SUPPORT_FILE_CHAR_POLICY,
109
+ archiveAfterDays: field('archiveAfterDays', config.archiveAfterDays, DEFAULT_ARCHIVE_AFTER_DAYS),
110
+ // PLAN S4.2 (2026-09-16): the builtin protected face is the core single
111
+ // source (PROTECTED_BUILTIN_SKILLS — the same set the curator enforces);
112
+ // the inline 'plan' literal here was a second copy that could drift.
113
+ protectedSkillNames: Object.freeze([...new Set([...PROTECTED_BUILTIN_SKILLS, ...(config.protectedSkillNames ?? [])])]),
114
+ });
115
+ if (clamped.length > 0) {
116
+ ctx.logger.warn(`evolution-policy: ${clamped.join(', ')} provided an invalid value; falling back to the default`);
117
+ }
118
+ }
119
+ get() {
120
+ return this.snapshot;
121
+ }
122
+ guardReason(toolName, args) {
123
+ // 0.3.17 (E-28): the forbidden-key list used to be a local copy and only
124
+ // covered the TOP-LEVEL args of a memory call — `operations[]` entries
125
+ // (the atomic-batch shape the threat scanner already treats as real)
126
+ // carried control-plane keys unchecked. Both fixed via the core constant
127
+ // (S3.10) and the inner scan (E-28).
128
+ // 0.3.20 (N-5): the write-tool set is the core single source (was a local
129
+ // hardcoded pair that drifted from the S3.10 constant).
130
+ if (EVOLUTION_WRITE_TOOLS.includes(toolName)) {
131
+ const scan = (candidate) => {
132
+ for (const forbidden of FORBIDDEN_CONTROL_KEYS) {
133
+ if (forbidden in candidate)
134
+ return `evolution-policy: tool call may not mutate ${forbidden}`;
135
+ }
136
+ return undefined;
137
+ };
138
+ const record = asRecord(args);
139
+ // Not a plain mapping ⇒ nothing this scanner knows how to judge.
140
+ if (record === undefined)
141
+ return undefined;
142
+ const top = scan(record);
143
+ if (top)
144
+ return top;
145
+ if (Array.isArray(record.operations)) {
146
+ for (const op of record.operations) {
147
+ // Same guard as above, one level down: a non-mapping entry has nothing to judge.
148
+ const opRecord = asRecord(op);
149
+ if (opRecord === undefined)
150
+ continue;
151
+ const inner = scan(opRecord);
152
+ if (inner)
153
+ return inner;
154
+ }
155
+ }
156
+ }
157
+ return undefined;
158
+ }
159
+ }
160
+ export default EvolutionPolicy;
161
+ //# sourceMappingURL=policy.js.map
@@ -38,8 +38,8 @@
38
38
  * @module
39
39
  */
40
40
  import type { EvolutionIoLike } from './io.ts';
41
- import type { RunOutcome } from '@lmzhen/dsh-evolution-contract';
42
- export type { RunOutcome } from '@lmzhen/dsh-evolution-contract';
41
+ import type { RunOutcome } from './contract.ts';
42
+ export type { RunOutcome } from './contract.ts';
43
43
  /** The kinds of long-running work the registry tracks. */
44
44
  export type RunKind = 'maintain' | 'merge';
45
45
  /** Which merge command opened a run. `kind` stays the work family; this is the command. */
@@ -29,6 +29,18 @@ export class EvolutionProjections extends Service {
29
29
  partial.reads = await port.register(evolutionReadsProjection);
30
30
  partial.history = await port.register(evolutionProjectionHistoryProjection);
31
31
  partial.signals = await port.register(evolutionSignalsProjection);
32
+ if (port.shape === 'unrecognised') {
33
+ // A registered service whose reads are silently empty is DEGRADED, not "no projection data":
34
+ // roll the registrations back and say why (audit 06-P1).
35
+ for (const handle of Object.values(partial).reverse()) {
36
+ try {
37
+ await handle.dispose();
38
+ }
39
+ catch { /* best-effort rollback */ }
40
+ }
41
+ this.markDegraded('projection port shape not recognised: ' + (port.reason ?? 'no reason reported'));
42
+ return;
43
+ }
32
44
  this.handles = partial;
33
45
  }
34
46
  catch (error) {
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * C-10: PATH HELPERS ONLY — despite the file name there is no store
7
7
  * here. Durable evolution state lives in the state stack (evolution-state over
8
- * evolution-state-json / -domain); skills and memories live in skill-store.ts
8
+ * evolution-state-domain); skills and memories live in skill-store.ts
9
9
  * / memory-store.ts. The file name is kept deliberately: renaming it would
10
10
  * touch every family import for zero behavior change, and the audit records
11
11
  * the mismatch as known naming debt.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * C-10: PATH HELPERS ONLY — despite the file name there is no store
7
7
  * here. Durable evolution state lives in the state stack (evolution-state over
8
- * evolution-state-json / -domain); skills and memories live in skill-store.ts
8
+ * evolution-state-domain); skills and memories live in skill-store.ts
9
9
  * / memory-store.ts. The file name is kept deliberately: renaming it would
10
10
  * touch every family import for zero behavior change, and the audit records
11
11
  * the mismatch as known naming debt.
@@ -58,7 +58,7 @@ export const STORE_LEDGER = [
58
58
  cutoff: 'resolved records beyond the cap',
59
59
  trigger: 'write',
60
60
  artifact: 'resolved record count',
61
- declare: [{ kind: 'named', module: 'evolution-state-storage/src/constants.ts', name: 'PENDING_RESOLVED_CAP', value: 200 }],
61
+ declare: [{ kind: 'named', module: 'evolution-state/src/constants.ts', name: 'PENDING_RESOLVED_CAP', value: 200 }],
62
62
  },
63
63
  {
64
64
  id: 'review-session',
@@ -68,7 +68,7 @@ export const STORE_LEDGER = [
68
68
  cutoff: 'rows beyond the session cap',
69
69
  trigger: 'write',
70
70
  artifact: 'review state row count',
71
- declare: [{ kind: 'named', module: 'evolution-state-storage/src/constants.ts', name: 'REVIEW_STATE_SESSION_CAP', value: 500 }],
71
+ declare: [{ kind: 'named', module: 'evolution-state/src/constants.ts', name: 'REVIEW_STATE_SESSION_CAP', value: 500 }],
72
72
  },
73
73
  {
74
74
  id: 'reports',
@@ -18,7 +18,9 @@
18
18
  import { readFileSync } from 'node:fs';
19
19
  import { fileURLToPath } from 'node:url';
20
20
  const SITES_URL = new URL('../persisted-write-inventory.json', import.meta.url);
21
- const SERIALIZATIONS = ['transact', 'write-lock', 'instance-claim'];
21
+ // `platform-file-lock` = the platform's withFileLock (W9-authority): the home lock record is
22
+ // owned by the platform writer, not by the family transact seam, so it is its own serialization kind.
23
+ const SERIALIZATIONS = ['transact', 'write-lock', 'instance-claim', 'platform-file-lock'];
22
24
  /** Parse + validate the table. A malformed table throws at import: a table the
23
25
  * gate cannot read must never degrade into "no declared write sites". */
24
26
  function parseTable(raw) {
package/lib/write.js CHANGED
@@ -1,5 +1,5 @@
1
- import { r as contentHash } from "./mutations-jUuOPaCn.js";
2
- import { $ as writeUnitSnapshot, A as unitJournalPort, B as readUnitEvidence, F as readUnitJournal, G as unitIndexPath, H as readUnitReceipt, I as unitJournalPath, J as unitSnapshotsDir, K as unitReceiptPath, L as unitJournalPhaseRank, M as UNIT_JOURNAL_PHASES, N as UNIT_JOURNAL_SCHEMA_VERSION, P as assertUnitJournalTransition, Q as writeUnitReceipt, R as writeUnitJournal, U as readUnitSnapshot, V as readUnitIndex, W as unitEvidencePath, X as upsertUnitIndex, Y as unitStorageKey, Z as writeUnitEvidence, et as MutationUnit, f as entryTarget, j as unitSnapshotPort, k as pruneTreeChangeUnits, nt as validateMutationRequest, q as unitSnapshotPath, rt as WriteKernel, tt as fileMutationLock, z as UNIT_STORAGE_SCHEMA_VERSION } from "./skill-history-_Cssts5o.js";
1
+ import { r as contentHash } from "./mutations-DwvbjRHF.js";
2
+ import { $ as writeUnitSnapshot, A as unitJournalPort, B as readUnitEvidence, F as readUnitJournal, G as unitIndexPath, H as readUnitReceipt, I as unitJournalPath, J as unitSnapshotsDir, K as unitReceiptPath, L as unitJournalPhaseRank, M as UNIT_JOURNAL_PHASES, N as UNIT_JOURNAL_SCHEMA_VERSION, P as assertUnitJournalTransition, Q as writeUnitReceipt, R as writeUnitJournal, U as readUnitSnapshot, V as readUnitIndex, W as unitEvidencePath, X as upsertUnitIndex, Y as unitStorageKey, Z as writeUnitEvidence, et as MutationUnit, f as entryTarget, j as unitSnapshotPort, k as pruneTreeChangeUnits, nt as validateMutationRequest, q as unitSnapshotPath, rt as WriteKernel, tt as fileMutationLock, z as UNIT_STORAGE_SCHEMA_VERSION } from "./skill-history-CjypdYqv.js";
3
3
  //#region lib/types/unit-undo.js
4
4
  /**
5
5
  * Cross-skill unit undo executor.