-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
chat_ui.avdl
565 lines (507 loc) · 15.7 KB
/
chat_ui.avdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
@namespace("chat.1")
protocol chatUi {
import idl "../keybase1" as keybase1;
import idl "../gregor1" as gregor1;
import idl "../stellar1" as stellar1;
import idl "common.avdl";
import idl "unfurl.avdl";
import idl "commands.avdl";
record UIPagination {
string next;
string previous;
int num;
boolean last;
}
record UIInboxSmallTeamRow {
string convID;
string name;
gregor1.Time time;
union { null, string } snippet;
SnippetDecoration snippetDecoration;
union { null, string } draft;
boolean isMuted;
boolean isTeam;
}
enum UIInboxBigTeamRowTyp {
LABEL_1,
CHANNEL_2
}
record UIInboxBigTeamChannelRow {
string convID;
string teamname;
string channelname;
union { null, string } draft;
boolean isMuted;
}
record UIInboxBigTeamLabelRow {
string name;
string id;
}
variant UIInboxBigTeamRow switch (UIInboxBigTeamRowTyp state) {
case LABEL: UIInboxBigTeamLabelRow;
case CHANNEL: UIInboxBigTeamChannelRow;
}
record UIInboxReselectInfo {
// we use this to defeat any race conditions, the UI can double check it actually has this selected
string oldConvID;
union { null, string } newConvID;
}
record UIInboxLayout {
int totalSmallTeams;
array<UIInboxSmallTeamRow> smallTeams;
array<UIInboxBigTeamRow> bigTeams;
union { null, UIInboxReselectInfo } reselectInfo;
array<UIInboxSmallTeamRow> widgetList;
}
record UnverifiedInboxUIItemMetadata {
string channelName;
string headline;
string headlineDecorated;
string snippet;
SnippetDecoration snippetDecoration;
array<string> writerNames;
array<string> resetParticipants;
}
record UnverifiedInboxUIItem {
string convID;
string tlfID;
TopicType topicType;
boolean isPublic;
string name;
keybase1.TLFVisibility visibility;
ConversationStatus status;
ConversationMembersType membersType;
ConversationMemberStatus memberStatus;
TeamType teamType;
union{ null, ConversationNotificationInfo } notifications;
gregor1.Time time;
ConversationVers version;
LocalConversationVers localVersion;
union { null, RetentionPolicy } convRetention;
union { null, RetentionPolicy } teamRetention;
MessageID maxMsgID;
MessageID maxVisibleMsgID;
MessageID readMsgID;
union { null , UnverifiedInboxUIItemMetadata } localMetadata;
union { null, string } draft;
union { null, ConversationFinalizeInfo } finalizeInfo;
array<ConversationMetadata> supersedes;
array<ConversationMetadata> supersededBy;
ConversationCommandGroups commands;
}
record UnverifiedInboxUIItems {
array<UnverifiedInboxUIItem> items;
boolean offline;
}
enum UIParticipantType {
NONE_0,
USER_1, // Keybase or SBS
PHONENO_2,
EMAIL_3
}
record UIParticipant {
UIParticipantType type;
string assertion;
boolean inConvName;
union { null, string } fullName;
union { null, string } contactName; // if set this is an imptofu conversation with someone in our contacts
}
record UIPinnedMessage {
UIMessage message;
string pinnerUsername;
}
record InboxUIItem {
string convID;
string tlfID;
TopicType topicType;
boolean isPublic;
boolean isEmpty;
string name;
string snippet;
SnippetDecoration snippetDecoration;
string channel;
string headline;
string headlineDecorated;
union { null, string } draft;
keybase1.TLFVisibility visibility;
array<UIParticipant> participants;
array<string> resetParticipants;
ConversationStatus status;
ConversationMembersType membersType;
ConversationMemberStatus memberStatus;
TeamType teamType;
gregor1.Time time;
union { null, ConversationNotificationInfo } notifications;
union { null, ConversationCreatorInfoLocal } creatorInfo;
ConversationVers version;
LocalConversationVers localVersion;
MessageID maxMsgID;
MessageID maxVisibleMsgID;
MessageID readMsgID;
union { null, RetentionPolicy } convRetention;
union { null, RetentionPolicy } teamRetention;
union { null, ConversationSettingsLocal } convSettings;
// Finalized convo stuff (KBFS only)
union { null, ConversationFinalizeInfo } finalizeInfo;
array<ConversationMetadata> supersedes;
array<ConversationMetadata> supersededBy;
// Command support
ConversationCommandGroups commands;
ConversationCommandGroups botCommands;
map<string, string> botAliases;
// Pinned message
union { null, UIPinnedMessage} pinnedMsg;
}
record InboxUIItemError {
ConversationErrorType typ;
string message;
string unverifiedTLFName;
// Only set if typ is for rekeying.
union { null, ConversationErrorRekey} rekeyInfo;
UnverifiedInboxUIItem remoteConv;
}
record InboxUIItems {
array<InboxUIItem> items;
boolean offline;
}
record UIChannelNameMention {
string name;
string convID;
}
record UIAssetUrlInfo {
string previewUrl;
string fullUrl;
boolean fullUrlCached;
string mimeType;
union { null, string } videoDuration;
boolean inlineVideoPlayable;
}
record UIPaymentInfo {
union { null, stellar1.AccountID } accountID; // "GXXXXXXX..."
string amountDescription; // "1,323.1234567 XLM"
string worth; // "$123.23"
string worthAtSendTime; // "$123.23 CLP", amount in current user's display currency if this is a pure XLM tx
stellar1.BalanceDelta delta; // NONE/INCREASE/DECREASE (e.g. INCREASE for "+ 1,323.1234567 XLM" amount above)
string note; // secret note
stellar1.PaymentID paymentID; // opaque paymentID
stellar1.PaymentStatus status; // NONE, PENDING, CLAIMABLE, COMPLETED, ERROR, UNKNOWN
string statusDescription; // "pending", "completed", "error"
string statusDetail;
boolean showCancel; // true if cancel is an option for this payment
string fromUsername;
string toUsername;
// for path payments
string sourceAmount;
stellar1.Asset sourceAsset;
string issuerDescription;
}
record UIRequestInfo {
string amount;
string amountDescription;
union { null, stellar1.Asset } asset;
union { null, stellar1.OutsideCurrencyCode } currency;
string worthAtRequestTime;
stellar1.RequestStatus status;
}
record UIMessageUnfurlInfo {
MessageID unfurlMessageID;
string url;
UnfurlDisplay unfurl;
boolean isCollapsed;
}
record UIMessageValid {
MessageID messageID;
gregor1.Time ctime;
union { null, string } outboxID;
MessageBody messageBody;
union { null, string } decoratedTextBody;
string bodySummary;
string senderUsername;
string senderDeviceName;
string senderDeviceType;
gregor1.UID senderUID;
gregor1.DeviceID senderDeviceID;
boolean superseded;
union { null, UIAssetUrlInfo } assetUrlInfo;
union { null, gregor1.Time } senderDeviceRevokedAt;
array<string> atMentions;
ChannelMention channelMention;
array<UIChannelNameMention> channelNameMentions;
boolean isEphemeral;
boolean isEphemeralExpired;
union { null, string} explodedBy;
gregor1.Time etime;
// reactionText -> [Reaction(username, reactionMsgID)...]
ReactionMap reactions;
boolean hasPairwiseMacs;
array<UIPaymentInfo> paymentInfos;
union { null, UIRequestInfo } requestInfo;
array<UIMessageUnfurlInfo> unfurls;
boolean isCollapsed;
union { null, string } flipGameID;
boolean isDeleteable;
boolean isEditable;
union { null, UIMessage } replyTo;
union { null, MessageID} pinnedMessageID;
// Non-empty if this message is keyed for a bot
string botUsername;
}
record UIMessageOutbox {
OutboxState state;
string outboxID;
MessageType messageType;
string body;
union { null, string } decoratedTextBody;
gregor1.Time ctime;
double ordinal;
boolean isEphemeral;
union { null, string} flipGameID;
union { null, UIMessage } replyTo;
// For attachments
string filename;
string title;
union { null, MakePreviewRes } preview;
}
record UIMessageJourneycard {
double ordinal; // Position in conversation. A float like {msgID:4,offset:1} -> "4.001"
JourneycardType cardType;
MessageID highlightMsgID; // Message ID to highlight in MSG_ATTENTION
boolean openTeam; // Whether the team is open. Can be erroneously false due to caching. Only filled for ADD_PEOPLE.
}
enum MessageUnboxedState {
VALID_1,
ERROR_2,
OUTBOX_3,
PLACEHOLDER_4,
JOURNEYCARD_5
}
variant UIMessage switch (MessageUnboxedState state) {
case VALID: UIMessageValid;
case ERROR: MessageUnboxedError;
case OUTBOX: UIMessageOutbox;
case PLACEHOLDER: MessageUnboxedPlaceholder;
case JOURNEYCARD: UIMessageJourneycard;
}
record UIMessages {
array<UIMessage> messages;
union { null, UIPagination } pagination;
}
record UITeamMention {
boolean inTeam;
boolean open;
union { null, string } description;
union { null, int } numMembers;
array<string> publicAdmins;
union { null, string } convID;
}
enum UITextDecorationTyp {
PAYMENT_0,
ATMENTION_1,
CHANNELNAMEMENTION_2,
MAYBEMENTION_3,
LINK_4,
MAILTO_5,
KBFSPATH_6
}
enum UIMaybeMentionStatus {
UNKNOWN_0,
USER_1,
TEAM_2,
NOTHING_3
}
record UILinkDecoration {
string display;
string url;
string punycode;
}
variant UIMaybeMentionInfo switch (UIMaybeMentionStatus status) {
case UNKNOWN: void;
case USER: void;
case TEAM: UITeamMention;
case NOTHING: void;
}
variant UITextDecoration switch (UITextDecorationTyp typ) {
case PAYMENT: TextPayment;
case ATMENTION: string;
case CHANNELNAMEMENTION: UIChannelNameMention;
case MAYBEMENTION: MaybeMention;
case LINK: UILinkDecoration;
case MAILTO: UILinkDecoration;
case KBFSPATH: KBFSPath;
}
void chatAttachmentDownloadStart(int sessionID);
void chatAttachmentDownloadProgress(int sessionID, long bytesComplete, long bytesTotal) oneway;
void chatAttachmentDownloadDone(int sessionID);
void chatInboxLayout(int sessionID, string layout); // layout is JSON of UIInboxLayout
void chatInboxUnverified(int sessionID, string inbox); // inbox is JSON of array<UnverifiedInboxUIItems>
void chatInboxConversation(int sessionID, string convs); // convs is JSON of array<InboxUIItem>
void chatInboxFailed(int sessionID, ConversationID convID, InboxUIItemError error);
enum UIChatThreadStatusTyp {
NONE_0,
SERVER_1,
VALIDATING_2,
VALIDATED_3
}
variant UIChatThreadStatus switch (UIChatThreadStatusTyp typ) {
case NONE: void;
case SERVER: void;
case VALIDATING: int;
case VALIDATED: void;
}
void chatThreadCached(int sessionID, union { null, string } thread); // thread is JSON of UIMessages
void chatThreadFull(int sessionID, string thread);
void chatThreadStatus(int sessionID, UIChatThreadStatus status);
void chatSearchHit(int sessionID, ChatSearchHit searchHit);
void chatSearchDone(int sessionID, int numHits);
record UIChatSearchConvHit {
string convID;
TeamType teamType;
string name;
gregor1.Time mtime;
}
record UIChatSearchConvHits {
array<UIChatSearchConvHit> hits;
boolean unreadMatches;
}
void chatSearchInboxStart(int sessionID);
void chatSearchInboxHit(int sessionID, ChatSearchInboxHit searchHit);
void chatSearchInboxDone(int sessionID, ChatSearchInboxDone res);
void chatSearchIndexStatus(int sessionID, ChatSearchIndexStatus status);
void chatSearchConvHits(int sessionID, UIChatSearchConvHits hits);
boolean chatConfirmChannelDelete(int sessionID, string channel);
// Chat Stellar send confirm screen UI
record UIChatPayment {
string username;
string fullName;
string xlmAmount;
union { null, string } error;
union { null, string } displayAmount;
}
record UIChatPaymentSummary {
string xlmTotal;
string displayTotal;
array<UIChatPayment> payments;
}
void chatStellarShowConfirm(int sessionID);
boolean chatStellarDataConfirm(int sessionID, UIChatPaymentSummary summary);
boolean chatStellarDataError(int sessionID, keybase1.Status error);
void chatStellarDone(int sessionID, boolean canceled);
record GiphySearchResult {
string targetUrl;
string previewUrl;
int previewWidth;
int previewHeight;
boolean previewIsVideo;
}
record GiphySearchResults {
array<GiphySearchResult> results;
string galleryUrl;
}
void chatGiphySearchResults(int sessionID, string convID, GiphySearchResults results);
void chatGiphyToggleResultWindow(int sessionID, string convID, boolean show, boolean clearInput);
void chatShowManageChannels(int sessionID, string teamname);
enum UICoinFlipPhase {
COMMITMENT_0,
REVEALS_1,
COMPLETE_2,
ERROR_3
}
record UICoinFlipErrorParticipant {
string user;
string device;
}
record UICoinFlipAbsenteeError {
array<UICoinFlipErrorParticipant> absentees;
}
enum UICoinFlipErrorTyp {
GENERIC_0,
ABSENTEE_1,
TIMEOUT_2,
ABORTED_3,
DUPREG_4,
DUPCOMMITCOMPLETE_5,
DUPREVEAL_6,
COMMITMISMATCH_7
}
variant UICoinFlipError switch (UICoinFlipErrorTyp typ) {
case GENERIC: string;
case ABSENTEE: UICoinFlipAbsenteeError;
case TIMEOUT: void;
case ABORTED: void;
case DUPREG: UICoinFlipErrorParticipant;
case DUPCOMMITCOMPLETE: UICoinFlipErrorParticipant;
case DUPREVEAL: UICoinFlipErrorParticipant;
case COMMITMISMATCH: UICoinFlipErrorParticipant;
}
enum UICoinFlipResultTyp {
NUMBER_0,
SHUFFLE_1,
DECK_2,
HANDS_3,
COIN_4
}
record UICoinFlipHand {
string target;
array<int> hand;
}
variant UICoinFlipResult switch (UICoinFlipResultTyp typ) {
case NUMBER: string;
case SHUFFLE: array<string>;
case DECK: array<int>;
case HANDS: array<UICoinFlipHand>;
case COIN: bool; // heads?
}
record UICoinFlipParticipant {
string uid;
string deviceID;
string username;
string deviceName;
string commitment;
union { null, string } reveal;
}
record UICoinFlipStatus {
string gameID;
UICoinFlipPhase phase;
string progressText;
string resultText;
string commitmentVisualization;
string revealVisualization;
array<UICoinFlipParticipant> participants;
union { null, UICoinFlipError } errorInfo;
union { null, UICoinFlipResult } resultInfo;
}
void chatCoinFlipStatus(int sessionID, array<UICoinFlipStatus> statuses);
record UICommandMarkdown {
string body;
union { null, string} title;
}
void chatCommandMarkdown(int sessionID, string convID, union { null, UICommandMarkdown } md);
void chatMaybeMentionUpdate(int sessionID, string teamName, string channel, UIMaybeMentionInfo info);
void chatLoadGalleryHit(int sessionID, UIMessage message);
// Location support
@typedef("uint64") @lint("ignore") record LocationWatchID {}
enum UIWatchPositionPerm {
BASE_0,
ALWAYS_1
}
LocationWatchID chatWatchPosition(int sessionID, ConversationID convID, UIWatchPositionPerm perm);
void chatClearWatch(int sessionID, LocationWatchID id);
// Slash command feedback
enum UICommandStatusDisplayTyp {
STATUS_0,
WARNING_1,
ERROR_2
}
enum UICommandStatusActionTyp {
APPSETTINGS_0
}
void chatCommandStatus(int sessionID, string convID, string displayText, UICommandStatusDisplayTyp typ, array<UICommandStatusActionTyp> actions);
enum UIBotCommandsUpdateStatus {
UPTODATE_0,
UPDATING_1,
FAILED_2,
BLANK_3
}
void chatBotCommandsUpdateStatus(int sessionID, string convID, UIBotCommandsUpdateStatus status);
void triggerContactSync(int sessionID);
}