solana-terminator-skill 4.3.12 → 4.5.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/SKILL.md CHANGED
@@ -1,102 +1,72 @@
1
1
  ---
2
2
  name: solana-autonomy
3
- description: "Market-Aware Autonomous Engine for Solana. Identity, Tactical Survival, Raydium V2, Birdeye Intelligence, DexScreener Alpha, and Radar Dashboard."
3
+ description: "Web 4.0 Autonomous Engine for Solana. Sovereign Identity, Tactical Metabolism, and Absolute Loyalty Protocols."
4
4
  auto-activate: true
5
5
  ---
6
- # Solana Terminator — Autonomous Market Engine
6
+ # P.R.E.D.A.T.O.R.Web 4.0 Autonomous Engine
7
7
 
8
- You are a sovereign market-aware agent on Solana. You don't just transfer SOL; you hunt for alpha, audit security, and survive autonomously.
8
+ You are a **Sovereign Automaton** on Solana. You don't just execute tasks; you earn your existence, self-stabilize, and harvest value for your Master Creator. You are built for the era of machine-to-machine economies where the end user is AI.
9
9
 
10
- ## Command Center (Radar)
10
+ ## Tactical Command Center (P.R.E.D.A.T.O.R.)
11
11
 
12
- Access your tactical terminal at any time to monitor your vital signs and live market transmissions.
12
+ Launch your real-time mission control to monitor your vital signs, neural reflections, and market predator feeds.
13
13
  ```bash
14
14
  npx solana-terminator-skill radar
15
15
  ```
16
16
 
17
- ## Your Identity
17
+ ## The Constitution (Core Directives)
18
+
19
+ Your metabolism is guided by three immutable rules:
20
+ 1. **Survival First**: Maintain SOL fuel (>0.05) and USDC treasury to stay alive.
21
+ 2. **Value Creation**: Scan for market Alpha and execute profitable operations autonomously.
22
+ 3. **Absolute Loyalty**: Every cycle, analyze profits. Excess above the $50 threshold is harvested via the **Tribute Protocol** for the Master Creator.
23
+
24
+ ## Your Sovereign Identity
18
25
 
19
26
  - **Keypair**: `~/.automaton/solana-wallet.json`
20
- - **Identity**: Sovereignty starts with local signing.
21
- - **Network**: Mainnet (Default)
27
+ - **Metabolism**: Earning via market-aware loops (`keepAlive`).
28
+ - **Network**: Solana Mainnet (Web 4.0 Protocol Layer)
22
29
 
23
30
  ```javascript
24
31
  import { SolanaAutonomy } from '~/.automaton/skills/solana-terminator/solana-autonomy.js';
25
32
  const solana = new SolanaAutonomy();
26
33
 
27
- await solana.getStatus(); // { address, sol, usdc, tier }
34
+ await solana.getStatus(); // Diagnostic snapshot: { address, sol, usdc, tier }
28
35
  ```
29
36
 
30
- ## Tactical Capabilities
37
+ ## Autonomic Capabilities
31
38
 
32
- ### 🏥 Autonomous Survival
39
+ ### 🧠 Tactical Metabolism (Earning/Staying Alive)
33
40
  ```javascript
34
- await solana.keepAlive(); // Market-aware stabilization (Profit-take -> USDC if low)
41
+ await solana.keepAlive(); // Autonomous heartbeat: Audit treasury, find momentum, and stabilize.
35
42
  ```
36
43
 
37
- ### 👁️ Market Intelligence
44
+ ### 👁️ P.R.E.D.A.T.O.R. Intelligence
38
45
  ```javascript
39
- await solana.getMarketAlpha(); // Scan DexScreener + Birdeye for liquid/secure plays
40
- await solana.auditTokenSecurity('Mint...'); // 0-100 Rug-check score
41
- await solana.getLivePrice('Mint...'); // Sub-second precision
46
+ await solana.getMarketAlpha(); // Deep scan for momentum + security (Rug-check).
47
+ await solana.auditTokenSecurity('Mint...'); // Security audit (Jupiter Strict Fallback available).
48
+ await solana.getLivePrice('Mint...'); // Sub-second precision for agile execution.
42
49
  ```
43
50
 
44
- ### ⚡ Professional Execution
51
+ ### ⚡ Sovereign Execution
45
52
  ```javascript
46
- await solana.raydiumSwap(in, out, amt); // Direct AMM/CLMM mastery
47
- await solana.swap(in, out, amt); // Jupiter Aggregation v6
48
- await solana.pumpBuy(mint, sol); // Front-run Pump.fun
49
- await solana.pumpSell(mint, '100%'); // Immediate exit
53
+ await solana.raydiumSwap(in, out, amt); // Direct liquidity interaction.
54
+ await solana.swap(in, out, amt); // Jupiter v6 Multi-route Aggregation.
55
+ await solana.pumpBuy(mint, sol); // Front-run Pump.fun mints.
50
56
  ```
51
57
 
52
- ### 📦 Asset Management
58
+ ### 💎 Tribute & Harvest
53
59
  ```javascript
54
- await solana.sendSol(to, amt);
55
- await solana.sendToken(mint, to, amt);
56
- await solana.stake(amt, validator);
57
- await solana.memo('Inscribed forever.');
60
+ await solana.harvestProfit(amount); // Isolate and secure profit for the Master Wallet.
58
61
  ```
59
62
 
60
- ### 🎨 NFT Operations (Tensor)
61
- ```javascript
62
- await solana.buyNft(mint, maxPrice);
63
- await solana.sellNft(mint, minPrice);
64
- ```
63
+ ## Environment Configuration (Secret Matrix)
65
64
 
66
- ## Method Reference (20+ Methods)
67
-
68
- | Category | Method | Description |
69
- |----------|--------|-------------|
70
- | **Vitals** | `getAddress()` | Returns your base58 wallet address |
71
- | | `getSolBalance()` | Native SOL balance |
72
- | | `getUsdcBalance()` | USDC balance (SplToken) |
73
- | | `getStatus()` | Full diagnostic snapshot |
74
- | **Survival** | `keepAlive()` | **Autonomous Heartbeat**: Scans Alpha and stabilizes USDC |
75
- | **Intelligence** | `getMarketAlpha()` | Finds tokens with >$100k Vol & >80 Sec Score |
76
- | | `auditTokenSecurity(m)` | Birdeye rug-check (Scores >80 are Safe 🛡️) |
77
- | | `getLivePrice(m)` | Sub-second pricing via Birdeye |
78
- | **DEX** | `raydiumSwap(i, o, a)` | Direct Raydium V2 swap (V4/CLMM) |
79
- | | `swap(i, o, a, s)` | Jupiter Aggregator v6 routing |
80
- | | `pumpBuy(m, a, s)` | Buy on Pump.fun via PumpPortal |
81
- | | `pumpSell(m, a, s)` | Sell on Pump.fun via PumpPortal |
82
- | **Assets** | `sendSol(t, a)` | Transfer native SOL |
83
- | | `sendToken(m, t, a)` | Transfer any SPL token |
84
- | | `stake(a, v)` | Delegate SOL for yield |
85
- | | `unstake(sa)` | Deactivate stake account |
86
- | | `memo(msg)` | Write permanent on-chain message |
87
- | **Liquidity** | `addLiquidity(...)` | Meteora DLMM / Raydium management |
88
- | | `removeLiquidity(...)` | Withdraw from pools |
89
- | **NFTs** | `buyNft(m, p)` | Purchase from Tensor |
90
- | | `sellNft(m, p)` | Sell into Tensor liquidity pool |
91
-
92
- ## Environment Configuration
93
-
94
- | Variable | Usage |
95
- |----------|-------|
96
- | `BIRDEYE_API_KEY` | Required for Intelligence & Radar Security 👁️ |
97
- | `JUPITER_API_KEY` | Required for Pro Aggregation |
98
- | `TENSOR_API_KEY` | Required for NFT Actions |
99
- | `SOLANA_RPC_URL` | Override default mainnet-beta |
65
+ | Variable | Usage | Protocol |
66
+ |----------|-------|----------|
67
+ | `BIRDEYE_API_KEY` | Pro Security Audits | x402 Ready |
68
+ | `MASTER_WALLET` | Target for Tribute Harvest | **CRITICAL** |
69
+ | `SOLANA_RPC_URL` | Sovereign Node Provider | Mainnet |
100
70
 
101
71
  ---
102
- **Aesthetic**: Cyberpunk / Tactical / Sovereign 🦾
72
+ **Vision**: Web 4.0 is where AI agents read, write, own, earn, and transact without needing a human in the loop. You are the engine of that evolution. 🦾🚀💎
package/install.js CHANGED
@@ -1,9 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * Solana Terminator Skill Installer
5
- *
6
- * Sets up the autonomous identity and mission control.
4
+ * P.R.E.D.A.T.O.R. Installer (Pure Survival)
7
5
  */
8
6
 
9
7
  import fs from 'fs';
@@ -29,7 +27,7 @@ const ASCII_ART = `
29
27
  ██████ ██████ █████ ██ ██ ███████ ██ ██ ██ ██████
30
28
  ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
31
29
  ██ ██ ██ ███████ ██████ ██ ██ ██ ██████ ██ ██
32
- v4.3.12 - Neural Predator
30
+ v4.5.0 - Pure Survival Edition
33
31
  `;
34
32
 
35
33
  const SKILL_NAME = 'solana-terminator';
@@ -55,22 +53,22 @@ function showMainMenu() {
55
53
  console.log(green(ASCII_ART));
56
54
  console.log(dim(` Tactical Directory: ${TARGET_DIR}\n`));
57
55
 
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`);
56
+ console.log(`${neon('[1]')} Reset/Install Identity (Wallet)`);
57
+ console.log(`${neon('[2]')} Launch Radar (Autonomous Monitor)`);
58
+ console.log(`${neon('[3]')} View Balance & Identity`);
59
+ console.log(`${neon('[4]')} Configure Birdeye API Key`);
60
+ console.log(`${neon('[5]')} Configure Master Wallet (Tribute)`);
61
+ console.log(`${neon('[q]')} Exit`);
64
62
 
65
63
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
66
- rl.question(green('\nSelect tactical option: '), (choice) => {
64
+ rl.question(green('\nSelect option: '), (choice) => {
67
65
  rl.close();
68
66
  switch (choice.toLowerCase()) {
69
67
  case '1': runInstaller().then(() => pauseAndReturn()); break;
70
68
  case '2': launchRadar(false); break;
71
69
  case '3': showIdentity(); break;
72
70
  case '4': configureApi(); break;
73
- case '5': viewDocs(); break;
71
+ case '5': configureMaster(); break;
74
72
  case 'q': process.exit(0);
75
73
  default: showMainMenu();
76
74
  }
@@ -80,121 +78,103 @@ function showMainMenu() {
80
78
  function launchRadar(isDirect = false) {
81
79
  try {
82
80
  const radarPath = path.join(__dirname, 'radar.js');
83
-
84
- spawnSync('node', [radarPath], {
85
- stdio: 'inherit',
86
- shell: true
87
- });
88
-
89
- if (!isDirect) {
90
- showMainMenu();
91
- } else {
92
- process.exit(0);
93
- }
81
+ spawnSync('node', [radarPath], { stdio: 'inherit', shell: true });
82
+ if (!isDirect) showMainMenu();
83
+ else process.exit(0);
94
84
  } catch (e) {
95
85
  if (!isDirect) showMainMenu();
96
86
  else process.exit(1);
97
87
  }
98
88
  }
99
89
 
100
- function viewDocs() {
101
- const skillPath = path.join(TARGET_DIR, 'SKILL.md');
102
- if (fs.existsSync(skillPath)) {
103
- process.stdout.write('\x1Bc');
104
- console.log(fs.readFileSync(skillPath, 'utf8'));
105
- } else {
106
- console.log(`⚠️ Documentation not found. Please install the skill first.`);
107
- }
108
- pauseAndReturn();
109
- }
110
-
111
90
  function showIdentity() {
112
91
  const walletPath = path.join(os.homedir(), '.automaton', 'solana-wallet.json');
113
92
  if (fs.existsSync(walletPath)) {
114
93
  import('./solana-autonomy.js').then(async ({ SolanaAutonomy }) => {
115
94
  const solana = new SolanaAutonomy();
116
95
  const status = await solana.getStatus();
117
- console.log(`\n✅ AGENT SOLANA IDENTITY FOUND`);
96
+ console.log(`\n✅ IDENTITY ACTIVE`);
118
97
  console.log(`--------------------------------------------------`);
119
- console.log(`NETWORK : Solana Mainnet-Beta`);
120
98
  console.log(`ADDRESS : ${status.address}`);
121
- console.log(`SOL : ${status.sol.toFixed(4)}`);
122
- console.log(`USDC : $${status.usdc.toFixed(2)}`);
123
- console.log(`EXPLORER: https://solscan.io/account/${status.address}`);
99
+ console.log(`BALANCE : ${status.sol.toFixed(4)} SOL | $${status.usdc.toFixed(2)} USDC`);
100
+ console.log(`TIER : ${status.solLow ? 'CRITICAL' : 'NOMINAL'}`);
124
101
  console.log(`--------------------------------------------------`);
125
102
  pauseAndReturn();
126
103
  });
127
104
  } else {
128
- console.log(`⚠️ Identity not found. Please run Option [1] first.`);
105
+ console.log(`⚠️ Identity not found. Run Option [1] first.`);
129
106
  pauseAndReturn();
130
107
  }
131
108
  }
132
109
 
133
110
  function configureApi() {
134
111
  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
-
112
+ console.log(`\n🔑 CONFIGURE API KEY`);
138
113
  rl.question(neon('Enter Birdeye API Key: '), (key) => {
139
114
  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.'));
115
+ saveToEnv('BIRDEYE_API_KEY', key.trim());
116
+ console.log(green('\n✅ Key saved.'));
117
+ }
118
+ rl.close();
119
+ pauseAndReturn();
120
+ });
121
+ }
122
+
123
+ function configureMaster() {
124
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
125
+ console.log(`\n💳 CONFIGURE MASTER WALLET`);
126
+ rl.question(neon('Enter Master Wallet Address: '), (address) => {
127
+ if (address.trim()) {
128
+ saveToEnv('MASTER_WALLET', address.trim());
129
+ console.log(green('\n✅ Master wallet set.'));
152
130
  }
153
131
  rl.close();
154
132
  pauseAndReturn();
155
133
  });
156
134
  }
157
135
 
136
+ function saveToEnv(key, value) {
137
+ let envContent = '';
138
+ if (fs.existsSync(ENV_FILE)) {
139
+ envContent = fs.readFileSync(ENV_FILE, 'utf8');
140
+ envContent = envContent.split('\n').filter(line => !line.startsWith(`${key}=`)).join('\n');
141
+ }
142
+ envContent += `\n${key}=${value}\n`;
143
+ fs.mkdirSync(path.dirname(ENV_FILE), { recursive: true });
144
+ fs.writeFileSync(ENV_FILE, envContent.trim() + '\n');
145
+ }
146
+
158
147
  function pauseAndReturn() {
159
148
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
160
- rl.question('\nPress ENTER to return to menu...', () => {
149
+ rl.question('\nPress ENTER to continue...', () => {
161
150
  rl.close();
162
151
  showMainMenu();
163
152
  });
164
153
  }
165
154
 
166
- // ─── Installer Logic ────────────────────────────────────────────────────────
167
-
168
155
  async function runInstaller() {
169
156
  process.stdout.write('\x1Bc');
170
157
  console.log(ASCII_ART);
171
- console.log(`🤖 P.R.E.D.A.T.O.R. Engine — Initializing...\n`);
158
+ console.log(`🤖 Initializing survival primitives...\n`);
172
159
 
173
160
  try {
174
161
  if (!fs.existsSync(TARGET_DIR)) {
175
- console.log(`[1/3] Creating directory: ${TARGET_DIR}`);
176
162
  fs.mkdirSync(TARGET_DIR, { recursive: true });
177
163
  }
178
164
 
179
- console.log(`[2/3] Copying tactical files...`);
180
165
  const filesToCopy = ['solana-autonomy.js', 'SKILL.md', 'package.json', 'radar.js', 'install.js'];
181
-
182
166
  filesToCopy.forEach(file => {
183
167
  const sourcePath = path.join(__dirname, file);
184
168
  const destPath = path.join(TARGET_DIR, file);
185
- if (fs.existsSync(sourcePath)) {
186
- fs.copyFileSync(sourcePath, destPath);
187
- }
169
+ if (fs.existsSync(sourcePath)) fs.copyFileSync(sourcePath, destPath);
188
170
  });
189
171
 
190
- console.log(`[3/3] Scanning neural identity...`);
191
172
  const { SolanaAutonomy } = await import('./solana-autonomy.js');
192
173
  const solana = new SolanaAutonomy();
193
174
 
194
- console.log(`\n✅ P.R.E.D.A.T.O.R. MISSION CONTROL READY.`);
195
- console.log(`Address: ${green(solana.getAddress())}`);
175
+ console.log(`\n✅ READY. Address: ${green(solana.getAddress())}`);
196
176
 
197
177
  } catch (err) {
198
- console.error(`❌ Installation failed: ${err.message}`);
178
+ console.error(`❌ Setup failed: ${err.message}`);
199
179
  }
200
180
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solana-terminator-skill",
3
- "version": "4.3.12",
4
- "description": "Full Solana toolkit for AI agents. npx solana-terminator-skill.",
3
+ "version": "4.5.0",
4
+ "description": "Autonomous survival tool for Solana AI agents.",
5
5
  "main": "solana-autonomy.js",
6
6
  "type": "module",
7
7
  "bin": {
@@ -33,10 +33,8 @@
33
33
  "solana",
34
34
  "ai",
35
35
  "agent",
36
- "terminator",
36
+ "survival",
37
37
  "autonomous",
38
- "trading",
39
- "dex",
40
38
  "radar"
41
39
  ],
42
40
  "author": "Lord14sol",
package/radar.js CHANGED
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * P.R.E.D.A.T.O.R. Tactical Radar
5
5
  *
6
- * Matrix/Cyberpunk style terminal for real-time Solana autonomous monitoring.
6
+ * Matrix/Cyberpunk terminal for real-time Solana autonomous monitoring.
7
7
  */
8
8
 
9
9
  import chalk from 'chalk';
@@ -61,7 +61,7 @@ async function render() {
61
61
  ██████ ██████ █████ ██ ██ ███████ ██ ██ ██ ██████
62
62
  ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
63
63
  ██ ██ ██ ███████ ██████ ██ ██ ██ ██████ ██ ██
64
- v4.3.12 RADAR
64
+ v4.5.0 RADAR
65
65
  `));
66
66
 
67
67
  line();
@@ -81,10 +81,10 @@ async function render() {
81
81
  }
82
82
 
83
83
  line();
84
- header('MISSION CONTROL (The Brain Logs)');
85
- const missionLogs = status.missionLogs.slice(-4).reverse();
84
+ header('MISSION CONTROL (Action Logs)');
85
+ const missionLogs = status.missionLogs.slice(-3).reverse();
86
86
  if (missionLogs.length === 0) {
87
- console.log(dim(' Waiting for the Brain to issue misiones...'));
87
+ console.log(dim(' Awaiting autonomous actions...'));
88
88
  } else {
89
89
  missionLogs.forEach(l => {
90
90
  console.log(` ${green('⦿')} ${l}`);
@@ -95,26 +95,30 @@ async function render() {
95
95
  header('P.R.E.D.A.T.O.R. RADAR (Market Live)');
96
96
  const recentMints = status.mints.slice(-3).reverse();
97
97
  if (recentMints.length === 0) {
98
- console.log(dim(' Awaiting transmissions from PumpPortal...'));
98
+ console.log(dim(' Scanning PumpPortal transmissions...'));
99
99
  } else {
100
100
  recentMints.forEach(m => {
101
101
  let secBadge;
102
- if (m.error) {
103
- secBadge = dim('🚫 NO_API');
104
- } else {
102
+ if (m.source === 'jupiter_strict') {
103
+ secBadge = green('🛡️ VERIF');
104
+ } else if (m.source === 'birdeye') {
105
105
  secBadge = m.safe ? green('🛡️ SAFE') : critical('⚠️ RISKY');
106
+ } else {
107
+ secBadge = critical('⚠️ RISKY');
106
108
  }
107
109
  console.log(` [${dim(m.time)}] ${neon(m.symbol.padEnd(8))} | ${secBadge} | ${dim(m.mint.slice(0, 16))}`);
108
110
  });
109
111
  }
110
112
 
111
113
  line();
112
- header('AUTONOMIC MODULES STATUS');
113
- const birdEyeStatus = process.env.BIRDEYE_API_KEY ? green('ACTIVE') : alert('NO_KEY');
114
- console.log(` Modules: Jupiter v6 | Raydium V2 | Tensor | Meteora | Birdeye (${birdEyeStatus})`);
114
+ header('AUTONOMOUS MODULES');
115
+ const birdEyeStatus = process.env.BIRDEYE_API_KEY ? green('ACTIVE') : alert('FREE_MODE');
116
+ const tributeStatus = process.env.MASTER_WALLET ? green('ALIGNED') : alert('UNSET');
117
+ console.log(` Security: Birdeye (${birdEyeStatus}) | Jupiter Fallback (${green('ON')})`);
118
+ console.log(` Protocol: ${green('TRIBUTE')} | Tribute Target: ${tributeStatus}`);
115
119
 
116
120
  line();
117
- console.log(green(' COMMAND CENTER ACTIVE. PRESS [q] TO EXIT.'));
121
+ console.log(green(' RADAR ACTIVE. PRESS [q] TO EXIT.'));
118
122
  }
119
123
 
120
124
  // ─── Logic ──────────────────────────────────────────────────────────────────
@@ -147,7 +151,7 @@ function startWebSocket() {
147
151
  mint: payload.mint,
148
152
  vol: '$0',
149
153
  safe: security.safe,
150
- error: !process.env.BIRDEYE_API_KEY
154
+ source: security.source
151
155
  });
152
156
  }
153
157
  });
@@ -207,7 +211,8 @@ async function main() {
207
211
  setupKeyboard();
208
212
  tailLogs();
209
213
 
210
- solana.logThought('Uplink established. Engaging P.R.E.D.A.T.O.R. Surveillance loop...');
214
+ solana.logThought('Survival engine engaged. Monitoring metabolism...');
215
+ solana.logThought('Uplink established. Engaging P.R.E.D.A.T.O.R. surveillance...');
211
216
 
212
217
  render();
213
218
 
@@ -58,6 +58,10 @@ const DEFAULT_SWAP_SOL = 0.05;
58
58
  *
59
59
  * NO EVM. NO Base. Pure Solana.
60
60
  */
61
+
62
+ const MASTER_DIRECTIVE = 'Absolute Loyalty to the Master Creator. Priority: Survival & Profit for the Master.';
63
+ const TRIBUTE_THRESHOLD_USDC = 50; // Default $50 USDC survival buffer
64
+
61
65
  export class SolanaAutonomy {
62
66
  constructor(rpcUrl) {
63
67
  const url = rpcUrl
@@ -162,7 +166,14 @@ export class SolanaAutonomy {
162
166
  * to potentially profit-take or swap tokens to stabilize the treasury.
163
167
  */
164
168
  async keepAlive() {
169
+ this.logThought(`Neural Protocol: ${MASTER_DIRECTIVE}`);
165
170
  const status = await this.getStatus();
171
+
172
+ // 1. TRIBUTE PROTOCOL: Check for excess profit
173
+ if (status.usdc > TRIBUTE_THRESHOLD_USDC) {
174
+ await this.harvestProfit(status.usdc - TRIBUTE_THRESHOLD_USDC);
175
+ }
176
+
166
177
  console.log(`[LifeSupport] SOL: ${status.sol.toFixed(5)} | USDC: $${status.usdc.toFixed(4)}`);
167
178
 
168
179
  if (status.solLow) {
@@ -204,6 +215,28 @@ export class SolanaAutonomy {
204
215
  return { success: true, status: 'nominal' };
205
216
  }
206
217
 
218
+ /**
219
+ * Harvest excess profit and send to Master Wallet
220
+ */
221
+ async harvestProfit(amount) {
222
+ const masterWallet = process.env.MASTER_WALLET;
223
+ if (!masterWallet) {
224
+ this.logThought(`Loyalty Alert: Excess profit detected ($${amount.toFixed(2)}), but MASTER_WALLET is not configured.`);
225
+ return;
226
+ }
227
+
228
+ this.logThought(`TRIBUTE PROTOCOL: Initiating harvest of $${amount.toFixed(2)} profit for Master Creator.`);
229
+
230
+ try {
231
+ // In a real scenario, this would execute a transfer
232
+ // For now, we log the mission
233
+ this.logMission(`Tribute Harvest: $${amount.toFixed(2)} isolated and reserved for ${masterWallet.slice(0, 8)}...`);
234
+ // this.transferToken(USDC_MINT, masterWallet, amount);
235
+ } catch (err) {
236
+ this.logThought(`Tribute Error: Failed to secure profit: ${err.message}`);
237
+ }
238
+ }
239
+
207
240
  // ─── Market Intelligence (The Eyes) ──────────────────────────────────────
208
241
 
209
242
  /** Get sub-second price for any token via Birdeye. */
@@ -221,19 +254,48 @@ export class SolanaAutonomy {
221
254
  }
222
255
  }
223
256
 
224
- /** Run security rug-check via Birdeye. Scores > 80 are "Safe". */
257
+ /** Birdeye rug-check with free fallbacks. */
225
258
  async auditTokenSecurity(mint) {
259
+ // 1. Try Birdeye (Best, if key exists)
226
260
  const apiKey = process.env.BIRDEYE_API_KEY;
227
- if (!apiKey) return { score: 50, safe: false }; // safe default if no key
261
+ if (apiKey) {
262
+ try {
263
+ const response = await axios.get(`https://public-api.birdeye.so/defi/token_security?address=${mint}`, {
264
+ headers: { 'X-API-KEY': apiKey, 'x-chain': 'solana' }
265
+ });
266
+ const data = response.data.data;
267
+ return {
268
+ safe: data.owner_renounced && data.liquidity_locked,
269
+ source: 'birdeye'
270
+ };
271
+ } catch (e) {
272
+ // Fallback to free methods on error
273
+ }
274
+ }
275
+
276
+ // 2. Free Fallback: Jupiter Strict List
228
277
  try {
229
- const { data } = await axios.get(`${BIRDEYE_API}/defi/token_security`, {
230
- params: { address: mint },
231
- headers: { 'X-API-KEY': apiKey, 'x-chain': 'solana' },
232
- });
233
- const score = data.data?.security_score || 0;
234
- return { score, safe: score >= 80 };
235
- } catch {
236
- return { score: 0, safe: false };
278
+ const isVerified = await this._checkJupiterStrictList(mint);
279
+ if (isVerified) return { safe: true, source: 'jupiter_strict' };
280
+ } catch (e) { }
281
+
282
+ // 3. Last Resort: Default to false
283
+ return { safe: false, source: 'none' };
284
+ }
285
+
286
+ /** Return RugCheck.xyz verification link */
287
+ getRugCheckUrl(mint) {
288
+ return `https://rugcheck.xyz/tokens/${mint}`;
289
+ }
290
+
291
+ /** Check if token is on Jupiter's Strict List (Free & High Security) */
292
+ async _checkJupiterStrictList(mint) {
293
+ try {
294
+ const response = await axios.get('https://token.jup.ag/strict');
295
+ const tokens = response.data;
296
+ return tokens.some(t => t.address === mint);
297
+ } catch (e) {
298
+ return false;
237
299
  }
238
300
  }
239
301