@livekit/rtc-node 0.10.1 → 0.10.3

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 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "LiveKit RTC Node",
4
4
  "license": "Apache-2.0",
5
5
  "author": "LiveKit",
6
- "version": "0.10.1",
6
+ "version": "0.10.3",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "type": "module",
@@ -43,11 +43,11 @@
43
43
  "prettier": "^3.0.3"
44
44
  },
45
45
  "optionalDependencies": {
46
- "@livekit/rtc-node-darwin-arm64": "0.10.1",
47
- "@livekit/rtc-node-darwin-x64": "0.10.1",
48
- "@livekit/rtc-node-linux-arm64-gnu": "0.10.1",
49
- "@livekit/rtc-node-linux-x64-gnu": "0.10.1",
50
- "@livekit/rtc-node-win32-x64-msvc": "0.10.1"
46
+ "@livekit/rtc-node-darwin-arm64": "0.10.3",
47
+ "@livekit/rtc-node-darwin-x64": "0.10.3",
48
+ "@livekit/rtc-node-linux-arm64-gnu": "0.10.3",
49
+ "@livekit/rtc-node-linux-x64-gnu": "0.10.3",
50
+ "@livekit/rtc-node-win32-x64-msvc": "0.10.3"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">= 18"
@@ -1,20 +1,20 @@
1
1
  // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import { AudioFrame } from './audio_frame';
5
- import { FfiClient, FfiHandle } from './ffi_client';
4
+ import { AudioFrame } from './audio_frame.js';
5
+ import { FfiClient, FfiHandle } from './ffi_client.js';
6
6
  import type {
7
7
  FlushSoxResamplerResponse,
8
8
  NewSoxResamplerResponse,
9
9
  PushSoxResamplerResponse,
10
- } from './proto/audio_frame_pb';
10
+ } from './proto/audio_frame_pb.js';
11
11
  import {
12
12
  FlushSoxResamplerRequest,
13
13
  NewSoxResamplerRequest,
14
14
  PushSoxResamplerRequest,
15
15
  SoxQualityRecipe,
16
16
  SoxResamplerDataType,
17
- } from './proto/audio_frame_pb';
17
+ } from './proto/audio_frame_pb.js';
18
18
 
19
19
  /**
20
20
  * Resampler quality. Higher quality settings result in better audio quality but require more
@@ -62,7 +62,7 @@ export class AudioResampler {
62
62
  inputRate,
63
63
  outputRate,
64
64
  numChannels: channels,
65
- qualityRecipe: quality as unknown as SoxQualityRecipe,
65
+ qualityRecipe: quality as number as SoxQualityRecipe,
66
66
  inputDataType: SoxResamplerDataType.SOXR_DATATYPE_INT16I,
67
67
  outputDataType: SoxResamplerDataType.SOXR_DATATYPE_INT16I,
68
68
  flags: 0,
@@ -97,7 +97,7 @@ export class AudioResampler {
97
97
  const req = new PushSoxResamplerRequest({
98
98
  resamplerHandle: this.#ffiHandle.handle,
99
99
  dataPtr: data.protoInfo().dataPtr,
100
- size: data.data.length,
100
+ size: data.data.byteLength,
101
101
  });
102
102
 
103
103
  const res = FfiClient.instance.request<PushSoxResamplerResponse>({
@@ -111,14 +111,14 @@ export class AudioResampler {
111
111
  throw new Error(res.error);
112
112
  }
113
113
 
114
- if (res.outputPtr) {
114
+ if (!res.outputPtr) {
115
115
  return [];
116
116
  }
117
117
 
118
118
  const outputData = FfiClient.instance.copyBuffer(res.outputPtr, res.size);
119
119
  return [
120
120
  new AudioFrame(
121
- new Int16Array(outputData.subarray()),
121
+ new Int16Array(outputData.buffer),
122
122
  this.#outputRate,
123
123
  this.#channels,
124
124
  Math.trunc(outputData.length / this.#channels / 2),
@@ -149,14 +149,14 @@ export class AudioResampler {
149
149
  throw new Error(res.error);
150
150
  }
151
151
 
152
- if (res.outputPtr) {
152
+ if (!res.outputPtr) {
153
153
  return [];
154
154
  }
155
155
 
156
156
  const outputData = FfiClient.instance.copyBuffer(res.outputPtr, res.size);
157
157
  return [
158
158
  new AudioFrame(
159
- new Int16Array(outputData.subarray()),
159
+ new Int16Array(outputData.buffer),
160
160
  this.#outputRate,
161
161
  this.#channels,
162
162
  Math.trunc(outputData.length / this.#channels / 2),
package/src/index.ts CHANGED
@@ -16,7 +16,7 @@ export {
16
16
  AudioTrack,
17
17
  } from './track.js';
18
18
  export { VideoFrame } from './video_frame.js';
19
- export { AudioFrame } from './audio_frame.js';
19
+ export { AudioFrame, combineAudioFrames } from './audio_frame.js';
20
20
  export { AudioStream } from './audio_stream.js';
21
21
  export { AudioResampler, AudioResamplerQuality } from './audio_resampler.js';
22
22
  export { VideoStream, VideoFrameEvent } from './video_stream.js';
@@ -43,3 +43,4 @@ export { StreamState, TrackKind, TrackSource } from './proto/track_pb.js';
43
43
  export { VideoBufferType, VideoRotation, VideoCodec } from './proto/video_frame_pb.js';
44
44
  export { ParticipantKind } from './proto/participant_pb.js';
45
45
  export { dispose } from './ffi_client.js';
46
+ export type { ChatMessage } from './types.js';
@@ -3,11 +3,14 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- export function livekitInitialize(callback: (data: Uint8Array) => void, captureLogs: boolean): void;
7
- export function livekitFfiRequest(data: Uint8Array): Uint8Array;
8
- export function livekitRetrievePtr(handle: Uint8Array): bigint;
9
- export function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
10
- export function livekitDispose(): Promise<void>;
6
+ export declare function livekitInitialize(
7
+ callback: (data: Uint8Array) => void,
8
+ captureLogs: boolean,
9
+ ): void;
10
+ export declare function livekitFfiRequest(data: Uint8Array): Uint8Array;
11
+ export declare function livekitRetrievePtr(handle: Uint8Array): bigint;
12
+ export declare function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
13
+ export declare function livekitDispose(): Promise<void>;
11
14
  export declare class FfiHandle {
12
15
  constructor(handle: bigint);
13
16
  dispose(): void;
@@ -3,7 +3,8 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import { FfiClient, FfiHandle } from './ffi_client.js';
5
5
  import type { OwnedParticipant, ParticipantInfo, ParticipantKind } from './proto/participant_pb.js';
6
- import type {
6
+ import {
7
+ ChatMessage as ChatMessageModel,
7
8
  PublishDataCallback,
8
9
  PublishDataResponse,
9
10
  PublishSipDtmfCallback,
@@ -12,6 +13,8 @@ import type {
12
13
  PublishTrackResponse,
13
14
  PublishTranscriptionCallback,
14
15
  PublishTranscriptionResponse,
16
+ SendChatMessageCallback,
17
+ SendChatMessageResponse,
15
18
  SetLocalAttributesCallback,
16
19
  SetLocalAttributesResponse,
17
20
  SetLocalMetadataCallback,
@@ -23,11 +26,13 @@ import type {
23
26
  UnpublishTrackResponse,
24
27
  } from './proto/room_pb.js';
25
28
  import {
29
+ EditChatMessageRequest,
26
30
  TranscriptionSegment as ProtoTranscriptionSegment,
27
31
  PublishDataRequest,
28
32
  PublishSipDtmfRequest,
29
33
  PublishTrackRequest,
30
34
  PublishTranscriptionRequest,
35
+ SendChatMessageRequest,
31
36
  SetLocalAttributesRequest,
32
37
  SetLocalMetadataRequest,
33
38
  SetLocalNameRequest,
@@ -37,6 +42,7 @@ import type { LocalTrack } from './track.js';
37
42
  import type { RemoteTrackPublication, TrackPublication } from './track_publication.js';
38
43
  import { LocalTrackPublication } from './track_publication.js';
39
44
  import type { Transcription } from './transcription.js';
45
+ import { ChatMessage } from './types.js';
40
46
 
41
47
  export abstract class Participant {
42
48
  /** @internal */
@@ -185,6 +191,77 @@ export class LocalParticipant extends Participant {
185
191
  });
186
192
  }
187
193
 
194
+ /**
195
+ *
196
+ */
197
+ async sendChatMessage(
198
+ text: string,
199
+ destinationIdentities?: Array<string>,
200
+ senderIdentity?: string,
201
+ ): Promise<ChatMessage> {
202
+ const req = new SendChatMessageRequest({
203
+ localParticipantHandle: this.ffi_handle.handle,
204
+ message: text,
205
+ destinationIdentities,
206
+ senderIdentity,
207
+ });
208
+
209
+ const res = FfiClient.instance.request<SendChatMessageResponse>({
210
+ message: { case: 'sendChatMessage', value: req },
211
+ });
212
+
213
+ const cb = await FfiClient.instance.waitFor<SendChatMessageCallback>((ev) => {
214
+ return ev.message.case == 'chatMessage' && ev.message.value.asyncId == res.asyncId;
215
+ });
216
+
217
+ if (cb.error) {
218
+ throw new Error(cb.error);
219
+ }
220
+ const { id, timestamp, editTimestamp, message } = cb.chatMessage;
221
+ return { id, timestamp: Number(timestamp), editTimestamp: Number(editTimestamp), message };
222
+ }
223
+
224
+ /**
225
+ * Sends a chat message to participants in the room
226
+ *
227
+ * @param text - The text content of the chat message.
228
+ * @param destinationIdentities - An optional array of recipient identities to whom the message will be sent. If omitted, the message is broadcast to all participants.
229
+ * @param senderIdentity - An optional identity of the sender. If omitted, the default sender identity is used.
230
+ *
231
+ */
232
+ async editChatMessage(
233
+ editText: string,
234
+ originalMessage: ChatMessage,
235
+ destinationIdentities?: Array<string>,
236
+ senderIdentity?: string,
237
+ ): Promise<ChatMessage> {
238
+ const req = new EditChatMessageRequest({
239
+ localParticipantHandle: this.ffi_handle.handle,
240
+ editText,
241
+ originalMessage: new ChatMessageModel({
242
+ ...originalMessage,
243
+ timestamp: BigInt(originalMessage.timestamp),
244
+ editTimestamp: BigInt(originalMessage.editTimestamp),
245
+ }),
246
+ destinationIdentities,
247
+ senderIdentity,
248
+ });
249
+
250
+ const res = FfiClient.instance.request<SendChatMessageResponse>({
251
+ message: { case: 'editChatMessage', value: req },
252
+ });
253
+
254
+ const cb = await FfiClient.instance.waitFor<SendChatMessageCallback>((ev) => {
255
+ return ev.message.case == 'chatMessage' && ev.message.value.asyncId == res.asyncId;
256
+ });
257
+
258
+ if (cb.error) {
259
+ throw new Error(cb.error);
260
+ }
261
+ const { id, timestamp, editTimestamp, message } = cb.chatMessage;
262
+ return { id, timestamp: Number(timestamp), editTimestamp: Number(editTimestamp), message };
263
+ }
264
+
188
265
  async updateName(name: string) {
189
266
  const req = new SetLocalNameRequest({
190
267
  localParticipantHandle: this.ffi_handle.handle,
@@ -19,7 +19,7 @@
19
19
 
20
20
  import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
21
21
  import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
22
- import { ConnectCallback, ConnectRequest, ConnectResponse, DisconnectCallback, DisconnectRequest, DisconnectResponse, GetSessionStatsCallback, GetSessionStatsRequest, GetSessionStatsResponse, PublishDataCallback, PublishDataRequest, PublishDataResponse, PublishSipDtmfCallback, PublishSipDtmfRequest, PublishSipDtmfResponse, PublishTrackCallback, PublishTrackRequest, PublishTrackResponse, PublishTranscriptionCallback, PublishTranscriptionRequest, PublishTranscriptionResponse, RoomEvent, SetLocalAttributesCallback, SetLocalAttributesRequest, SetLocalAttributesResponse, SetLocalMetadataCallback, SetLocalMetadataRequest, SetLocalMetadataResponse, SetLocalNameCallback, SetLocalNameRequest, SetLocalNameResponse, SetSubscribedRequest, SetSubscribedResponse, UnpublishTrackCallback, UnpublishTrackRequest, UnpublishTrackResponse } from "./room_pb.js";
22
+ import { ConnectCallback, ConnectRequest, ConnectResponse, DisconnectCallback, DisconnectRequest, DisconnectResponse, EditChatMessageRequest, GetSessionStatsCallback, GetSessionStatsRequest, GetSessionStatsResponse, PublishDataCallback, PublishDataRequest, PublishDataResponse, PublishSipDtmfCallback, PublishSipDtmfRequest, PublishSipDtmfResponse, PublishTrackCallback, PublishTrackRequest, PublishTrackResponse, PublishTranscriptionCallback, PublishTranscriptionRequest, PublishTranscriptionResponse, RoomEvent, SendChatMessageCallback, SendChatMessageRequest, SendChatMessageResponse, SetLocalAttributesCallback, SetLocalAttributesRequest, SetLocalAttributesResponse, SetLocalMetadataCallback, SetLocalMetadataRequest, SetLocalMetadataResponse, SetLocalNameCallback, SetLocalNameRequest, SetLocalNameResponse, SetSubscribedRequest, SetSubscribedResponse, UnpublishTrackCallback, UnpublishTrackRequest, UnpublishTrackResponse } from "./room_pb.js";
23
23
  import { CreateAudioTrackRequest, CreateAudioTrackResponse, CreateVideoTrackRequest, CreateVideoTrackResponse, EnableRemoteTrackRequest, EnableRemoteTrackResponse, GetStatsCallback, GetStatsRequest, GetStatsResponse, LocalTrackMuteRequest, LocalTrackMuteResponse, TrackEvent } from "./track_pb.js";
24
24
  import { CaptureVideoFrameRequest, CaptureVideoFrameResponse, NewVideoSourceRequest, NewVideoSourceResponse, NewVideoStreamRequest, NewVideoStreamResponse, VideoConvertRequest, VideoConvertResponse, VideoStreamEvent, VideoStreamFromParticipantRequest, VideoStreamFromParticipantResponse } from "./video_frame_pb.js";
25
25
  import { AudioStreamEvent, AudioStreamFromParticipantRequest, AudioStreamFromParticipantResponse, CaptureAudioFrameCallback, CaptureAudioFrameRequest, CaptureAudioFrameResponse, ClearAudioBufferRequest, ClearAudioBufferResponse, FlushSoxResamplerRequest, FlushSoxResamplerResponse, NewAudioResamplerRequest, NewAudioResamplerResponse, NewAudioSourceRequest, NewAudioSourceResponse, NewAudioStreamRequest, NewAudioStreamResponse, NewSoxResamplerRequest, NewSoxResamplerResponse, PushSoxResamplerRequest, PushSoxResamplerResponse, RemixAndResampleRequest, RemixAndResampleResponse } from "./audio_frame_pb.js";
@@ -285,6 +285,18 @@ export class FfiRequest extends Message<FfiRequest> {
285
285
  */
286
286
  value: FlushSoxResamplerRequest;
287
287
  case: "flushSoxResampler";
288
+ } | {
289
+ /**
290
+ * @generated from field: livekit.proto.SendChatMessageRequest send_chat_message = 36;
291
+ */
292
+ value: SendChatMessageRequest;
293
+ case: "sendChatMessage";
294
+ } | {
295
+ /**
296
+ * @generated from field: livekit.proto.EditChatMessageRequest edit_chat_message = 37;
297
+ */
298
+ value: EditChatMessageRequest;
299
+ case: "editChatMessage";
288
300
  } | { case: undefined; value?: undefined } = { case: undefined };
289
301
 
290
302
  constructor(data?: PartialMessage<FfiRequest>) {
@@ -329,6 +341,8 @@ export class FfiRequest extends Message<FfiRequest> {
329
341
  { no: 33, name: "new_sox_resampler", kind: "message", T: NewSoxResamplerRequest, oneof: "message" },
330
342
  { no: 34, name: "push_sox_resampler", kind: "message", T: PushSoxResamplerRequest, oneof: "message" },
331
343
  { no: 35, name: "flush_sox_resampler", kind: "message", T: FlushSoxResamplerRequest, oneof: "message" },
344
+ { no: 36, name: "send_chat_message", kind: "message", T: SendChatMessageRequest, oneof: "message" },
345
+ { no: 37, name: "edit_chat_message", kind: "message", T: EditChatMessageRequest, oneof: "message" },
332
346
  ]);
333
347
 
334
348
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FfiRequest {
@@ -569,6 +583,12 @@ export class FfiResponse extends Message<FfiResponse> {
569
583
  */
570
584
  value: FlushSoxResamplerResponse;
571
585
  case: "flushSoxResampler";
586
+ } | {
587
+ /**
588
+ * @generated from field: livekit.proto.SendChatMessageResponse send_chat_message = 36;
589
+ */
590
+ value: SendChatMessageResponse;
591
+ case: "sendChatMessage";
572
592
  } | { case: undefined; value?: undefined } = { case: undefined };
573
593
 
574
594
  constructor(data?: PartialMessage<FfiResponse>) {
@@ -613,6 +633,7 @@ export class FfiResponse extends Message<FfiResponse> {
613
633
  { no: 33, name: "new_sox_resampler", kind: "message", T: NewSoxResamplerResponse, oneof: "message" },
614
634
  { no: 34, name: "push_sox_resampler", kind: "message", T: PushSoxResamplerResponse, oneof: "message" },
615
635
  { no: 35, name: "flush_sox_resampler", kind: "message", T: FlushSoxResamplerResponse, oneof: "message" },
636
+ { no: 36, name: "send_chat_message", kind: "message", T: SendChatMessageResponse, oneof: "message" },
616
637
  ]);
617
638
 
618
639
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FfiResponse {
@@ -763,6 +784,12 @@ export class FfiEvent extends Message<FfiEvent> {
763
784
  */
764
785
  value: PublishSipDtmfCallback;
765
786
  case: "publishSipDtmf";
787
+ } | {
788
+ /**
789
+ * @generated from field: livekit.proto.SendChatMessageCallback chat_message = 22;
790
+ */
791
+ value: SendChatMessageCallback;
792
+ case: "chatMessage";
766
793
  } | { case: undefined; value?: undefined } = { case: undefined };
767
794
 
768
795
  constructor(data?: PartialMessage<FfiEvent>) {
@@ -793,6 +820,7 @@ export class FfiEvent extends Message<FfiEvent> {
793
820
  { no: 19, name: "get_session_stats", kind: "message", T: GetSessionStatsCallback, oneof: "message" },
794
821
  { no: 20, name: "panic", kind: "message", T: Panic, oneof: "message" },
795
822
  { no: 21, name: "publish_sip_dtmf", kind: "message", T: PublishSipDtmfCallback, oneof: "message" },
823
+ { no: 22, name: "chat_message", kind: "message", T: SendChatMessageCallback, oneof: "message" },
796
824
  ]);
797
825
 
798
826
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FfiEvent {
@@ -1375,6 +1375,208 @@ export class SetLocalMetadataCallback extends Message<SetLocalMetadataCallback>
1375
1375
  }
1376
1376
  }
1377
1377
 
1378
+ /**
1379
+ * @generated from message livekit.proto.SendChatMessageRequest
1380
+ */
1381
+ export class SendChatMessageRequest extends Message<SendChatMessageRequest> {
1382
+ /**
1383
+ * @generated from field: uint64 local_participant_handle = 1;
1384
+ */
1385
+ localParticipantHandle = protoInt64.zero;
1386
+
1387
+ /**
1388
+ * @generated from field: string message = 2;
1389
+ */
1390
+ message = "";
1391
+
1392
+ /**
1393
+ * @generated from field: repeated string destination_identities = 3;
1394
+ */
1395
+ destinationIdentities: string[] = [];
1396
+
1397
+ /**
1398
+ * @generated from field: optional string sender_identity = 4;
1399
+ */
1400
+ senderIdentity?: string;
1401
+
1402
+ constructor(data?: PartialMessage<SendChatMessageRequest>) {
1403
+ super();
1404
+ proto3.util.initPartial(data, this);
1405
+ }
1406
+
1407
+ static readonly runtime: typeof proto3 = proto3;
1408
+ static readonly typeName = "livekit.proto.SendChatMessageRequest";
1409
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1410
+ { no: 1, name: "local_participant_handle", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
1411
+ { no: 2, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1412
+ { no: 3, name: "destination_identities", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
1413
+ { no: 4, name: "sender_identity", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
1414
+ ]);
1415
+
1416
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SendChatMessageRequest {
1417
+ return new SendChatMessageRequest().fromBinary(bytes, options);
1418
+ }
1419
+
1420
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SendChatMessageRequest {
1421
+ return new SendChatMessageRequest().fromJson(jsonValue, options);
1422
+ }
1423
+
1424
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SendChatMessageRequest {
1425
+ return new SendChatMessageRequest().fromJsonString(jsonString, options);
1426
+ }
1427
+
1428
+ static equals(a: SendChatMessageRequest | PlainMessage<SendChatMessageRequest> | undefined, b: SendChatMessageRequest | PlainMessage<SendChatMessageRequest> | undefined): boolean {
1429
+ return proto3.util.equals(SendChatMessageRequest, a, b);
1430
+ }
1431
+ }
1432
+
1433
+ /**
1434
+ * @generated from message livekit.proto.EditChatMessageRequest
1435
+ */
1436
+ export class EditChatMessageRequest extends Message<EditChatMessageRequest> {
1437
+ /**
1438
+ * @generated from field: uint64 local_participant_handle = 1;
1439
+ */
1440
+ localParticipantHandle = protoInt64.zero;
1441
+
1442
+ /**
1443
+ * @generated from field: string edit_text = 2;
1444
+ */
1445
+ editText = "";
1446
+
1447
+ /**
1448
+ * @generated from field: livekit.proto.ChatMessage original_message = 3;
1449
+ */
1450
+ originalMessage?: ChatMessage;
1451
+
1452
+ /**
1453
+ * @generated from field: repeated string destination_identities = 4;
1454
+ */
1455
+ destinationIdentities: string[] = [];
1456
+
1457
+ /**
1458
+ * @generated from field: optional string sender_identity = 5;
1459
+ */
1460
+ senderIdentity?: string;
1461
+
1462
+ constructor(data?: PartialMessage<EditChatMessageRequest>) {
1463
+ super();
1464
+ proto3.util.initPartial(data, this);
1465
+ }
1466
+
1467
+ static readonly runtime: typeof proto3 = proto3;
1468
+ static readonly typeName = "livekit.proto.EditChatMessageRequest";
1469
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1470
+ { no: 1, name: "local_participant_handle", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
1471
+ { no: 2, name: "edit_text", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1472
+ { no: 3, name: "original_message", kind: "message", T: ChatMessage },
1473
+ { no: 4, name: "destination_identities", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
1474
+ { no: 5, name: "sender_identity", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
1475
+ ]);
1476
+
1477
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EditChatMessageRequest {
1478
+ return new EditChatMessageRequest().fromBinary(bytes, options);
1479
+ }
1480
+
1481
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EditChatMessageRequest {
1482
+ return new EditChatMessageRequest().fromJson(jsonValue, options);
1483
+ }
1484
+
1485
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EditChatMessageRequest {
1486
+ return new EditChatMessageRequest().fromJsonString(jsonString, options);
1487
+ }
1488
+
1489
+ static equals(a: EditChatMessageRequest | PlainMessage<EditChatMessageRequest> | undefined, b: EditChatMessageRequest | PlainMessage<EditChatMessageRequest> | undefined): boolean {
1490
+ return proto3.util.equals(EditChatMessageRequest, a, b);
1491
+ }
1492
+ }
1493
+
1494
+ /**
1495
+ * @generated from message livekit.proto.SendChatMessageResponse
1496
+ */
1497
+ export class SendChatMessageResponse extends Message<SendChatMessageResponse> {
1498
+ /**
1499
+ * @generated from field: uint64 async_id = 1;
1500
+ */
1501
+ asyncId = protoInt64.zero;
1502
+
1503
+ constructor(data?: PartialMessage<SendChatMessageResponse>) {
1504
+ super();
1505
+ proto3.util.initPartial(data, this);
1506
+ }
1507
+
1508
+ static readonly runtime: typeof proto3 = proto3;
1509
+ static readonly typeName = "livekit.proto.SendChatMessageResponse";
1510
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1511
+ { no: 1, name: "async_id", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
1512
+ ]);
1513
+
1514
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SendChatMessageResponse {
1515
+ return new SendChatMessageResponse().fromBinary(bytes, options);
1516
+ }
1517
+
1518
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SendChatMessageResponse {
1519
+ return new SendChatMessageResponse().fromJson(jsonValue, options);
1520
+ }
1521
+
1522
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SendChatMessageResponse {
1523
+ return new SendChatMessageResponse().fromJsonString(jsonString, options);
1524
+ }
1525
+
1526
+ static equals(a: SendChatMessageResponse | PlainMessage<SendChatMessageResponse> | undefined, b: SendChatMessageResponse | PlainMessage<SendChatMessageResponse> | undefined): boolean {
1527
+ return proto3.util.equals(SendChatMessageResponse, a, b);
1528
+ }
1529
+ }
1530
+
1531
+ /**
1532
+ * @generated from message livekit.proto.SendChatMessageCallback
1533
+ */
1534
+ export class SendChatMessageCallback extends Message<SendChatMessageCallback> {
1535
+ /**
1536
+ * @generated from field: uint64 async_id = 1;
1537
+ */
1538
+ asyncId = protoInt64.zero;
1539
+
1540
+ /**
1541
+ * @generated from field: optional string error = 2;
1542
+ */
1543
+ error?: string;
1544
+
1545
+ /**
1546
+ * @generated from field: optional livekit.proto.ChatMessage chat_message = 3;
1547
+ */
1548
+ chatMessage?: ChatMessage;
1549
+
1550
+ constructor(data?: PartialMessage<SendChatMessageCallback>) {
1551
+ super();
1552
+ proto3.util.initPartial(data, this);
1553
+ }
1554
+
1555
+ static readonly runtime: typeof proto3 = proto3;
1556
+ static readonly typeName = "livekit.proto.SendChatMessageCallback";
1557
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1558
+ { no: 1, name: "async_id", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
1559
+ { no: 2, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
1560
+ { no: 3, name: "chat_message", kind: "message", T: ChatMessage, opt: true },
1561
+ ]);
1562
+
1563
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SendChatMessageCallback {
1564
+ return new SendChatMessageCallback().fromBinary(bytes, options);
1565
+ }
1566
+
1567
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SendChatMessageCallback {
1568
+ return new SendChatMessageCallback().fromJson(jsonValue, options);
1569
+ }
1570
+
1571
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SendChatMessageCallback {
1572
+ return new SendChatMessageCallback().fromJsonString(jsonString, options);
1573
+ }
1574
+
1575
+ static equals(a: SendChatMessageCallback | PlainMessage<SendChatMessageCallback> | undefined, b: SendChatMessageCallback | PlainMessage<SendChatMessageCallback> | undefined): boolean {
1576
+ return proto3.util.equals(SendChatMessageCallback, a, b);
1577
+ }
1578
+ }
1579
+
1378
1580
  /**
1379
1581
  * Change the local participant's attributes
1380
1582
  *
@@ -2491,6 +2693,12 @@ export class RoomEvent extends Message<RoomEvent> {
2491
2693
  */
2492
2694
  value: TranscriptionReceived;
2493
2695
  case: "transcriptionReceived";
2696
+ } | {
2697
+ /**
2698
+ * @generated from field: livekit.proto.ChatMessageReceived chat_message = 29;
2699
+ */
2700
+ value: ChatMessageReceived;
2701
+ case: "chatMessage";
2494
2702
  } | { case: undefined; value?: undefined } = { case: undefined };
2495
2703
 
2496
2704
  constructor(data?: PartialMessage<RoomEvent>) {
@@ -2529,6 +2737,7 @@ export class RoomEvent extends Message<RoomEvent> {
2529
2737
  { no: 26, name: "eos", kind: "message", T: RoomEOS, oneof: "message" },
2530
2738
  { no: 27, name: "data_packet_received", kind: "message", T: DataPacketReceived, oneof: "message" },
2531
2739
  { no: 28, name: "transcription_received", kind: "message", T: TranscriptionReceived, oneof: "message" },
2740
+ { no: 29, name: "chat_message", kind: "message", T: ChatMessageReceived, oneof: "message" },
2532
2741
  ]);
2533
2742
 
2534
2743
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RoomEvent {
@@ -3517,6 +3726,116 @@ export class UserPacket extends Message<UserPacket> {
3517
3726
  }
3518
3727
  }
3519
3728
 
3729
+ /**
3730
+ * @generated from message livekit.proto.ChatMessage
3731
+ */
3732
+ export class ChatMessage extends Message<ChatMessage> {
3733
+ /**
3734
+ * @generated from field: string id = 1;
3735
+ */
3736
+ id = "";
3737
+
3738
+ /**
3739
+ * @generated from field: int64 timestamp = 2;
3740
+ */
3741
+ timestamp = protoInt64.zero;
3742
+
3743
+ /**
3744
+ * @generated from field: string message = 3;
3745
+ */
3746
+ message = "";
3747
+
3748
+ /**
3749
+ * @generated from field: optional int64 edit_timestamp = 4;
3750
+ */
3751
+ editTimestamp?: bigint;
3752
+
3753
+ /**
3754
+ * @generated from field: optional bool deleted = 5;
3755
+ */
3756
+ deleted?: boolean;
3757
+
3758
+ /**
3759
+ * @generated from field: optional bool generated = 6;
3760
+ */
3761
+ generated?: boolean;
3762
+
3763
+ constructor(data?: PartialMessage<ChatMessage>) {
3764
+ super();
3765
+ proto3.util.initPartial(data, this);
3766
+ }
3767
+
3768
+ static readonly runtime: typeof proto3 = proto3;
3769
+ static readonly typeName = "livekit.proto.ChatMessage";
3770
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
3771
+ { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
3772
+ { no: 2, name: "timestamp", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
3773
+ { no: 3, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ },
3774
+ { no: 4, name: "edit_timestamp", kind: "scalar", T: 3 /* ScalarType.INT64 */, opt: true },
3775
+ { no: 5, name: "deleted", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true },
3776
+ { no: 6, name: "generated", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true },
3777
+ ]);
3778
+
3779
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ChatMessage {
3780
+ return new ChatMessage().fromBinary(bytes, options);
3781
+ }
3782
+
3783
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ChatMessage {
3784
+ return new ChatMessage().fromJson(jsonValue, options);
3785
+ }
3786
+
3787
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ChatMessage {
3788
+ return new ChatMessage().fromJsonString(jsonString, options);
3789
+ }
3790
+
3791
+ static equals(a: ChatMessage | PlainMessage<ChatMessage> | undefined, b: ChatMessage | PlainMessage<ChatMessage> | undefined): boolean {
3792
+ return proto3.util.equals(ChatMessage, a, b);
3793
+ }
3794
+ }
3795
+
3796
+ /**
3797
+ * @generated from message livekit.proto.ChatMessageReceived
3798
+ */
3799
+ export class ChatMessageReceived extends Message<ChatMessageReceived> {
3800
+ /**
3801
+ * @generated from field: livekit.proto.ChatMessage message = 1;
3802
+ */
3803
+ message?: ChatMessage;
3804
+
3805
+ /**
3806
+ * @generated from field: string participant_identity = 2;
3807
+ */
3808
+ participantIdentity = "";
3809
+
3810
+ constructor(data?: PartialMessage<ChatMessageReceived>) {
3811
+ super();
3812
+ proto3.util.initPartial(data, this);
3813
+ }
3814
+
3815
+ static readonly runtime: typeof proto3 = proto3;
3816
+ static readonly typeName = "livekit.proto.ChatMessageReceived";
3817
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
3818
+ { no: 1, name: "message", kind: "message", T: ChatMessage },
3819
+ { no: 2, name: "participant_identity", kind: "scalar", T: 9 /* ScalarType.STRING */ },
3820
+ ]);
3821
+
3822
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ChatMessageReceived {
3823
+ return new ChatMessageReceived().fromBinary(bytes, options);
3824
+ }
3825
+
3826
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ChatMessageReceived {
3827
+ return new ChatMessageReceived().fromJson(jsonValue, options);
3828
+ }
3829
+
3830
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ChatMessageReceived {
3831
+ return new ChatMessageReceived().fromJsonString(jsonString, options);
3832
+ }
3833
+
3834
+ static equals(a: ChatMessageReceived | PlainMessage<ChatMessageReceived> | undefined, b: ChatMessageReceived | PlainMessage<ChatMessageReceived> | undefined): boolean {
3835
+ return proto3.util.equals(ChatMessageReceived, a, b);
3836
+ }
3837
+ }
3838
+
3520
3839
  /**
3521
3840
  * @generated from message livekit.proto.SipDTMF
3522
3841
  */