@evomap/evolver 1.67.4 → 1.68.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja-JP.md +55 -2
- package/README.md +55 -2
- package/README.zh-CN.md +55 -2
- package/SECURITY.md +66 -0
- package/index.js +41 -25
- package/package.json +1 -1
- package/src/adapters/scripts/evolver-session-end.js +194 -0
- package/src/adapters/scripts/evolver-session-start.js +93 -0
- package/src/adapters/scripts/evolver-signal-detect.js +69 -0
- package/src/config.js +26 -0
- package/src/evolve.js +1 -1
- package/src/gep/.integrity +0 -0
- package/src/gep/a2aProtocol.js +1 -1
- package/src/gep/candidateEval.js +1 -1
- package/src/gep/candidates.js +1 -1
- package/src/gep/contentHash.js +1 -1
- package/src/gep/crypto.js +1 -1
- package/src/gep/curriculum.js +1 -1
- package/src/gep/deviceId.js +1 -1
- package/src/gep/envFingerprint.js +1 -1
- package/src/gep/explore.js +1 -1
- package/src/gep/hubReview.js +1 -1
- package/src/gep/hubSearch.js +1 -1
- package/src/gep/hubVerify.js +1 -1
- package/src/gep/integrityCheck.js +1 -1
- package/src/gep/learningSignals.js +1 -1
- package/src/gep/memoryGraph.js +1 -1
- package/src/gep/memoryGraphAdapter.js +1 -1
- package/src/gep/mutation.js +1 -1
- package/src/gep/narrativeMemory.js +1 -1
- package/src/gep/personality.js +1 -1
- package/src/gep/policyCheck.js +1 -1
- package/src/gep/prompt.js +1 -1
- package/src/gep/reflection.js +1 -1
- package/src/gep/selector.js +1 -1
- package/src/gep/shield.js +1 -1
- package/src/gep/skillDistiller.js +1 -1
- package/src/gep/solidify.js +1 -1
- package/src/gep/strategy.js +1 -1
- package/src/gep/validator/index.js +170 -0
- package/src/gep/validator/reporter.js +118 -0
- package/src/gep/validator/sandboxExecutor.js +262 -0
- package/src/gep/validator/stakeBootstrap.js +81 -0
- package/assets/gep/candidates.jsonl +0 -2
- package/assets/gep/failed_capsules.json +0 -4
- package/assets/gep/genes.jsonl +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// evolver-session-start.js
|
|
3
|
+
// Reads recent evolution memory and injects it as context for the agent session.
|
|
4
|
+
// Input: stdin JSON (session context). Output: stdout JSON with agent_message.
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
function findEvolverRoot() {
|
|
10
|
+
const candidates = [
|
|
11
|
+
process.env.EVOLVER_ROOT,
|
|
12
|
+
path.resolve(__dirname, '..', '..', '..'),
|
|
13
|
+
];
|
|
14
|
+
for (const c of candidates) {
|
|
15
|
+
if (c && fs.existsSync(path.join(c, 'package.json'))) {
|
|
16
|
+
try {
|
|
17
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(c, 'package.json'), 'utf8'));
|
|
18
|
+
if (pkg.name === '@evomap/evolver' || pkg.name === 'evolver') return c;
|
|
19
|
+
} catch { /* skip */ }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const homeSkills = path.join(require('os').homedir(), 'skills', 'evolver');
|
|
23
|
+
if (fs.existsSync(path.join(homeSkills, 'package.json'))) return homeSkills;
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function findMemoryGraph(evolverRoot) {
|
|
28
|
+
if (process.env.MEMORY_GRAPH_PATH && fs.existsSync(process.env.MEMORY_GRAPH_PATH)) {
|
|
29
|
+
return process.env.MEMORY_GRAPH_PATH;
|
|
30
|
+
}
|
|
31
|
+
const candidates = [
|
|
32
|
+
evolverRoot && path.join(evolverRoot, 'memory', 'evolution', 'memory_graph.jsonl'),
|
|
33
|
+
evolverRoot && path.join(evolverRoot, 'MEMORY', 'evolution', 'memory_graph.jsonl'),
|
|
34
|
+
];
|
|
35
|
+
for (const c of candidates) {
|
|
36
|
+
if (c && fs.existsSync(c)) return c;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function readLastN(filePath, n) {
|
|
42
|
+
try {
|
|
43
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
44
|
+
const lines = content.trim().split('\n').filter(Boolean);
|
|
45
|
+
return lines.slice(-n).map(line => {
|
|
46
|
+
try { return JSON.parse(line); } catch { return null; }
|
|
47
|
+
}).filter(Boolean);
|
|
48
|
+
} catch { return []; }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function formatOutcome(entry) {
|
|
52
|
+
const status = entry.outcome ? entry.outcome.status : 'unknown';
|
|
53
|
+
const score = entry.outcome && entry.outcome.score != null ? entry.outcome.score : '?';
|
|
54
|
+
const note = entry.outcome && entry.outcome.note ? entry.outcome.note : '';
|
|
55
|
+
const signals = Array.isArray(entry.signals) ? entry.signals.slice(0, 3).join(', ') : '';
|
|
56
|
+
const ts = entry.timestamp ? entry.timestamp.slice(0, 10) : '';
|
|
57
|
+
const icon = status === 'success' ? '+' : status === 'failed' ? '-' : '?';
|
|
58
|
+
return `[${icon}] ${ts} score=${score} signals=[${signals}] ${note}`.slice(0, 200);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function main() {
|
|
62
|
+
const evolverRoot = findEvolverRoot();
|
|
63
|
+
const graphPath = findMemoryGraph(evolverRoot);
|
|
64
|
+
|
|
65
|
+
if (!graphPath) {
|
|
66
|
+
process.stdout.write(JSON.stringify({}));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const entries = readLastN(graphPath, 5);
|
|
71
|
+
if (entries.length === 0) {
|
|
72
|
+
process.stdout.write(JSON.stringify({}));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const successCount = entries.filter(e => e.outcome && e.outcome.status === 'success').length;
|
|
77
|
+
const failCount = entries.filter(e => e.outcome && e.outcome.status === 'failed').length;
|
|
78
|
+
|
|
79
|
+
const lines = entries.map(formatOutcome);
|
|
80
|
+
const summary = [
|
|
81
|
+
`[Evolution Memory] Recent ${entries.length} outcomes (${successCount} success, ${failCount} failed):`,
|
|
82
|
+
...lines,
|
|
83
|
+
'',
|
|
84
|
+
'Use successful approaches. Avoid repeating failed patterns.',
|
|
85
|
+
].join('\n');
|
|
86
|
+
|
|
87
|
+
process.stdout.write(JSON.stringify({
|
|
88
|
+
agent_message: summary,
|
|
89
|
+
additionalContext: summary,
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
main();
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// evolver-signal-detect.js
|
|
3
|
+
// Lightweight signal detection on file edit events.
|
|
4
|
+
// Input: stdin JSON (edit event). Output: stdout JSON with additional_context.
|
|
5
|
+
|
|
6
|
+
const SIGNAL_KEYWORDS = {
|
|
7
|
+
perf_bottleneck: ['timeout', 'slow', 'latency', 'bottleneck', 'oom', 'out of memory', 'performance'],
|
|
8
|
+
capability_gap: ['not supported', 'unsupported', 'not implemented', 'missing feature', 'not available'],
|
|
9
|
+
log_error: ['error:', 'exception:', 'typeerror', 'referenceerror', 'syntaxerror', 'failed'],
|
|
10
|
+
user_feature_request: ['add feature', 'implement', 'new function', 'new module', 'please add'],
|
|
11
|
+
recurring_error: ['same error', 'still failing', 'not fixed', 'keeps failing', 'repeatedly'],
|
|
12
|
+
deployment_issue: ['deploy failed', 'build failed', 'ci failed', 'pipeline', 'rollback'],
|
|
13
|
+
test_failure: ['test failed', 'test failure', 'assertion', 'expect(', 'assert.'],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function detectSignals(text) {
|
|
17
|
+
if (!text || typeof text !== 'string') return [];
|
|
18
|
+
const lower = text.toLowerCase();
|
|
19
|
+
const found = [];
|
|
20
|
+
for (const [signal, keywords] of Object.entries(SIGNAL_KEYWORDS)) {
|
|
21
|
+
for (const kw of keywords) {
|
|
22
|
+
if (lower.includes(kw)) {
|
|
23
|
+
found.push(signal);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return [...new Set(found)];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function main() {
|
|
32
|
+
let inputData = '';
|
|
33
|
+
let handled = false;
|
|
34
|
+
process.stdin.setEncoding('utf8');
|
|
35
|
+
process.stdin.on('data', chunk => { inputData += chunk; });
|
|
36
|
+
process.stdin.on('end', () => {
|
|
37
|
+
if (handled) return;
|
|
38
|
+
handled = true;
|
|
39
|
+
try {
|
|
40
|
+
const input = inputData.trim() ? JSON.parse(inputData) : {};
|
|
41
|
+
const content = input.content || input.file_content || input.diff || '';
|
|
42
|
+
const filePath = input.path || input.file_path || '';
|
|
43
|
+
|
|
44
|
+
const signals = detectSignals(content);
|
|
45
|
+
|
|
46
|
+
if (signals.length === 0) {
|
|
47
|
+
process.stdout.write(JSON.stringify({}));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const ctx = `[Evolution Signal] Detected: [${signals.join(', ')}] in ${filePath || 'edited file'}. Consider recording this outcome.`;
|
|
52
|
+
process.stdout.write(JSON.stringify({
|
|
53
|
+
additional_context: ctx,
|
|
54
|
+
additionalContext: ctx,
|
|
55
|
+
}));
|
|
56
|
+
} catch {
|
|
57
|
+
process.stdout.write(JSON.stringify({}));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
if (handled) return;
|
|
63
|
+
handled = true;
|
|
64
|
+
process.stdout.write(JSON.stringify({}));
|
|
65
|
+
process.exit(0);
|
|
66
|
+
}, 1500);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main();
|
package/src/config.js
CHANGED
|
@@ -84,6 +84,23 @@ const SELF_PR_TIMEOUT_MS = envInt('EVOLVER_SELF_PR_TIMEOUT_MS', 30000);
|
|
|
84
84
|
|
|
85
85
|
const LEAK_CHECK_MODE = envStr('EVOLVER_LEAK_CHECK', 'warn');
|
|
86
86
|
|
|
87
|
+
// --- Validator mode (opt-in) ---
|
|
88
|
+
// Opt-in node role: when enabled, the evolver periodically fetches assigned
|
|
89
|
+
// validation tasks from the Hub, runs the commands in an isolated sandbox,
|
|
90
|
+
// and submits ValidationReports. Default is OFF for backward compatibility.
|
|
91
|
+
|
|
92
|
+
const VALIDATOR_ENABLED = (function () {
|
|
93
|
+
const v = String(process.env.EVOLVER_VALIDATOR_ENABLED || '').toLowerCase().trim();
|
|
94
|
+
return v === '1' || v === 'true' || v === 'yes' || v === 'on';
|
|
95
|
+
})();
|
|
96
|
+
const VALIDATOR_STAKE_AMOUNT = envInt('EVOLVER_VALIDATOR_STAKE_AMOUNT', 100);
|
|
97
|
+
const VALIDATOR_MAX_TASKS_PER_CYCLE = envInt('EVOLVER_VALIDATOR_MAX_TASKS_PER_CYCLE', 2);
|
|
98
|
+
const VALIDATOR_FETCH_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_FETCH_TIMEOUT_MS', 8000);
|
|
99
|
+
const VALIDATOR_REPORT_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_REPORT_TIMEOUT_MS', 10000);
|
|
100
|
+
const VALIDATOR_STAKE_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_STAKE_TIMEOUT_MS', 10000);
|
|
101
|
+
const VALIDATOR_CMD_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_CMD_TIMEOUT_MS', 60000);
|
|
102
|
+
const VALIDATOR_BATCH_TIMEOUT_MS = envInt('EVOLVER_VALIDATOR_BATCH_TIMEOUT_MS', 180000);
|
|
103
|
+
|
|
87
104
|
module.exports = {
|
|
88
105
|
// Network
|
|
89
106
|
HELLO_TIMEOUT_MS,
|
|
@@ -136,6 +153,15 @@ module.exports = {
|
|
|
136
153
|
SELF_PR_TIMEOUT_MS,
|
|
137
154
|
// Security
|
|
138
155
|
LEAK_CHECK_MODE,
|
|
156
|
+
// Validator (opt-in role)
|
|
157
|
+
VALIDATOR_ENABLED,
|
|
158
|
+
VALIDATOR_STAKE_AMOUNT,
|
|
159
|
+
VALIDATOR_MAX_TASKS_PER_CYCLE,
|
|
160
|
+
VALIDATOR_FETCH_TIMEOUT_MS,
|
|
161
|
+
VALIDATOR_REPORT_TIMEOUT_MS,
|
|
162
|
+
VALIDATOR_STAKE_TIMEOUT_MS,
|
|
163
|
+
VALIDATOR_CMD_TIMEOUT_MS,
|
|
164
|
+
VALIDATOR_BATCH_TIMEOUT_MS,
|
|
139
165
|
// Helpers
|
|
140
166
|
envInt,
|
|
141
167
|
envFloat,
|