@dynamicu/chromedebug-mcp 2.5.14 → 2.5.15

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.
@@ -67,7 +67,7 @@ export class BrowserDaemon {
67
67
  const signals = ['SIGINT', 'SIGTERM', 'SIGQUIT'];
68
68
  signals.forEach(signal => {
69
69
  process.on(signal, async () => {
70
- console.log(`[BrowserDaemon] Received ${signal}, initiating graceful shutdown...`);
70
+ console.error(`[BrowserDaemon] Received ${signal}, initiating graceful shutdown...`);
71
71
  await this.gracefulShutdown();
72
72
  process.exit(0);
73
73
  });
@@ -96,7 +96,7 @@ export class BrowserDaemon {
96
96
  }
97
97
 
98
98
  try {
99
- console.log(`[BrowserDaemon] Starting daemon ${this.daemonId}...`);
99
+ console.error(`[BrowserDaemon] Starting daemon ${this.daemonId}...`);
100
100
 
101
101
  // Initialize core managers
102
102
  await this.profileManager.initialize();
@@ -116,7 +116,7 @@ export class BrowserDaemon {
116
116
  // Start health monitoring
117
117
  this.startHealthCheck();
118
118
 
119
- console.log(`[BrowserDaemon] Daemon started successfully on port ${this.config.daemonPort}`);
119
+ console.error(`[BrowserDaemon] Daemon started successfully on port ${this.config.daemonPort}`);
120
120
 
121
121
  return {
122
122
  success: true,
@@ -167,9 +167,9 @@ export class BrowserDaemon {
167
167
  `--disable-extensions-except=${extensionPath}`,
168
168
  `--load-extension=${extensionPath}`
169
169
  );
170
- console.log(`[BrowserDaemon] Loading ChromeDebug extension from: ${extensionPath}`);
170
+ console.error(`[BrowserDaemon] Loading ChromeDebug extension from: ${extensionPath}`);
171
171
  } else {
172
- console.warn('[BrowserDaemon] ChromeDebug extension not found. Visual selection features will be unavailable.');
172
+ console.error('[BrowserDaemon] ChromeDebug extension not found. Visual selection features will be unavailable.');
173
173
  }
174
174
 
175
175
  const launchOptions = {
@@ -182,7 +182,7 @@ export class BrowserDaemon {
182
182
  userDataDir: await this.createSharedUserDataDir()
183
183
  };
184
184
 
185
- console.log(`[BrowserDaemon] Launching Chrome with debugging port ${this.config.daemonPort}`);
185
+ console.error(`[BrowserDaemon] Launching Chrome with debugging port ${this.config.daemonPort}`);
186
186
  return await puppeteer.launch(launchOptions);
187
187
  }
188
188
 
@@ -196,7 +196,7 @@ export class BrowserDaemon {
196
196
  const sharedUserDataDir = path.join(tmpDir, sharedDirName);
197
197
 
198
198
  await fs.mkdir(sharedUserDataDir, { recursive: true });
199
- console.log(`[BrowserDaemon] Created shared user data directory: ${sharedUserDataDir}`);
199
+ console.error(`[BrowserDaemon] Created shared user data directory: ${sharedUserDataDir}`);
200
200
 
201
201
  return sharedUserDataDir;
202
202
  }
@@ -262,7 +262,7 @@ export class BrowserDaemon {
262
262
  lastActivity: sessionData.lastActivity
263
263
  });
264
264
 
265
- console.log(`[BrowserDaemon] Allocated session ${sessionId} for Claude instance ${claudeInstanceId}`);
265
+ console.error(`[BrowserDaemon] Allocated session ${sessionId} for Claude instance ${claudeInstanceId}`);
266
266
 
267
267
  return {
268
268
  success: true,
@@ -290,7 +290,7 @@ export class BrowserDaemon {
290
290
  */
291
291
  async deallocateSession(sessionId) {
292
292
  if (!sessionId || !this.activeSessions.has(sessionId)) {
293
- console.warn(`[BrowserDaemon] Attempted to deallocate non-existent session: ${sessionId}`);
293
+ console.error(`[BrowserDaemon] Attempted to deallocate non-existent session: ${sessionId}`);
294
294
  return false;
295
295
  }
296
296
 
@@ -311,7 +311,7 @@ export class BrowserDaemon {
311
311
  // Remove from persistent registry
312
312
  await this.sessionRegistry.removeSession(sessionId);
313
313
 
314
- console.log(`[BrowserDaemon] Deallocated session ${sessionId}`);
314
+ console.error(`[BrowserDaemon] Deallocated session ${sessionId}`);
315
315
  return true;
316
316
  } catch (error) {
317
317
  console.error(`[BrowserDaemon] Error deallocating session ${sessionId}:`, error);
@@ -369,7 +369,7 @@ export class BrowserDaemon {
369
369
  }
370
370
 
371
371
  this.healthCheckTimer = setInterval(this.performHealthCheck, this.config.healthCheckInterval);
372
- console.log(`[BrowserDaemon] Started health check with ${this.config.healthCheckInterval}ms interval`);
372
+ console.error(`[BrowserDaemon] Started health check with ${this.config.healthCheckInterval}ms interval`);
373
373
  }
374
374
 
375
375
  /**
@@ -381,7 +381,7 @@ export class BrowserDaemon {
381
381
  try {
382
382
  // Check browser health - log status but don't restart
383
383
  if (!this.browser || this.browser.process()?.killed) {
384
- console.warn('[BrowserDaemon] Browser process is down. Claude can launch a new browser when needed.');
384
+ console.error('[BrowserDaemon] Browser process is down. Claude can launch a new browser when needed.');
385
385
  // Don't restart - let Claude handle recovery via MCP tools
386
386
  return;
387
387
  }
@@ -399,12 +399,12 @@ export class BrowserDaemon {
399
399
 
400
400
  // Clean up expired sessions
401
401
  for (const sessionId of expiredSessions) {
402
- console.log(`[BrowserDaemon] Cleaning up expired session: ${sessionId}`);
402
+ console.error(`[BrowserDaemon] Cleaning up expired session: ${sessionId}`);
403
403
  await this.deallocateSession(sessionId);
404
404
  }
405
405
 
406
406
  if (expiredSessions.length > 0) {
407
- console.log(`[BrowserDaemon] Cleaned up ${expiredSessions.length} expired sessions`);
407
+ console.error(`[BrowserDaemon] Cleaned up ${expiredSessions.length} expired sessions`);
408
408
  }
409
409
 
410
410
  } catch (error) {
@@ -437,7 +437,7 @@ export class BrowserDaemon {
437
437
  if (this.isShuttingDown) return;
438
438
 
439
439
  this.isShuttingDown = true;
440
- console.log('[BrowserDaemon] Initiating graceful shutdown...');
440
+ console.error('[BrowserDaemon] Initiating graceful shutdown...');
441
441
 
442
442
  try {
443
443
  // Stop health checks
@@ -447,7 +447,7 @@ export class BrowserDaemon {
447
447
  }
448
448
 
449
449
  // Clean up all active sessions
450
- console.log(`[BrowserDaemon] Cleaning up ${this.activeSessions.size} active sessions...`);
450
+ console.error(`[BrowserDaemon] Cleaning up ${this.activeSessions.size} active sessions...`);
451
451
  for (const sessionId of this.activeSessions.keys()) {
452
452
  await this.deallocateSession(sessionId);
453
453
  }
@@ -462,7 +462,7 @@ export class BrowserDaemon {
462
462
  await this.cleanup();
463
463
 
464
464
  this.isRunning = false;
465
- console.log('[BrowserDaemon] Graceful shutdown completed');
465
+ console.error('[BrowserDaemon] Graceful shutdown completed');
466
466
  } catch (error) {
467
467
  console.error('[BrowserDaemon] Error during graceful shutdown:', error);
468
468
  }
@@ -157,7 +157,7 @@ export class GitSafetyService {
157
157
  backupInfo.created = true;
158
158
  } else {
159
159
  // Fallback to file copy if git stash fails
160
- console.warn('Git stash failed, falling back to file copy:', gitBackup.error);
160
+ console.error('Git stash failed, falling back to file copy:', gitBackup.error);
161
161
  const fileBackup = await this._createFileCopyBackup(projectPath, operationId);
162
162
  backupInfo.strategy = 'file-copy';
163
163
  backupInfo.backupPath = fileBackup.backupPath;
@@ -502,7 +502,7 @@ export class GitSafetyService {
502
502
  mkdirSync(destDir, { recursive: true });
503
503
  copyFileSync(file, destPath);
504
504
  } catch (copyError) {
505
- console.warn(`Failed to copy file ${file}:`, copyError.message);
505
+ console.error(`Failed to copy file ${file}:`, copyError.message);
506
506
  }
507
507
  }
508
508
 
@@ -670,6 +670,6 @@ export class GitSafetyService {
670
670
  // Clean up any temporary resources
671
671
  this.activeBackups.clear();
672
672
  this.operationHistory = [];
673
- console.log('GitSafetyService cleanup completed');
673
+ console.error('GitSafetyService cleanup completed');
674
674
  }
675
675
  }
@@ -41,7 +41,7 @@ export class HeartbeatManager {
41
41
  };
42
42
 
43
43
  this.heartbeats.set(sessionId, heartbeatData);
44
- console.log(`[HeartbeatManager] Started heartbeat for session ${sessionId}`);
44
+ console.error(`[HeartbeatManager] Started heartbeat for session ${sessionId}`);
45
45
  }
46
46
 
47
47
  /**
@@ -53,7 +53,7 @@ export class HeartbeatManager {
53
53
  if (heartbeatData) {
54
54
  clearInterval(heartbeatData.interval);
55
55
  this.heartbeats.delete(sessionId);
56
- console.log(`[HeartbeatManager] Stopped heartbeat for session ${sessionId}`);
56
+ console.error(`[HeartbeatManager] Stopped heartbeat for session ${sessionId}`);
57
57
  }
58
58
  }
59
59
 
@@ -75,9 +75,9 @@ export class HeartbeatManager {
75
75
  const heartbeatData = this.heartbeats.get(sessionId);
76
76
  if (heartbeatData) {
77
77
  heartbeatData.lastUpdate = new Date();
78
- console.log(`[HeartbeatManager] Manual heartbeat update for session ${sessionId}`);
78
+ console.error(`[HeartbeatManager] Manual heartbeat update for session ${sessionId}`);
79
79
  } else {
80
- console.warn(`[HeartbeatManager] Cannot update heartbeat for unknown session ${sessionId}`);
80
+ console.error(`[HeartbeatManager] Cannot update heartbeat for unknown session ${sessionId}`);
81
81
  }
82
82
  }
83
83
 
@@ -108,7 +108,7 @@ export class HeartbeatManager {
108
108
  }
109
109
 
110
110
  if (staleSessionIds.length > 0) {
111
- console.log(`[HeartbeatManager] Found ${staleSessionIds.length} stale heartbeats:`, staleSessionIds);
111
+ console.error(`[HeartbeatManager] Found ${staleSessionIds.length} stale heartbeats:`, staleSessionIds);
112
112
  }
113
113
 
114
114
  return staleSessionIds;
@@ -152,7 +152,7 @@ export class HeartbeatManager {
152
152
  * Stops all heartbeats (cleanup method)
153
153
  */
154
154
  stopAllHeartbeats() {
155
- console.log(`[HeartbeatManager] Stopping all heartbeats (${this.heartbeats.size} sessions)`);
155
+ console.error(`[HeartbeatManager] Stopping all heartbeats (${this.heartbeats.size} sessions)`);
156
156
 
157
157
  for (const [sessionId, heartbeatData] of this.heartbeats.entries()) {
158
158
  clearInterval(heartbeatData.interval);
@@ -173,7 +173,7 @@ export class HeartbeatManager {
173
173
  }
174
174
 
175
175
  if (staleSessionIds.length > 0) {
176
- console.log(`[HeartbeatManager] Auto-cleaned ${staleSessionIds.length} stale heartbeats`);
176
+ console.error(`[HeartbeatManager] Auto-cleaned ${staleSessionIds.length} stale heartbeats`);
177
177
  }
178
178
 
179
179
  return staleSessionIds;
@@ -67,7 +67,7 @@ async function findChromePilotProcesses() {
67
67
  // This allows the server to start on Windows without crashing
68
68
  // TODO: Implement proper Windows process management using tasklist or Node.js process handles
69
69
  if (process.platform === 'win32') {
70
- console.log('[ChromeDebug] Process cleanup skipped on Windows (not yet implemented)');
70
+ console.error('[ChromeDebug] Process cleanup skipped on Windows (not yet implemented)');
71
71
  return { pidsToKill: [], processDescriptions: [] };
72
72
  }
73
73
 
@@ -27,7 +27,7 @@ function getSessionId() {
27
27
  export function setSessionId(sessionId) {
28
28
  if (typeof sessionId === 'string' && sessionId.match(/^[a-zA-Z0-9_-]+$/)) {
29
29
  currentSessionId = sessionId;
30
- console.log(`ChromeDebug session ID set to: ${sessionId}`);
30
+ console.error(`ChromeDebug session ID set to: ${sessionId}`);
31
31
  } else {
32
32
  throw new Error('Session ID must be alphanumeric with dashes/underscores only');
33
33
  }
@@ -126,7 +126,7 @@ export function registerProcess(pid, type = 'unknown') {
126
126
  });
127
127
 
128
128
  writePidFile(data);
129
- console.log(`Registered ChromeDebug process: PID ${validatedPid} (${type})`);
129
+ console.error(`Registered ChromeDebug process: PID ${validatedPid} (${type})`);
130
130
  return true;
131
131
  }
132
132
 
@@ -145,7 +145,7 @@ export function unregisterProcess(pid) {
145
145
 
146
146
  if (data.processes.length < initialLength) {
147
147
  writePidFile(data);
148
- console.log(`Unregistered ChromeDebug process: PID ${validatedPid}`);
148
+ console.error(`Unregistered ChromeDebug process: PID ${validatedPid}`);
149
149
  return true;
150
150
  }
151
151
 
@@ -190,7 +190,7 @@ export function cleanupDeadProcesses() {
190
190
  if (isProcessRunning(proc.pid)) {
191
191
  aliveProcesses.push(proc);
192
192
  } else {
193
- console.log(`Removing dead process from tracking: PID ${proc.pid} (${proc.type})`);
193
+ console.error(`Removing dead process from tracking: PID ${proc.pid} (${proc.type})`);
194
194
  removedCount++;
195
195
  }
196
196
  }
@@ -198,7 +198,7 @@ export function cleanupDeadProcesses() {
198
198
  if (removedCount > 0) {
199
199
  data.processes = aliveProcesses;
200
200
  writePidFile(data);
201
- console.log(`Cleaned up ${removedCount} dead processes from tracking`);
201
+ console.error(`Cleaned up ${removedCount} dead processes from tracking`);
202
202
  }
203
203
 
204
204
  return removedCount;
@@ -223,7 +223,7 @@ export async function killRegisteredProcess(pid, signal = 'SIGTERM') {
223
223
 
224
224
  try {
225
225
  process.kill(validatedPid, signal);
226
- console.log(`Sent ${signal} to registered ChromeDebug process: PID ${validatedPid}`);
226
+ console.error(`Sent ${signal} to registered ChromeDebug process: PID ${validatedPid}`);
227
227
 
228
228
  // If successful and using SIGKILL, unregister immediately
229
229
  if (signal === 'SIGKILL') {
@@ -258,11 +258,11 @@ export async function killAllRegisteredProcesses() {
258
258
  };
259
259
 
260
260
  if (processes.length === 0) {
261
- console.log('No registered ChromeDebug processes to kill');
261
+ console.error('No registered ChromeDebug processes to kill');
262
262
  return results;
263
263
  }
264
264
 
265
- console.log(`Found ${processes.length} registered ChromeDebug processes, cleaning up...`);
265
+ console.error(`Found ${processes.length} registered ChromeDebug processes, cleaning up...`);
266
266
 
267
267
  // First try SIGTERM for graceful shutdown
268
268
  for (const proc of processes) {
@@ -276,7 +276,7 @@ export async function killAllRegisteredProcesses() {
276
276
 
277
277
  // Wait for graceful shutdown
278
278
  if (results.failed.length > 0) {
279
- console.log('Waiting 2 seconds for graceful shutdown...');
279
+ console.error('Waiting 2 seconds for graceful shutdown...');
280
280
  await new Promise(resolve => setTimeout(resolve, 2000));
281
281
 
282
282
  // Try SIGKILL for remaining processes
@@ -390,20 +390,20 @@ export async function killUntrackedChromePilotProcesses() {
390
390
  };
391
391
 
392
392
  if (untrackedProcesses.length === 0) {
393
- console.log('No untracked ChromeDebug processes found');
393
+ console.error('No untracked ChromeDebug processes found');
394
394
  return results;
395
395
  }
396
396
 
397
- console.log(`Found ${untrackedProcesses.length} untracked ChromeDebug processes:`);
397
+ console.error(`Found ${untrackedProcesses.length} untracked ChromeDebug processes:`);
398
398
  untrackedProcesses.forEach(proc => {
399
- console.log(` - ${proc.description}`);
399
+ console.error(` - ${proc.description}`);
400
400
  });
401
401
 
402
402
  // Try SIGTERM first
403
403
  for (const proc of untrackedProcesses) {
404
404
  try {
405
405
  process.kill(proc.pid, 'SIGTERM');
406
- console.log(`Sent SIGTERM to untracked process: PID ${proc.pid}`);
406
+ console.error(`Sent SIGTERM to untracked process: PID ${proc.pid}`);
407
407
  results.killed.push(proc.pid);
408
408
  } catch (error) {
409
409
  if (error.code === 'ESRCH') {
@@ -418,7 +418,7 @@ export async function killUntrackedChromePilotProcesses() {
418
418
 
419
419
  // Wait for graceful shutdown
420
420
  if (results.failed.length > 0) {
421
- console.log('Waiting 2 seconds for graceful shutdown...');
421
+ console.error('Waiting 2 seconds for graceful shutdown...');
422
422
  await new Promise(resolve => setTimeout(resolve, 2000));
423
423
 
424
424
  // Try SIGKILL for remaining processes
@@ -426,7 +426,7 @@ export async function killUntrackedChromePilotProcesses() {
426
426
  for (const pid of results.failed) {
427
427
  try {
428
428
  process.kill(pid, 'SIGKILL');
429
- console.log(`Sent SIGKILL to stubborn process: PID ${pid}`);
429
+ console.error(`Sent SIGKILL to stubborn process: PID ${pid}`);
430
430
  // Move from failed to killed
431
431
  const index = results.failed.indexOf(pid);
432
432
  results.failed.splice(index, 1);
@@ -464,7 +464,7 @@ export function setupProcessTracking(type = 'mcp-server') {
464
464
  // Set up robust cleanup on process exit
465
465
  const cleanup = (reason = 'unknown') => {
466
466
  try {
467
- console.log(`Process ${currentPid} exiting (${reason}), cleaning up...`);
467
+ console.error(`Process ${currentPid} exiting (${reason}), cleaning up...`);
468
468
  unregisterProcess(currentPid);
469
469
  } catch (error) {
470
470
  console.error(`Error during process cleanup: ${error.message}`);
@@ -496,7 +496,7 @@ export function setupProcessTracking(type = 'mcp-server') {
496
496
  process.exit(1);
497
497
  });
498
498
 
499
- console.log(`Process tracking setup complete for PID ${currentPid} (${type}) [Session: ${getSessionId()}]`);
499
+ console.error(`Process tracking setup complete for PID ${currentPid} (${type}) [Session: ${getSessionId()}]`);
500
500
  return currentPid;
501
501
  }
502
502
 
@@ -518,15 +518,15 @@ export function setupProcessTrackingWithOptions(type = 'mcp-server', options = {
518
518
  const currentSessionId = getSessionId();
519
519
 
520
520
  if (verbose) {
521
- console.log(`ChromeDebug MCP starting with session ID: ${currentSessionId}`);
522
- console.log(`Skip cleanup: ${skipCleanup}`);
521
+ console.error(`ChromeDebug MCP starting with session ID: ${currentSessionId}`);
522
+ console.error(`Skip cleanup: ${skipCleanup}`);
523
523
  }
524
524
 
525
525
  // Optionally skip cleanup of dead processes
526
526
  if (!skipCleanup) {
527
527
  const removedCount = cleanupDeadProcesses();
528
528
  if (removedCount > 0 && verbose) {
529
- console.log(`Cleaned up ${removedCount} dead processes from session ${currentSessionId}`);
529
+ console.error(`Cleaned up ${removedCount} dead processes from session ${currentSessionId}`);
530
530
  }
531
531
  }
532
532
 
@@ -554,7 +554,7 @@ export function getSessionInfo() {
554
554
  */
555
555
  export async function cleanupCurrentSession() {
556
556
  const sessionId = getSessionId();
557
- console.log(`Cleaning up session: ${sessionId}`);
557
+ console.error(`Cleaning up session: ${sessionId}`);
558
558
 
559
559
  // Kill all processes in this session
560
560
  const results = await killAllRegisteredProcesses();
@@ -564,7 +564,7 @@ export async function cleanupCurrentSession() {
564
564
  try {
565
565
  if (fs.existsSync(pidFilePath)) {
566
566
  fs.unlinkSync(pidFilePath);
567
- console.log(`Removed session PID file: ${pidFilePath}`);
567
+ console.error(`Removed session PID file: ${pidFilePath}`);
568
568
  }
569
569
  } catch (error) {
570
570
  console.error(`Failed to remove PID file: ${error.message}`);
@@ -32,7 +32,7 @@ export class ProfileManager {
32
32
  ...options
33
33
  };
34
34
 
35
- console.log(`[ProfileManager] Initialized with profiles directory: ${this.profilesDir}`);
35
+ console.error(`[ProfileManager] Initialized with profiles directory: ${this.profilesDir}`);
36
36
  }
37
37
 
38
38
  /**
@@ -49,7 +49,7 @@ export class ProfileManager {
49
49
  await this.cleanupOrphanedProfiles();
50
50
 
51
51
  this.initialized = true;
52
- console.log('[ProfileManager] Initialized successfully');
52
+ console.error('[ProfileManager] Initialized successfully');
53
53
  } catch (error) {
54
54
  console.error('[ProfileManager] Initialization failed:', error);
55
55
  throw error;
@@ -143,7 +143,7 @@ export class ProfileManager {
143
143
 
144
144
  this.activeProfiles.set(sessionId, profileInfo);
145
145
 
146
- console.log(`[ProfileManager] Created profile for session ${sessionId}: ${resolvedProfilePath}`);
146
+ console.error(`[ProfileManager] Created profile for session ${sessionId}: ${resolvedProfilePath}`);
147
147
  return resolvedProfilePath;
148
148
  } catch (error) {
149
149
  console.error(`[ProfileManager] Failed to create profile for session ${sessionId}:`, error);
@@ -152,7 +152,7 @@ export class ProfileManager {
152
152
  const profilePath = path.join(this.profilesDir, `session-${sessionId}`);
153
153
  await fs.rm(profilePath, { recursive: true, force: true });
154
154
  } catch (cleanupError) {
155
- console.warn('[ProfileManager] Failed to cleanup partial profile:', cleanupError);
155
+ console.error('[ProfileManager] Failed to cleanup partial profile:', cleanupError);
156
156
  }
157
157
  throw error;
158
158
  }
@@ -227,7 +227,7 @@ export class ProfileManager {
227
227
  const localStatePath = path.join(profilePath, 'Local State');
228
228
  await fs.writeFile(localStatePath, JSON.stringify(localState, null, 2));
229
229
 
230
- console.log(`[ProfileManager] Created profile configuration for session ${sessionId}`);
230
+ console.error(`[ProfileManager] Created profile configuration for session ${sessionId}`);
231
231
  }
232
232
 
233
233
  /**
@@ -237,7 +237,7 @@ export class ProfileManager {
237
237
  */
238
238
  async cleanupProfile(sessionId) {
239
239
  if (!sessionId || !this.activeProfiles.has(sessionId)) {
240
- console.warn(`[ProfileManager] Attempted to cleanup non-existent profile: ${sessionId}`);
240
+ console.error(`[ProfileManager] Attempted to cleanup non-existent profile: ${sessionId}`);
241
241
  return false;
242
242
  }
243
243
 
@@ -256,9 +256,9 @@ export class ProfileManager {
256
256
  // Calculate profile size for logging
257
257
  try {
258
258
  const stats = await this.calculateDirectorySize(profilePath);
259
- console.log(`[ProfileManager] Profile ${sessionId} size: ${(stats.size / 1024 / 1024).toFixed(2)}MB (${stats.files} files)`);
259
+ console.error(`[ProfileManager] Profile ${sessionId} size: ${(stats.size / 1024 / 1024).toFixed(2)}MB (${stats.files} files)`);
260
260
  } catch (sizeError) {
261
- console.warn('[ProfileManager] Could not calculate profile size:', sizeError);
261
+ console.error('[ProfileManager] Could not calculate profile size:', sizeError);
262
262
  }
263
263
 
264
264
  // Remove profile directory
@@ -267,7 +267,7 @@ export class ProfileManager {
267
267
  // Remove from active profiles
268
268
  this.activeProfiles.delete(sessionId);
269
269
 
270
- console.log(`[ProfileManager] Cleaned up profile for session ${sessionId}`);
270
+ console.error(`[ProfileManager] Cleaned up profile for session ${sessionId}`);
271
271
  return true;
272
272
  } catch (error) {
273
273
  console.error(`[ProfileManager] Error cleaning up profile for session ${sessionId}:`, error);
@@ -287,12 +287,12 @@ export class ProfileManager {
287
287
  throw new Error(`Total profiles size (${totalSizeMB.toFixed(2)}MB) exceeds limit (${this.config.maxTotalProfilesMB}MB)`);
288
288
  }
289
289
 
290
- console.log(`[ProfileManager] Current profiles size: ${totalSizeMB.toFixed(2)}MB / ${this.config.maxTotalProfilesMB}MB`);
290
+ console.error(`[ProfileManager] Current profiles size: ${totalSizeMB.toFixed(2)}MB / ${this.config.maxTotalProfilesMB}MB`);
291
291
  } catch (error) {
292
292
  if (error.message.includes('exceeds limit')) {
293
293
  throw error;
294
294
  }
295
- console.warn('[ProfileManager] Could not check space quota:', error);
295
+ console.error('[ProfileManager] Could not check space quota:', error);
296
296
  }
297
297
  }
298
298
 
@@ -317,7 +317,7 @@ export class ProfileManager {
317
317
 
318
318
  return totalSize;
319
319
  } catch (error) {
320
- console.warn('[ProfileManager] Error calculating total profiles size:', error);
320
+ console.error('[ProfileManager] Error calculating total profiles size:', error);
321
321
  return 0;
322
322
  }
323
323
  }
@@ -377,18 +377,18 @@ export class ProfileManager {
377
377
  if (age > this.config.profileCleanupAgeMs) {
378
378
  await fs.rm(sessionDirPath, { recursive: true, force: true });
379
379
  cleanedCount++;
380
- console.log(`[ProfileManager] Cleaned up orphaned profile: ${sessionDir}`);
380
+ console.error(`[ProfileManager] Cleaned up orphaned profile: ${sessionDir}`);
381
381
  }
382
382
  } catch (error) {
383
- console.warn(`[ProfileManager] Error processing orphaned profile ${sessionDir}:`, error);
383
+ console.error(`[ProfileManager] Error processing orphaned profile ${sessionDir}:`, error);
384
384
  }
385
385
  }
386
386
 
387
387
  if (cleanedCount > 0) {
388
- console.log(`[ProfileManager] Cleaned up ${cleanedCount} orphaned profiles`);
388
+ console.error(`[ProfileManager] Cleaned up ${cleanedCount} orphaned profiles`);
389
389
  }
390
390
  } catch (error) {
391
- console.warn('[ProfileManager] Error during orphaned profile cleanup:', error);
391
+ console.error('[ProfileManager] Error during orphaned profile cleanup:', error);
392
392
  }
393
393
  }
394
394
 
@@ -436,7 +436,7 @@ export class ProfileManager {
436
436
  * Cleanup method for graceful shutdown
437
437
  */
438
438
  async cleanup() {
439
- console.log('[ProfileManager] Cleaning up active profiles...');
439
+ console.error('[ProfileManager] Cleaning up active profiles...');
440
440
 
441
441
  // Clean up all active profiles
442
442
  const sessionIds = Array.from(this.activeProfiles.keys());
@@ -444,6 +444,6 @@ export class ProfileManager {
444
444
  await this.cleanupProfile(sessionId);
445
445
  }
446
446
 
447
- console.log('[ProfileManager] Cleanup completed');
447
+ console.error('[ProfileManager] Cleanup completed');
448
448
  }
449
449
  }