shell-mirror 1.5.44 → 1.5.45
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 +18 -6
- package/package.json +1 -1
package/mac-agent/agent.js
CHANGED
|
@@ -200,12 +200,7 @@ class SessionManager {
|
|
|
200
200
|
session.lastActivity = Date.now();
|
|
201
201
|
|
|
202
202
|
logToFile(`[SESSION] ✅ Client ${clientId} connected to session ${sessionId}`);
|
|
203
|
-
|
|
204
|
-
// Send buffered output to newly connected client
|
|
205
|
-
const bufferedOutput = session.buffer.getAll();
|
|
206
|
-
if (bufferedOutput) {
|
|
207
|
-
this.sendToClient(clientId, { type: 'output', data: bufferedOutput });
|
|
208
|
-
}
|
|
203
|
+
logToFile(`[SESSION] ℹ️ Buffered output will be sent when WebRTC data channel opens`);
|
|
209
204
|
|
|
210
205
|
return true;
|
|
211
206
|
}
|
|
@@ -636,6 +631,23 @@ function cleanup(clientId = null) {
|
|
|
636
631
|
function setupDataChannel(clientId) {
|
|
637
632
|
dataChannel.onopen = () => {
|
|
638
633
|
logToFile('[AGENT] ✅ Data channel is open!');
|
|
634
|
+
|
|
635
|
+
// Send buffered output for existing session when data channel opens
|
|
636
|
+
const session = sessionManager.getClientSession(clientId);
|
|
637
|
+
if (session) {
|
|
638
|
+
const bufferedOutput = session.buffer.getAll();
|
|
639
|
+
if (bufferedOutput) {
|
|
640
|
+
logToFile(`[AGENT] 📤 Sending buffered output to client (${bufferedOutput.length} chars)`);
|
|
641
|
+
try {
|
|
642
|
+
dataChannel.send(JSON.stringify({ type: 'output', data: bufferedOutput }));
|
|
643
|
+
logToFile('[AGENT] ✅ Buffered output sent successfully');
|
|
644
|
+
} catch (err) {
|
|
645
|
+
logToFile(`[AGENT] ❌ Error sending buffered output: ${err.message}`);
|
|
646
|
+
}
|
|
647
|
+
} else {
|
|
648
|
+
logToFile('[AGENT] ℹ️ No buffered output to send for this session');
|
|
649
|
+
}
|
|
650
|
+
}
|
|
639
651
|
};
|
|
640
652
|
|
|
641
653
|
dataChannel.onmessage = (event) => {
|
package/package.json
CHANGED