@ai-matrx/meet 0.11.51 → 0.11.52

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/CHANGELOG.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Changelog — `@ai-matrx/meet`
2
2
 
3
- ## 0.11.51
3
+ ## 0.11.52
4
4
 
5
5
  Automatic changed-only republish (docs/metadata drift since the last tag — see
6
- `git diff npm/meet/v0.11.50..npm/meet/v0.11.51 -- apps/shared/meet`).
6
+ `git diff npm/meet/v0.11.51..npm/meet/v0.11.52 -- apps/shared/meet`).
7
7
  No source changes intended and no consumer action required.
8
8
 
9
9
  ## 0.11.50
package/dist/core.cjs CHANGED
@@ -4896,6 +4896,16 @@ var ALIVE_TOPIC = "mx.alive";
4896
4896
  function encodeBeat(beat) {
4897
4897
  return JSON.stringify({ q: beat.q, vp: beat.vp });
4898
4898
  }
4899
+ function encodeBye() {
4900
+ return JSON.stringify({ bye: true });
4901
+ }
4902
+ function isBye(payload) {
4903
+ try {
4904
+ return JSON.parse(payload).bye === true;
4905
+ } catch {
4906
+ return false;
4907
+ }
4908
+ }
4899
4909
  function decodeBeat(payload) {
4900
4910
  try {
4901
4911
  const raw = JSON.parse(payload);
@@ -7145,6 +7155,7 @@ function createRoomEngine(options) {
7145
7155
  const autoOff = createVideoAutoOff(() => connectionPolicy.videoAutoOffAfterPoorSeconds * 1e3, now);
7146
7156
  const lkQuality = /* @__PURE__ */ new Map();
7147
7157
  let silent = /* @__PURE__ */ new Set();
7158
+ const saidBye = /* @__PURE__ */ new Set();
7148
7159
  let healthTimer = null;
7149
7160
  let lastBeatAt = 0;
7150
7161
  let wasUnstable = false;
@@ -7175,6 +7186,7 @@ function createRoomEngine(options) {
7175
7186
  assessor.reset();
7176
7187
  autoOff.reset();
7177
7188
  silent = /* @__PURE__ */ new Set();
7189
+ saidBye.clear();
7178
7190
  lkQuality.clear();
7179
7191
  lastBeatAt = 0;
7180
7192
  wasUnstable = false;
@@ -7232,6 +7244,13 @@ function createRoomEngine(options) {
7232
7244
  await target?.disconnect();
7233
7245
  }
7234
7246
  async function leaveRoom() {
7247
+ const target = driver;
7248
+ if (target !== null && store.snapshot().phase === "in_call") {
7249
+ await Promise.race([
7250
+ target.publishData(ALIVE_TOPIC, encodeBye()).catch(() => void 0),
7251
+ new Promise((resolve) => setTimeout(resolve, 300))
7252
+ ]);
7253
+ }
7235
7254
  store.dispatch({ type: "leave" });
7236
7255
  await dropRoom();
7237
7256
  options.onLeft?.(null);
@@ -7327,8 +7346,6 @@ function createRoomEngine(options) {
7327
7346
  },
7328
7347
  participantLeft(who, reason) {
7329
7348
  departures.set(who, reason);
7330
- liveness.forget(who);
7331
- silent.delete(who);
7332
7349
  },
7333
7350
  roomMetadata(metadata) {
7334
7351
  let parsed = {};
@@ -7371,8 +7388,12 @@ function createRoomEngine(options) {
7371
7388
  const snap = store.snapshot();
7372
7389
  if (snap.phase !== "in_call" || snap.connection !== "stable") return;
7373
7390
  startHealth();
7391
+ const before = assessor.current();
7374
7392
  const quality = assessor.push(reading);
7375
7393
  const path = pathOf(reading);
7394
+ if (quality !== before) {
7395
+ report("info", `meet: this connection reads ${quality} (round trip ${reading.rttMs ?? "?"} ms, path ${path})`, "Diagnostic only.");
7396
+ }
7376
7397
  patchLocalNetwork({ quality, ...path !== "unknown" ? { path } : {} });
7377
7398
  refreshQualities();
7378
7399
  const cameraOn = snap.media.camera.enabled;
@@ -7387,6 +7408,11 @@ function createRoomEngine(options) {
7387
7408
  connectionState(state) {
7388
7409
  supervisor.driverState(state);
7389
7410
  if (state === "connected" && store.snapshot().phase === "joining") store.dispatch({ type: "connected" });
7411
+ if (state === "connected") {
7412
+ startHealth();
7413
+ lastBeatAt = 0;
7414
+ healthTick();
7415
+ }
7390
7416
  },
7391
7417
  transcription(event) {
7392
7418
  const snapshot = store.snapshot();
@@ -7478,6 +7504,10 @@ function createRoomEngine(options) {
7478
7504
  }
7479
7505
  const sender = personOf(from ?? "");
7480
7506
  if (from !== null) {
7507
+ if (topic === ALIVE_TOPIC && isBye(payload)) {
7508
+ saidBye.add(from);
7509
+ return;
7510
+ }
7481
7511
  const beat = topic === ALIVE_TOPIC ? decodeBeat(payload) : null;
7482
7512
  const before = liveness.reported(from);
7483
7513
  liveness.heard(from, beat);
@@ -7710,10 +7740,17 @@ function createRoomEngine(options) {
7710
7740
  const graceMs = connectionPolicy.reconnectGraceSeconds * 1e3;
7711
7741
  for (const [who, reason] of departures) {
7712
7742
  const last = previous.get(who);
7713
- if (last !== void 0 && !last.isLocal && !present.has(who) && graceMs > 0 && isUnannouncedDeparture(reason)) {
7743
+ const dropped = !saidBye.has(who) && (isUnannouncedDeparture(reason) || silent.has(who));
7744
+ report("info", `meet: ${who} left the room (${reason ?? "no reason"}${dropped ? ", held as reconnecting" : ""})`, "Diagnostic only.");
7745
+ if (last !== void 0 && !last.isLocal && !present.has(who) && graceMs > 0 && dropped) {
7714
7746
  ghosts.set(who, { participant: last, until: at + graceMs });
7715
7747
  }
7716
7748
  }
7749
+ for (const who of departures.keys()) {
7750
+ liveness.forget(who);
7751
+ silent.delete(who);
7752
+ saidBye.delete(who);
7753
+ }
7717
7754
  departures.clear();
7718
7755
  liveRoster = list;
7719
7756
  const localNow = list.find((p) => p.isLocal);