refacil-sdd-ai 2.8.1 → 2.8.2
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/bus/broker.js +7 -1
- package/package.json +1 -1
package/lib/bus/broker.js
CHANGED
|
@@ -205,6 +205,7 @@ function handleJoin(state, ws, data) {
|
|
|
205
205
|
|
|
206
206
|
// Si la sesión ya existe en otra sala, sacarla primero
|
|
207
207
|
const existing = state.sessions.get(session);
|
|
208
|
+
const isReturningToSameRoom = !!(existing && existing.room === room);
|
|
208
209
|
if (existing && existing.room && existing.room !== room) {
|
|
209
210
|
leaveRoom(state, session);
|
|
210
211
|
}
|
|
@@ -212,8 +213,13 @@ function handleJoin(state, ws, data) {
|
|
|
212
213
|
const meta = existing || {};
|
|
213
214
|
meta.repo = repo || meta.repo || null;
|
|
214
215
|
meta.room = room;
|
|
215
|
-
meta.lastSeen = nowIso();
|
|
216
216
|
meta.watchOnly = false;
|
|
217
|
+
// Primer join o cambio de sala → lastSeen = ahora (sin backlog).
|
|
218
|
+
// Reingreso a la misma sala tras desconectar → preservar lastSeen existente
|
|
219
|
+
// para que /inbox traiga los mensajes perdidos mientras estuvo fuera.
|
|
220
|
+
if (!isReturningToSameRoom || !meta.lastSeen) {
|
|
221
|
+
meta.lastSeen = nowIso();
|
|
222
|
+
}
|
|
217
223
|
if (!meta.wss) meta.wss = new Set();
|
|
218
224
|
state.sessions.set(session, meta);
|
|
219
225
|
ws._refacilSession = session;
|
package/package.json
CHANGED