2026-06-29 23:10:16 -04:00
|
|
|
/*
|
|
|
|
|
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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Custom widget actions exchanged between the Lotus host (cinny) and this fork.
|
|
|
|
|
* Kept dependency-free so both `widget.ts` and `lotus/*` can import it without
|
|
|
|
|
* a circular dependency.
|
|
|
|
|
*/
|
|
|
|
|
export enum LotusWidgetActions {
|
2026-06-29 23:14:42 -04:00
|
|
|
/**
|
|
|
|
|
* fromWidget: in-call per-participant speaking / mute state.
|
|
|
|
|
* NOTE: matrix-widget-api `transport.send` is request/response — the host
|
2026-06-30 00:15:59 -04:00
|
|
|
* MUST register a handler that replies/acks each one (cinny's `listenAction`
|
|
|
|
|
* does, replying `{}`). If the host has no handler, ClientWidgetApi
|
|
|
|
|
* immediately error-replies "unsupported from-widget action", so the data is
|
|
|
|
|
* silently dropped and each throttled send rejects (caught) — functional miss
|
|
|
|
|
* + log churn, not a hang.
|
2026-06-29 23:14:42 -04:00
|
|
|
*/
|
2026-06-29 23:10:16 -04:00
|
|
|
CallState = "io.lotus.call_state",
|
|
|
|
|
/** toWidget: pin/spotlight (or clear, with userId=null) a participant. */
|
|
|
|
|
FocusParticipant = "io.lotus.focus_participant",
|
2026-06-29 23:26:45 -04:00
|
|
|
/** toWidget: play an audio clip into the call as a separate published track. */
|
2026-06-29 23:10:16 -04:00
|
|
|
InjectAudio = "io.lotus.inject_audio",
|
2026-06-29 23:24:57 -04:00
|
|
|
/** toWidget: set audio/screenshare encoding quality (bitrate/framerate). */
|
|
|
|
|
SetQuality = "io.lotus.set_quality",
|
2026-06-29 23:38:45 -04:00
|
|
|
/** toWidget: per-user avatar-decoration image URLs for in-call tiles. */
|
|
|
|
|
Decorations = "io.lotus.decorations",
|
2026-07-02 14:12:08 -04:00
|
|
|
/** toWidget: deafen remote audio (and optionally mute screenshare audio). */
|
|
|
|
|
SetDeafen = "io.lotus.set_deafen",
|
2026-09-13 01:22:20 -04:00
|
|
|
/**
|
|
|
|
|
* fromWidget: sent on (re)registration of a lotus toWidget handler (e.g.
|
|
|
|
|
* decorations) so the host can re-push state that would otherwise only be
|
|
|
|
|
* sent on change (decorations roster, the current focus pin) after an
|
|
|
|
|
* EC-side reconnect/remount. cinny's `resendForkState()` should respond to
|
|
|
|
|
* this the same way it responds to a fresh join.
|
|
|
|
|
*/
|
|
|
|
|
RequestState = "io.lotus.request_state",
|
|
|
|
|
/**
|
|
|
|
|
* fromWidget: real state of the in-source denoise engine —
|
|
|
|
|
* `{ active: boolean, model: string, error?: string }` — sent once the
|
|
|
|
|
* processor attaches (or after the rnnoise fallback also fails), so the host
|
|
|
|
|
* toggle can reflect reality rather than the requested state.
|
|
|
|
|
*/
|
|
|
|
|
DenoiseState = "io.lotus.denoise_state",
|
2026-09-20 13:39:18 -04:00
|
|
|
/**
|
|
|
|
|
* fromWidget: one-shot end-of-call readout for the local participant —
|
|
|
|
|
* `{ durationMs, reconnects, poorMs, verdict }` (#143) — sent on SFU
|
|
|
|
|
* disconnect or in-call teardown, whichever comes first.
|
|
|
|
|
*/
|
|
|
|
|
CallSummary = "io.lotus.call_summary",
|
2026-09-20 15:31:33 -04:00
|
|
|
/** toWidget: select the audio output device `{ deviceId }` (#119). */
|
|
|
|
|
SetAudioOutput = "io.lotus.set_audio_output",
|
|
|
|
|
/** fromWidget: the currently selected output `{ deviceId }` (#119). */
|
|
|
|
|
AudioOutputState = "io.lotus.audio_output_state",
|
2026-09-20 15:44:22 -04:00
|
|
|
/**
|
|
|
|
|
* fromWidget: local screenshare reminder `{ kind: "ended" | "no-frames" | "alone" }`
|
|
|
|
|
* — window closed, no frames for 15 s, or 30 min of sharing with nobody
|
|
|
|
|
* else in the call (#39). Each fires at most once per share.
|
|
|
|
|
*/
|
|
|
|
|
ScreenshareNotice = "io.lotus.screenshare_notice",
|
2026-09-24 22:16:24 -04:00
|
|
|
/**
|
|
|
|
|
* toWidget: switch the call layout `{ layout: "grid" | "spotlight" }`
|
|
|
|
|
* (cinny #43 — replaces the host clicking EC's hidden layout radio).
|
|
|
|
|
*/
|
|
|
|
|
SetLayout = "io.lotus.set_layout",
|
|
|
|
|
/**
|
|
|
|
|
* toWidget: open EC's settings modal, or close it with `{ open: false }`;
|
|
|
|
|
* omit `open` to toggle (cinny #43).
|
|
|
|
|
*/
|
|
|
|
|
OpenSettings = "io.lotus.open_settings",
|
|
|
|
|
/** toWidget: toggle the reactions / raise-hand menu (cinny #43). */
|
|
|
|
|
ToggleReactions = "io.lotus.toggle_reactions",
|
|
|
|
|
/**
|
2026-09-26 12:49:58 -04:00
|
|
|
* toWidget: start/stop sharing `{ on?: boolean }` (omit to toggle; cinny #43).
|
|
|
|
|
* Starting calls getDisplayMedia, which needs the user's click: the host
|
|
|
|
|
* sends this with Capability Delegation (`delegate: "display-capture"`), and
|
|
|
|
|
* without it the browser rejects the share.
|
|
|
|
|
*/
|
|
|
|
|
SetScreenshare = "io.lotus.set_screenshare",
|
|
|
|
|
/**
|
|
|
|
|
* fromWidget: `{ screensharing: boolean, layout: "grid" | "spotlight" | null,
|
|
|
|
|
* screenshareAction: true }`
|
2026-09-24 22:16:24 -04:00
|
|
|
* whenever either changes (cinny #43), so the host stops reading EC's DOM for
|
|
|
|
|
* them. Its arrival also tells the host this fork supports the actions above.
|
|
|
|
|
*/
|
|
|
|
|
ControlsState = "io.lotus.controls_state",
|
2026-09-25 12:08:57 -04:00
|
|
|
/**
|
|
|
|
|
* fromWidget: local mic level `{ bars: 0 | 1 | 2 | 3 }` (cinny #146), sent
|
|
|
|
|
* only when it changes (≤ 10 Hz); 0 while muted or with no mic.
|
|
|
|
|
*/
|
|
|
|
|
MicLevel = "io.lotus.mic_level",
|
2026-06-29 23:10:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** toWidget Lotus actions that must be allow-listed in `initializeWidget`. */
|
|
|
|
|
export const LOTUS_TO_WIDGET_ACTIONS: LotusWidgetActions[] = [
|
|
|
|
|
LotusWidgetActions.FocusParticipant,
|
|
|
|
|
LotusWidgetActions.InjectAudio,
|
2026-06-29 23:24:57 -04:00
|
|
|
LotusWidgetActions.SetQuality,
|
2026-06-29 23:38:45 -04:00
|
|
|
LotusWidgetActions.Decorations,
|
2026-07-02 14:12:08 -04:00
|
|
|
LotusWidgetActions.SetDeafen,
|
2026-09-20 15:31:33 -04:00
|
|
|
LotusWidgetActions.SetAudioOutput,
|
2026-09-24 22:16:24 -04:00
|
|
|
LotusWidgetActions.SetLayout,
|
|
|
|
|
LotusWidgetActions.OpenSettings,
|
|
|
|
|
LotusWidgetActions.ToggleReactions,
|
2026-09-26 12:49:58 -04:00
|
|
|
LotusWidgetActions.SetScreenshare,
|
2026-06-29 23:10:16 -04:00
|
|
|
];
|