gossipcat 0.6.3 → 0.6.4
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-mcp/mcp-server.js +32 -1
- package/package.json +1 -1
package/dist-mcp/mcp-server.js
CHANGED
|
@@ -44398,6 +44398,19 @@ var init_api_bridge = __esm({
|
|
|
44398
44398
|
// emitReply STILL gates on knownChatIds, so mirroring never widens the
|
|
44399
44399
|
// outbound reply boundary (api-bridge.ts emitReply isKnownChatId check).
|
|
44400
44400
|
mirrorChatIds = /* @__PURE__ */ new Map();
|
|
44401
|
+
// The most-recently-registered active mirror chat_id (set in
|
|
44402
|
+
// registerMirrorChatId, cleared/recomputed when that id is TTL-evicted).
|
|
44403
|
+
// Used by emitMirror to route unresolved terminal frames to a live observer
|
|
44404
|
+
// instead of the provisional buffer when one exists (fix: mirror frames
|
|
44405
|
+
// previously fell into _provisional and were dropped by the dashboard client
|
|
44406
|
+
// because bindSession never ran — the browser cannot send a session_id it
|
|
44407
|
+
// doesn't know). SECURITY: only ever a chat_id already in mirrorChatIds.
|
|
44408
|
+
// KNOWN LIMITATION (consensus 96350953-8ce94428): single-pointer, so with
|
|
44409
|
+
// multiple concurrent dashboard tabs only the most-recently-registered one
|
|
44410
|
+
// receives unresolved terminal frames; earlier tabs see no live activity until
|
|
44411
|
+
// they send again. Accepted tradeoff — a strict improvement over the prior
|
|
44412
|
+
// behaviour where the frames went to _provisional and EVERY tab saw nothing.
|
|
44413
|
+
latestMirrorChatId = null;
|
|
44401
44414
|
// Session→chat_id map (P1#5). The relay has no native "active session
|
|
44402
44415
|
// chat_id" notion — a no-chat_id inbound POST mints a fresh UUID. We learn the
|
|
44403
44416
|
// mapping from the dashboard turn: a turn carries BOTH a chat_id (validated)
|
|
@@ -44581,6 +44594,8 @@ var init_api_bridge = __esm({
|
|
|
44581
44594
|
chatId = resolved;
|
|
44582
44595
|
} else if (this.dropUnresolvedMirror) {
|
|
44583
44596
|
return { status: 202, payload: { ok: true, chat_id: null, dropped: validated.length } };
|
|
44597
|
+
} else if (this.latestMirrorChatId !== null && this.isMirrorChatId(this.latestMirrorChatId)) {
|
|
44598
|
+
chatId = this.latestMirrorChatId;
|
|
44584
44599
|
} else {
|
|
44585
44600
|
chatId = _BridgeHub.PROVISIONAL_CHAT_ID;
|
|
44586
44601
|
}
|
|
@@ -44801,6 +44816,7 @@ var init_api_bridge = __esm({
|
|
|
44801
44816
|
if (oldestKey !== null) this.mirrorChatIds.delete(oldestKey);
|
|
44802
44817
|
}
|
|
44803
44818
|
this.mirrorChatIds.set(chatId, now);
|
|
44819
|
+
this.latestMirrorChatId = chatId;
|
|
44804
44820
|
if (isNew) this.backfillProvisional(chatId, now);
|
|
44805
44821
|
}
|
|
44806
44822
|
/**
|
|
@@ -44821,8 +44837,23 @@ var init_api_bridge = __esm({
|
|
|
44821
44837
|
return this.mirrorChatIds.has(chatId);
|
|
44822
44838
|
}
|
|
44823
44839
|
evictMirrorChatIds(now) {
|
|
44840
|
+
let evictedLatest = false;
|
|
44824
44841
|
for (const [k, v] of this.mirrorChatIds) {
|
|
44825
|
-
if (now - v > _BridgeHub.CHAT_ID_TTL_MS)
|
|
44842
|
+
if (now - v > _BridgeHub.CHAT_ID_TTL_MS) {
|
|
44843
|
+
this.mirrorChatIds.delete(k);
|
|
44844
|
+
if (k === this.latestMirrorChatId) evictedLatest = true;
|
|
44845
|
+
}
|
|
44846
|
+
}
|
|
44847
|
+
if (evictedLatest) {
|
|
44848
|
+
let newestKey = null;
|
|
44849
|
+
let newest = -Infinity;
|
|
44850
|
+
for (const [k, v] of this.mirrorChatIds) {
|
|
44851
|
+
if (v > newest) {
|
|
44852
|
+
newest = v;
|
|
44853
|
+
newestKey = k;
|
|
44854
|
+
}
|
|
44855
|
+
}
|
|
44856
|
+
this.latestMirrorChatId = newestKey;
|
|
44826
44857
|
}
|
|
44827
44858
|
}
|
|
44828
44859
|
/**
|
package/package.json
CHANGED