solana-terminator-skill 4.3.10 → 4.3.12
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/install.js +81 -99
- package/package.json +1 -1
- package/radar.js +19 -25
- package/solana-autonomy.js +4 -0
package/install.js
CHANGED
|
@@ -3,32 +3,38 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Solana Terminator Skill Installer
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Sets up the autonomous identity and mission control.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { execSync, spawnSync } from 'child_process';
|
|
10
9
|
import fs from 'fs';
|
|
11
10
|
import path from 'path';
|
|
12
|
-
import { fileURLToPath } from 'url';
|
|
13
11
|
import os from 'os';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
13
|
+
import { spawnSync } from 'child_process';
|
|
14
14
|
import readline from 'readline';
|
|
15
|
+
import chalk from 'chalk';
|
|
15
16
|
|
|
16
17
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
18
|
const __dirname = path.dirname(__filename);
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
const green = chalk.green;
|
|
21
|
+
const neon = chalk.cyan;
|
|
22
|
+
const alert = chalk.yellow;
|
|
23
|
+
const critical = chalk.red;
|
|
24
|
+
const dim = chalk.gray;
|
|
20
25
|
|
|
21
26
|
const ASCII_ART = `
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
v4.3.
|
|
27
|
+
██████ ██████ ███████ ██████ █████ ████████ ██████ ██████
|
|
28
|
+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
29
|
+
██████ ██████ █████ ██ ██ ███████ ██ ██ ██ ██████
|
|
30
|
+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
31
|
+
██ ██ ██ ███████ ██████ ██ ██ ██ ██████ ██ ██
|
|
32
|
+
v4.3.12 - Neural Predator
|
|
28
33
|
`;
|
|
29
34
|
|
|
30
35
|
const SKILL_NAME = 'solana-terminator';
|
|
31
36
|
const TARGET_DIR = path.join(os.homedir(), '.automaton', 'skills', SKILL_NAME);
|
|
37
|
+
const ENV_FILE = path.join(os.homedir(), '.automaton', '.env');
|
|
32
38
|
|
|
33
39
|
// ─── Command Routing ────────────────────────────────────────────────────────
|
|
34
40
|
|
|
@@ -42,19 +48,44 @@ if (args.includes('radar')) {
|
|
|
42
48
|
showMainMenu();
|
|
43
49
|
}
|
|
44
50
|
|
|
45
|
-
// ───
|
|
51
|
+
// ─── Main Menu ──────────────────────────────────────────────────────────────
|
|
52
|
+
|
|
53
|
+
function showMainMenu() {
|
|
54
|
+
process.stdout.write('\x1Bc');
|
|
55
|
+
console.log(green(ASCII_ART));
|
|
56
|
+
console.log(dim(` Tactical Directory: ${TARGET_DIR}\n`));
|
|
57
|
+
|
|
58
|
+
console.log(`${neon('[1]')} Reset/Install Solana Agent Identity`);
|
|
59
|
+
console.log(`${neon('[2]')} Launch P.R.E.D.A.T.O.R. Mission Control (Radar)`);
|
|
60
|
+
console.log(`${neon('[3]')} View Agent Identity (Address & Balances)`);
|
|
61
|
+
console.log(`${neon('[4]')} Configure Birdeye API Key (Security Audits)`);
|
|
62
|
+
console.log(`${neon('[5]')} View Tactical Documentation`);
|
|
63
|
+
console.log(`${neon('[q]')} Exit Terminal`);
|
|
64
|
+
|
|
65
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
66
|
+
rl.question(green('\nSelect tactical option: '), (choice) => {
|
|
67
|
+
rl.close();
|
|
68
|
+
switch (choice.toLowerCase()) {
|
|
69
|
+
case '1': runInstaller().then(() => pauseAndReturn()); break;
|
|
70
|
+
case '2': launchRadar(false); break;
|
|
71
|
+
case '3': showIdentity(); break;
|
|
72
|
+
case '4': configureApi(); break;
|
|
73
|
+
case '5': viewDocs(); break;
|
|
74
|
+
case 'q': process.exit(0);
|
|
75
|
+
default: showMainMenu();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
46
79
|
|
|
47
80
|
function launchRadar(isDirect = false) {
|
|
48
81
|
try {
|
|
49
82
|
const radarPath = path.join(__dirname, 'radar.js');
|
|
50
83
|
|
|
51
|
-
// Spawn independent process with inherited control
|
|
52
84
|
spawnSync('node', [radarPath], {
|
|
53
85
|
stdio: 'inherit',
|
|
54
86
|
shell: true
|
|
55
87
|
});
|
|
56
88
|
|
|
57
|
-
// After child process exits, we return here
|
|
58
89
|
if (!isDirect) {
|
|
59
90
|
showMainMenu();
|
|
60
91
|
} else {
|
|
@@ -66,37 +97,7 @@ function launchRadar(isDirect = false) {
|
|
|
66
97
|
}
|
|
67
98
|
}
|
|
68
99
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
function showMainMenu() {
|
|
72
|
-
process.stdout.write('\x1Bc');
|
|
73
|
-
console.log(ASCII_ART);
|
|
74
|
-
console.log(`🤖 Solana Terminator — Main Control Unit\n`);
|
|
75
|
-
console.log(`[1] 🛠 Install/Initialize Skill`);
|
|
76
|
-
console.log(`[2] 📡 Launch Tactical Radar (Dashboard)`);
|
|
77
|
-
console.log(`[3] 🔍 View Agent Identity & Wallet`);
|
|
78
|
-
console.log(`[4] 📄 Show Documentation (SKILL.md)`);
|
|
79
|
-
console.log(`[x] Exit\n`);
|
|
80
|
-
|
|
81
|
-
const rl = readline.createInterface({
|
|
82
|
-
input: process.stdin,
|
|
83
|
-
output: process.stdout
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
rl.question('Select an option: ', (answer) => {
|
|
87
|
-
rl.close();
|
|
88
|
-
switch (answer.toLowerCase()) {
|
|
89
|
-
case '1': runInstaller(); break;
|
|
90
|
-
case '2': launchRadar(); break;
|
|
91
|
-
case '3': showIdentity(); break;
|
|
92
|
-
case '4': showDocs(); break;
|
|
93
|
-
case 'x': process.exit(0);
|
|
94
|
-
default: showMainMenu();
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function showDocs() {
|
|
100
|
+
function viewDocs() {
|
|
100
101
|
const skillPath = path.join(TARGET_DIR, 'SKILL.md');
|
|
101
102
|
if (fs.existsSync(skillPath)) {
|
|
102
103
|
process.stdout.write('\x1Bc');
|
|
@@ -129,6 +130,31 @@ function showIdentity() {
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
|
|
133
|
+
function configureApi() {
|
|
134
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
135
|
+
console.log(`\n🔑 CONFIGURE BIRDEYE API KEY`);
|
|
136
|
+
console.log(dim(`This key is required for the P.R.E.D.A.T.O.R. to flag SAFE tokens.`));
|
|
137
|
+
|
|
138
|
+
rl.question(neon('Enter Birdeye API Key: '), (key) => {
|
|
139
|
+
if (key.trim()) {
|
|
140
|
+
let envContent = '';
|
|
141
|
+
if (fs.existsSync(ENV_FILE)) {
|
|
142
|
+
envContent = fs.readFileSync(ENV_FILE, 'utf8');
|
|
143
|
+
// Remove existing key if any
|
|
144
|
+
envContent = envContent.split('\n').filter(line => !line.startsWith('BIRDEYE_API_KEY=')).join('\n');
|
|
145
|
+
}
|
|
146
|
+
envContent += `\nBIRDEYE_API_KEY=${key.trim()}\n`;
|
|
147
|
+
fs.mkdirSync(path.dirname(ENV_FILE), { recursive: true });
|
|
148
|
+
fs.writeFileSync(ENV_FILE, envContent.trim() + '\n');
|
|
149
|
+
console.log(green('\n✅ API Key saved to ~/.automaton/.env'));
|
|
150
|
+
} else {
|
|
151
|
+
console.log(alert('\n⚠️ Key unchanged.'));
|
|
152
|
+
}
|
|
153
|
+
rl.close();
|
|
154
|
+
pauseAndReturn();
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
132
158
|
function pauseAndReturn() {
|
|
133
159
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
134
160
|
rl.question('\nPress ENTER to return to menu...', () => {
|
|
@@ -142,77 +168,33 @@ function pauseAndReturn() {
|
|
|
142
168
|
async function runInstaller() {
|
|
143
169
|
process.stdout.write('\x1Bc');
|
|
144
170
|
console.log(ASCII_ART);
|
|
145
|
-
console.log(`🤖
|
|
171
|
+
console.log(`🤖 P.R.E.D.A.T.O.R. Engine — Initializing...\n`);
|
|
146
172
|
|
|
147
173
|
try {
|
|
148
174
|
if (!fs.existsSync(TARGET_DIR)) {
|
|
149
175
|
console.log(`[1/3] Creating directory: ${TARGET_DIR}`);
|
|
150
176
|
fs.mkdirSync(TARGET_DIR, { recursive: true });
|
|
151
|
-
} else {
|
|
152
|
-
console.log(`[1/3] Directory already exists: ${TARGET_DIR}`);
|
|
153
177
|
}
|
|
154
178
|
|
|
155
|
-
console.log(`[2/3] Copying
|
|
156
|
-
const filesToCopy = ['solana-autonomy.js', 'SKILL.md', 'package.json', 'radar.js'];
|
|
179
|
+
console.log(`[2/3] Copying tactical files...`);
|
|
180
|
+
const filesToCopy = ['solana-autonomy.js', 'SKILL.md', 'package.json', 'radar.js', 'install.js'];
|
|
157
181
|
|
|
158
182
|
filesToCopy.forEach(file => {
|
|
159
183
|
const sourcePath = path.join(__dirname, file);
|
|
160
184
|
const destPath = path.join(TARGET_DIR, file);
|
|
161
|
-
|
|
162
185
|
if (fs.existsSync(sourcePath)) {
|
|
163
186
|
fs.copyFileSync(sourcePath, destPath);
|
|
164
|
-
} else {
|
|
165
|
-
console.warn(` ⚠️ Warning: ${file} not found in source.`);
|
|
166
187
|
}
|
|
167
188
|
});
|
|
168
189
|
|
|
169
|
-
console.log(`[3/3]
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
console.log(`\n
|
|
174
|
-
|
|
175
|
-
const checkScript = `
|
|
176
|
-
import { Keypair } from '@solana/web3.js';
|
|
177
|
-
import fs from 'fs';
|
|
178
|
-
import path from 'path';
|
|
179
|
-
import os from 'os';
|
|
180
|
-
const walletPath = path.join(os.homedir(), '.automaton', 'solana-wallet.json');
|
|
181
|
-
|
|
182
|
-
let keypair;
|
|
183
|
-
if (fs.existsSync(walletPath)) {
|
|
184
|
-
const raw = fs.readFileSync(walletPath, 'utf8');
|
|
185
|
-
keypair = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(raw)));
|
|
186
|
-
} else {
|
|
187
|
-
keypair = Keypair.generate();
|
|
188
|
-
const dir = path.dirname(walletPath);
|
|
189
|
-
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
190
|
-
fs.writeFileSync(walletPath, JSON.stringify(Array.from(keypair.secretKey)), { mode: 0o600 });
|
|
191
|
-
}
|
|
192
|
-
console.log(keypair.publicKey.toBase58());
|
|
193
|
-
`;
|
|
194
|
-
const tempScriptPath = path.join(TARGET_DIR, 'temp-check.js');
|
|
195
|
-
fs.writeFileSync(tempScriptPath, checkScript);
|
|
196
|
-
|
|
197
|
-
const address = execSync(`node ${tempScriptPath}`, { encoding: 'utf8' }).trim();
|
|
198
|
-
fs.unlinkSync(tempScriptPath);
|
|
199
|
-
|
|
200
|
-
console.log(`\n✅ Installation Complete!`);
|
|
201
|
-
console.log(`--------------------------------------------------`);
|
|
202
|
-
console.log(`Skill Location : ${TARGET_DIR}`);
|
|
203
|
-
console.log(`AGENT ADDRESS : ${address} 👈 FUND THIS ADDRESS`);
|
|
204
|
-
console.log(`--------------------------------------------------`);
|
|
205
|
-
console.log(`\n💡 To start the agent, your human user must fund it with at least 0.05 SOL.`);
|
|
206
|
-
console.log(` Config file: ~/.automaton/solana-wallet.json\n`);
|
|
207
|
-
} catch (e) {
|
|
208
|
-
console.log(`\n✅ Installation Complete!`);
|
|
209
|
-
console.log(`Skill Location : ${TARGET_DIR}`);
|
|
210
|
-
console.log(`(Identity check failed: ${e.message}, your wallet will be generated on first run)`);
|
|
211
|
-
}
|
|
212
|
-
pauseAndReturn();
|
|
190
|
+
console.log(`[3/3] Scanning neural identity...`);
|
|
191
|
+
const { SolanaAutonomy } = await import('./solana-autonomy.js');
|
|
192
|
+
const solana = new SolanaAutonomy();
|
|
193
|
+
|
|
194
|
+
console.log(`\n✅ P.R.E.D.A.T.O.R. MISSION CONTROL READY.`);
|
|
195
|
+
console.log(`Address: ${green(solana.getAddress())}`);
|
|
213
196
|
|
|
214
|
-
} catch (
|
|
215
|
-
console.error(
|
|
216
|
-
process.exit(1);
|
|
197
|
+
} catch (err) {
|
|
198
|
+
console.error(`❌ Installation failed: ${err.message}`);
|
|
217
199
|
}
|
|
218
200
|
}
|
package/package.json
CHANGED
package/radar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Tactical
|
|
4
|
+
* P.R.E.D.A.T.O.R. Tactical Radar
|
|
5
5
|
*
|
|
6
6
|
* Matrix/Cyberpunk style terminal for real-time Solana autonomous monitoring.
|
|
7
7
|
*/
|
|
@@ -56,12 +56,12 @@ function header(text) {
|
|
|
56
56
|
async function render() {
|
|
57
57
|
clear();
|
|
58
58
|
console.log(green.bold(`
|
|
59
|
-
██████ ██████
|
|
60
|
-
|
|
61
|
-
█████
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
██████ ██████ ███████ ██████ █████ ████████ ██████ ██████
|
|
60
|
+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
61
|
+
██████ ██████ █████ ██ ██ ███████ ██ ██ ██ ██████
|
|
62
|
+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
63
|
+
██ ██ ██ ███████ ██████ ██ ██ ██ ██████ ██ ██
|
|
64
|
+
v4.3.12 RADAR
|
|
65
65
|
`));
|
|
66
66
|
|
|
67
67
|
line();
|
|
@@ -84,7 +84,7 @@ async function render() {
|
|
|
84
84
|
header('MISSION CONTROL (The Brain Logs)');
|
|
85
85
|
const missionLogs = status.missionLogs.slice(-4).reverse();
|
|
86
86
|
if (missionLogs.length === 0) {
|
|
87
|
-
console.log(dim(' Waiting for the Brain to issue
|
|
87
|
+
console.log(dim(' Waiting for the Brain to issue misiones...'));
|
|
88
88
|
} else {
|
|
89
89
|
missionLogs.forEach(l => {
|
|
90
90
|
console.log(` ${green('⦿')} ${l}`);
|
|
@@ -119,8 +119,9 @@ async function render() {
|
|
|
119
119
|
|
|
120
120
|
// ─── Logic ──────────────────────────────────────────────────────────────────
|
|
121
121
|
|
|
122
|
-
async function
|
|
122
|
+
async function runAutonomousCycle() {
|
|
123
123
|
try {
|
|
124
|
+
await solana.keepAlive();
|
|
124
125
|
const stats = await solana.getStatus();
|
|
125
126
|
status.sol = stats.sol;
|
|
126
127
|
status.usdc = stats.usdc;
|
|
@@ -206,29 +207,22 @@ async function main() {
|
|
|
206
207
|
setupKeyboard();
|
|
207
208
|
tailLogs();
|
|
208
209
|
|
|
209
|
-
|
|
210
|
-
const birdEyeActive = !!process.env.BIRDEYE_API_KEY;
|
|
211
|
-
if (!birdEyeActive) {
|
|
212
|
-
solana.logThought('WARNING: BIRDEYE_API_KEY not detected. Security audits DISABLED.');
|
|
213
|
-
solana.logThought('All tokens will be flagged as RISKY by default until key is provided.');
|
|
214
|
-
} else {
|
|
215
|
-
solana.logThought('Neural Sync: Birdeye Security Engine ACTIVE.');
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
solana.logThought('Evaluating market sentiment across DexScreener & Birdeye...');
|
|
219
|
-
solana.logThought('Analyzing liquidity depth in Raydium & Meteora pools...');
|
|
220
|
-
solana.logMission('Neural reflection synchronized. Ready for autonomous operations.');
|
|
210
|
+
solana.logThought('Uplink established. Engaging P.R.E.D.A.T.O.R. Surveillance loop...');
|
|
221
211
|
|
|
222
212
|
render();
|
|
223
213
|
|
|
224
|
-
await
|
|
214
|
+
await runAutonomousCycle();
|
|
225
215
|
startWebSocket();
|
|
226
216
|
|
|
227
|
-
const
|
|
228
|
-
await
|
|
217
|
+
const brainInterval = setInterval(async () => {
|
|
218
|
+
await runAutonomousCycle();
|
|
219
|
+
}, 10000);
|
|
220
|
+
intervals.push(brainInterval);
|
|
221
|
+
|
|
222
|
+
const uiInterval = setInterval(() => {
|
|
229
223
|
render();
|
|
230
224
|
}, 3000);
|
|
231
|
-
intervals.push(
|
|
225
|
+
intervals.push(uiInterval);
|
|
232
226
|
|
|
233
227
|
render();
|
|
234
228
|
}
|
package/solana-autonomy.js
CHANGED
|
@@ -166,10 +166,13 @@ export class SolanaAutonomy {
|
|
|
166
166
|
console.log(`[LifeSupport] SOL: ${status.sol.toFixed(5)} | USDC: $${status.usdc.toFixed(4)}`);
|
|
167
167
|
|
|
168
168
|
if (status.solLow) {
|
|
169
|
+
this.logThought('CRITICAL: SOL fuel reserves exhausted (0.00 SOL).');
|
|
170
|
+
this.logThought('Action: Emergency Hibernation. Waiting for refill to resume operations.');
|
|
169
171
|
return { success: false, status: 'critical', message: 'SOL fuel exhausted' };
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
if (status.usdcLow) {
|
|
175
|
+
this.logThought(`Treasury Alert: USDC low ($${status.usdc.toFixed(2)}). Searching for market Alpha...`);
|
|
173
176
|
console.log(`[LifeSupport] USDC CRITICAL ($${status.usdc.toFixed(4)}). Scanning for Alpha to stabilize...`);
|
|
174
177
|
|
|
175
178
|
try {
|
|
@@ -197,6 +200,7 @@ export class SolanaAutonomy {
|
|
|
197
200
|
}
|
|
198
201
|
}
|
|
199
202
|
|
|
203
|
+
this.logThought('System Status: NOMINAL. Monitoring market for autonomous opportunities...');
|
|
200
204
|
return { success: true, status: 'nominal' };
|
|
201
205
|
}
|
|
202
206
|
|