feat: complete Ancestor quote bot with production-ready Docker support

This commit is contained in:
unfunny
2026-09-13 14:14:38 -04:00
parent f2016da05a
commit fe7351a7dc
1145 changed files with 30890 additions and 97684 deletions

View File

@@ -1,24 +1,21 @@
import { EventTimelineSet, type EventTimelineSetHandlerMap, type IAddLiveEventOptions } from "./event-timeline-set.ts";
import { EventTimeline } from "./event-timeline.ts";
import { MatrixEvent, MatrixEventEvent, type MatrixEventHandlerMap } from "./event.ts";
import { EventStatus } from "./event-status.ts";
import { RoomMember } from "./room-member.ts";
import { type IRoomSummary, RoomSummary } from "./room-summary.ts";
import { TypedReEmitter } from "../ReEmitter.ts";
import { EventType, RoomType } from "../@types/event.ts";
import { type MatrixClient, PendingEventOrdering } from "../client.ts";
import { type GuestAccess, type HistoryVisibility, type JoinRule, type ResizeMethod } from "../@types/partials.ts";
import { Filter } from "../filter.ts";
import { type RoomState, RoomStateEvent, type RoomStateEventHandlerMap } from "./room-state.ts";
import { BeaconEvent, type BeaconEventHandlerMap } from "./beacon.ts";
import { Thread, ThreadEvent, type ThreadEventHandlerMap as ThreadHandlerMap } from "./thread.ts";
import { type CachedReceiptStructure, type Receipt } from "../@types/read_receipts.ts";
import { RelationsContainer } from "./relations-container.ts";
import { ReadReceipt } from "./read-receipt.ts";
import { Poll, PollEvent } from "./poll.ts";
import { type Membership } from "../@types/membership.ts";
import { type MSC4186Hero } from "../sliding-sync.ts";
import { RoomStickyEventsStore, RoomStickyEventsEvent, type RoomStickyEventsMap } from "./room-sticky-events.ts";
import { EventTimelineSet, DuplicateStrategy, IAddLiveEventOptions, EventTimelineSetHandlerMap } from "./event-timeline-set";
import { EventTimeline } from "./event-timeline";
import { MatrixEvent, MatrixEventEvent, MatrixEventHandlerMap } from "./event";
import { EventStatus } from "./event-status";
import { RoomMember } from "./room-member";
import { IRoomSummary, RoomSummary } from "./room-summary";
import { TypedReEmitter } from "../ReEmitter";
import { EventType, RoomType } from "../@types/event";
import { MatrixClient, PendingEventOrdering } from "../client";
import { GuestAccess, HistoryVisibility, JoinRule, ResizeMethod } from "../@types/partials";
import { Filter } from "../filter";
import { RoomState, RoomStateEvent, RoomStateEventHandlerMap } from "./room-state";
import { BeaconEvent, BeaconEventHandlerMap } from "./beacon";
import { Thread, ThreadEvent, ThreadEventHandlerMap as ThreadHandlerMap } from "./thread";
import { CachedReceiptStructure, Receipt } from "../@types/read_receipts";
import { RelationsContainer } from "./relations-container";
import { ReadReceipt } from "./read-receipt";
import { Poll, PollEvent } from "./poll";
export declare const KNOWN_SAFE_ROOM_VERSION = "10";
interface IOpts {
/**
@@ -65,10 +62,9 @@ export declare enum RoomEvent {
OldStateUpdated = "Room.OldStateUpdated",
CurrentStateUpdated = "Room.CurrentStateUpdated",
HistoryImportedWithinTimeline = "Room.historyImportedWithinTimeline",
UnreadNotifications = "Room.UnreadNotifications",
Summary = "Room.Summary"
UnreadNotifications = "Room.UnreadNotifications"
}
export type RoomEmittedEvents = RoomEvent | RoomStateEvent.Events | RoomStateEvent.Members | RoomStateEvent.NewMember | RoomStateEvent.Update | RoomStateEvent.Marker | RoomStickyEventsEvent.Update | ThreadEvent.New | ThreadEvent.Update | ThreadEvent.NewReply | ThreadEvent.Delete | MatrixEventEvent.BeforeRedaction | BeaconEvent.New | BeaconEvent.Update | BeaconEvent.Destroy | BeaconEvent.LivenessChange | PollEvent.New;
export type RoomEmittedEvents = RoomEvent | RoomStateEvent.Events | RoomStateEvent.Members | RoomStateEvent.NewMember | RoomStateEvent.Update | RoomStateEvent.Marker | ThreadEvent.New | ThreadEvent.Update | ThreadEvent.NewReply | ThreadEvent.Delete | MatrixEventEvent.BeforeRedaction | BeaconEvent.New | BeaconEvent.Update | BeaconEvent.Destroy | BeaconEvent.LivenessChange | PollEvent.New;
export type RoomEventHandlerMap = {
/**
* Fires when the logged in user's membership in the room is updated.
@@ -77,7 +73,7 @@ export type RoomEventHandlerMap = {
* @param membership - The new membership value
* @param prevMembership - The previous membership value
*/
[RoomEvent.MyMembership]: (room: Room, membership: Membership, prevMembership?: Membership) => void;
[RoomEvent.MyMembership]: (room: Room, membership: string, prevMembership?: string) => void;
/**
* Fires whenever a room's tags are updated.
* @param event - The tags event
@@ -106,7 +102,7 @@ export type RoomEventHandlerMap = {
* });
* ```
*/
[RoomEvent.AccountData]: (event: MatrixEvent, room: Room, prevEvent?: MatrixEvent) => void;
[RoomEvent.AccountData]: (event: MatrixEvent, room: Room, lastEvent?: MatrixEvent) => void;
/**
* Fires whenever a receipt is received for a room
* @param event - The receipt event
@@ -138,9 +134,8 @@ export type RoomEventHandlerMap = {
*
* @param event - The matrix redaction event
* @param room - The room containing the redacted event
* @param threadId - The thread containing the redacted event (before it was redacted)
*/
[RoomEvent.Redaction]: (event: MatrixEvent, room: Room, threadId?: string) => void;
[RoomEvent.Redaction]: (event: MatrixEvent, room: Room) => void;
/**
* Fires when an event that was previously redacted isn't anymore.
* This happens when the redaction couldn't be sent and
@@ -189,21 +184,13 @@ export type RoomEventHandlerMap = {
[RoomEvent.HistoryImportedWithinTimeline]: (markerEvent: MatrixEvent, room: Room) => void;
[RoomEvent.UnreadNotifications]: (unreadNotifications?: NotificationCount, threadId?: string) => void;
[RoomEvent.TimelineRefresh]: (room: Room, eventTimelineSet: EventTimelineSet) => void;
/**
* Fires when a new room summary is returned by `/sync`.
*
* See https://spec.matrix.org/v1.8/client-server-api/#_matrixclientv3sync_roomsummary
* for full details
* @param summary - the room summary object
*/
[RoomEvent.Summary]: (summary: IRoomSummary) => void;
[ThreadEvent.New]: (thread: Thread, toStartOfTimeline: boolean) => void;
/**
* Fires when a new poll instance is added to the room state
* @param poll - the new poll
*/
[PollEvent.New]: (poll: Poll) => void;
} & Pick<ThreadHandlerMap, ThreadEvent.Update | ThreadEvent.NewReply | ThreadEvent.Delete> & EventTimelineSetHandlerMap & Pick<MatrixEventHandlerMap, MatrixEventEvent.BeforeRedaction> & Pick<RoomStickyEventsMap, RoomStickyEventsEvent.Update> & Pick<RoomStateEventHandlerMap, RoomStateEvent.Events | RoomStateEvent.Members | RoomStateEvent.NewMember | RoomStateEvent.Update | RoomStateEvent.Marker | BeaconEvent.New> & Pick<BeaconEventHandlerMap, BeaconEvent.Update | BeaconEvent.Destroy | BeaconEvent.LivenessChange>;
} & Pick<ThreadHandlerMap, ThreadEvent.Update | ThreadEvent.NewReply | ThreadEvent.Delete> & EventTimelineSetHandlerMap & Pick<MatrixEventHandlerMap, MatrixEventEvent.BeforeRedaction> & Pick<RoomStateEventHandlerMap, RoomStateEvent.Events | RoomStateEvent.Members | RoomStateEvent.NewMember | RoomStateEvent.Update | RoomStateEvent.Marker | BeaconEvent.New> & Pick<BeaconEventHandlerMap, BeaconEvent.Update | BeaconEvent.Destroy | BeaconEvent.LivenessChange>;
export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
readonly roomId: string;
readonly client: MatrixClient;
@@ -212,7 +199,6 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
readonly reEmitter: TypedReEmitter<RoomEmittedEvents, RoomEventHandlerMap>;
private txnToEvent;
private notificationCounts;
private bumpStamp;
private readonly threadNotifications;
readonly cachedThreadReadReceipts: Map<string, CachedReceiptStructure[]>;
private oldestThreadedReceiptTs;
@@ -234,17 +220,9 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
private readonly pendingEventList?;
private blacklistUnverifiedDevices?;
private selfMembership?;
/**
* A `Hero` is a stripped `m.room.member` event which contains the important renderable fields from the event.
*
* It is used in MSC4186 (Simplified Sliding Sync) as a replacement for the old `summary` field.
*
* When we are doing old-style (`/v3/sync`) sync, we simulate the SSS behaviour by constructing
* a `Hero` object based on the user id we get from the summary. Obviously, in that case,
* the `Hero` will lack a `displayName` or `avatarUrl`.
*/
private heroes;
private summaryHeroes;
private getTypeWarning;
private getVersionWarning;
private membersPromise?;
/**
* The human-readable display name for this room.
@@ -268,6 +246,13 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* The room summary.
*/
summary: RoomSummary | null;
/**
* The live event timeline for this room, with the oldest event at index 0.
*
* @deprecated Present for backwards compatibility.
* Use getLiveTimeline().getEvents() instead
*/
timeline: MatrixEvent[];
/**
* oldState The state of the room at the time of the oldest event in the live timeline.
*
@@ -288,6 +273,11 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* This is not a comprehensive list of the threads that exist in this room
*/
private threads;
/**
* @deprecated This value is unreliable. It may not contain the last thread.
* Use {@link Room.getLastThread} instead.
*/
lastThread?: Thread;
/**
* A mapping of eventId to all visibility changes to apply
* to the event, by chronological order, as per
@@ -305,16 +295,6 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @experimental
*/
private visibilityEvents;
/**
* The latest receipts (synthetic and real) for each user in each thread
* (and unthreaded).
*/
private roomReceipts;
/**
* Stores and tracks sticky events
*/
private stickyEvents;
private readonly retention?;
/**
* Construct a new Room.
*
@@ -366,9 +346,16 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
getCreator(): string | null;
/**
* Gets the version of the room
* @returns The version of the room
* @returns The version of the room, or null if it could not be determined
*/
getVersion(): string;
/**
* Determines whether this room needs to be upgraded to a new version
* @returns What version the room should be upgraded to, or null if
* the room does not require upgrading at this time.
* @deprecated Use #getRecommendedVersion() instead
*/
shouldUpgradeToVersion(): string | null;
/**
* Determines the recommended room version for the room. This returns an
* object with 3 properties: `version` as the new version the
@@ -422,13 +409,6 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @returns live timeline
*/
getLiveTimeline(): EventTimeline;
/**
* The live event timeline for this room, with the oldest event at index 0.
*
* @deprecated Present for backwards compatibility.
* Use getLiveTimeline().getEvents() instead
*/
get timeline(): MatrixEvent[];
/**
* Get the timestamp of the last message in the room
*
@@ -457,9 +437,9 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
*/
getLastThread(): Thread | undefined;
/**
* @returns the membership type (join | leave | invite | knock) for the logged in user
* @returns the membership type (join | leave | invite) for the logged in user
*/
getMyMembership(): Membership;
getMyMembership(): string;
/**
* If this room is a DM we're invited to,
* try to find out who invited us
@@ -471,21 +451,12 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @returns user id of the other member (could be syncing user)
*/
guessDMUserId(): string;
/**
* Gets the "functional members" in this room.
*
* Returns the list of userIDs from the `io.element.functional_members` event. Does not consider the
* current membership states of those users.
*
* @see https://github.com/element-hq/element-meta/blob/develop/spec/functional_members.md.
*/
private getFunctionalMembers;
getAvatarFallbackMember(): RoomMember | undefined;
/**
* Sets the membership this room was received as during sync
* @param membership - join | leave | invite
*/
updateMyMembership(membership: Membership): void;
updateMyMembership(membership: string): void;
private loadMembersFromServer;
private loadMembers;
/**
@@ -545,8 +516,16 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @internal
*/
private fixUpLegacyTimelineFields;
private onReceipt;
private clearNotificationsOnReceipt;
/**
* Returns whether there are any devices in the room that are unverified
*
* Note: Callers should first check if crypto is enabled on this device. If it is
* disabled, then we aren't tracking room devices at all, so we can't answer this, and an
* error will be thrown.
*
* @returns the result
*/
hasUnverifiedDevices(): Promise<boolean>;
/**
* Return the timeline sets for this room.
* @returns array of timeline sets for this room
@@ -633,32 +612,9 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
*/
get threadsAggregateNotificationType(): NotificationCountType | null;
/**
* Resets the total thread notifications for all threads in this room to zero,
* excluding any threads whose IDs are given in `exceptThreadIds`.
*
* If the room is not encrypted, also resets the highlight notification count to zero
* for the same set of threads.
*
* This is intended for use from the sync code since we calculate highlight notification
* counts locally from decrypted messages. We want to partially trust the total from the
* server such that we clear notifications when read receipts arrive. The weird name is
* intended to reflect this. You probably do not want to use this.
*
* @param exceptThreadIds - The thread IDs to exclude from the reset.
* Resets the thread notifications for this room
*/
resetThreadUnreadNotificationCountFromSync(exceptThreadIds?: string[]): void;
/**
* Set the bump stamp for this room. This can be used for sorting rooms when the timeline
* entries are unknown. Used in MSC4186: Simplified Sliding Sync.
* @param bumpStamp The bump_stamp value from the server
*/
setBumpStamp(bumpStamp: number): void;
/**
* Get the bump stamp for this room. This can be used for sorting rooms when the timeline
* entries are unknown. Used in MSC4186: Simplified Sliding Sync.
* @returns The bump stamp for the room, if it exists.
*/
getBumpStamp(): number | undefined;
resetThreadUnreadNotificationCount(notificationsToKeep?: string[]): void;
/**
* Set one of the notification counts for this room
* @param type - The type of notification count to set.
@@ -666,20 +622,7 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
*/
setUnreadNotificationCount(type: NotificationCountType, count: number): void;
setUnread(type: NotificationCountType, count: number): void;
/**
* Takes a legacy room summary (/v3/sync as opposed to MSC4186) and updates the room with it.
*
* @param summary - The room summary to update the room with
*/
setSummary(summary: IRoomSummary): void;
/**
* Takes information from the MSC4186 room summary and updates the room with it.
*
* @param heroes - The room's hero members
* @param joinedCount - The number of joined members
* @param invitedCount - The number of invited members
*/
setMSC4186SummaryData(heroes: MSC4186Hero[] | undefined, joinedCount: number | undefined, invitedCount: number | undefined): void;
/**
* Whether to send encrypted messages to devices within this room.
* @param value - true to blacklist unverified devices, null
@@ -702,14 +645,9 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* "crop" or "scale".
* @param allowDefault - True to allow an identicon for this room if an
* avatar URL wasn't explicitly set. Default: true. (Deprecated)
* @param useAuthentication - (optional) If true, the caller supports authenticated
* media and wants an authentication-required URL. Note that server support for
* authenticated media will not be checked - it is the caller's responsibility
* to do so before calling this function. Note also that useAuthentication
* implies allowRedirects. Defaults to false (unauthenticated endpoints).
* @returns the avatar URL or null.
*/
getAvatarUrl(baseUrl: string, width: number, height: number, resizeMethod: ResizeMethod, allowDefault?: boolean, useAuthentication?: boolean): string | null;
getAvatarUrl(baseUrl: string, width: number, height: number, resizeMethod: ResizeMethod, allowDefault?: boolean): string | null;
/**
* Get the mxc avatar url for the room, if one was set.
* @returns the mxc avatar url or falsy
@@ -746,7 +684,7 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @remarks
* Fires {@link RoomEvent.Timeline}
*/
addEventsToTimeline(events: MatrixEvent[], toStartOfTimeline: boolean, addToState: boolean, timeline: EventTimeline, paginationToken?: string): void;
addEventsToTimeline(events: MatrixEvent[], toStartOfTimeline: boolean, timeline: EventTimeline, paginationToken?: string): void;
/**
* Get the instance of the thread associated with the current event
* @param eventId - the ID of the current event
@@ -797,7 +735,7 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @param membership - The membership state.
* @returns A list of members with the given membership state.
*/
getMembersWithMembership(membership: Membership): RoomMember[];
getMembersWithMembership(membership: string): RoomMember[];
/**
* Get a list of members we should be encrypting for in this room
* @returns A list of members who
@@ -823,7 +761,7 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @param membership - The membership e.g. `'join'`
* @returns True if this user_id has the given membership state.
*/
hasMembershipState(userId: string, membership: Membership): boolean;
hasMembershipState(userId: string, membership: string): boolean;
/**
* Add a timelineSet for this room with the given filter
* @param filter - The filter to be applied to this timelineSet
@@ -845,7 +783,7 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
*/
fetchRoomThreads(): Promise<void>;
/**
* Process a list of poll events.
* Calls {@link processPollEvent} for a list of events.
*
* @param events - List of events
*/
@@ -866,7 +804,6 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @internal
*/
private fetchRoomThreadList;
private onThreadUpdate;
private onThreadReply;
private onThreadDelete;
/**
@@ -882,12 +819,6 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* Relations (other than m.thread), redactions, replies to a thread root live only in the main timeline
* Relations, redactions, replies where the parent cannot be found live in no timelines but should be aggregated regardless.
* Otherwise, the event lives in the main timeline only.
*
* Note: when a redaction is applied, the redacted event, events relating
* to it, and the redaction event itself, will all move to the main thread.
* This method classifies them as inside the thread of the redacted event.
* They are moved later as part of makeRedacted.
* This will change if MSC3389 is merged.
*/
eventShouldLiveIn(event: MatrixEvent, events?: MatrixEvent[], roots?: Set<string>): {
shouldLiveInRoom: boolean;
@@ -903,18 +834,7 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
private updateThreadRootEvents;
private updateThreadRootEvent;
createThread(threadId: string, rootEvent: MatrixEvent | undefined, events: MatrixEvent[] | undefined, toStartOfTimeline: boolean): Thread;
/**
* Applies an event as a redaction of another event, regardless of whether the redacting
* event is actually a redaction.
*
* Callers should use tryApplyRedaction instead.
*
* @param redactionEvent The event which redacts an event.
* @param redactedEvent The event being redacted.
* @private
*/
private applyEventAsRedaction;
readonly tryApplyRedaction: (event: MatrixEvent) => void;
private applyRedaction;
private processLiveEvent;
/**
* Add an event to the end of this room's live timelines. Will fire
@@ -1005,7 +925,6 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
*/
updatePendingEvent(event: MatrixEvent, newStatus: EventStatus, newEventId?: string): void;
private revertRedactionLocalEcho;
private assertTimelineSetsAreLive;
/**
* Add some events to this room. This can include state events, message
* events and typing notifications. These events are treated as "live" so
@@ -1015,7 +934,11 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @param addLiveEventOptions - addLiveEvent options
* @throws If `duplicateStrategy` is not falsey, 'replace' or 'ignore'.
*/
addLiveEvents(events: MatrixEvent[], addLiveEventOptions: IAddLiveEventOptions): Promise<void>;
addLiveEvents(events: MatrixEvent[], addLiveEventOptions?: IAddLiveEventOptions): Promise<void>;
/**
* @deprecated In favor of the overload with `IAddLiveEventOptions`
*/
addLiveEvents(events: MatrixEvent[], duplicateStrategy?: DuplicateStrategy, fromCache?: boolean): Promise<void>;
partitionThreadedEvents(events: MatrixEvent[]): [timelineEvents: MatrixEvent[], threadedEvents: MatrixEvent[], unknownRelations: MatrixEvent[]];
/**
* Given some events, find the IDs of all the thread roots that are referred to by them.
@@ -1070,32 +993,6 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @returns the account_data event in question
*/
getAccountData(type: EventType | string): MatrixEvent | undefined;
/**
* Get an iterator of currently active sticky events.
*/
_unstable_getStickyEvents(): ReturnType<RoomStickyEventsStore["getStickyEvents"]>;
/**
* Get a sticky event that match the given `type`, `sender`, and `stickyKey`
* @param type The event `type`.
* @param sender The sender of the sticky event.
* @param stickyKey The sticky key used by the event.
* @returns A matching active sticky event, or undefined.
*/
_unstable_getKeyedStickyEvent(sender: string, type: string, stickyKey: string): ReturnType<RoomStickyEventsStore["getKeyedStickyEvent"]>;
/**
* Get active sticky events without a sticky key that match the given `type` and `sender`.
* @param type The event `type`.
* @param sender The sender of the sticky event.
* @returns An array of matching sticky events.
*/
_unstable_getUnkeyedStickyEvent(sender: string, type: string): ReturnType<RoomStickyEventsStore["getUnkeyedStickyEvent"]>;
/**
* Add a series of sticky events, emitting `RoomEvent.StickyEvents` if any
* changes were made.
* @param events A set of new sticky events.
* @internal
*/
_unstable_addStickyEvents(events: MatrixEvent[]): ReturnType<RoomStickyEventsStore["addStickyEvents"]>;
/**
* Returns whether the syncing user has permission to send a message in the room
* @returns true if the user should be permitted to send
@@ -1203,16 +1100,6 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* @returns the timestamp of the oldest threaded receipt
*/
getOldestThreadedReceiptTs(): number;
/**
* Determines if the given user has read a particular event ID with the known
* history of the room. This is not a definitive check as it relies only on
* what is available to the room at the time of execution.
*
* @param userId - The user ID to check the read state of.
* @param eventId - The event ID to check if the user read.
* @returns true if the user has read the event, false otherwise.
*/
hasUserReadEvent(userId: string, eventId: string): boolean;
/**
* Returns the most recent unthreaded receipt for a given user
* @param userId - the MxID of the User
@@ -1233,34 +1120,6 @@ export declare class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandle
* contexts
*/
fixupNotifications(userId: string): void;
/**
* Determine the order of two events in this room.
*
* In principle this should use the same order as the server, but in practice
* this is difficult for events that were not received over the Sync API. See
* MSC4033 for details.
*
* This implementation leans on the order of events within their timelines, and
* falls back to comparing event timestamps when they are in different
* timelines.
*
* See https://github.com/matrix-org/matrix-js-sdk/issues/3325 for where we are
* tracking the work to fix this.
*
* @param leftEventId - the id of the first event
* @param rightEventId - the id of the second event
* @returns -1 if left \< right, 1 if left \> right, 0 if left == right, null if
* we can't tell (because we can't find the events).
*/
compareEventOrdering(leftEventId: string, rightEventId: string): number | null;
/**
* Return true if this room has an `m.room.encryption` state event.
*
* If this returns `true`, events sent to this room should be encrypted (and `MatrixClient.sendEvent` and friends
* will encrypt outgoing events).
*/
hasEncryptionStateEvent(): boolean;
}
export declare enum RoomNameType {
EmptyRoom = 0,