shell-mirror 1.5.106 → 1.5.107
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/mac-agent/agent.js +3 -0
- package/package.json +1 -1
- package/public/app/terminal.html +1 -1
- package/public/app/terminal.js +18 -1
package/mac-agent/agent.js
CHANGED
|
@@ -989,6 +989,9 @@ function setupDataChannel(clientId) {
|
|
|
989
989
|
availableSessions: sessionManager.getAllSessions()
|
|
990
990
|
}));
|
|
991
991
|
|
|
992
|
+
// Send immediate heartbeat to update dashboard
|
|
993
|
+
sendHeartbeat();
|
|
994
|
+
|
|
992
995
|
logToFile(`[AGENT] ✅ Session closed: ${message.sessionId}`);
|
|
993
996
|
}
|
|
994
997
|
} catch (err) {
|
package/package.json
CHANGED
package/public/app/terminal.html
CHANGED
package/public/app/terminal.js
CHANGED
|
@@ -1098,7 +1098,16 @@ function doCloseSession(sessionId) {
|
|
|
1098
1098
|
// If closing current session, switch to another or show message
|
|
1099
1099
|
if (currentSession && currentSession.id === sessionId) {
|
|
1100
1100
|
if (availableSessions.length > 0) {
|
|
1101
|
-
|
|
1101
|
+
// Update currentSession IMMEDIATELY so renderTabs shows correct active tab
|
|
1102
|
+
const nextSession = availableSessions[0];
|
|
1103
|
+
currentSession = {
|
|
1104
|
+
id: nextSession.id,
|
|
1105
|
+
name: nextSession.name || 'Terminal Session'
|
|
1106
|
+
};
|
|
1107
|
+
// Tell agent to switch (will send session-switched confirmation)
|
|
1108
|
+
switchToSession(nextSession.id);
|
|
1109
|
+
// Update URL
|
|
1110
|
+
updateUrlWithSession(nextSession.id);
|
|
1102
1111
|
} else {
|
|
1103
1112
|
currentSession = null;
|
|
1104
1113
|
term.clear();
|
|
@@ -1258,6 +1267,14 @@ function handleSessionMessage(message) {
|
|
|
1258
1267
|
term.write(`\r\n\x1b[31m❌ Session terminated\x1b[0m\r\n`);
|
|
1259
1268
|
term.write('🔄 Click Dashboard to start a new session\r\n');
|
|
1260
1269
|
break;
|
|
1270
|
+
case 'session-closed':
|
|
1271
|
+
console.log('[CLIENT] ✅ Session closed confirmed:', message.sessionId);
|
|
1272
|
+
// Update available sessions from server response
|
|
1273
|
+
if (message.availableSessions) {
|
|
1274
|
+
availableSessions = message.availableSessions;
|
|
1275
|
+
renderTabs();
|
|
1276
|
+
}
|
|
1277
|
+
break;
|
|
1261
1278
|
case 'error':
|
|
1262
1279
|
term.write(`\r\n\x1b[31m❌ Error: ${message.message}\x1b[0m\r\n`);
|
|
1263
1280
|
break;
|