@rivetkit/engine-runner-protocol 2.0.4-rc.1

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.
@@ -0,0 +1,662 @@
1
+ import * as bare from '@rivetkit/bare-ts';
2
+
3
+ type i64 = bigint;
4
+ type u16 = number;
5
+ type u32 = number;
6
+ type u64 = bigint;
7
+ type Id = string;
8
+ declare function readId(bc: bare.ByteCursor): Id;
9
+ declare function writeId(bc: bare.ByteCursor, x: Id): void;
10
+ type Json = string;
11
+ declare function readJson(bc: bare.ByteCursor): Json;
12
+ declare function writeJson(bc: bare.ByteCursor, x: Json): void;
13
+ type GatewayId = ArrayBuffer;
14
+ declare function readGatewayId(bc: bare.ByteCursor): GatewayId;
15
+ declare function writeGatewayId(bc: bare.ByteCursor, x: GatewayId): void;
16
+ type RequestId = ArrayBuffer;
17
+ declare function readRequestId(bc: bare.ByteCursor): RequestId;
18
+ declare function writeRequestId(bc: bare.ByteCursor, x: RequestId): void;
19
+ type MessageIndex = u16;
20
+ declare function readMessageIndex(bc: bare.ByteCursor): MessageIndex;
21
+ declare function writeMessageIndex(bc: bare.ByteCursor, x: MessageIndex): void;
22
+ /**
23
+ * Basic types
24
+ */
25
+ type KvKey = ArrayBuffer;
26
+ declare function readKvKey(bc: bare.ByteCursor): KvKey;
27
+ declare function writeKvKey(bc: bare.ByteCursor, x: KvKey): void;
28
+ type KvValue = ArrayBuffer;
29
+ declare function readKvValue(bc: bare.ByteCursor): KvValue;
30
+ declare function writeKvValue(bc: bare.ByteCursor, x: KvValue): void;
31
+ type KvMetadata = {
32
+ readonly version: ArrayBuffer;
33
+ readonly updateTs: i64;
34
+ };
35
+ declare function readKvMetadata(bc: bare.ByteCursor): KvMetadata;
36
+ declare function writeKvMetadata(bc: bare.ByteCursor, x: KvMetadata): void;
37
+ /**
38
+ * Query types
39
+ */
40
+ type KvListAllQuery = null;
41
+ type KvListRangeQuery = {
42
+ readonly start: KvKey;
43
+ readonly end: KvKey;
44
+ readonly exclusive: boolean;
45
+ };
46
+ declare function readKvListRangeQuery(bc: bare.ByteCursor): KvListRangeQuery;
47
+ declare function writeKvListRangeQuery(bc: bare.ByteCursor, x: KvListRangeQuery): void;
48
+ type KvListPrefixQuery = {
49
+ readonly key: KvKey;
50
+ };
51
+ declare function readKvListPrefixQuery(bc: bare.ByteCursor): KvListPrefixQuery;
52
+ declare function writeKvListPrefixQuery(bc: bare.ByteCursor, x: KvListPrefixQuery): void;
53
+ type KvListQuery = {
54
+ readonly tag: "KvListAllQuery";
55
+ readonly val: KvListAllQuery;
56
+ } | {
57
+ readonly tag: "KvListRangeQuery";
58
+ readonly val: KvListRangeQuery;
59
+ } | {
60
+ readonly tag: "KvListPrefixQuery";
61
+ readonly val: KvListPrefixQuery;
62
+ };
63
+ declare function readKvListQuery(bc: bare.ByteCursor): KvListQuery;
64
+ declare function writeKvListQuery(bc: bare.ByteCursor, x: KvListQuery): void;
65
+ /**
66
+ * Request types
67
+ */
68
+ type KvGetRequest = {
69
+ readonly keys: readonly KvKey[];
70
+ };
71
+ declare function readKvGetRequest(bc: bare.ByteCursor): KvGetRequest;
72
+ declare function writeKvGetRequest(bc: bare.ByteCursor, x: KvGetRequest): void;
73
+ type KvListRequest = {
74
+ readonly query: KvListQuery;
75
+ readonly reverse: boolean | null;
76
+ readonly limit: u64 | null;
77
+ };
78
+ declare function readKvListRequest(bc: bare.ByteCursor): KvListRequest;
79
+ declare function writeKvListRequest(bc: bare.ByteCursor, x: KvListRequest): void;
80
+ type KvPutRequest = {
81
+ readonly keys: readonly KvKey[];
82
+ readonly values: readonly KvValue[];
83
+ };
84
+ declare function readKvPutRequest(bc: bare.ByteCursor): KvPutRequest;
85
+ declare function writeKvPutRequest(bc: bare.ByteCursor, x: KvPutRequest): void;
86
+ type KvDeleteRequest = {
87
+ readonly keys: readonly KvKey[];
88
+ };
89
+ declare function readKvDeleteRequest(bc: bare.ByteCursor): KvDeleteRequest;
90
+ declare function writeKvDeleteRequest(bc: bare.ByteCursor, x: KvDeleteRequest): void;
91
+ type KvDropRequest = null;
92
+ /**
93
+ * Response types
94
+ */
95
+ type KvErrorResponse = {
96
+ readonly message: string;
97
+ };
98
+ declare function readKvErrorResponse(bc: bare.ByteCursor): KvErrorResponse;
99
+ declare function writeKvErrorResponse(bc: bare.ByteCursor, x: KvErrorResponse): void;
100
+ type KvGetResponse = {
101
+ readonly keys: readonly KvKey[];
102
+ readonly values: readonly KvValue[];
103
+ readonly metadata: readonly KvMetadata[];
104
+ };
105
+ declare function readKvGetResponse(bc: bare.ByteCursor): KvGetResponse;
106
+ declare function writeKvGetResponse(bc: bare.ByteCursor, x: KvGetResponse): void;
107
+ type KvListResponse = {
108
+ readonly keys: readonly KvKey[];
109
+ readonly values: readonly KvValue[];
110
+ readonly metadata: readonly KvMetadata[];
111
+ };
112
+ declare function readKvListResponse(bc: bare.ByteCursor): KvListResponse;
113
+ declare function writeKvListResponse(bc: bare.ByteCursor, x: KvListResponse): void;
114
+ type KvPutResponse = null;
115
+ type KvDeleteResponse = null;
116
+ type KvDropResponse = null;
117
+ /**
118
+ * Request/Response unions
119
+ */
120
+ type KvRequestData = {
121
+ readonly tag: "KvGetRequest";
122
+ readonly val: KvGetRequest;
123
+ } | {
124
+ readonly tag: "KvListRequest";
125
+ readonly val: KvListRequest;
126
+ } | {
127
+ readonly tag: "KvPutRequest";
128
+ readonly val: KvPutRequest;
129
+ } | {
130
+ readonly tag: "KvDeleteRequest";
131
+ readonly val: KvDeleteRequest;
132
+ } | {
133
+ readonly tag: "KvDropRequest";
134
+ readonly val: KvDropRequest;
135
+ };
136
+ declare function readKvRequestData(bc: bare.ByteCursor): KvRequestData;
137
+ declare function writeKvRequestData(bc: bare.ByteCursor, x: KvRequestData): void;
138
+ type KvResponseData = {
139
+ readonly tag: "KvErrorResponse";
140
+ readonly val: KvErrorResponse;
141
+ } | {
142
+ readonly tag: "KvGetResponse";
143
+ readonly val: KvGetResponse;
144
+ } | {
145
+ readonly tag: "KvListResponse";
146
+ readonly val: KvListResponse;
147
+ } | {
148
+ readonly tag: "KvPutResponse";
149
+ readonly val: KvPutResponse;
150
+ } | {
151
+ readonly tag: "KvDeleteResponse";
152
+ readonly val: KvDeleteResponse;
153
+ } | {
154
+ readonly tag: "KvDropResponse";
155
+ readonly val: KvDropResponse;
156
+ };
157
+ declare function readKvResponseData(bc: bare.ByteCursor): KvResponseData;
158
+ declare function writeKvResponseData(bc: bare.ByteCursor, x: KvResponseData): void;
159
+ /**
160
+ * Core
161
+ */
162
+ declare enum StopCode {
163
+ Ok = "Ok",
164
+ Error = "Error"
165
+ }
166
+ declare function readStopCode(bc: bare.ByteCursor): StopCode;
167
+ declare function writeStopCode(bc: bare.ByteCursor, x: StopCode): void;
168
+ type ActorName = {
169
+ readonly metadata: Json;
170
+ };
171
+ declare function readActorName(bc: bare.ByteCursor): ActorName;
172
+ declare function writeActorName(bc: bare.ByteCursor, x: ActorName): void;
173
+ type ActorConfig = {
174
+ readonly name: string;
175
+ readonly key: string | null;
176
+ readonly createTs: i64;
177
+ readonly input: ArrayBuffer | null;
178
+ };
179
+ declare function readActorConfig(bc: bare.ByteCursor): ActorConfig;
180
+ declare function writeActorConfig(bc: bare.ByteCursor, x: ActorConfig): void;
181
+ type ActorCheckpoint = {
182
+ readonly actorId: Id;
183
+ readonly generation: u32;
184
+ readonly index: i64;
185
+ };
186
+ declare function readActorCheckpoint(bc: bare.ByteCursor): ActorCheckpoint;
187
+ declare function writeActorCheckpoint(bc: bare.ByteCursor, x: ActorCheckpoint): void;
188
+ /**
189
+ * Intent
190
+ */
191
+ type ActorIntentSleep = null;
192
+ type ActorIntentStop = null;
193
+ type ActorIntent = {
194
+ readonly tag: "ActorIntentSleep";
195
+ readonly val: ActorIntentSleep;
196
+ } | {
197
+ readonly tag: "ActorIntentStop";
198
+ readonly val: ActorIntentStop;
199
+ };
200
+ declare function readActorIntent(bc: bare.ByteCursor): ActorIntent;
201
+ declare function writeActorIntent(bc: bare.ByteCursor, x: ActorIntent): void;
202
+ /**
203
+ * State
204
+ */
205
+ type ActorStateRunning = null;
206
+ type ActorStateStopped = {
207
+ readonly code: StopCode;
208
+ readonly message: string | null;
209
+ };
210
+ declare function readActorStateStopped(bc: bare.ByteCursor): ActorStateStopped;
211
+ declare function writeActorStateStopped(bc: bare.ByteCursor, x: ActorStateStopped): void;
212
+ type ActorState = {
213
+ readonly tag: "ActorStateRunning";
214
+ readonly val: ActorStateRunning;
215
+ } | {
216
+ readonly tag: "ActorStateStopped";
217
+ readonly val: ActorStateStopped;
218
+ };
219
+ declare function readActorState(bc: bare.ByteCursor): ActorState;
220
+ declare function writeActorState(bc: bare.ByteCursor, x: ActorState): void;
221
+ /**
222
+ * MARK: Events
223
+ */
224
+ type EventActorIntent = {
225
+ readonly intent: ActorIntent;
226
+ };
227
+ declare function readEventActorIntent(bc: bare.ByteCursor): EventActorIntent;
228
+ declare function writeEventActorIntent(bc: bare.ByteCursor, x: EventActorIntent): void;
229
+ type EventActorStateUpdate = {
230
+ readonly state: ActorState;
231
+ };
232
+ declare function readEventActorStateUpdate(bc: bare.ByteCursor): EventActorStateUpdate;
233
+ declare function writeEventActorStateUpdate(bc: bare.ByteCursor, x: EventActorStateUpdate): void;
234
+ type EventActorSetAlarm = {
235
+ readonly alarmTs: i64 | null;
236
+ };
237
+ declare function readEventActorSetAlarm(bc: bare.ByteCursor): EventActorSetAlarm;
238
+ declare function writeEventActorSetAlarm(bc: bare.ByteCursor, x: EventActorSetAlarm): void;
239
+ type Event = {
240
+ readonly tag: "EventActorIntent";
241
+ readonly val: EventActorIntent;
242
+ } | {
243
+ readonly tag: "EventActorStateUpdate";
244
+ readonly val: EventActorStateUpdate;
245
+ } | {
246
+ readonly tag: "EventActorSetAlarm";
247
+ readonly val: EventActorSetAlarm;
248
+ };
249
+ declare function readEvent(bc: bare.ByteCursor): Event;
250
+ declare function writeEvent(bc: bare.ByteCursor, x: Event): void;
251
+ type EventWrapper = {
252
+ readonly checkpoint: ActorCheckpoint;
253
+ readonly inner: Event;
254
+ };
255
+ declare function readEventWrapper(bc: bare.ByteCursor): EventWrapper;
256
+ declare function writeEventWrapper(bc: bare.ByteCursor, x: EventWrapper): void;
257
+ type HibernatingRequest = {
258
+ readonly gatewayId: GatewayId;
259
+ readonly requestId: RequestId;
260
+ };
261
+ declare function readHibernatingRequest(bc: bare.ByteCursor): HibernatingRequest;
262
+ declare function writeHibernatingRequest(bc: bare.ByteCursor, x: HibernatingRequest): void;
263
+ type CommandStartActor = {
264
+ readonly config: ActorConfig;
265
+ readonly hibernatingRequests: readonly HibernatingRequest[];
266
+ };
267
+ declare function readCommandStartActor(bc: bare.ByteCursor): CommandStartActor;
268
+ declare function writeCommandStartActor(bc: bare.ByteCursor, x: CommandStartActor): void;
269
+ type CommandStopActor = null;
270
+ type Command = {
271
+ readonly tag: "CommandStartActor";
272
+ readonly val: CommandStartActor;
273
+ } | {
274
+ readonly tag: "CommandStopActor";
275
+ readonly val: CommandStopActor;
276
+ };
277
+ declare function readCommand(bc: bare.ByteCursor): Command;
278
+ declare function writeCommand(bc: bare.ByteCursor, x: Command): void;
279
+ type CommandWrapper = {
280
+ readonly checkpoint: ActorCheckpoint;
281
+ readonly inner: Command;
282
+ };
283
+ declare function readCommandWrapper(bc: bare.ByteCursor): CommandWrapper;
284
+ declare function writeCommandWrapper(bc: bare.ByteCursor, x: CommandWrapper): void;
285
+ /**
286
+ * We redeclare this so its top level
287
+ */
288
+ type ActorCommandKeyData = {
289
+ readonly tag: "CommandStartActor";
290
+ readonly val: CommandStartActor;
291
+ } | {
292
+ readonly tag: "CommandStopActor";
293
+ readonly val: CommandStopActor;
294
+ };
295
+ declare function readActorCommandKeyData(bc: bare.ByteCursor): ActorCommandKeyData;
296
+ declare function writeActorCommandKeyData(bc: bare.ByteCursor, x: ActorCommandKeyData): void;
297
+ declare function encodeActorCommandKeyData(x: ActorCommandKeyData, config?: Partial<bare.Config>): Uint8Array;
298
+ declare function decodeActorCommandKeyData(bytes: Uint8Array): ActorCommandKeyData;
299
+ type MessageId = {
300
+ /**
301
+ * Globally unique ID
302
+ */
303
+ readonly gatewayId: GatewayId;
304
+ /**
305
+ * Unique ID to the gateway
306
+ */
307
+ readonly requestId: RequestId;
308
+ /**
309
+ * Unique ID to the request
310
+ */
311
+ readonly messageIndex: MessageIndex;
312
+ };
313
+ declare function readMessageId(bc: bare.ByteCursor): MessageId;
314
+ declare function writeMessageId(bc: bare.ByteCursor, x: MessageId): void;
315
+ /**
316
+ * HTTP
317
+ */
318
+ type ToClientRequestStart = {
319
+ readonly actorId: Id;
320
+ readonly method: string;
321
+ readonly path: string;
322
+ readonly headers: ReadonlyMap<string, string>;
323
+ readonly body: ArrayBuffer | null;
324
+ readonly stream: boolean;
325
+ };
326
+ declare function readToClientRequestStart(bc: bare.ByteCursor): ToClientRequestStart;
327
+ declare function writeToClientRequestStart(bc: bare.ByteCursor, x: ToClientRequestStart): void;
328
+ type ToClientRequestChunk = {
329
+ readonly body: ArrayBuffer;
330
+ readonly finish: boolean;
331
+ };
332
+ declare function readToClientRequestChunk(bc: bare.ByteCursor): ToClientRequestChunk;
333
+ declare function writeToClientRequestChunk(bc: bare.ByteCursor, x: ToClientRequestChunk): void;
334
+ type ToClientRequestAbort = null;
335
+ type ToServerResponseStart = {
336
+ readonly status: u16;
337
+ readonly headers: ReadonlyMap<string, string>;
338
+ readonly body: ArrayBuffer | null;
339
+ readonly stream: boolean;
340
+ };
341
+ declare function readToServerResponseStart(bc: bare.ByteCursor): ToServerResponseStart;
342
+ declare function writeToServerResponseStart(bc: bare.ByteCursor, x: ToServerResponseStart): void;
343
+ type ToServerResponseChunk = {
344
+ readonly body: ArrayBuffer;
345
+ readonly finish: boolean;
346
+ };
347
+ declare function readToServerResponseChunk(bc: bare.ByteCursor): ToServerResponseChunk;
348
+ declare function writeToServerResponseChunk(bc: bare.ByteCursor, x: ToServerResponseChunk): void;
349
+ type ToServerResponseAbort = null;
350
+ /**
351
+ * WebSocket
352
+ */
353
+ type ToClientWebSocketOpen = {
354
+ readonly actorId: Id;
355
+ readonly path: string;
356
+ readonly headers: ReadonlyMap<string, string>;
357
+ };
358
+ declare function readToClientWebSocketOpen(bc: bare.ByteCursor): ToClientWebSocketOpen;
359
+ declare function writeToClientWebSocketOpen(bc: bare.ByteCursor, x: ToClientWebSocketOpen): void;
360
+ type ToClientWebSocketMessage = {
361
+ readonly data: ArrayBuffer;
362
+ readonly binary: boolean;
363
+ };
364
+ declare function readToClientWebSocketMessage(bc: bare.ByteCursor): ToClientWebSocketMessage;
365
+ declare function writeToClientWebSocketMessage(bc: bare.ByteCursor, x: ToClientWebSocketMessage): void;
366
+ type ToClientWebSocketClose = {
367
+ readonly code: u16 | null;
368
+ readonly reason: string | null;
369
+ };
370
+ declare function readToClientWebSocketClose(bc: bare.ByteCursor): ToClientWebSocketClose;
371
+ declare function writeToClientWebSocketClose(bc: bare.ByteCursor, x: ToClientWebSocketClose): void;
372
+ type ToServerWebSocketOpen = {
373
+ readonly canHibernate: boolean;
374
+ };
375
+ declare function readToServerWebSocketOpen(bc: bare.ByteCursor): ToServerWebSocketOpen;
376
+ declare function writeToServerWebSocketOpen(bc: bare.ByteCursor, x: ToServerWebSocketOpen): void;
377
+ type ToServerWebSocketMessage = {
378
+ readonly data: ArrayBuffer;
379
+ readonly binary: boolean;
380
+ };
381
+ declare function readToServerWebSocketMessage(bc: bare.ByteCursor): ToServerWebSocketMessage;
382
+ declare function writeToServerWebSocketMessage(bc: bare.ByteCursor, x: ToServerWebSocketMessage): void;
383
+ type ToServerWebSocketMessageAck = {
384
+ readonly index: MessageIndex;
385
+ };
386
+ declare function readToServerWebSocketMessageAck(bc: bare.ByteCursor): ToServerWebSocketMessageAck;
387
+ declare function writeToServerWebSocketMessageAck(bc: bare.ByteCursor, x: ToServerWebSocketMessageAck): void;
388
+ type ToServerWebSocketClose = {
389
+ readonly code: u16 | null;
390
+ readonly reason: string | null;
391
+ readonly hibernate: boolean;
392
+ };
393
+ declare function readToServerWebSocketClose(bc: bare.ByteCursor): ToServerWebSocketClose;
394
+ declare function writeToServerWebSocketClose(bc: bare.ByteCursor, x: ToServerWebSocketClose): void;
395
+ /**
396
+ * To Server
397
+ */
398
+ type ToServerTunnelMessageKind =
399
+ /**
400
+ * HTTP
401
+ */
402
+ {
403
+ readonly tag: "ToServerResponseStart";
404
+ readonly val: ToServerResponseStart;
405
+ } | {
406
+ readonly tag: "ToServerResponseChunk";
407
+ readonly val: ToServerResponseChunk;
408
+ } | {
409
+ readonly tag: "ToServerResponseAbort";
410
+ readonly val: ToServerResponseAbort;
411
+ }
412
+ /**
413
+ * WebSocket
414
+ */
415
+ | {
416
+ readonly tag: "ToServerWebSocketOpen";
417
+ readonly val: ToServerWebSocketOpen;
418
+ } | {
419
+ readonly tag: "ToServerWebSocketMessage";
420
+ readonly val: ToServerWebSocketMessage;
421
+ } | {
422
+ readonly tag: "ToServerWebSocketMessageAck";
423
+ readonly val: ToServerWebSocketMessageAck;
424
+ } | {
425
+ readonly tag: "ToServerWebSocketClose";
426
+ readonly val: ToServerWebSocketClose;
427
+ };
428
+ declare function readToServerTunnelMessageKind(bc: bare.ByteCursor): ToServerTunnelMessageKind;
429
+ declare function writeToServerTunnelMessageKind(bc: bare.ByteCursor, x: ToServerTunnelMessageKind): void;
430
+ type ToServerTunnelMessage = {
431
+ readonly messageId: MessageId;
432
+ readonly messageKind: ToServerTunnelMessageKind;
433
+ };
434
+ declare function readToServerTunnelMessage(bc: bare.ByteCursor): ToServerTunnelMessage;
435
+ declare function writeToServerTunnelMessage(bc: bare.ByteCursor, x: ToServerTunnelMessage): void;
436
+ /**
437
+ * To Client
438
+ */
439
+ type ToClientTunnelMessageKind =
440
+ /**
441
+ * HTTP
442
+ */
443
+ {
444
+ readonly tag: "ToClientRequestStart";
445
+ readonly val: ToClientRequestStart;
446
+ } | {
447
+ readonly tag: "ToClientRequestChunk";
448
+ readonly val: ToClientRequestChunk;
449
+ } | {
450
+ readonly tag: "ToClientRequestAbort";
451
+ readonly val: ToClientRequestAbort;
452
+ }
453
+ /**
454
+ * WebSocket
455
+ */
456
+ | {
457
+ readonly tag: "ToClientWebSocketOpen";
458
+ readonly val: ToClientWebSocketOpen;
459
+ } | {
460
+ readonly tag: "ToClientWebSocketMessage";
461
+ readonly val: ToClientWebSocketMessage;
462
+ } | {
463
+ readonly tag: "ToClientWebSocketClose";
464
+ readonly val: ToClientWebSocketClose;
465
+ };
466
+ declare function readToClientTunnelMessageKind(bc: bare.ByteCursor): ToClientTunnelMessageKind;
467
+ declare function writeToClientTunnelMessageKind(bc: bare.ByteCursor, x: ToClientTunnelMessageKind): void;
468
+ type ToClientTunnelMessage = {
469
+ readonly messageId: MessageId;
470
+ readonly messageKind: ToClientTunnelMessageKind;
471
+ };
472
+ declare function readToClientTunnelMessage(bc: bare.ByteCursor): ToClientTunnelMessage;
473
+ declare function writeToClientTunnelMessage(bc: bare.ByteCursor, x: ToClientTunnelMessage): void;
474
+ type ToClientPing = {
475
+ readonly ts: i64;
476
+ };
477
+ declare function readToClientPing(bc: bare.ByteCursor): ToClientPing;
478
+ declare function writeToClientPing(bc: bare.ByteCursor, x: ToClientPing): void;
479
+ /**
480
+ * MARK: To Server
481
+ */
482
+ type ToServerInit = {
483
+ readonly name: string;
484
+ readonly version: u32;
485
+ readonly totalSlots: u32;
486
+ readonly prepopulateActorNames: ReadonlyMap<string, ActorName> | null;
487
+ readonly metadata: Json | null;
488
+ };
489
+ declare function readToServerInit(bc: bare.ByteCursor): ToServerInit;
490
+ declare function writeToServerInit(bc: bare.ByteCursor, x: ToServerInit): void;
491
+ type ToServerEvents = readonly EventWrapper[];
492
+ declare function readToServerEvents(bc: bare.ByteCursor): ToServerEvents;
493
+ declare function writeToServerEvents(bc: bare.ByteCursor, x: ToServerEvents): void;
494
+ type ToServerAckCommands = {
495
+ readonly lastCommandCheckpoints: readonly ActorCheckpoint[];
496
+ };
497
+ declare function readToServerAckCommands(bc: bare.ByteCursor): ToServerAckCommands;
498
+ declare function writeToServerAckCommands(bc: bare.ByteCursor, x: ToServerAckCommands): void;
499
+ type ToServerStopping = null;
500
+ type ToServerPong = {
501
+ readonly ts: i64;
502
+ };
503
+ declare function readToServerPong(bc: bare.ByteCursor): ToServerPong;
504
+ declare function writeToServerPong(bc: bare.ByteCursor, x: ToServerPong): void;
505
+ type ToServerKvRequest = {
506
+ readonly actorId: Id;
507
+ readonly requestId: u32;
508
+ readonly data: KvRequestData;
509
+ };
510
+ declare function readToServerKvRequest(bc: bare.ByteCursor): ToServerKvRequest;
511
+ declare function writeToServerKvRequest(bc: bare.ByteCursor, x: ToServerKvRequest): void;
512
+ type ToServer = {
513
+ readonly tag: "ToServerInit";
514
+ readonly val: ToServerInit;
515
+ } | {
516
+ readonly tag: "ToServerEvents";
517
+ readonly val: ToServerEvents;
518
+ } | {
519
+ readonly tag: "ToServerAckCommands";
520
+ readonly val: ToServerAckCommands;
521
+ } | {
522
+ readonly tag: "ToServerStopping";
523
+ readonly val: ToServerStopping;
524
+ } | {
525
+ readonly tag: "ToServerPong";
526
+ readonly val: ToServerPong;
527
+ } | {
528
+ readonly tag: "ToServerKvRequest";
529
+ readonly val: ToServerKvRequest;
530
+ } | {
531
+ readonly tag: "ToServerTunnelMessage";
532
+ readonly val: ToServerTunnelMessage;
533
+ };
534
+ declare function readToServer(bc: bare.ByteCursor): ToServer;
535
+ declare function writeToServer(bc: bare.ByteCursor, x: ToServer): void;
536
+ declare function encodeToServer(x: ToServer, config?: Partial<bare.Config>): Uint8Array;
537
+ declare function decodeToServer(bytes: Uint8Array): ToServer;
538
+ /**
539
+ * MARK: To Client
540
+ */
541
+ type ProtocolMetadata = {
542
+ readonly runnerLostThreshold: i64;
543
+ };
544
+ declare function readProtocolMetadata(bc: bare.ByteCursor): ProtocolMetadata;
545
+ declare function writeProtocolMetadata(bc: bare.ByteCursor, x: ProtocolMetadata): void;
546
+ type ToClientInit = {
547
+ readonly runnerId: Id;
548
+ readonly metadata: ProtocolMetadata;
549
+ };
550
+ declare function readToClientInit(bc: bare.ByteCursor): ToClientInit;
551
+ declare function writeToClientInit(bc: bare.ByteCursor, x: ToClientInit): void;
552
+ type ToClientCommands = readonly CommandWrapper[];
553
+ declare function readToClientCommands(bc: bare.ByteCursor): ToClientCommands;
554
+ declare function writeToClientCommands(bc: bare.ByteCursor, x: ToClientCommands): void;
555
+ type ToClientAckEvents = {
556
+ readonly lastEventCheckpoints: readonly ActorCheckpoint[];
557
+ };
558
+ declare function readToClientAckEvents(bc: bare.ByteCursor): ToClientAckEvents;
559
+ declare function writeToClientAckEvents(bc: bare.ByteCursor, x: ToClientAckEvents): void;
560
+ type ToClientKvResponse = {
561
+ readonly requestId: u32;
562
+ readonly data: KvResponseData;
563
+ };
564
+ declare function readToClientKvResponse(bc: bare.ByteCursor): ToClientKvResponse;
565
+ declare function writeToClientKvResponse(bc: bare.ByteCursor, x: ToClientKvResponse): void;
566
+ type ToClient = {
567
+ readonly tag: "ToClientInit";
568
+ readonly val: ToClientInit;
569
+ } | {
570
+ readonly tag: "ToClientCommands";
571
+ readonly val: ToClientCommands;
572
+ } | {
573
+ readonly tag: "ToClientAckEvents";
574
+ readonly val: ToClientAckEvents;
575
+ } | {
576
+ readonly tag: "ToClientKvResponse";
577
+ readonly val: ToClientKvResponse;
578
+ } | {
579
+ readonly tag: "ToClientTunnelMessage";
580
+ readonly val: ToClientTunnelMessage;
581
+ } | {
582
+ readonly tag: "ToClientPing";
583
+ readonly val: ToClientPing;
584
+ };
585
+ declare function readToClient(bc: bare.ByteCursor): ToClient;
586
+ declare function writeToClient(bc: bare.ByteCursor, x: ToClient): void;
587
+ declare function encodeToClient(x: ToClient, config?: Partial<bare.Config>): Uint8Array;
588
+ declare function decodeToClient(bytes: Uint8Array): ToClient;
589
+ /**
590
+ * MARK: To Runner
591
+ */
592
+ type ToRunnerPing = {
593
+ readonly gatewayId: GatewayId;
594
+ readonly requestId: RequestId;
595
+ readonly ts: i64;
596
+ };
597
+ declare function readToRunnerPing(bc: bare.ByteCursor): ToRunnerPing;
598
+ declare function writeToRunnerPing(bc: bare.ByteCursor, x: ToRunnerPing): void;
599
+ type ToRunnerClose = null;
600
+ /**
601
+ * We have to re-declare the entire union since BARE will not generate the
602
+ * ser/de for ToClient if it's not a top-level type
603
+ */
604
+ type ToRunner = {
605
+ readonly tag: "ToRunnerPing";
606
+ readonly val: ToRunnerPing;
607
+ } | {
608
+ readonly tag: "ToRunnerClose";
609
+ readonly val: ToRunnerClose;
610
+ } | {
611
+ readonly tag: "ToClientCommands";
612
+ readonly val: ToClientCommands;
613
+ } | {
614
+ readonly tag: "ToClientAckEvents";
615
+ readonly val: ToClientAckEvents;
616
+ } | {
617
+ readonly tag: "ToClientTunnelMessage";
618
+ readonly val: ToClientTunnelMessage;
619
+ };
620
+ declare function readToRunner(bc: bare.ByteCursor): ToRunner;
621
+ declare function writeToRunner(bc: bare.ByteCursor, x: ToRunner): void;
622
+ declare function encodeToRunner(x: ToRunner, config?: Partial<bare.Config>): Uint8Array;
623
+ declare function decodeToRunner(bytes: Uint8Array): ToRunner;
624
+ /**
625
+ * MARK: To Gateway
626
+ */
627
+ type ToGatewayPong = {
628
+ readonly requestId: RequestId;
629
+ readonly ts: i64;
630
+ };
631
+ declare function readToGatewayPong(bc: bare.ByteCursor): ToGatewayPong;
632
+ declare function writeToGatewayPong(bc: bare.ByteCursor, x: ToGatewayPong): void;
633
+ type ToGateway = {
634
+ readonly tag: "ToGatewayPong";
635
+ readonly val: ToGatewayPong;
636
+ } | {
637
+ readonly tag: "ToServerTunnelMessage";
638
+ readonly val: ToServerTunnelMessage;
639
+ };
640
+ declare function readToGateway(bc: bare.ByteCursor): ToGateway;
641
+ declare function writeToGateway(bc: bare.ByteCursor, x: ToGateway): void;
642
+ declare function encodeToGateway(x: ToGateway, config?: Partial<bare.Config>): Uint8Array;
643
+ declare function decodeToGateway(bytes: Uint8Array): ToGateway;
644
+ /**
645
+ * MARK: Serverless
646
+ */
647
+ type ToServerlessServerInit = {
648
+ readonly runnerId: Id;
649
+ readonly runnerProtocolVersion: u16;
650
+ };
651
+ declare function readToServerlessServerInit(bc: bare.ByteCursor): ToServerlessServerInit;
652
+ declare function writeToServerlessServerInit(bc: bare.ByteCursor, x: ToServerlessServerInit): void;
653
+ type ToServerlessServer = {
654
+ readonly tag: "ToServerlessServerInit";
655
+ readonly val: ToServerlessServerInit;
656
+ };
657
+ declare function readToServerlessServer(bc: bare.ByteCursor): ToServerlessServer;
658
+ declare function writeToServerlessServer(bc: bare.ByteCursor, x: ToServerlessServer): void;
659
+ declare function encodeToServerlessServer(x: ToServerlessServer, config?: Partial<bare.Config>): Uint8Array;
660
+ declare function decodeToServerlessServer(bytes: Uint8Array): ToServerlessServer;
661
+
662
+ export { type ActorCheckpoint, type ActorCommandKeyData, type ActorConfig, type ActorIntent, type ActorIntentSleep, type ActorIntentStop, type ActorName, type ActorState, type ActorStateRunning, type ActorStateStopped, type Command, type CommandStartActor, type CommandStopActor, type CommandWrapper, type Event, type EventActorIntent, type EventActorSetAlarm, type EventActorStateUpdate, type EventWrapper, type GatewayId, type HibernatingRequest, type Id, type Json, type KvDeleteRequest, type KvDeleteResponse, type KvDropRequest, type KvDropResponse, type KvErrorResponse, type KvGetRequest, type KvGetResponse, type KvKey, type KvListAllQuery, type KvListPrefixQuery, type KvListQuery, type KvListRangeQuery, type KvListRequest, type KvListResponse, type KvMetadata, type KvPutRequest, type KvPutResponse, type KvRequestData, type KvResponseData, type KvValue, type MessageId, type MessageIndex, type ProtocolMetadata, type RequestId, StopCode, type ToClient, type ToClientAckEvents, type ToClientCommands, type ToClientInit, type ToClientKvResponse, type ToClientPing, type ToClientRequestAbort, type ToClientRequestChunk, type ToClientRequestStart, type ToClientTunnelMessage, type ToClientTunnelMessageKind, type ToClientWebSocketClose, type ToClientWebSocketMessage, type ToClientWebSocketOpen, type ToGateway, type ToGatewayPong, type ToRunner, type ToRunnerClose, type ToRunnerPing, type ToServer, type ToServerAckCommands, type ToServerEvents, type ToServerInit, type ToServerKvRequest, type ToServerPong, type ToServerResponseAbort, type ToServerResponseChunk, type ToServerResponseStart, type ToServerStopping, type ToServerTunnelMessage, type ToServerTunnelMessageKind, type ToServerWebSocketClose, type ToServerWebSocketMessage, type ToServerWebSocketMessageAck, type ToServerWebSocketOpen, type ToServerlessServer, type ToServerlessServerInit, decodeActorCommandKeyData, decodeToClient, decodeToGateway, decodeToRunner, decodeToServer, decodeToServerlessServer, encodeActorCommandKeyData, encodeToClient, encodeToGateway, encodeToRunner, encodeToServer, encodeToServerlessServer, type i64, readActorCheckpoint, readActorCommandKeyData, readActorConfig, readActorIntent, readActorName, readActorState, readActorStateStopped, readCommand, readCommandStartActor, readCommandWrapper, readEvent, readEventActorIntent, readEventActorSetAlarm, readEventActorStateUpdate, readEventWrapper, readGatewayId, readHibernatingRequest, readId, readJson, readKvDeleteRequest, readKvErrorResponse, readKvGetRequest, readKvGetResponse, readKvKey, readKvListPrefixQuery, readKvListQuery, readKvListRangeQuery, readKvListRequest, readKvListResponse, readKvMetadata, readKvPutRequest, readKvRequestData, readKvResponseData, readKvValue, readMessageId, readMessageIndex, readProtocolMetadata, readRequestId, readStopCode, readToClient, readToClientAckEvents, readToClientCommands, readToClientInit, readToClientKvResponse, readToClientPing, readToClientRequestChunk, readToClientRequestStart, readToClientTunnelMessage, readToClientTunnelMessageKind, readToClientWebSocketClose, readToClientWebSocketMessage, readToClientWebSocketOpen, readToGateway, readToGatewayPong, readToRunner, readToRunnerPing, readToServer, readToServerAckCommands, readToServerEvents, readToServerInit, readToServerKvRequest, readToServerPong, readToServerResponseChunk, readToServerResponseStart, readToServerTunnelMessage, readToServerTunnelMessageKind, readToServerWebSocketClose, readToServerWebSocketMessage, readToServerWebSocketMessageAck, readToServerWebSocketOpen, readToServerlessServer, readToServerlessServerInit, type u16, type u32, type u64, writeActorCheckpoint, writeActorCommandKeyData, writeActorConfig, writeActorIntent, writeActorName, writeActorState, writeActorStateStopped, writeCommand, writeCommandStartActor, writeCommandWrapper, writeEvent, writeEventActorIntent, writeEventActorSetAlarm, writeEventActorStateUpdate, writeEventWrapper, writeGatewayId, writeHibernatingRequest, writeId, writeJson, writeKvDeleteRequest, writeKvErrorResponse, writeKvGetRequest, writeKvGetResponse, writeKvKey, writeKvListPrefixQuery, writeKvListQuery, writeKvListRangeQuery, writeKvListRequest, writeKvListResponse, writeKvMetadata, writeKvPutRequest, writeKvRequestData, writeKvResponseData, writeKvValue, writeMessageId, writeMessageIndex, writeProtocolMetadata, writeRequestId, writeStopCode, writeToClient, writeToClientAckEvents, writeToClientCommands, writeToClientInit, writeToClientKvResponse, writeToClientPing, writeToClientRequestChunk, writeToClientRequestStart, writeToClientTunnelMessage, writeToClientTunnelMessageKind, writeToClientWebSocketClose, writeToClientWebSocketMessage, writeToClientWebSocketOpen, writeToGateway, writeToGatewayPong, writeToRunner, writeToRunnerPing, writeToServer, writeToServerAckCommands, writeToServerEvents, writeToServerInit, writeToServerKvRequest, writeToServerPong, writeToServerResponseChunk, writeToServerResponseStart, writeToServerTunnelMessage, writeToServerTunnelMessageKind, writeToServerWebSocketClose, writeToServerWebSocketMessage, writeToServerWebSocketMessageAck, writeToServerWebSocketOpen, writeToServerlessServer, writeToServerlessServerInit };