Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions auth/accesstoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ func (t *AccessToken) SetObservabilityGrant(grant *ObservabilityGrant) *AccessTo
return t
}

func (t *AccessToken) SetSimulationGrant(grant *SimulationGrant) *AccessToken {
t.grant.Simulation = grant
return t
}

func (t *AccessToken) SetMetadata(md string) *AccessToken {
t.grant.Metadata = md
return t
Expand Down
29 changes: 29 additions & 0 deletions auth/grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ type ClaimGrants struct {
Agent *AgentGrant `json:"agent,omitempty"`
Inference *InferenceGrant `json:"inference,omitempty"`
Observability *ObservabilityGrant `json:"observability,omitempty"`
Simulation *SimulationGrant `json:"simulation,omitempty"`
// Room configuration to use if this participant initiates the room
RoomConfig *RoomConfiguration `json:"roomConfig,omitempty"`
// Cloud-only, config preset to use
Expand Down Expand Up @@ -218,6 +219,7 @@ func (c *ClaimGrants) Clone() *ClaimGrants {
clone.Agent = c.Agent.Clone()
clone.Inference = c.Inference.Clone()
clone.Observability = c.Observability.Clone()
clone.Simulation = c.Simulation.Clone()
clone.Attributes = maps.Clone(c.Attributes)
clone.RoomConfig = c.RoomConfig.Clone()
if len(c.KindDetails) > 0 {
Expand All @@ -240,6 +242,7 @@ func (c *ClaimGrants) MarshalLogObject(e zapcore.ObjectEncoder) error {
e.AddObject("Agent", c.Agent)
e.AddObject("Inference", c.Inference)
e.AddObject("Observability", c.Observability)
e.AddObject("Simulation", c.Simulation)
e.AddObject("RoomConfig", logger.Proto((*livekit.RoomConfiguration)(c.RoomConfig)))
e.AddString("RoomPreset", c.RoomPreset)
return nil
Expand Down Expand Up @@ -628,6 +631,32 @@ func (s *ObservabilityGrant) MarshalLogObject(e zapcore.ObjectEncoder) error {

// ------------------------------------------------------------------

type SimulationGrant struct {
// Dispatch grants access to dispatch simulated humans to evaluate an agent.
Dispatch bool `json:"dispatch,omitempty"`
}

func (s *SimulationGrant) Clone() *SimulationGrant {
if s == nil {
return nil
}

clone := *s

return &clone
}

func (s *SimulationGrant) MarshalLogObject(e zapcore.ObjectEncoder) error {
if s == nil {
return nil
}

e.AddBool("Dispatch", s.Dispatch)
return nil
}

// ------------------------------------------------------------------

func sourceToString(source livekit.TrackSource) string {
return strings.ToLower(source.String())
}
Expand Down
Loading