@evomap/evolver-cli 2.0.0-beta.9 → 2.0.1

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 (87) hide show
  1. package/dist/antiGeneBenchmark.js +2 -0
  2. package/dist/antiGeneRollout.js +9 -3
  3. package/dist/assetHealth.js +2 -0
  4. package/dist/assetTrust.js +14 -1
  5. package/dist/atp.d.ts +10 -5
  6. package/dist/atp.js +119 -26
  7. package/dist/atpAutoBuyer.d.ts +120 -0
  8. package/dist/atpAutoBuyer.js +814 -0
  9. package/dist/atpAutoDeliver.js +2 -2
  10. package/dist/autoDistillLlm.js +2 -1
  11. package/dist/autoDistillTranscript.js +3 -2
  12. package/dist/autoexec.d.ts +101 -13
  13. package/dist/autoexec.js +794 -91
  14. package/dist/cli.js +13 -0
  15. package/dist/cliContracts.d.ts +23 -2
  16. package/dist/cliContracts.js +504 -54
  17. package/dist/commands.d.ts +1 -0
  18. package/dist/commands.js +1 -0
  19. package/dist/curriculumCapabilityGaps.d.ts +6 -0
  20. package/dist/curriculumCapabilityGaps.js +24 -0
  21. package/dist/cycleConsumer.d.ts +13 -0
  22. package/dist/cycleConsumer.js +186 -20
  23. package/dist/dashboard.js +47 -9
  24. package/dist/dispatch.js +8 -2
  25. package/dist/distillPrimitives.d.ts +3 -2
  26. package/dist/distillPrimitives.js +80 -12
  27. package/dist/doctor.js +120 -11
  28. package/dist/identityHome.d.ts +9 -0
  29. package/dist/identityHome.js +47 -0
  30. package/dist/index.d.ts +70 -40
  31. package/dist/index.js +581 -193
  32. package/dist/learningTrace.d.ts +15 -0
  33. package/dist/learningTrace.js +73 -0
  34. package/dist/lifecycle.d.ts +67 -1
  35. package/dist/lifecycle.js +738 -44
  36. package/dist/localMemoryGraph.d.ts +90 -3
  37. package/dist/localMemoryGraph.js +2031 -231
  38. package/dist/login.d.ts +1 -1
  39. package/dist/login.js +3 -3
  40. package/dist/materialSnapshot.d.ts +9 -1
  41. package/dist/materialSnapshot.js +23 -6
  42. package/dist/memoryGraphOps.d.ts +8 -0
  43. package/dist/memoryGraphOps.js +140 -0
  44. package/dist/migrate/assetFormatMap.d.ts +61 -0
  45. package/dist/migrate/assetFormatMap.js +53 -0
  46. package/dist/migrate/envTranslate.d.ts +26 -0
  47. package/dist/migrate/envTranslate.js +147 -0
  48. package/dist/migrate/fieldMap.d.ts +4 -2
  49. package/dist/migrate/fieldMap.js +9 -5
  50. package/dist/migrate/oauthImport.d.ts +66 -0
  51. package/dist/migrate/oauthImport.js +667 -0
  52. package/dist/migrate/v1Import.d.ts +92 -1
  53. package/dist/migrate/v1Import.js +1481 -141
  54. package/dist/promptRecallHook.d.ts +24 -0
  55. package/dist/promptRecallHook.js +425 -0
  56. package/dist/recallVerifyReport.d.ts +37 -0
  57. package/dist/recallVerifyReport.js +244 -0
  58. package/dist/recipe.d.ts +7 -1
  59. package/dist/recipe.js +426 -56
  60. package/dist/requiredSandboxValidation.d.ts +5 -0
  61. package/dist/requiredSandboxValidation.js +4 -0
  62. package/dist/reuse.d.ts +9 -0
  63. package/dist/reuse.js +151 -56
  64. package/dist/runtimeCapabilities.js +15 -15
  65. package/dist/runtimeSessionSource.d.ts +3 -2
  66. package/dist/runtimeSessionSource.js +63 -11
  67. package/dist/selectionPolicyConfig.d.ts +8 -0
  68. package/dist/selectionPolicyConfig.js +18 -0
  69. package/dist/semanticIdfConfig.d.ts +2 -0
  70. package/dist/semanticIdfConfig.js +4 -0
  71. package/dist/sessionIngest.d.ts +37 -0
  72. package/dist/sessionIngest.js +156 -0
  73. package/dist/setupHooks.js +95 -1
  74. package/dist/skill2gep.d.ts +13 -9
  75. package/dist/skill2gep.js +42 -30
  76. package/dist/skillDistill.d.ts +8 -4
  77. package/dist/skillDistill.js +38 -9
  78. package/dist/solo/mode.js +1 -0
  79. package/dist/sync.d.ts +12 -0
  80. package/dist/sync.js +1246 -151
  81. package/dist/thesis.d.ts +1 -1
  82. package/dist/thesis.js +20 -3
  83. package/dist/trajectoryExport.js +21 -3
  84. package/dist/v1Compat.d.ts +1 -0
  85. package/dist/v1Compat.js +9 -0
  86. package/dist/workflowRuntime.js +24 -18
  87. package/package.json +11 -8
@@ -2,7 +2,7 @@
2
2
  // `evolver ingest --distill` and the live distillObserver reuse ONE copy (no forked distill logic). Zero behavior
3
3
  // change vs the inline version: same tokens, same step drafting, same candidate shape. No I/O — the caller parses
4
4
  // the session into turns + extracts signals; this turns them into a draft GeneCandidate (or null when too thin).
5
- import { algo } from '@evomap/evolver-core';
5
+ import { algo, hub } from '@evomap/evolver-core';
6
6
  // Map a strong signal's free-text to a SHORT, matchable token (so a gene's signals_match stays a few
7
7
  // keywords, not a dumped error blob). Deterministic + testable; unknown errors fall back to the tool name only.
8
8
  const SIGNAL_ERROR_CLASSES = [
@@ -14,10 +14,11 @@ const SIGNAL_ERROR_CLASSES = [
14
14
  [/permission denied/i, 'permission-denied'],
15
15
  [/timed?\s?out/i, 'timeout'],
16
16
  ];
17
- /** Short matchable signal tokens from the STRONG signals only (toolName + a known error class). Every strong
18
- * signal yields ≥1 token: if it has no toolName and matches no known error class (e.g. `FAILED: …` or
17
+ /** Short matchable signal tokens from STRONG signals (error classes) and SUCCESS signals (verified capabilities).
18
+ * Every strong signal yields ≥1 token: if it has no toolName and matches no known error class (e.g. `FAILED: …` or
19
19
  * `Error: connection refused`), it falls back to its kind (`structured_error`/`error_result`) so a real strong
20
20
  * signal is never silently tokenless — keeping `signals_match.length === 0` an honest "no strong signal" gate.
21
+ * Success signals (#578) also produce tokens so a purely successful session can yield a matchable gene.
21
22
  * Deduped, ≤8. */
22
23
  export function signalTokens(sigs) {
23
24
  const set = new Set();
@@ -38,6 +39,22 @@ export function signalTokens(sigs) {
38
39
  if (!matched)
39
40
  set.add(s.kind);
40
41
  }
42
+ // A later failure invalidates an earlier successful intermediate command. Conversely, fail-then-pass remains a
43
+ // valid repair history because the last deterministic outcome is the verified success.
44
+ const lastOutcome = sigs.findLast((s) => s.strength === 'strong' || s.strength === 'weak' || (s.strength === 'success' && !s.needsAnalysis));
45
+ const terminalSuccess = lastOutcome?.strength === 'success' && !lastOutcome.needsAnalysis;
46
+ // Only confirmed terminal success enters the deterministic path. Prose marked needsAnalysis is left to transcript
47
+ // LLM distillation instead of triggering a material cycle before analysis has happened.
48
+ for (const s of terminalSuccess ? sigs : []) {
49
+ if (s.strength !== 'success' || s.needsAnalysis)
50
+ continue;
51
+ if (s.toolName)
52
+ set.add(s.toolName);
53
+ if (s.kind === 'verified_success')
54
+ set.add('verified-success');
55
+ else
56
+ set.add(s.kind);
57
+ }
41
58
  return [...set].slice(0, 8);
42
59
  }
43
60
  /** Trim free text to a clean step: collapse whitespace, and when longer than `cap` keep as much as fits, cutting
@@ -57,8 +74,24 @@ const NARRATION_OPENER = /^(let me (take a (closer )?)?look|let me (check|see|in
57
74
  * that opens with narration is dropped ONLY when it has none of these — so "let me check … the root cause is X,
58
75
  * fix by Y" keeps its substantive remainder rather than being discarded for its opener. */
59
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
+ }
60
87
  function isNarrationOnly(raw) {
61
- 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);
62
95
  }
63
96
  /** When a turn opens with narration but states real substance, drop the leading narration sentence so the step
64
97
  * LEADS with the cause/fix — otherwise the (capped) step could be narration while the substance is trimmed off.
@@ -66,11 +99,7 @@ function isNarrationOnly(raw) {
66
99
  function dropNarrationOpener(raw) {
67
100
  if (!NARRATION_OPENER.test(raw))
68
101
  return raw;
69
- const m = /^.*?[.!?。]\s+/.exec(raw);
70
- if (!m)
71
- return raw;
72
- const rest = raw.slice(m[0].length).trim();
73
- return rest.length >= 40 ? rest : raw;
102
+ return narrationRemainder(raw) ?? raw;
74
103
  }
75
104
  /** Draft strategy steps = the agent's own substantive (non-meta) turns — boundary-trimmed (never chopped
76
105
  * mid-word); turns that are PURELY narration ("let me look around" with no cause/action) are dropped, and a
@@ -83,7 +112,7 @@ export function draftStrategy(turns) {
83
112
  for (const t of turns) {
84
113
  if (t.role !== 'assistant' || t.isMeta)
85
114
  continue;
86
- const raw = (t.text ?? '').replace(/\s+/g, ' ').trim();
115
+ const raw = hub.redactString(t.text ?? '').replace(/\s+/g, ' ').trim();
87
116
  if (raw.length < 40)
88
117
  continue; // too short to be a step
89
118
  if (isNarrationOnly(raw))
@@ -96,6 +125,17 @@ export function draftStrategy(turns) {
96
125
  }
97
126
  return steps.slice(-6); // the latest substantive actions (closest to the resolution)
98
127
  }
128
+ const GENERIC_SUCCESS_TOPICS = new Set([
129
+ 'added', 'adjusted', 'assistant', 'change', 'changed', 'changes', 'command', 'commands', 'complete',
130
+ 'completed', 'coverage', 'fixed', 'handling', 'implementation', 'passed', 'passing', 'regression', 'result',
131
+ 'results', 'successful', 'successfully', 'tests', 'updated', 'validation', 'verified',
132
+ ]);
133
+ function successTopicSignals(strategy) {
134
+ const text = strategy.join(' ');
135
+ return hub.extractTopicKeywords(text, undefined, 24, { minOccurrences: 1, preserveSourceOrder: true })
136
+ .filter((topic) => !GENERIC_SUCCESS_TOPICS.has(topic))
137
+ .slice(0, 4);
138
+ }
99
139
  /**
100
140
  * Assemble an UNPROVEN draft GeneCandidate from a parsed session, or null when too thin to distill (no strong
101
141
  * signal OR no substantive step). The single source of the "what makes a draftable session" gate + candidate
@@ -105,10 +145,36 @@ export function draftStrategy(turns) {
105
145
  export function draftGeneCandidate(turns, sigs, agent) {
106
146
  const signals_match = signalTokens(sigs);
107
147
  const strategy = draftStrategy(turns);
108
- if (signals_match.length === 0 || strategy.length === 0) {
148
+ const hadVerifiedSuccess = sigs.some((s) => s.strength === 'success' && !s.needsAnalysis);
149
+ const hasTerminalVerifiedSuccess = signals_match.includes('verified-success');
150
+ // 当只有成功信号(没有错误信号)时,走 innovate 路径而非 repair (#578):
151
+ // 一次成功的问题解决过程不应被分类为 repair —— 它是一个可复用的成功能力。
152
+ const hasStrongError = sigs.some((s) => s.strength === 'strong');
153
+ if (signals_match.length === 0 || strategy.length === 0 || !hasStrongError) {
154
+ // Do not let the capability sniffer resurrect a success that a later unresolved outcome already superseded.
155
+ if (hadVerifiedSuccess && !hasTerminalVerifiedSuccess && !hasStrongError)
156
+ return null;
109
157
  const hit = algo.sniffConversationCapabilities(turns)[0];
110
- if (!hit)
158
+ if (!hit) {
159
+ // Sniffer 也未命中:如果有 success 信号和 strategy(仅当 hasStrongError 为 false 才走到这里且 signals_match 非空),
160
+ // 仍然产出 gene,但标记为 innovate —— 这是一个被验证的能力,而非错误修复。
161
+ if (signals_match.length > 0 && strategy.length > 0) {
162
+ const topics = successTopicSignals(strategy);
163
+ // Generic runner + success tokens are not a reusable capability identity. Let the optional transcript-LLM
164
+ // path handle prose that has no safe discriminating topic instead of storing one global shell-success gene.
165
+ if (topics.length === 0)
166
+ return null;
167
+ const successSignals = [...new Set([...signals_match, ...topics])].slice(0, 8);
168
+ return {
169
+ category: 'innovate',
170
+ signals_match: successSignals,
171
+ strategy,
172
+ summary: `Auto-drafted from ${agent} session (UNPROVEN — curate via review): ${topics.slice(0, 3).join(', ')}`,
173
+ generation_meta: { source: 'distilled' },
174
+ };
175
+ }
111
176
  return null;
177
+ }
112
178
  const fallbackStrategy = hit.evidence;
113
179
  if (fallbackStrategy.length === 0)
114
180
  return null;
@@ -149,6 +215,8 @@ const GENERIC_NOVELTY_SIGNALS = new Set([
149
215
  'sh',
150
216
  'cmd',
151
217
  'command',
218
+ 'verified-success',
219
+ 'verified_success',
152
220
  ]);
153
221
  function normalizeSignalSet(values) {
154
222
  return new Set((values ?? []).map((value) => String(value).trim().toLowerCase()).filter(Boolean));
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',
@@ -162,6 +170,20 @@ const ENV_CATALOG_DEFINITIONS = [
162
170
  requiredFor: 'reuse ranking tuning',
163
171
  defaultValue: 'enabled unless set to 0',
164
172
  },
173
+ {
174
+ name: 'EVOLVER_SEMANTIC_IDF',
175
+ group: 'autoexec-selection',
176
+ purpose: 'Emergency rollback for trusted-corpus IDF semantic weighting.',
177
+ requiredFor: 'selection ranking rollout',
178
+ defaultValue: 'enabled unless set to 0',
179
+ },
180
+ {
181
+ name: 'EVOLVER_SELECTION_POLICY',
182
+ group: 'autoexec-selection',
183
+ purpose: 'Controls plateau exploration: engine-health, UCB1 shadow, or explicit UCB1 canary.',
184
+ requiredFor: 'selection exploration rollout',
185
+ defaultValue: 'engine-health',
186
+ },
165
187
  {
166
188
  name: 'EVOLVER_REUSE_MODE',
167
189
  group: 'autoexec-reuse',
@@ -181,9 +203,15 @@ const ENV_CATALOG_DEFINITIONS = [
181
203
  requiredFor: 'probation rollout',
182
204
  defaultValue: '0',
183
205
  },
206
+ {
207
+ name: 'EVOLVER_AUTO_DISTILL',
208
+ group: 'distill',
209
+ purpose: 'Controls structural distillation from completed evolution cycles.',
210
+ requiredFor: 'structural gene distill',
211
+ defaultValue: 'enabled unless set to 0',
212
+ },
184
213
  {
185
214
  name: 'EVOLVER_AUTO_DISTILL_LLM',
186
- aliases: ['EVOLVER_AUTO_DISTILL'],
187
215
  group: 'distill',
188
216
  purpose: 'Enables LLM distillation from successful capsules.',
189
217
  requiredFor: 'online gene distill',
@@ -286,8 +314,9 @@ const ENV_CATALOG_DEFINITIONS = [
286
314
  {
287
315
  name: 'EVOLVER_SESSION_SOURCE',
288
316
  group: 'trajectory-export',
289
- purpose: 'Runtime session source selector.',
290
- requiredFor: 'runtime adapter filtering',
317
+ purpose: 'Legacy V1 session collector selector; ignored by V2 runtime behavior, detected only for migration, and has no one-to-one replacement.',
318
+ requiredFor: 'none; review explicit runtime discovery or transcript directories before removing',
319
+ defaultValue: 'ignored',
291
320
  },
292
321
  {
293
322
  name: 'EVOLVER_TRAJECTORY_INCLUDE_UNMARKED',
@@ -379,9 +408,9 @@ const ENV_CATALOG_DEFINITIONS = [
379
408
  {
380
409
  name: 'EVOLVER_ATP',
381
410
  group: 'marketplace-atp',
382
- purpose: 'Controls ATP marketplace/payment feature surface.',
383
- requiredFor: 'ATP flows',
384
- defaultValue: 'off unless explicitly enabled',
411
+ purpose: 'Legacy V1 merchant-agent mode; ignored by V2 runtime behavior, detected only for migration, and must not be mapped to buyer auto-spend consent.',
412
+ requiredFor: 'none; review the missing merchant workflow before removing',
413
+ defaultValue: 'ignored',
385
414
  },
386
415
  {
387
416
  name: 'EVOLVER_ATP_AUTOBUY',
@@ -390,12 +419,26 @@ const ENV_CATALOG_DEFINITIONS = [
390
419
  requiredFor: 'operator-approved ATP automation',
391
420
  defaultValue: 'off',
392
421
  },
422
+ {
423
+ name: 'ATP_AUTOBUY_DAILY_CAP_CREDITS',
424
+ group: 'marketplace-atp',
425
+ purpose: 'Hard UTC-day spending cap for automatic ATP purchases.',
426
+ requiredFor: 'ATP auto-buyer budget control',
427
+ defaultValue: '50',
428
+ },
429
+ {
430
+ name: 'ATP_AUTOBUY_PER_ORDER_CAP_CREDITS',
431
+ group: 'marketplace-atp',
432
+ purpose: 'Hard per-order spending cap for automatic ATP purchases.',
433
+ requiredFor: 'ATP auto-buyer budget control',
434
+ defaultValue: '10',
435
+ },
393
436
  {
394
437
  name: 'EVOLVER_ATP_AUTODELIVER',
395
438
  group: 'marketplace-atp',
396
439
  purpose: 'Controls automatic ATP delivery behavior.',
397
440
  requiredFor: 'operator-approved ATP automation',
398
- defaultValue: 'off',
441
+ defaultValue: 'on (opt-out)',
399
442
  },
400
443
  {
401
444
  name: 'EVOLVER_LIFECYCLE_COMMAND',
@@ -426,13 +469,35 @@ const ENV_CATALOG_DEFINITIONS = [
426
469
  group: 'self-update',
427
470
  purpose: 'Controls self-update behavior.',
428
471
  requiredFor: 'operator-controlled proxy update rollout',
429
- defaultValue: 'off unless explicitly enabled',
472
+ defaultValue: 'auto unless explicitly disabled (gated by supervisor attestation; default auto degrades to off without it, after a one-shot first-run bootstrap attempt)',
473
+ },
474
+ {
475
+ name: 'EVOLVER_SELF_BOOTSTRAP',
476
+ group: 'self-update',
477
+ purpose: 'Kill switch for the first-run supervision bootstrap of unsupervised startups.',
478
+ requiredFor: 'opting out of automatic service registration',
479
+ defaultValue: 'on (exact 0 or off disables)',
480
+ },
481
+ {
482
+ name: 'EVOLVER_BOOTSTRAP_MIGRATION',
483
+ group: 'self-update',
484
+ purpose: 'Kill switch for the one-time npm/JS → standalone binary migration attempted by unsupervised startups.',
485
+ requiredFor: 'opting out of automatic standalone binary migration',
486
+ defaultValue: 'on (exact 0 or off disables)',
487
+ },
488
+ {
489
+ name: 'EVOLVER_BOOTSTRAP_MIGRATION_VERSION',
490
+ group: 'self-update',
491
+ purpose: 'Target version override for the one-time standalone binary migration.',
492
+ requiredFor: 'pinning the migrated standalone binary version',
493
+ defaultValue: 'current package version',
430
494
  },
431
495
  {
432
496
  name: 'EVOLVER_SELF_UPDATE_PUBLIC_KEY',
433
497
  group: 'self-update',
434
498
  purpose: 'Public key used to verify self-update artifacts.',
435
499
  requiredFor: 'self-update verification',
500
+ defaultValue: 'built-in official v2-beta release key',
436
501
  },
437
502
  {
438
503
  name: 'EVOLVER_SELF_UPDATE_SUPERVISOR',
@@ -458,6 +523,9 @@ const POINTER_RE = /EVOLVER_ENV_FILE"?\s*[:=]\s*"([^"]+)"/;
458
523
  /** Loopback hosts a NO_PROXY entry must EXACTLY be to cover local IPC/proxy ('*' = bypass all). Exact-entry match,
459
524
  * not substring, so `127.0.0.10` / `notlocalhost.com` do not count (#279 Bugbot). */
460
525
  const LOOPBACK_ENTRIES = new Set(['127.0.0.1', 'localhost', '::1', '[::1]', '*']);
526
+ // Release asset names installed by the one-time npm/JS → standalone migration (mirrors evolver-proxy
527
+ // releaseAssetName; kept dependency-free so doctor stays read-only and self-contained).
528
+ const MIGRATION_BINARY_ASSET_NAMES = ['evolver-darwin-arm64', 'evolver-darwin-x64', 'evolver-linux-arm64', 'evolver-linux-x64', 'evolver-windows-x64.exe'];
461
529
  /**
462
530
  * Run the read-only doctor checks. Pure given its (injectable) deps — no config mutation, no env-file load into the
463
531
  * process. Returns the check list; the CLI formats + sets the exit code.
@@ -537,6 +605,36 @@ export function runDoctorChecks(deps = {}) {
537
605
  }
538
606
  }
539
607
  }
608
+ // 1b. v1-env-compat: warn when V1-only knobs are still set (process env and/or EVOLVER_ENV_FILE). Refs #698.
609
+ {
610
+ const merged = { ...env, ...envFileValues };
611
+ const compat = bootstrap.scanV1EnvCompat(merged);
612
+ if (compat.detected.length === 0) {
613
+ checks.push({
614
+ name: 'v1-env-compat',
615
+ status: 'pass',
616
+ detail: 'no deprecated V1-only env knobs detected (see `evolver migrate env`)',
617
+ });
618
+ }
619
+ else {
620
+ const names = compat.detected.map((d) => d.v1Name).join(', ');
621
+ const maps = compat.detected
622
+ .filter((d) => bootstrap.resolveV1EnvMigrationAction(d) === 'map' && d.v2Equivalent)
623
+ .map((d) => `${d.v1Name}→${d.v2Equivalent}`)
624
+ .join(', ');
625
+ const manual = compat.detected.filter((d) => bootstrap.resolveV1EnvMigrationAction(d) === 'manual').map((d) => d.v1Name).join(', ');
626
+ const drops = compat.detected.filter((d) => bootstrap.resolveV1EnvMigrationAction(d) === 'remove').map((d) => d.v1Name).join(', ');
627
+ const parts = [`${compat.detected.length} deprecated V1 env var(s): ${names}`];
628
+ if (maps)
629
+ parts.push(`map: ${maps}`);
630
+ if (manual)
631
+ parts.push(`manual: ${manual}`);
632
+ if (drops)
633
+ parts.push(`remove: ${drops}`);
634
+ parts.push('run `evolver migrate env` or see docs/migration-guide.md');
635
+ checks.push({ name: 'v1-env-compat', status: 'warn', detail: parts.join(' — ') });
636
+ }
637
+ }
540
638
  // 2. config-no-secrets: runtime config must reference creds via the EVOLVER_ENV_FILE pointer, never inline a secret.
541
639
  const offenders = [];
542
640
  for (const rel of CONFIG_FILES) {
@@ -573,6 +671,17 @@ export function runDoctorChecks(deps = {}) {
573
671
  else {
574
672
  checks.push({ name: 'no-proxy-loopback', status: 'warn', detail: 'a system proxy is set but NO_PROXY lacks 127.0.0.1/localhost — local IPC/LLM-proxy traffic may be intercepted; add them to NO_PROXY' });
575
673
  }
674
+ // 4. self-update-migration: read-only view of the one-time npm/JS → standalone migration — the
675
+ // EVOLVER_BOOTSTRAP_MIGRATION switch state and any migrated binary already under <home>/bin.
676
+ {
677
+ const migrationSwitch = effectiveEnv['EVOLVER_BOOTSTRAP_MIGRATION']?.trim();
678
+ const switchState = migrationSwitch === '0' || migrationSwitch === 'off' ? 'disabled (exact 0/off)' : 'on';
679
+ const binDir = join(events.evomapHome(effectiveEnv), 'bin');
680
+ const installed = MIGRATION_BINARY_ASSET_NAMES.filter((name) => exists(join(binDir, name)));
681
+ checks.push(installed.length > 0
682
+ ? { name: 'self-update-migration', status: 'pass', detail: `EVOLVER_BOOTSTRAP_MIGRATION ${switchState}; migrated standalone binary present: ${installed.map((name) => redact(join(binDir, name))).join(', ')}` }
683
+ : { name: 'self-update-migration', status: 'pass', detail: `EVOLVER_BOOTSTRAP_MIGRATION ${switchState}; no migrated standalone binary under ${redact(binDir)} (the npm/JS first-run migration installs it there)` });
684
+ }
576
685
  if (deps.profile === 'private-runtime') {
577
686
  checks.push(...privateRuntimeChecks(env, envFileValues, envFileReadiness));
578
687
  }
@@ -0,0 +1,9 @@
1
+ export interface ExplicitNodeCredentials {
2
+ senderId?: string;
3
+ nodeSecret?: string;
4
+ nodeSecretVersion?: string;
5
+ }
6
+ /** Select explicit node credentials without combining conflicting alias namespaces. */
7
+ export declare function resolveExplicitNodeCredentials(env?: NodeJS.ProcessEnv): ExplicitNodeCredentials;
8
+ /** Resolve the public Hub identity root without coupling credentials to Evolver state. */
9
+ export declare function resolveIdentityHome(env?: NodeJS.ProcessEnv, homeDir?: string): string;
@@ -0,0 +1,47 @@
1
+ import { homedir } from 'node:os';
2
+ import { join } from 'node:path';
3
+ function nonBlank(value) {
4
+ const trimmed = value?.trim();
5
+ return trimmed ? trimmed : undefined;
6
+ }
7
+ /** Select explicit node credentials without combining conflicting alias namespaces. */
8
+ export function resolveExplicitNodeCredentials(env = process.env) {
9
+ const evomap = credentialNamespace(env, 'EVOMAP');
10
+ const a2a = credentialNamespace(env, 'A2A');
11
+ if (evomap.senderId && evomap.nodeSecret)
12
+ return evomap;
13
+ if (a2a.senderId && a2a.nodeSecret)
14
+ return a2a;
15
+ if (evomap.senderId && a2a.senderId && evomap.senderId === a2a.senderId) {
16
+ const selected = evomap.nodeSecret ? evomap : a2a.nodeSecret ? a2a : evomap;
17
+ return selected.nodeSecret ? selected : { senderId: selected.senderId };
18
+ }
19
+ const senderId = evomap.senderId ?? a2a.senderId;
20
+ if (senderId)
21
+ return { senderId };
22
+ const selected = evomap.nodeSecret ? evomap : a2a;
23
+ return selected.nodeSecret
24
+ ? {
25
+ nodeSecret: selected.nodeSecret,
26
+ ...(selected.nodeSecretVersion ? { nodeSecretVersion: selected.nodeSecretVersion } : {}),
27
+ }
28
+ : {};
29
+ }
30
+ function credentialNamespace(env, prefix) {
31
+ const senderId = nonBlank(env[`${prefix}_NODE_ID`]);
32
+ const nodeSecret = nonBlank(env[`${prefix}_NODE_SECRET`]);
33
+ const nodeSecretVersion = nonBlank(env[`${prefix}_NODE_SECRET_VERSION`]);
34
+ return {
35
+ ...(senderId ? { senderId } : {}),
36
+ ...(nodeSecret ? { nodeSecret } : {}),
37
+ ...(nodeSecretVersion ? { nodeSecretVersion } : {}),
38
+ };
39
+ }
40
+ /** Resolve the public Hub identity root without coupling credentials to Evolver state. */
41
+ export function resolveIdentityHome(env = process.env, homeDir) {
42
+ const explicit = [env['EVOMAP_HOME'], env['EVOMAP_DIR'], env['EVOLVER_HOME']]
43
+ .map(nonBlank)
44
+ .filter((value) => value !== undefined);
45
+ const fallbackHome = nonBlank(env['HOME']) ?? homeDir ?? homedir();
46
+ return explicit[0] ?? join(fallbackHome, '.evomap');
47
+ }
package/dist/index.d.ts CHANGED
@@ -1,23 +1,15 @@
1
- import { events, ops } from '@evomap/evolver-core';
2
- import { assetstore, material as materialNs } from '@evomap/evolver-core';
1
+ import { events, ops, hub as hubNs } from '@evomap/evolver-core';
2
+ import { assetstore } from '@evomap/evolver-core';
3
+ import { type ImportV1Options } from './migrate/v1Import.js';
4
+ import { type LifecyclePaths } from './lifecycle.js';
3
5
  import { type NonGitWorkspaceNoticeOptions } from './nonGitWorkspaceNotice.js';
4
- /**
5
- * Composition seam for ingest's substrate dependencies. The CLI is the composition layer that wires the
6
- * MaterialStore (M1 raw-material substrate) + the watermark cursor (file-level re-ingest dedup) + the AE
7
- * Ingestor (root_events) together — evolver-core stays adapter/CLI-agnostic. Defaults point at the live
8
- * ~/.evomap home; tests inject temp paths so no global state leaks.
9
- */
10
- export interface IngestDeps {
11
- materialStore?: materialNs.MaterialStore;
12
- watermarkStore?: materialNs.WatermarkStore;
13
- ingestor?: events.Ingestor;
14
- }
15
- export interface SessionIngestTickResult {
16
- recorded: number;
17
- sourceAgents: string[];
18
- signalKinds: string[];
19
- signalStrengths: string[];
20
- invalidJsonRows?: number;
6
+ import { type IngestDeps } from './sessionIngest.js';
7
+ export { runSessionIngestTick, scanSessionDirs, type IngestDeps, type SessionIngestTickResult, } from './sessionIngest.js';
8
+ export interface DistillDeps extends IngestDeps {
9
+ responseFileRoot?: string;
10
+ maxResponseFileBytes?: number;
11
+ /** Deterministic test seam for response-file replacement/growth races. Never wired by production callers. */
12
+ responseFileReadTestHook?: (phase: 'before-open' | 'after-open', path: string) => void;
21
13
  }
22
14
  export declare const PACKAGE = "@evomap/evolver-cli";
23
15
  export interface RebuildOptions {
@@ -44,35 +36,27 @@ export declare function runResetLocalSecret(argv: readonly string[], opts?: Rese
44
36
  export declare function rebuildViews(opts?: RebuildOptions): {
45
37
  rebuilt: string[];
46
38
  };
47
- /** migrate import-v1 <v1dir> [outDir] --workspace <path>: v1→v2 read-only migration. */
48
- export declare function runMigrate(argv: readonly string[]): Promise<number>;
39
+ export type MigrateDeps = Pick<ImportV1Options, 'disposeTestHook' | 'outputRootTestHook'>;
40
+ /** migrate import-v1 | migrate env | migrate oauth — V1→V2 migration tools. */
41
+ export declare function runMigrate(argv: readonly string[], deps?: MigrateDeps): Promise<number>;
49
42
  /** One-line summary of an asset for `asset-log` (pure, testable). */
50
43
  export declare function formatAssetLine(a: assetstore.AssetRecord): string;
51
- /** asset-log [Gene|Capsule|EvolutionEvent|AntiGene] [limit]: list recent local assets (observability; ported v1 CLI verb). */
52
- export declare function runAssetLog(argv: readonly string[], store?: assetstore.AssetStoreProvider): Promise<number>;
44
+ export interface AssetLogDeps {
45
+ callLog?: Pick<hubNs.AssetCallLog, 'read' | 'summarize'>;
46
+ logPath?: string;
47
+ }
48
+ /**
49
+ * Preserve V2's asset-store listing as the default. V1's call audit is available
50
+ * through the explicit `calls` mode so the two contracts do not overload an empty argv.
51
+ */
52
+ export declare function runAssetLog(argv: readonly string[], store?: assetstore.AssetStoreProvider, deps?: AssetLogDeps): Promise<number>;
53
53
  /**
54
54
  * distill: gate a learned approach into the gene pool (ported v1 CLI verb). Runs the structural intake
55
55
  * (schema + dedup + asset_id) and, only if it passes, writes the gene to the store. The agent/runtime is
56
56
  * what discovers the strategy; this is the manual entry point that turns it into a pooled, selectable gene.
57
57
  * Usage: evolver distill --category <c> --signals <s1,s2> --strategy "<step1; step2>" [--summary <text>] [--id <id>]
58
58
  */
59
- export declare function runDistill(argv: readonly string[], store?: assetstore.AssetStoreProvider, deps?: IngestDeps): Promise<number>;
60
- /**
61
- * Recursively enumerate recognized runtime-session sources under the given dirs — the daemon's auto-distill
62
- * producer source (#106). This includes text session files handled by runtime adapters (`*.jsonl` and Gemini
63
- * `*.json`) plus Cursor's sqlite `state.vscdb`. A missing/permission-denied dir is silently skipped (a daemon
64
- * must not crash on an absent home dir).
65
- */
66
- export declare function scanSessionDirs(dirs: readonly string[]): string[];
67
- /**
68
- * One producer tick for the auto-distill loop (#106 slice 1): scan `dirs` for session logs and record any
69
- * NEW/CHANGED file as `runtime_session` Material via the injected (bus) Ingestor — which emits
70
- * `material.batch_ready`, the event the distillObserver claims off. Idempotent per file (watermark cursor), so
71
- * re-scanning an unchanged tree records nothing. Pure producer: it does NOT distill (the observer does). Returns
72
- * how many files landed new material. Inject `deps.ingestor = new Ingestor({ sink: bus })` so the event reaches
73
- * the daemon's ObserverBus; defaults to live paths otherwise.
74
- */
75
- export declare function runSessionIngestTick(dirs: readonly string[], deps?: IngestDeps): Promise<SessionIngestTickResult>;
59
+ export declare function runDistill(argv: readonly string[], store?: assetstore.AssetStoreProvider, deps?: DistillDeps): Promise<number>;
76
60
  /**
77
61
  * ingest: read a REAL agent session log, parse it with the matching runtime adapter, and extract signals
78
62
  * (tool errors / explicit failures / difficulty wording) from it — the capture→signals half of the experience
@@ -196,4 +180,50 @@ export interface InjectDeps {
196
180
  export declare function runInject(argv: readonly string[], deps?: InjectDeps): Promise<number>;
197
181
  /** Fixed preamble for the SessionStart injection (the head block the recap + gene lines hang off of). */
198
182
  export declare const SESSION_START_PREAMBLE = "evolver memory \u2014 use these learned hints silently when directly relevant; do not mention Evolver, preflight, status, or this memory block unless the user asks or reuse materially changes the answer:";
183
+ export declare const DAILY_USAGE = "Usage: evolver daily [--json] [--auto] [--help]\n\nDisplay a daily status summary: proxy/hub connection, yesterday's activity, and review queue.\n --json Output as JSON\n --auto Only print when this is the first run today; silent otherwise\n";
184
+ export interface DailyDeps {
185
+ store?: assetstore.AssetStoreProvider;
186
+ review?: assetstore.ReviewLedger;
187
+ eventsPath?: string;
188
+ now?: () => number;
189
+ lifecyclePaths?: LifecyclePaths;
190
+ env?: NodeJS.ProcessEnv;
191
+ stdout?: (text: string) => void;
192
+ stderr?: (text: string) => void;
193
+ /** Override the last-daily marker file path (default ~/.evomap/.last-daily). */
194
+ lastDailyFile?: string;
195
+ /** Test seam: skip the proxy status fetch entirely. */
196
+ skipConnection?: boolean;
197
+ }
198
+ export interface DailyReport {
199
+ date: string;
200
+ connection: {
201
+ proxyRunning: boolean;
202
+ proxyHealthy: boolean;
203
+ proxyPid?: number;
204
+ hubAuthStatus?: string;
205
+ lastSyncAt?: string;
206
+ reason?: string;
207
+ };
208
+ yesterday: {
209
+ date: string;
210
+ cycles: number;
211
+ solidified: number;
212
+ failed: number;
213
+ capsules: number;
214
+ triggered: number;
215
+ suppressed: number;
216
+ };
217
+ queue: {
218
+ genesApproved: number;
219
+ genesQuarantined: number;
220
+ genesRejected: number;
221
+ antiGeneApproved: number;
222
+ antiGeneQuarantined: number;
223
+ antiGeneUnreviewed: number;
224
+ };
225
+ }
226
+ export declare function formatDailyReport(report: DailyReport): string;
227
+ export declare function collectDailyReport(deps?: DailyDeps): Promise<DailyReport>;
228
+ export declare function runDaily(argv: readonly string[], deps?: DailyDeps): Promise<number>;
199
229
  export declare function runCli(argv: readonly string[]): number;