Skip to content

Commit 22adce4

Browse files
committed
wip
1 parent d60e932 commit 22adce4

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

auth/accesstoken.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ func (t *AccessToken) SetObservabilityGrant(grant *ObservabilityGrant) *AccessTo
103103
return t
104104
}
105105

106+
func (t *AccessToken) SetSimulationGrant(grant *SimulationGrant) *AccessToken {
107+
t.grant.Simulation = grant
108+
return t
109+
}
110+
106111
func (t *AccessToken) SetMetadata(md string) *AccessToken {
107112
t.grant.Metadata = md
108113
return t

auth/grants.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ type ClaimGrants struct {
172172
Agent *AgentGrant `json:"agent,omitempty"`
173173
Inference *InferenceGrant `json:"inference,omitempty"`
174174
Observability *ObservabilityGrant `json:"observability,omitempty"`
175+
Simulation *SimulationGrant `json:"simulation,omitempty"`
175176
// Room configuration to use if this participant initiates the room
176177
RoomConfig *RoomConfiguration `json:"roomConfig,omitempty"`
177178
// Cloud-only, config preset to use
@@ -218,6 +219,7 @@ func (c *ClaimGrants) Clone() *ClaimGrants {
218219
clone.Agent = c.Agent.Clone()
219220
clone.Inference = c.Inference.Clone()
220221
clone.Observability = c.Observability.Clone()
222+
clone.Simulation = c.Simulation.Clone()
221223
clone.Attributes = maps.Clone(c.Attributes)
222224
clone.RoomConfig = c.RoomConfig.Clone()
223225
if len(c.KindDetails) > 0 {
@@ -240,6 +242,7 @@ func (c *ClaimGrants) MarshalLogObject(e zapcore.ObjectEncoder) error {
240242
e.AddObject("Agent", c.Agent)
241243
e.AddObject("Inference", c.Inference)
242244
e.AddObject("Observability", c.Observability)
245+
e.AddObject("Simulation", c.Simulation)
243246
e.AddObject("RoomConfig", logger.Proto((*livekit.RoomConfiguration)(c.RoomConfig)))
244247
e.AddString("RoomPreset", c.RoomPreset)
245248
return nil
@@ -628,6 +631,32 @@ func (s *ObservabilityGrant) MarshalLogObject(e zapcore.ObjectEncoder) error {
628631

629632
// ------------------------------------------------------------------
630633

634+
type SimulationGrant struct {
635+
// Dispatch grants access to dispatch simulated humans to evaluate an agent.
636+
Dispatch bool `json:"dispatch,omitempty"`
637+
}
638+
639+
func (s *SimulationGrant) Clone() *SimulationGrant {
640+
if s == nil {
641+
return nil
642+
}
643+
644+
clone := *s
645+
646+
return &clone
647+
}
648+
649+
func (s *SimulationGrant) MarshalLogObject(e zapcore.ObjectEncoder) error {
650+
if s == nil {
651+
return nil
652+
}
653+
654+
e.AddBool("Dispatch", s.Dispatch)
655+
return nil
656+
}
657+
658+
// ------------------------------------------------------------------
659+
631660
func sourceToString(source livekit.TrackSource) string {
632661
return strings.ToLower(source.String())
633662
}

0 commit comments

Comments
 (0)