-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-agents.mjs
More file actions
executable file
·52 lines (38 loc) · 1.46 KB
/
generate-agents.mjs
File metadata and controls
executable file
·52 lines (38 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env node
// generate-agents.mjs
// Fully Node.js-based NEXUS dummy agent generator
import fs from "fs";
import path from "path";
const HOME_DIR = process.env.HOME || "/home/loop";
const RUNLEVEL_DIR = path.join(HOME_DIR, ".repository/wsl-systemd");
const LOGS_DIR = path.join(RUNLEVEL_DIR, "logs");
// List of agent names
const AGENTS = ["COIN", "WAVE", "LOOP", "SIGN", "CORE", "WORK", "CUBE", "CODE", "LINE"];
// Ensure directories exist
fs.mkdirSync(RUNLEVEL_DIR, { recursive: true });
fs.mkdirSync(LOGS_DIR, { recursive: true });
AGENTS.forEach(agent => {
const filename = path.join(RUNLEVEL_DIR, `nexus-${agent.toLowerCase()}.mjs`);
const content = `#!/usr/bin/env node
import fs from "fs";
import path from "path";
const AGENT_NAME = "${agent}";
const HOME_DIR = process.env.HOME || "/home/loop";
const LOGS_DIR = path.join(HOME_DIR, ".repository/wsl-systemd", "logs");
const LOG_FILE = path.join(LOGS_DIR, \`\${AGENT_NAME}.log\`);
fs.mkdirSync(LOGS_DIR, { recursive: true });
function log(message) {
const timestamp = new Date().toISOString();
const line = \`[\${timestamp}] [\${AGENT_NAME}] \${message}\\n\`;
fs.appendFileSync(LOG_FILE, line);
process.stdout.write(line);
}
log("Starting agent...");
setInterval(() => {
log("Alive and running.");
}, 3000);
`;
fs.writeFileSync(filename, content, { mode: 0o755 });
console.log(`[generate-agents] Created ${filename}`);
});
console.log("[generate-agents] All NEXUS agents generated successfully.");