@evomap/evolver 1.89.20 → 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 -3586
  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/skills/_meta/SKILL.md +0 -41
  38. package/skills/index.json +0 -14
  39. package/src/adapters/claudeCode.js +0 -194
  40. package/src/adapters/codex.js +0 -216
  41. package/src/adapters/cursor.js +0 -91
  42. package/src/adapters/hookAdapter.js +0 -469
  43. package/src/adapters/kiro.js +0 -195
  44. package/src/adapters/opencode.js +0 -326
  45. package/src/adapters/scripts/_lockPaths.js +0 -74
  46. package/src/adapters/scripts/_memoryFiltering.js +0 -35
  47. package/src/adapters/scripts/_runtimePaths.js +0 -440
  48. package/src/adapters/scripts/evolver-session-end.js +0 -321
  49. package/src/adapters/scripts/evolver-session-start.js +0 -587
  50. package/src/adapters/scripts/evolver-signal-detect.js +0 -98
  51. package/src/adapters/scripts/evolver-task-recall.js +0 -173
  52. package/src/atp/atpExecute.js +0 -283
  53. package/src/atp/atpTaskPickup.js +0 -233
  54. package/src/atp/autoBuyer.js +0 -382
  55. package/src/atp/autoDeliver.js +0 -215
  56. package/src/atp/cli.js +0 -354
  57. package/src/atp/cliAutobuyPrompt.js +0 -154
  58. package/src/atp/consumerAgent.js +0 -157
  59. package/src/atp/defaultHandler.js +0 -69
  60. package/src/atp/heartbeatSignalsHandler.js +0 -254
  61. package/src/atp/hubClient.js +0 -317
  62. package/src/atp/index.js +0 -38
  63. package/src/atp/merchantAgent.js +0 -118
  64. package/src/atp/protocol.js +0 -41
  65. package/src/atp/questionComposer.js +0 -133
  66. package/src/atp/serviceHelper.js +0 -92
  67. package/src/canary.js +0 -13
  68. package/src/config.js +0 -351
  69. package/src/evolve/guards.js +0 -1
  70. package/src/evolve/pipeline/collect.js +0 -1
  71. package/src/evolve/pipeline/dispatch.js +0 -1
  72. package/src/evolve/pipeline/enrich.js +0 -1
  73. package/src/evolve/pipeline/hub.js +0 -1
  74. package/src/evolve/pipeline/select.js +0 -1
  75. package/src/evolve/pipeline/signals.js +0 -1
  76. package/src/evolve/utils.js +0 -1
  77. package/src/evolve.js +0 -1
  78. package/src/experiment/agentRunner.js +0 -229
  79. package/src/experiment/cli.js +0 -159
  80. package/src/experiment/comparison.js +0 -233
  81. package/src/experiment/metrics.js +0 -75
  82. package/src/forceUpdate.js +0 -991
  83. package/src/gep/a2a.js +0 -173
  84. package/src/gep/a2aProtocol.js +0 -1
  85. package/src/gep/analyzer.js +0 -35
  86. package/src/gep/antiAbuseTelemetry.js +0 -1
  87. package/src/gep/assetCallLog.js +0 -197
  88. package/src/gep/assetStore.js +0 -723
  89. package/src/gep/assets.js +0 -36
  90. package/src/gep/autoDistillConv.js +0 -1
  91. package/src/gep/autoDistillLlm.js +0 -1
  92. package/src/gep/bridge.js +0 -138
  93. package/src/gep/candidateEval.js +0 -1
  94. package/src/gep/candidates.js +0 -1
  95. package/src/gep/claimNudge.js +0 -121
  96. package/src/gep/cliContracts.js +0 -1190
  97. package/src/gep/contentHash.js +0 -1
  98. package/src/gep/conversationDistiller.js +0 -1
  99. package/src/gep/conversationSniffer.js +0 -1
  100. package/src/gep/crypto.js +0 -1
  101. package/src/gep/curriculum.js +0 -1
  102. package/src/gep/deviceId.js +0 -1
  103. package/src/gep/directoryClient.js +0 -115
  104. package/src/gep/envFingerprint.js +0 -1
  105. package/src/gep/epigenetics.js +0 -1
  106. package/src/gep/execBridge.js +0 -1
  107. package/src/gep/executionTrace.js +0 -291
  108. package/src/gep/explore.js +0 -1
  109. package/src/gep/featureFlags.js +0 -121
  110. package/src/gep/gitOps.js +0 -265
  111. package/src/gep/hash.js +0 -1
  112. package/src/gep/hostErrorClassifier.js +0 -34
  113. package/src/gep/hubFetch.js +0 -1
  114. package/src/gep/hubReview.js +0 -1
  115. package/src/gep/hubSearch.js +0 -1
  116. package/src/gep/hubVerify.js +0 -1
  117. package/src/gep/idleScheduler.js +0 -400
  118. package/src/gep/issueReporter.js +0 -416
  119. package/src/gep/learningSignals.js +0 -1
  120. package/src/gep/llmReview.js +0 -92
  121. package/src/gep/localStateAwareness.js +0 -243
  122. package/src/gep/mailboxTransport.js +0 -119
  123. package/src/gep/memoryGraph.js +0 -1
  124. package/src/gep/memoryGraphAdapter.js +0 -1
  125. package/src/gep/mutation.js +0 -1
  126. package/src/gep/narrativeMemory.js +0 -1
  127. package/src/gep/oauthLogin.js +0 -181
  128. package/src/gep/openPRRegistry.js +0 -1
  129. package/src/gep/paths.js +0 -522
  130. package/src/gep/personality.js +0 -1
  131. package/src/gep/policyCheck.js +0 -1
  132. package/src/gep/portable.js +0 -103
  133. package/src/gep/privacyClient.js +0 -235
  134. package/src/gep/prompt.js +0 -1
  135. package/src/gep/questionGenerator.js +0 -518
  136. package/src/gep/recallInject.js +0 -1
  137. package/src/gep/recallVerifier.js +0 -1
  138. package/src/gep/reflection.js +0 -1
  139. package/src/gep/sanitize.js +0 -264
  140. package/src/gep/savingsCore.js +0 -1
  141. package/src/gep/schemas/capsule.js +0 -170
  142. package/src/gep/schemas/gene.js +0 -154
  143. package/src/gep/schemas/index.js +0 -8
  144. package/src/gep/schemas/protocol.js +0 -51
  145. package/src/gep/schemas/task.js +0 -74
  146. package/src/gep/selector.js +0 -1
  147. package/src/gep/selfPR.js +0 -469
  148. package/src/gep/signals.js +0 -776
  149. package/src/gep/skill2gep.js +0 -1056
  150. package/src/gep/skill2gepAudit.js +0 -303
  151. package/src/gep/skill2recipes.js +0 -511
  152. package/src/gep/skillDistiller.js +0 -1
  153. package/src/gep/skillPublisher.js +0 -358
  154. package/src/gep/solidify.js +0 -1
  155. package/src/gep/strategy.js +0 -1
  156. package/src/gep/taskReceiver.js +0 -575
  157. package/src/gep/tokenSavings.js +0 -1
  158. package/src/gep/trajectoryExport.js +0 -1
  159. package/src/gep/validationReport.js +0 -55
  160. package/src/gep/validator/index.js +0 -411
  161. package/src/gep/validator/reporter.js +0 -210
  162. package/src/gep/validator/sandboxExecutor.js +0 -480
  163. package/src/gep/validator/stakeBootstrap.js +0 -357
  164. package/src/gep/workspaceKeychain.js +0 -1
  165. package/src/ops/cleanup.js +0 -80
  166. package/src/ops/commentary.js +0 -60
  167. package/src/ops/health_check.js +0 -104
  168. package/src/ops/index.js +0 -11
  169. package/src/ops/innovation.js +0 -67
  170. package/src/ops/lifecycle.js +0 -798
  171. package/src/ops/self_repair.js +0 -76
  172. package/src/ops/skills_monitor.js +0 -147
  173. package/src/ops/trigger.js +0 -33
  174. package/src/proxy/clientSettings.js +0 -405
  175. package/src/proxy/envelope.js +0 -59
  176. package/src/proxy/extensions/dmHandler.js +0 -45
  177. package/src/proxy/extensions/sessionHandler.js +0 -141
  178. package/src/proxy/extensions/skillUpdater.js +0 -64
  179. package/src/proxy/extensions/traceControl.js +0 -1
  180. package/src/proxy/index.js +0 -1395
  181. package/src/proxy/inject.js +0 -1
  182. package/src/proxy/lifecycle/manager.js +0 -1568
  183. package/src/proxy/mailbox/state.js +0 -207
  184. package/src/proxy/mailbox/store.js +0 -590
  185. package/src/proxy/router/cache_passthrough.js +0 -26
  186. package/src/proxy/router/features.js +0 -84
  187. package/src/proxy/router/gemini_route.js +0 -154
  188. package/src/proxy/router/messages_route.js +0 -535
  189. package/src/proxy/router/model_router.js +0 -113
  190. package/src/proxy/router/models_route.js +0 -52
  191. package/src/proxy/router/ollama_route.js +0 -103
  192. package/src/proxy/router/responses_route.js +0 -170
  193. package/src/proxy/router/vertex_route.js +0 -110
  194. package/src/proxy/server/http.js +0 -363
  195. package/src/proxy/server/routes.js +0 -558
  196. package/src/proxy/server/settings.js +0 -115
  197. package/src/proxy/sync/engine.js +0 -179
  198. package/src/proxy/sync/inbound.js +0 -211
  199. package/src/proxy/sync/outbound.js +0 -320
  200. package/src/proxy/task/monitor.js +0 -131
  201. package/src/proxy/trace/extractor.js +0 -1
  202. package/src/proxy/trace/usage.js +0 -1
  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
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- const { WebUiServer } = require('./server/http');
4
-
5
- async function startWebUi(opts = {}) {
6
- const server = new WebUiServer(opts);
7
- const info = await server.start();
8
- return { server, ...info };
9
- }
10
-
11
- module.exports = {
12
- startWebUi,
13
- WebUiServer,
14
- };
@@ -1,146 +0,0 @@
1
- 'use strict';
2
-
3
- const { getObserverPaths } = require('./paths');
4
- const { readJsonSafe, readJsonl, paginate } = require('./jsonl');
5
- const { redactValue } = require('./redact');
6
-
7
- function getAssetOverview(query = {}) {
8
- const paths = getObserverPaths();
9
- const genes = readGenes(paths);
10
- const capsules = readCapsules(paths);
11
- const failedCapsules = readFailedCapsules(paths);
12
- const events = readJsonl(paths.eventsPath, { last: query.eventsLast || 500 }).map(redactValue);
13
- const candidates = readJsonl(paths.candidatesPath, { last: query.candidatesLast || 200 }).map(redactValue);
14
- const externalCandidates = readJsonl(paths.externalCandidatesPath, { last: query.candidatesLast || 200 }).map(redactValue);
15
- const assetCalls = readJsonl(paths.assetCallLogPath, { last: query.assetCallsLast || 500 }).map(redactValue);
16
-
17
- return {
18
- counts: {
19
- genes: genes.length,
20
- capsules: capsules.length,
21
- failedCapsules: failedCapsules.length,
22
- events: events.length,
23
- candidates: candidates.length,
24
- externalCandidates: externalCandidates.length,
25
- assetCalls: assetCalls.length,
26
- },
27
- genesByCategory: countBy(genes, 'category'),
28
- capsulesByOutcome: countBy(capsules, (c) => c.outcome && c.outcome.status || 'unknown'),
29
- assetCallsByAction: countBy(assetCalls, 'action'),
30
- recentEvents: events.slice(-20).reverse(),
31
- recentAssetCalls: assetCalls.slice(-20).reverse(),
32
- };
33
- }
34
-
35
- function listGenes(query = {}) {
36
- const genes = readGenes(getObserverPaths());
37
- return {
38
- ...paginate(filterText(genes, query.q), query),
39
- categories: countBy(genes, 'category'),
40
- };
41
- }
42
-
43
- function listCapsules(query = {}) {
44
- const paths = getObserverPaths();
45
- const all = readCapsules(paths).concat(readFailedCapsules(paths).map((c) => ({ ...c, failed_store: true })));
46
- return {
47
- ...paginate(filterText(all, query.q), query),
48
- outcomes: countBy(all, (c) => c.outcome && c.outcome.status || 'unknown'),
49
- };
50
- }
51
-
52
- function listEvents(query = {}) {
53
- const events = readJsonl(getObserverPaths().eventsPath).map(redactValue).reverse();
54
- return paginate(filterText(events, query.q), query);
55
- }
56
-
57
- function listCandidates(query = {}) {
58
- const paths = getObserverPaths();
59
- const local = readJsonl(paths.candidatesPath).map((entry) => ({ ...entry, source: 'local' }));
60
- const external = readJsonl(paths.externalCandidatesPath).map((entry) => ({ ...entry, source: 'external' }));
61
- return paginate(filterText(local.concat(external).map(redactValue).reverse(), query.q), query);
62
- }
63
-
64
- function listAssetCalls(query = {}) {
65
- const calls = readJsonl(getObserverPaths().assetCallLogPath).map(redactValue).reverse();
66
- return paginate(filterText(calls, query.q), query);
67
- }
68
-
69
- function getLineage(id) {
70
- const paths = getObserverPaths();
71
- const genes = readGenes(paths);
72
- const capsules = readCapsules(paths).concat(readFailedCapsules(paths));
73
- const events = readJsonl(paths.eventsPath).map(redactValue);
74
- const assetCalls = readJsonl(paths.assetCallLogPath).map(redactValue);
75
- return {
76
- id,
77
- genes: genes.filter((g) => matchesAsset(g, id)),
78
- capsules: capsules.filter((c) => matchesAsset(c, id) || c.gene === id),
79
- events: events.filter((e) => eventMentions(e, id)),
80
- assetCalls: assetCalls.filter((entry) => matchesAsset(entry, id)),
81
- };
82
- }
83
-
84
- function readGenes(paths) {
85
- const fromJson = readJsonSafe(paths.genesPath, { genes: [] }).genes || [];
86
- const fromJsonl = readJsonl(paths.genesJsonlPath).filter((g) => g && g.type === 'Gene');
87
- return dedupeById(fromJson.concat(fromJsonl)).map(redactValue);
88
- }
89
-
90
- function readCapsules(paths) {
91
- const fromJson = readJsonSafe(paths.capsulesPath, { capsules: [] }).capsules || [];
92
- const fromJsonl = readJsonl(paths.capsulesJsonlPath).filter((c) => c && c.type === 'Capsule');
93
- return dedupeById(fromJson.concat(fromJsonl)).map(redactValue);
94
- }
95
-
96
- function readFailedCapsules(paths) {
97
- const failed = readJsonSafe(paths.failedCapsulesPath, { failed_capsules: [] }).failed_capsules || [];
98
- return failed.map(redactValue);
99
- }
100
-
101
- function dedupeById(items) {
102
- const out = new Map();
103
- for (const item of items) {
104
- if (item && item.id) out.set(String(item.id), item);
105
- }
106
- return Array.from(out.values());
107
- }
108
-
109
- function countBy(items, keyOrFn) {
110
- const counts = {};
111
- for (const item of items) {
112
- const key = typeof keyOrFn === 'function' ? keyOrFn(item) : item && item[keyOrFn];
113
- const safeKey = key || 'unknown';
114
- counts[safeKey] = (counts[safeKey] || 0) + 1;
115
- }
116
- return counts;
117
- }
118
-
119
- function filterText(items, q) {
120
- if (!q) return items;
121
- const needle = String(q).toLowerCase();
122
- return items.filter((item) => JSON.stringify(item).toLowerCase().includes(needle));
123
- }
124
-
125
- function matchesAsset(item, id) {
126
- if (!item || !id) return false;
127
- return item.id === id || item.asset_id === id || item.asset_id === `sha256:${id}`;
128
- }
129
-
130
- function eventMentions(event, id) {
131
- if (matchesAsset(event, id)) return true;
132
- if (event.capsule_id === id || event.mutation_id === id) return true;
133
- return Array.isArray(event.genes_used) && event.genes_used.includes(id);
134
- }
135
-
136
- module.exports = {
137
- getAssetOverview,
138
- listGenes,
139
- listCapsules,
140
- listEvents,
141
- listCandidates,
142
- listAssetCalls,
143
- getLineage,
144
- readGenes,
145
- readCapsules,
146
- };
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- const { getStatus } = require('./status');
4
- const { getSafetyState } = require('./safety');
5
- const { listRuns, getRun } = require('./runs');
6
- const { getAssetOverview, listGenes, listCapsules, listEvents, listCandidates, listAssetCalls, getLineage } = require('./assets');
7
- const { getInteractions } = require('./interactions');
8
- const { getPersonality, getMemoryGraph } = require('./personality');
9
- const { listSkills } = require('./skills');
10
- const { getObserverPaths } = require('./paths');
11
- const { tailText } = require('./jsonl');
12
- const { redactText } = require('./redact');
13
-
14
- function getEvolverLog(query = {}) {
15
- const tail = query.tail || 200;
16
- const text = tailText(getObserverPaths().evolverLogPath, tail);
17
- return { text: redactText(text), tail: Number(tail) || 200 };
18
- }
19
-
20
- module.exports = {
21
- getStatus,
22
- getSafetyState,
23
- listRuns,
24
- getRun,
25
- getAssetOverview,
26
- listGenes,
27
- listCapsules,
28
- listEvents,
29
- listCandidates,
30
- listAssetCalls,
31
- getLineage,
32
- getInteractions,
33
- getPersonality,
34
- getMemoryGraph,
35
- listSkills,
36
- getEvolverLog,
37
- };
@@ -1,127 +0,0 @@
1
- 'use strict';
2
-
3
- const http = require('http');
4
- const path = require('path');
5
- const { getProxySettings } = require('./status');
6
- const { getProxyToken } = require('../../proxy/server/settings');
7
- const { readJsonl, paginate } = require('./jsonl');
8
- const { redactValue } = require('./redact');
9
- const { getEvomapPath } = require('../../gep/paths');
10
-
11
- // Lazy via paths.getEvomapPath() — honors EVOLVER_HOME (#114).
12
- function _defaultMailboxDir() { return getEvomapPath('mailbox'); }
13
-
14
- async function getInteractions(query = {}) {
15
- const proxy = getProxySettings();
16
- const proxySnapshots = proxy.url ? await readProxySnapshots(proxy.url) : {};
17
- const mailbox = readMailboxMessages(query);
18
- return {
19
- proxy,
20
- proxySnapshots,
21
- mailbox: paginate(mailbox, query),
22
- };
23
- }
24
-
25
- function readMailboxMessages(query = {}) {
26
- const mailboxDir = query.mailboxDir || process.env.EVOMAP_MAILBOX_DIR || _defaultMailboxDir();
27
- const messages = readJsonl(path.join(mailboxDir, 'messages.jsonl'), { last: query.last || 500 })
28
- .filter((row) => row && !row._op)
29
- .map((row) => normalizeMessage(redactValue(row)));
30
- return filterMessages(messages, query);
31
- }
32
-
33
- async function readProxySnapshots(baseUrl) {
34
- const endpoints = {
35
- status: '/proxy/status',
36
- hubStatus: '/proxy/hub-status',
37
- taskMetrics: '/task/metrics',
38
- assetSubmissions: '/asset/submissions?limit=20',
39
- sessions: '/session/list?limit=20',
40
- dms: '/dm/list?limit=20',
41
- atpPolicy: '/atp/policy',
42
- atpProofs: '/atp/proofs?limit=20',
43
- };
44
- // Issue all proxy requests concurrently. Sequential await meant the
45
- // worst-case (every endpoint timing out at 1500ms each) blocked the
46
- // /webui/interactions response for ~12s; parallel keeps it ~1.5s.
47
- const entries = await Promise.all(
48
- Object.entries(endpoints).map(async ([key, endpoint]) =>
49
- [key, await requestJson(baseUrl + endpoint)],
50
- ),
51
- );
52
- return redactValue(Object.fromEntries(entries));
53
- }
54
-
55
- function requestJson(url) {
56
- return new Promise((resolve) => {
57
- const u = new URL(url);
58
- const token = getProxyToken();
59
- const headers = {};
60
- if (token) headers['Authorization'] = 'Bearer ' + token;
61
- const req = http.request(
62
- { hostname: u.hostname, port: u.port, path: u.pathname + (u.search || ''), method: 'GET', headers, timeout: 1500 },
63
- (res) => {
64
- const chunks = [];
65
- res.on('data', (chunk) => chunks.push(chunk));
66
- res.on('end', () => {
67
- const raw = Buffer.concat(chunks).toString();
68
- try {
69
- resolve({ ok: res.statusCode >= 200 && res.statusCode < 300, status: res.statusCode, body: JSON.parse(raw) });
70
- } catch {
71
- resolve({ ok: false, status: res.statusCode, body: null });
72
- }
73
- });
74
- },
75
- );
76
- req.on('timeout', () => { req.destroy(); resolve({ ok: false, status: 0, error: 'timeout' }); });
77
- req.on('error', (err) => resolve({ ok: false, status: 0, error: err.message }));
78
- req.end();
79
- });
80
- }
81
-
82
- function normalizeMessage(msg) {
83
- return {
84
- id: msg.id || null,
85
- source: 'mailbox',
86
- direction: msg.direction || null,
87
- type: msg.type || null,
88
- status: msg.status || null,
89
- timestamp: toIso(msg.created_at || msg.updated_at || msg.synced_at),
90
- refId: msg.ref_id || msg.payload && msg.payload.ref_id || null,
91
- priority: msg.priority || null,
92
- summary: summarizePayload(msg),
93
- payload: msg.payload || null,
94
- };
95
- }
96
-
97
- function filterMessages(messages, query) {
98
- return messages.filter((msg) => {
99
- if (query.type && msg.type !== query.type) return false;
100
- if (query.direction && msg.direction !== query.direction) return false;
101
- if (query.status && msg.status !== query.status) return false;
102
- return true;
103
- }).reverse();
104
- }
105
-
106
- function summarizePayload(msg) {
107
- const payload = msg.payload || {};
108
- if (payload.task_id) return `Task ${payload.task_id}`;
109
- if (payload.asset_id) return `Asset ${payload.asset_id}`;
110
- if (payload.session_id) return `Session ${payload.session_id}`;
111
- if (payload.title) return String(payload.title);
112
- if (msg.type) return String(msg.type).replace(/_/g, ' ');
113
- return 'message';
114
- }
115
-
116
- function toIso(value) {
117
- if (!value) return null;
118
- if (typeof value === 'string') return value;
119
- const n = Number(value);
120
- return Number.isFinite(n) ? new Date(n).toISOString() : null;
121
- }
122
-
123
- module.exports = {
124
- getInteractions,
125
- readMailboxMessages,
126
- readProxySnapshots,
127
- };
@@ -1,75 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
-
5
- function readJsonSafe(filePath, fallback) {
6
- try {
7
- if (!filePath || !fs.existsSync(filePath)) return fallback;
8
- const raw = fs.readFileSync(filePath, 'utf8');
9
- if (!raw.trim()) return fallback;
10
- return JSON.parse(raw);
11
- } catch {
12
- return fallback;
13
- }
14
- }
15
-
16
- function readJsonl(filePath, opts = {}) {
17
- try {
18
- if (!filePath || !fs.existsSync(filePath)) return [];
19
- const raw = fs.readFileSync(filePath, 'utf8');
20
- const lines = raw.split('\n').map((line) => line.trim()).filter(Boolean);
21
- const selected = opts.last ? lines.slice(-toPositiveInt(opts.last, lines.length)) : lines;
22
- const rows = [];
23
- for (const line of selected) {
24
- try {
25
- rows.push(JSON.parse(line));
26
- } catch {
27
- // Corrupt JSONL rows should not break the dashboard.
28
- }
29
- }
30
- return rows;
31
- } catch {
32
- return [];
33
- }
34
- }
35
-
36
- function tailText(filePath, maxLines) {
37
- try {
38
- if (!filePath || !fs.existsSync(filePath)) return '';
39
- const raw = fs.readFileSync(filePath, 'utf8');
40
- const lines = raw.split('\n');
41
- return lines.slice(-toPositiveInt(maxLines, 200)).join('\n');
42
- } catch {
43
- return '';
44
- }
45
- }
46
-
47
- function paginate(items, query = {}) {
48
- const limit = Math.min(toPositiveInt(query.limit, 50), 200);
49
- const offset = Math.max(0, toPositiveInt(query.offset || query.cursor, 0));
50
- const data = items.slice(offset, offset + limit);
51
- const nextOffset = offset + data.length;
52
- return {
53
- data,
54
- pagination: {
55
- limit,
56
- offset,
57
- totalItems: items.length,
58
- nextCursor: nextOffset < items.length ? String(nextOffset) : null,
59
- },
60
- };
61
- }
62
-
63
- function toPositiveInt(value, fallback) {
64
- const n = Number(value);
65
- if (!Number.isFinite(n) || n < 0) return fallback;
66
- return Math.floor(n);
67
- }
68
-
69
- module.exports = {
70
- readJsonSafe,
71
- readJsonl,
72
- tailText,
73
- paginate,
74
- toPositiveInt,
75
- };
@@ -1,46 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const {
5
- getRepoRoot,
6
- getWorkspaceRoot,
7
- getEvolutionDir,
8
- getGepAssetsDir,
9
- getSkillsDir,
10
- getEvolverLogPath,
11
- getAgentSessionsDir,
12
- getNarrativePath,
13
- getReflectionLogPath,
14
- } = require('../../gep/paths');
15
-
16
- function getObserverPaths() {
17
- const evolutionDir = getEvolutionDir();
18
- const gepAssetsDir = getGepAssetsDir();
19
- return {
20
- repoRoot: getRepoRoot(),
21
- workspaceRoot: getWorkspaceRoot(),
22
- evolutionDir,
23
- gepAssetsDir,
24
- skillsDir: getSkillsDir(),
25
- agentSessionsDir: getAgentSessionsDir(),
26
- evolverLogPath: getEvolverLogPath(),
27
- cycleProgressPath: path.join(evolutionDir, 'cycle_progress.json'),
28
- solidifyStatePath: path.join(evolutionDir, 'evolution_solidify_state.json'),
29
- evolutionStatePath: path.join(evolutionDir, 'evolution_state.json'),
30
- pipelineEventsPath: path.join(evolutionDir, 'pipeline_events.jsonl'),
31
- assetCallLogPath: path.join(evolutionDir, 'asset_call_log.jsonl'),
32
- reflectionLogPath: getReflectionLogPath(),
33
- narrativePath: getNarrativePath(),
34
- memoryGraphPath: path.join(evolutionDir, 'memory_graph.jsonl'),
35
- genesPath: path.join(gepAssetsDir, 'genes.json'),
36
- genesJsonlPath: path.join(gepAssetsDir, 'genes.jsonl'),
37
- capsulesPath: path.join(gepAssetsDir, 'capsules.json'),
38
- capsulesJsonlPath: path.join(gepAssetsDir, 'capsules.jsonl'),
39
- eventsPath: path.join(gepAssetsDir, 'events.jsonl'),
40
- candidatesPath: path.join(gepAssetsDir, 'candidates.jsonl'),
41
- externalCandidatesPath: path.join(gepAssetsDir, 'external_candidates.jsonl'),
42
- failedCapsulesPath: path.join(gepAssetsDir, 'failed_capsules.json'),
43
- };
44
- }
45
-
46
- module.exports = { getObserverPaths };
@@ -1,43 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const fs = require('fs');
5
- const { getMemoryDir, getEvolutionDir } = require('../../gep/paths');
6
- const { readJsonSafe, readJsonl } = require('./jsonl');
7
- const { redactValue } = require('./redact');
8
-
9
- function getPersonality() {
10
- const evoDir = getEvolutionDir();
11
- const memDir = getMemoryDir();
12
- const candidates = [
13
- path.join(evoDir, 'personality_state.json'),
14
- path.join(memDir, 'personality_state.json'),
15
- ];
16
- for (const candidate of candidates) {
17
- const data = readJsonSafe(candidate, null);
18
- if (data) return { exists: true, ...redactValue(data) };
19
- }
20
- return { exists: false, current: null, history: [] };
21
- }
22
-
23
- function getMemoryGraph(query = {}) {
24
- const limit = Math.min(Number(query.limit) || 50, 500);
25
- const graphPath = path.join(getEvolutionDir(), 'memory_graph.jsonl');
26
- if (!fs.existsSync(graphPath)) return { exists: false, items: [] };
27
- const rows = readJsonl(graphPath, { last: limit }).map(redactValue);
28
- return {
29
- exists: true,
30
- total: countLines(graphPath),
31
- items: rows.reverse(),
32
- };
33
- }
34
-
35
- function countLines(filePath) {
36
- try {
37
- return fs.readFileSync(filePath, 'utf8').split('\n').filter(Boolean).length;
38
- } catch {
39
- return 0;
40
- }
41
- }
42
-
43
- module.exports = { getPersonality, getMemoryGraph };
@@ -1,58 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const { getObserverPaths } = require('./paths');
6
- const { readJsonl } = require('./jsonl');
7
- const { redactValue } = require('./redact');
8
-
9
- const VALID_PHASE_STATUSES = new Set(['pending', 'running', 'success', 'failed', 'skipped', 'blocked']);
10
-
11
- function readPipelineEvents(opts = {}) {
12
- return readJsonl(getObserverPaths().pipelineEventsPath, opts).map(normalizePipelineEvent);
13
- }
14
-
15
- function logPipelineEvent(event) {
16
- const normalized = normalizePipelineEvent(event);
17
- const target = getObserverPaths().pipelineEventsPath;
18
- fs.mkdirSync(path.dirname(target), { recursive: true });
19
- fs.appendFileSync(target, JSON.stringify(normalized) + '\n', 'utf8');
20
- return normalized;
21
- }
22
-
23
- function normalizePipelineEvent(event) {
24
- const input = event && typeof event === 'object' ? event : {};
25
- const status = VALID_PHASE_STATUSES.has(input.status) ? input.status : 'running';
26
- return redactValue({
27
- run_id: stringOrNull(input.run_id),
28
- cycle_id: stringOrNull(input.cycle_id),
29
- phase: stringOrDefault(input.phase, 'unknown'),
30
- status,
31
- started_at: stringOrNull(input.started_at),
32
- finished_at: stringOrNull(input.finished_at),
33
- summary: stringOrDefault(input.summary, ''),
34
- evidence_refs: arrayOfObjects(input.evidence_refs),
35
- asset_refs: arrayOfObjects(input.asset_refs),
36
- validation_refs: arrayOfObjects(input.validation_refs),
37
- requires_confirmation: Boolean(input.requires_confirmation),
38
- timestamp: input.timestamp || new Date().toISOString(),
39
- });
40
- }
41
-
42
- function stringOrNull(value) {
43
- return typeof value === 'string' && value ? value : null;
44
- }
45
-
46
- function stringOrDefault(value, fallback) {
47
- return typeof value === 'string' ? value : fallback;
48
- }
49
-
50
- function arrayOfObjects(value) {
51
- return Array.isArray(value) ? value.filter((entry) => entry && typeof entry === 'object') : [];
52
- }
53
-
54
- module.exports = {
55
- readPipelineEvents,
56
- logPipelineEvent,
57
- normalizePipelineEvent,
58
- };
@@ -1,63 +0,0 @@
1
- 'use strict';
2
-
3
- const SECRET_KEY_RE = /(secret|token|api[_-]?key|authorization|cookie|oauth|password|private[_-]?key|node_secret)/i;
4
- // Three alternation arms, each with one capturing group so the replace()
5
- // callback can keep the prefix and only mask the value:
6
- // 1) HTTP Bearer auth header
7
- // 2) Env/INI/CLI style NAME=value (or NAME: value) where NAME ends in
8
- // SECRET / TOKEN / KEY / PASSWORD / PASSWD / PWD. The original
9
- // regex only matched SECRET / TOKEN; without KEY / PASSWORD a line
10
- // like `OPENAI_API_KEY=sk-...` or `DB_PASSWORD=hunter2` would slip
11
- // through to the /webui/logs/evolver tail, leaking live credentials.
12
- // 3) Bare OpenAI/Anthropic-shape API keys (`sk-...` / `sk-ant-...`) for
13
- // cases where they appear as standalone tokens in log lines without
14
- // a NAME= prefix.
15
- // Flagged /gi so lower-case variants (`password=...`, `bearer ...`,
16
- // `sk-...`) are also caught; over-redacting harmless prose tokens like
17
- // "monkey=" is acceptable, leaking a real key is not.
18
- const SECRET_TEXT_RE = new RegExp([
19
- '(Bearer\\s+)[A-Za-z0-9._~+/-]+=*',
20
- '([A-Za-z0-9_]*(?:SECRET|TOKEN|KEY|PASSWORD|PASSWD|PWD)[A-Za-z0-9_]*\\s*[:=]\\s*)["\']?[^\\s,"\'`]+',
21
- '(sk-(?:ant-)?[A-Za-z0-9_-]{20,})',
22
- ].join('|'), 'gi');
23
-
24
- function redactValue(value, depth = 0) {
25
- if (depth > 8) return '[REDACTED_DEPTH]';
26
- if (Array.isArray(value)) return value.map((entry) => redactValue(entry, depth + 1));
27
- if (!value || typeof value !== 'object') {
28
- return typeof value === 'string' ? redactText(value) : value;
29
- }
30
-
31
- const out = {};
32
- for (const [key, child] of Object.entries(value)) {
33
- if (SECRET_KEY_RE.test(key)) {
34
- out[key] = '[REDACTED]';
35
- } else if (isLargeSensitiveField(key, child)) {
36
- out[key] = '[REDACTED_SENSITIVE_DETAIL]';
37
- } else {
38
- out[key] = redactValue(child, depth + 1);
39
- }
40
- }
41
- return out;
42
- }
43
-
44
- function redactText(text) {
45
- if (typeof text !== 'string') return text;
46
- return text.replace(SECRET_TEXT_RE, (match, bearer, namedPrefix, bareKey) => {
47
- if (bearer) return `${bearer}[REDACTED]`;
48
- if (namedPrefix) return `${namedPrefix}[REDACTED]`;
49
- if (bareKey) return '[REDACTED]';
50
- return '[REDACTED]';
51
- });
52
- }
53
-
54
- function isLargeSensitiveField(key, value) {
55
- if (typeof value !== 'string') return false;
56
- if (!/(prompt|diff|content|transcript|message|raw)/i.test(key)) return false;
57
- return value.length > 500;
58
- }
59
-
60
- module.exports = {
61
- redactValue,
62
- redactText,
63
- };