sandboxbox 2.3.3 → 2.3.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/podman.js +25 -96
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandboxbox",
3
- "version": "2.3.3",
3
+ "version": "2.3.5",
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",
package/utils/podman.js CHANGED
@@ -27,8 +27,21 @@ export function getPodmanPath() {
27
27
  }
28
28
 
29
29
  export function setupBackendNonBlocking(podmanPath) {
30
- if (process.platform === 'linux') return true;
30
+ if (process.platform === 'linux') {
31
+ // Linux can run true rootless Podman
32
+ const execOptions = { encoding: 'utf-8', stdio: 'pipe', shell: true };
33
+ try {
34
+ execSync(`"${podmanPath}" info`, execOptions);
35
+ return true;
36
+ } catch (infoError) {
37
+ console.log(color('yellow', '\nšŸ”§ Starting Podman rootless service...'));
38
+ console.log(color('cyan', ' Run: podman system service --time=0 &'));
39
+ console.log(color('yellow', ' Or use systemd: sudo systemctl enable --now podman'));
40
+ return false;
41
+ }
42
+ }
31
43
 
44
+ // Windows/macOS: Show setup instructions (VM required, no way around it)
32
45
  const execOptions = { encoding: 'utf-8', stdio: 'pipe', shell: true };
33
46
 
34
47
  try {
@@ -39,103 +52,19 @@ export function setupBackendNonBlocking(podmanPath) {
39
52
  return false;
40
53
  }
41
54
 
42
- console.log(color('yellow', '\nšŸ”§ Initializing Podman backend (one-time setup, takes 2-3 minutes)...'));
55
+ console.log(color('yellow', '\nšŸ”§ Podman machine setup required (Windows/macOS limitation)'));
56
+ console.log(color('cyan', process.platform === 'win32'
57
+ ? ' Windows requires a VM backend for Podman containers'
58
+ : ' macOS requires a VM backend for Podman containers'));
43
59
 
44
- try {
45
- // Check existing machines with timeout
46
- let machines = [];
47
- try {
48
- const machineListOutput = execSync(`"${podmanPath}" machine list --format json`, {
49
- ...execOptions,
50
- timeout: 10000 // 10 seconds timeout
51
- });
52
- machines = JSON.parse(machineListOutput || '[]');
53
- console.log(color('cyan', ` Found ${machines.length} existing machine(s)`));
54
- } catch (machineListError) {
55
- console.log(color('yellow', ' Could not list machines, assuming no machines exist'));
56
- }
57
-
58
- if (machines.length === 0) {
59
- console.log(color('cyan', ' Creating Podman machine...'));
60
- const initCmd = process.platform === 'win32'
61
- ? `"${podmanPath}" machine init --rootful=false`
62
- : `"${podmanPath}" machine init`;
63
-
64
- try {
65
- execSync(initCmd, {
66
- stdio: ['pipe', 'pipe', 'pipe'],
67
- shell: true,
68
- timeout: 120000 // 2 minutes
69
- });
70
- } catch (initError) {
71
- const errorOutput = initError.stdout?.toString() + initError.stderr?.toString();
72
- if (errorOutput?.includes('already exists') ||
73
- errorOutput?.includes('VM already exists') ||
74
- initError.message.includes('already exists')) {
75
- console.log(color('cyan', ' Machine already exists, proceeding...'));
76
- } else {
77
- console.log(color('red', ` Error output: ${errorOutput}`));
78
- throw initError;
79
- }
80
- }
81
- } else {
82
- console.log(color('cyan', ' Using existing machine'));
83
- }
60
+ console.log(color('yellow', '\nšŸ“‹ One-time setup (takes 2-3 minutes):'));
61
+ const setupCmd = process.platform === 'win32'
62
+ ? `podman machine init --rootful=false && podman machine start`
63
+ : `podman machine init && podman machine start`;
84
64
 
85
- console.log(color('cyan', ' Checking machine status...'));
86
- try {
87
- const statusOutput = execSync(`"${podmanPath}" machine list`, {
88
- encoding: 'utf-8',
89
- stdio: 'pipe',
90
- shell: true,
91
- timeout: 10000
92
- });
93
-
94
- if (statusOutput.includes('Running')) {
95
- console.log(color('green', ' Machine is already running'));
96
- } else {
97
- console.log(color('cyan', ' Starting Podman machine...'));
98
- execSync(`"${podmanPath}" machine start`, {
99
- stdio: 'inherit',
100
- shell: true,
101
- timeout: 180000 // 3 minutes
102
- });
103
- }
104
- } catch (statusError) {
105
- console.log(color('cyan', ' Could not check status, attempting to start machine...'));
106
- execSync(`"${podmanPath}" machine start`, {
107
- stdio: 'inherit',
108
- shell: true,
109
- timeout: 180000 // 3 minutes
110
- });
111
- }
112
-
113
- // Verify backend is actually working
114
- console.log(color('cyan', ' Verifying backend connection...'));
115
- try {
116
- execSync(`"${podmanPath}" info`, execOptions);
117
- } catch (verifyError) {
118
- console.log(color('red', ` Backend verification failed: ${verifyError.message}`));
119
- console.log(color('yellow', ' Please ensure Podman machine is running manually'));
120
- return false;
121
- }
122
-
123
- console.log(color('green', '\nāœ… Podman backend setup completed!\n'));
124
- return true;
125
- } catch (setupError) {
126
- if (setupError.signal === 'SIGTERM') {
127
- console.log(color('red', '\nāŒ Setup timed out. Please run manually:'));
128
- } else {
129
- console.log(color('red', `\nāŒ Setup failed: ${setupError.message}`));
130
- console.log(color('red', ` Error details: ${setupError.stack}`));
131
- }
132
-
133
- const manualCmd = process.platform === 'win32'
134
- ? `"${podmanPath}" machine init --rootful=false && "${podmanPath}" machine start`
135
- : `"${podmanPath}" machine init && "${podmanPath}" machine start`;
136
- console.log(color('cyan', ` Manual setup: ${manualCmd}`));
137
- return false;
138
- }
65
+ console.log(color('cyan', ` ${setupCmd}`));
66
+ console.log(color('yellow', '\nšŸ’” After setup, sandboxbox will work instantly forever\n'));
67
+ return false;
139
68
  }
140
69
  }
141
70