@ai-matrx/meet 0.11.53 → 0.11.54

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/react.js CHANGED
@@ -2277,6 +2277,10 @@ function personOf(identity) {
2277
2277
  const cut = value.indexOf(CONNECTION_SEPARATOR);
2278
2278
  return cut === -1 ? value : value.slice(0, cut);
2279
2279
  }
2280
+ function userIdOfIdentity(identity) {
2281
+ const person = personOf(identity);
2282
+ return person.startsWith("user:") ? person.slice("user:".length) : null;
2283
+ }
2280
2284
  function isGuestIdentity(identity) {
2281
2285
  return personOf(identity).startsWith("guest:");
2282
2286
  }
@@ -5821,21 +5825,35 @@ function heartbeatIntervalMs(roomSize) {
5821
5825
  function staleAfterMs(roomSize) {
5822
5826
  return heartbeatIntervalMs(roomSize) * 3 + 1e3;
5823
5827
  }
5828
+ function firstBeatAllowanceMs(roomSize) {
5829
+ return staleAfterMs(roomSize) * 2;
5830
+ }
5824
5831
  function createLivenessTracker(now) {
5825
5832
  const lastHeard = /* @__PURE__ */ new Map();
5833
+ const firstSeen = /* @__PURE__ */ new Map();
5826
5834
  const beats = /* @__PURE__ */ new Map();
5827
5835
  return {
5828
5836
  heard(who, beat) {
5829
5837
  lastHeard.set(who, now());
5838
+ firstSeen.delete(who);
5830
5839
  if (beat !== null) beats.set(who, beat);
5831
5840
  },
5841
+ expect(who) {
5842
+ if (!lastHeard.has(who) && !firstSeen.has(who)) firstSeen.set(who, now());
5843
+ },
5832
5844
  stale(present, roomSize) {
5833
5845
  const limit = staleAfterMs(roomSize);
5846
+ const firstLimit = firstBeatAllowanceMs(roomSize);
5834
5847
  const at = now();
5835
5848
  const out = /* @__PURE__ */ new Set();
5836
5849
  for (const who of present) {
5837
5850
  const heard = lastHeard.get(who);
5838
- if (heard !== void 0 && at - heard > limit) out.add(who);
5851
+ if (heard !== void 0) {
5852
+ if (at - heard > limit) out.add(who);
5853
+ continue;
5854
+ }
5855
+ const seen = firstSeen.get(who);
5856
+ if (seen !== void 0 && at - seen > firstLimit) out.add(who);
5839
5857
  }
5840
5858
  return out;
5841
5859
  },
@@ -5843,13 +5861,16 @@ function createLivenessTracker(now) {
5843
5861
  restartClock() {
5844
5862
  const at = now();
5845
5863
  for (const who of lastHeard.keys()) lastHeard.set(who, at);
5864
+ for (const who of firstSeen.keys()) firstSeen.set(who, at);
5846
5865
  },
5847
5866
  forget(who) {
5848
5867
  lastHeard.delete(who);
5868
+ firstSeen.delete(who);
5849
5869
  beats.delete(who);
5850
5870
  },
5851
5871
  clear() {
5852
5872
  lastHeard.clear();
5873
+ firstSeen.clear();
5853
5874
  beats.clear();
5854
5875
  }
5855
5876
  };
@@ -6615,6 +6636,13 @@ function createRoomEngine(options) {
6615
6636
  const previous = new Map(liveRoster.map((p) => [p.identity, p]));
6616
6637
  const present = new Set(list.map((p) => p.identity));
6617
6638
  const graceMs = connectionPolicy.reconnectGraceSeconds * 1e3;
6639
+ if (store.snapshot().phase === "in_call") {
6640
+ for (const [who, last] of previous) {
6641
+ if (last.isLocal || present.has(who) || departures.has(who)) continue;
6642
+ departures.set(who, null);
6643
+ report("warn", `meet: ${who} vanished from the room's roster with no departure event; held as reconnecting`, "The media layer dropped a participant silently; the tile is kept for the reconnect grace.");
6644
+ }
6645
+ }
6618
6646
  for (const [who, reason] of departures) {
6619
6647
  const last = previous.get(who);
6620
6648
  const dropped = !saidBye.has(who) && (isUnannouncedDeparture(reason) || silent.has(who));
@@ -6630,6 +6658,9 @@ function createRoomEngine(options) {
6630
6658
  }
6631
6659
  departures.clear();
6632
6660
  liveRoster = list;
6661
+ for (const p of list) {
6662
+ if (!p.isLocal && (isGuestIdentity(p.identity) || userIdOfIdentity(p.identity) !== null)) liveness.expect(p.identity);
6663
+ }
6633
6664
  const localNow = list.find((p) => p.isLocal);
6634
6665
  if (localNow !== void 0 && !localNow.screenSharing && store.snapshot().share.state === "presenting") {
6635
6666
  store.patch({ share: NO_SHARE });
@@ -6650,7 +6681,7 @@ function createRoomEngine(options) {
6650
6681
  store.setParticipants(
6651
6682
  [...people.values()].map(({ entry }) => {
6652
6683
  const projected = projectParticipant(entry, joinedAt);
6653
- if (entry.reconnecting === true || !entry.isLocal && silent.has(entry.identity)) {
6684
+ if (entry.reconnecting === true || !entry.isLocal && silent.has(entry.identity) && !saidBye.has(entry.identity)) {
6654
6685
  return { ...projected, reconnecting: true, quality: "lost" };
6655
6686
  }
6656
6687
  const videoPaused = entry.isLocal ? store.snapshot().localNetwork.videoPaused : liveness.reported(entry.identity)?.vp === true;