@evomap/evolver 1.29.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.
- package/LICENSE +22 -0
- package/README.md +290 -0
- package/README.zh-CN.md +236 -0
- package/SKILL.md +132 -0
- package/assets/gep/capsules.json +79 -0
- package/assets/gep/events.jsonl +7 -0
- package/assets/gep/genes.json +108 -0
- package/index.js +479 -0
- package/package.json +38 -0
- package/src/canary.js +13 -0
- package/src/evolve.js +1704 -0
- package/src/gep/a2a.js +173 -0
- package/src/gep/a2aProtocol.js +736 -0
- package/src/gep/analyzer.js +35 -0
- package/src/gep/assetCallLog.js +130 -0
- package/src/gep/assetStore.js +297 -0
- package/src/gep/assets.js +36 -0
- package/src/gep/bridge.js +71 -0
- package/src/gep/candidates.js +142 -0
- package/src/gep/contentHash.js +65 -0
- package/src/gep/deviceId.js +209 -0
- package/src/gep/envFingerprint.js +68 -0
- package/src/gep/hubReview.js +206 -0
- package/src/gep/hubSearch.js +237 -0
- package/src/gep/issueReporter.js +262 -0
- package/src/gep/llmReview.js +92 -0
- package/src/gep/memoryGraph.js +771 -0
- package/src/gep/memoryGraphAdapter.js +203 -0
- package/src/gep/mutation.js +186 -0
- package/src/gep/narrativeMemory.js +108 -0
- package/src/gep/paths.js +113 -0
- package/src/gep/personality.js +355 -0
- package/src/gep/prompt.js +566 -0
- package/src/gep/questionGenerator.js +212 -0
- package/src/gep/reflection.js +127 -0
- package/src/gep/sanitize.js +67 -0
- package/src/gep/selector.js +250 -0
- package/src/gep/signals.js +417 -0
- package/src/gep/skillDistiller.js +499 -0
- package/src/gep/solidify.js +1681 -0
- package/src/gep/strategy.js +126 -0
- package/src/gep/taskReceiver.js +528 -0
- package/src/gep/validationReport.js +55 -0
- package/src/ops/cleanup.js +80 -0
- package/src/ops/commentary.js +60 -0
- package/src/ops/health_check.js +106 -0
- package/src/ops/index.js +11 -0
- package/src/ops/innovation.js +67 -0
- package/src/ops/lifecycle.js +168 -0
- package/src/ops/self_repair.js +72 -0
- package/src/ops/skills_monitor.js +143 -0
- package/src/ops/trigger.js +33 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// Skills Monitor (v2.0) - Evolver Core Module
|
|
2
|
+
// Checks installed skills for real issues, auto-heals simple problems.
|
|
3
|
+
// Zero Feishu dependency.
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
|
+
const { getSkillsDir, getWorkspaceRoot } = require('../gep/paths');
|
|
9
|
+
|
|
10
|
+
const IGNORE_LIST = new Set([
|
|
11
|
+
'common',
|
|
12
|
+
'clawhub',
|
|
13
|
+
'input-validator',
|
|
14
|
+
'proactive-agent',
|
|
15
|
+
'security-audit',
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
// Load user-defined ignore list
|
|
19
|
+
try {
|
|
20
|
+
var ignoreFile = path.join(getWorkspaceRoot(), '.skill_monitor_ignore');
|
|
21
|
+
if (fs.existsSync(ignoreFile)) {
|
|
22
|
+
fs.readFileSync(ignoreFile, 'utf8').split('\n').forEach(function(l) {
|
|
23
|
+
var t = l.trim();
|
|
24
|
+
if (t && !t.startsWith('#')) IGNORE_LIST.add(t);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
} catch (e) { /* ignore */ }
|
|
28
|
+
|
|
29
|
+
function checkSkill(skillName) {
|
|
30
|
+
var SKILLS_DIR = getSkillsDir();
|
|
31
|
+
if (IGNORE_LIST.has(skillName)) return null;
|
|
32
|
+
var skillPath = path.join(SKILLS_DIR, skillName);
|
|
33
|
+
var issues = [];
|
|
34
|
+
|
|
35
|
+
try { if (!fs.statSync(skillPath).isDirectory()) return null; } catch (e) { return null; }
|
|
36
|
+
|
|
37
|
+
var mainFile = 'index.js';
|
|
38
|
+
var pkgPath = path.join(skillPath, 'package.json');
|
|
39
|
+
var hasPkg = false;
|
|
40
|
+
|
|
41
|
+
if (fs.existsSync(pkgPath)) {
|
|
42
|
+
hasPkg = true;
|
|
43
|
+
try {
|
|
44
|
+
var pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
45
|
+
if (pkg.main) mainFile = pkg.main;
|
|
46
|
+
if (pkg.dependencies && Object.keys(pkg.dependencies).length > 0) {
|
|
47
|
+
if (!fs.existsSync(path.join(skillPath, 'node_modules'))) {
|
|
48
|
+
issues.push('Missing node_modules (needs npm install)');
|
|
49
|
+
} else {
|
|
50
|
+
// Optimization: Check for node_modules existence instead of spawning node
|
|
51
|
+
// Spawning node for every skill is too slow (perf_bottleneck).
|
|
52
|
+
// We assume if node_modules exists, it's likely okay.
|
|
53
|
+
// Only spawn check if we really suspect issues (e.g. empty node_modules).
|
|
54
|
+
try {
|
|
55
|
+
if (fs.readdirSync(path.join(skillPath, 'node_modules')).length === 0) {
|
|
56
|
+
issues.push('Empty node_modules (needs npm install)');
|
|
57
|
+
}
|
|
58
|
+
} catch (e) {
|
|
59
|
+
issues.push('Invalid node_modules');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} catch (e) {
|
|
64
|
+
issues.push('Invalid package.json');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (mainFile.endsWith('.js')) {
|
|
69
|
+
var entryPoint = path.join(skillPath, mainFile);
|
|
70
|
+
if (fs.existsSync(entryPoint)) {
|
|
71
|
+
// Optimization: Syntax check via node -c is slow.
|
|
72
|
+
// We can trust the runtime to catch syntax errors when loading.
|
|
73
|
+
// Or we can use a lighter check if absolutely necessary.
|
|
74
|
+
// For now, removing the synchronous spawn to fix perf_bottleneck.
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (hasPkg && !fs.existsSync(path.join(skillPath, 'SKILL.md'))) {
|
|
79
|
+
issues.push('Missing SKILL.md');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return issues.length > 0 ? { name: skillName, issues: issues } : null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function autoHeal(skillName, issues) {
|
|
86
|
+
var SKILLS_DIR = getSkillsDir();
|
|
87
|
+
var skillPath = path.join(SKILLS_DIR, skillName);
|
|
88
|
+
var healed = [];
|
|
89
|
+
|
|
90
|
+
for (var i = 0; i < issues.length; i++) {
|
|
91
|
+
if (issues[i] === 'Missing node_modules (needs npm install)' || issues[i] === 'Empty node_modules (needs npm install)') {
|
|
92
|
+
try {
|
|
93
|
+
// Remove package-lock.json if it exists to prevent conflict errors
|
|
94
|
+
try { fs.unlinkSync(path.join(skillPath, 'package-lock.json')); } catch (e) {}
|
|
95
|
+
|
|
96
|
+
execSync('npm install --production --no-audit --no-fund', {
|
|
97
|
+
cwd: skillPath, stdio: 'ignore', timeout: 60000 // Increased timeout
|
|
98
|
+
});
|
|
99
|
+
healed.push(issues[i]);
|
|
100
|
+
console.log('[SkillsMonitor] Auto-healed ' + skillName + ': npm install');
|
|
101
|
+
} catch (e) {
|
|
102
|
+
console.error('[SkillsMonitor] Failed to heal ' + skillName + ': ' + e.message);
|
|
103
|
+
}
|
|
104
|
+
} else if (issues[i] === 'Missing SKILL.md') {
|
|
105
|
+
try {
|
|
106
|
+
var name = skillName.replace(/-/g, ' ');
|
|
107
|
+
fs.writeFileSync(path.join(skillPath, 'SKILL.md'), '# ' + skillName + '\n\n' + name + ' skill.\n');
|
|
108
|
+
healed.push(issues[i]);
|
|
109
|
+
console.log('[SkillsMonitor] Auto-healed ' + skillName + ': created SKILL.md stub');
|
|
110
|
+
} catch (e) {}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return healed;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function run(options) {
|
|
117
|
+
var heal = (options && options.autoHeal) !== false;
|
|
118
|
+
var SKILLS_DIR = getSkillsDir();
|
|
119
|
+
var skills = fs.readdirSync(SKILLS_DIR);
|
|
120
|
+
var report = [];
|
|
121
|
+
|
|
122
|
+
for (var i = 0; i < skills.length; i++) {
|
|
123
|
+
if (skills[i].startsWith('.')) continue;
|
|
124
|
+
var result = checkSkill(skills[i]);
|
|
125
|
+
if (result) {
|
|
126
|
+
if (heal) {
|
|
127
|
+
var healed = autoHeal(result.name, result.issues);
|
|
128
|
+
result.issues = result.issues.filter(function(issue) { return !healed.includes(issue); });
|
|
129
|
+
if (result.issues.length === 0) continue;
|
|
130
|
+
}
|
|
131
|
+
report.push(result);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return report;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (require.main === module) {
|
|
138
|
+
var issues = run();
|
|
139
|
+
console.log(JSON.stringify(issues, null, 2));
|
|
140
|
+
process.exit(issues.length > 0 ? 1 : 0);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
module.exports = { run, checkSkill, autoHeal };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Evolver Wake Trigger - Evolver Core Module
|
|
2
|
+
// Writes a signal file that the wrapper can poll to wake up immediately.
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { getWorkspaceRoot } = require('../gep/paths');
|
|
7
|
+
|
|
8
|
+
var WAKE_FILE = path.join(getWorkspaceRoot(), 'memory', 'evolver_wake.signal');
|
|
9
|
+
|
|
10
|
+
function send() {
|
|
11
|
+
try {
|
|
12
|
+
fs.writeFileSync(WAKE_FILE, 'WAKE');
|
|
13
|
+
console.log('[Trigger] Wake signal sent to ' + WAKE_FILE);
|
|
14
|
+
return true;
|
|
15
|
+
} catch (e) {
|
|
16
|
+
console.error('[Trigger] Failed: ' + e.message);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function clear() {
|
|
22
|
+
try { if (fs.existsSync(WAKE_FILE)) fs.unlinkSync(WAKE_FILE); } catch (e) {}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function isPending() {
|
|
26
|
+
return fs.existsSync(WAKE_FILE);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (require.main === module) {
|
|
30
|
+
send();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = { send, clear, isPending };
|