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,9 +1,8 @@
import type { SyncCryptoCallbacks } from "./common-crypto/CryptoBackend.ts";
import { Room } from "./models/room.ts";
import { type Logger } from "./logger.ts";
import { type IStoredClientOpts, type MatrixClient, type ResetTimelineCallback } from "./client.ts";
import { type ReceivedToDeviceMessage } from "./sync-accumulator.ts";
import { MatrixEvent } from "./models/event.ts";
import type { SyncCryptoCallbacks } from "./common-crypto/CryptoBackend";
import { Room } from "./models/room";
import { IStoredClientOpts, MatrixClient, ResetTimelineCallback } from "./client";
import { MatrixEvent } from "./models/event";
import { Crypto } from "./crypto";
export declare enum SyncState {
/** Emitted after we try to sync more than `FAILED_SYNC_ERROR_THRESHOLD`
* times and are still failing. Or when we enounter a hard error like the
@@ -27,6 +26,12 @@ export declare enum SyncState {
* Options passed into the constructor of SyncApi by MatrixClient
*/
export interface SyncApiOptions {
/**
* Crypto manager
*
* @deprecated in favour of cryptoCallbacks
*/
crypto?: Crypto;
/**
* If crypto is enabled on our client, callbacks into the crypto module
*/
@@ -38,8 +43,6 @@ export interface SyncApiOptions {
* there are other references to the timelines for this room.
*/
canResetEntireTimeline?: ResetTimelineCallback;
/** Logger instance to use for writing debug logs. */
logger: Logger;
}
export interface ISyncStateData {
/**
@@ -73,7 +76,7 @@ export declare enum SetPresence {
}
/** add default settings to an IStoredClientOpts */
export declare function defaultClientOpts(opts?: IStoredClientOpts): IStoredClientOpts;
export declare function defaultSyncApiOpts(syncOpts: SyncApiOptions): SyncApiOptions;
export declare function defaultSyncApiOpts(syncOpts?: SyncApiOptions): SyncApiOptions;
export declare class SyncApi {
private readonly client;
private readonly opts;
@@ -86,7 +89,7 @@ export declare class SyncApi {
private catchingUp;
private running;
private keepAliveTimer?;
private connectionReturnedResolvers?;
private connectionReturnedDefer?;
private notifEvents;
private failedSyncCount;
private storeIsInvalid;
@@ -98,7 +101,7 @@ export declare class SyncApi {
* @param syncOpts - sync-specific options passed by the client
* @internal
*/
constructor(client: MatrixClient, opts: IStoredClientOpts | undefined, syncOpts: SyncApiOptions);
constructor(client: MatrixClient, opts?: IStoredClientOpts, syncOpts?: SyncApiOptions);
createRoom(roomId: string): Room;
/** When we see the marker state change in the room, we know there is some
* new historical messages imported by MSC2716 `/batch_send` somewhere in
@@ -119,11 +122,10 @@ export declare class SyncApi {
* Peek into a room. This will result in the room in question being synced so it
* is accessible via getRooms(). Live updates for the room will be provided.
* @param roomId - The room ID to peek into.
* @param limit - The number of timeline events to initially retrieve.
* @returns A promise which resolves once the room has been added to the
* store.
*/
peek(roomId: string, limit?: number): Promise<Room>;
peek(roomId: string): Promise<Room>;
/**
* Stop polling for updates in the peeked room. NOPs if there is no room being
* peeked.
@@ -148,19 +150,15 @@ export declare class SyncApi {
*/
getSyncStateData(): ISyncStateData | null;
recoverFromSyncStartupError(savedSyncPromise: Promise<void> | undefined, error: Error): Promise<void>;
/**
* Is the lazy loading option different than in previous session?
* @param lazyLoadMembers - current options for lazy loading
* @returns whether or not the option has changed compared to the previous session */
private wasLazyLoadingToggled;
private shouldAbortSync;
private getPushRules;
private buildDefaultFilter;
/**
* Sets up the sync filter options for lazy loading if enabled,
* (or force-disables lazy loading entirely if we're a guest).
*/
private prepareSyncFilterLazyLoading;
/**
* Preare sync filter options for the unstable MSC4429 user profile fields if enabled.
*/
private prepareSyncFilterUserProfiles;
private storeClientOptions;
private checkLazyLoadStatus;
private getFilter;
private savedSyncPromise?;
/**
@@ -216,7 +214,7 @@ export declare class SyncApi {
* reachable.
*
* On failure, schedules a call back to itself. On success, resolves
* this.connectionReturnedResolvers.
* this.connectionReturnedDefer.
*
* @param connDidFail - True if a connectivity failure has been detected. Optional.
*/
@@ -226,26 +224,15 @@ export declare class SyncApi {
/**
*/
private resolveInvites;
private findEncryptionEvent;
private isRoomEncrypted;
private mapAndInjectRoomEvents;
/**
* Injects events into a room's model.
* @param stateEventList - A list of state events. This is the state
* at the *START* of the timeline list if it is supplied.
* @param stateAfterEventList - A list of state events. This is the state
* at the *END* of the timeline list if it is supplied.
* @param timelineEventList - A list of timeline events, including threaded. Lower index
* is earlier in time. Higher index is later.
* @param fromCache - whether the sync response came from cache
*
* No more than one of stateEventList and stateAfterEventList must be supplied. If
* stateEventList is supplied, the events in timelineEventList are added to the state
* after stateEventList. If stateAfterEventList is supplied, the events in timelineEventList
* are not added to the state.
*/
injectRoomEvents(room: Room, stateEventList: MatrixEvent[], stateAfterEventList: undefined, timelineEventList?: MatrixEvent[], fromCache?: boolean): Promise<void>;
injectRoomEvents(room: Room, stateEventList: undefined, stateAfterEventList: MatrixEvent[], timelineEventList?: MatrixEvent[], fromCache?: boolean): Promise<void>;
injectRoomEvents(room: Room, stateEventList: MatrixEvent[], timelineEventList?: MatrixEvent[], fromCache?: boolean): Promise<void>;
/**
* Takes a list of timelineEvents and adds and adds to notifEvents
* as appropriate.
@@ -271,11 +258,4 @@ export declare class SyncApi {
private onOnline;
}
export declare function _createAndReEmitRoom(client: MatrixClient, roomId: string, opts: Partial<IStoredClientOpts>): Room;
/**
* Process a list of (decrypted, where possible) received to-device events.
*
* Emits the appropriate {@link ClientEvent.ReceivedToDeviceMessage} event.
* Also converts the events into `MatrixEvent`s, and emits the now deprecated {@link ClientEvent.ToDeviceEvent} events for compatibility.
* */
export declare function processToDeviceMessages(toDeviceMessages: ReceivedToDeviceMessage[], client: MatrixClient): void;
//# sourceMappingURL=sync.d.ts.map