shell-mirror 1.5.31 → 1.5.33
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/lib/auto-start.js +10 -5
- package/package.json +1 -1
package/lib/auto-start.js
CHANGED
|
@@ -449,10 +449,10 @@ WS_URL=${wsConfig.wsUrl}` : ''}
|
|
|
449
449
|
|
|
450
450
|
try {
|
|
451
451
|
// Register this agent with the cloud backend
|
|
452
|
-
await this.registerAsMacAgent(authInfo);
|
|
452
|
+
const agentId = await this.registerAsMacAgent(authInfo);
|
|
453
453
|
|
|
454
454
|
// Start the terminal agent with cloud WebSocket connection
|
|
455
|
-
await this.startTerminalAgent(authInfo);
|
|
455
|
+
await this.startTerminalAgent(authInfo, agentId);
|
|
456
456
|
|
|
457
457
|
} catch (error) {
|
|
458
458
|
console.error('❌ Failed to start Shell Mirror:', error.message);
|
|
@@ -465,8 +465,10 @@ WS_URL=${wsConfig.wsUrl}` : ''}
|
|
|
465
465
|
console.log(` User: ${authInfo.email}`);
|
|
466
466
|
console.log(` Machine: ${os.hostname()}`);
|
|
467
467
|
|
|
468
|
+
// Generate agent ID outside try block so it's always available
|
|
469
|
+
const agentId = `local-${os.hostname()}-${Date.now()}`;
|
|
470
|
+
|
|
468
471
|
try {
|
|
469
|
-
const agentId = `local-${os.hostname()}-${Date.now()}`;
|
|
470
472
|
const registrationData = {
|
|
471
473
|
agentId: agentId,
|
|
472
474
|
ownerEmail: authInfo.email,
|
|
@@ -530,9 +532,11 @@ WS_URL=${wsConfig.wsUrl}` : ''}
|
|
|
530
532
|
console.log(` Error details: ${error.stack}`);
|
|
531
533
|
console.log(' Server will run locally only');
|
|
532
534
|
}
|
|
535
|
+
|
|
536
|
+
return agentId; // Return the agent ID for use in startTerminalAgent
|
|
533
537
|
}
|
|
534
538
|
|
|
535
|
-
async startTerminalAgent(authInfo) {
|
|
539
|
+
async startTerminalAgent(authInfo, agentId) {
|
|
536
540
|
console.log('');
|
|
537
541
|
console.log('🔄 Starting terminal agent with cloud WebSocket connection...');
|
|
538
542
|
|
|
@@ -547,7 +551,8 @@ WS_URL=${wsConfig.wsUrl}` : ''}
|
|
|
547
551
|
USER_NAME: authInfo.name,
|
|
548
552
|
ACCESS_TOKEN: authInfo.accessToken,
|
|
549
553
|
WEBSOCKET_URL: 'wss://shell-mirror-30aa5479ceaf.herokuapp.com',
|
|
550
|
-
CONNECTION_TYPE: 'cloud-websocket'
|
|
554
|
+
CONNECTION_TYPE: 'cloud-websocket',
|
|
555
|
+
AGENT_ID: agentId
|
|
551
556
|
};
|
|
552
557
|
|
|
553
558
|
console.log('🌐 Connecting to: wss://shell-mirror-30aa5479ceaf.herokuapp.com');
|
package/package.json
CHANGED