@tiflis-io/tiflis-code-workstation 0.3.18 → 0.3.20
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/dist/main.js +11 -60
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1503,6 +1503,10 @@ var TunnelClient = class {
|
|
|
1503
1503
|
disconnect() {
|
|
1504
1504
|
this.clearTimers();
|
|
1505
1505
|
if (this.ws) {
|
|
1506
|
+
this.ws.removeAllListeners("open");
|
|
1507
|
+
this.ws.removeAllListeners("message");
|
|
1508
|
+
this.ws.removeAllListeners("close");
|
|
1509
|
+
this.ws.removeAllListeners("error");
|
|
1506
1510
|
this.ws.close();
|
|
1507
1511
|
this.ws = null;
|
|
1508
1512
|
}
|
|
@@ -2758,6 +2762,7 @@ var TerminalSession = class extends Session {
|
|
|
2758
2762
|
if (this._status === "terminated") {
|
|
2759
2763
|
return;
|
|
2760
2764
|
}
|
|
2765
|
+
this._outputCallbacks.clear();
|
|
2761
2766
|
return new Promise((resolve2) => {
|
|
2762
2767
|
const timeout = setTimeout(() => {
|
|
2763
2768
|
this._pty.kill("SIGKILL");
|
|
@@ -5065,21 +5070,7 @@ var MessageBroadcasterImpl = class {
|
|
|
5065
5070
|
* connected to the tunnel and will re-authenticate soon.
|
|
5066
5071
|
*/
|
|
5067
5072
|
broadcastToAll(message) {
|
|
5068
|
-
|
|
5069
|
-
const authenticatedCount = clients.filter((c) => c.isAuthenticated).length;
|
|
5070
|
-
this.logger.info(
|
|
5071
|
-
{
|
|
5072
|
-
totalClients: clients.length,
|
|
5073
|
-
authenticatedClients: authenticatedCount,
|
|
5074
|
-
messagePreview: message.slice(0, 100)
|
|
5075
|
-
},
|
|
5076
|
-
"broadcastToAll called"
|
|
5077
|
-
);
|
|
5078
|
-
const sent = this.deps.tunnelClient.send(message);
|
|
5079
|
-
this.logger.info(
|
|
5080
|
-
{ sent, authenticatedClients: authenticatedCount },
|
|
5081
|
-
"Broadcast to all - message sent to tunnel"
|
|
5082
|
-
);
|
|
5073
|
+
this.deps.tunnelClient.send(message);
|
|
5083
5074
|
}
|
|
5084
5075
|
/**
|
|
5085
5076
|
* Broadcasts a message to all clients subscribed to a session.
|
|
@@ -5091,15 +5082,7 @@ var MessageBroadcasterImpl = class {
|
|
|
5091
5082
|
(c) => c.isAuthenticated
|
|
5092
5083
|
).length;
|
|
5093
5084
|
if (authenticatedCount > 0) {
|
|
5094
|
-
|
|
5095
|
-
this.logger.debug(
|
|
5096
|
-
{
|
|
5097
|
-
sessionId: sessionId.value,
|
|
5098
|
-
sent,
|
|
5099
|
-
authenticatedSubscribers: authenticatedCount
|
|
5100
|
-
},
|
|
5101
|
-
"Broadcast to session"
|
|
5102
|
-
);
|
|
5085
|
+
this.deps.tunnelClient.send(message);
|
|
5103
5086
|
}
|
|
5104
5087
|
}
|
|
5105
5088
|
/**
|
|
@@ -5113,17 +5096,6 @@ var MessageBroadcasterImpl = class {
|
|
|
5113
5096
|
* but not yet re-authenticated with the workstation
|
|
5114
5097
|
*/
|
|
5115
5098
|
sendToClient(deviceId, message) {
|
|
5116
|
-
const device = new DeviceId(deviceId);
|
|
5117
|
-
const client = this.deps.clientRegistry.getByDeviceId(device);
|
|
5118
|
-
this.logger.info(
|
|
5119
|
-
{
|
|
5120
|
-
deviceId,
|
|
5121
|
-
clientInRegistry: !!client,
|
|
5122
|
-
clientAuthenticated: client?.isAuthenticated,
|
|
5123
|
-
messagePreview: message.slice(0, 100)
|
|
5124
|
-
},
|
|
5125
|
-
"sendToClient - sending via tunnel (supports HTTP polling clients)"
|
|
5126
|
-
);
|
|
5127
5099
|
return this.deps.tunnelClient.sendToDevice(deviceId, message);
|
|
5128
5100
|
}
|
|
5129
5101
|
/**
|
|
@@ -5136,37 +5108,12 @@ var MessageBroadcasterImpl = class {
|
|
|
5136
5108
|
const authenticatedSubscribers = subscribers.filter(
|
|
5137
5109
|
(c) => c.isAuthenticated
|
|
5138
5110
|
);
|
|
5139
|
-
const allClients = this.deps.clientRegistry.getAll();
|
|
5140
|
-
this.logger.info(
|
|
5141
|
-
{
|
|
5142
|
-
sessionId,
|
|
5143
|
-
totalClients: allClients.length,
|
|
5144
|
-
totalSubscribers: subscribers.length,
|
|
5145
|
-
authenticatedSubscribers: authenticatedSubscribers.length,
|
|
5146
|
-
clientsInfo: allClients.map((c) => ({
|
|
5147
|
-
deviceId: c.deviceId.value,
|
|
5148
|
-
isAuthenticated: c.isAuthenticated,
|
|
5149
|
-
isConnected: c.isConnected,
|
|
5150
|
-
status: c.status,
|
|
5151
|
-
subscriptions: c.getSubscriptions()
|
|
5152
|
-
}))
|
|
5153
|
-
},
|
|
5154
|
-
"broadcastToSubscribers - client state"
|
|
5155
|
-
);
|
|
5156
5111
|
if (authenticatedSubscribers.length === 0) {
|
|
5157
|
-
this.logger.warn(
|
|
5158
|
-
{ sessionId, totalClients: allClients.length },
|
|
5159
|
-
"broadcastToSubscribers - no authenticated subscribers found"
|
|
5160
|
-
);
|
|
5161
5112
|
return;
|
|
5162
5113
|
}
|
|
5163
5114
|
for (const client of authenticatedSubscribers) {
|
|
5164
5115
|
this.deps.tunnelClient.sendToDevice(client.deviceId.value, message);
|
|
5165
5116
|
}
|
|
5166
|
-
this.logger.debug(
|
|
5167
|
-
{ sessionId, subscriberCount: authenticatedSubscribers.length },
|
|
5168
|
-
"Broadcast to subscribers - messages sent"
|
|
5169
|
-
);
|
|
5170
5117
|
}
|
|
5171
5118
|
};
|
|
5172
5119
|
|
|
@@ -11353,6 +11300,10 @@ async function bootstrap() {
|
|
|
11353
11300
|
try {
|
|
11354
11301
|
logger.info("Disconnecting from tunnel...");
|
|
11355
11302
|
tunnelClient.disconnect();
|
|
11303
|
+
logger.info("Removing event listeners...");
|
|
11304
|
+
agentSessionManager.removeAllListeners();
|
|
11305
|
+
supervisorAgent.removeAllListeners();
|
|
11306
|
+
sessionManager.removeAllListeners();
|
|
11356
11307
|
logger.info("Cleaning up agent sessions...");
|
|
11357
11308
|
agentSessionManager.cleanup();
|
|
11358
11309
|
logger.info("Terminating all sessions...");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiflis-io/tiflis-code-workstation",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"description": "Workstation server for tiflis-code - manages agent sessions and terminal access",
|
|
5
5
|
"author": "Roman Barinov <rbarinov@gmail.com>",
|
|
6
6
|
"license": "FSL-1.1-NC",
|