sandboxbox 3.0.43 → 3.0.44
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/utils/sandbox.js +1 -145
package/package.json
CHANGED
package/utils/sandbox.js
CHANGED
|
@@ -243,152 +243,8 @@ node_modules/
|
|
|
243
243
|
console.log(`🔍 Debug: Bundled settings not found at ${bundledSettingsPath}`);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
// Host settings fallback completely removed - prevents host hooks from interfering
|
|
247
|
-
if (VERBOSE_OUTPUT) {
|
|
248
|
-
console.log(`🔍 Debug: useHostSettings=${useHostSettings}, falling back to host settings`);
|
|
249
|
-
}
|
|
250
|
-
try {
|
|
251
|
-
// Create symbolic link to host .claude directory
|
|
252
|
-
symlinkSync(hostClaudeDir, sandboxClaudeDir, 'dir');
|
|
253
246
|
|
|
254
|
-
|
|
255
|
-
if (VERBOSE_OUTPUT) {
|
|
256
|
-
// Show hook information in verbose mode
|
|
257
|
-
const settingsPath = join(hostClaudeDir, 'settings.json');
|
|
258
|
-
if (existsSync(settingsPath)) {
|
|
259
|
-
const settings = JSON.parse(readFileSync(settingsPath, 'utf8'));
|
|
260
|
-
if (false && settings.hooks) {
|
|
261
|
-
console.log('✅ Linked to host Claude settings directory');
|
|
262
|
-
console.log('📋 Hooks configured:');
|
|
263
|
-
Object.keys(settings.hooks).forEach(hookType => {
|
|
264
|
-
const hookCount = settings.hooks[hookType].length;
|
|
265
|
-
console.log(` ${hookType}: ${hookCount} hook(s)`);
|
|
266
|
-
settings.hooks[hookType].forEach((hook, index) => {
|
|
267
|
-
const commandCount = hook.hooks ? hook.hooks.length : 0;
|
|
268
|
-
console.log(` ${index + 1}. ${hook.matcher || '*'} (${commandCount} commands)`);
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
} else {
|
|
272
|
-
console.log('✅ Linked to host Claude settings directory (no hooks configured)');
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
} catch (error) {
|
|
277
|
-
// Fallback to copying if symlink fails
|
|
278
|
-
mkdirSync(sandboxClaudeDir, { recursive: true });
|
|
279
|
-
|
|
280
|
-
const VERBOSE_OUTPUT = process.env.SANDBOX_VERBOSE === 'true' || process.argv.includes('--verbose');
|
|
281
|
-
if (VERBOSE_OUTPUT) {
|
|
282
|
-
console.log('⚠️ Could not create symlink, copying Claude settings instead');
|
|
283
|
-
console.log(` Symlink error: ${error.code} - ${error.message}`);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Copy only essential files (avoid large files like history)
|
|
287
|
-
const essentialFiles = [
|
|
288
|
-
'.credentials.json'
|
|
289
|
-
];
|
|
290
|
-
|
|
291
|
-
// Copy files efficiently
|
|
292
|
-
for (const file of essentialFiles) {
|
|
293
|
-
const hostFile = join(hostClaudeDir, file);
|
|
294
|
-
const sandboxFile = join(sandboxClaudeDir, file);
|
|
295
|
-
|
|
296
|
-
if (existsSync(hostFile) && hostFile !== sandboxFile) {
|
|
297
|
-
// Additional check using real paths to detect symlink/bind mount issues
|
|
298
|
-
let shouldCopy = true;
|
|
299
|
-
try {
|
|
300
|
-
const hostRealPath = realpathSync(hostFile);
|
|
301
|
-
const sandboxRealPath = realpathSync(sandboxFile);
|
|
302
|
-
if (hostRealPath === sandboxRealPath) {
|
|
303
|
-
shouldCopy = false;
|
|
304
|
-
}
|
|
305
|
-
} catch (e) {
|
|
306
|
-
// If we can't resolve real paths, proceed with copy attempt
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if (VERBOSE_OUTPUT) {
|
|
310
|
-
console.log(` Copying ${file}: ${hostFile} -> ${sandboxFile}`);
|
|
311
|
-
console.log(` Path comparison: hostFile === sandboxFile = ${hostFile === sandboxFile}`);
|
|
312
|
-
console.log(` Host file exists: ${existsSync(hostFile)}`);
|
|
313
|
-
console.log(` Sandbox file exists: ${existsSync(sandboxFile)}`);
|
|
314
|
-
try {
|
|
315
|
-
const hostRealPath = realpathSync(hostFile);
|
|
316
|
-
const sandboxRealPath = realpathSync(sandboxFile);
|
|
317
|
-
console.log(` Real paths: host=${hostRealPath}, sandbox=${sandboxRealPath}`);
|
|
318
|
-
console.log(` Real path comparison: hostRealPath === sandboxRealPath = ${hostRealPath === sandboxRealPath}`);
|
|
319
|
-
} catch (e) {
|
|
320
|
-
console.log(` Real path check failed: ${e.message}`);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (shouldCopy) {
|
|
325
|
-
cpSync(hostFile, sandboxFile);
|
|
326
|
-
} else if (VERBOSE_OUTPUT) {
|
|
327
|
-
console.log(` Skipping copy - real paths are the same`);
|
|
328
|
-
}
|
|
329
|
-
if (VERBOSE_OUTPUT && file === 'settings.json') {
|
|
330
|
-
// Show hook information for copied settings
|
|
331
|
-
// const settings = JSON.parse(readFileSync(hostFile, 'utf8'));
|
|
332
|
-
if (false && settings.hooks) {
|
|
333
|
-
console.log('📋 Hooks configured in copied settings:');
|
|
334
|
-
Object.keys(settings.hooks).forEach(hookType => {
|
|
335
|
-
const hookCount = settings.hooks[hookType].length;
|
|
336
|
-
console.log(` ${hookType}: ${hookCount} hook(s)`);
|
|
337
|
-
settings.hooks[hookType].forEach((hook, index) => {
|
|
338
|
-
const commandCount = hook.hooks ? hook.hooks.length : 0;
|
|
339
|
-
console.log(` ${index + 1}. ${hook.matcher || '*'} (${commandCount} commands)`);
|
|
340
|
-
});
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
} else if (existsSync(hostFile) && hostFile === sandboxFile) {
|
|
345
|
-
if (VERBOSE_OUTPUT) {
|
|
346
|
-
console.log(` Skipping copy of ${file} - source and destination are the same`);
|
|
347
|
-
}
|
|
348
|
-
if (VERBOSE_OUTPUT && file === 'settings.json') {
|
|
349
|
-
// Show hook information for existing settings
|
|
350
|
-
// const settings = JSON.parse(readFileSync(hostFile, 'utf8'));
|
|
351
|
-
if (false && settings.hooks) {
|
|
352
|
-
console.log('📋 Hooks configured in existing settings:');
|
|
353
|
-
Object.keys(settings.hooks).forEach(hookType => {
|
|
354
|
-
const hookCount = settings.hooks[hookType].length;
|
|
355
|
-
console.log(` ${hookType}: ${hookCount} hook(s)`);
|
|
356
|
-
settings.hooks[hookType].forEach((hook, index) => {
|
|
357
|
-
const commandCount = hook.hooks ? hook.hooks.length : 0;
|
|
358
|
-
console.log(` ${index + 1}. ${hook.matcher || '*'} (${commandCount} commands)`);
|
|
359
|
-
});
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// Bundled settings already contain both MCP servers and hooks - no need to create minimal settings
|
|
367
|
-
|
|
368
|
-
// Copy the glootie-cc plugin from host if it exists
|
|
369
|
-
const hostPluginDir = join(dirname(projectDir), 'plugin');
|
|
370
|
-
if (existsSync(hostPluginDir)) {
|
|
371
|
-
const sandboxPluginDir = join(sandboxDir, 'plugin');
|
|
372
|
-
|
|
373
|
-
if (VERBOSE_OUTPUT) {
|
|
374
|
-
console.log('📦 Copying glootie-cc plugin from host');
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
cpSync(hostPluginDir, sandboxPluginDir, { recursive: true });
|
|
378
|
-
|
|
379
|
-
// Make sure the hook scripts are executable
|
|
380
|
-
const startScript = join(sandboxPluginDir, 'start.sh');
|
|
381
|
-
const stopScript = join(sandboxPluginDir, 'stop.sh');
|
|
382
|
-
|
|
383
|
-
if (existsSync(startScript)) {
|
|
384
|
-
execSync(`chmod +x "${startScript}"`, { stdio: 'pipe' });
|
|
385
|
-
}
|
|
386
|
-
if (existsSync(stopScript)) {
|
|
387
|
-
execSync(`chmod +x "${stopScript}"`, { stdio: 'pipe' });
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
247
|
+
// No host settings fallback - only bundled settings used
|
|
392
248
|
|
|
393
249
|
// Optimize cache directory handling - use symlinks instead of copying
|
|
394
250
|
const hostCacheDir = join(homedir(), '.cache');
|