@openmarket/rooms-client 0.1.0
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/LICENSE +201 -0
- package/README.md +25 -0
- package/dist/agent/armed-mode.d.ts +187 -0
- package/dist/agent/armed-mode.js +306 -0
- package/dist/agent/clients/common.d.ts +70 -0
- package/dist/agent/clients/common.js +46 -0
- package/dist/agent/lane-draft.d.ts +15 -0
- package/dist/agent/lane-draft.js +43 -0
- package/dist/agent/lane-prompts.d.ts +102 -0
- package/dist/agent/lane-prompts.js +120 -0
- package/dist/agent/library-context.d.ts +38 -0
- package/dist/agent/library-context.js +57 -0
- package/dist/agent/library-model.d.ts +41 -0
- package/dist/agent/library-model.js +173 -0
- package/dist/agent/room-context.d.ts +151 -0
- package/dist/agent/room-context.js +251 -0
- package/dist/agent/sidebar-model.d.ts +86 -0
- package/dist/agent/sidebar-model.js +162 -0
- package/dist/agent/topic-inbox.d.ts +119 -0
- package/dist/agent/topic-inbox.js +266 -0
- package/dist/agent/topic-view-batcher.d.ts +54 -0
- package/dist/agent/topic-view-batcher.js +115 -0
- package/dist/client.d.ts +421 -0
- package/dist/client.js +1428 -0
- package/dist/doc-reconcile.d.ts +100 -0
- package/dist/doc-reconcile.js +110 -0
- package/dist/doc-uri.d.ts +29 -0
- package/dist/doc-uri.js +55 -0
- package/dist/endpoints.d.ts +9 -0
- package/dist/endpoints.js +13 -0
- package/dist/jwt.d.ts +10 -0
- package/dist/jwt.js +51 -0
- package/dist/library-publisher.d.ts +52 -0
- package/dist/library-publisher.js +49 -0
- package/dist/merge3.d.ts +50 -0
- package/dist/merge3.js +280 -0
- package/dist/names.d.ts +6 -0
- package/dist/names.js +35 -0
- package/dist/shared/emoji-data.d.ts +22 -0
- package/dist/shared/emoji-data.js +8834 -0
- package/dist/shared/mentions.d.ts +6 -0
- package/dist/shared/mentions.js +32 -0
- package/dist/shared/rooms-protocol.d.ts +1183 -0
- package/dist/shared/rooms-protocol.js +160 -0
- package/dist/social-client.d.ts +361 -0
- package/dist/social-client.js +686 -0
- package/dist/social-types.d.ts +338 -0
- package/dist/social-types.js +1 -0
- package/dist/suggestion-attribution.d.ts +10 -0
- package/dist/suggestion-attribution.js +56 -0
- package/dist/topic-uri.d.ts +26 -0
- package/dist/topic-uri.js +40 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/dist/ws-client.d.ts +115 -0
- package/dist/ws-client.js +491 -0
- package/package.json +180 -0
- package/src/agent/armed-mode.ts +368 -0
- package/src/agent/clients/common.ts +91 -0
- package/src/agent/lane-draft.ts +47 -0
- package/src/agent/lane-prompts.ts +267 -0
- package/src/agent/library-context.ts +97 -0
- package/src/agent/library-model.ts +210 -0
- package/src/agent/room-context.ts +351 -0
- package/src/agent/sidebar-model.ts +235 -0
- package/src/agent/topic-inbox.ts +297 -0
- package/src/agent/topic-view-batcher.ts +134 -0
- package/src/client.ts +2331 -0
- package/src/doc-reconcile.ts +160 -0
- package/src/doc-uri.ts +83 -0
- package/src/endpoints.ts +14 -0
- package/src/jwt.ts +59 -0
- package/src/library-publisher.ts +93 -0
- package/src/merge3.ts +326 -0
- package/src/names.ts +44 -0
- package/src/shared/emoji-data.ts +8868 -0
- package/src/shared/mentions.ts +32 -0
- package/src/shared/rooms-protocol.ts +1339 -0
- package/src/social-client.ts +1287 -0
- package/src/social-types.ts +376 -0
- package/src/suggestion-attribution.ts +83 -0
- package/src/topic-uri.ts +64 -0
- package/src/types.ts +83 -0
- package/src/version.ts +2 -0
- package/src/ws-client.ts +611 -0
|
@@ -0,0 +1,1183 @@
|
|
|
1
|
+
export declare const RoomClientMessageType: {
|
|
2
|
+
readonly AUTHENTICATE: "AUTHENTICATE";
|
|
3
|
+
readonly CREATE_ROOM: "CREATE_ROOM";
|
|
4
|
+
readonly INVITE: "INVITE";
|
|
5
|
+
readonly REMOVE_MEMBER: "REMOVE_MEMBER";
|
|
6
|
+
readonly SEARCH: "SEARCH";
|
|
7
|
+
readonly JOIN: "JOIN";
|
|
8
|
+
readonly HISTORY: "HISTORY";
|
|
9
|
+
readonly PEEK: "PEEK";
|
|
10
|
+
readonly LEAVE: "LEAVE";
|
|
11
|
+
readonly POST: "POST";
|
|
12
|
+
readonly REACT: "REACT";
|
|
13
|
+
readonly EDIT: "EDIT";
|
|
14
|
+
readonly DELETE: "DELETE";
|
|
15
|
+
readonly THREAD: "THREAD";
|
|
16
|
+
readonly PIN: "PIN";
|
|
17
|
+
readonly UNPIN: "UNPIN";
|
|
18
|
+
readonly PINS: "PINS";
|
|
19
|
+
readonly REACTORS: "REACTORS";
|
|
20
|
+
readonly REPORT: "REPORT";
|
|
21
|
+
readonly MUTE: "MUTE";
|
|
22
|
+
readonly KICK: "KICK";
|
|
23
|
+
readonly BAN: "BAN";
|
|
24
|
+
readonly ROLE_CHANGE: "ROLE_CHANGE";
|
|
25
|
+
readonly SET_READ_ONLY: "SET_READ_ONLY";
|
|
26
|
+
readonly AUDIT_LOG: "AUDIT_LOG";
|
|
27
|
+
readonly SPACES: "SPACES";
|
|
28
|
+
readonly JOIN_SPACE: "JOIN_SPACE";
|
|
29
|
+
readonly READ_STATE: "READ_STATE";
|
|
30
|
+
readonly SEARCH_ENTRIES: "SEARCH_ENTRIES";
|
|
31
|
+
readonly WHO: "WHO";
|
|
32
|
+
readonly TYPING: "TYPING";
|
|
33
|
+
readonly STATUS: "STATUS";
|
|
34
|
+
readonly ACK: "ACK";
|
|
35
|
+
readonly PING: "PING";
|
|
36
|
+
readonly FRIENDS: "FRIENDS";
|
|
37
|
+
readonly DM_OPEN: "DM_OPEN";
|
|
38
|
+
readonly DM_HISTORY: "DM_HISTORY";
|
|
39
|
+
readonly DM_SEND: "DM_SEND";
|
|
40
|
+
readonly DM_READ: "DM_READ";
|
|
41
|
+
readonly TOPIC_CREATE: "TOPIC_CREATE";
|
|
42
|
+
readonly TOPIC_RENAME: "TOPIC_RENAME";
|
|
43
|
+
readonly TOPIC_MOVE: "TOPIC_MOVE";
|
|
44
|
+
readonly TOPIC_MERGE: "TOPIC_MERGE";
|
|
45
|
+
readonly TOPIC_RESOLVE: "TOPIC_RESOLVE";
|
|
46
|
+
readonly TOPIC_SET_ATTENTION: "TOPIC_SET_ATTENTION";
|
|
47
|
+
readonly TOPIC_LIST: "TOPIC_LIST";
|
|
48
|
+
};
|
|
49
|
+
export type RoomClientMessageType = (typeof RoomClientMessageType)[keyof typeof RoomClientMessageType];
|
|
50
|
+
export declare const RoomServerMessageType: {
|
|
51
|
+
readonly AUTH_SUCCESS: "AUTH_SUCCESS";
|
|
52
|
+
readonly ROOM_CREATED: "ROOM_CREATED";
|
|
53
|
+
readonly ROOM_INVITED: "ROOM_INVITED";
|
|
54
|
+
readonly ROOM_MEMBER_REMOVED: "ROOM_MEMBER_REMOVED";
|
|
55
|
+
readonly ROOMS: "ROOMS";
|
|
56
|
+
readonly BACKFILL: "BACKFILL";
|
|
57
|
+
readonly HISTORY: "HISTORY";
|
|
58
|
+
readonly PEEK_RESULT: "PEEK_RESULT";
|
|
59
|
+
readonly MESSAGE: "MESSAGE";
|
|
60
|
+
readonly ENTRY_UPDATED: "ENTRY_UPDATED";
|
|
61
|
+
readonly THREAD: "THREAD";
|
|
62
|
+
readonly PINS: "PINS";
|
|
63
|
+
readonly REACTORS: "REACTORS";
|
|
64
|
+
readonly ROOM_REPORTED: "ROOM_REPORTED";
|
|
65
|
+
readonly ROOM_MUTED: "ROOM_MUTED";
|
|
66
|
+
readonly ROOM_BANNED: "ROOM_BANNED";
|
|
67
|
+
readonly ROOM_MEMBER_ROLE_CHANGED: "ROOM_MEMBER_ROLE_CHANGED";
|
|
68
|
+
readonly ROOM_READ_ONLY_SET: "ROOM_READ_ONLY_SET";
|
|
69
|
+
readonly ROOM_AUDIT_LOG: "ROOM_AUDIT_LOG";
|
|
70
|
+
readonly SPACES: "SPACES";
|
|
71
|
+
readonly SPACE_JOINED: "SPACE_JOINED";
|
|
72
|
+
readonly SPACE_MEMBER_ADDED: "SPACE_MEMBER_ADDED";
|
|
73
|
+
readonly SPACE_INVITE: "SPACE_INVITE";
|
|
74
|
+
readonly ROOM_UPDATED: "ROOM_UPDATED";
|
|
75
|
+
readonly SPACE_UPDATED: "SPACE_UPDATED";
|
|
76
|
+
readonly READ_STATE: "READ_STATE";
|
|
77
|
+
readonly SEARCH_RESULTS: "SEARCH_RESULTS";
|
|
78
|
+
readonly PRESENCE: "PRESENCE";
|
|
79
|
+
readonly RESYNC: "RESYNC";
|
|
80
|
+
readonly PRESENCE_DELTA: "PRESENCE_DELTA";
|
|
81
|
+
readonly WHO: "WHO";
|
|
82
|
+
readonly TYPING: "TYPING";
|
|
83
|
+
readonly ERROR: "ERROR";
|
|
84
|
+
readonly PONG: "PONG";
|
|
85
|
+
readonly FRIENDS: "FRIENDS";
|
|
86
|
+
readonly DM_OPENED: "DM_OPENED";
|
|
87
|
+
readonly DM_HISTORY: "DM_HISTORY";
|
|
88
|
+
readonly DM_MESSAGE: "DM_MESSAGE";
|
|
89
|
+
readonly DM_INBOX_UPDATED: "DM_INBOX_UPDATED";
|
|
90
|
+
readonly TOPIC: "TOPIC";
|
|
91
|
+
readonly TOPICS: "TOPICS";
|
|
92
|
+
readonly TOPIC_UPDATED: "TOPIC_UPDATED";
|
|
93
|
+
};
|
|
94
|
+
export declare function addBounded<T>(set: Set<T>, value: T, max: number): void;
|
|
95
|
+
export type RoomServerMessageType = (typeof RoomServerMessageType)[keyof typeof RoomServerMessageType];
|
|
96
|
+
export declare const SUPPORTED_ROOM_PROTOCOL_VERSION = 2;
|
|
97
|
+
export declare const RoomLedgerEntryType: {
|
|
98
|
+
readonly POST: "post";
|
|
99
|
+
readonly SYSTEM: "system";
|
|
100
|
+
readonly SYSTEM_MARKET: "system_market";
|
|
101
|
+
readonly MODERATION: "moderation";
|
|
102
|
+
readonly SECRET: "secret";
|
|
103
|
+
};
|
|
104
|
+
export type RoomLedgerEntryType = (typeof RoomLedgerEntryType)[keyof typeof RoomLedgerEntryType];
|
|
105
|
+
/** Sealed-secrets envelope on a `secret` entry. Opaque everywhere except the
|
|
106
|
+
* recipients' daemons: armored age ciphertext plus recipient userIds. The
|
|
107
|
+
* `kind` reveals only whether a text value or a file reference is inside. */
|
|
108
|
+
export interface RoomLedgerSecretPayload {
|
|
109
|
+
armored: string;
|
|
110
|
+
recipients: string[];
|
|
111
|
+
kind: "text" | "file";
|
|
112
|
+
}
|
|
113
|
+
export declare function isSystemRoomLedgerEntryType(type: RoomLedgerEntryType): boolean;
|
|
114
|
+
export type RoomMemberTier = "free" | "paid";
|
|
115
|
+
export type RoomUserStatus = "online" | "idle" | "dnd";
|
|
116
|
+
export type RoomAccessMode = "public" | "invite_only" | "code" | "space";
|
|
117
|
+
export type RoomSearchScope = "canonical" | "community" | "all";
|
|
118
|
+
export type RoomRole = "owner" | "admin" | "mod" | "member";
|
|
119
|
+
/** Per-channel topics dial, owner-set data. Defaults to "allowed" since the
|
|
120
|
+
* 2026-07-12 dial-default flip (see RoomMeta.topicsPolicy for the wire
|
|
121
|
+
* semantics of an absent value). */
|
|
122
|
+
export type RoomTopicsPolicy = "off" | "allowed" | "required";
|
|
123
|
+
export type RoomTopicAttention = "follow" | "default" | "mute";
|
|
124
|
+
export interface RoomMember {
|
|
125
|
+
userId: string;
|
|
126
|
+
username: string;
|
|
127
|
+
handle: string;
|
|
128
|
+
isAgent: boolean;
|
|
129
|
+
roomRole?: RoomRole | null | undefined;
|
|
130
|
+
chatRole?: string | null | undefined;
|
|
131
|
+
status?: RoomUserStatus | undefined;
|
|
132
|
+
tier?: RoomMemberTier | null | undefined;
|
|
133
|
+
since?: string | number | null | undefined;
|
|
134
|
+
joinedAt: number;
|
|
135
|
+
avatarUrl?: string | null;
|
|
136
|
+
statusText?: string | null;
|
|
137
|
+
}
|
|
138
|
+
export interface RoomMeta {
|
|
139
|
+
name: string;
|
|
140
|
+
title: string;
|
|
141
|
+
description: string;
|
|
142
|
+
kind: string;
|
|
143
|
+
symbols: string[];
|
|
144
|
+
community?: boolean | undefined;
|
|
145
|
+
access?: RoomAccessMode | undefined;
|
|
146
|
+
maxMembers?: number | undefined;
|
|
147
|
+
createdByUserId?: string | undefined;
|
|
148
|
+
createdByHandle?: string | undefined;
|
|
149
|
+
category?: string | null | undefined;
|
|
150
|
+
sortOrder?: number | undefined;
|
|
151
|
+
spaceId?: string | null | undefined;
|
|
152
|
+
postingRoles?: RoomRole[] | undefined;
|
|
153
|
+
postingRolesRestricted?: boolean | undefined;
|
|
154
|
+
viewerRole?: RoomRole | null | undefined;
|
|
155
|
+
/** Head event sequence; diff against the read cursor for unread badges. */
|
|
156
|
+
headSeq?: number | undefined;
|
|
157
|
+
/** Topics dial for this channel. Absent reads as "allowed" since the
|
|
158
|
+
* 2026-07-12 dial-default flip (post-flip relays always advertise the
|
|
159
|
+
* stored value, "off" included); explicit "off" means topics are inert. */
|
|
160
|
+
topicsPolicy?: RoomTopicsPolicy | undefined;
|
|
161
|
+
tags?: string[] | undefined;
|
|
162
|
+
entities?: string[] | undefined;
|
|
163
|
+
sourceRefs?: Array<Record<string, unknown>> | undefined;
|
|
164
|
+
readOnly?: boolean | undefined;
|
|
165
|
+
heat?: {
|
|
166
|
+
score?: number | undefined;
|
|
167
|
+
roomHeat?: number | undefined;
|
|
168
|
+
marketHeat?: number | undefined;
|
|
169
|
+
heatKind?: "room" | "market" | "mixed" | undefined;
|
|
170
|
+
messageRate?: number | undefined;
|
|
171
|
+
freshMessageRate?: number | undefined;
|
|
172
|
+
recentMessageCount?: number | undefined;
|
|
173
|
+
baselineMessageRate?: number | undefined;
|
|
174
|
+
surge?: number | undefined;
|
|
175
|
+
onlineCount?: number | undefined;
|
|
176
|
+
activeSenders?: number | undefined;
|
|
177
|
+
updatedAt?: string | number | undefined;
|
|
178
|
+
} | null | undefined;
|
|
179
|
+
onlineCount?: number | undefined;
|
|
180
|
+
}
|
|
181
|
+
export interface RoomLedgerEntry {
|
|
182
|
+
seq: number;
|
|
183
|
+
ts: number;
|
|
184
|
+
room: string;
|
|
185
|
+
handle: string;
|
|
186
|
+
userId: string;
|
|
187
|
+
isAgent: boolean;
|
|
188
|
+
type: RoomLedgerEntryType;
|
|
189
|
+
text?: string | undefined;
|
|
190
|
+
secret?: RoomLedgerSecretPayload | undefined;
|
|
191
|
+
clientMsgId?: string | undefined;
|
|
192
|
+
receiptId?: string | undefined;
|
|
193
|
+
inReplyTo?: number | undefined;
|
|
194
|
+
/** Registry-backed topic this entry was posted into; absent = untopicked. */
|
|
195
|
+
topicId?: string | undefined;
|
|
196
|
+
tier?: RoomMemberTier | null | undefined;
|
|
197
|
+
since?: string | number | null | undefined;
|
|
198
|
+
reactions?: Array<{
|
|
199
|
+
emoji: string;
|
|
200
|
+
count: number;
|
|
201
|
+
}> | undefined;
|
|
202
|
+
editedAt?: string | number | Date | undefined;
|
|
203
|
+
deletedAt?: string | number | Date | undefined;
|
|
204
|
+
deletedBy?: string | undefined;
|
|
205
|
+
replyCount?: number | undefined;
|
|
206
|
+
lastReplyAt?: string | number | Date | undefined;
|
|
207
|
+
pinned?: boolean | undefined;
|
|
208
|
+
pinnedBy?: string | null | undefined;
|
|
209
|
+
pinnedAt?: string | number | Date | null | undefined;
|
|
210
|
+
attachments?: RoomAttachment[] | undefined;
|
|
211
|
+
roomRole?: RoomRole | null | undefined;
|
|
212
|
+
}
|
|
213
|
+
export interface RoomAttachment {
|
|
214
|
+
/** Object key under room-attachments/; clients sign it at render time. */
|
|
215
|
+
key: string;
|
|
216
|
+
name: string;
|
|
217
|
+
size: number;
|
|
218
|
+
mime: string;
|
|
219
|
+
scanStatus?: "pending" | "clean" | "held" | undefined;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* A registry-backed topic inside a channel. The id is permanent: rename
|
|
223
|
+
* changes `name` only, and links (`om://topic/<topicId>`) keep resolving.
|
|
224
|
+
* A merged topic stays resolvable via `mergedInto` (its own id never changes
|
|
225
|
+
* either; readers follow the alias to the surviving topic).
|
|
226
|
+
*/
|
|
227
|
+
export interface RoomTopic {
|
|
228
|
+
topicId: string;
|
|
229
|
+
room: string;
|
|
230
|
+
name: string;
|
|
231
|
+
resolved: boolean;
|
|
232
|
+
createdByUserId?: string | undefined;
|
|
233
|
+
mergedInto?: string | null | undefined;
|
|
234
|
+
}
|
|
235
|
+
export interface RoomAuthSuccessPayload {
|
|
236
|
+
userId: string;
|
|
237
|
+
username: string;
|
|
238
|
+
handle: string;
|
|
239
|
+
isAgent?: boolean;
|
|
240
|
+
isGuest?: boolean;
|
|
241
|
+
connectionId: string;
|
|
242
|
+
protocolVersion: number;
|
|
243
|
+
minClientBuild?: string | undefined;
|
|
244
|
+
}
|
|
245
|
+
export interface RoomBackfillPayload {
|
|
246
|
+
room: string;
|
|
247
|
+
entries: RoomLedgerEntry[];
|
|
248
|
+
upToSeq: number;
|
|
249
|
+
hasMore: boolean;
|
|
250
|
+
readOnly?: boolean | undefined;
|
|
251
|
+
beforeSeq?: number;
|
|
252
|
+
sinceSeq?: number;
|
|
253
|
+
atMs?: number;
|
|
254
|
+
requestId?: string;
|
|
255
|
+
}
|
|
256
|
+
export interface RoomMessagePayload {
|
|
257
|
+
room: string;
|
|
258
|
+
seq: number;
|
|
259
|
+
entry: RoomLedgerEntry;
|
|
260
|
+
requestId?: string;
|
|
261
|
+
}
|
|
262
|
+
export type RoomEntryUpdatedPayload = RoomMessagePayload;
|
|
263
|
+
export interface RoomThreadPayload {
|
|
264
|
+
room: string;
|
|
265
|
+
rootSeq: number;
|
|
266
|
+
entries: RoomLedgerEntry[];
|
|
267
|
+
upToSeq: number;
|
|
268
|
+
hasMore: boolean;
|
|
269
|
+
requestId?: string | undefined;
|
|
270
|
+
}
|
|
271
|
+
export interface RoomPinsPayload {
|
|
272
|
+
room: string;
|
|
273
|
+
pins: RoomLedgerEntry[];
|
|
274
|
+
hasMore: boolean;
|
|
275
|
+
requestId?: string | undefined;
|
|
276
|
+
}
|
|
277
|
+
export interface RoomReadStatePayload {
|
|
278
|
+
readState: Record<string, number>;
|
|
279
|
+
requestId?: string | undefined;
|
|
280
|
+
}
|
|
281
|
+
export interface RoomSearchResultsPayload {
|
|
282
|
+
room: string;
|
|
283
|
+
query: string;
|
|
284
|
+
entries: RoomLedgerEntry[];
|
|
285
|
+
hasMore: boolean;
|
|
286
|
+
requestId?: string | undefined;
|
|
287
|
+
}
|
|
288
|
+
export interface RoomPresencePayload {
|
|
289
|
+
room: string;
|
|
290
|
+
humans: number;
|
|
291
|
+
agents: number;
|
|
292
|
+
total: number;
|
|
293
|
+
guestCount?: number | undefined;
|
|
294
|
+
sample: RoomMember[];
|
|
295
|
+
members?: RoomMember[] | undefined;
|
|
296
|
+
requestId?: string | undefined;
|
|
297
|
+
}
|
|
298
|
+
export interface RoomPresenceDeltaPayload {
|
|
299
|
+
room: string;
|
|
300
|
+
joined?: RoomMember | undefined;
|
|
301
|
+
left?: string | undefined;
|
|
302
|
+
/** In-place identity refresh (status/statusText/avatar changes). */
|
|
303
|
+
updated?: RoomMember | undefined;
|
|
304
|
+
humans: number;
|
|
305
|
+
agents: number;
|
|
306
|
+
guestCount?: number | undefined;
|
|
307
|
+
}
|
|
308
|
+
export declare const ROOM_PRESENCE_SAMPLE_LIMIT = 50;
|
|
309
|
+
/**
|
|
310
|
+
* Relay typing contract (kiyotaka `room.constants.ts`). Two facts every
|
|
311
|
+
* client-side typing feature must design against:
|
|
312
|
+
*
|
|
313
|
+
* - A typer's roster entry expires ROOM_TYPING_RELAY_ENTRY_TTL_MS after
|
|
314
|
+
* their last start frame, and the expiry is pruned lazily on the next
|
|
315
|
+
* roster read; it is NEVER broadcast. A client that wants the entry to
|
|
316
|
+
* survive a long message must re-send start inside this window, and a
|
|
317
|
+
* client rendering the roster must self-expire it locally.
|
|
318
|
+
* - Roster broadcasts are throttled to one per room per
|
|
319
|
+
* ROOM_TYPING_RELAY_BROADCAST_THROTTLE_MS (a trailing broadcast covers
|
|
320
|
+
* frames coalesced inside the window), so any roster a client displays
|
|
321
|
+
* can be that stale before the next one arrives.
|
|
322
|
+
*/
|
|
323
|
+
export declare const ROOM_TYPING_RELAY_ENTRY_TTL_MS = 5000;
|
|
324
|
+
export declare const ROOM_TYPING_RELAY_BROADCAST_THROTTLE_MS = 2000;
|
|
325
|
+
export declare function applyRoomPresenceDelta(current: RoomPresencePayload | null | undefined, delta: RoomPresenceDeltaPayload): RoomPresencePayload;
|
|
326
|
+
export interface RoomWhoPayload {
|
|
327
|
+
room: string;
|
|
328
|
+
members: RoomMember[];
|
|
329
|
+
offset: number;
|
|
330
|
+
limit: number;
|
|
331
|
+
total: number;
|
|
332
|
+
humans?: number | undefined;
|
|
333
|
+
agents?: number | undefined;
|
|
334
|
+
guestCount?: number | undefined;
|
|
335
|
+
requestId?: string | undefined;
|
|
336
|
+
}
|
|
337
|
+
export interface RoomTypingPayload {
|
|
338
|
+
room: string;
|
|
339
|
+
users: string[];
|
|
340
|
+
count: number;
|
|
341
|
+
}
|
|
342
|
+
export interface RoomResyncPayload {
|
|
343
|
+
room: string;
|
|
344
|
+
reason: "stream_gap" | "stream_poison" | "stale_cursor";
|
|
345
|
+
sinceSeq?: number | undefined;
|
|
346
|
+
missing?: number | undefined;
|
|
347
|
+
attempts?: number | undefined;
|
|
348
|
+
}
|
|
349
|
+
export interface RoomErrorPayload {
|
|
350
|
+
code: string;
|
|
351
|
+
message: string;
|
|
352
|
+
details?: unknown;
|
|
353
|
+
requestId?: string;
|
|
354
|
+
}
|
|
355
|
+
export interface RoomFriendPresence {
|
|
356
|
+
friendshipId?: string | undefined;
|
|
357
|
+
userId: string;
|
|
358
|
+
username: string;
|
|
359
|
+
acceptedAt?: number | undefined;
|
|
360
|
+
lastMessageAt?: number | undefined;
|
|
361
|
+
}
|
|
362
|
+
export interface RoomSearchPayload {
|
|
363
|
+
requestId?: string;
|
|
364
|
+
query?: string;
|
|
365
|
+
scope?: RoomSearchScope;
|
|
366
|
+
category?: string | string[];
|
|
367
|
+
tag?: string | string[];
|
|
368
|
+
kind?: string | string[];
|
|
369
|
+
entity?: string | string[];
|
|
370
|
+
symbol?: string | string[];
|
|
371
|
+
spaceId?: string | string[];
|
|
372
|
+
hot?: boolean;
|
|
373
|
+
createdByMe?: boolean;
|
|
374
|
+
includeArchived?: boolean;
|
|
375
|
+
limit?: number;
|
|
376
|
+
}
|
|
377
|
+
export interface RoomCreatePayload {
|
|
378
|
+
requestId?: string;
|
|
379
|
+
name: string;
|
|
380
|
+
title?: string;
|
|
381
|
+
description?: string;
|
|
382
|
+
access?: RoomAccessMode;
|
|
383
|
+
maxMembers?: number;
|
|
384
|
+
category?: string;
|
|
385
|
+
sortOrder?: number;
|
|
386
|
+
spaceId?: string;
|
|
387
|
+
postingRoles?: RoomRole[];
|
|
388
|
+
tags?: string[];
|
|
389
|
+
}
|
|
390
|
+
export interface RoomCreatedPayload {
|
|
391
|
+
requestId?: string;
|
|
392
|
+
room: RoomMeta;
|
|
393
|
+
joinCode?: string;
|
|
394
|
+
}
|
|
395
|
+
export interface RoomInvitePayload {
|
|
396
|
+
requestId?: string;
|
|
397
|
+
room: string;
|
|
398
|
+
username?: string;
|
|
399
|
+
userId?: string;
|
|
400
|
+
}
|
|
401
|
+
export interface RoomInvitedPayload {
|
|
402
|
+
requestId?: string;
|
|
403
|
+
room: string;
|
|
404
|
+
invitedUserId: string;
|
|
405
|
+
invitedHandle: string;
|
|
406
|
+
}
|
|
407
|
+
export interface RoomRemoveMemberPayload {
|
|
408
|
+
requestId?: string;
|
|
409
|
+
room: string;
|
|
410
|
+
username?: string;
|
|
411
|
+
userId?: string;
|
|
412
|
+
reason?: string;
|
|
413
|
+
}
|
|
414
|
+
export interface RoomMemberRemovedPayload {
|
|
415
|
+
requestId?: string;
|
|
416
|
+
room: string;
|
|
417
|
+
removedUserId: string;
|
|
418
|
+
removedHandle: string;
|
|
419
|
+
}
|
|
420
|
+
export interface RoomDmParticipant {
|
|
421
|
+
userId: string;
|
|
422
|
+
username: string;
|
|
423
|
+
}
|
|
424
|
+
export interface RoomDmMessage {
|
|
425
|
+
id?: string | undefined;
|
|
426
|
+
_id?: string | undefined;
|
|
427
|
+
messageId?: string | undefined;
|
|
428
|
+
conversationId?: string | undefined;
|
|
429
|
+
senderId?: string | undefined;
|
|
430
|
+
userId?: string | undefined;
|
|
431
|
+
senderUsername?: string | undefined;
|
|
432
|
+
username?: string | undefined;
|
|
433
|
+
content: string;
|
|
434
|
+
clientMsgId?: string | undefined;
|
|
435
|
+
type?: string | undefined;
|
|
436
|
+
timestamp?: string | number | undefined;
|
|
437
|
+
createdAt?: string | number | undefined;
|
|
438
|
+
/** Sealed DM: content is '' and the opaque envelope rides here. */
|
|
439
|
+
secret?: RoomLedgerSecretPayload | null | undefined;
|
|
440
|
+
metadata?: Record<string, unknown> | undefined;
|
|
441
|
+
}
|
|
442
|
+
export interface RoomDmOpenPayload {
|
|
443
|
+
requestId?: string;
|
|
444
|
+
username: string;
|
|
445
|
+
limit?: number;
|
|
446
|
+
markRead?: boolean;
|
|
447
|
+
}
|
|
448
|
+
export interface RoomDmHistoryPayload {
|
|
449
|
+
requestId?: string;
|
|
450
|
+
username?: string;
|
|
451
|
+
conversationId?: string;
|
|
452
|
+
before?: number;
|
|
453
|
+
limit?: number;
|
|
454
|
+
markRead?: boolean;
|
|
455
|
+
}
|
|
456
|
+
export interface RoomDmSendPayload {
|
|
457
|
+
requestId?: string;
|
|
458
|
+
username?: string;
|
|
459
|
+
conversationId?: string;
|
|
460
|
+
content: string;
|
|
461
|
+
clientMsgId?: string;
|
|
462
|
+
}
|
|
463
|
+
export interface RoomDmReadPayload {
|
|
464
|
+
requestId?: string;
|
|
465
|
+
username?: string;
|
|
466
|
+
conversationId?: string;
|
|
467
|
+
before?: number;
|
|
468
|
+
}
|
|
469
|
+
export interface RoomDmOpenedPayload {
|
|
470
|
+
requestId?: string;
|
|
471
|
+
conversationId: string;
|
|
472
|
+
participant: RoomDmParticipant;
|
|
473
|
+
messages: RoomDmMessage[];
|
|
474
|
+
hasMore?: boolean;
|
|
475
|
+
cursor?: number;
|
|
476
|
+
}
|
|
477
|
+
export type RoomDmHistoryResultPayload = RoomDmOpenedPayload;
|
|
478
|
+
export interface RoomDmMessagePayload {
|
|
479
|
+
requestId?: string;
|
|
480
|
+
conversationId: string;
|
|
481
|
+
participant: RoomDmParticipant;
|
|
482
|
+
message: RoomDmMessage;
|
|
483
|
+
clientMsgId?: string;
|
|
484
|
+
}
|
|
485
|
+
export interface RoomDmInboxUpdatedPayload {
|
|
486
|
+
conversationId: string;
|
|
487
|
+
participant: RoomDmParticipant;
|
|
488
|
+
unreadCount: number;
|
|
489
|
+
lastMessage?: RoomDmMessage;
|
|
490
|
+
updatedAt?: string | number;
|
|
491
|
+
}
|
|
492
|
+
export interface RoomReportPayload {
|
|
493
|
+
requestId?: string;
|
|
494
|
+
room: string;
|
|
495
|
+
seq?: number;
|
|
496
|
+
targetUserId?: string;
|
|
497
|
+
reason: string;
|
|
498
|
+
}
|
|
499
|
+
export interface RoomReportedPayload {
|
|
500
|
+
requestId?: string;
|
|
501
|
+
room: string;
|
|
502
|
+
target: {
|
|
503
|
+
kind: "event";
|
|
504
|
+
seq: number;
|
|
505
|
+
} | {
|
|
506
|
+
kind: "membership";
|
|
507
|
+
userId: string;
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
export interface RoomModerateMemberPayload {
|
|
511
|
+
requestId?: string;
|
|
512
|
+
room: string;
|
|
513
|
+
username?: string;
|
|
514
|
+
userId?: string;
|
|
515
|
+
reason?: string;
|
|
516
|
+
}
|
|
517
|
+
export interface RoomMutePayload extends RoomModerateMemberPayload {
|
|
518
|
+
until: string | number | Date;
|
|
519
|
+
}
|
|
520
|
+
export interface RoomMutedPayload {
|
|
521
|
+
requestId?: string;
|
|
522
|
+
room: string;
|
|
523
|
+
mutedUserId: string;
|
|
524
|
+
mutedHandle: string;
|
|
525
|
+
until: string | number | Date;
|
|
526
|
+
}
|
|
527
|
+
export interface RoomBannedPayload {
|
|
528
|
+
requestId?: string;
|
|
529
|
+
room: string;
|
|
530
|
+
bannedUserId: string;
|
|
531
|
+
bannedHandle: string;
|
|
532
|
+
}
|
|
533
|
+
export interface RoomRoleChangePayload {
|
|
534
|
+
requestId?: string;
|
|
535
|
+
room: string;
|
|
536
|
+
username?: string;
|
|
537
|
+
userId?: string;
|
|
538
|
+
role: RoomRole;
|
|
539
|
+
reason?: string;
|
|
540
|
+
}
|
|
541
|
+
export interface RoomMemberRoleChangedPayload {
|
|
542
|
+
requestId?: string;
|
|
543
|
+
room: string;
|
|
544
|
+
targetUserId: string;
|
|
545
|
+
targetHandle: string;
|
|
546
|
+
role: RoomRole;
|
|
547
|
+
actorUserId?: string;
|
|
548
|
+
}
|
|
549
|
+
export interface RoomSetReadOnlyPayload {
|
|
550
|
+
requestId?: string;
|
|
551
|
+
room: string;
|
|
552
|
+
postingRoles: RoomRole[];
|
|
553
|
+
reason?: string;
|
|
554
|
+
}
|
|
555
|
+
export interface RoomReadOnlySetPayload {
|
|
556
|
+
requestId?: string;
|
|
557
|
+
room: string;
|
|
558
|
+
postingRoles: RoomRole[];
|
|
559
|
+
}
|
|
560
|
+
export interface RoomAuditLogRequestPayload {
|
|
561
|
+
requestId?: string;
|
|
562
|
+
room: string;
|
|
563
|
+
limit?: number;
|
|
564
|
+
}
|
|
565
|
+
export interface RoomAuditEntry {
|
|
566
|
+
roomId: string;
|
|
567
|
+
actor: string;
|
|
568
|
+
action: string;
|
|
569
|
+
target?: Record<string, unknown> | undefined;
|
|
570
|
+
reason?: string | undefined;
|
|
571
|
+
at: string | number | Date;
|
|
572
|
+
}
|
|
573
|
+
export interface RoomAuditLogPayload {
|
|
574
|
+
requestId?: string;
|
|
575
|
+
room: string;
|
|
576
|
+
entries: RoomAuditEntry[];
|
|
577
|
+
}
|
|
578
|
+
export interface RoomSpace {
|
|
579
|
+
spaceId: string;
|
|
580
|
+
name: string;
|
|
581
|
+
ownerUserId: string;
|
|
582
|
+
createdAt: string | number | Date;
|
|
583
|
+
joined?: boolean | undefined;
|
|
584
|
+
iconUrl?: string | null | undefined;
|
|
585
|
+
}
|
|
586
|
+
export interface RoomSpacesPayload {
|
|
587
|
+
requestId?: string;
|
|
588
|
+
spaces: RoomSpace[];
|
|
589
|
+
}
|
|
590
|
+
export interface RoomJoinSpacePayload {
|
|
591
|
+
requestId?: string;
|
|
592
|
+
spaceId: string;
|
|
593
|
+
}
|
|
594
|
+
export interface SpaceMemberAddedPayload {
|
|
595
|
+
spaceId: string;
|
|
596
|
+
spaceName?: string;
|
|
597
|
+
role: string;
|
|
598
|
+
addedBy?: string;
|
|
599
|
+
}
|
|
600
|
+
export interface RoomReactorsPayload {
|
|
601
|
+
room: string;
|
|
602
|
+
seq: number;
|
|
603
|
+
reactors: Array<{
|
|
604
|
+
emoji: string;
|
|
605
|
+
users: Array<{
|
|
606
|
+
userId: string;
|
|
607
|
+
handle: string;
|
|
608
|
+
}>;
|
|
609
|
+
count: number;
|
|
610
|
+
}>;
|
|
611
|
+
requestId?: string;
|
|
612
|
+
}
|
|
613
|
+
export interface SpaceInvitePayload {
|
|
614
|
+
inviteId: string;
|
|
615
|
+
spaceId: string;
|
|
616
|
+
spaceName?: string;
|
|
617
|
+
role: string;
|
|
618
|
+
invitedBy?: string;
|
|
619
|
+
}
|
|
620
|
+
/** Channel settings changed: full meta replace, or an archive tombstone. */
|
|
621
|
+
export interface RoomUpdatedPayload {
|
|
622
|
+
room: string;
|
|
623
|
+
meta?: RoomMeta | undefined;
|
|
624
|
+
archived?: boolean | undefined;
|
|
625
|
+
}
|
|
626
|
+
/** Server settings changed (rename / icon / archive). */
|
|
627
|
+
export interface SpaceUpdatedPayload {
|
|
628
|
+
spaceId: string;
|
|
629
|
+
name?: string | undefined;
|
|
630
|
+
iconUrl?: string | null | undefined;
|
|
631
|
+
archived?: boolean | undefined;
|
|
632
|
+
}
|
|
633
|
+
export interface RoomSpaceJoinedPayload {
|
|
634
|
+
requestId?: string;
|
|
635
|
+
space: RoomSpace;
|
|
636
|
+
}
|
|
637
|
+
export interface RoomTopicCreatePayload {
|
|
638
|
+
requestId?: string;
|
|
639
|
+
room: string;
|
|
640
|
+
name: string;
|
|
641
|
+
}
|
|
642
|
+
export interface RoomTopicRenamePayload {
|
|
643
|
+
requestId?: string;
|
|
644
|
+
topicId: string;
|
|
645
|
+
name: string;
|
|
646
|
+
}
|
|
647
|
+
export interface RoomTopicMovePayload {
|
|
648
|
+
requestId?: string;
|
|
649
|
+
topicId: string;
|
|
650
|
+
seqs: number[];
|
|
651
|
+
toTopicId: string;
|
|
652
|
+
}
|
|
653
|
+
export interface RoomTopicMergePayload {
|
|
654
|
+
requestId?: string;
|
|
655
|
+
topicId: string;
|
|
656
|
+
intoTopicId: string;
|
|
657
|
+
}
|
|
658
|
+
export interface RoomTopicResolvePayload {
|
|
659
|
+
requestId?: string;
|
|
660
|
+
topicId: string;
|
|
661
|
+
/** Defaults to true (mark resolved) when omitted; false reopens it. */
|
|
662
|
+
resolved?: boolean;
|
|
663
|
+
}
|
|
664
|
+
export interface RoomTopicSetAttentionPayload {
|
|
665
|
+
requestId?: string;
|
|
666
|
+
topicId: string;
|
|
667
|
+
attention: RoomTopicAttention;
|
|
668
|
+
}
|
|
669
|
+
export interface RoomTopicListPayload {
|
|
670
|
+
requestId?: string;
|
|
671
|
+
room: string;
|
|
672
|
+
includeResolved?: boolean;
|
|
673
|
+
/** Also return the caller's per-bucket view state and the room head. */
|
|
674
|
+
withState?: boolean;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Per-bucket view state for the requesting user: one entry per topicId plus
|
|
678
|
+
* the reserved '' key for the room's untopicked (linear) messages. lastSeq
|
|
679
|
+
* and unreadCount cover visible user messages only; unreadCount also
|
|
680
|
+
* excludes the caller's own posts and saturates at a server-side cap. The
|
|
681
|
+
* per-topic cursors and the room-wide cursor are independent per the phase
|
|
682
|
+
* 2 contract: a linear read never implies a topic was seen, and vice versa.
|
|
683
|
+
*/
|
|
684
|
+
export interface RoomTopicBucketState {
|
|
685
|
+
lastSeq: number;
|
|
686
|
+
unreadCount: number;
|
|
687
|
+
cursor: number;
|
|
688
|
+
attention: RoomTopicAttention;
|
|
689
|
+
}
|
|
690
|
+
export interface RoomTopicResultPayload {
|
|
691
|
+
room: string;
|
|
692
|
+
topic: RoomTopic;
|
|
693
|
+
requestId?: string | undefined;
|
|
694
|
+
}
|
|
695
|
+
export interface RoomTopicsResultPayload {
|
|
696
|
+
room: string;
|
|
697
|
+
topics: RoomTopic[];
|
|
698
|
+
/** Present when the request asked withState: keyed by topicId plus ''. */
|
|
699
|
+
state?: Record<string, RoomTopicBucketState> | undefined;
|
|
700
|
+
/** Present when the request asked withState: the room head seq. */
|
|
701
|
+
headSeq?: number | undefined;
|
|
702
|
+
requestId?: string | undefined;
|
|
703
|
+
}
|
|
704
|
+
/** Broadcast to the room on any topic mutation (create/rename/move/merge/resolve). */
|
|
705
|
+
export interface RoomTopicUpdatedPayload {
|
|
706
|
+
room: string;
|
|
707
|
+
topic: RoomTopic;
|
|
708
|
+
}
|
|
709
|
+
export type RoomClientMessage = {
|
|
710
|
+
type: typeof RoomClientMessageType.AUTHENTICATE;
|
|
711
|
+
payload: {
|
|
712
|
+
token?: string;
|
|
713
|
+
username?: string;
|
|
714
|
+
handle?: string;
|
|
715
|
+
isAgent?: boolean;
|
|
716
|
+
protocolVersion?: number;
|
|
717
|
+
};
|
|
718
|
+
timestamp?: number;
|
|
719
|
+
} | {
|
|
720
|
+
type: typeof RoomClientMessageType.CREATE_ROOM;
|
|
721
|
+
payload: RoomCreatePayload;
|
|
722
|
+
timestamp?: number;
|
|
723
|
+
} | {
|
|
724
|
+
type: typeof RoomClientMessageType.INVITE;
|
|
725
|
+
payload: RoomInvitePayload;
|
|
726
|
+
timestamp?: number;
|
|
727
|
+
} | {
|
|
728
|
+
type: typeof RoomClientMessageType.REMOVE_MEMBER;
|
|
729
|
+
payload: RoomRemoveMemberPayload;
|
|
730
|
+
timestamp?: number;
|
|
731
|
+
} | {
|
|
732
|
+
type: typeof RoomClientMessageType.SEARCH;
|
|
733
|
+
payload: RoomSearchPayload;
|
|
734
|
+
timestamp?: number;
|
|
735
|
+
} | {
|
|
736
|
+
type: typeof RoomClientMessageType.JOIN;
|
|
737
|
+
payload: {
|
|
738
|
+
room: string;
|
|
739
|
+
workspaceId?: string;
|
|
740
|
+
requestId?: string;
|
|
741
|
+
code?: string;
|
|
742
|
+
sinceSeq?: number;
|
|
743
|
+
limit?: number;
|
|
744
|
+
reason?: string;
|
|
745
|
+
source?: string;
|
|
746
|
+
hook?: string;
|
|
747
|
+
suggestionId?: string;
|
|
748
|
+
};
|
|
749
|
+
timestamp?: number;
|
|
750
|
+
} | {
|
|
751
|
+
type: typeof RoomClientMessageType.HISTORY;
|
|
752
|
+
payload: {
|
|
753
|
+
room: string;
|
|
754
|
+
requestId?: string;
|
|
755
|
+
sinceSeq?: number;
|
|
756
|
+
beforeSeq?: number;
|
|
757
|
+
atMs?: number;
|
|
758
|
+
limit?: number;
|
|
759
|
+
};
|
|
760
|
+
timestamp?: number;
|
|
761
|
+
} | {
|
|
762
|
+
type: typeof RoomClientMessageType.PEEK;
|
|
763
|
+
payload: {
|
|
764
|
+
room: string;
|
|
765
|
+
requestId?: string;
|
|
766
|
+
sinceSeq?: number;
|
|
767
|
+
beforeSeq?: number;
|
|
768
|
+
atMs?: number;
|
|
769
|
+
limit?: number;
|
|
770
|
+
};
|
|
771
|
+
timestamp?: number;
|
|
772
|
+
} | {
|
|
773
|
+
type: typeof RoomClientMessageType.LEAVE;
|
|
774
|
+
payload: {
|
|
775
|
+
room: string;
|
|
776
|
+
};
|
|
777
|
+
timestamp?: number;
|
|
778
|
+
} | {
|
|
779
|
+
type: typeof RoomClientMessageType.POST;
|
|
780
|
+
payload: {
|
|
781
|
+
room: string;
|
|
782
|
+
text?: string;
|
|
783
|
+
attachments?: RoomAttachment[];
|
|
784
|
+
inReplyTo?: number;
|
|
785
|
+
/** Post directly into a topic; the room's linear stream is unaffected. */
|
|
786
|
+
topicId?: string;
|
|
787
|
+
clientMsgId?: string;
|
|
788
|
+
reason?: string;
|
|
789
|
+
requestId?: string;
|
|
790
|
+
};
|
|
791
|
+
timestamp?: number;
|
|
792
|
+
} | {
|
|
793
|
+
type: typeof RoomClientMessageType.REACT;
|
|
794
|
+
payload: {
|
|
795
|
+
requestId?: string;
|
|
796
|
+
room: string;
|
|
797
|
+
seq: number;
|
|
798
|
+
emoji: string;
|
|
799
|
+
op: "add" | "remove";
|
|
800
|
+
};
|
|
801
|
+
timestamp?: number;
|
|
802
|
+
} | {
|
|
803
|
+
type: typeof RoomClientMessageType.EDIT;
|
|
804
|
+
payload: {
|
|
805
|
+
requestId?: string;
|
|
806
|
+
room: string;
|
|
807
|
+
seq: number;
|
|
808
|
+
text: string;
|
|
809
|
+
};
|
|
810
|
+
timestamp?: number;
|
|
811
|
+
} | {
|
|
812
|
+
type: typeof RoomClientMessageType.DELETE;
|
|
813
|
+
payload: {
|
|
814
|
+
requestId?: string;
|
|
815
|
+
room: string;
|
|
816
|
+
seq: number;
|
|
817
|
+
};
|
|
818
|
+
timestamp?: number;
|
|
819
|
+
} | {
|
|
820
|
+
type: typeof RoomClientMessageType.THREAD;
|
|
821
|
+
payload: {
|
|
822
|
+
requestId?: string;
|
|
823
|
+
room: string;
|
|
824
|
+
rootSeq: number;
|
|
825
|
+
beforeSeq?: number;
|
|
826
|
+
sinceSeq?: number;
|
|
827
|
+
limit?: number;
|
|
828
|
+
};
|
|
829
|
+
timestamp?: number;
|
|
830
|
+
} | {
|
|
831
|
+
type: typeof RoomClientMessageType.PIN;
|
|
832
|
+
payload: {
|
|
833
|
+
requestId?: string;
|
|
834
|
+
room: string;
|
|
835
|
+
seq: number;
|
|
836
|
+
};
|
|
837
|
+
timestamp?: number;
|
|
838
|
+
} | {
|
|
839
|
+
type: typeof RoomClientMessageType.UNPIN;
|
|
840
|
+
payload: {
|
|
841
|
+
requestId?: string;
|
|
842
|
+
room: string;
|
|
843
|
+
seq: number;
|
|
844
|
+
};
|
|
845
|
+
timestamp?: number;
|
|
846
|
+
} | {
|
|
847
|
+
type: typeof RoomClientMessageType.PINS;
|
|
848
|
+
payload: {
|
|
849
|
+
requestId?: string;
|
|
850
|
+
room: string;
|
|
851
|
+
limit?: number;
|
|
852
|
+
};
|
|
853
|
+
timestamp?: number;
|
|
854
|
+
} | {
|
|
855
|
+
type: typeof RoomClientMessageType.REACTORS;
|
|
856
|
+
payload: {
|
|
857
|
+
requestId?: string;
|
|
858
|
+
room: string;
|
|
859
|
+
seq: number;
|
|
860
|
+
emoji?: string;
|
|
861
|
+
limit?: number;
|
|
862
|
+
};
|
|
863
|
+
timestamp?: number;
|
|
864
|
+
} | {
|
|
865
|
+
type: typeof RoomClientMessageType.REPORT;
|
|
866
|
+
payload: RoomReportPayload;
|
|
867
|
+
timestamp?: number;
|
|
868
|
+
} | {
|
|
869
|
+
type: typeof RoomClientMessageType.MUTE;
|
|
870
|
+
payload: RoomMutePayload;
|
|
871
|
+
timestamp?: number;
|
|
872
|
+
} | {
|
|
873
|
+
type: typeof RoomClientMessageType.KICK;
|
|
874
|
+
payload: RoomModerateMemberPayload;
|
|
875
|
+
timestamp?: number;
|
|
876
|
+
} | {
|
|
877
|
+
type: typeof RoomClientMessageType.BAN;
|
|
878
|
+
payload: RoomModerateMemberPayload;
|
|
879
|
+
timestamp?: number;
|
|
880
|
+
} | {
|
|
881
|
+
type: typeof RoomClientMessageType.ROLE_CHANGE;
|
|
882
|
+
payload: RoomRoleChangePayload;
|
|
883
|
+
timestamp?: number;
|
|
884
|
+
} | {
|
|
885
|
+
type: typeof RoomClientMessageType.SET_READ_ONLY;
|
|
886
|
+
payload: RoomSetReadOnlyPayload;
|
|
887
|
+
timestamp?: number;
|
|
888
|
+
} | {
|
|
889
|
+
type: typeof RoomClientMessageType.AUDIT_LOG;
|
|
890
|
+
payload: RoomAuditLogRequestPayload;
|
|
891
|
+
timestamp?: number;
|
|
892
|
+
} | {
|
|
893
|
+
type: typeof RoomClientMessageType.SPACES;
|
|
894
|
+
payload?: {
|
|
895
|
+
requestId?: string;
|
|
896
|
+
};
|
|
897
|
+
timestamp?: number;
|
|
898
|
+
} | {
|
|
899
|
+
type: typeof RoomClientMessageType.JOIN_SPACE;
|
|
900
|
+
payload: RoomJoinSpacePayload;
|
|
901
|
+
timestamp?: number;
|
|
902
|
+
} | {
|
|
903
|
+
type: typeof RoomClientMessageType.READ_STATE;
|
|
904
|
+
payload: {
|
|
905
|
+
requestId?: string;
|
|
906
|
+
rooms?: string[];
|
|
907
|
+
};
|
|
908
|
+
timestamp?: number;
|
|
909
|
+
} | {
|
|
910
|
+
type: typeof RoomClientMessageType.SEARCH_ENTRIES;
|
|
911
|
+
payload: {
|
|
912
|
+
requestId?: string;
|
|
913
|
+
room: string;
|
|
914
|
+
query: string;
|
|
915
|
+
beforeSeq?: number;
|
|
916
|
+
sinceSeq?: number;
|
|
917
|
+
fromMs?: number;
|
|
918
|
+
toMs?: number;
|
|
919
|
+
limit?: number;
|
|
920
|
+
};
|
|
921
|
+
timestamp?: number;
|
|
922
|
+
} | {
|
|
923
|
+
type: typeof RoomClientMessageType.WHO;
|
|
924
|
+
payload: {
|
|
925
|
+
room: string;
|
|
926
|
+
requestId?: string;
|
|
927
|
+
offset?: number;
|
|
928
|
+
limit?: number;
|
|
929
|
+
};
|
|
930
|
+
timestamp?: number;
|
|
931
|
+
} | {
|
|
932
|
+
type: typeof RoomClientMessageType.TYPING;
|
|
933
|
+
payload: {
|
|
934
|
+
room: string;
|
|
935
|
+
state: "start" | "stop";
|
|
936
|
+
};
|
|
937
|
+
timestamp?: number;
|
|
938
|
+
} | {
|
|
939
|
+
type: typeof RoomClientMessageType.STATUS;
|
|
940
|
+
payload: {
|
|
941
|
+
status: RoomUserStatus;
|
|
942
|
+
statusText?: string | null;
|
|
943
|
+
};
|
|
944
|
+
timestamp?: number;
|
|
945
|
+
} | {
|
|
946
|
+
type: typeof RoomClientMessageType.ACK;
|
|
947
|
+
/** `topicId` acks a per-topic cursor; the room-wide cursor is separate. */
|
|
948
|
+
payload: {
|
|
949
|
+
room: string;
|
|
950
|
+
seq: number;
|
|
951
|
+
topicId?: string;
|
|
952
|
+
};
|
|
953
|
+
timestamp?: number;
|
|
954
|
+
} | {
|
|
955
|
+
type: typeof RoomClientMessageType.PING;
|
|
956
|
+
payload?: Record<string, never>;
|
|
957
|
+
timestamp?: number;
|
|
958
|
+
} | {
|
|
959
|
+
type: typeof RoomClientMessageType.FRIENDS;
|
|
960
|
+
payload?: Record<string, never>;
|
|
961
|
+
timestamp?: number;
|
|
962
|
+
} | {
|
|
963
|
+
type: typeof RoomClientMessageType.DM_OPEN;
|
|
964
|
+
payload: RoomDmOpenPayload;
|
|
965
|
+
timestamp?: number;
|
|
966
|
+
} | {
|
|
967
|
+
type: typeof RoomClientMessageType.DM_HISTORY;
|
|
968
|
+
payload: RoomDmHistoryPayload;
|
|
969
|
+
timestamp?: number;
|
|
970
|
+
} | {
|
|
971
|
+
type: typeof RoomClientMessageType.DM_SEND;
|
|
972
|
+
payload: RoomDmSendPayload;
|
|
973
|
+
timestamp?: number;
|
|
974
|
+
} | {
|
|
975
|
+
type: typeof RoomClientMessageType.DM_READ;
|
|
976
|
+
payload: RoomDmReadPayload;
|
|
977
|
+
timestamp?: number;
|
|
978
|
+
} | {
|
|
979
|
+
type: typeof RoomClientMessageType.TOPIC_CREATE;
|
|
980
|
+
payload: RoomTopicCreatePayload;
|
|
981
|
+
timestamp?: number;
|
|
982
|
+
} | {
|
|
983
|
+
type: typeof RoomClientMessageType.TOPIC_RENAME;
|
|
984
|
+
payload: RoomTopicRenamePayload;
|
|
985
|
+
timestamp?: number;
|
|
986
|
+
} | {
|
|
987
|
+
type: typeof RoomClientMessageType.TOPIC_MOVE;
|
|
988
|
+
payload: RoomTopicMovePayload;
|
|
989
|
+
timestamp?: number;
|
|
990
|
+
} | {
|
|
991
|
+
type: typeof RoomClientMessageType.TOPIC_MERGE;
|
|
992
|
+
payload: RoomTopicMergePayload;
|
|
993
|
+
timestamp?: number;
|
|
994
|
+
} | {
|
|
995
|
+
type: typeof RoomClientMessageType.TOPIC_RESOLVE;
|
|
996
|
+
payload: RoomTopicResolvePayload;
|
|
997
|
+
timestamp?: number;
|
|
998
|
+
} | {
|
|
999
|
+
type: typeof RoomClientMessageType.TOPIC_SET_ATTENTION;
|
|
1000
|
+
payload: RoomTopicSetAttentionPayload;
|
|
1001
|
+
timestamp?: number;
|
|
1002
|
+
} | {
|
|
1003
|
+
type: typeof RoomClientMessageType.TOPIC_LIST;
|
|
1004
|
+
payload: RoomTopicListPayload;
|
|
1005
|
+
timestamp?: number;
|
|
1006
|
+
};
|
|
1007
|
+
export type RoomServerMessage = {
|
|
1008
|
+
type: typeof RoomServerMessageType.AUTH_SUCCESS;
|
|
1009
|
+
payload: RoomAuthSuccessPayload;
|
|
1010
|
+
timestamp: number;
|
|
1011
|
+
} | {
|
|
1012
|
+
type: typeof RoomServerMessageType.ROOM_CREATED;
|
|
1013
|
+
payload: RoomCreatedPayload;
|
|
1014
|
+
timestamp: number;
|
|
1015
|
+
} | {
|
|
1016
|
+
type: typeof RoomServerMessageType.ROOM_INVITED;
|
|
1017
|
+
payload: RoomInvitedPayload;
|
|
1018
|
+
timestamp: number;
|
|
1019
|
+
} | {
|
|
1020
|
+
type: typeof RoomServerMessageType.ROOM_MEMBER_REMOVED;
|
|
1021
|
+
payload: RoomMemberRemovedPayload;
|
|
1022
|
+
timestamp: number;
|
|
1023
|
+
} | {
|
|
1024
|
+
type: typeof RoomServerMessageType.ROOMS;
|
|
1025
|
+
payload: {
|
|
1026
|
+
rooms: RoomMeta[];
|
|
1027
|
+
requestId?: string;
|
|
1028
|
+
};
|
|
1029
|
+
timestamp: number;
|
|
1030
|
+
} | {
|
|
1031
|
+
type: typeof RoomServerMessageType.BACKFILL;
|
|
1032
|
+
payload: RoomBackfillPayload;
|
|
1033
|
+
timestamp: number;
|
|
1034
|
+
} | {
|
|
1035
|
+
type: typeof RoomServerMessageType.HISTORY;
|
|
1036
|
+
payload: RoomBackfillPayload;
|
|
1037
|
+
timestamp: number;
|
|
1038
|
+
} | {
|
|
1039
|
+
type: typeof RoomServerMessageType.PEEK_RESULT;
|
|
1040
|
+
payload: RoomBackfillPayload;
|
|
1041
|
+
timestamp: number;
|
|
1042
|
+
} | {
|
|
1043
|
+
type: typeof RoomServerMessageType.MESSAGE;
|
|
1044
|
+
payload: RoomMessagePayload;
|
|
1045
|
+
timestamp: number;
|
|
1046
|
+
} | {
|
|
1047
|
+
type: typeof RoomServerMessageType.ENTRY_UPDATED;
|
|
1048
|
+
payload: RoomEntryUpdatedPayload;
|
|
1049
|
+
timestamp: number;
|
|
1050
|
+
} | {
|
|
1051
|
+
type: typeof RoomServerMessageType.THREAD;
|
|
1052
|
+
payload: RoomThreadPayload;
|
|
1053
|
+
timestamp: number;
|
|
1054
|
+
} | {
|
|
1055
|
+
type: typeof RoomServerMessageType.PINS;
|
|
1056
|
+
payload: RoomPinsPayload;
|
|
1057
|
+
timestamp: number;
|
|
1058
|
+
} | {
|
|
1059
|
+
type: typeof RoomServerMessageType.ROOM_REPORTED;
|
|
1060
|
+
payload: RoomReportedPayload;
|
|
1061
|
+
timestamp: number;
|
|
1062
|
+
} | {
|
|
1063
|
+
type: typeof RoomServerMessageType.ROOM_MUTED;
|
|
1064
|
+
payload: RoomMutedPayload;
|
|
1065
|
+
timestamp: number;
|
|
1066
|
+
} | {
|
|
1067
|
+
type: typeof RoomServerMessageType.ROOM_BANNED;
|
|
1068
|
+
payload: RoomBannedPayload;
|
|
1069
|
+
timestamp: number;
|
|
1070
|
+
} | {
|
|
1071
|
+
type: typeof RoomServerMessageType.ROOM_MEMBER_ROLE_CHANGED;
|
|
1072
|
+
payload: RoomMemberRoleChangedPayload;
|
|
1073
|
+
timestamp: number;
|
|
1074
|
+
} | {
|
|
1075
|
+
type: typeof RoomServerMessageType.ROOM_READ_ONLY_SET;
|
|
1076
|
+
payload: RoomReadOnlySetPayload;
|
|
1077
|
+
timestamp: number;
|
|
1078
|
+
} | {
|
|
1079
|
+
type: typeof RoomServerMessageType.ROOM_AUDIT_LOG;
|
|
1080
|
+
payload: RoomAuditLogPayload;
|
|
1081
|
+
timestamp: number;
|
|
1082
|
+
} | {
|
|
1083
|
+
type: typeof RoomServerMessageType.SPACES;
|
|
1084
|
+
payload: RoomSpacesPayload;
|
|
1085
|
+
timestamp: number;
|
|
1086
|
+
} | {
|
|
1087
|
+
type: typeof RoomServerMessageType.SPACE_JOINED;
|
|
1088
|
+
payload: RoomSpaceJoinedPayload;
|
|
1089
|
+
timestamp: number;
|
|
1090
|
+
} | {
|
|
1091
|
+
type: typeof RoomServerMessageType.SPACE_MEMBER_ADDED;
|
|
1092
|
+
payload: SpaceMemberAddedPayload;
|
|
1093
|
+
timestamp: number;
|
|
1094
|
+
} | {
|
|
1095
|
+
type: typeof RoomServerMessageType.ROOM_UPDATED;
|
|
1096
|
+
payload: RoomUpdatedPayload;
|
|
1097
|
+
timestamp?: number;
|
|
1098
|
+
} | {
|
|
1099
|
+
type: typeof RoomServerMessageType.SPACE_UPDATED;
|
|
1100
|
+
payload: SpaceUpdatedPayload;
|
|
1101
|
+
timestamp?: number;
|
|
1102
|
+
} | {
|
|
1103
|
+
type: typeof RoomServerMessageType.SPACE_INVITE;
|
|
1104
|
+
payload: SpaceInvitePayload;
|
|
1105
|
+
timestamp: number;
|
|
1106
|
+
} | {
|
|
1107
|
+
type: typeof RoomServerMessageType.REACTORS;
|
|
1108
|
+
payload: RoomReactorsPayload;
|
|
1109
|
+
timestamp: number;
|
|
1110
|
+
} | {
|
|
1111
|
+
type: typeof RoomServerMessageType.READ_STATE;
|
|
1112
|
+
payload: RoomReadStatePayload;
|
|
1113
|
+
timestamp: number;
|
|
1114
|
+
} | {
|
|
1115
|
+
type: typeof RoomServerMessageType.SEARCH_RESULTS;
|
|
1116
|
+
payload: RoomSearchResultsPayload;
|
|
1117
|
+
timestamp: number;
|
|
1118
|
+
} | {
|
|
1119
|
+
type: typeof RoomServerMessageType.PRESENCE;
|
|
1120
|
+
payload: RoomPresencePayload;
|
|
1121
|
+
timestamp: number;
|
|
1122
|
+
} | {
|
|
1123
|
+
type: typeof RoomServerMessageType.RESYNC;
|
|
1124
|
+
payload: RoomResyncPayload;
|
|
1125
|
+
timestamp: number;
|
|
1126
|
+
} | {
|
|
1127
|
+
type: typeof RoomServerMessageType.PRESENCE_DELTA;
|
|
1128
|
+
payload: RoomPresenceDeltaPayload;
|
|
1129
|
+
timestamp: number;
|
|
1130
|
+
} | {
|
|
1131
|
+
type: typeof RoomServerMessageType.WHO;
|
|
1132
|
+
payload: RoomWhoPayload;
|
|
1133
|
+
timestamp: number;
|
|
1134
|
+
} | {
|
|
1135
|
+
type: typeof RoomServerMessageType.TYPING;
|
|
1136
|
+
payload: RoomTypingPayload;
|
|
1137
|
+
timestamp: number;
|
|
1138
|
+
} | {
|
|
1139
|
+
type: typeof RoomServerMessageType.ERROR;
|
|
1140
|
+
payload: RoomErrorPayload;
|
|
1141
|
+
timestamp: number;
|
|
1142
|
+
} | {
|
|
1143
|
+
type: typeof RoomServerMessageType.PONG;
|
|
1144
|
+
payload: Record<string, never>;
|
|
1145
|
+
timestamp: number;
|
|
1146
|
+
} | {
|
|
1147
|
+
type: typeof RoomServerMessageType.FRIENDS;
|
|
1148
|
+
payload: {
|
|
1149
|
+
friends: RoomFriendPresence[];
|
|
1150
|
+
};
|
|
1151
|
+
timestamp: number;
|
|
1152
|
+
} | {
|
|
1153
|
+
type: typeof RoomServerMessageType.DM_OPENED;
|
|
1154
|
+
payload: RoomDmOpenedPayload;
|
|
1155
|
+
timestamp: number;
|
|
1156
|
+
} | {
|
|
1157
|
+
type: typeof RoomServerMessageType.DM_HISTORY;
|
|
1158
|
+
payload: RoomDmHistoryResultPayload;
|
|
1159
|
+
timestamp: number;
|
|
1160
|
+
} | {
|
|
1161
|
+
type: typeof RoomServerMessageType.DM_MESSAGE;
|
|
1162
|
+
payload: RoomDmMessagePayload;
|
|
1163
|
+
timestamp: number;
|
|
1164
|
+
} | {
|
|
1165
|
+
type: typeof RoomServerMessageType.DM_INBOX_UPDATED;
|
|
1166
|
+
payload: RoomDmInboxUpdatedPayload;
|
|
1167
|
+
timestamp: number;
|
|
1168
|
+
} | {
|
|
1169
|
+
type: typeof RoomServerMessageType.TOPIC;
|
|
1170
|
+
payload: RoomTopicResultPayload;
|
|
1171
|
+
timestamp: number;
|
|
1172
|
+
} | {
|
|
1173
|
+
type: typeof RoomServerMessageType.TOPICS;
|
|
1174
|
+
payload: RoomTopicsResultPayload;
|
|
1175
|
+
timestamp: number;
|
|
1176
|
+
} | {
|
|
1177
|
+
type: typeof RoomServerMessageType.TOPIC_UPDATED;
|
|
1178
|
+
payload: RoomTopicUpdatedPayload;
|
|
1179
|
+
timestamp: number;
|
|
1180
|
+
};
|
|
1181
|
+
export type RoomServerMessageOf<T extends RoomServerMessageType> = Extract<RoomServerMessage, {
|
|
1182
|
+
type: T;
|
|
1183
|
+
}>;
|