@evomap/evolver-cli 2.0.0-beta.18 → 2.0.0-beta.19

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 (63) hide show
  1. package/dist/antiGeneRollout.js +7 -3
  2. package/dist/assetTrust.js +14 -1
  3. package/dist/atp.d.ts +8 -3
  4. package/dist/atp.js +82 -11
  5. package/dist/atpAutoBuyer.d.ts +120 -0
  6. package/dist/atpAutoBuyer.js +814 -0
  7. package/dist/atpAutoDeliver.js +2 -2
  8. package/dist/autoDistillLlm.js +2 -1
  9. package/dist/autoDistillTranscript.js +3 -2
  10. package/dist/autoexec.d.ts +90 -13
  11. package/dist/autoexec.js +731 -84
  12. package/dist/cli.js +13 -0
  13. package/dist/cliContracts.d.ts +5 -2
  14. package/dist/cliContracts.js +135 -8
  15. package/dist/commands.d.ts +1 -0
  16. package/dist/commands.js +1 -0
  17. package/dist/curriculumCapabilityGaps.d.ts +6 -0
  18. package/dist/curriculumCapabilityGaps.js +24 -0
  19. package/dist/cycleConsumer.d.ts +4 -0
  20. package/dist/cycleConsumer.js +175 -20
  21. package/dist/dashboard.js +47 -9
  22. package/dist/dispatch.js +6 -2
  23. package/dist/distillPrimitives.js +18 -6
  24. package/dist/doctor.js +63 -5
  25. package/dist/identityHome.js +2 -1
  26. package/dist/index.d.ts +67 -39
  27. package/dist/index.js +504 -185
  28. package/dist/learningTrace.js +8 -2
  29. package/dist/lifecycle.d.ts +54 -1
  30. package/dist/lifecycle.js +489 -37
  31. package/dist/materialSnapshot.d.ts +9 -1
  32. package/dist/materialSnapshot.js +23 -6
  33. package/dist/migrate/envTranslate.d.ts +26 -0
  34. package/dist/migrate/envTranslate.js +145 -0
  35. package/dist/migrate/oauthImport.d.ts +66 -0
  36. package/dist/migrate/oauthImport.js +667 -0
  37. package/dist/migrate/v1Import.d.ts +13 -1
  38. package/dist/migrate/v1Import.js +621 -122
  39. package/dist/promptRecallHook.d.ts +24 -0
  40. package/dist/promptRecallHook.js +425 -0
  41. package/dist/recallVerifyReport.d.ts +37 -0
  42. package/dist/recallVerifyReport.js +244 -0
  43. package/dist/requiredSandboxValidation.d.ts +5 -0
  44. package/dist/requiredSandboxValidation.js +4 -0
  45. package/dist/reuse.d.ts +1 -0
  46. package/dist/reuse.js +45 -37
  47. package/dist/runtimeCapabilities.js +13 -13
  48. package/dist/runtimeSessionSource.d.ts +3 -2
  49. package/dist/runtimeSessionSource.js +63 -11
  50. package/dist/sessionIngest.d.ts +37 -0
  51. package/dist/sessionIngest.js +156 -0
  52. package/dist/setupHooks.js +95 -1
  53. package/dist/skill2gep.d.ts +4 -7
  54. package/dist/skill2gep.js +4 -21
  55. package/dist/solo/mode.js +1 -0
  56. package/dist/sync.js +125 -23
  57. package/dist/thesis.d.ts +1 -1
  58. package/dist/thesis.js +18 -3
  59. package/dist/trajectoryExport.js +21 -3
  60. package/dist/v1Compat.d.ts +1 -0
  61. package/dist/v1Compat.js +9 -0
  62. package/dist/workflowRuntime.js +24 -18
  63. package/package.json +10 -7
@@ -1,18 +1,22 @@
1
1
  import { accessSync, constants, lstatSync, mkdirSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
2
3
  import { basename, dirname, join, resolve } from 'node:path';
3
4
  import { assetstore, algo, events, exec, material as materialNs, personality, schema, signals, util, verify } from '@evomap/evolver-core';
4
- import { materialHasRuntimeSessionSnapshot, materialSourceAvailable, runtimeSessionSourcesForMaterial } from './materialSnapshot.js';
5
+ import { MATERIAL_RUNTIME_SESSION_SNAPSHOT_SCHEMA, materialHasRuntimeSessionSnapshot, materialSourceAvailable, runtimeSessionEvidenceSummariesFromMaterialPayload, runtimeSessionSourcesForMaterial, runtimeSessionSourcesForMaterialDetails, } from './materialSnapshot.js';
6
+ import { runRequiredSandboxedValidation } from './requiredSandboxValidation.js';
5
7
  import { signalTokens } from './distillPrimitives.js';
6
8
  import { readEvents, showCycle } from './commands.js';
7
9
  import { RUNTIME_CAPABILITY_MATRIX, runtimeCapabilities } from './runtimeCapabilities.js';
10
+ import { parseRuntimeSessionSources } from './runtimeSessionSource.js';
8
11
  import { LocalMemoryGraph, resolveLocalMemoryUserIdentity } from './localMemoryGraph.js';
12
+ import { makeCurriculumCapabilityGapsProvider } from './curriculumCapabilityGaps.js';
9
13
  const CYCLE_GROUP = 'cycle';
10
14
  const DEFAULT_LIMIT = 5;
11
15
  const DEFAULT_WATCH_IDLE_MS = 1000;
12
16
  const DEFAULT_WATCH_MAX_IDLE_MS = 30_000;
13
17
  const DEFAULT_WATCH_BACKOFF = 2;
14
- const CYCLE_USAGE = 'usage: evolver cycle capabilities [--json] | evolver cycle show <id> | evolver cycle status [--json] | evolver cycle recover [--limit N] [--json] | evolver cycle watch --repo <path> [--idle-ms N] [--max-idle N] [--state-file <path>] [--validation-cmd <cmd>] [--timeout-ms N] [--json] | evolver cycle --repo <path> [--limit N] [--target <path>] [--expected-effect <text>] [--runner claude|codex|cursor|gemini] [--validation-cmd <cmd>] [--timeout-ms N]\n';
15
- const WATCH_USAGE = 'usage: evolver cycle watch --repo <path> [--limit N] [--idle-ms N] [--max-idle-ms N] [--max-idle N] [--max-iterations N] [--state-file <path>] [--target <path>] [--expected-effect <text>] [--runner claude|codex|cursor|gemini] [--validation-cmd <cmd>] [--timeout-ms N] [--json]\n';
18
+ const CYCLE_USAGE = 'usage: evolver cycle capabilities [--json] | evolver cycle show <id> | evolver cycle status [--json] | evolver cycle recover [--limit N] [--json] | evolver cycle watch --repo <path> [--resume] [--idle-ms N] [--max-idle N] [--state-file <path>] [--validation-cmd <cmd>] [--timeout-ms N] [--json] | evolver cycle --repo <path> [--resume] [--limit N] [--target <path>] [--expected-effect <text>] [--runner claude|codex|gemini] [--validation-cmd <cmd>] [--timeout-ms N]\n';
19
+ const WATCH_USAGE = 'usage: evolver cycle watch --repo <path> [--resume] [--limit N] [--idle-ms N] [--max-idle-ms N] [--max-idle N] [--max-iterations N] [--state-file <path>] [--target <path>] [--expected-effect <text>] [--runner claude|codex|gemini] [--validation-cmd <cmd>] [--timeout-ms N] [--json]\n';
16
20
  class CycleWatchStateWriteError extends Error {
17
21
  constructor() {
18
22
  super('cycle watch state file write failed');
@@ -36,6 +40,22 @@ function parseFlags(argv) {
36
40
  }
37
41
  return out;
38
42
  }
43
+ function parseSwitchFlag(argv, name) {
44
+ const flag = `--${name}`;
45
+ let present = false;
46
+ for (let i = 0; i < argv.length; i++) {
47
+ const arg = argv[i];
48
+ if (arg?.startsWith(`${flag}=`))
49
+ return null;
50
+ if (arg !== flag)
51
+ continue;
52
+ const next = argv[i + 1];
53
+ if (next !== undefined && !next.startsWith('--'))
54
+ return null;
55
+ present = true;
56
+ }
57
+ return present;
58
+ }
39
59
  function parseRepeatedFlag(argv, name) {
40
60
  const values = [];
41
61
  const flag = `--${name}`;
@@ -62,18 +82,13 @@ function parseRepeatedFlag(argv, name) {
62
82
  function makeCycleValidationHook(validationCmds, fallback, runSandboxedValidation = verify.runSandboxedValidation) {
63
83
  if (validationCmds.length === 0)
64
84
  return fallback;
65
- let warnedNoIsolation = false;
66
85
  return (task) => {
67
86
  const fallbackHook = fallback?.(task);
68
87
  return async (mutation, decision, cwd) => {
69
88
  const fallbackResult = fallbackHook ? await fallbackHook(mutation, decision, cwd) : null;
70
89
  if (fallbackResult && !fallbackResult.passed)
71
90
  return fallbackResult;
72
- const result = await runSandboxedValidation(task.validationCmds ?? validationCmds, cwd);
73
- if (!result.isolated && !warnedNoIsolation) {
74
- warnedNoIsolation = true;
75
- process.stdout.write(' warning: validation runs WITHOUT network/FS isolation on this platform; non-namespace hardening still applies.\n');
76
- }
91
+ const result = await runRequiredSandboxedValidation(task.validationCmds ?? validationCmds, cwd, {}, runSandboxedValidation);
77
92
  return { passed: result.passed, score: result.score };
78
93
  };
79
94
  };
@@ -97,14 +112,14 @@ function parseRunner(value) {
97
112
  if (value === undefined || value === 'claude')
98
113
  return { ok: true, runner: 'claude' };
99
114
  if (value.trim() === '')
100
- return { ok: false, error: 'runner value is required (supported: claude, codex, cursor, gemini)' };
101
- if (value === 'codex' || value === 'cursor' || value === 'gemini')
115
+ return { ok: false, error: 'runner value is required (supported: claude, codex, gemini)' };
116
+ if (value === 'codex' || value === 'gemini')
102
117
  return { ok: true, runner: value };
103
- if (value === 'antigravity' || value === 'kimi' || value === 'kiro' || value === 'opencode') {
118
+ if (value === 'cursor' || value === 'antigravity' || value === 'kimi' || value === 'kiro' || value === 'opencode') {
104
119
  const capability = RUNTIME_CAPABILITY_MATRIX[value].execute;
105
120
  return { ok: false, error: `runner '${value}' execute capability is ${capability.status}: ${capability.evidence}` };
106
121
  }
107
- return { ok: false, error: `unknown runner '${value}' (supported: claude, codex, cursor, gemini)` };
122
+ return { ok: false, error: `unknown runner '${value}' (supported: claude, codex, gemini)` };
108
123
  }
109
124
  function resolveMaterialRunner(material, requestedRunner) {
110
125
  const sourceAgent = material.sourceAgent;
@@ -114,10 +129,10 @@ function resolveMaterialRunner(material, requestedRunner) {
114
129
  runner = 'claude';
115
130
  break;
116
131
  case 'codex':
117
- case 'cursor':
118
132
  case 'gemini':
119
133
  runner = sourceAgent;
120
134
  break;
135
+ case 'cursor':
121
136
  case 'antigravity':
122
137
  case 'kimi': {
123
138
  const capability = RUNTIME_CAPABILITY_MATRIX[sourceAgent].execute;
@@ -172,8 +187,20 @@ function resolveMaterialCycleDeps(deps = {}) {
172
187
  store,
173
188
  now: () => Date.now(),
174
189
  personality: personalityStore,
190
+ capabilityGaps: makeCurriculumCapabilityGapsProvider(),
175
191
  });
176
- return { materialStore, consumer, store, provenance, review, ingestor, engine, personality: personalityStore, memoryGraph };
192
+ return {
193
+ materialStore,
194
+ consumer,
195
+ store,
196
+ provenance,
197
+ review,
198
+ ingestor,
199
+ engine,
200
+ personality: personalityStore,
201
+ memoryGraph,
202
+ nativeSessionHome: deps.nativeSessionHome ?? homedir(),
203
+ };
177
204
  }
178
205
  export function cycleIdForMaterial(materialId) {
179
206
  return `autoexec-material-${materialId}`;
@@ -273,8 +300,7 @@ function fallbackSignalTokens(sigs) {
273
300
  }
274
301
  return [...out];
275
302
  }
276
- function materialSignals(material) {
277
- const sources = runtimeSessionSourcesForMaterial(material);
303
+ function materialSignals(sources) {
278
304
  const sigs = sources.flatMap((source) => signals.extractSignals(source.turns));
279
305
  const tokens = signalTokens(sigs);
280
306
  return {
@@ -282,6 +308,82 @@ function materialSignals(material) {
282
308
  sourceCount: sources.length,
283
309
  };
284
310
  }
311
+ function resolveMaterialResume(material, runner, sources, liveSources) {
312
+ if (material.sourceAgent !== 'claude-code' && material.sourceAgent !== 'cursor') {
313
+ const capability = material.sourceAgent
314
+ ? RUNTIME_CAPABILITY_MATRIX[material.sourceAgent].resume
315
+ : undefined;
316
+ return {
317
+ ok: false,
318
+ error: capability
319
+ ? `sourceAgent '${material.sourceAgent}' resume capability is ${capability.status}: ${capability.evidence}`
320
+ : 'runtime_session material has no resumable sourceAgent',
321
+ };
322
+ }
323
+ const expectedRunner = material.sourceAgent === 'cursor' ? 'cursor' : 'claude';
324
+ if (runner !== expectedRunner) {
325
+ return { ok: false, error: `resume identity harness does not match runner '${runner}'` };
326
+ }
327
+ if (material.sourceAgent === 'cursor' && basename(material.sourcePath).toLowerCase() === 'state.vscdb') {
328
+ return { ok: false, error: 'Cursor state.vscdb composer identity is ingest-only and cannot be resumed' };
329
+ }
330
+ const hasSnapshotSchema = typeof material.payload === 'object'
331
+ && material.payload !== null
332
+ && material.payload['schema'] === MATERIAL_RUNTIME_SESSION_SNAPSHOT_SCHEMA;
333
+ const snapshot = runtimeSessionEvidenceSummariesFromMaterialPayload(material.payload);
334
+ if (hasSnapshotSchema && !snapshot) {
335
+ return { ok: false, error: 'resume identity snapshot metadata is invalid' };
336
+ }
337
+ if (snapshot && (snapshot.sourceCount !== 1 || snapshot.omittedSourceCount !== 0)) {
338
+ return {
339
+ ok: false,
340
+ error: `resume identity is ambiguous for sourceAgent '${material.sourceAgent}': snapshot reports ${snapshot.sourceCount} sessions (${snapshot.omittedSourceCount} omitted)`,
341
+ };
342
+ }
343
+ const snapshotSource = snapshot?.summaries[0];
344
+ if (snapshot && snapshotSource?.agent !== material.sourceAgent) {
345
+ return { ok: false, error: `resume identity harness does not match sourceAgent '${material.sourceAgent}' in snapshot` };
346
+ }
347
+ const snapshotSessionId = snapshotSource?.sessionId?.trim();
348
+ if (snapshot && !snapshotSessionId) {
349
+ return { ok: false, error: `resume identity missing from snapshot for sourceAgent '${material.sourceAgent}'` };
350
+ }
351
+ if (!liveSources && snapshotSource?.resumeIdentityProvenance !== 'canonical_native_transcript') {
352
+ return {
353
+ ok: false,
354
+ error: `resume identity snapshot lacks verified native transcript provenance for sourceAgent '${material.sourceAgent}'`,
355
+ };
356
+ }
357
+ // Signals may safely fall back to the durable snapshot, but resume identity must retain live provenance.
358
+ // Otherwise an existing transcript with a new path-bound identity and no parseable turns can be filtered out,
359
+ // making the stale snapshot identity appear to match itself and resuming the wrong native session.
360
+ const identitySources = liveSources ?? sources;
361
+ if (identitySources.length === 0) {
362
+ return { ok: false, error: `resume identity missing for sourceAgent '${material.sourceAgent}'` };
363
+ }
364
+ if (identitySources.some((source) => source.agent !== material.sourceAgent)) {
365
+ return { ok: false, error: `resume identity harness does not match sourceAgent '${material.sourceAgent}'` };
366
+ }
367
+ if (identitySources.length !== 1) {
368
+ return { ok: false, error: `resume identity is ambiguous for sourceAgent '${material.sourceAgent}': expected one session, found ${identitySources.length}` };
369
+ }
370
+ const sessionId = identitySources[0].sessionId?.trim();
371
+ if (!sessionId) {
372
+ return { ok: false, error: `resume identity missing for sourceAgent '${material.sourceAgent}'` };
373
+ }
374
+ if (snapshotSessionId && sessionId !== snapshotSessionId) {
375
+ return { ok: false, error: `resume identity does not match snapshot for sourceAgent '${material.sourceAgent}'` };
376
+ }
377
+ const resume = { runner, sessionId };
378
+ try {
379
+ exec.validateAgentSessionResume(resume, runner);
380
+ }
381
+ catch (error) {
382
+ const code = error instanceof exec.AgentSessionResumeError ? error.code : 'invalid_session_id';
383
+ return { ok: false, error: `resume identity is invalid for sourceAgent '${material.sourceAgent}' (${code})` };
384
+ }
385
+ return { ok: true, resume };
386
+ }
285
387
  async function emitConsumed(ingestor, material, item, extra = {}) {
286
388
  await ingestor.ingest({
287
389
  type: 'cycle.consumed',
@@ -361,9 +463,18 @@ async function processMaterial(material, opts, deps) {
361
463
  ackOne(deps.consumer, material);
362
464
  return item;
363
465
  }
364
- let extracted;
466
+ let sources;
467
+ let liveResumeSources;
365
468
  try {
366
- extracted = materialSignals(material);
469
+ const resolvedSources = runtimeSessionSourcesForMaterialDetails(material, undefined, deps.nativeSessionHome);
470
+ const sourceAvailable = materialSourceAvailable(material);
471
+ if (opts.resume && sourceAvailable && resolvedSources.sourceError) {
472
+ throw resolvedSources.sourceError;
473
+ }
474
+ sources = resolvedSources.sources;
475
+ // A successful read is authoritative even if the source disappears before the availability check.
476
+ // Discarding captured provenance here could resume a stale snapshot identity.
477
+ liveResumeSources = opts.resume ? resolvedSources.liveSources : undefined;
367
478
  }
368
479
  catch (error) {
369
480
  const reason = error instanceof Error ? error.message : String(error);
@@ -372,6 +483,22 @@ async function processMaterial(material, opts, deps) {
372
483
  ackOne(deps.consumer, material);
373
484
  return item;
374
485
  }
486
+ const resume = opts.resume
487
+ ? resolveMaterialResume(material, runner.runner, sources, liveResumeSources)
488
+ : undefined;
489
+ if (resume && !resume.ok) {
490
+ const item = {
491
+ materialId: material.materialId,
492
+ action: 'fail',
493
+ status: 'refused',
494
+ cycleId,
495
+ reason: resume.error,
496
+ };
497
+ await emitConsumed(deps.ingestor, material, item);
498
+ ackOne(deps.consumer, material);
499
+ return item;
500
+ }
501
+ const extracted = materialSignals(sources);
375
502
  if (extracted.sourceCount === 0 || extracted.signals.length === 0) {
376
503
  const reason = extracted.sourceCount === 0 ? 'no parseable runtime session source' : 'no cycle-worthy session signals';
377
504
  const item = { materialId: material.materialId, action: 'fail', status: 'no_signals', cycleId, reason };
@@ -379,6 +506,19 @@ async function processMaterial(material, opts, deps) {
379
506
  ackOne(deps.consumer, material);
380
507
  return item;
381
508
  }
509
+ if ((runner.runner === 'claude' || runner.runner === 'codex') && !opts.agent) {
510
+ const runnerName = runner.runner === 'claude' ? 'Claude' : 'Codex';
511
+ const item = {
512
+ materialId: material.materialId,
513
+ action: 'fail',
514
+ status: 'refused',
515
+ cycleId,
516
+ reason: `execute capability is unsupported: built-in ${runnerName} requires a verified host filesystem sandbox`,
517
+ };
518
+ await emitConsumed(deps.ingestor, material, item);
519
+ ackOne(deps.consumer, material);
520
+ return item;
521
+ }
382
522
  const repo = resolve(opts.repo);
383
523
  const task = {
384
524
  id: `material-${material.materialId}`,
@@ -393,6 +533,7 @@ async function processMaterial(material, opts, deps) {
393
533
  ...(opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : {}),
394
534
  ...opts.safety,
395
535
  runner: runner.runner,
536
+ ...(resume?.ok ? { resume: resume.resume } : {}),
396
537
  ...(opts.signal ? { signal: opts.signal } : {}),
397
538
  };
398
539
  const verdict = await exec.runAutoExecTask({
@@ -418,6 +559,7 @@ async function processMaterial(material, opts, deps) {
418
559
  signalCount: extracted.signals.length,
419
560
  signals: extracted.signals,
420
561
  runner: runner.runner,
562
+ ...(resume?.ok && verdict.status === 'solidified' ? { resumedSession: true } : {}),
421
563
  });
422
564
  ackOne(deps.consumer, material);
423
565
  return item;
@@ -864,7 +1006,13 @@ export async function runCycleCommand(argv, injectedDeps = {}) {
864
1006
  return 0;
865
1007
  }
866
1008
  if (argv[0] === 'watch') {
867
- const flags = parseFlags(argv.slice(1));
1009
+ const watchArgv = argv.slice(1);
1010
+ const flags = parseFlags(watchArgv);
1011
+ const resume = parseSwitchFlag(watchArgv, 'resume');
1012
+ if (resume === null) {
1013
+ process.stderr.write(WATCH_USAGE);
1014
+ return 1;
1015
+ }
868
1016
  const runner = parseRunner(flags['runner']);
869
1017
  if (!runner.ok) {
870
1018
  process.stderr.write(`${runner.error}\n`);
@@ -906,6 +1054,7 @@ export async function runCycleCommand(argv, injectedDeps = {}) {
906
1054
  try {
907
1055
  result = await runMaterialCycleWatch({
908
1056
  repo,
1057
+ ...(resume ? { resume: true } : {}),
909
1058
  limit: parsePositiveInt(flags['limit'], DEFAULT_LIMIT),
910
1059
  target: flags['target'] || '.',
911
1060
  expectedEffect: flags['expected-effect'] || 'evolve from consumed session material',
@@ -1006,6 +1155,11 @@ export async function runCycleCommand(argv, injectedDeps = {}) {
1006
1155
  return result.stopped === 'cancelled' ? cancellation.exitCode() : 0;
1007
1156
  }
1008
1157
  const flags = parseFlags(argv);
1158
+ const resume = parseSwitchFlag(argv, 'resume');
1159
+ if (resume === null) {
1160
+ process.stderr.write(CYCLE_USAGE);
1161
+ return 1;
1162
+ }
1009
1163
  const runner = parseRunner(flags['runner']);
1010
1164
  if (!runner.ok) {
1011
1165
  process.stderr.write(`${runner.error}\n`);
@@ -1033,6 +1187,7 @@ export async function runCycleCommand(argv, injectedDeps = {}) {
1033
1187
  try {
1034
1188
  result = await runMaterialCycleConsumer({
1035
1189
  repo,
1190
+ ...(resume ? { resume: true } : {}),
1036
1191
  limit: parsePositiveInt(flags['limit'], DEFAULT_LIMIT),
1037
1192
  target: flags['target'] || '.',
1038
1193
  expectedEffect: flags['expected-effect'] || 'evolve from consumed session material',
package/dist/dashboard.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { assetstore, events, ops, personality, workflow } from '@evomap/evolver-core';
2
+ import { lstatSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { assetstore, events, mailbox, ops, personality, workflow } from '@evomap/evolver-core';
3
5
  import { loadPriceTable } from '@evomap/evolver-adapter-public';
4
6
  import { loadEnvFileFromEnv } from '@evomap/evolver-mcp';
5
7
  import { createGithubPrDiagnosticsProvider, readLogDiagnostics, readPersonalityDiagnostics, WebUIServer, } from '@evomap/evolver-webui';
@@ -201,9 +203,11 @@ export function createDashboardServer(memoryGraphStatus, env = process.env) {
201
203
  });
202
204
  const logFile = lifecyclePaths(resolvedEnv).logFile;
203
205
  const githubPrDiagnostics = createGithubPrDiagnosticsProvider({ cwd: process.cwd() });
204
- return new WebUIServer({
206
+ const mailboxStore = openDashboardMailbox(resolvedEnv);
207
+ const server = new WebUIServer({
205
208
  eventsPath,
206
209
  store,
210
+ ...(mailboxStore ? { mailbox: mailboxStore } : {}),
207
211
  valueSummary: (window, eventSnapshot) => ops.loadValueSummary({
208
212
  traces: ops.readTraceRecords(tracesDir),
209
213
  events: eventSnapshot,
@@ -220,6 +224,42 @@ export function createDashboardServer(memoryGraphStatus, env = process.env) {
220
224
  memoryGraphStatus,
221
225
  workflow: createDashboardWorkflowProvider(resolvedEnv),
222
226
  });
227
+ if (!mailboxStore)
228
+ return server;
229
+ let closed = false;
230
+ return {
231
+ token: server.token,
232
+ launchTicket: server.launchTicket,
233
+ listen: (port) => server.listen(port),
234
+ close: async () => {
235
+ if (closed)
236
+ return;
237
+ closed = true;
238
+ try {
239
+ await server.close();
240
+ }
241
+ catch (error) {
242
+ if (error.code !== 'ERR_SERVER_NOT_RUNNING')
243
+ throw error;
244
+ }
245
+ finally {
246
+ mailboxStore.close();
247
+ }
248
+ },
249
+ };
250
+ }
251
+ function openDashboardMailbox(env) {
252
+ const configured = env['EVOLVER_PROXY_STORE']?.trim();
253
+ const path = configured || join(events.evomapHome(env), 'proxy', 'mailbox.db');
254
+ try {
255
+ const stat = lstatSync(path);
256
+ if (!stat.isFile() || stat.isSymbolicLink())
257
+ return undefined;
258
+ return new mailbox.MailboxStore({ path });
259
+ }
260
+ catch {
261
+ return undefined;
262
+ }
223
263
  }
224
264
  export function dashboardOpenCommand(url, platform = process.platform) {
225
265
  if (platform === 'win32')
@@ -340,13 +380,11 @@ export async function runDashboardCommand(argv, deps = {}, options = {}) {
340
380
  return 1;
341
381
  }
342
382
  finally {
343
- if (listening) {
344
- try {
345
- await server.close();
346
- }
347
- catch {
348
- // The process is already shutting down; avoid replacing the command result with a close race.
349
- }
383
+ try {
384
+ await server.close();
385
+ }
386
+ catch {
387
+ // The command result takes precedence over a close race or an unbound HTTP server.
350
388
  }
351
389
  }
352
390
  }
package/dist/dispatch.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // this module holds the dispatch DATA so the surface is importable and assertable (see commandSurface.test.ts).
4
4
  // The "phantom command" trap this guards against: an installer baking `evolver <verb>` into a user's runtime
5
5
  // config for a verb the CLI never actually dispatches — a green build hides it, the user hits a usage error.
6
- import { runCli, runMigrate, runAssetLog, runDistill, runIngest, runInject, runReview, } from './index.js';
6
+ import { runCli, runMigrate, runAssetLog, runDistill, runIngest, runInject, runReview, runDaily, } from './index.js';
7
7
  import { runAutoExec } from './autoexec.js';
8
8
  import { runAtpCommand, runBuyCommand, runOrdersCommand, runVerifyCommand } from './atp.js';
9
9
  import { runLogin, runLogout } from './login.js';
@@ -17,6 +17,7 @@ import { runReuseCommand } from './reuse.js';
17
17
  import { runPublishCommand } from './cliContracts.js';
18
18
  import { runRecallCommand } from './recall.js';
19
19
  import { runReuseReportCommand } from './reuseReport.js';
20
+ import { runRecallVerifyReportCommand } from './recallVerifyReport.js';
20
21
  import { runDoctorCommand } from './doctor.js';
21
22
  import { runPhubCommand } from './phub.js';
22
23
  import { runTrajectoryExport } from './trajectoryExport.js';
@@ -31,7 +32,7 @@ import { runDashboardCommand } from './dashboard.js';
31
32
  import { runIssueReportCommand } from './issueReport.js';
32
33
  import { runAssetTrustCommand } from './assetTrust.js';
33
34
  import { runAssetHealthCommand } from './assetHealth.js';
34
- import { runV1FetchCompat, runV1RunCompat, runV1SolidifyCompat, runV1WebuiCompat } from './v1Compat.js';
35
+ import { runV1FetchCompat, runV1RunCompat, runV1SolidifyCompat, runV1WebuiCompat, runV1ExecCompat } from './v1Compat.js';
35
36
  import { runWorkflowCommand } from './workflow.js';
36
37
  export async function runProxyCommand(argv, importer = () => import('@evomap/evolver-proxy/bin/evolver-proxy')) {
37
38
  const { runProxyCli } = await importer();
@@ -45,6 +46,7 @@ export const ASYNC_COMMANDS = {
45
46
  ingest: runIngest,
46
47
  inject: runInject,
47
48
  review: runReview,
49
+ daily: runDaily,
48
50
  skill: runSkillCommand,
49
51
  'skill-distill': runSkillDistill,
50
52
  'skill-md-update': runSkillMdUpdate,
@@ -64,6 +66,7 @@ export const ASYNC_COMMANDS = {
64
66
  sync: runSyncCommand,
65
67
  recall: runRecallCommand,
66
68
  'reuse-report': runReuseReportCommand,
69
+ 'recall-verify-report': runRecallVerifyReportCommand,
67
70
  doctor: runDoctorCommand,
68
71
  phub: runPhubCommand,
69
72
  lifecycle: runLifecycleCommand,
@@ -81,6 +84,7 @@ export const ASYNC_COMMANDS = {
81
84
  solidify: runV1SolidifyCompat,
82
85
  fetch: runV1FetchCompat,
83
86
  webui: runV1WebuiCompat,
87
+ exec: runV1ExecCompat,
84
88
  workflow: runWorkflowCommand,
85
89
  };
86
90
  /** Verbs handled by the synchronous runCli core (read-only views + local ops). Kept in sync with runCli's switch
@@ -74,8 +74,24 @@ const NARRATION_OPENER = /^(let me (take a (closer )?)?look|let me (check|see|in
74
74
  * that opens with narration is dropped ONLY when it has none of these — so "let me check … the root cause is X,
75
75
  * fix by Y" keeps its substantive remainder rather than being discarded for its opener. */
76
76
  const HAS_SUBSTANCE = /\b(because|so that|root cause|the (issue|bug|problem|fix|error)|fix(ed|es|ing)?|add(ed|ing)?|remov(e|ed|ing)|delet(e|ed|ing)|chang(e|ed|ing)?|updat(e|ed|ing)?|replac(e|ed|ing)?|renam(e|ed|ing)?|implement(ed|ing)?|revert(ed)?|switch(ed|ing)?|configur(e|ed|ing)?|install(ed|ing)?|return(s|ed)?|throw(s|n)?|catch|wrap(ped)?|guard|import(ed|s)?|export(ed|s)?|re-?run|retry|set\s)\b/i;
77
+ const HAS_CJK_TEXT = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u;
78
+ // Require whitespace after ASCII punctuation unless CJK starts immediately, so dots in paths stay intact.
79
+ const NARRATION_SENTENCE_END = /^.*?(?:[.!?](?:\s+|(?=[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]))|[。!?]\s*)/u;
80
+ function narrationRemainder(raw) {
81
+ const boundary = NARRATION_SENTENCE_END.exec(raw);
82
+ if (!boundary)
83
+ return undefined;
84
+ const rest = raw.slice(boundary[0].length).trim();
85
+ return rest.length >= 40 ? rest : undefined;
86
+ }
77
87
  function isNarrationOnly(raw) {
78
- return NARRATION_OPENER.test(raw) && !HAS_SUBSTANCE.test(raw) && !/[`]|[\w/-]+\.[a-z]{2,5}\b|\/[\w./-]+/.test(raw);
88
+ if (!NARRATION_OPENER.test(raw))
89
+ return false;
90
+ const rest = narrationRemainder(raw);
91
+ const hasCjkRemainder = rest !== undefined && HAS_CJK_TEXT.test(rest);
92
+ return !hasCjkRemainder
93
+ && !HAS_SUBSTANCE.test(raw)
94
+ && !/[`]|[\w/-]+\.[a-z]{2,5}\b|\/[\w./-]+/.test(raw);
79
95
  }
80
96
  /** When a turn opens with narration but states real substance, drop the leading narration sentence so the step
81
97
  * LEADS with the cause/fix — otherwise the (capped) step could be narration while the substance is trimmed off.
@@ -83,11 +99,7 @@ function isNarrationOnly(raw) {
83
99
  function dropNarrationOpener(raw) {
84
100
  if (!NARRATION_OPENER.test(raw))
85
101
  return raw;
86
- const m = /^.*?[.!?。]\s+/.exec(raw);
87
- if (!m)
88
- return raw;
89
- const rest = raw.slice(m[0].length).trim();
90
- return rest.length >= 40 ? rest : raw;
102
+ return narrationRemainder(raw) ?? raw;
91
103
  }
92
104
  /** Draft strategy steps = the agent's own substantive (non-meta) turns — boundary-trimmed (never chopped
93
105
  * mid-word); turns that are PURELY narration ("let me look around" with no cause/action) are dropped, and a
package/dist/doctor.js CHANGED
@@ -4,7 +4,7 @@
4
4
  // (heartbeat, proxy path) touch the proxy and are a SEPARATE, gated step — not here.
5
5
  import { readFileSync, existsSync, statSync } from 'node:fs';
6
6
  import { isAbsolute, join } from 'node:path';
7
- import { events, issueReporter } from '@evomap/evolver-core';
7
+ import { bootstrap, events, issueReporter } from '@evomap/evolver-core';
8
8
  import { expandHomePath, parseEnvFile } from '@evomap/evolver-mcp';
9
9
  import { formatMemoryGraphOperatorStatus, loadMemoryGraphOperatorStatus } from './localMemoryGraph.js';
10
10
  // Secrets that must live ONLY behind the EVOLVER_ENV_FILE pointer — never inlined into a runtime config (#217).
@@ -109,10 +109,18 @@ const ENV_CATALOG_DEFINITIONS = [
109
109
  defaultValue: 'unset',
110
110
  },
111
111
  {
112
- name: 'EVOLVER_HEARTBEAT_MS',
112
+ name: 'HEARTBEAT_INTERVAL_MS',
113
113
  group: 'hub-runtime',
114
- purpose: 'Proxy heartbeat interval.',
114
+ purpose: 'Proxy heartbeat interval for the Hub lifecycle manager.',
115
115
  requiredFor: 'proxy daemon heartbeat tuning',
116
+ defaultValue: '360000',
117
+ },
118
+ {
119
+ name: 'EVOLVER_HEARTBEAT_MS',
120
+ group: 'observability',
121
+ purpose: 'Interval for autoexec cycle.heartbeat observability events.',
122
+ requiredFor: 'autoexec heartbeat log tuning',
123
+ defaultValue: '60000',
116
124
  },
117
125
  {
118
126
  name: 'EVOLVER_PROXY_URL',
@@ -181,9 +189,15 @@ const ENV_CATALOG_DEFINITIONS = [
181
189
  requiredFor: 'probation rollout',
182
190
  defaultValue: '0',
183
191
  },
192
+ {
193
+ name: 'EVOLVER_AUTO_DISTILL',
194
+ group: 'distill',
195
+ purpose: 'Controls structural distillation from completed evolution cycles.',
196
+ requiredFor: 'structural gene distill',
197
+ defaultValue: 'enabled unless set to 0',
198
+ },
184
199
  {
185
200
  name: 'EVOLVER_AUTO_DISTILL_LLM',
186
- aliases: ['EVOLVER_AUTO_DISTILL'],
187
201
  group: 'distill',
188
202
  purpose: 'Enables LLM distillation from successful capsules.',
189
203
  requiredFor: 'online gene distill',
@@ -390,12 +404,26 @@ const ENV_CATALOG_DEFINITIONS = [
390
404
  requiredFor: 'operator-approved ATP automation',
391
405
  defaultValue: 'off',
392
406
  },
407
+ {
408
+ name: 'ATP_AUTOBUY_DAILY_CAP_CREDITS',
409
+ group: 'marketplace-atp',
410
+ purpose: 'Hard UTC-day spending cap for automatic ATP purchases.',
411
+ requiredFor: 'ATP auto-buyer budget control',
412
+ defaultValue: '50',
413
+ },
414
+ {
415
+ name: 'ATP_AUTOBUY_PER_ORDER_CAP_CREDITS',
416
+ group: 'marketplace-atp',
417
+ purpose: 'Hard per-order spending cap for automatic ATP purchases.',
418
+ requiredFor: 'ATP auto-buyer budget control',
419
+ defaultValue: '10',
420
+ },
393
421
  {
394
422
  name: 'EVOLVER_ATP_AUTODELIVER',
395
423
  group: 'marketplace-atp',
396
424
  purpose: 'Controls automatic ATP delivery behavior.',
397
425
  requiredFor: 'operator-approved ATP automation',
398
- defaultValue: 'off',
426
+ defaultValue: 'on (opt-out)',
399
427
  },
400
428
  {
401
429
  name: 'EVOLVER_LIFECYCLE_COMMAND',
@@ -537,6 +565,36 @@ export function runDoctorChecks(deps = {}) {
537
565
  }
538
566
  }
539
567
  }
568
+ // 1b. v1-env-compat: warn when V1-only knobs are still set (process env and/or EVOLVER_ENV_FILE). Refs #698.
569
+ {
570
+ const merged = { ...env, ...envFileValues };
571
+ const compat = bootstrap.scanV1EnvCompat(merged);
572
+ if (compat.detected.length === 0) {
573
+ checks.push({
574
+ name: 'v1-env-compat',
575
+ status: 'pass',
576
+ detail: 'no deprecated V1-only env knobs detected (see `evolver migrate env`)',
577
+ });
578
+ }
579
+ else {
580
+ const names = compat.detected.map((d) => d.v1Name).join(', ');
581
+ const maps = compat.detected
582
+ .filter((d) => bootstrap.resolveV1EnvMigrationAction(d) === 'map' && d.v2Equivalent)
583
+ .map((d) => `${d.v1Name}→${d.v2Equivalent}`)
584
+ .join(', ');
585
+ const manual = compat.detected.filter((d) => bootstrap.resolveV1EnvMigrationAction(d) === 'manual').map((d) => d.v1Name).join(', ');
586
+ const drops = compat.detected.filter((d) => bootstrap.resolveV1EnvMigrationAction(d) === 'remove').map((d) => d.v1Name).join(', ');
587
+ const parts = [`${compat.detected.length} deprecated V1 env var(s): ${names}`];
588
+ if (maps)
589
+ parts.push(`map: ${maps}`);
590
+ if (manual)
591
+ parts.push(`manual: ${manual}`);
592
+ if (drops)
593
+ parts.push(`remove: ${drops}`);
594
+ parts.push('run `evolver migrate env` or see docs/migration-guide.md');
595
+ checks.push({ name: 'v1-env-compat', status: 'warn', detail: parts.join(' — ') });
596
+ }
597
+ }
540
598
  // 2. config-no-secrets: runtime config must reference creds via the EVOLVER_ENV_FILE pointer, never inline a secret.
541
599
  const offenders = [];
542
600
  for (const rel of CONFIG_FILES) {
@@ -42,5 +42,6 @@ export function resolveIdentityHome(env = process.env, homeDir) {
42
42
  const explicit = [env['EVOMAP_HOME'], env['EVOMAP_DIR'], env['EVOLVER_HOME']]
43
43
  .map(nonBlank)
44
44
  .filter((value) => value !== undefined);
45
- return explicit[0] ?? join(homeDir ?? homedir(), '.evomap');
45
+ const fallbackHome = nonBlank(env['HOME']) ?? homeDir ?? homedir();
46
+ return explicit[0] ?? join(fallbackHome, '.evomap');
46
47
  }