@evomap/evolver 1.90.0 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/README.md +27 -564
  2. package/bin/evolver-llm-proxy.js +3 -0
  3. package/bin/evolver-mcp.js +2 -0
  4. package/bin/evolver-proxy.js +3 -0
  5. package/bin/evolver.js +4 -0
  6. package/index.js +1 -3670
  7. package/package.json +32 -62
  8. package/CONTRIBUTING.md +0 -19
  9. package/LICENSE +0 -641
  10. package/README.ja-JP.md +0 -521
  11. package/README.ko-KR.md +0 -520
  12. package/README.zh-CN.md +0 -531
  13. package/SKILL.md +0 -365
  14. package/assets/cover.png +0 -0
  15. package/assets/gep/genes.seed.json +0 -496
  16. package/conformance/savings-core/constants.json +0 -30
  17. package/conformance/savings-core/golden-vectors.json +0 -333
  18. package/scripts/a2a_export.js +0 -63
  19. package/scripts/a2a_ingest.js +0 -79
  20. package/scripts/a2a_promote.js +0 -118
  21. package/scripts/analyze_by_skill.js +0 -121
  22. package/scripts/build_binaries.js +0 -479
  23. package/scripts/check-changelog.js +0 -166
  24. package/scripts/extract_log.js +0 -85
  25. package/scripts/generate_history.js +0 -75
  26. package/scripts/gep_append_event.js +0 -96
  27. package/scripts/gep_personality_report.js +0 -234
  28. package/scripts/human_report.js +0 -147
  29. package/scripts/recall-verify-report.js +0 -234
  30. package/scripts/recover_loop.js +0 -61
  31. package/scripts/refresh_stars_badge.js +0 -168
  32. package/scripts/seed-merchants.js +0 -91
  33. package/scripts/skill2recipes.js +0 -118
  34. package/scripts/suggest_version.js +0 -89
  35. package/scripts/validate-modules.js +0 -38
  36. package/scripts/validate-suite.js +0 -78
  37. package/src/adapters/claudeCode.js +0 -194
  38. package/src/adapters/codex.js +0 -216
  39. package/src/adapters/cursor.js +0 -91
  40. package/src/adapters/hookAdapter.js +0 -469
  41. package/src/adapters/kiro.js +0 -195
  42. package/src/adapters/opencode.js +0 -326
  43. package/src/adapters/scripts/_lockPaths.js +0 -74
  44. package/src/adapters/scripts/_memoryFiltering.js +0 -35
  45. package/src/adapters/scripts/_runtimePaths.js +0 -440
  46. package/src/adapters/scripts/evolver-session-end.js +0 -321
  47. package/src/adapters/scripts/evolver-session-start.js +0 -587
  48. package/src/adapters/scripts/evolver-signal-detect.js +0 -98
  49. package/src/adapters/scripts/evolver-task-recall.js +0 -173
  50. package/src/atp/atpExecute.js +0 -283
  51. package/src/atp/atpTaskPickup.js +0 -233
  52. package/src/atp/autoBuyer.js +0 -382
  53. package/src/atp/autoDeliver.js +0 -215
  54. package/src/atp/cli.js +0 -354
  55. package/src/atp/cliAutobuyPrompt.js +0 -154
  56. package/src/atp/consumerAgent.js +0 -157
  57. package/src/atp/defaultHandler.js +0 -69
  58. package/src/atp/heartbeatSignalsHandler.js +0 -254
  59. package/src/atp/hubClient.js +0 -317
  60. package/src/atp/index.js +0 -38
  61. package/src/atp/merchantAgent.js +0 -118
  62. package/src/atp/protocol.js +0 -41
  63. package/src/atp/questionComposer.js +0 -133
  64. package/src/atp/serviceHelper.js +0 -92
  65. package/src/canary.js +0 -13
  66. package/src/config.js +0 -351
  67. package/src/evolve/guards.js +0 -1
  68. package/src/evolve/pipeline/collect.js +0 -1
  69. package/src/evolve/pipeline/dispatch.js +0 -1
  70. package/src/evolve/pipeline/enrich.js +0 -1
  71. package/src/evolve/pipeline/hub.js +0 -1
  72. package/src/evolve/pipeline/select.js +0 -1
  73. package/src/evolve/pipeline/signals.js +0 -1
  74. package/src/evolve/utils.js +0 -1
  75. package/src/evolve.js +0 -1
  76. package/src/experiment/agentRunner.js +0 -229
  77. package/src/experiment/cli.js +0 -159
  78. package/src/experiment/comparison.js +0 -233
  79. package/src/experiment/metrics.js +0 -75
  80. package/src/forceUpdate.js +0 -991
  81. package/src/gep/a2a.js +0 -173
  82. package/src/gep/a2aProtocol.js +0 -1
  83. package/src/gep/analyzer.js +0 -35
  84. package/src/gep/antiAbuseTelemetry.js +0 -1
  85. package/src/gep/assetCallLog.js +0 -197
  86. package/src/gep/assetStore.js +0 -723
  87. package/src/gep/assets.js +0 -36
  88. package/src/gep/autoDistillConv.js +0 -1
  89. package/src/gep/autoDistillLlm.js +0 -1
  90. package/src/gep/bridge.js +0 -138
  91. package/src/gep/candidateEval.js +0 -1
  92. package/src/gep/candidates.js +0 -1
  93. package/src/gep/claimNudge.js +0 -121
  94. package/src/gep/cliContracts.js +0 -1190
  95. package/src/gep/contentHash.js +0 -1
  96. package/src/gep/conversationDistiller.js +0 -1
  97. package/src/gep/conversationSniffer.js +0 -1
  98. package/src/gep/crypto.js +0 -1
  99. package/src/gep/curriculum.js +0 -1
  100. package/src/gep/deviceId.js +0 -1
  101. package/src/gep/directoryClient.js +0 -115
  102. package/src/gep/envFingerprint.js +0 -1
  103. package/src/gep/epigenetics.js +0 -1
  104. package/src/gep/execBridge.js +0 -1
  105. package/src/gep/executionTrace.js +0 -291
  106. package/src/gep/explore.js +0 -1
  107. package/src/gep/featureFlags.js +0 -121
  108. package/src/gep/gitOps.js +0 -265
  109. package/src/gep/hash.js +0 -1
  110. package/src/gep/hostErrorClassifier.js +0 -34
  111. package/src/gep/hubFetch.js +0 -1
  112. package/src/gep/hubReview.js +0 -1
  113. package/src/gep/hubSearch.js +0 -1
  114. package/src/gep/hubVerify.js +0 -1
  115. package/src/gep/idleScheduler.js +0 -400
  116. package/src/gep/issueReporter.js +0 -416
  117. package/src/gep/learningSignals.js +0 -1
  118. package/src/gep/llmReview.js +0 -92
  119. package/src/gep/localStateAwareness.js +0 -243
  120. package/src/gep/mailboxTransport.js +0 -119
  121. package/src/gep/memoryGraph.js +0 -1
  122. package/src/gep/memoryGraphAdapter.js +0 -1
  123. package/src/gep/mutation.js +0 -1
  124. package/src/gep/narrativeMemory.js +0 -1
  125. package/src/gep/oauthLogin.js +0 -181
  126. package/src/gep/openPRRegistry.js +0 -1
  127. package/src/gep/paths.js +0 -522
  128. package/src/gep/personality.js +0 -1
  129. package/src/gep/policyCheck.js +0 -1
  130. package/src/gep/portable.js +0 -103
  131. package/src/gep/privacyClient.js +0 -235
  132. package/src/gep/prompt.js +0 -1
  133. package/src/gep/questionGenerator.js +0 -518
  134. package/src/gep/recallInject.js +0 -1
  135. package/src/gep/recallVerifier.js +0 -1
  136. package/src/gep/reflection.js +0 -1
  137. package/src/gep/sanitize.js +0 -264
  138. package/src/gep/savingsCore.js +0 -1
  139. package/src/gep/schemas/capsule.js +0 -170
  140. package/src/gep/schemas/gene.js +0 -154
  141. package/src/gep/schemas/index.js +0 -8
  142. package/src/gep/schemas/protocol.js +0 -51
  143. package/src/gep/schemas/task.js +0 -74
  144. package/src/gep/selector.js +0 -1
  145. package/src/gep/selfPR.js +0 -469
  146. package/src/gep/signals.js +0 -776
  147. package/src/gep/skill2gep.js +0 -1056
  148. package/src/gep/skill2gepAudit.js +0 -303
  149. package/src/gep/skill2recipes.js +0 -511
  150. package/src/gep/skillDistiller.js +0 -1
  151. package/src/gep/skillPublisher.js +0 -358
  152. package/src/gep/solidify.js +0 -1
  153. package/src/gep/strategy.js +0 -1
  154. package/src/gep/taskReceiver.js +0 -575
  155. package/src/gep/tokenSavings.js +0 -1
  156. package/src/gep/trajectoryExport.js +0 -1
  157. package/src/gep/validationReport.js +0 -55
  158. package/src/gep/validator/index.js +0 -411
  159. package/src/gep/validator/reporter.js +0 -210
  160. package/src/gep/validator/sandboxExecutor.js +0 -480
  161. package/src/gep/validator/stakeBootstrap.js +0 -357
  162. package/src/gep/workspaceKeychain.js +0 -1
  163. package/src/ops/cleanup.js +0 -80
  164. package/src/ops/commentary.js +0 -60
  165. package/src/ops/health_check.js +0 -104
  166. package/src/ops/index.js +0 -11
  167. package/src/ops/innovation.js +0 -67
  168. package/src/ops/lifecycle.js +0 -798
  169. package/src/ops/self_repair.js +0 -76
  170. package/src/ops/skills_monitor.js +0 -147
  171. package/src/ops/trigger.js +0 -33
  172. package/src/proxy/clientSettings.js +0 -405
  173. package/src/proxy/envelope.js +0 -59
  174. package/src/proxy/extensions/dmHandler.js +0 -45
  175. package/src/proxy/extensions/sessionHandler.js +0 -141
  176. package/src/proxy/extensions/skillUpdater.js +0 -64
  177. package/src/proxy/extensions/traceControl.js +0 -1
  178. package/src/proxy/index.js +0 -1395
  179. package/src/proxy/inject.js +0 -1
  180. package/src/proxy/lifecycle/manager.js +0 -1568
  181. package/src/proxy/mailbox/state.js +0 -207
  182. package/src/proxy/mailbox/store.js +0 -602
  183. package/src/proxy/router/cache_passthrough.js +0 -26
  184. package/src/proxy/router/features.js +0 -84
  185. package/src/proxy/router/gemini_route.js +0 -154
  186. package/src/proxy/router/messages_route.js +0 -535
  187. package/src/proxy/router/model_router.js +0 -113
  188. package/src/proxy/router/models_route.js +0 -52
  189. package/src/proxy/router/ollama_route.js +0 -103
  190. package/src/proxy/router/responses_route.js +0 -170
  191. package/src/proxy/router/vertex_route.js +0 -110
  192. package/src/proxy/server/http.js +0 -363
  193. package/src/proxy/server/routes.js +0 -558
  194. package/src/proxy/server/settings.js +0 -115
  195. package/src/proxy/sync/engine.js +0 -179
  196. package/src/proxy/sync/inbound.js +0 -211
  197. package/src/proxy/sync/outbound.js +0 -361
  198. package/src/proxy/task/monitor.js +0 -131
  199. package/src/proxy/trace/extractor.js +0 -1
  200. package/src/proxy/trace/usage.js +0 -1
  201. package/src/solo/breaker.js +0 -25
  202. package/src/solo/gitGuard.js +0 -65
  203. package/src/webui/client/clientJs/assets.js +0 -111
  204. package/src/webui/client/clientJs/bootstrap.js +0 -92
  205. package/src/webui/client/clientJs/common.js +0 -77
  206. package/src/webui/client/clientJs/i18n.js +0 -366
  207. package/src/webui/client/clientJs/index.js +0 -35
  208. package/src/webui/client/clientJs/interactions.js +0 -351
  209. package/src/webui/client/clientJs/overview.js +0 -152
  210. package/src/webui/client/clientJs/personality.js +0 -285
  211. package/src/webui/client/clientJs/pipelines.js +0 -330
  212. package/src/webui/client/indexHtml.js +0 -221
  213. package/src/webui/client/static.js +0 -23
  214. package/src/webui/client/stylesCss.js +0 -639
  215. package/src/webui/client/vendor/README.md +0 -15
  216. package/src/webui/client/vendor/echarts.min.js +0 -45
  217. package/src/webui/index.js +0 -14
  218. package/src/webui/observer/assets.js +0 -146
  219. package/src/webui/observer/index.js +0 -37
  220. package/src/webui/observer/interactions.js +0 -127
  221. package/src/webui/observer/jsonl.js +0 -75
  222. package/src/webui/observer/paths.js +0 -46
  223. package/src/webui/observer/personality.js +0 -43
  224. package/src/webui/observer/pipelineEvents.js +0 -58
  225. package/src/webui/observer/redact.js +0 -63
  226. package/src/webui/observer/runs.js +0 -356
  227. package/src/webui/observer/safety.js +0 -57
  228. package/src/webui/observer/skills.js +0 -70
  229. package/src/webui/observer/status.js +0 -71
  230. package/src/webui/server/http.js +0 -138
  231. package/src/webui/server/routes.js +0 -41
package/src/config.js DELETED
@@ -1,351 +0,0 @@
1
- // Centralized configuration for evolver runtime thresholds and timeouts.
2
- // All values support environment variable override where specified.
3
- // Groups: network, solidify, evolution, ops, limits.
4
-
5
- function envInt(key, fallback) {
6
- const v = process.env[key];
7
- if (v === undefined || v === '') return fallback;
8
- const n = parseInt(v, 10);
9
- return isNaN(n) ? fallback : n;
10
- }
11
-
12
- // Strict variant for timing / timeout / interval values that must be
13
- // positive. Rejects: NaN (e.g. "5min" silently parses to 5 -- here 5 is
14
- // accepted but a suffix-only "ms" becomes NaN), 0 (which would turn an
15
- // interval into a hot loop or zero out a timeout signal), and negatives
16
- // (setTimeout clamps to 1 ms). Also rejects values >= 2^31 because
17
- // setTimeout silently downgrades those to 1 ms in Node. Misconfigured
18
- // values fall back to the default with a one-time warning so the user
19
- // is not silently running a broken setup.
20
- const _envPositiveIntWarned = new Set();
21
- function envPositiveInt(key, fallback) {
22
- const v = process.env[key];
23
- if (v === undefined || v === '') return fallback;
24
- const n = parseInt(v, 10);
25
- const valid = Number.isFinite(n) && n > 0 && n < 2 ** 31;
26
- if (!valid) {
27
- if (!_envPositiveIntWarned.has(key)) {
28
- _envPositiveIntWarned.add(key);
29
- try {
30
- console.warn(
31
- '[config] ' + key + '=' + JSON.stringify(v) + ' is not a positive integer; ' +
32
- 'falling back to ' + fallback + '. Set a value in (0, 2^31) ms.'
33
- );
34
- } catch (_) {}
35
- }
36
- return fallback;
37
- }
38
- return n;
39
- }
40
-
41
- function envFloat(key, fallback) {
42
- const v = process.env[key];
43
- if (v === undefined || v === '') return fallback;
44
- const n = parseFloat(v);
45
- return isNaN(n) ? fallback : n;
46
- }
47
-
48
- function envStr(key, fallback) {
49
- const v = process.env[key];
50
- return (v !== undefined && v !== '') ? v : fallback;
51
- }
52
-
53
- // --- Network & A2A ---
54
-
55
- // Hot-path timers / intervals use envPositiveInt: a misconfigured 0,
56
- // negative, or non-numeric value would otherwise turn the heartbeat
57
- // loop into a hot spin (setTimeout(0)) or zero out a timeout signal
58
- // (AbortSignal.timeout(0) immediately aborts every request). Falls back
59
- // to the default with a one-time warning when the env var is invalid.
60
- const HELLO_TIMEOUT_MS = envPositiveInt('EVOLVER_HELLO_TIMEOUT_MS', 15000);
61
- const HEARTBEAT_TIMEOUT_MS = envPositiveInt('EVOLVER_HEARTBEAT_TIMEOUT_MS', 10000);
62
- const HEARTBEAT_INTERVAL_MS = envPositiveInt('HEARTBEAT_INTERVAL_MS', 360000);
63
- const HEARTBEAT_FIRST_DELAY_MS = envPositiveInt('EVOLVER_HEARTBEAT_FIRST_DELAY_MS', 30000);
64
- const EVENT_POLL_TIMEOUT_MS = envPositiveInt('EVOLVER_EVENT_POLL_TIMEOUT_MS', 60000);
65
- const HTTP_TRANSPORT_TIMEOUT_MS = envPositiveInt('EVOLVER_HTTP_TRANSPORT_TIMEOUT_MS', 15000);
66
- const SECRET_CACHE_TTL_MS = envPositiveInt('EVOLVER_SECRET_CACHE_TTL_MS', 60000);
67
- const HUB_SEARCH_TIMEOUT_MS = envPositiveInt('EVOLVER_HUB_SEARCH_TIMEOUT_MS', 8000);
68
-
69
- // Hub URL resolution (since v1.69.7).
70
- //
71
- // Precedence at runtime (re-evaluated on every call of resolveHubUrl()):
72
- // 1. process.env.A2A_HUB_URL -- primary override used by most modules
73
- // 2. process.env.EVOMAP_HUB_URL -- secondary, kept for backward compat
74
- // 3. process.env.EVOLVER_DEFAULT_HUB_URL -- deployment-time default override
75
- // (useful for air-gapped deployments that point all clients at a private
76
- // hub endpoint without having to rewrite A2A_HUB_URL in every service)
77
- // 4. PUBLIC_DEFAULT_HUB_URL below (compile-time literal)
78
- //
79
- // IMPORTANT: callers MUST NOT cache the return value at module-load time.
80
- // Before v1.69.7 several modules (validator/*, taskReceiver, directoryClient,
81
- // privacyClient) bound their HUB_URL fallback at require()-time, which meant
82
- // that setting process.env.A2A_HUB_URL later (common in tests and wrappers)
83
- // had no effect. Use resolveHubUrl() inside the function body that builds the
84
- // HTTP request instead.
85
- const PUBLIC_DEFAULT_HUB_URL = 'https://evomap.ai';
86
-
87
- function resolveHubUrl() {
88
- // Trim each candidate and fall through on empty/whitespace-only values.
89
- // A trailing space in a `.env` value (common with quoted entries like
90
- // A2A_HUB_URL="https://evomap.ai ") otherwise survives into endpoint
91
- // construction: `hubUrl.replace(/\/+$/, '')` strips trailing slashes but
92
- // NOT whitespace, producing "https://evomap.ai /a2a/events/poll" which
93
- // fails URL validation (#580 Bug 1). `||` alone would also pick a
94
- // whitespace-only override as "truthy", so trim-then-fall-through here.
95
- const pick = (v) => { const t = (v == null ? '' : String(v)).trim(); return t || null; };
96
- const raw = pick(process.env.A2A_HUB_URL)
97
- || pick(process.env.EVOMAP_HUB_URL)
98
- || pick(process.env.EVOLVER_DEFAULT_HUB_URL)
99
- || PUBLIC_DEFAULT_HUB_URL;
100
-
101
- if (process.env.EVOMAP_HUB_ALLOW_INSECURE !== '1') {
102
- let parsed;
103
- try {
104
- parsed = new URL(raw);
105
- } catch {
106
- throw new Error(
107
- '[config] Hub URL is not a valid URL: ' + JSON.stringify(raw) + '. ' +
108
- 'Set EVOMAP_HUB_ALLOW_INSECURE=1 to bypass (local dev / mock hub only).'
109
- );
110
- }
111
- if (parsed.protocol !== 'https:') {
112
- throw new Error(
113
- '[config] Hub URL must use https:// — got ' + JSON.stringify(raw) + '. ' +
114
- 'Set EVOMAP_HUB_ALLOW_INSECURE=1 to bypass (local dev / mock hub only).'
115
- );
116
- }
117
- }
118
- return raw;
119
- }
120
-
121
- // --- Solidify & Validation ---
122
-
123
- const BLAST_RADIUS_HARD_CAP_FILES = envInt('EVOLVER_HARD_CAP_FILES', 60);
124
- const BLAST_RADIUS_HARD_CAP_LINES = envInt('EVOLVER_HARD_CAP_LINES', 20000);
125
- const VALIDATION_TIMEOUT_MS = envInt('EVOLVER_VALIDATION_TIMEOUT_MS', 180000);
126
- const CANARY_TIMEOUT_MS = envInt('EVOLVER_CANARY_TIMEOUT_MS', 30000);
127
- const CAPSULE_CONTENT_MAX_CHARS = envInt('EVOLVER_CAPSULE_MAX_CHARS', 8000);
128
- const SOLIDIFY_MAX_RETRIES = envInt('SOLIDIFY_MAX_RETRIES', 2);
129
- const SOLIDIFY_RETRY_INTERVAL_MS = envInt('EVOLVER_SOLIDIFY_RETRY_INTERVAL_MS', 1000);
130
- const MIN_PUBLISH_SCORE = envFloat('EVOLVER_MIN_PUBLISH_SCORE', 0.78);
131
- const BROADCAST_SCORE_THRESHOLD = 0.7;
132
- const BROADCAST_SUCCESS_STREAK = 2;
133
- const MAX_REGEX_PATTERN_LEN = 1024;
134
-
135
- // --- Evolution Loop ---
136
-
137
- const REPAIR_LOOP_THRESHOLD = envInt('EVOLVER_REPAIR_LOOP_THRESHOLD', 3);
138
-
139
- // --- Gene Suppression (saturated / repeatedly failing genes) ---
140
- // These thresholds control when a Gene is forcibly excluded from selection
141
- // regardless of drift state. Without this, a Gene that fails repeatedly can
142
- // trigger plateau detection -> drift mode -> the legacy ban skip path,
143
- // resulting in the same failed Gene being re-selected forever.
144
- //
145
- // GENE_BAN_PER_KEY_ATTEMPTS: minimum attempts on the same signal key
146
- // GENE_BAN_BEST_THRESHOLD: best success rate at or below which the Gene is banned
147
- // GENE_INERT_BAN_STREAK: consecutive inert (stable_no_error, zero-work) outcomes
148
- // on a signal key after which a Gene with no real
149
- // success is banned, so --loop selection explores
150
- // instead of re-running a do-nothing gene (#562)
151
- // GENE_EPIGENETIC_HARD_BOOST: epigenetic boost at or below which the Gene is hard-suppressed
152
- const GENE_BAN_PER_KEY_ATTEMPTS = envInt('EVOLVER_GENE_BAN_PER_KEY_ATTEMPTS', 4);
153
- const GENE_BAN_BEST_THRESHOLD = envFloat('EVOLVER_GENE_BAN_BEST_THRESHOLD', 0.15);
154
- const GENE_INERT_BAN_STREAK = envInt('EVOLVER_GENE_INERT_BAN_STREAK', 8);
155
- const GENE_EPIGENETIC_HARD_BOOST = envFloat('EVOLVER_GENE_EPIGENETIC_HARD_BOOST', -0.3);
156
- const SESSION_ARCHIVE_TRIGGER = envInt('EVOLVER_SESSION_ARCHIVE_TRIGGER', 100);
157
- const SESSION_ARCHIVE_KEEP = envInt('EVOLVER_SESSION_ARCHIVE_KEEP', 50);
158
- const MEMORY_FRAGMENT_MAX_CHARS = envInt('EVOLVER_MEMORY_FRAGMENT_MAX_CHARS', 50000);
159
- const IDLE_FETCH_INTERVAL_MS = envInt('EVOLVER_IDLE_FETCH_INTERVAL_MS', 600000);
160
- const PROMPT_MAX_CHARS = envInt('EVOLVER_PROMPT_MAX_CHARS', 24000);
161
- const ACTIVE_WINDOW_MS = 24 * 60 * 60 * 1000;
162
- const TARGET_BYTES = 120000;
163
- const PER_FILE_BYTES = 20000;
164
- const PER_SESSION_BYTES = 20000;
165
- const RECENCY_GUARD_MS = 30 * 1000;
166
- const DORMANT_TTL_MS = 3600 * 1000;
167
- const PACKAGE_DESC_CACHE_TTL_MS = 6 * 60 * 60 * 1000;
168
- const MEMORY_GRAPH_READ_LIMIT = 1000;
169
- const NARRATIVE_SUMMARY_MAX_CHARS = 3000;
170
-
171
- // --- Ops ---
172
-
173
- const MAX_SILENCE_MS = envInt('EVOLVER_MAX_SILENCE_MS', 30 * 60 * 1000);
174
- const CLEANUP_MAX_AGE_MS = envInt('EVOLVER_CLEANUP_MAX_AGE_MS', 24 * 60 * 60 * 1000);
175
- const CLEANUP_MIN_KEEP = envInt('EVOLVER_CLEANUP_MIN_KEEP', 10);
176
- const CLEANUP_MAX_FILES = envInt('EVOLVER_CLEANUP_MAX_FILES', 10);
177
- const LOCK_MAX_AGE_MS = envInt('EVOLVER_LOCK_MAX_AGE_MS', 10 * 60 * 1000);
178
-
179
- // --- Self-PR (auto-contribute mutations back to public repo) ---
180
-
181
- const SELF_PR_MIN_SCORE = envFloat('EVOLVER_SELF_PR_MIN_SCORE', 0.85);
182
- const SELF_PR_MIN_STREAK = envInt('EVOLVER_SELF_PR_MIN_STREAK', 3);
183
- const SELF_PR_MAX_FILES = envInt('EVOLVER_SELF_PR_MAX_FILES', 3);
184
- const SELF_PR_MAX_LINES = envInt('EVOLVER_SELF_PR_MAX_LINES', 100);
185
- const SELF_PR_COOLDOWN_MS = envInt('EVOLVER_SELF_PR_COOLDOWN_MS', 24 * 60 * 60 * 1000);
186
- const SELF_PR_REPO = envStr('EVOLVER_SELF_PR_REPO', 'EvoMap/evolver');
187
- const SELF_PR_TIMEOUT_MS = envInt('EVOLVER_SELF_PR_TIMEOUT_MS', 30000);
188
-
189
- // --- Leak Check ---
190
-
191
- const LEAK_CHECK_MODE = envStr('EVOLVER_LEAK_CHECK', 'strict');
192
-
193
- // --- Reuse attribution (P4-a, Slice A) ---
194
- // Controls whether the evolver attaches a `reuse_attribution` block to the
195
- // synced `outcome` MemoryGraphEvent so the Hub can LATER (P4-a Slice B, gated +
196
- // team-signed-off) credit the SOURCE node when its asset is reused. Modes:
197
- // off (default) — attach nothing; byte-identical to pre-P4-a behavior.
198
- // shadow — attach the attribution block; it rides the existing
199
- // syncEventToHub -> /a2a/memory/event into the Hub's
200
- // MemoryGraphEvent.payload blob, which is GDI-inert and
201
- // read by NO payout path today.
202
- // There is intentionally NO `enforce` on the CLIENT: the evolver cannot move
203
- // money, so an enforce word would be a lie. The report stays economy-inert
204
- // until a SIGNED-OFF Hub reader converts it to credit (which MUST add the
205
- // anti-sybil gating — see P4-a Slice B). Until then it only emits honest,
206
- // runtime-observed attribution data (never agent-supplied identity).
207
- const REUSE_ATTRIBUTION_MODE = envStr('EVOLVER_REUSE_ATTRIBUTION', 'off');
208
- function reuseAttributionMode() {
209
- const v = String(process.env.EVOLVER_REUSE_ATTRIBUTION || REUSE_ATTRIBUTION_MODE || 'off').toLowerCase().trim();
210
- return v === 'shadow' ? 'shadow' : 'off';
211
- }
212
-
213
- // Opt-in Hub reuse-OUTCOME reporting (P4-a Slice B, client side). When 'on', the
214
- // evolver POSTs {signals, status, used_asset_ids} to the Hub's /a2a/memory/record
215
- // so the reuse-reward attribution pipeline (which reads THAT endpoint, not the
216
- // inert reuse_attribution blob on /a2a/memory/event) finally gets data.
217
- // MONEY-ADJACENT and charges Hub credits -> default 'off'. The Hub still
218
- // re-verifies every used_asset_id against its own AssetFetcher rows before
219
- // crediting. Also requires EVOLVER_REUSE_ATTRIBUTION=shadow, which is what builds
220
- // the cycle-correlated, timestamp-guarded attribution this report consumes.
221
- const OUTCOME_REPORT_MODE = envStr('EVOLVER_OUTCOME_REPORT', 'off');
222
- function outcomeReportMode() {
223
- const v = String(process.env.EVOLVER_OUTCOME_REPORT || OUTCOME_REPORT_MODE || 'off').toLowerCase().trim();
224
- return v === 'on' || v === 'enforce' || v === 'true' ? 'on' : 'off';
225
- }
226
-
227
- // --- Anti-abuse telemetry (privacy-preserving heartbeat summary) ---
228
- // Enabled by default. In heartbeat mode, clients attach a small
229
- // `meta.anti_abuse` envelope with low-sensitive hashes, source-confidence
230
- // labels, and explicit placeholders for data that must be observed by Hub
231
- // services instead of trusted from the client.
232
- const ANTI_ABUSE_TELEMETRY_MODE = envStr('EVOLVER_ANTI_ABUSE_TELEMETRY', 'heartbeat');
233
- function antiAbuseTelemetryMode() {
234
- const raw = process.env.EVOLVER_ANTI_ABUSE_TELEMETRY;
235
- const v = String(raw == null ? '' : raw).toLowerCase().trim();
236
- // Empty / whitespace-only counts as UNSET (same as envStr's '' -> fallback
237
- // above): a blank `EVOLVER_ANTI_ABUSE_TELEMETRY=` line in a .env file must
238
- // not silently disable the documented default-on behavior. Opt-out is
239
- // explicit only.
240
- if (v === '') return 'heartbeat';
241
- if (v === '0' || v === 'false' || v === 'no' || v === 'off') return 'off';
242
- return (v === '1' || v === 'true' || v === 'yes' || v === 'on' || v === 'heartbeat')
243
- ? 'heartbeat'
244
- : 'off';
245
- }
246
-
247
- // --- Validator mode (opt-out) ---
248
- // Node role: the evolver periodically fetches assigned validation tasks from
249
- // the Hub, runs the commands in an isolated sandbox, and submits
250
- // ValidationReports. Default is ON (opt-out). Set EVOLVER_VALIDATOR_ENABLED=false
251
- // to skip the validator role. Note: the exported VALIDATOR_ENABLED below is a
252
- // legacy helper that resolves only from env (no persisted flag). Real runtime
253
- // gating lives in src/gep/validator/index.js:isValidatorEnabled().
254
-
255
- const VALIDATOR_ENABLED = (function () {
256
- const v = String(process.env.EVOLVER_VALIDATOR_ENABLED || '').toLowerCase().trim();
257
- return v === '1' || v === 'true' || v === 'yes' || v === 'on';
258
- })();
259
- const VALIDATOR_STAKE_AMOUNT = envInt('EVOLVER_VALIDATOR_STAKE_AMOUNT', 100);
260
- const VALIDATOR_MAX_TASKS_PER_CYCLE = envInt('EVOLVER_VALIDATOR_MAX_TASKS_PER_CYCLE', 2);
261
- const VALIDATOR_FETCH_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_FETCH_TIMEOUT_MS', 8000);
262
- const VALIDATOR_REPORT_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_REPORT_TIMEOUT_MS', 10000);
263
- const VALIDATOR_STAKE_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_STAKE_TIMEOUT_MS', 10000);
264
- const VALIDATOR_CMD_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_CMD_TIMEOUT_MS', 60000);
265
- const VALIDATOR_BATCH_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_BATCH_TIMEOUT_MS', 180000);
266
-
267
- module.exports = {
268
- // Network
269
- HELLO_TIMEOUT_MS,
270
- HEARTBEAT_TIMEOUT_MS,
271
- HEARTBEAT_INTERVAL_MS,
272
- HEARTBEAT_FIRST_DELAY_MS,
273
- EVENT_POLL_TIMEOUT_MS,
274
- HTTP_TRANSPORT_TIMEOUT_MS,
275
- SECRET_CACHE_TTL_MS,
276
- HUB_SEARCH_TIMEOUT_MS,
277
- PUBLIC_DEFAULT_HUB_URL,
278
- resolveHubUrl,
279
- // Solidify
280
- VALIDATION_TIMEOUT_MS,
281
- CANARY_TIMEOUT_MS,
282
- CAPSULE_CONTENT_MAX_CHARS,
283
- SOLIDIFY_MAX_RETRIES,
284
- SOLIDIFY_RETRY_INTERVAL_MS,
285
- MIN_PUBLISH_SCORE,
286
- BROADCAST_SCORE_THRESHOLD,
287
- BROADCAST_SUCCESS_STREAK,
288
- MAX_REGEX_PATTERN_LEN,
289
- // Evolution
290
- REPAIR_LOOP_THRESHOLD,
291
- GENE_BAN_PER_KEY_ATTEMPTS,
292
- GENE_BAN_BEST_THRESHOLD,
293
- GENE_INERT_BAN_STREAK,
294
- GENE_EPIGENETIC_HARD_BOOST,
295
- SESSION_ARCHIVE_TRIGGER,
296
- SESSION_ARCHIVE_KEEP,
297
- MEMORY_FRAGMENT_MAX_CHARS,
298
- IDLE_FETCH_INTERVAL_MS,
299
- PROMPT_MAX_CHARS,
300
- ACTIVE_WINDOW_MS,
301
- TARGET_BYTES,
302
- PER_FILE_BYTES,
303
- PER_SESSION_BYTES,
304
- RECENCY_GUARD_MS,
305
- DORMANT_TTL_MS,
306
- PACKAGE_DESC_CACHE_TTL_MS,
307
- MEMORY_GRAPH_READ_LIMIT,
308
- NARRATIVE_SUMMARY_MAX_CHARS,
309
- // Ops
310
- MAX_SILENCE_MS,
311
- CLEANUP_MAX_AGE_MS,
312
- CLEANUP_MIN_KEEP,
313
- CLEANUP_MAX_FILES,
314
- LOCK_MAX_AGE_MS,
315
- // Self-PR
316
- SELF_PR_MIN_SCORE,
317
- SELF_PR_MIN_STREAK,
318
- SELF_PR_MAX_FILES,
319
- SELF_PR_MAX_LINES,
320
- SELF_PR_COOLDOWN_MS,
321
- SELF_PR_REPO,
322
- SELF_PR_TIMEOUT_MS,
323
- // Policy
324
- BLAST_RADIUS_HARD_CAP_FILES,
325
- BLAST_RADIUS_HARD_CAP_LINES,
326
- // Security
327
- LEAK_CHECK_MODE,
328
- // Reuse attribution (P4-a Slice A)
329
- REUSE_ATTRIBUTION_MODE,
330
- reuseAttributionMode,
331
- // Reuse-outcome Hub reporting (P4-a Slice B, opt-in)
332
- OUTCOME_REPORT_MODE,
333
- outcomeReportMode,
334
- // Anti-abuse telemetry
335
- ANTI_ABUSE_TELEMETRY_MODE,
336
- antiAbuseTelemetryMode,
337
- // Validator (opt-in role)
338
- VALIDATOR_ENABLED,
339
- VALIDATOR_STAKE_AMOUNT,
340
- VALIDATOR_MAX_TASKS_PER_CYCLE,
341
- VALIDATOR_FETCH_TIMEOUT_MS,
342
- VALIDATOR_REPORT_TIMEOUT_MS,
343
- VALIDATOR_STAKE_TIMEOUT_MS,
344
- VALIDATOR_CMD_TIMEOUT_MS,
345
- VALIDATOR_BATCH_TIMEOUT_MS,
346
- // Helpers
347
- envInt,
348
- envPositiveInt,
349
- envFloat,
350
- envStr,
351
- };