@xaidenlabs/uso 1.1.50 → 1.1.51
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/platforms/wsl.js +81 -73
package/package.json
CHANGED
package/src/platforms/wsl.js
CHANGED
|
@@ -74,77 +74,85 @@ const installWsl = async () => {
|
|
|
74
74
|
|
|
75
75
|
log.info("⚙️ Initializing Uso Engine environment...");
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
77
|
+
// --- PHASE 1: System Dependencies (as root, no sudo needed) ---
|
|
78
|
+
const rootScript = `
|
|
79
|
+
#!/bin/bash
|
|
80
|
+
set -e
|
|
81
|
+
export DEBIAN_FRONTEND=noninteractive
|
|
82
|
+
|
|
83
|
+
if ! command -v cc &> /dev/null || ! command -v pkg-config &> /dev/null; then
|
|
84
|
+
echo "📦 Installing system build tools..."
|
|
85
|
+
apt-get update -y -qq
|
|
86
|
+
apt-get install -y -qq curl build-essential pkg-config libssl-dev libudev-dev
|
|
87
|
+
echo "✅ Build tools installed."
|
|
88
|
+
else
|
|
89
|
+
echo "✅ Build tools already present."
|
|
90
|
+
fi
|
|
91
|
+
`.replace(/\r\n/g, '\n');
|
|
92
|
+
|
|
93
|
+
const rootScriptPath = path.join(process.cwd(), 'uso_root_setup.sh');
|
|
94
|
+
fs.writeFileSync(rootScriptPath, rootScript);
|
|
95
|
+
const wslRootScriptPath = toWslPath(rootScriptPath);
|
|
96
|
+
|
|
97
|
+
const spin1 = spinner('Phase 1/2: Installing system dependencies...').start();
|
|
98
|
+
const rootRes = shell.exec(`wsl -d Ubuntu -u root -e bash "${wslRootScriptPath}"`);
|
|
99
|
+
fs.unlinkSync(rootScriptPath);
|
|
100
|
+
|
|
101
|
+
if (rootRes.code !== 0) {
|
|
102
|
+
spin1.fail('System dependency installation failed.');
|
|
103
|
+
log.error(rootRes.stderr || 'Unknown error during root setup.');
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
spin1.succeed('System dependencies ready.');
|
|
107
|
+
|
|
108
|
+
// --- PHASE 2: User Tools (Rust, Solana, Anchor as normal user) ---
|
|
109
|
+
const userScript = `
|
|
110
|
+
#!/bin/bash
|
|
111
|
+
set -e
|
|
112
|
+
|
|
113
|
+
# Hush login
|
|
114
|
+
touch ~/.hushlogin
|
|
115
|
+
|
|
116
|
+
# Install Rust
|
|
117
|
+
if ! command -v cargo &> /dev/null; then
|
|
118
|
+
echo "🦀 Installing Rust..."
|
|
119
|
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
120
|
+
fi
|
|
121
|
+
source $HOME/.cargo/env 2>/dev/null || true
|
|
122
|
+
|
|
123
|
+
# Install Solana
|
|
124
|
+
if ! command -v solana &> /dev/null; then
|
|
125
|
+
echo "☀️ Installing Solana CLI..."
|
|
126
|
+
if ! sh -c "$(curl -sSfL https://release.solana.com/stable/install)" 2>/dev/null; then
|
|
127
|
+
echo "Retrying with Agave installer..."
|
|
128
|
+
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)" 2>/dev/null || true
|
|
129
|
+
fi
|
|
130
|
+
fi
|
|
131
|
+
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
|
|
132
|
+
|
|
133
|
+
# Install Anchor (AVM)
|
|
134
|
+
if ! command -v avm &> /dev/null; then
|
|
135
|
+
echo "⚓ Installing AVM (this compiles from source, ~5 min)..."
|
|
136
|
+
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
|
|
137
|
+
avm install latest
|
|
138
|
+
avm use latest
|
|
139
|
+
fi
|
|
140
|
+
|
|
141
|
+
echo "✅ Uso Engine Setup Complete."
|
|
142
|
+
`.replace(/\r\n/g, '\n');
|
|
143
|
+
|
|
144
|
+
const userScriptPath = path.join(process.cwd(), 'uso_user_setup.sh');
|
|
145
|
+
fs.writeFileSync(userScriptPath, userScript);
|
|
146
|
+
const wslUserScriptPath = toWslPath(userScriptPath);
|
|
147
|
+
|
|
148
|
+
const spin2 = spinner('Phase 2/2: Installing Rust, Solana, Anchor (this takes a while)...').start();
|
|
149
|
+
const userRes = shell.exec(`wsl -d Ubuntu -e bash "${wslUserScriptPath}"`);
|
|
150
|
+
fs.unlinkSync(userScriptPath);
|
|
151
|
+
|
|
152
|
+
if (userRes.code === 0) {
|
|
153
|
+
spin2.succeed('Uso Engine configured successfully.');
|
|
154
|
+
|
|
155
|
+
// Set "Stealth Mode" config
|
|
148
156
|
const configPath = path.join(os.homedir(), '.uso-config.json');
|
|
149
157
|
const config = { mode: 'wsl', distro: 'Ubuntu' };
|
|
150
158
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
@@ -152,8 +160,8 @@ const installWsl = async () => {
|
|
|
152
160
|
log.success("✅ Stealth Mode Enabled. 'uso' commands will now run via WSL.");
|
|
153
161
|
return true;
|
|
154
162
|
} else {
|
|
155
|
-
|
|
156
|
-
log.error(
|
|
163
|
+
spin2.fail('Setup script failed.');
|
|
164
|
+
log.error(userRes.stderr || 'Check the output above for errors.');
|
|
157
165
|
return false;
|
|
158
166
|
}
|
|
159
167
|
};
|