@xaidenlabs/uso 1.1.48 → 1.1.50
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/package.json +1 -1
- package/src/commands/workflow.js +52 -0
- package/src/platforms/wsl.js +13 -7
- package/src/utils/stealth.js +25 -0
package/package.json
CHANGED
package/src/commands/workflow.js
CHANGED
|
@@ -3,8 +3,32 @@ const os = require('os');
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { log, spinner } = require('../utils/logger');
|
|
6
|
+
const { isStealthMode } = require('../utils/stealth');
|
|
7
|
+
const { runWsl, toWslPath } = require('../utils/wsl-bridge');
|
|
6
8
|
|
|
7
9
|
const runProxyCommand = async (command, args = [], binary = 'anchor') => {
|
|
10
|
+
const stealth = isStealthMode();
|
|
11
|
+
|
|
12
|
+
// --- STEALTH WSL MODE ---
|
|
13
|
+
if (stealth.enabled) {
|
|
14
|
+
const fullCommand = `${binary} ${command} ${args.join(' ')}`;
|
|
15
|
+
log.header(`🚀 Running: ${fullCommand}`);
|
|
16
|
+
log.info(`🐧 Routing through Uso Engine...`);
|
|
17
|
+
|
|
18
|
+
// Source cargo/solana paths inside WSL before running
|
|
19
|
+
const envSetup = 'source $HOME/.cargo/env 2>/dev/null; export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"';
|
|
20
|
+
const wslCwd = toWslPath(process.cwd());
|
|
21
|
+
const execution = runWsl(`${envSetup} && ${fullCommand}`, { distro: stealth.distro, cwd: process.cwd() });
|
|
22
|
+
|
|
23
|
+
if (execution.code === 0) {
|
|
24
|
+
log.success(`✅ '${command}' completed successfully.`);
|
|
25
|
+
} else {
|
|
26
|
+
log.error(`❌ '${command}' failed.`);
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// --- NATIVE MODE ---
|
|
8
32
|
// Check if binary is available
|
|
9
33
|
if (!shell.which(binary)) {
|
|
10
34
|
log.error(`❌ ${binary} is not found in PATH.`);
|
|
@@ -169,6 +193,28 @@ const airdrop = (amount, recipient) => {
|
|
|
169
193
|
};
|
|
170
194
|
|
|
171
195
|
const validator = async (args = []) => {
|
|
196
|
+
const stealth = isStealthMode();
|
|
197
|
+
|
|
198
|
+
// --- STEALTH WSL MODE ---
|
|
199
|
+
if (stealth.enabled) {
|
|
200
|
+
const flags = Array.isArray(args) ? args : [];
|
|
201
|
+
const cmdArgs = flags.join(' ');
|
|
202
|
+
const fullCmd = cmdArgs ? `solana-test-validator ${cmdArgs}` : 'solana-test-validator';
|
|
203
|
+
|
|
204
|
+
log.header(`🚀 Starting Validator via Uso Engine...`);
|
|
205
|
+
log.info(`🐧 Running: ${fullCmd}`);
|
|
206
|
+
log.info("👉 Press Ctrl+C to stop it.");
|
|
207
|
+
|
|
208
|
+
const envSetup = 'source $HOME/.cargo/env 2>/dev/null; export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"';
|
|
209
|
+
runWsl(`${envSetup} && ${fullCmd}`, {
|
|
210
|
+
distro: stealth.distro,
|
|
211
|
+
cwd: process.cwd(),
|
|
212
|
+
execOpts: { async: false }
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// --- NATIVE MODE ---
|
|
172
218
|
if (!shell.which('solana-test-validator')) {
|
|
173
219
|
log.error("❌ 'solana-test-validator' is not found in PATH.");
|
|
174
220
|
log.warn("👉 Run 'uso init' to install it.");
|
|
@@ -340,10 +386,16 @@ module.exports = {
|
|
|
340
386
|
};
|
|
341
387
|
|
|
342
388
|
const dev = async () => {
|
|
389
|
+
const stealth = isStealthMode();
|
|
343
390
|
log.header("🚀 Starting Development Environment...");
|
|
344
391
|
|
|
345
392
|
// 1. Check if validator is running
|
|
346
393
|
const isValidatorRunning = () => {
|
|
394
|
+
if (stealth.enabled) {
|
|
395
|
+
// Check from Windows side — validator in WSL still binds to host port
|
|
396
|
+
const res = shell.exec('netstat -an | findstr 8899', { silent: true });
|
|
397
|
+
return res.code === 0 && res.stdout.length > 0;
|
|
398
|
+
}
|
|
347
399
|
const res = shell.exec('netstat -an | findstr 8899', { silent: true });
|
|
348
400
|
return res.code === 0 && res.stdout.length > 0;
|
|
349
401
|
};
|
package/src/platforms/wsl.js
CHANGED
|
@@ -81,22 +81,28 @@ const installWsl = async () => {
|
|
|
81
81
|
# 1. Hush Login
|
|
82
82
|
touch ~/.hushlogin
|
|
83
83
|
|
|
84
|
-
# 2. Update & Install Dependencies
|
|
85
|
-
if ! command -v
|
|
86
|
-
|
|
84
|
+
# 2. Update & Install Build Dependencies (ALWAYS check for cc linker)
|
|
85
|
+
if ! command -v cc &> /dev/null || ! command -v pkg-config &> /dev/null; then
|
|
86
|
+
echo "Installing build tools..."
|
|
87
|
+
sudo apt-get update -y && sudo apt-get install -y curl build-essential pkg-config libssl-dev libudev-dev
|
|
87
88
|
fi
|
|
88
89
|
|
|
89
90
|
# 3. Install Rust
|
|
90
91
|
if ! command -v cargo &> /dev/null; then
|
|
91
92
|
echo "Installing Rust..."
|
|
92
93
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
93
|
-
source $HOME/.cargo/env
|
|
94
94
|
fi
|
|
95
|
+
# Always source cargo env for subsequent steps
|
|
96
|
+
source $HOME/.cargo/env 2>/dev/null || true
|
|
95
97
|
|
|
96
98
|
# 4. Install Solana
|
|
97
99
|
if ! command -v solana &> /dev/null; then
|
|
98
|
-
echo "Installing Solana..."
|
|
99
|
-
|
|
100
|
+
echo "Installing Solana CLI..."
|
|
101
|
+
# Try official installer first, fall back to Agave
|
|
102
|
+
if ! sh -c "$(curl -sSfL https://release.solana.com/stable/install)" 2>/dev/null; then
|
|
103
|
+
echo "Retrying with Agave installer..."
|
|
104
|
+
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)" 2>/dev/null || true
|
|
105
|
+
fi
|
|
100
106
|
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
|
|
101
107
|
fi
|
|
102
108
|
|
|
@@ -108,7 +114,7 @@ const installWsl = async () => {
|
|
|
108
114
|
avm use latest
|
|
109
115
|
fi
|
|
110
116
|
|
|
111
|
-
echo "✅
|
|
117
|
+
echo "✅ Uso Engine Setup Complete."
|
|
112
118
|
`;
|
|
113
119
|
|
|
114
120
|
// Write script to a temporary file in Windows (which is mounted in WSL)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checks if Stealth WSL Mode is enabled.
|
|
7
|
+
* Reads ~/.uso-config.json and returns the mode configuration.
|
|
8
|
+
* @returns {{ enabled: boolean, distro: string }}
|
|
9
|
+
*/
|
|
10
|
+
const isStealthMode = () => {
|
|
11
|
+
try {
|
|
12
|
+
const configPath = path.join(os.homedir(), '.uso-config.json');
|
|
13
|
+
if (!fs.existsSync(configPath)) return { enabled: false, distro: 'Ubuntu' };
|
|
14
|
+
|
|
15
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
16
|
+
return {
|
|
17
|
+
enabled: config.mode === 'wsl',
|
|
18
|
+
distro: config.distro || 'Ubuntu'
|
|
19
|
+
};
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return { enabled: false, distro: 'Ubuntu' };
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
module.exports = { isStealthMode };
|