@xaidenlabs/uso 1.1.48 → 1.1.49
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/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
|
};
|
|
@@ -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 };
|