@evomap/evolver-cli 2.0.0-beta.2 → 2.0.0-beta.22

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 (124) hide show
  1. package/dist/antiGeneBenchmark.js +2 -0
  2. package/dist/antiGeneRollout.js +9 -3
  3. package/dist/assetHealth.d.ts +6 -0
  4. package/dist/assetHealth.js +107 -0
  5. package/dist/assetRepair.d.ts +24 -0
  6. package/dist/assetRepair.js +172 -0
  7. package/dist/assetSidecarRecovery.d.ts +14 -0
  8. package/dist/assetSidecarRecovery.js +171 -0
  9. package/dist/assetTrust.d.ts +24 -0
  10. package/dist/assetTrust.js +231 -0
  11. package/dist/atp.d.ts +10 -5
  12. package/dist/atp.js +119 -26
  13. package/dist/atpAutoBuyer.d.ts +120 -0
  14. package/dist/atpAutoBuyer.js +814 -0
  15. package/dist/atpAutoDeliver.js +2 -2
  16. package/dist/autoDistillAntiGene.js +7 -5
  17. package/dist/autoDistillLlm.d.ts +26 -0
  18. package/dist/autoDistillLlm.js +119 -22
  19. package/dist/autoDistillTranscript.js +3 -2
  20. package/dist/autoexec.d.ts +111 -24
  21. package/dist/autoexec.js +887 -120
  22. package/dist/autoexecConfig.d.ts +10 -0
  23. package/dist/autoexecConfig.js +69 -0
  24. package/dist/cli.js +13 -0
  25. package/dist/cliContracts.d.ts +33 -2
  26. package/dist/cliContracts.js +818 -78
  27. package/dist/commandCatalog.d.ts +72 -0
  28. package/dist/commandCatalog.js +120 -0
  29. package/dist/commands.d.ts +1 -0
  30. package/dist/commands.js +1 -0
  31. package/dist/curriculumCapabilityGaps.d.ts +6 -0
  32. package/dist/curriculumCapabilityGaps.js +24 -0
  33. package/dist/cycleConsumer.d.ts +17 -2
  34. package/dist/cycleConsumer.js +374 -50
  35. package/dist/dashboard.d.ts +13 -1
  36. package/dist/dashboard.js +235 -18
  37. package/dist/dispatch.d.ts +9 -2
  38. package/dist/dispatch.js +29 -6
  39. package/dist/distillAdmission.d.ts +13 -0
  40. package/dist/distillAdmission.js +35 -0
  41. package/dist/distillObserver.js +27 -12
  42. package/dist/distillPrimitives.d.ts +11 -8
  43. package/dist/distillPrimitives.js +116 -22
  44. package/dist/doctor.d.ts +13 -0
  45. package/dist/doctor.js +177 -10
  46. package/dist/identityHome.d.ts +9 -0
  47. package/dist/identityHome.js +47 -0
  48. package/dist/index.d.ts +73 -40
  49. package/dist/index.js +745 -207
  50. package/dist/issueReport.d.ts +7 -0
  51. package/dist/issueReport.js +291 -0
  52. package/dist/learningTrace.d.ts +15 -0
  53. package/dist/learningTrace.js +73 -0
  54. package/dist/lifecycle.d.ts +199 -2
  55. package/dist/lifecycle.js +4999 -152
  56. package/dist/lifecycleBootstrapTransaction.d.ts +235 -0
  57. package/dist/lifecycleBootstrapTransaction.js +2182 -0
  58. package/dist/localMemoryGraph.d.ts +184 -0
  59. package/dist/localMemoryGraph.js +2689 -0
  60. package/dist/login.d.ts +1 -1
  61. package/dist/login.js +3 -3
  62. package/dist/materialPackage.js +3 -6
  63. package/dist/materialSnapshot.d.ts +35 -1
  64. package/dist/materialSnapshot.js +265 -18
  65. package/dist/memoryGraphOps.d.ts +8 -0
  66. package/dist/memoryGraphOps.js +140 -0
  67. package/dist/migrate/assetFormatMap.d.ts +61 -0
  68. package/dist/migrate/assetFormatMap.js +53 -0
  69. package/dist/migrate/envTranslate.d.ts +26 -0
  70. package/dist/migrate/envTranslate.js +147 -0
  71. package/dist/migrate/fieldMap.d.ts +7 -5
  72. package/dist/migrate/fieldMap.js +20 -14
  73. package/dist/migrate/oauthImport.d.ts +66 -0
  74. package/dist/migrate/oauthImport.js +667 -0
  75. package/dist/migrate/v1Import.d.ts +98 -1
  76. package/dist/migrate/v1Import.js +1532 -71
  77. package/dist/modelCompatibility.d.ts +10 -0
  78. package/dist/modelCompatibility.js +296 -0
  79. package/dist/promptRecallHook.d.ts +24 -0
  80. package/dist/promptRecallHook.js +425 -0
  81. package/dist/recallVerifyReport.d.ts +37 -0
  82. package/dist/recallVerifyReport.js +244 -0
  83. package/dist/recipe.d.ts +14 -2
  84. package/dist/recipe.js +543 -65
  85. package/dist/repairedAssetStore.d.ts +2 -0
  86. package/dist/repairedAssetStore.js +12 -0
  87. package/dist/requiredSandboxValidation.d.ts +5 -0
  88. package/dist/requiredSandboxValidation.js +4 -0
  89. package/dist/reuse.d.ts +18 -4
  90. package/dist/reuse.js +375 -107
  91. package/dist/reviewFilter.d.ts +3 -1
  92. package/dist/reviewFilter.js +3 -1
  93. package/dist/runtimeCapabilities.d.ts +18 -0
  94. package/dist/runtimeCapabilities.js +81 -0
  95. package/dist/runtimeSessionSource.d.ts +8 -2
  96. package/dist/runtimeSessionSource.js +63 -11
  97. package/dist/selectionPolicyConfig.d.ts +8 -0
  98. package/dist/selectionPolicyConfig.js +18 -0
  99. package/dist/semanticIdfConfig.d.ts +2 -0
  100. package/dist/semanticIdfConfig.js +4 -0
  101. package/dist/sessionIngest.d.ts +43 -0
  102. package/dist/sessionIngest.js +180 -0
  103. package/dist/setupHooks.d.ts +5 -0
  104. package/dist/setupHooks.js +330 -14
  105. package/dist/skill2gep.d.ts +13 -9
  106. package/dist/skill2gep.js +99 -36
  107. package/dist/skillDistill.d.ts +8 -4
  108. package/dist/skillDistill.js +39 -9
  109. package/dist/solo/mode.js +1 -0
  110. package/dist/sync.d.ts +13 -1
  111. package/dist/sync.js +1947 -265
  112. package/dist/thesis.d.ts +1 -1
  113. package/dist/thesis.js +20 -3
  114. package/dist/trajectoryExport.js +21 -3
  115. package/dist/v1Compat.d.ts +1 -0
  116. package/dist/v1Compat.js +9 -0
  117. package/dist/valueDigest.js +8 -1
  118. package/dist/windowsLegacyTaskCleanup.d.ts +228 -0
  119. package/dist/windowsLegacyTaskCleanup.js +1475 -0
  120. package/dist/workflow.d.ts +39 -0
  121. package/dist/workflow.js +386 -0
  122. package/dist/workflowRuntime.d.ts +66 -0
  123. package/dist/workflowRuntime.js +638 -0
  124. package/package.json +14 -7
@@ -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;
@@ -136,19 +202,42 @@ export function draftGeneCandidate(turns, sigs, agent) {
136
202
  generation_meta: { source: 'distilled' },
137
203
  };
138
204
  }
205
+ // Signals injected by the fallback itself, plus generic command runners, carry no domain identity. Including them
206
+ // in Jaccard makes unrelated capabilities (for example GitHub vs Playwright) look 60% identical even though their
207
+ // one discriminating signal differs. Keep them for exact-subset detection, but omit them from soft similarity.
208
+ const GENERIC_NOVELTY_SIGNALS = new Set([
209
+ 'reusable_capability',
210
+ 'verified_workflow',
211
+ 'shell_command',
212
+ 'bash',
213
+ 'powershell',
214
+ 'pwsh',
215
+ 'sh',
216
+ 'cmd',
217
+ 'command',
218
+ 'verified-success',
219
+ 'verified_success',
220
+ ]);
221
+ function normalizeSignalSet(values) {
222
+ return new Set((values ?? []).map((value) => String(value).trim().toLowerCase()).filter(Boolean));
223
+ }
224
+ function noveltySignalSet(signals) {
225
+ const discriminating = [...signals].filter((signal) => !GENERIC_NOVELTY_SIGNALS.has(signal));
226
+ return discriminating.length > 0 ? new Set(discriminating) : signals;
227
+ }
139
228
  /**
140
229
  * Value/novelty gate run BEFORE a draft is quarantined (#117 improvement 3). `intakeGene` already rejects
141
- * empty/structurally-invalid candidates and EXACT signal subsets (fullyOverlaps), but two kinds of noise still
142
- * reach the human review queue: drafts too thin to be worth reviewing (one weak signal, one vague step), and
143
- * near-duplicates that escape the subset check by carrying one extra signal. Unattended auto-distill turns that
144
- * trickle into a flood, and a review gate nobody reads is no gate. This adds a substance floor + a SOFT similarity
145
- * reject. Pure and deterministic; the caller decides what to do with a non-admit (skip, never an error).
230
+ * empty/structurally-invalid candidates and EXACT signal subsets (fullyOverlaps). Admission mirrors that subset
231
+ * check so a duplicate is a per-candidate skip instead of aborting a whole batch, then adds the two missing noise
232
+ * controls: a substance floor and a SOFT near-duplicate comparison. Unattended auto-distill turns that trickle
233
+ * into a flood, and a review gate nobody reads is no gate. Pure and deterministic; the caller decides what to do
234
+ * with a non-admit (skip, never an error).
146
235
  */
147
236
  export function assessDraftAdmission(candidate, existing = [], opts = {}) {
148
237
  const minSignals = opts.minSignals ?? 2;
149
238
  const minStrategy = opts.minStrategy ?? 1;
150
- const maxSimilarity = opts.maxSimilarity ?? 0.8;
151
- const sigs = [...new Set((candidate.signals_match ?? []).map((s) => String(s).toLowerCase()).filter(Boolean))];
239
+ const maxSimilarity = opts.maxSimilarity ?? 0.6;
240
+ const sigs = [...normalizeSignalSet(candidate.signals_match)];
152
241
  const strategy = (candidate.strategy ?? []).filter((s) => String(s).trim());
153
242
  if (sigs.length < minSignals)
154
243
  return { admit: false, reason: `too few signals (${sigs.length} < ${minSignals})` };
@@ -156,11 +245,16 @@ export function assessDraftAdmission(candidate, existing = [], opts = {}) {
156
245
  return { admit: false, reason: `strategy too thin (${strategy.length} < ${minStrategy} steps)` };
157
246
  const newSet = new Set(sigs);
158
247
  for (const eg of existing) {
159
- const egSet = new Set((eg.signals_match ?? []).map((s) => String(s).toLowerCase()).filter(Boolean));
248
+ const egSet = normalizeSignalSet(eg.signals_match);
160
249
  if (egSet.size === 0)
161
250
  continue;
162
- const inter = [...newSet].filter((s) => egSet.has(s)).length;
163
- const union = new Set([...newSet, ...egSet]).size;
251
+ if ([...newSet].every((signal) => egSet.has(signal))) {
252
+ return { admit: false, reason: `near-duplicate of ${eg.id ?? '?'} (candidate signal subset)` };
253
+ }
254
+ const comparableNew = noveltySignalSet(newSet);
255
+ const comparableExisting = noveltySignalSet(egSet);
256
+ const inter = [...comparableNew].filter((s) => comparableExisting.has(s)).length;
257
+ const union = new Set([...comparableNew, ...comparableExisting]).size;
164
258
  const jaccard = union ? inter / union : 0;
165
259
  if (jaccard >= maxSimilarity)
166
260
  return { admit: false, reason: `near-duplicate of ${eg.id ?? '?'} (similarity ${jaccard.toFixed(2)})` };
package/dist/doctor.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type MemoryGraphOperatorStatus } from './localMemoryGraph.js';
1
2
  type DoctorStatus = 'pass' | 'warn' | 'fail';
2
3
  export interface DoctorCheck {
3
4
  name: string;
@@ -36,6 +37,18 @@ export interface DoctorDeps {
36
37
  statMode?: (p: string) => number | undefined;
37
38
  profile?: DoctorProfile;
38
39
  label?: string;
40
+ memoryGraphStatus?: (env: Record<string, string | undefined>) => MemoryGraphOperatorStatus;
41
+ /** Runtime platform override (tests). Defaults to process.platform. */
42
+ platform?: NodeJS.Platform;
43
+ /** Test seam for the read-only legacy v1 Windows scheduled-task probe (#956). */
44
+ legacyWindowsTasks?: (options: {
45
+ env: NodeJS.ProcessEnv;
46
+ platform?: NodeJS.Platform;
47
+ }) => {
48
+ conclusive: boolean;
49
+ legacy: string[];
50
+ detail: string;
51
+ };
39
52
  }
40
53
  export interface EnvCatalogResult {
41
54
  profile: DoctorProfile;
package/dist/doctor.js CHANGED
@@ -4,7 +4,10 @@
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 { bootstrap, events, issueReporter } from '@evomap/evolver-core';
7
8
  import { expandHomePath, parseEnvFile } from '@evomap/evolver-mcp';
9
+ import { formatMemoryGraphOperatorStatus, loadMemoryGraphOperatorStatus } from './localMemoryGraph.js';
10
+ import { LEGACY_TASK_SKIP_ENV, probeLegacyWindowsDaemonTasks } from './windowsLegacyTaskCleanup.js';
8
11
  // Secrets that must live ONLY behind the EVOLVER_ENV_FILE pointer — never inlined into a runtime config (#217).
9
12
  const SECRET_KEYS = [
10
13
  'A2A_NODE_SECRET',
@@ -107,10 +110,18 @@ const ENV_CATALOG_DEFINITIONS = [
107
110
  defaultValue: 'unset',
108
111
  },
109
112
  {
110
- name: 'EVOLVER_HEARTBEAT_MS',
113
+ name: 'HEARTBEAT_INTERVAL_MS',
111
114
  group: 'hub-runtime',
112
- purpose: 'Proxy heartbeat interval.',
115
+ purpose: 'Proxy heartbeat interval for the Hub lifecycle manager.',
113
116
  requiredFor: 'proxy daemon heartbeat tuning',
117
+ defaultValue: '360000',
118
+ },
119
+ {
120
+ name: 'EVOLVER_HEARTBEAT_MS',
121
+ group: 'observability',
122
+ purpose: 'Interval for autoexec cycle.heartbeat observability events.',
123
+ requiredFor: 'autoexec heartbeat log tuning',
124
+ defaultValue: '60000',
114
125
  },
115
126
  {
116
127
  name: 'EVOLVER_PROXY_URL',
@@ -160,6 +171,20 @@ const ENV_CATALOG_DEFINITIONS = [
160
171
  requiredFor: 'reuse ranking tuning',
161
172
  defaultValue: 'enabled unless set to 0',
162
173
  },
174
+ {
175
+ name: 'EVOLVER_SEMANTIC_IDF',
176
+ group: 'autoexec-selection',
177
+ purpose: 'Emergency rollback for trusted-corpus IDF semantic weighting.',
178
+ requiredFor: 'selection ranking rollout',
179
+ defaultValue: 'enabled unless set to 0',
180
+ },
181
+ {
182
+ name: 'EVOLVER_SELECTION_POLICY',
183
+ group: 'autoexec-selection',
184
+ purpose: 'Controls plateau exploration: engine-health, UCB1 shadow, or explicit UCB1 canary.',
185
+ requiredFor: 'selection exploration rollout',
186
+ defaultValue: 'engine-health',
187
+ },
163
188
  {
164
189
  name: 'EVOLVER_REUSE_MODE',
165
190
  group: 'autoexec-reuse',
@@ -179,9 +204,15 @@ const ENV_CATALOG_DEFINITIONS = [
179
204
  requiredFor: 'probation rollout',
180
205
  defaultValue: '0',
181
206
  },
207
+ {
208
+ name: 'EVOLVER_AUTO_DISTILL',
209
+ group: 'distill',
210
+ purpose: 'Controls structural distillation from completed evolution cycles.',
211
+ requiredFor: 'structural gene distill',
212
+ defaultValue: 'enabled unless set to 0',
213
+ },
182
214
  {
183
215
  name: 'EVOLVER_AUTO_DISTILL_LLM',
184
- aliases: ['EVOLVER_AUTO_DISTILL'],
185
216
  group: 'distill',
186
217
  purpose: 'Enables LLM distillation from successful capsules.',
187
218
  requiredFor: 'online gene distill',
@@ -284,8 +315,9 @@ const ENV_CATALOG_DEFINITIONS = [
284
315
  {
285
316
  name: 'EVOLVER_SESSION_SOURCE',
286
317
  group: 'trajectory-export',
287
- purpose: 'Runtime session source selector.',
288
- requiredFor: 'runtime adapter filtering',
318
+ purpose: 'Legacy V1 session collector selector; ignored by V2 runtime behavior, detected only for migration, and has no one-to-one replacement.',
319
+ requiredFor: 'none; review explicit runtime discovery or transcript directories before removing',
320
+ defaultValue: 'ignored',
289
321
  },
290
322
  {
291
323
  name: 'EVOLVER_TRAJECTORY_INCLUDE_UNMARKED',
@@ -377,9 +409,9 @@ const ENV_CATALOG_DEFINITIONS = [
377
409
  {
378
410
  name: 'EVOLVER_ATP',
379
411
  group: 'marketplace-atp',
380
- purpose: 'Controls ATP marketplace/payment feature surface.',
381
- requiredFor: 'ATP flows',
382
- defaultValue: 'off unless explicitly enabled',
412
+ 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.',
413
+ requiredFor: 'none; review the missing merchant workflow before removing',
414
+ defaultValue: 'ignored',
383
415
  },
384
416
  {
385
417
  name: 'EVOLVER_ATP_AUTOBUY',
@@ -388,12 +420,26 @@ const ENV_CATALOG_DEFINITIONS = [
388
420
  requiredFor: 'operator-approved ATP automation',
389
421
  defaultValue: 'off',
390
422
  },
423
+ {
424
+ name: 'ATP_AUTOBUY_DAILY_CAP_CREDITS',
425
+ group: 'marketplace-atp',
426
+ purpose: 'Hard UTC-day spending cap for automatic ATP purchases.',
427
+ requiredFor: 'ATP auto-buyer budget control',
428
+ defaultValue: '50',
429
+ },
430
+ {
431
+ name: 'ATP_AUTOBUY_PER_ORDER_CAP_CREDITS',
432
+ group: 'marketplace-atp',
433
+ purpose: 'Hard per-order spending cap for automatic ATP purchases.',
434
+ requiredFor: 'ATP auto-buyer budget control',
435
+ defaultValue: '10',
436
+ },
391
437
  {
392
438
  name: 'EVOLVER_ATP_AUTODELIVER',
393
439
  group: 'marketplace-atp',
394
440
  purpose: 'Controls automatic ATP delivery behavior.',
395
441
  requiredFor: 'operator-approved ATP automation',
396
- defaultValue: 'off',
442
+ defaultValue: 'on (opt-out)',
397
443
  },
398
444
  {
399
445
  name: 'EVOLVER_LIFECYCLE_COMMAND',
@@ -424,13 +470,41 @@ const ENV_CATALOG_DEFINITIONS = [
424
470
  group: 'self-update',
425
471
  purpose: 'Controls self-update behavior.',
426
472
  requiredFor: 'operator-controlled proxy update rollout',
427
- defaultValue: 'off unless explicitly enabled',
473
+ defaultValue: 'auto unless explicitly disabled (gated by supervisor attestation; default auto degrades to off without it, after a one-shot first-run bootstrap attempt)',
474
+ },
475
+ {
476
+ name: 'EVOLVER_SELF_BOOTSTRAP',
477
+ group: 'self-update',
478
+ purpose: 'Kill switch for the first-run supervision bootstrap of unsupervised startups.',
479
+ requiredFor: 'opting out of automatic service registration',
480
+ defaultValue: 'on (exact 0 or off disables)',
481
+ },
482
+ {
483
+ name: 'EVOLVER_BOOTSTRAP_MIGRATION',
484
+ group: 'self-update',
485
+ purpose: 'Kill switch for the one-time npm/JS → standalone binary migration attempted by unsupervised startups.',
486
+ requiredFor: 'opting out of automatic standalone binary migration',
487
+ defaultValue: 'on (exact 0 or off disables)',
488
+ },
489
+ {
490
+ name: 'EVOLVER_BOOTSTRAP_MIGRATION_VERSION',
491
+ group: 'self-update',
492
+ purpose: 'Target version override for the one-time standalone binary migration.',
493
+ requiredFor: 'pinning the migrated standalone binary version',
494
+ defaultValue: 'current package version',
428
495
  },
429
496
  {
430
497
  name: 'EVOLVER_SELF_UPDATE_PUBLIC_KEY',
431
498
  group: 'self-update',
432
499
  purpose: 'Public key used to verify self-update artifacts.',
433
500
  requiredFor: 'self-update verification',
501
+ defaultValue: 'built-in official v2-beta release key',
502
+ },
503
+ {
504
+ name: 'EVOLVER_SELF_UPDATE_SUPERVISOR',
505
+ group: 'self-update',
506
+ purpose: 'Attests that a generated durable service launcher owns relaunch.',
507
+ requiredFor: 'automatic self-update',
434
508
  },
435
509
  {
436
510
  name: 'EVOLVER_SELF_UPDATE_TARGET_PATH',
@@ -450,6 +524,9 @@ const POINTER_RE = /EVOLVER_ENV_FILE"?\s*[:=]\s*"([^"]+)"/;
450
524
  /** Loopback hosts a NO_PROXY entry must EXACTLY be to cover local IPC/proxy ('*' = bypass all). Exact-entry match,
451
525
  * not substring, so `127.0.0.10` / `notlocalhost.com` do not count (#279 Bugbot). */
452
526
  const LOOPBACK_ENTRIES = new Set(['127.0.0.1', 'localhost', '::1', '[::1]', '*']);
527
+ // Release asset names installed by the one-time npm/JS → standalone migration (mirrors evolver-proxy
528
+ // releaseAssetName; kept dependency-free so doctor stays read-only and self-contained).
529
+ const MIGRATION_BINARY_ASSET_NAMES = ['evolver-darwin-arm64', 'evolver-darwin-x64', 'evolver-linux-arm64', 'evolver-linux-x64', 'evolver-windows-x64.exe'];
453
530
  /**
454
531
  * Run the read-only doctor checks. Pure given its (injectable) deps — no config mutation, no env-file load into the
455
532
  * process. Returns the check list; the CLI formats + sets the exit code.
@@ -529,6 +606,36 @@ export function runDoctorChecks(deps = {}) {
529
606
  }
530
607
  }
531
608
  }
609
+ // 1b. v1-env-compat: warn when V1-only knobs are still set (process env and/or EVOLVER_ENV_FILE). Refs #698.
610
+ {
611
+ const merged = { ...env, ...envFileValues };
612
+ const compat = bootstrap.scanV1EnvCompat(merged);
613
+ if (compat.detected.length === 0) {
614
+ checks.push({
615
+ name: 'v1-env-compat',
616
+ status: 'pass',
617
+ detail: 'no deprecated V1-only env knobs detected (see `evolver migrate env`)',
618
+ });
619
+ }
620
+ else {
621
+ const names = compat.detected.map((d) => d.v1Name).join(', ');
622
+ const maps = compat.detected
623
+ .filter((d) => bootstrap.resolveV1EnvMigrationAction(d) === 'map' && d.v2Equivalent)
624
+ .map((d) => `${d.v1Name}→${d.v2Equivalent}`)
625
+ .join(', ');
626
+ const manual = compat.detected.filter((d) => bootstrap.resolveV1EnvMigrationAction(d) === 'manual').map((d) => d.v1Name).join(', ');
627
+ const drops = compat.detected.filter((d) => bootstrap.resolveV1EnvMigrationAction(d) === 'remove').map((d) => d.v1Name).join(', ');
628
+ const parts = [`${compat.detected.length} deprecated V1 env var(s): ${names}`];
629
+ if (maps)
630
+ parts.push(`map: ${maps}`);
631
+ if (manual)
632
+ parts.push(`manual: ${manual}`);
633
+ if (drops)
634
+ parts.push(`remove: ${drops}`);
635
+ parts.push('run `evolver migrate env` or see docs/migration-guide.md');
636
+ checks.push({ name: 'v1-env-compat', status: 'warn', detail: parts.join(' — ') });
637
+ }
638
+ }
532
639
  // 2. config-no-secrets: runtime config must reference creds via the EVOLVER_ENV_FILE pointer, never inline a secret.
533
640
  const offenders = [];
534
641
  for (const rel of CONFIG_FILES) {
@@ -565,9 +672,54 @@ export function runDoctorChecks(deps = {}) {
565
672
  else {
566
673
  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' });
567
674
  }
675
+ // 4. self-update-migration: read-only view of the one-time npm/JS → standalone migration — the
676
+ // EVOLVER_BOOTSTRAP_MIGRATION switch state and any migrated binary already under <home>/bin.
677
+ {
678
+ const migrationSwitch = effectiveEnv['EVOLVER_BOOTSTRAP_MIGRATION']?.trim();
679
+ const switchState = migrationSwitch === '0' || migrationSwitch === 'off' ? 'disabled (exact 0/off)' : 'on';
680
+ const binDir = join(events.evomapHome(effectiveEnv), 'bin');
681
+ const installed = MIGRATION_BINARY_ASSET_NAMES.filter((name) => exists(join(binDir, name)));
682
+ checks.push(installed.length > 0
683
+ ? { name: 'self-update-migration', status: 'pass', detail: `EVOLVER_BOOTSTRAP_MIGRATION ${switchState}; migrated standalone binary present: ${installed.map((name) => redact(join(binDir, name))).join(', ')}` }
684
+ : { 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)` });
685
+ }
568
686
  if (deps.profile === 'private-runtime') {
569
687
  checks.push(...privateRuntimeChecks(env, envFileValues, envFileReadiness));
570
688
  }
689
+ try {
690
+ const status = (deps.memoryGraphStatus ?? loadMemoryGraphOperatorStatus)(effectiveEnv);
691
+ checks.push({
692
+ name: 'memory-graph',
693
+ status: status.recovery === 'degraded' ? 'warn' : 'pass',
694
+ detail: formatMemoryGraphOperatorStatus(status),
695
+ });
696
+ }
697
+ catch {
698
+ checks.push({ name: 'memory-graph', status: 'warn', detail: 'state=degraded corrupt=1 oversized_lines=0 oversized_files=0 archives=0' });
699
+ }
700
+ // 5. windows-legacy-tasks (#956): read-only probe for legacy V1 scheduled-task residue
701
+ // (win32 only). A detected residue warns with the manual fix; an INCONCLUSIVE probe
702
+ // also warns — it must never be reported as a confirmed-negative pass.
703
+ if ((deps.platform ?? process.platform) === 'win32') {
704
+ try {
705
+ const probe = (deps.legacyWindowsTasks ?? probeLegacyWindowsDaemonTasks)({
706
+ env: effectiveEnv,
707
+ platform: 'win32',
708
+ });
709
+ if (!probe.conclusive) {
710
+ checks.push({ name: 'windows-legacy-tasks', status: 'warn', detail: `probe inconclusive (${probe.detail}); legacy v1 residue cannot be ruled out — run evolver lifecycle cleanup-legacy-tasks --dry-run, or set ${LEGACY_TASK_SKIP_ENV}=1 to silence the automatic probes on restricted hosts` });
711
+ }
712
+ else if (probe.legacy.length > 0) {
713
+ checks.push({ name: 'windows-legacy-tasks', status: 'warn', detail: `detected legacy v1 scheduled task(s): ${probe.legacy.join(', ')} — run evolver lifecycle cleanup-legacy-tasks` });
714
+ }
715
+ else {
716
+ checks.push({ name: 'windows-legacy-tasks', status: 'pass', detail: 'no legacy v1-style scheduled tasks registered' });
717
+ }
718
+ }
719
+ catch {
720
+ checks.push({ name: 'windows-legacy-tasks', status: 'warn', detail: `probe inconclusive (internal error); legacy v1 residue cannot be ruled out — run evolver lifecycle cleanup-legacy-tasks --dry-run, or set ${LEGACY_TASK_SKIP_ENV}=1 to silence the automatic probes on restricted hosts` });
721
+ }
722
+ }
571
723
  return checks;
572
724
  }
573
725
  export function buildEnvCatalog(deps = {}) {
@@ -905,6 +1057,21 @@ export async function runDoctor(argv, deps = {}) {
905
1057
  }
906
1058
  const checks = runDoctorChecks({ ...deps, profile: f.profile, ...(f.root !== undefined ? { configRoot: f.root } : {}) });
907
1059
  const failed = checks.some((c) => c.status === 'fail');
1060
+ if (failed) {
1061
+ try {
1062
+ const input = issueReporter.issueReportInputFromDoctor(checks.map(({ name, status }) => ({ name, status })));
1063
+ if (input) {
1064
+ issueReporter.createIssueDraft(input, {
1065
+ rootDir: join(events.evomapHome(deps.env ?? process.env), 'evolution', 'issue-reporter'),
1066
+ workspaceScope: process.cwd(),
1067
+ env: deps.env ?? process.env,
1068
+ });
1069
+ }
1070
+ }
1071
+ catch {
1072
+ // Local draft reporting must never change the doctor command surface.
1073
+ }
1074
+ }
908
1075
  if (f.json) {
909
1076
  process.stdout.write(`${JSON.stringify({ ok: !failed, profile: f.profile, checks })}\n`);
910
1077
  }
@@ -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
+ }