sandboxbox 2.4.6 → 2.4.8

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/.vexify.db ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandboxbox",
3
- "version": "2.4.6",
3
+ "version": "2.4.8",
4
4
  "description": "Portable container runner with Podman - Claude Code & Playwright support. Works on Windows, macOS, and Linux.",
5
5
  "type": "module",
6
6
  "main": "cli.js",
@@ -84,8 +84,8 @@ export function runCommand(projectDir, cmd = 'bash') {
84
84
  const maxRetries = process.platform === 'linux' ? 3 : 12; // More retries for Windows/macOS
85
85
 
86
86
  while (retries < maxRetries) {
87
- console.log(color('cyan', ` Debug: Attempt ${retries + 1}/${maxRetries} - running container command...`));
88
87
  try {
88
+ // Try container operation first
89
89
  execSync(`"${podmanPath}" run --rm -it ${mounts.join(' ')} -w /workspace sandboxbox:latest ${cmd}`, {
90
90
  stdio: 'inherit',
91
91
  shell: process.platform === 'win32',
@@ -98,12 +98,37 @@ export function runCommand(projectDir, cmd = 'bash') {
98
98
  return true;
99
99
  } catch (error) {
100
100
  retries++;
101
- // Debug: Log the actual error message
102
- console.log(color('cyan', ` Debug: Error message: "${error.message}"`));
103
- console.log(color('cyan', ` Debug: Checking retry patterns...`));
104
-
105
101
  if (retries < maxRetries && (error.message.includes('Cannot connect to Podman') || error.message.includes('connectex') || error.message.includes('No connection could be made') || error.message.includes('actively refused') || error.message.includes('Command failed'))) {
106
- console.log(color('yellow', ` Backend not ready yet (${retries}/${maxRetries}), waiting 15 seconds...`));
102
+ console.log(color('yellow', ` Backend not ready yet (${retries}/${maxRetries}), initializing machine...`));
103
+
104
+ // Actually initialize the machine instead of just waiting
105
+ if (process.platform === 'win32') {
106
+ try {
107
+ console.log(color('cyan', ' Initializing Podman machine...'));
108
+ execSync(`"${podmanPath}" machine init --rootful=false`, {
109
+ stdio: 'pipe',
110
+ shell: true,
111
+ windowsHide: true,
112
+ timeout: 180000 // 3 minutes for machine init
113
+ });
114
+
115
+ console.log(color('cyan', ' Starting Podman machine...'));
116
+ execSync(`"${podmanPath}" machine start`, {
117
+ stdio: 'pipe',
118
+ shell: true,
119
+ windowsHide: true,
120
+ timeout: 60000 // 1 minute for machine start
121
+ });
122
+
123
+ console.log(color('green', ' ✅ Podman machine ready!'));
124
+ continue; // Try container again immediately
125
+ } catch (machineError) {
126
+ console.log(color('red', ` Machine setup failed: ${machineError.message}`));
127
+ }
128
+ }
129
+
130
+ // If machine setup failed or not Windows, wait and retry
131
+ console.log(color('yellow', ` Waiting 15 seconds before retry...`));
107
132
  const start = Date.now();
108
133
  while (Date.now() - start < 15000) {
109
134
  // Wait 15 seconds
@@ -159,7 +184,36 @@ export function shellCommand(projectDir) {
159
184
  } catch (error) {
160
185
  retries++;
161
186
  if (retries < maxRetries && (error.message.includes('Cannot connect to Podman') || error.message.includes('connectex') || error.message.includes('No connection could be made') || error.message.includes('actively refused') || error.message.includes('Command failed'))) {
162
- console.log(color('yellow', ` Backend not ready yet (${retries}/${maxRetries}), waiting 15 seconds...`));
187
+ console.log(color('yellow', ` Backend not ready yet (${retries}/${maxRetries}), initializing machine...`));
188
+
189
+ // Actually initialize the machine instead of just waiting
190
+ if (process.platform === 'win32') {
191
+ try {
192
+ console.log(color('cyan', ' Initializing Podman machine...'));
193
+ execSync(`"${podmanPath}" machine init --rootful=false`, {
194
+ stdio: 'pipe',
195
+ shell: true,
196
+ windowsHide: true,
197
+ timeout: 180000 // 3 minutes for machine init
198
+ });
199
+
200
+ console.log(color('cyan', ' Starting Podman machine...'));
201
+ execSync(`"${podmanPath}" machine start`, {
202
+ stdio: 'pipe',
203
+ shell: true,
204
+ windowsHide: true,
205
+ timeout: 60000 // 1 minute for machine start
206
+ });
207
+
208
+ console.log(color('green', ' ✅ Podman machine ready!'));
209
+ continue; // Try container again immediately
210
+ } catch (machineError) {
211
+ console.log(color('red', ` Machine setup failed: ${machineError.message}`));
212
+ }
213
+ }
214
+
215
+ // If machine setup failed or not Windows, wait and retry
216
+ console.log(color('yellow', ` Waiting 15 seconds before retry...`));
163
217
  const start = Date.now();
164
218
  while (Date.now() - start < 15000) {
165
219
  // Wait 15 seconds
package/utils/podman.js CHANGED
@@ -96,26 +96,53 @@ function setupMachineBackground(podmanPath) {
96
96
 
97
97
  // Windows-specific: Use completely hidden process execution
98
98
  const spawnOptions = process.platform === 'win32' ? {
99
- stdio: ['ignore', 'ignore', 'ignore'],
99
+ stdio: ['pipe', 'pipe', 'pipe'],
100
100
  shell: true,
101
101
  detached: true,
102
102
  windowsHide: true, // Hide the console window on Windows
103
103
  cwd: process.cwd() // Ensure working directory is set
104
104
  } : {
105
- stdio: ['ignore', 'ignore', 'ignore'],
105
+ stdio: ['pipe', 'pipe', 'pipe'],
106
106
  shell: true,
107
107
  detached: true
108
108
  };
109
109
 
110
110
  const initProcess = spawn(initCmd, spawnOptions);
111
- initProcess.unref();
112
111
 
113
- // Start machine after init completes (with delay)
114
- setTimeout(() => {
115
- const startCmd = `"${podmanPath}" machine start`;
116
- const startProcess = spawn(startCmd, spawnOptions);
117
- startProcess.unref();
118
- }, 30000); // Wait 30 seconds for init to complete
112
+ // Handle init process completion/errors
113
+ initProcess.on('error', (error) => {
114
+ console.log(color('red', ` Init process error: ${error.message}`));
115
+ });
116
+
117
+ initProcess.on('exit', (code) => {
118
+ if (code === 0) {
119
+ console.log(color('green', ' Machine initialization completed, starting in 10 seconds...'));
120
+
121
+ // Start machine after init completes
122
+ setTimeout(() => {
123
+ const startCmd = `"${podmanPath}" machine start`;
124
+ const startProcess = spawn(startCmd, spawnOptions);
125
+
126
+ startProcess.on('error', (error) => {
127
+ console.log(color('red', ` Start process error: ${error.message}`));
128
+ });
129
+
130
+ startProcess.on('exit', (startCode) => {
131
+ if (startCode === 0) {
132
+ console.log(color('green', ' Podman machine started successfully!'));
133
+ } else {
134
+ console.log(color('red', ` Machine start failed with code: ${startCode}`));
135
+ }
136
+ });
137
+
138
+ startProcess.unref();
139
+ }, 10000); // Wait 10 seconds before starting
140
+ } else {
141
+ console.log(color('red', ` Machine initialization failed with code: ${code}`));
142
+ }
143
+ });
144
+
145
+ initProcess.unref();
119
146
 
120
147
  console.log(color('yellow', ' Setup initiated in background (may take 2-3 minutes)'));
121
148
  console.log(color('cyan', ' Container operations will work when setup completes\n'));