@evomap/evolver-cli 2.0.33 → 2.0.35

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.
@@ -0,0 +1,448 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { lstatSync, readFileSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { isAbsolute, relative, resolve, sep } from 'node:path';
5
+ import { DEFAULT_HOOK_COMMAND, DEFAULT_PROMPT_RECALL_HOOK_COMMAND, installInjection, uninstallInjection, } from '@evomap/evolver-mcp';
6
+ export const SETUP_LIFECYCLE_SCHEMA = 'evolver.setup_hooks.lifecycle.v1';
7
+ export const SETUP_LIFECYCLE_PLAN_TTL_MS = 120_000;
8
+ export class SetupLifecycleError extends Error {
9
+ code;
10
+ constructor(code, message) {
11
+ super(message);
12
+ this.code = code;
13
+ this.name = 'SetupLifecycleError';
14
+ }
15
+ }
16
+ export function setupLifecycleCapabilities(runtime, scope) {
17
+ const supported = runtime === 'claude-code' || runtime === 'codex';
18
+ return {
19
+ schema: SETUP_LIFECYCLE_SCHEMA,
20
+ runtime,
21
+ scope,
22
+ supported,
23
+ operations: {
24
+ plan: supported,
25
+ verify: supported,
26
+ install: supported,
27
+ uninstall: supported,
28
+ },
29
+ };
30
+ }
31
+ function digest(value) {
32
+ return createHash('sha256').update(value).digest('hex');
33
+ }
34
+ function canonicalJson(value) {
35
+ if (Array.isArray(value))
36
+ return value.map(canonicalJson);
37
+ if (value !== null && typeof value === 'object') {
38
+ const entries = Object.entries(value)
39
+ .filter(([, entry]) => entry !== undefined)
40
+ .sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0)
41
+ .map(([key, entry]) => [key, canonicalJson(entry)]);
42
+ return Object.fromEntries(entries);
43
+ }
44
+ return value;
45
+ }
46
+ function lifecycleIntentDigest(context, action) {
47
+ const options = context.installOptions;
48
+ const targetResolution = {
49
+ configRoot: context.configRoot,
50
+ scope: context.scope,
51
+ homeDir: options.homeDir,
52
+ codexHome: options.codexHome,
53
+ kiroHome: options.kiroHome,
54
+ xdgConfigHome: options.xdgConfigHome,
55
+ opencodeConfig: options.opencodeConfig,
56
+ opencodeConfigDir: options.opencodeConfigDir,
57
+ };
58
+ const intent = action === 'install'
59
+ ? {
60
+ action,
61
+ runtime: context.runtime,
62
+ scope: context.scope,
63
+ targetResolution,
64
+ injectionPlan: {
65
+ runtime: context.injectionPlan.runtime,
66
+ mode: context.injectionPlan.mode,
67
+ config: context.injectionPlan.config,
68
+ },
69
+ install: {
70
+ server: options.server,
71
+ productBridgeNodePath: options.productBridgeNodePath ?? process.execPath,
72
+ hookCommand: options.hookCommand ?? DEFAULT_HOOK_COMMAND,
73
+ promptRecallHookCommand: options.promptRecallHookCommand ?? DEFAULT_PROMPT_RECALL_HOOK_COMMAND,
74
+ force: options.force === true,
75
+ genes: options.genes,
76
+ maxGenes: options.maxGenes,
77
+ opencodeConfigContent: options.opencodeConfigContent,
78
+ opencodeDisableProjectConfig: options.opencodeDisableProjectConfig,
79
+ opencodeManagedConfigDir: options.opencodeManagedConfigDir,
80
+ opencodeManagedPreferencePaths: options.opencodeManagedPreferencePaths,
81
+ opencodePlatform: options.opencodePlatform,
82
+ opencodeProgramData: options.opencodeProgramData,
83
+ opencodeUsername: options.opencodeUsername,
84
+ },
85
+ }
86
+ : { action, runtime: context.runtime, scope: context.scope, targetResolution };
87
+ return digest(JSON.stringify(canonicalJson(intent)));
88
+ }
89
+ function fileIdentity(path) {
90
+ try {
91
+ const stat = lstatSync(path);
92
+ if (stat.isSymbolicLink())
93
+ return digest(`symlink:${path}`);
94
+ if (!stat.isFile())
95
+ return digest(`non-file:${path}:${stat.mode}`);
96
+ return digest(Buffer.concat([
97
+ Buffer.from(`file:${path}:${stat.mode}:`),
98
+ readFileSync(path),
99
+ ]));
100
+ }
101
+ catch (error) {
102
+ if (error.code === 'ENOENT')
103
+ return digest(`absent:${path}`);
104
+ throw error;
105
+ }
106
+ }
107
+ function displayTarget(path, context) {
108
+ const base = context.scope === 'user' ? context.installOptions.homeDir ?? homedir() : context.configRoot;
109
+ const candidate = relative(base, path);
110
+ if (!isAbsolute(candidate) && candidate !== '..' && !candidate.startsWith(`..${sep}`)) {
111
+ return context.scope === 'user' ? `~/${candidate.replaceAll('\\', '/')}` : candidate.replaceAll('\\', '/');
112
+ }
113
+ return `<managed:${context.runtime}:${context.scope}>`;
114
+ }
115
+ function planResult(context, action) {
116
+ if (action === 'install') {
117
+ return installInjection(context.injectionPlan, { ...context.installOptions, dryRun: true });
118
+ }
119
+ return uninstallInjection(context.runtime, {
120
+ configRoot: context.configRoot,
121
+ scope: context.scope,
122
+ homeDir: context.installOptions.homeDir,
123
+ codexHome: context.installOptions.codexHome,
124
+ kiroHome: context.installOptions.kiroHome,
125
+ xdgConfigHome: context.installOptions.xdgConfigHome,
126
+ opencodeConfig: context.installOptions.opencodeConfig,
127
+ opencodeConfigDir: context.installOptions.opencodeConfigDir,
128
+ dryRun: true,
129
+ });
130
+ }
131
+ function planForTimes(context, action, createdAt, expiresAt) {
132
+ const capabilities = setupLifecycleCapabilities(context.runtime, context.scope);
133
+ if (!capabilities.supported || !capabilities.operations[action]) {
134
+ throw new SetupLifecycleError('CAPABILITY_UNAVAILABLE', `lifecycle ${action} is unavailable for ${context.runtime}/${context.scope}`);
135
+ }
136
+ const dryRun = planResult(context, action);
137
+ if (!dryRun.ok)
138
+ throw new SetupLifecycleError('PLAN_INVALID', dryRun.error ?? 'lifecycle plan failed');
139
+ const files = [...new Set(dryRun.files.map((path) => resolve(path)))].sort();
140
+ const targets = files.map((path) => {
141
+ const expectedIdentity = fileIdentity(path);
142
+ return {
143
+ target_id: digest(`${context.runtime}\0${context.scope}\0${path}`).slice(0, 32),
144
+ target_ref: displayTarget(path, context),
145
+ expected_identity: expectedIdentity,
146
+ disposition: action === 'install' ? 'installable' : 'removable',
147
+ impact_hints: action === 'uninstall' ? ['new_sessions_required'] : [],
148
+ };
149
+ });
150
+ if (targets.length === 0) {
151
+ targets.push({
152
+ target_id: digest(`${context.runtime}\0${context.scope}\0already-satisfied`).slice(0, 32),
153
+ target_ref: `${context.runtime}:${context.scope}`,
154
+ expected_identity: digest('already-satisfied'),
155
+ disposition: 'already_satisfied',
156
+ impact_hints: [],
157
+ });
158
+ }
159
+ const intentDigest = lifecycleIntentDigest(context, action);
160
+ const generation = digest(JSON.stringify([intentDigest, targets.map(({ target_id, expected_identity }) => [target_id, expected_identity])]));
161
+ const targetSetDigest = digest(JSON.stringify(targets.map(({ target_id }) => target_id)));
162
+ const base = {
163
+ schema: SETUP_LIFECYCLE_SCHEMA,
164
+ generation,
165
+ target_set_digest: targetSetDigest,
166
+ intent_digest: intentDigest,
167
+ created_at: createdAt.toISOString(),
168
+ expires_at: expiresAt.toISOString(),
169
+ action,
170
+ runtime: context.runtime,
171
+ scope: context.scope,
172
+ targets,
173
+ };
174
+ return { ...base, plan_id: digest(JSON.stringify(base)) };
175
+ }
176
+ export function createSetupLifecyclePlan(context, action) {
177
+ const createdAt = (context.now ?? (() => new Date()))();
178
+ return planForTimes(context, action, createdAt, new Date(createdAt.getTime() + SETUP_LIFECYCLE_PLAN_TTL_MS));
179
+ }
180
+ export function encodeSetupLifecyclePlan(plan) {
181
+ return Buffer.from(JSON.stringify(plan), 'utf8').toString('base64url');
182
+ }
183
+ export function decodeSetupLifecyclePlan(raw) {
184
+ let value;
185
+ try {
186
+ value = JSON.parse(Buffer.from(raw, 'base64url').toString('utf8'));
187
+ }
188
+ catch {
189
+ throw new SetupLifecycleError('PLAN_INVALID', 'confirmed lifecycle plan is not valid base64url JSON');
190
+ }
191
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
192
+ throw new SetupLifecycleError('PLAN_INVALID', 'confirmed lifecycle plan must be an object');
193
+ }
194
+ const plan = value;
195
+ const targetsValid = Array.isArray(plan.targets) && plan.targets.every((target) => target !== null
196
+ && typeof target === 'object'
197
+ && typeof target.target_id === 'string'
198
+ && typeof target.target_ref === 'string'
199
+ && typeof target.expected_identity === 'string'
200
+ && ['installable', 'removable', 'already_satisfied'].includes(target.disposition)
201
+ && Array.isArray(target.impact_hints)
202
+ && target.impact_hints.every((hint) => typeof hint === 'string'));
203
+ if (plan.schema !== SETUP_LIFECYCLE_SCHEMA
204
+ || typeof plan.plan_id !== 'string'
205
+ || typeof plan.generation !== 'string'
206
+ || typeof plan.target_set_digest !== 'string'
207
+ || typeof plan.intent_digest !== 'string'
208
+ || typeof plan.created_at !== 'string'
209
+ || typeof plan.expires_at !== 'string'
210
+ || (plan.action !== 'install' && plan.action !== 'uninstall')
211
+ || typeof plan.runtime !== 'string'
212
+ || (plan.scope !== 'project' && plan.scope !== 'user')
213
+ || !targetsValid) {
214
+ throw new SetupLifecycleError('PLAN_INVALID', 'confirmed lifecycle plan has an invalid schema');
215
+ }
216
+ return plan;
217
+ }
218
+ export function verifySetupLifecycle(context) {
219
+ const result = installInjection(context.injectionPlan, { ...context.installOptions, dryRun: true });
220
+ return result.ok && result.alreadyInstalled === true && result.verified === true && result.files.length === 0;
221
+ }
222
+ export function executeSetupLifecyclePlan(context, confirmed, options = {}) {
223
+ if (confirmed.runtime !== context.runtime || confirmed.scope !== context.scope) {
224
+ throw new SetupLifecycleError('PLAN_INVALID', 'confirmed lifecycle plan does not match runtime scope');
225
+ }
226
+ const { plan_id: confirmedPlanID, ...confirmedBase } = confirmed;
227
+ if (digest(JSON.stringify(confirmedBase)) !== confirmedPlanID) {
228
+ throw new SetupLifecycleError('PLAN_INVALID', 'confirmed lifecycle plan identity is invalid');
229
+ }
230
+ if (lifecycleIntentDigest(context, confirmed.action) !== confirmed.intent_digest) {
231
+ throw new SetupLifecycleError('PLAN_STALE', 'lifecycle write intent changed; create a fresh plan');
232
+ }
233
+ const now = (context.now ?? (() => new Date()))();
234
+ const createdAt = new Date(confirmed.created_at);
235
+ const expiresAt = new Date(confirmed.expires_at);
236
+ if (!Number.isFinite(createdAt.getTime()) || !Number.isFinite(expiresAt.getTime())) {
237
+ throw new SetupLifecycleError('PLAN_INVALID', 'confirmed lifecycle plan has invalid timestamps');
238
+ }
239
+ const continuingTargetExecution = options.targetId !== undefined && (options.completedTargetIds?.length ?? 0) > 0;
240
+ if (now.getTime() > expiresAt.getTime() && !continuingTargetExecution) {
241
+ throw new SetupLifecycleError('PLAN_EXPIRED', 'confirmed lifecycle plan expired; create a fresh plan');
242
+ }
243
+ if (options.targetId !== undefined) {
244
+ return executeSetupLifecycleTarget(context, confirmed, options.targetId, options.completedTargetIds ?? [], createdAt, expiresAt);
245
+ }
246
+ const current = planForTimes(context, confirmed.action, createdAt, expiresAt);
247
+ const sameTargets = JSON.stringify(current.targets.map((target) => target.target_id))
248
+ === JSON.stringify(confirmed.targets.map((target) => target.target_id));
249
+ if (current.plan_id !== confirmed.plan_id
250
+ || current.generation !== confirmed.generation
251
+ || current.target_set_digest !== confirmed.target_set_digest
252
+ || !sameTargets) {
253
+ throw new SetupLifecycleError('PLAN_STALE', 'lifecycle target identity changed; create a fresh plan');
254
+ }
255
+ let result;
256
+ let executionFailed = false;
257
+ try {
258
+ result = confirmed.action === 'install'
259
+ ? installInjection(context.injectionPlan, context.installOptions)
260
+ : uninstallInjection(context.runtime, {
261
+ configRoot: context.configRoot,
262
+ scope: context.scope,
263
+ homeDir: context.installOptions.homeDir,
264
+ codexHome: context.installOptions.codexHome,
265
+ kiroHome: context.installOptions.kiroHome,
266
+ xdgConfigHome: context.installOptions.xdgConfigHome,
267
+ opencodeConfig: context.installOptions.opencodeConfig,
268
+ opencodeConfigDir: context.installOptions.opencodeConfigDir,
269
+ });
270
+ executionFailed = !result.ok;
271
+ }
272
+ catch {
273
+ executionFailed = true;
274
+ }
275
+ let verified = false;
276
+ if (!executionFailed) {
277
+ try {
278
+ verified = confirmed.action === 'install'
279
+ ? verifySetupLifecycle(context)
280
+ : planResult(context, 'uninstall').files.length === 0;
281
+ }
282
+ catch {
283
+ executionFailed = true;
284
+ }
285
+ }
286
+ const targets = confirmed.targets.map((target) => {
287
+ const path = resolveTargetRef(target, context);
288
+ const committed = path !== '' && fileIdentity(path) !== target.expected_identity;
289
+ const targetVerified = !executionFailed && verified;
290
+ return {
291
+ target_id: target.target_id,
292
+ outcome: target.disposition === 'already_satisfied' || !committed && targetVerified
293
+ ? confirmed.action === 'uninstall' ? 'already_absent' : 'already_satisfied'
294
+ : committed
295
+ ? confirmed.action === 'install' ? 'installed' : 'removed'
296
+ : 'failed',
297
+ committed,
298
+ verified: targetVerified,
299
+ ...(!targetVerified ? { recovery: committed ? 'RETRY_VERIFICATION' : 'OPEN_CONFIG' } : {}),
300
+ };
301
+ });
302
+ return {
303
+ schema: SETUP_LIFECYCLE_SCHEMA,
304
+ action: confirmed.action,
305
+ runtime: context.runtime,
306
+ scope: context.scope,
307
+ plan_id: confirmed.plan_id,
308
+ generation: confirmed.generation,
309
+ target_set_digest: confirmed.target_set_digest,
310
+ complete: verified,
311
+ verified,
312
+ targets,
313
+ };
314
+ }
315
+ function executeSetupLifecycleTarget(context, confirmed, targetId, completedTargetIds, createdAt, expiresAt) {
316
+ const selected = confirmed.targets.find((target) => target.target_id === targetId);
317
+ if (!selected)
318
+ throw new SetupLifecycleError('PLAN_INVALID', 'selected lifecycle target is not in the confirmed plan');
319
+ const confirmedIds = new Set(confirmed.targets.map((target) => target.target_id));
320
+ const completed = new Set(completedTargetIds);
321
+ if (completed.size !== completedTargetIds.length || completed.has(targetId) || [...completed].some((id) => !confirmedIds.has(id))) {
322
+ throw new SetupLifecycleError('PLAN_INVALID', 'completed lifecycle target set is invalid');
323
+ }
324
+ const current = planForTimes(context, confirmed.action, createdAt, expiresAt);
325
+ const currentTargets = current.targets.filter((target) => target.disposition !== 'already_satisfied');
326
+ const currentByID = new Map(currentTargets.map((target) => [target.target_id, target]));
327
+ if (currentTargets.some((target) => !confirmedIds.has(target.target_id))) {
328
+ throw new SetupLifecycleError('PLAN_STALE', 'lifecycle target set changed; create a fresh plan');
329
+ }
330
+ if (selected.disposition === 'already_satisfied') {
331
+ return {
332
+ schema: SETUP_LIFECYCLE_SCHEMA,
333
+ action: confirmed.action,
334
+ runtime: context.runtime,
335
+ scope: context.scope,
336
+ plan_id: confirmed.plan_id,
337
+ generation: confirmed.generation,
338
+ target_set_digest: confirmed.target_set_digest,
339
+ complete: true,
340
+ verified: true,
341
+ targets: [{
342
+ target_id: targetId,
343
+ outcome: confirmed.action === 'uninstall' ? 'already_absent' : 'already_satisfied',
344
+ committed: false,
345
+ verified: true,
346
+ }],
347
+ };
348
+ }
349
+ for (const target of confirmed.targets) {
350
+ if (target.disposition === 'already_satisfied')
351
+ continue;
352
+ const currentTarget = currentByID.get(target.target_id);
353
+ if (completed.has(target.target_id)) {
354
+ if (currentTarget)
355
+ throw new SetupLifecycleError('PLAN_STALE', 'a completed lifecycle target is no longer verified');
356
+ continue;
357
+ }
358
+ if (target.target_id === targetId) {
359
+ if (currentTarget && currentTarget.expected_identity !== target.expected_identity) {
360
+ throw new SetupLifecycleError('PLAN_STALE', 'selected lifecycle target identity changed');
361
+ }
362
+ continue;
363
+ }
364
+ if (!currentTarget || currentTarget.expected_identity !== target.expected_identity) {
365
+ throw new SetupLifecycleError('PLAN_STALE', 'a pending lifecycle target identity changed');
366
+ }
367
+ }
368
+ const targetPath = resolveTargetRef(selected, context);
369
+ const alreadyApplied = !currentByID.has(targetId);
370
+ if (alreadyApplied) {
371
+ return {
372
+ schema: SETUP_LIFECYCLE_SCHEMA,
373
+ action: confirmed.action,
374
+ runtime: context.runtime,
375
+ scope: context.scope,
376
+ plan_id: confirmed.plan_id,
377
+ generation: confirmed.generation,
378
+ target_set_digest: confirmed.target_set_digest,
379
+ complete: true,
380
+ verified: true,
381
+ targets: [{
382
+ target_id: targetId,
383
+ outcome: confirmed.action === 'uninstall' ? 'already_absent' : 'already_satisfied',
384
+ committed: false,
385
+ verified: true,
386
+ }],
387
+ };
388
+ }
389
+ let executionFailed = false;
390
+ try {
391
+ const result = confirmed.action === 'install'
392
+ ? installInjection(context.injectionPlan, { ...context.installOptions, targetPath })
393
+ : uninstallInjection(context.runtime, {
394
+ configRoot: context.configRoot,
395
+ scope: context.scope,
396
+ homeDir: context.installOptions.homeDir,
397
+ codexHome: context.installOptions.codexHome,
398
+ kiroHome: context.installOptions.kiroHome,
399
+ xdgConfigHome: context.installOptions.xdgConfigHome,
400
+ opencodeConfig: context.installOptions.opencodeConfig,
401
+ opencodeConfigDir: context.installOptions.opencodeConfigDir,
402
+ targetPath,
403
+ });
404
+ executionFailed = !result.ok;
405
+ }
406
+ catch {
407
+ executionFailed = true;
408
+ }
409
+ let verified = false;
410
+ try {
411
+ const after = planForTimes(context, confirmed.action, createdAt, expiresAt);
412
+ verified = !after.targets.some((target) => target.target_id === targetId);
413
+ }
414
+ catch {
415
+ executionFailed = true;
416
+ }
417
+ const committed = targetPath !== '' && fileIdentity(targetPath) !== selected.expected_identity;
418
+ const targetVerified = !executionFailed && verified;
419
+ const outcome = targetVerified
420
+ ? confirmed.action === 'install' ? 'installed' : 'removed'
421
+ : 'failed';
422
+ return {
423
+ schema: SETUP_LIFECYCLE_SCHEMA,
424
+ action: confirmed.action,
425
+ runtime: context.runtime,
426
+ scope: context.scope,
427
+ plan_id: confirmed.plan_id,
428
+ generation: confirmed.generation,
429
+ target_set_digest: confirmed.target_set_digest,
430
+ complete: targetVerified,
431
+ verified: targetVerified,
432
+ targets: [{
433
+ target_id: targetId,
434
+ outcome,
435
+ committed,
436
+ verified: targetVerified,
437
+ ...(!targetVerified ? { recovery: committed ? 'RETRY_VERIFICATION' : 'OPEN_CONFIG' } : {}),
438
+ }],
439
+ };
440
+ }
441
+ function resolveTargetRef(target, context) {
442
+ if (target.disposition === 'already_satisfied' || target.target_ref.startsWith('<managed:'))
443
+ return '';
444
+ if (target.target_ref.startsWith('~/')) {
445
+ return resolve(context.installOptions.homeDir ?? homedir(), target.target_ref.slice(2));
446
+ }
447
+ return resolve(context.configRoot, target.target_ref);
448
+ }
package/dist/sync.js CHANGED
@@ -2,7 +2,7 @@ import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readSy
2
2
  import { Buffer } from 'node:buffer';
3
3
  import { createHash, randomUUID } from 'node:crypto';
4
4
  import { dirname, join } from 'node:path';
5
- import { assetstore, events, hub as hubNs, wire } from '@evomap/evolver-core';
5
+ import { reference, assetstore, events, hub as hubNs, wire } from '@evomap/evolver-core';
6
6
  import { AuthError, connectPublicHub, HubClientError, HubUnreachableError, isHubDryRunEnabled, MalformedAccountAssetPageError, resolveHubUrl, stripHubDeliveryMetadataForIntegrity, } from '@evomap/evolver-adapter-public';
7
7
  import { loadEnvFileFromEnv } from '@evomap/evolver-mcp';
8
8
  import { createRecipeHubFromEnv, resolveRecipeHubResumeIdentityFingerprint } from './recipe.js';
@@ -53,6 +53,34 @@ export async function runSyncCommand(argv, deps = {}) {
53
53
  env,
54
54
  assetsDir: deps.assetsDir ?? join(events.evomapHome(env), 'assets'),
55
55
  };
56
+ if (parsed.value.importPath) {
57
+ const raw = JSON.parse(readBoundedGepxText(parsed.value.importPath));
58
+ if (reference.hasEvidenceMode(raw)) {
59
+ const envelope = !Array.isArray(raw) ? reference.record(raw) : undefined;
60
+ const assets = envelope?.['assets'];
61
+ let batch = raw;
62
+ if (Array.isArray(assets)) {
63
+ if (assets.some((a) => !['Gene', 'Capsule'].includes(String(reference.record(a)['type']))))
64
+ throw new Error('reference_pair_required');
65
+ const genes = assets.filter((a) => reference.record(a)['type'] === 'Gene');
66
+ const capsules = assets.filter((a) => reference.record(a)['type'] === 'Capsule');
67
+ batch = capsules.map((capsule) => {
68
+ const matches = genes.filter((gene) => [reference.record(gene)['id'], reference.record(gene)['asset_id']].includes(reference.record(capsule)['gene']));
69
+ if (matches.length !== 1)
70
+ throw new Error('reference_gene_binding_invalid');
71
+ return { gene: matches[0], capsule };
72
+ });
73
+ if (genes.some((g) => !capsules.some((c) => [reference.record(g)['id'], reference.record(g)['asset_id']].includes(reference.record(c)['gene']))))
74
+ throw new Error('reference_orphan_gene');
75
+ }
76
+ const pairs = reference.decodeReferenceBatch(batch);
77
+ const receipt = parsed.value.write
78
+ ? new reference.ReferenceStore(join(runtimeDeps.assetsDir, 'references')).import(pairs)
79
+ : { status: 'would_store_reference', count: pairs.length, executable: false };
80
+ out(stringifyJsonOutput({ ok: true, group: GROUP, ...receipt }));
81
+ return 0;
82
+ }
83
+ }
56
84
  const result = parsed.value.exportPath
57
85
  ? await executeSyncExport(parsed.value, runtimeDeps)
58
86
  : parsed.value.importPath
@@ -9,7 +9,7 @@
9
9
  // tick the cadence check — this is the bus's first live built-in observer.
10
10
  import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
11
11
  import { dirname, join } from 'node:path';
12
- import { assetstore, events, observers, ops } from '@evomap/evolver-core';
12
+ import { reference, assetstore, events, observers, ops } from '@evomap/evolver-core';
13
13
  import { loadPriceTable } from '@evomap/evolver-adapter-public';
14
14
  /** Markdown file sink: appends each weekly digest to <home>/evolution/value-digest.md (inspectable history). */
15
15
  export function fileDigestSink(path) {
@@ -86,6 +86,7 @@ export function resolveValueDigestObserver(env = process.env, opts = {}) {
86
86
  traces: ops.readTraceRecords(tracesDir),
87
87
  events: events.readEvents(eventsPath),
88
88
  prices,
89
+ referenceScope: reference.referenceScopeForEventsPath(eventsPath),
89
90
  }, window),
90
91
  digestExtras: async () => {
91
92
  const store = new assetstore.LocalJsonlProvider(events.assetsDir());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evomap/evolver-cli",
3
- "version": "2.0.33",
3
+ "version": "2.0.35",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -23,12 +23,12 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@evomap/evolver-core": "2.0.33",
27
- "@evomap/evolver-adapter-public": "2.0.33",
28
- "@evomap/evolver-mcp": "2.0.33",
29
- "@evomap/evolver-proxy": "2.0.33",
30
- "@evomap/evolver-runtime-adapters": "2.0.33",
31
- "@evomap/evolver-webui": "2.0.33"
26
+ "@evomap/evolver-core": "2.0.35",
27
+ "@evomap/evolver-adapter-public": "2.0.35",
28
+ "@evomap/evolver-mcp": "2.0.35",
29
+ "@evomap/evolver-proxy": "2.0.35",
30
+ "@evomap/evolver-runtime-adapters": "2.0.35",
31
+ "@evomap/evolver-webui": "2.0.35"
32
32
  },
33
33
  "repository": {
34
34
  "type": "git",