Compare commits

..
Author SHA1 Message Date
Lotus CIandClaude Opus 5.5 a1dd0e254c fix(lotus): a homeserver stall shorter than the delayed-leave window no longer ends the call (#46)
CI / Build embedded bundle (pull_request) Successful in 3m33s
CI / Publish to Gitea npm registry (pull_request) Skipped
maximumNetworkErrorRetryCount was sized to min(sync grace period,
leave delay), i.e. 10 s, so the membership manager gave up 20-35 s into
a homeserver stall and showed "Connection lost", even when the server
would keep the membership for 60 s (prod config). Size it to the leave
delay instead: the embedded call has no /sync loop for the grace period
to describe, and the server's delayed leave is what actually ends the
membership.

Fixes #46

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-18 02:47:36 -04:00
Lotus CIandClaude Opus 5.5 58625c86b0 chore(lotus): 0.25.0-lotus.24
CI / Build embedded bundle (push) Successful in 3m14s
CI / Publish to Gitea npm registry (push) Successful in 1m19s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-17 20:47:48 -04:00
jared e3ac9a96d6 Merge pull request 'feat(lotus): report the frame's audio outputs to the host (cinny #310)' (#49) from fix/audio-output-list into lotus
CI / Build embedded bundle (push) Canceled after 0s
CI / Publish to Gitea npm registry (push) Canceled after 0s
2026-10-17 20:45:10 -04:00
Lotus CIandClaude Opus 5.5 34d541b707 feat(lotus): report the frame's audio outputs to the host (cinny #310)
CI / Build embedded bundle (pull_request) Successful in 3m28s
CI / Publish to Gitea npm registry (pull_request) Skipped
Browsers hash deviceIds per frame/origin, so ids from the host's own
enumerateDevices() are unknown in here and select() fell back to the
default. io.lotus.audio_output_state now also carries
available: [{id,label}] (frame-valid ids), so the host's call-bar menu
can offer real choices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-17 19:48:33 -04:00
Lotus CIandClaude Opus 5.5 eb59fd5b3f chore(lotus): 0.25.0-lotus.23
CI / Build embedded bundle (push) Successful in 2m51s
CI / Publish to Gitea npm registry (push) Successful in 1m9s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-17 17:53:24 -04:00
jared fea233f5e1 Merge pull request 'feat(lotus): sendNotificationType=none turns the call-start notification off (cinny #295)' (#48) from lotus-notify-none into lotus
CI / Build embedded bundle (push) Successful in 3m18s
CI / Publish to Gitea npm registry (push) Skipped
2026-10-16 23:13:46 -04:00
Lotus CIandClaude Opus 5.5 93905c5bc1 feat(lotus): sendNotificationType=none turns the call-start notification off (cinny #295)
CI / Build embedded bundle (pull_request) Successful in 3m55s
CI / Publish to Gitea npm registry (pull_request) Skipped
The widget intent presets default sendNotificationType to "notification",
and the URL param could only switch it to ring/notification, so the host
had no way to say "don't notify". In persistent voice channels and space
rooms that notification carries an @room mention: every member got a
highlighted ping (and phone push) whenever a moderator joined first, and
other clients showed it as a missed call.

`sendNotificationType=none` now clears it after the presets are applied.
Unit test added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-16 22:06:12 -04:00
6 changed files with 96 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@lotusguild/element-call-embedded",
"version": "0.25.0-lotus.22",
"version": "0.25.0-lotus.24",
"files": [
"README.md",
"LICENSE-AGPL-3.0",
+13
View File
@@ -305,6 +305,19 @@ describe("UrlParams", () => {
});
});
it("[lotus] sendNotificationType=none turns the preset notification off", () => {
expect(
computeUrlParams(
"?intent=start_call&widgetId=1234&parentUrl=parent.org&sendNotificationType=none",
).sendNotificationType,
).toBeUndefined();
expect(
computeUrlParams(
"?intent=start_call&widgetId=1234&parentUrl=parent.org",
).sendNotificationType,
).toBe("notification");
});
it("accepts join_existing", () => {
expect(
computeUrlParams(
+8
View File
@@ -523,6 +523,14 @@ export const computeUrlParams = (search = "", hash = ""): UrlParams => {
...properties,
...intentPreset,
...pickBy(configuration, (v?: unknown) => v !== undefined),
// [lotus] `sendNotificationType=none` turns the intent preset's
// notification off. The host passes it for persistent voice channels and
// space rooms, where a call start must not @room-ping every member
// (LotusGuild/cinny#295). pickBy above drops undefined, so it can't be
// expressed as a plain override.
...(parser.getParam("sendNotificationType") === "none"
? { sendNotificationType: undefined }
: {}),
};
};
+24
View File
@@ -0,0 +1,24 @@
/*
Copyright 2026 Lotus Guild
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { expect, test } from "vitest";
import { audioOutputList } from "./lotusAudioOutput";
import { type AudioOutputDeviceLabel } from "../state/MediaDevices";
test("audioOutputList labels every kind of output (cinny #310)", () => {
const m = new Map<string, AudioOutputDeviceLabel>([
["", { type: "default", name: "Speakers" }],
["a1", { type: "name", name: "Headset" }],
["a2", { type: "number", number: 3 }],
]);
expect(audioOutputList(m)).toEqual([
{ id: "", label: "Default (Speakers)" },
{ id: "a1", label: "Headset" },
{ id: "a2", label: "Output 3" },
]);
});
+41 -2
View File
@@ -8,7 +8,12 @@ Please see LICENSE in the repository root for full details.
import { type IWidgetApiRequest } from "matrix-widget-api";
import { logger } from "matrix-js-sdk/lib/logger";
import { type MediaDevices } from "../state/MediaDevices";
import { combineLatest } from "rxjs";
import {
type AudioOutputDeviceLabel,
type MediaDevices,
} from "../state/MediaDevices";
import { widget } from "../widget";
import { LotusWidgetActions } from "./lotusActions";
import { lotusSendToHost } from "./lotusWidget";
@@ -19,6 +24,10 @@ import { lotusSendToHost } from "./lotusWidget";
* selects the output; the fork answers each change (and the initial state)
* with `io.lotus.audio_output_state { deviceId, available: [{id,label}] }`.
* No effect unless the host sends the action. Returns a teardown function.
*
* [cinny #310] Browsers hash deviceIds per frame/origin, so the host can't
* use ids from its own enumerateDevices(); it builds its menu from
* `available` here, whose ids are valid in this frame.
*/
export function startLotusAudioOutput(mediaDevices: MediaDevices): () => void {
const w = widget;
@@ -33,9 +42,13 @@ export function startLotusAudioOutput(mediaDevices: MediaDevices): () => void {
};
w.lazyActions.on(LotusWidgetActions.SetAudioOutput, handler);
const sub = mediaDevices.audioOutput.selected$.subscribe((selected) => {
const sub = combineLatest([
mediaDevices.audioOutput.available$,
mediaDevices.audioOutput.selected$,
]).subscribe(([available, selected]) => {
lotusSendToHost(LotusWidgetActions.AudioOutputState, {
deviceId: selected?.id ?? null,
available: audioOutputList(available),
});
});
@@ -44,3 +57,29 @@ export function startLotusAudioOutput(mediaDevices: MediaDevices): () => void {
w.lazyActions.off(LotusWidgetActions.SetAudioOutput, handler);
};
}
/** The output list as `{id, label}` for the host's menu (#310). */
export function audioOutputList(
available: Map<string, AudioOutputDeviceLabel>,
): { id: string; label: string }[] {
return [...available].map(([id, l]) => {
let label: string;
switch (l.type) {
case "name":
label = l.name;
break;
case "number":
label = `Output ${l.number}`;
break;
case "default":
label = l.name ? `Default (${l.name})` : "Default";
break;
case "speaker":
label = "Speaker";
break;
default:
label = "Earpiece";
}
return { id, label };
});
}
@@ -868,16 +868,19 @@ export function enterRTCSession(
};
}
// Calculates `maximumNetworkErrorRetryCount`. The connection is failed if EITHER:
// - The /sync loop is unresponsive for > `gracePeriod` ms, or
// - A delayed leave event is emitted (after `leaveDelay` ms period).
// Note: Use leaveDelay >> gracePeriod for delegated leave events.
// Calculates `maximumNetworkErrorRetryCount`: enough retries to outlast the
// server's delayed-leave window (see [lotus #46] below).
const gracePeriod = Config.get().sync_disconnect_grace_period_ms;
const leaveDelay = matrixRtcSessionConfig?.delayed_leave_event_delay_ms;
const retryInterval = matrixRtcSessionConfig?.network_error_retry_ms;
// Math.min is used to account for the respective worst case: /sync not available or leave event emitted.
const maxWaitTime = Math.min(gracePeriod, leaveDelay);
// [lotus #46] Keep retrying for as long as the homeserver itself would keep
// our membership: until its delayed leave fires (`leaveDelay`). Capping at
// the 10 s sync grace period made a ~20–35 s homeserver stall end everyone's
// call ("Connection lost") even with a 60 s server-side leave delay. The
// embedded call has no /sync loop of its own, so the grace period doesn't
// describe anything it can observe.
const maxWaitTime = Math.max(gracePeriod, leaveDelay);
const maximumNetworkErrorRetryCount =
Math.ceil(maxWaitTime / retryInterval) + 1;