@@ -278,6 +278,9 @@ type VideoGrant struct {
278278 // if a participant can subscribe to metrics
279279 CanSubscribeMetrics * bool `json:"canSubscribeMetrics,omitempty"`
280280
281+ // if a participant can manage an agent session via RemoteSession
282+ CanManageAgentSession * bool `json:"canManageAgentSession,omitempty"`
283+
281284 // destination room which this participant can forward to
282285 DestinationRoom string `json:"destinationRoom,omitempty"`
283286}
@@ -309,6 +312,10 @@ func (v *VideoGrant) SetCanSubscribeMetrics(val bool) {
309312 v .CanSubscribeMetrics = & val
310313}
311314
315+ func (v * VideoGrant ) SetCanManageAgentSession (val bool ) {
316+ v .CanManageAgentSession = & val
317+ }
318+
312319func (v * VideoGrant ) GetCanPublish () bool {
313320 if v .CanPublish == nil {
314321 return true
@@ -373,6 +380,13 @@ func (v *VideoGrant) GetCanSubscribeMetrics() bool {
373380 return * v .CanSubscribeMetrics
374381}
375382
383+ func (v * VideoGrant ) GetCanManageAgentSession () bool {
384+ if v .CanManageAgentSession == nil {
385+ return false
386+ }
387+ return * v .CanManageAgentSession
388+ }
389+
376390func (v * VideoGrant ) MatchesPermission (permission * livekit.ParticipantPermission ) bool {
377391 if permission == nil {
378392 return false
@@ -405,6 +419,9 @@ func (v *VideoGrant) MatchesPermission(permission *livekit.ParticipantPermission
405419 if v .GetCanSubscribeMetrics () != permission .CanSubscribeMetrics {
406420 return false
407421 }
422+ if v .GetCanManageAgentSession () != permission .CanManageAgentSession {
423+ return false
424+ }
408425
409426 return true
410427}
@@ -423,6 +440,7 @@ func (v *VideoGrant) UpdateFromPermission(permission *livekit.ParticipantPermiss
423440 v .Recorder = permission .Recorder
424441 v .Agent = permission .Agent
425442 v .SetCanSubscribeMetrics (permission .CanSubscribeMetrics )
443+ v .SetCanManageAgentSession (permission .CanManageAgentSession )
426444}
427445
428446func (v * VideoGrant ) ToPermission () * livekit.ParticipantPermission {
@@ -435,7 +453,8 @@ func (v *VideoGrant) ToPermission() *livekit.ParticipantPermission {
435453 Hidden : v .Hidden ,
436454 Recorder : v .Recorder ,
437455 Agent : v .Agent ,
438- CanSubscribeMetrics : v .GetCanSubscribeMetrics (),
456+ CanSubscribeMetrics : v .GetCanSubscribeMetrics (),
457+ CanManageAgentSession : v .GetCanManageAgentSession (),
439458 }
440459}
441460
@@ -471,6 +490,16 @@ func (v *VideoGrant) Clone() *VideoGrant {
471490 clone .CanUpdateOwnMetadata = & canUpdateOwnMetadata
472491 }
473492
493+ if v .CanSubscribeMetrics != nil {
494+ canSubscribeMetrics := * v .CanSubscribeMetrics
495+ clone .CanSubscribeMetrics = & canSubscribeMetrics
496+ }
497+
498+ if v .CanManageAgentSession != nil {
499+ canManageAgentSession := * v .CanManageAgentSession
500+ clone .CanManageAgentSession = & canManageAgentSession
501+ }
502+
474503 return & clone
475504}
476505
@@ -508,6 +537,7 @@ func (v *VideoGrant) MarshalLogObject(e zapcore.ObjectEncoder) error {
508537 logBoolPtr ("Agent" , & v .Agent )
509538
510539 logBoolPtr ("CanSubscribeMetrics" , v .CanSubscribeMetrics )
540+ logBoolPtr ("CanManageAgentSession" , v .CanManageAgentSession )
511541 e .AddString ("DestinationRoom" , v .DestinationRoom )
512542 return nil
513543}
0 commit comments