@rivetkit/engine-runner-protocol 25.7.1-rc.1 → 25.7.2-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.
Files changed (4) hide show
  1. package/LICENSE +203 -0
  2. package/dist/index.d.ts +323 -98
  3. package/dist/index.js +677 -302
  4. package/package.json +32 -32
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as bare from '@bare-ts/lib';
2
2
 
3
3
  type i64 = bigint;
4
+ type u16 = number;
4
5
  type u32 = number;
5
6
  type u64 = bigint;
6
7
  type Id = string;
@@ -9,6 +10,9 @@ declare function writeId(bc: bare.ByteCursor, x: Id): void;
9
10
  type Json = string;
10
11
  declare function readJson(bc: bare.ByteCursor): Json;
11
12
  declare function writeJson(bc: bare.ByteCursor, x: Json): void;
13
+ /**
14
+ * Basic types
15
+ */
12
16
  type KvKey = ArrayBuffer;
13
17
  declare function readKvKey(bc: bare.ByteCursor): KvKey;
14
18
  declare function writeKvKey(bc: bare.ByteCursor, x: KvKey): void;
@@ -21,6 +25,9 @@ type KvMetadata = {
21
25
  };
22
26
  declare function readKvMetadata(bc: bare.ByteCursor): KvMetadata;
23
27
  declare function writeKvMetadata(bc: bare.ByteCursor, x: KvMetadata): void;
28
+ /**
29
+ * Query types
30
+ */
24
31
  type KvListAllQuery = null;
25
32
  type KvListRangeQuery = {
26
33
  readonly start: KvKey;
@@ -46,17 +53,125 @@ type KvListQuery = {
46
53
  };
47
54
  declare function readKvListQuery(bc: bare.ByteCursor): KvListQuery;
48
55
  declare function writeKvListQuery(bc: bare.ByteCursor, x: KvListQuery): void;
49
- type ActorName = {
50
- readonly metadata: Json;
56
+ /**
57
+ * Request types
58
+ */
59
+ type KvGetRequest = {
60
+ readonly keys: readonly KvKey[];
51
61
  };
52
- declare function readActorName(bc: bare.ByteCursor): ActorName;
53
- declare function writeActorName(bc: bare.ByteCursor, x: ActorName): void;
62
+ declare function readKvGetRequest(bc: bare.ByteCursor): KvGetRequest;
63
+ declare function writeKvGetRequest(bc: bare.ByteCursor, x: KvGetRequest): void;
64
+ type KvListRequest = {
65
+ readonly query: KvListQuery;
66
+ readonly reverse: boolean | null;
67
+ readonly limit: u64 | null;
68
+ };
69
+ declare function readKvListRequest(bc: bare.ByteCursor): KvListRequest;
70
+ declare function writeKvListRequest(bc: bare.ByteCursor, x: KvListRequest): void;
71
+ type KvPutRequest = {
72
+ readonly keys: readonly KvKey[];
73
+ readonly values: readonly KvValue[];
74
+ };
75
+ declare function readKvPutRequest(bc: bare.ByteCursor): KvPutRequest;
76
+ declare function writeKvPutRequest(bc: bare.ByteCursor, x: KvPutRequest): void;
77
+ type KvDeleteRequest = {
78
+ readonly keys: readonly KvKey[];
79
+ };
80
+ declare function readKvDeleteRequest(bc: bare.ByteCursor): KvDeleteRequest;
81
+ declare function writeKvDeleteRequest(bc: bare.ByteCursor, x: KvDeleteRequest): void;
82
+ type KvDropRequest = null;
83
+ /**
84
+ * Response types
85
+ */
86
+ type KvErrorResponse = {
87
+ readonly message: string;
88
+ };
89
+ declare function readKvErrorResponse(bc: bare.ByteCursor): KvErrorResponse;
90
+ declare function writeKvErrorResponse(bc: bare.ByteCursor, x: KvErrorResponse): void;
91
+ type KvGetResponse = {
92
+ readonly keys: readonly KvKey[];
93
+ readonly values: readonly KvValue[];
94
+ readonly metadata: readonly KvMetadata[];
95
+ };
96
+ declare function readKvGetResponse(bc: bare.ByteCursor): KvGetResponse;
97
+ declare function writeKvGetResponse(bc: bare.ByteCursor, x: KvGetResponse): void;
98
+ type KvListResponse = {
99
+ readonly keys: readonly KvKey[];
100
+ readonly values: readonly KvValue[];
101
+ readonly metadata: readonly KvMetadata[];
102
+ };
103
+ declare function readKvListResponse(bc: bare.ByteCursor): KvListResponse;
104
+ declare function writeKvListResponse(bc: bare.ByteCursor, x: KvListResponse): void;
105
+ type KvPutResponse = null;
106
+ type KvDeleteResponse = null;
107
+ type KvDropResponse = null;
108
+ /**
109
+ * Request/Response unions
110
+ */
111
+ type KvRequestData = {
112
+ readonly tag: "KvGetRequest";
113
+ readonly val: KvGetRequest;
114
+ } | {
115
+ readonly tag: "KvListRequest";
116
+ readonly val: KvListRequest;
117
+ } | {
118
+ readonly tag: "KvPutRequest";
119
+ readonly val: KvPutRequest;
120
+ } | {
121
+ readonly tag: "KvDeleteRequest";
122
+ readonly val: KvDeleteRequest;
123
+ } | {
124
+ readonly tag: "KvDropRequest";
125
+ readonly val: KvDropRequest;
126
+ };
127
+ declare function readKvRequestData(bc: bare.ByteCursor): KvRequestData;
128
+ declare function writeKvRequestData(bc: bare.ByteCursor, x: KvRequestData): void;
129
+ type KvResponseData = {
130
+ readonly tag: "KvErrorResponse";
131
+ readonly val: KvErrorResponse;
132
+ } | {
133
+ readonly tag: "KvGetResponse";
134
+ readonly val: KvGetResponse;
135
+ } | {
136
+ readonly tag: "KvListResponse";
137
+ readonly val: KvListResponse;
138
+ } | {
139
+ readonly tag: "KvPutResponse";
140
+ readonly val: KvPutResponse;
141
+ } | {
142
+ readonly tag: "KvDeleteResponse";
143
+ readonly val: KvDeleteResponse;
144
+ } | {
145
+ readonly tag: "KvDropResponse";
146
+ readonly val: KvDropResponse;
147
+ };
148
+ declare function readKvResponseData(bc: bare.ByteCursor): KvResponseData;
149
+ declare function writeKvResponseData(bc: bare.ByteCursor, x: KvResponseData): void;
150
+ /**
151
+ * Core
152
+ */
54
153
  declare enum StopCode {
55
154
  Ok = "Ok",
56
155
  Error = "Error"
57
156
  }
58
157
  declare function readStopCode(bc: bare.ByteCursor): StopCode;
59
158
  declare function writeStopCode(bc: bare.ByteCursor, x: StopCode): void;
159
+ type ActorName = {
160
+ readonly metadata: Json;
161
+ };
162
+ declare function readActorName(bc: bare.ByteCursor): ActorName;
163
+ declare function writeActorName(bc: bare.ByteCursor, x: ActorName): void;
164
+ type ActorConfig = {
165
+ readonly name: string;
166
+ readonly key: string | null;
167
+ readonly createTs: i64;
168
+ readonly input: ArrayBuffer | null;
169
+ };
170
+ declare function readActorConfig(bc: bare.ByteCursor): ActorConfig;
171
+ declare function writeActorConfig(bc: bare.ByteCursor, x: ActorConfig): void;
172
+ /**
173
+ * Intent
174
+ */
60
175
  type ActorIntentSleep = null;
61
176
  type ActorIntentStop = null;
62
177
  type ActorIntent = {
@@ -68,6 +183,9 @@ type ActorIntent = {
68
183
  };
69
184
  declare function readActorIntent(bc: bare.ByteCursor): ActorIntent;
70
185
  declare function writeActorIntent(bc: bare.ByteCursor, x: ActorIntent): void;
186
+ /**
187
+ * State
188
+ */
71
189
  type ActorStateRunning = null;
72
190
  type ActorStateStopped = {
73
191
  readonly code: StopCode;
@@ -84,6 +202,9 @@ type ActorState = {
84
202
  };
85
203
  declare function readActorState(bc: bare.ByteCursor): ActorState;
86
204
  declare function writeActorState(bc: bare.ByteCursor, x: ActorState): void;
205
+ /**
206
+ * MARK: Events
207
+ */
87
208
  type EventActorIntent = {
88
209
  readonly actorId: Id;
89
210
  readonly generation: u32;
@@ -123,14 +244,6 @@ type EventWrapper = {
123
244
  };
124
245
  declare function readEventWrapper(bc: bare.ByteCursor): EventWrapper;
125
246
  declare function writeEventWrapper(bc: bare.ByteCursor, x: EventWrapper): void;
126
- type ActorConfig = {
127
- readonly name: string;
128
- readonly key: string | null;
129
- readonly createTs: i64;
130
- readonly input: ArrayBuffer | null;
131
- };
132
- declare function readActorConfig(bc: bare.ByteCursor): ActorConfig;
133
- declare function writeActorConfig(bc: bare.ByteCursor, x: ActorConfig): void;
134
247
  type CommandStartActor = {
135
248
  readonly actorId: Id;
136
249
  readonly generation: u32;
@@ -159,6 +272,180 @@ type CommandWrapper = {
159
272
  };
160
273
  declare function readCommandWrapper(bc: bare.ByteCursor): CommandWrapper;
161
274
  declare function writeCommandWrapper(bc: bare.ByteCursor, x: CommandWrapper): void;
275
+ type RequestId = ArrayBuffer;
276
+ declare function readRequestId(bc: bare.ByteCursor): RequestId;
277
+ declare function writeRequestId(bc: bare.ByteCursor, x: RequestId): void;
278
+ /**
279
+ * UUIDv4
280
+ */
281
+ type MessageId = ArrayBuffer;
282
+ declare function readMessageId(bc: bare.ByteCursor): MessageId;
283
+ declare function writeMessageId(bc: bare.ByteCursor, x: MessageId): void;
284
+ /**
285
+ * Ack
286
+ */
287
+ type TunnelAck = null;
288
+ /**
289
+ * HTTP
290
+ */
291
+ type ToClientRequestStart = {
292
+ readonly actorId: Id;
293
+ readonly method: string;
294
+ readonly path: string;
295
+ readonly headers: ReadonlyMap<string, string>;
296
+ readonly body: ArrayBuffer | null;
297
+ readonly stream: boolean;
298
+ };
299
+ declare function readToClientRequestStart(bc: bare.ByteCursor): ToClientRequestStart;
300
+ declare function writeToClientRequestStart(bc: bare.ByteCursor, x: ToClientRequestStart): void;
301
+ type ToClientRequestChunk = {
302
+ readonly body: ArrayBuffer;
303
+ readonly finish: boolean;
304
+ };
305
+ declare function readToClientRequestChunk(bc: bare.ByteCursor): ToClientRequestChunk;
306
+ declare function writeToClientRequestChunk(bc: bare.ByteCursor, x: ToClientRequestChunk): void;
307
+ type ToClientRequestAbort = null;
308
+ type ToServerResponseStart = {
309
+ readonly status: u16;
310
+ readonly headers: ReadonlyMap<string, string>;
311
+ readonly body: ArrayBuffer | null;
312
+ readonly stream: boolean;
313
+ };
314
+ declare function readToServerResponseStart(bc: bare.ByteCursor): ToServerResponseStart;
315
+ declare function writeToServerResponseStart(bc: bare.ByteCursor, x: ToServerResponseStart): void;
316
+ type ToServerResponseChunk = {
317
+ readonly body: ArrayBuffer;
318
+ readonly finish: boolean;
319
+ };
320
+ declare function readToServerResponseChunk(bc: bare.ByteCursor): ToServerResponseChunk;
321
+ declare function writeToServerResponseChunk(bc: bare.ByteCursor, x: ToServerResponseChunk): void;
322
+ type ToServerResponseAbort = null;
323
+ /**
324
+ * WebSocket
325
+ */
326
+ type ToClientWebSocketOpen = {
327
+ readonly actorId: Id;
328
+ readonly path: string;
329
+ readonly headers: ReadonlyMap<string, string>;
330
+ };
331
+ declare function readToClientWebSocketOpen(bc: bare.ByteCursor): ToClientWebSocketOpen;
332
+ declare function writeToClientWebSocketOpen(bc: bare.ByteCursor, x: ToClientWebSocketOpen): void;
333
+ type ToClientWebSocketMessage = {
334
+ readonly data: ArrayBuffer;
335
+ readonly binary: boolean;
336
+ };
337
+ declare function readToClientWebSocketMessage(bc: bare.ByteCursor): ToClientWebSocketMessage;
338
+ declare function writeToClientWebSocketMessage(bc: bare.ByteCursor, x: ToClientWebSocketMessage): void;
339
+ type ToClientWebSocketClose = {
340
+ readonly code: u16 | null;
341
+ readonly reason: string | null;
342
+ };
343
+ declare function readToClientWebSocketClose(bc: bare.ByteCursor): ToClientWebSocketClose;
344
+ declare function writeToClientWebSocketClose(bc: bare.ByteCursor, x: ToClientWebSocketClose): void;
345
+ type ToServerWebSocketOpen = null;
346
+ type ToServerWebSocketMessage = {
347
+ readonly data: ArrayBuffer;
348
+ readonly binary: boolean;
349
+ };
350
+ declare function readToServerWebSocketMessage(bc: bare.ByteCursor): ToServerWebSocketMessage;
351
+ declare function writeToServerWebSocketMessage(bc: bare.ByteCursor, x: ToServerWebSocketMessage): void;
352
+ type ToServerWebSocketClose = {
353
+ readonly code: u16 | null;
354
+ readonly reason: string | null;
355
+ };
356
+ declare function readToServerWebSocketClose(bc: bare.ByteCursor): ToServerWebSocketClose;
357
+ declare function writeToServerWebSocketClose(bc: bare.ByteCursor, x: ToServerWebSocketClose): void;
358
+ /**
359
+ * To Server
360
+ */
361
+ type ToServerTunnelMessageKind = {
362
+ readonly tag: "TunnelAck";
363
+ readonly val: TunnelAck;
364
+ }
365
+ /**
366
+ * HTTP
367
+ */
368
+ | {
369
+ readonly tag: "ToServerResponseStart";
370
+ readonly val: ToServerResponseStart;
371
+ } | {
372
+ readonly tag: "ToServerResponseChunk";
373
+ readonly val: ToServerResponseChunk;
374
+ } | {
375
+ readonly tag: "ToServerResponseAbort";
376
+ readonly val: ToServerResponseAbort;
377
+ }
378
+ /**
379
+ * WebSocket
380
+ */
381
+ | {
382
+ readonly tag: "ToServerWebSocketOpen";
383
+ readonly val: ToServerWebSocketOpen;
384
+ } | {
385
+ readonly tag: "ToServerWebSocketMessage";
386
+ readonly val: ToServerWebSocketMessage;
387
+ } | {
388
+ readonly tag: "ToServerWebSocketClose";
389
+ readonly val: ToServerWebSocketClose;
390
+ };
391
+ declare function readToServerTunnelMessageKind(bc: bare.ByteCursor): ToServerTunnelMessageKind;
392
+ declare function writeToServerTunnelMessageKind(bc: bare.ByteCursor, x: ToServerTunnelMessageKind): void;
393
+ type ToServerTunnelMessage = {
394
+ readonly requestId: RequestId;
395
+ readonly messageId: MessageId;
396
+ readonly messageKind: ToServerTunnelMessageKind;
397
+ };
398
+ declare function readToServerTunnelMessage(bc: bare.ByteCursor): ToServerTunnelMessage;
399
+ declare function writeToServerTunnelMessage(bc: bare.ByteCursor, x: ToServerTunnelMessage): void;
400
+ /**
401
+ * To Client
402
+ */
403
+ type ToClientTunnelMessageKind = {
404
+ readonly tag: "TunnelAck";
405
+ readonly val: TunnelAck;
406
+ }
407
+ /**
408
+ * HTTP
409
+ */
410
+ | {
411
+ readonly tag: "ToClientRequestStart";
412
+ readonly val: ToClientRequestStart;
413
+ } | {
414
+ readonly tag: "ToClientRequestChunk";
415
+ readonly val: ToClientRequestChunk;
416
+ } | {
417
+ readonly tag: "ToClientRequestAbort";
418
+ readonly val: ToClientRequestAbort;
419
+ }
420
+ /**
421
+ * WebSocket
422
+ */
423
+ | {
424
+ readonly tag: "ToClientWebSocketOpen";
425
+ readonly val: ToClientWebSocketOpen;
426
+ } | {
427
+ readonly tag: "ToClientWebSocketMessage";
428
+ readonly val: ToClientWebSocketMessage;
429
+ } | {
430
+ readonly tag: "ToClientWebSocketClose";
431
+ readonly val: ToClientWebSocketClose;
432
+ };
433
+ declare function readToClientTunnelMessageKind(bc: bare.ByteCursor): ToClientTunnelMessageKind;
434
+ declare function writeToClientTunnelMessageKind(bc: bare.ByteCursor, x: ToClientTunnelMessageKind): void;
435
+ type ToClientTunnelMessage = {
436
+ readonly requestId: RequestId;
437
+ readonly messageId: MessageId;
438
+ readonly messageKind: ToClientTunnelMessageKind;
439
+ /**
440
+ * Should be stripped before sending to the runner.
441
+ */
442
+ readonly gatewayReplyTo: string | null;
443
+ };
444
+ declare function readToClientTunnelMessage(bc: bare.ByteCursor): ToClientTunnelMessage;
445
+ declare function writeToClientTunnelMessage(bc: bare.ByteCursor, x: ToClientTunnelMessage): void;
446
+ /**
447
+ * MARK: To Server
448
+ */
162
449
  type ToServerInit = {
163
450
  readonly name: string;
164
451
  readonly version: u32;
@@ -183,48 +470,6 @@ type ToServerPing = {
183
470
  };
184
471
  declare function readToServerPing(bc: bare.ByteCursor): ToServerPing;
185
472
  declare function writeToServerPing(bc: bare.ByteCursor, x: ToServerPing): void;
186
- type KvGetRequest = {
187
- readonly keys: readonly KvKey[];
188
- };
189
- declare function readKvGetRequest(bc: bare.ByteCursor): KvGetRequest;
190
- declare function writeKvGetRequest(bc: bare.ByteCursor, x: KvGetRequest): void;
191
- type KvListRequest = {
192
- readonly query: KvListQuery;
193
- readonly reverse: boolean | null;
194
- readonly limit: u64 | null;
195
- };
196
- declare function readKvListRequest(bc: bare.ByteCursor): KvListRequest;
197
- declare function writeKvListRequest(bc: bare.ByteCursor, x: KvListRequest): void;
198
- type KvPutRequest = {
199
- readonly keys: readonly KvKey[];
200
- readonly values: readonly KvValue[];
201
- };
202
- declare function readKvPutRequest(bc: bare.ByteCursor): KvPutRequest;
203
- declare function writeKvPutRequest(bc: bare.ByteCursor, x: KvPutRequest): void;
204
- type KvDeleteRequest = {
205
- readonly keys: readonly KvKey[];
206
- };
207
- declare function readKvDeleteRequest(bc: bare.ByteCursor): KvDeleteRequest;
208
- declare function writeKvDeleteRequest(bc: bare.ByteCursor, x: KvDeleteRequest): void;
209
- type KvDropRequest = null;
210
- type KvRequestData = {
211
- readonly tag: "KvGetRequest";
212
- readonly val: KvGetRequest;
213
- } | {
214
- readonly tag: "KvListRequest";
215
- readonly val: KvListRequest;
216
- } | {
217
- readonly tag: "KvPutRequest";
218
- readonly val: KvPutRequest;
219
- } | {
220
- readonly tag: "KvDeleteRequest";
221
- readonly val: KvDeleteRequest;
222
- } | {
223
- readonly tag: "KvDropRequest";
224
- readonly val: KvDropRequest;
225
- };
226
- declare function readKvRequestData(bc: bare.ByteCursor): KvRequestData;
227
- declare function writeKvRequestData(bc: bare.ByteCursor, x: KvRequestData): void;
228
473
  type ToServerKvRequest = {
229
474
  readonly actorId: Id;
230
475
  readonly requestId: u32;
@@ -250,11 +495,17 @@ type ToServer = {
250
495
  } | {
251
496
  readonly tag: "ToServerKvRequest";
252
497
  readonly val: ToServerKvRequest;
498
+ } | {
499
+ readonly tag: "ToServerTunnelMessage";
500
+ readonly val: ToServerTunnelMessage;
253
501
  };
254
502
  declare function readToServer(bc: bare.ByteCursor): ToServer;
255
503
  declare function writeToServer(bc: bare.ByteCursor, x: ToServer): void;
256
504
  declare function encodeToServer(x: ToServer, config?: Partial<bare.Config>): Uint8Array;
257
505
  declare function decodeToServer(bytes: Uint8Array): ToServer;
506
+ /**
507
+ * MARK: To Client
508
+ */
258
509
  type ProtocolMetadata = {
259
510
  readonly runnerLostThreshold: i64;
260
511
  };
@@ -275,58 +526,19 @@ type ToClientAckEvents = {
275
526
  };
276
527
  declare function readToClientAckEvents(bc: bare.ByteCursor): ToClientAckEvents;
277
528
  declare function writeToClientAckEvents(bc: bare.ByteCursor, x: ToClientAckEvents): void;
278
- type KvErrorResponse = {
279
- readonly message: string;
280
- };
281
- declare function readKvErrorResponse(bc: bare.ByteCursor): KvErrorResponse;
282
- declare function writeKvErrorResponse(bc: bare.ByteCursor, x: KvErrorResponse): void;
283
- type KvGetResponse = {
284
- readonly keys: readonly KvKey[];
285
- readonly values: readonly KvValue[];
286
- readonly metadata: readonly KvMetadata[];
287
- };
288
- declare function readKvGetResponse(bc: bare.ByteCursor): KvGetResponse;
289
- declare function writeKvGetResponse(bc: bare.ByteCursor, x: KvGetResponse): void;
290
- type KvListResponse = {
291
- readonly keys: readonly KvKey[];
292
- readonly values: readonly KvValue[];
293
- readonly metadata: readonly KvMetadata[];
294
- };
295
- declare function readKvListResponse(bc: bare.ByteCursor): KvListResponse;
296
- declare function writeKvListResponse(bc: bare.ByteCursor, x: KvListResponse): void;
297
- type KvPutResponse = null;
298
- type KvDeleteResponse = null;
299
- type KvDropResponse = null;
300
- type KvResponseData = {
301
- readonly tag: "KvErrorResponse";
302
- readonly val: KvErrorResponse;
303
- } | {
304
- readonly tag: "KvGetResponse";
305
- readonly val: KvGetResponse;
306
- } | {
307
- readonly tag: "KvListResponse";
308
- readonly val: KvListResponse;
309
- } | {
310
- readonly tag: "KvPutResponse";
311
- readonly val: KvPutResponse;
312
- } | {
313
- readonly tag: "KvDeleteResponse";
314
- readonly val: KvDeleteResponse;
315
- } | {
316
- readonly tag: "KvDropResponse";
317
- readonly val: KvDropResponse;
318
- };
319
- declare function readKvResponseData(bc: bare.ByteCursor): KvResponseData;
320
- declare function writeKvResponseData(bc: bare.ByteCursor, x: KvResponseData): void;
321
529
  type ToClientKvResponse = {
322
530
  readonly requestId: u32;
323
531
  readonly data: KvResponseData;
324
532
  };
325
533
  declare function readToClientKvResponse(bc: bare.ByteCursor): ToClientKvResponse;
326
534
  declare function writeToClientKvResponse(bc: bare.ByteCursor, x: ToClientKvResponse): void;
535
+ type ToClientClose = null;
327
536
  type ToClient = {
328
537
  readonly tag: "ToClientInit";
329
538
  readonly val: ToClientInit;
539
+ } | {
540
+ readonly tag: "ToClientClose";
541
+ readonly val: ToClientClose;
330
542
  } | {
331
543
  readonly tag: "ToClientCommands";
332
544
  readonly val: ToClientCommands;
@@ -336,10 +548,23 @@ type ToClient = {
336
548
  } | {
337
549
  readonly tag: "ToClientKvResponse";
338
550
  readonly val: ToClientKvResponse;
551
+ } | {
552
+ readonly tag: "ToClientTunnelMessage";
553
+ readonly val: ToClientTunnelMessage;
339
554
  };
340
555
  declare function readToClient(bc: bare.ByteCursor): ToClient;
341
556
  declare function writeToClient(bc: bare.ByteCursor, x: ToClient): void;
342
557
  declare function encodeToClient(x: ToClient, config?: Partial<bare.Config>): Uint8Array;
343
558
  declare function decodeToClient(bytes: Uint8Array): ToClient;
559
+ /**
560
+ * MARK: To Gateway
561
+ */
562
+ type ToGateway = {
563
+ readonly message: ToServerTunnelMessage;
564
+ };
565
+ declare function readToGateway(bc: bare.ByteCursor): ToGateway;
566
+ declare function writeToGateway(bc: bare.ByteCursor, x: ToGateway): void;
567
+ declare function encodeToGateway(x: ToGateway, config?: Partial<bare.Config>): Uint8Array;
568
+ declare function decodeToGateway(bytes: Uint8Array): ToGateway;
344
569
 
345
- export { 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 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 ProtocolMetadata, StopCode, type ToClient, type ToClientAckEvents, type ToClientCommands, type ToClientInit, type ToClientKvResponse, type ToServer, type ToServerAckCommands, type ToServerEvents, type ToServerInit, type ToServerKvRequest, type ToServerPing, type ToServerStopping, decodeToClient, decodeToServer, encodeToClient, encodeToServer, type i64, readActorConfig, readActorIntent, readActorName, readActorState, readActorStateStopped, readCommand, readCommandStartActor, readCommandStopActor, readCommandWrapper, readEvent, readEventActorIntent, readEventActorSetAlarm, readEventActorStateUpdate, readEventWrapper, readId, readJson, readKvDeleteRequest, readKvErrorResponse, readKvGetRequest, readKvGetResponse, readKvKey, readKvListPrefixQuery, readKvListQuery, readKvListRangeQuery, readKvListRequest, readKvListResponse, readKvMetadata, readKvPutRequest, readKvRequestData, readKvResponseData, readKvValue, readProtocolMetadata, readStopCode, readToClient, readToClientAckEvents, readToClientCommands, readToClientInit, readToClientKvResponse, readToServer, readToServerAckCommands, readToServerEvents, readToServerInit, readToServerKvRequest, readToServerPing, type u32, type u64, writeActorConfig, writeActorIntent, writeActorName, writeActorState, writeActorStateStopped, writeCommand, writeCommandStartActor, writeCommandStopActor, writeCommandWrapper, writeEvent, writeEventActorIntent, writeEventActorSetAlarm, writeEventActorStateUpdate, writeEventWrapper, writeId, writeJson, writeKvDeleteRequest, writeKvErrorResponse, writeKvGetRequest, writeKvGetResponse, writeKvKey, writeKvListPrefixQuery, writeKvListQuery, writeKvListRangeQuery, writeKvListRequest, writeKvListResponse, writeKvMetadata, writeKvPutRequest, writeKvRequestData, writeKvResponseData, writeKvValue, writeProtocolMetadata, writeStopCode, writeToClient, writeToClientAckEvents, writeToClientCommands, writeToClientInit, writeToClientKvResponse, writeToServer, writeToServerAckCommands, writeToServerEvents, writeToServerInit, writeToServerKvRequest, writeToServerPing };
570
+ export { 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 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 ProtocolMetadata, type RequestId, StopCode, type ToClient, type ToClientAckEvents, type ToClientClose, type ToClientCommands, type ToClientInit, type ToClientKvResponse, type ToClientRequestAbort, type ToClientRequestChunk, type ToClientRequestStart, type ToClientTunnelMessage, type ToClientTunnelMessageKind, type ToClientWebSocketClose, type ToClientWebSocketMessage, type ToClientWebSocketOpen, type ToGateway, type ToServer, type ToServerAckCommands, type ToServerEvents, type ToServerInit, type ToServerKvRequest, type ToServerPing, type ToServerResponseAbort, type ToServerResponseChunk, type ToServerResponseStart, type ToServerStopping, type ToServerTunnelMessage, type ToServerTunnelMessageKind, type ToServerWebSocketClose, type ToServerWebSocketMessage, type ToServerWebSocketOpen, type TunnelAck, decodeToClient, decodeToGateway, decodeToServer, encodeToClient, encodeToGateway, encodeToServer, type i64, readActorConfig, readActorIntent, readActorName, readActorState, readActorStateStopped, readCommand, readCommandStartActor, readCommandStopActor, readCommandWrapper, readEvent, readEventActorIntent, readEventActorSetAlarm, readEventActorStateUpdate, readEventWrapper, readId, readJson, readKvDeleteRequest, readKvErrorResponse, readKvGetRequest, readKvGetResponse, readKvKey, readKvListPrefixQuery, readKvListQuery, readKvListRangeQuery, readKvListRequest, readKvListResponse, readKvMetadata, readKvPutRequest, readKvRequestData, readKvResponseData, readKvValue, readMessageId, readProtocolMetadata, readRequestId, readStopCode, readToClient, readToClientAckEvents, readToClientCommands, readToClientInit, readToClientKvResponse, readToClientRequestChunk, readToClientRequestStart, readToClientTunnelMessage, readToClientTunnelMessageKind, readToClientWebSocketClose, readToClientWebSocketMessage, readToClientWebSocketOpen, readToGateway, readToServer, readToServerAckCommands, readToServerEvents, readToServerInit, readToServerKvRequest, readToServerPing, readToServerResponseChunk, readToServerResponseStart, readToServerTunnelMessage, readToServerTunnelMessageKind, readToServerWebSocketClose, readToServerWebSocketMessage, type u16, type u32, type u64, writeActorConfig, writeActorIntent, writeActorName, writeActorState, writeActorStateStopped, writeCommand, writeCommandStartActor, writeCommandStopActor, writeCommandWrapper, writeEvent, writeEventActorIntent, writeEventActorSetAlarm, writeEventActorStateUpdate, writeEventWrapper, writeId, writeJson, writeKvDeleteRequest, writeKvErrorResponse, writeKvGetRequest, writeKvGetResponse, writeKvKey, writeKvListPrefixQuery, writeKvListQuery, writeKvListRangeQuery, writeKvListRequest, writeKvListResponse, writeKvMetadata, writeKvPutRequest, writeKvRequestData, writeKvResponseData, writeKvValue, writeMessageId, writeProtocolMetadata, writeRequestId, writeStopCode, writeToClient, writeToClientAckEvents, writeToClientCommands, writeToClientInit, writeToClientKvResponse, writeToClientRequestChunk, writeToClientRequestStart, writeToClientTunnelMessage, writeToClientTunnelMessageKind, writeToClientWebSocketClose, writeToClientWebSocketMessage, writeToClientWebSocketOpen, writeToGateway, writeToServer, writeToServerAckCommands, writeToServerEvents, writeToServerInit, writeToServerKvRequest, writeToServerPing, writeToServerResponseChunk, writeToServerResponseStart, writeToServerTunnelMessage, writeToServerTunnelMessageKind, writeToServerWebSocketClose, writeToServerWebSocketMessage };