From b411cbe39fb86c0ae6a16ab57bcedaecdf9d23e9 Mon Sep 17 00:00:00 2001 From: lukasIO Date: Thu, 7 Dec 2023 19:08:05 +0100 Subject: [PATCH] Add isAgent getter on participant (#960) * Add isAgent getter on participant * Create shy-steaks-poke.md --- .changeset/shy-steaks-poke.md | 5 +++++ src/proto/livekit_models_pb.ts | 16 +++++++++++++++- src/proto/livekit_rtc_pb.ts | 2 +- src/room/participant/Participant.ts | 4 ++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .changeset/shy-steaks-poke.md diff --git a/.changeset/shy-steaks-poke.md b/.changeset/shy-steaks-poke.md new file mode 100644 index 0000000000..dcdb21bd15 --- /dev/null +++ b/.changeset/shy-steaks-poke.md @@ -0,0 +1,5 @@ +--- +"livekit-client": patch +--- + +Add isAgent getter on participant diff --git a/src/proto/livekit_models_pb.ts b/src/proto/livekit_models_pb.ts index 3790087c22..def9fd4c45 100644 --- a/src/proto/livekit_models_pb.ts +++ b/src/proto/livekit_models_pb.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.3.3 with parameter "target=ts" +// @generated by protoc-gen-es v1.4.2 with parameter "target=ts" // @generated from file livekit_models.proto (package livekit, syntax proto3) /* eslint-disable */ // @ts-nocheck @@ -218,12 +218,18 @@ export enum ConnectionQuality { * @generated from enum value: EXCELLENT = 2; */ EXCELLENT = 2, + + /** + * @generated from enum value: LOST = 3; + */ + LOST = 3, } // Retrieve enum metadata with: proto3.getEnumType(ConnectionQuality) proto3.util.setEnumType(ConnectionQuality, "livekit.ConnectionQuality", [ { no: 0, name: "POOR" }, { no: 1, name: "GOOD" }, { no: 2, name: "EXCELLENT" }, + { no: 3, name: "LOST" }, ]); /** @@ -614,6 +620,13 @@ export class ParticipantPermission extends Message { */ canUpdateMetadata = false; + /** + * indicates that participant is an agent + * + * @generated from field: bool agent = 11; + */ + agent = false; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -629,6 +642,7 @@ export class ParticipantPermission extends Message { { no: 7, name: "hidden", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, { no: 8, name: "recorder", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, { no: 10, name: "can_update_metadata", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 11, name: "agent", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): ParticipantPermission { diff --git a/src/proto/livekit_rtc_pb.ts b/src/proto/livekit_rtc_pb.ts index b57a900b1e..638f35390f 100644 --- a/src/proto/livekit_rtc_pb.ts +++ b/src/proto/livekit_rtc_pb.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.3.3 with parameter "target=ts" +// @generated by protoc-gen-es v1.4.2 with parameter "target=ts" // @generated from file livekit_rtc.proto (package livekit, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/src/room/participant/Participant.ts b/src/room/participant/Participant.ts index 600bc19214..e90e306521 100644 --- a/src/room/participant/Participant.ts +++ b/src/room/participant/Participant.ts @@ -77,6 +77,10 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter return this.tracks.size > 0 && Array.from(this.tracks.values()).every((tr) => tr.isEncrypted); } + get isAgent() { + return this.permissions?.agent ?? false; + } + /** @internal */ constructor(sid: string, identity: string, name?: string, metadata?: string) { super();