diff --git a/livekit/livekit_agent_simulation.pb.go b/livekit/livekit_agent_simulation.pb.go new file mode 100644 index 000000000..e2e9b5715 --- /dev/null +++ b/livekit/livekit_agent_simulation.pb.go @@ -0,0 +1,1987 @@ +// Copyright 2024 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v4.23.4 +// source: livekit_agent_simulation.proto + +package livekit + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SimulationRun_Status int32 + +const ( + SimulationRun_STATUS_GENERATING SimulationRun_Status = 0 + SimulationRun_STATUS_RUNNING SimulationRun_Status = 1 + SimulationRun_STATUS_COMPLETED SimulationRun_Status = 2 + SimulationRun_STATUS_FAILED SimulationRun_Status = 3 +) + +// Enum value maps for SimulationRun_Status. +var ( + SimulationRun_Status_name = map[int32]string{ + 0: "STATUS_GENERATING", + 1: "STATUS_RUNNING", + 2: "STATUS_COMPLETED", + 3: "STATUS_FAILED", + } + SimulationRun_Status_value = map[string]int32{ + "STATUS_GENERATING": 0, + "STATUS_RUNNING": 1, + "STATUS_COMPLETED": 2, + "STATUS_FAILED": 3, + } +) + +func (x SimulationRun_Status) Enum() *SimulationRun_Status { + p := new(SimulationRun_Status) + *p = x + return p +} + +func (x SimulationRun_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SimulationRun_Status) Descriptor() protoreflect.EnumDescriptor { + return file_livekit_agent_simulation_proto_enumTypes[0].Descriptor() +} + +func (SimulationRun_Status) Type() protoreflect.EnumType { + return &file_livekit_agent_simulation_proto_enumTypes[0] +} + +func (x SimulationRun_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SimulationRun_Status.Descriptor instead. +func (SimulationRun_Status) EnumDescriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0, 0} +} + +type SimulationRun_Job_Status int32 + +const ( + SimulationRun_Job_STATUS_PENDING SimulationRun_Job_Status = 0 + SimulationRun_Job_STATUS_RUNNING SimulationRun_Job_Status = 1 + SimulationRun_Job_STATUS_COMPLETED SimulationRun_Job_Status = 2 + SimulationRun_Job_STATUS_FAILED SimulationRun_Job_Status = 3 + SimulationRun_Job_STATUS_CANCELLED SimulationRun_Job_Status = 4 +) + +// Enum value maps for SimulationRun_Job_Status. +var ( + SimulationRun_Job_Status_name = map[int32]string{ + 0: "STATUS_PENDING", + 1: "STATUS_RUNNING", + 2: "STATUS_COMPLETED", + 3: "STATUS_FAILED", + 4: "STATUS_CANCELLED", + } + SimulationRun_Job_Status_value = map[string]int32{ + "STATUS_PENDING": 0, + "STATUS_RUNNING": 1, + "STATUS_COMPLETED": 2, + "STATUS_FAILED": 3, + "STATUS_CANCELLED": 4, + } +) + +func (x SimulationRun_Job_Status) Enum() *SimulationRun_Job_Status { + p := new(SimulationRun_Job_Status) + *p = x + return p +} + +func (x SimulationRun_Job_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SimulationRun_Job_Status) Descriptor() protoreflect.EnumDescriptor { + return file_livekit_agent_simulation_proto_enumTypes[1].Descriptor() +} + +func (SimulationRun_Job_Status) Type() protoreflect.EnumType { + return &file_livekit_agent_simulation_proto_enumTypes[1] +} + +func (x SimulationRun_Job_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SimulationRun_Job_Status.Descriptor instead. +func (SimulationRun_Job_Status) EnumDescriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0, 0, 0} +} + +type Scenario_Status int32 + +const ( + // Scenario is being generated from a session by an LLM. + // instructions and agent_expectations are not yet available. + Scenario_STATUS_GENERATING Scenario_Status = 0 + Scenario_STATUS_READY Scenario_Status = 1 + Scenario_STATUS_FAILED Scenario_Status = 2 +) + +// Enum value maps for Scenario_Status. +var ( + Scenario_Status_name = map[int32]string{ + 0: "STATUS_GENERATING", + 1: "STATUS_READY", + 2: "STATUS_FAILED", + } + Scenario_Status_value = map[string]int32{ + "STATUS_GENERATING": 0, + "STATUS_READY": 1, + "STATUS_FAILED": 2, + } +) + +func (x Scenario_Status) Enum() *Scenario_Status { + p := new(Scenario_Status) + *p = x + return p +} + +func (x Scenario_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Scenario_Status) Descriptor() protoreflect.EnumDescriptor { + return file_livekit_agent_simulation_proto_enumTypes[2].Descriptor() +} + +func (Scenario_Status) Type() protoreflect.EnumType { + return &file_livekit_agent_simulation_proto_enumTypes[2] +} + +func (x Scenario_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Scenario_Status.Descriptor instead. +func (Scenario_Status) EnumDescriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{1, 0} +} + +type SimulationRun struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Status SimulationRun_Status `protobuf:"varint,3,opt,name=status,proto3,enum=livekit.SimulationRun_Status" json:"status,omitempty"` + AgentDescription string `protobuf:"bytes,4,opt,name=agent_description,json=agentDescription,proto3" json:"agent_description,omitempty"` + Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"` + CreatedAt int64 `protobuf:"varint,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Jobs []*SimulationRun_Job `protobuf:"bytes,7,rep,name=jobs,proto3" json:"jobs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SimulationRun) Reset() { + *x = SimulationRun{} + mi := &file_livekit_agent_simulation_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SimulationRun) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimulationRun) ProtoMessage() {} + +func (x *SimulationRun) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SimulationRun.ProtoReflect.Descriptor instead. +func (*SimulationRun) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0} +} + +func (x *SimulationRun) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SimulationRun) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *SimulationRun) GetStatus() SimulationRun_Status { + if x != nil { + return x.Status + } + return SimulationRun_STATUS_GENERATING +} + +func (x *SimulationRun) GetAgentDescription() string { + if x != nil { + return x.AgentDescription + } + return "" +} + +func (x *SimulationRun) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +func (x *SimulationRun) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *SimulationRun) GetJobs() []*SimulationRun_Job { + if x != nil { + return x.Jobs + } + return nil +} + +type Scenario struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + Instructions string `protobuf:"bytes,4,opt,name=instructions,proto3" json:"instructions,omitempty"` + AgentExpectations string `protobuf:"bytes,5,opt,name=agent_expectations,json=agentExpectations,proto3" json:"agent_expectations,omitempty"` + SourceRoomId string `protobuf:"bytes,6,opt,name=source_room_id,json=sourceRoomId,proto3" json:"source_room_id,omitempty"` + CreatedAt int64 `protobuf:"varint,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Status Scenario_Status `protobuf:"varint,8,opt,name=status,proto3,enum=livekit.Scenario_Status" json:"status,omitempty"` + Error string `protobuf:"bytes,9,opt,name=error,proto3" json:"error,omitempty"` + GroupId string `protobuf:"bytes,10,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + // Set as participant attributes on the simulation participant's access token. + Metadata map[string]string `protobuf:"bytes,11,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Scenario) Reset() { + *x = Scenario{} + mi := &file_livekit_agent_simulation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Scenario) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Scenario) ProtoMessage() {} + +func (x *Scenario) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Scenario.ProtoReflect.Descriptor instead. +func (*Scenario) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{1} +} + +func (x *Scenario) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Scenario) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *Scenario) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *Scenario) GetInstructions() string { + if x != nil { + return x.Instructions + } + return "" +} + +func (x *Scenario) GetAgentExpectations() string { + if x != nil { + return x.AgentExpectations + } + return "" +} + +func (x *Scenario) GetSourceRoomId() string { + if x != nil { + return x.SourceRoomId + } + return "" +} + +func (x *Scenario) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *Scenario) GetStatus() Scenario_Status { + if x != nil { + return x.Status + } + return Scenario_STATUS_GENERATING +} + +func (x *Scenario) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +func (x *Scenario) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *Scenario) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +type ScenarioGroup struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Scenarios []*Scenario `protobuf:"bytes,5,rep,name=scenarios,proto3" json:"scenarios,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScenarioGroup) Reset() { + *x = ScenarioGroup{} + mi := &file_livekit_agent_simulation_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScenarioGroup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScenarioGroup) ProtoMessage() {} + +func (x *ScenarioGroup) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScenarioGroup.ProtoReflect.Descriptor instead. +func (*ScenarioGroup) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{2} +} + +func (x *ScenarioGroup) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ScenarioGroup) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *ScenarioGroup) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *ScenarioGroup) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ScenarioGroup) GetScenarios() []*Scenario { + if x != nil { + return x.Scenarios + } + return nil +} + +type CreateSimulationRunRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + AgentName string `protobuf:"bytes,2,opt,name=agent_name,json=agentName,proto3" json:"agent_name,omitempty"` + AgentDescription string `protobuf:"bytes,3,opt,name=agent_description,json=agentDescription,proto3" json:"agent_description,omitempty"` + NumSimulations int32 `protobuf:"varint,4,opt,name=num_simulations,json=numSimulations,proto3" json:"num_simulations,omitempty"` + GroupId string `protobuf:"bytes,5,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + Region string `protobuf:"bytes,6,opt,name=region,proto3" json:"region,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSimulationRunRequest) Reset() { + *x = CreateSimulationRunRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSimulationRunRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSimulationRunRequest) ProtoMessage() {} + +func (x *CreateSimulationRunRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSimulationRunRequest.ProtoReflect.Descriptor instead. +func (*CreateSimulationRunRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateSimulationRunRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *CreateSimulationRunRequest) GetAgentName() string { + if x != nil { + return x.AgentName + } + return "" +} + +func (x *CreateSimulationRunRequest) GetAgentDescription() string { + if x != nil { + return x.AgentDescription + } + return "" +} + +func (x *CreateSimulationRunRequest) GetNumSimulations() int32 { + if x != nil { + return x.NumSimulations + } + return 0 +} + +func (x *CreateSimulationRunRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *CreateSimulationRunRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +type CreateSimulationRunResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + SimulationRunId string `protobuf:"bytes,1,opt,name=simulation_run_id,json=simulationRunId,proto3" json:"simulation_run_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSimulationRunResponse) Reset() { + *x = CreateSimulationRunResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSimulationRunResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSimulationRunResponse) ProtoMessage() {} + +func (x *CreateSimulationRunResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSimulationRunResponse.ProtoReflect.Descriptor instead. +func (*CreateSimulationRunResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateSimulationRunResponse) GetSimulationRunId() string { + if x != nil { + return x.SimulationRunId + } + return "" +} + +type GetSimulationRunRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + SimulationRunId string `protobuf:"bytes,2,opt,name=simulation_run_id,json=simulationRunId,proto3" json:"simulation_run_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSimulationRunRequest) Reset() { + *x = GetSimulationRunRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSimulationRunRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSimulationRunRequest) ProtoMessage() {} + +func (x *GetSimulationRunRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSimulationRunRequest.ProtoReflect.Descriptor instead. +func (*GetSimulationRunRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{5} +} + +func (x *GetSimulationRunRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *GetSimulationRunRequest) GetSimulationRunId() string { + if x != nil { + return x.SimulationRunId + } + return "" +} + +type GetSimulationRunResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Run *SimulationRun `protobuf:"bytes,1,opt,name=run,proto3" json:"run,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSimulationRunResponse) Reset() { + *x = GetSimulationRunResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSimulationRunResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSimulationRunResponse) ProtoMessage() {} + +func (x *GetSimulationRunResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSimulationRunResponse.ProtoReflect.Descriptor instead. +func (*GetSimulationRunResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{6} +} + +func (x *GetSimulationRunResponse) GetRun() *SimulationRun { + if x != nil { + return x.Run + } + return nil +} + +type ListSimulationRunsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSimulationRunsRequest) Reset() { + *x = ListSimulationRunsRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSimulationRunsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSimulationRunsRequest) ProtoMessage() {} + +func (x *ListSimulationRunsRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSimulationRunsRequest.ProtoReflect.Descriptor instead. +func (*ListSimulationRunsRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{7} +} + +func (x *ListSimulationRunsRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +type ListSimulationRunsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Runs []*SimulationRun `protobuf:"bytes,1,rep,name=runs,proto3" json:"runs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSimulationRunsResponse) Reset() { + *x = ListSimulationRunsResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSimulationRunsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSimulationRunsResponse) ProtoMessage() {} + +func (x *ListSimulationRunsResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSimulationRunsResponse.ProtoReflect.Descriptor instead. +func (*ListSimulationRunsResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{8} +} + +func (x *ListSimulationRunsResponse) GetRuns() []*SimulationRun { + if x != nil { + return x.Runs + } + return nil +} + +type CreateScenarioRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` + Instructions string `protobuf:"bytes,3,opt,name=instructions,proto3" json:"instructions,omitempty"` + AgentExpectations string `protobuf:"bytes,4,opt,name=agent_expectations,json=agentExpectations,proto3" json:"agent_expectations,omitempty"` + GroupId string `protobuf:"bytes,5,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + Metadata map[string]string `protobuf:"bytes,6,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioRequest) Reset() { + *x = CreateScenarioRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioRequest) ProtoMessage() {} + +func (x *CreateScenarioRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateScenarioRequest.ProtoReflect.Descriptor instead. +func (*CreateScenarioRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{9} +} + +func (x *CreateScenarioRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *CreateScenarioRequest) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *CreateScenarioRequest) GetInstructions() string { + if x != nil { + return x.Instructions + } + return "" +} + +func (x *CreateScenarioRequest) GetAgentExpectations() string { + if x != nil { + return x.AgentExpectations + } + return "" +} + +func (x *CreateScenarioRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *CreateScenarioRequest) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +type CreateScenarioResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Scenario *Scenario `protobuf:"bytes,1,opt,name=scenario,proto3" json:"scenario,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioResponse) Reset() { + *x = CreateScenarioResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioResponse) ProtoMessage() {} + +func (x *CreateScenarioResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateScenarioResponse.ProtoReflect.Descriptor instead. +func (*CreateScenarioResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{10} +} + +func (x *CreateScenarioResponse) GetScenario() *Scenario { + if x != nil { + return x.Scenario + } + return nil +} + +type CreateScenarioFromSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + RoomId string `protobuf:"bytes,2,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` + GroupId string `protobuf:"bytes,3,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` + Region string `protobuf:"bytes,5,opt,name=region,proto3" json:"region,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioFromSessionRequest) Reset() { + *x = CreateScenarioFromSessionRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioFromSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioFromSessionRequest) ProtoMessage() {} + +func (x *CreateScenarioFromSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateScenarioFromSessionRequest.ProtoReflect.Descriptor instead. +func (*CreateScenarioFromSessionRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{11} +} + +func (x *CreateScenarioFromSessionRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *CreateScenarioFromSessionRequest) GetRoomId() string { + if x != nil { + return x.RoomId + } + return "" +} + +func (x *CreateScenarioFromSessionRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *CreateScenarioFromSessionRequest) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *CreateScenarioFromSessionRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +type CreateScenarioFromSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Scenario *Scenario `protobuf:"bytes,1,opt,name=scenario,proto3" json:"scenario,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioFromSessionResponse) Reset() { + *x = CreateScenarioFromSessionResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioFromSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioFromSessionResponse) ProtoMessage() {} + +func (x *CreateScenarioFromSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateScenarioFromSessionResponse.ProtoReflect.Descriptor instead. +func (*CreateScenarioFromSessionResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{12} +} + +func (x *CreateScenarioFromSessionResponse) GetScenario() *Scenario { + if x != nil { + return x.Scenario + } + return nil +} + +type DeleteScenarioRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ScenarioId string `protobuf:"bytes,2,opt,name=scenario_id,json=scenarioId,proto3" json:"scenario_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioRequest) Reset() { + *x = DeleteScenarioRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioRequest) ProtoMessage() {} + +func (x *DeleteScenarioRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteScenarioRequest.ProtoReflect.Descriptor instead. +func (*DeleteScenarioRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{13} +} + +func (x *DeleteScenarioRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *DeleteScenarioRequest) GetScenarioId() string { + if x != nil { + return x.ScenarioId + } + return "" +} + +type DeleteScenarioResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioResponse) Reset() { + *x = DeleteScenarioResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioResponse) ProtoMessage() {} + +func (x *DeleteScenarioResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteScenarioResponse.ProtoReflect.Descriptor instead. +func (*DeleteScenarioResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{14} +} + +type UpdateScenarioRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ScenarioId string `protobuf:"bytes,2,opt,name=scenario_id,json=scenarioId,proto3" json:"scenario_id,omitempty"` + Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + Instructions string `protobuf:"bytes,4,opt,name=instructions,proto3" json:"instructions,omitempty"` + AgentExpectations string `protobuf:"bytes,5,opt,name=agent_expectations,json=agentExpectations,proto3" json:"agent_expectations,omitempty"` + GroupId string `protobuf:"bytes,6,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateScenarioRequest) Reset() { + *x = UpdateScenarioRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateScenarioRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateScenarioRequest) ProtoMessage() {} + +func (x *UpdateScenarioRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateScenarioRequest.ProtoReflect.Descriptor instead. +func (*UpdateScenarioRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{15} +} + +func (x *UpdateScenarioRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *UpdateScenarioRequest) GetScenarioId() string { + if x != nil { + return x.ScenarioId + } + return "" +} + +func (x *UpdateScenarioRequest) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *UpdateScenarioRequest) GetInstructions() string { + if x != nil { + return x.Instructions + } + return "" +} + +func (x *UpdateScenarioRequest) GetAgentExpectations() string { + if x != nil { + return x.AgentExpectations + } + return "" +} + +func (x *UpdateScenarioRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *UpdateScenarioRequest) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +type UpdateScenarioResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Scenario *Scenario `protobuf:"bytes,1,opt,name=scenario,proto3" json:"scenario,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateScenarioResponse) Reset() { + *x = UpdateScenarioResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateScenarioResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateScenarioResponse) ProtoMessage() {} + +func (x *UpdateScenarioResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateScenarioResponse.ProtoReflect.Descriptor instead. +func (*UpdateScenarioResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{16} +} + +func (x *UpdateScenarioResponse) GetScenario() *Scenario { + if x != nil { + return x.Scenario + } + return nil +} + +type CreateScenarioGroupRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioGroupRequest) Reset() { + *x = CreateScenarioGroupRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioGroupRequest) ProtoMessage() {} + +func (x *CreateScenarioGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateScenarioGroupRequest.ProtoReflect.Descriptor instead. +func (*CreateScenarioGroupRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{17} +} + +func (x *CreateScenarioGroupRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *CreateScenarioGroupRequest) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +type CreateScenarioGroupResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScenarioGroup *ScenarioGroup `protobuf:"bytes,1,opt,name=scenario_group,json=scenarioGroup,proto3" json:"scenario_group,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioGroupResponse) Reset() { + *x = CreateScenarioGroupResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioGroupResponse) ProtoMessage() {} + +func (x *CreateScenarioGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateScenarioGroupResponse.ProtoReflect.Descriptor instead. +func (*CreateScenarioGroupResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{18} +} + +func (x *CreateScenarioGroupResponse) GetScenarioGroup() *ScenarioGroup { + if x != nil { + return x.ScenarioGroup + } + return nil +} + +type DeleteScenarioGroupRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + GroupId string `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioGroupRequest) Reset() { + *x = DeleteScenarioGroupRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioGroupRequest) ProtoMessage() {} + +func (x *DeleteScenarioGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteScenarioGroupRequest.ProtoReflect.Descriptor instead. +func (*DeleteScenarioGroupRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{19} +} + +func (x *DeleteScenarioGroupRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *DeleteScenarioGroupRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +type DeleteScenarioGroupResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioGroupResponse) Reset() { + *x = DeleteScenarioGroupResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioGroupResponse) ProtoMessage() {} + +func (x *DeleteScenarioGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteScenarioGroupResponse.ProtoReflect.Descriptor instead. +func (*DeleteScenarioGroupResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{20} +} + +type ListScenarioGroupsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenarioGroupsRequest) Reset() { + *x = ListScenarioGroupsRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenarioGroupsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenarioGroupsRequest) ProtoMessage() {} + +func (x *ListScenarioGroupsRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListScenarioGroupsRequest.ProtoReflect.Descriptor instead. +func (*ListScenarioGroupsRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{21} +} + +func (x *ListScenarioGroupsRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +type ListScenarioGroupsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScenarioGroups []*ScenarioGroup `protobuf:"bytes,1,rep,name=scenario_groups,json=scenarioGroups,proto3" json:"scenario_groups,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenarioGroupsResponse) Reset() { + *x = ListScenarioGroupsResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenarioGroupsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenarioGroupsResponse) ProtoMessage() {} + +func (x *ListScenarioGroupsResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListScenarioGroupsResponse.ProtoReflect.Descriptor instead. +func (*ListScenarioGroupsResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{22} +} + +func (x *ListScenarioGroupsResponse) GetScenarioGroups() []*ScenarioGroup { + if x != nil { + return x.ScenarioGroups + } + return nil +} + +type ListScenariosRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + GroupId string `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenariosRequest) Reset() { + *x = ListScenariosRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenariosRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenariosRequest) ProtoMessage() {} + +func (x *ListScenariosRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListScenariosRequest.ProtoReflect.Descriptor instead. +func (*ListScenariosRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{23} +} + +func (x *ListScenariosRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *ListScenariosRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +type ListScenariosResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Scenarios []*Scenario `protobuf:"bytes,1,rep,name=scenarios,proto3" json:"scenarios,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenariosResponse) Reset() { + *x = ListScenariosResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenariosResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenariosResponse) ProtoMessage() {} + +func (x *ListScenariosResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListScenariosResponse.ProtoReflect.Descriptor instead. +func (*ListScenariosResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{24} +} + +func (x *ListScenariosResponse) GetScenarios() []*Scenario { + if x != nil { + return x.Scenarios + } + return nil +} + +type SimulationRun_Job struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Status SimulationRun_Job_Status `protobuf:"varint,2,opt,name=status,proto3,enum=livekit.SimulationRun_Job_Status" json:"status,omitempty"` + Instructions string `protobuf:"bytes,3,opt,name=instructions,proto3" json:"instructions,omitempty"` + Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SimulationRun_Job) Reset() { + *x = SimulationRun_Job{} + mi := &file_livekit_agent_simulation_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SimulationRun_Job) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimulationRun_Job) ProtoMessage() {} + +func (x *SimulationRun_Job) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SimulationRun_Job.ProtoReflect.Descriptor instead. +func (*SimulationRun_Job) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *SimulationRun_Job) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SimulationRun_Job) GetStatus() SimulationRun_Job_Status { + if x != nil { + return x.Status + } + return SimulationRun_Job_STATUS_PENDING +} + +func (x *SimulationRun_Job) GetInstructions() string { + if x != nil { + return x.Instructions + } + return "" +} + +func (x *SimulationRun_Job) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +var File_livekit_agent_simulation_proto protoreflect.FileDescriptor + +const file_livekit_agent_simulation_proto_rawDesc = "" + + "\n" + + "\x1elivekit_agent_simulation.proto\x12\alivekit\"\xe3\x04\n" + + "\rSimulationRun\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + + "\n" + + "project_id\x18\x02 \x01(\tR\tprojectId\x125\n" + + "\x06status\x18\x03 \x01(\x0e2\x1d.livekit.SimulationRun.StatusR\x06status\x12+\n" + + "\x11agent_description\x18\x04 \x01(\tR\x10agentDescription\x12\x14\n" + + "\x05error\x18\x05 \x01(\tR\x05error\x12\x1d\n" + + "\n" + + "created_at\x18\x06 \x01(\x03R\tcreatedAt\x12.\n" + + "\x04jobs\x18\a \x03(\v2\x1a.livekit.SimulationRun.JobR\x04jobs\x1a\xfb\x01\n" + + "\x03Job\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x129\n" + + "\x06status\x18\x02 \x01(\x0e2!.livekit.SimulationRun.Job.StatusR\x06status\x12\"\n" + + "\finstructions\x18\x03 \x01(\tR\finstructions\x12\x14\n" + + "\x05error\x18\x04 \x01(\tR\x05error\"o\n" + + "\x06Status\x12\x12\n" + + "\x0eSTATUS_PENDING\x10\x00\x12\x12\n" + + "\x0eSTATUS_RUNNING\x10\x01\x12\x14\n" + + "\x10STATUS_COMPLETED\x10\x02\x12\x11\n" + + "\rSTATUS_FAILED\x10\x03\x12\x14\n" + + "\x10STATUS_CANCELLED\x10\x04\"\\\n" + + "\x06Status\x12\x15\n" + + "\x11STATUS_GENERATING\x10\x00\x12\x12\n" + + "\x0eSTATUS_RUNNING\x10\x01\x12\x14\n" + + "\x10STATUS_COMPLETED\x10\x02\x12\x11\n" + + "\rSTATUS_FAILED\x10\x03\"\x8a\x04\n" + + "\bScenario\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + + "\n" + + "project_id\x18\x02 \x01(\tR\tprojectId\x12\x14\n" + + "\x05label\x18\x03 \x01(\tR\x05label\x12\"\n" + + "\finstructions\x18\x04 \x01(\tR\finstructions\x12-\n" + + "\x12agent_expectations\x18\x05 \x01(\tR\x11agentExpectations\x12$\n" + + "\x0esource_room_id\x18\x06 \x01(\tR\fsourceRoomId\x12\x1d\n" + + "\n" + + "created_at\x18\a \x01(\x03R\tcreatedAt\x120\n" + + "\x06status\x18\b \x01(\x0e2\x18.livekit.Scenario.StatusR\x06status\x12\x14\n" + + "\x05error\x18\t \x01(\tR\x05error\x12\x19\n" + + "\bgroup_id\x18\n" + + " \x01(\tR\agroupId\x12;\n" + + "\bmetadata\x18\v \x03(\v2\x1f.livekit.Scenario.MetadataEntryR\bmetadata\x1a;\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"D\n" + + "\x06Status\x12\x15\n" + + "\x11STATUS_GENERATING\x10\x00\x12\x10\n" + + "\fSTATUS_READY\x10\x01\x12\x11\n" + + "\rSTATUS_FAILED\x10\x02\"\xa4\x01\n" + + "\rScenarioGroup\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + + "\n" + + "project_id\x18\x02 \x01(\tR\tprojectId\x12\x14\n" + + "\x05label\x18\x03 \x01(\tR\x05label\x12\x1d\n" + + "\n" + + "created_at\x18\x04 \x01(\x03R\tcreatedAt\x12/\n" + + "\tscenarios\x18\x05 \x03(\v2\x11.livekit.ScenarioR\tscenarios\"\xe3\x01\n" + + "\x1aCreateSimulationRunRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x1d\n" + + "\n" + + "agent_name\x18\x02 \x01(\tR\tagentName\x12+\n" + + "\x11agent_description\x18\x03 \x01(\tR\x10agentDescription\x12'\n" + + "\x0fnum_simulations\x18\x04 \x01(\x05R\x0enumSimulations\x12\x19\n" + + "\bgroup_id\x18\x05 \x01(\tR\agroupId\x12\x16\n" + + "\x06region\x18\x06 \x01(\tR\x06region\"I\n" + + "\x1bCreateSimulationRunResponse\x12*\n" + + "\x11simulation_run_id\x18\x01 \x01(\tR\x0fsimulationRunId\"d\n" + + "\x17GetSimulationRunRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12*\n" + + "\x11simulation_run_id\x18\x02 \x01(\tR\x0fsimulationRunId\"D\n" + + "\x18GetSimulationRunResponse\x12(\n" + + "\x03run\x18\x01 \x01(\v2\x16.livekit.SimulationRunR\x03run\":\n" + + "\x19ListSimulationRunsRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\"H\n" + + "\x1aListSimulationRunsResponse\x12*\n" + + "\x04runs\x18\x01 \x03(\v2\x16.livekit.SimulationRunR\x04runs\"\xc1\x02\n" + + "\x15CreateScenarioRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x14\n" + + "\x05label\x18\x02 \x01(\tR\x05label\x12\"\n" + + "\finstructions\x18\x03 \x01(\tR\finstructions\x12-\n" + + "\x12agent_expectations\x18\x04 \x01(\tR\x11agentExpectations\x12\x19\n" + + "\bgroup_id\x18\x05 \x01(\tR\agroupId\x12H\n" + + "\bmetadata\x18\x06 \x03(\v2,.livekit.CreateScenarioRequest.MetadataEntryR\bmetadata\x1a;\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"G\n" + + "\x16CreateScenarioResponse\x12-\n" + + "\bscenario\x18\x01 \x01(\v2\x11.livekit.ScenarioR\bscenario\"\xa3\x01\n" + + " CreateScenarioFromSessionRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x17\n" + + "\aroom_id\x18\x02 \x01(\tR\x06roomId\x12\x19\n" + + "\bgroup_id\x18\x03 \x01(\tR\agroupId\x12\x14\n" + + "\x05label\x18\x04 \x01(\tR\x05label\x12\x16\n" + + "\x06region\x18\x05 \x01(\tR\x06region\"R\n" + + "!CreateScenarioFromSessionResponse\x12-\n" + + "\bscenario\x18\x01 \x01(\v2\x11.livekit.ScenarioR\bscenario\"W\n" + + "\x15DeleteScenarioRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x1f\n" + + "\vscenario_id\x18\x02 \x01(\tR\n" + + "scenarioId\"\x18\n" + + "\x16DeleteScenarioResponse\"\xe2\x02\n" + + "\x15UpdateScenarioRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x1f\n" + + "\vscenario_id\x18\x02 \x01(\tR\n" + + "scenarioId\x12\x14\n" + + "\x05label\x18\x03 \x01(\tR\x05label\x12\"\n" + + "\finstructions\x18\x04 \x01(\tR\finstructions\x12-\n" + + "\x12agent_expectations\x18\x05 \x01(\tR\x11agentExpectations\x12\x19\n" + + "\bgroup_id\x18\x06 \x01(\tR\agroupId\x12H\n" + + "\bmetadata\x18\a \x03(\v2,.livekit.UpdateScenarioRequest.MetadataEntryR\bmetadata\x1a;\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"G\n" + + "\x16UpdateScenarioResponse\x12-\n" + + "\bscenario\x18\x01 \x01(\v2\x11.livekit.ScenarioR\bscenario\"Q\n" + + "\x1aCreateScenarioGroupRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x14\n" + + "\x05label\x18\x02 \x01(\tR\x05label\"\\\n" + + "\x1bCreateScenarioGroupResponse\x12=\n" + + "\x0escenario_group\x18\x01 \x01(\v2\x16.livekit.ScenarioGroupR\rscenarioGroup\"V\n" + + "\x1aDeleteScenarioGroupRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x19\n" + + "\bgroup_id\x18\x02 \x01(\tR\agroupId\"\x1d\n" + + "\x1bDeleteScenarioGroupResponse\":\n" + + "\x19ListScenarioGroupsRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\"]\n" + + "\x1aListScenarioGroupsResponse\x12?\n" + + "\x0fscenario_groups\x18\x01 \x03(\v2\x16.livekit.ScenarioGroupR\x0escenarioGroups\"P\n" + + "\x14ListScenariosRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x19\n" + + "\bgroup_id\x18\x02 \x01(\tR\agroupId\"H\n" + + "\x15ListScenariosResponse\x12/\n" + + "\tscenarios\x18\x01 \x03(\v2\x11.livekit.ScenarioR\tscenarios2\x8b\b\n" + + "\x0fAgentSimulation\x12`\n" + + "\x13CreateSimulationRun\x12#.livekit.CreateSimulationRunRequest\x1a$.livekit.CreateSimulationRunResponse\x12W\n" + + "\x10GetSimulationRun\x12 .livekit.GetSimulationRunRequest\x1a!.livekit.GetSimulationRunResponse\x12]\n" + + "\x12ListSimulationRuns\x12\".livekit.ListSimulationRunsRequest\x1a#.livekit.ListSimulationRunsResponse\x12Q\n" + + "\x0eCreateScenario\x12\x1e.livekit.CreateScenarioRequest\x1a\x1f.livekit.CreateScenarioResponse\x12r\n" + + "\x19CreateScenarioFromSession\x12).livekit.CreateScenarioFromSessionRequest\x1a*.livekit.CreateScenarioFromSessionResponse\x12Q\n" + + "\x0eDeleteScenario\x12\x1e.livekit.DeleteScenarioRequest\x1a\x1f.livekit.DeleteScenarioResponse\x12Q\n" + + "\x0eUpdateScenario\x12\x1e.livekit.UpdateScenarioRequest\x1a\x1f.livekit.UpdateScenarioResponse\x12`\n" + + "\x13CreateScenarioGroup\x12#.livekit.CreateScenarioGroupRequest\x1a$.livekit.CreateScenarioGroupResponse\x12`\n" + + "\x13DeleteScenarioGroup\x12#.livekit.DeleteScenarioGroupRequest\x1a$.livekit.DeleteScenarioGroupResponse\x12]\n" + + "\x12ListScenarioGroups\x12\".livekit.ListScenarioGroupsRequest\x1a#.livekit.ListScenarioGroupsResponse\x12N\n" + + "\rListScenarios\x12\x1d.livekit.ListScenariosRequest\x1a\x1e.livekit.ListScenariosResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" + +var ( + file_livekit_agent_simulation_proto_rawDescOnce sync.Once + file_livekit_agent_simulation_proto_rawDescData []byte +) + +func file_livekit_agent_simulation_proto_rawDescGZIP() []byte { + file_livekit_agent_simulation_proto_rawDescOnce.Do(func() { + file_livekit_agent_simulation_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_livekit_agent_simulation_proto_rawDesc), len(file_livekit_agent_simulation_proto_rawDesc))) + }) + return file_livekit_agent_simulation_proto_rawDescData +} + +var file_livekit_agent_simulation_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_livekit_agent_simulation_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_livekit_agent_simulation_proto_goTypes = []any{ + (SimulationRun_Status)(0), // 0: livekit.SimulationRun.Status + (SimulationRun_Job_Status)(0), // 1: livekit.SimulationRun.Job.Status + (Scenario_Status)(0), // 2: livekit.Scenario.Status + (*SimulationRun)(nil), // 3: livekit.SimulationRun + (*Scenario)(nil), // 4: livekit.Scenario + (*ScenarioGroup)(nil), // 5: livekit.ScenarioGroup + (*CreateSimulationRunRequest)(nil), // 6: livekit.CreateSimulationRunRequest + (*CreateSimulationRunResponse)(nil), // 7: livekit.CreateSimulationRunResponse + (*GetSimulationRunRequest)(nil), // 8: livekit.GetSimulationRunRequest + (*GetSimulationRunResponse)(nil), // 9: livekit.GetSimulationRunResponse + (*ListSimulationRunsRequest)(nil), // 10: livekit.ListSimulationRunsRequest + (*ListSimulationRunsResponse)(nil), // 11: livekit.ListSimulationRunsResponse + (*CreateScenarioRequest)(nil), // 12: livekit.CreateScenarioRequest + (*CreateScenarioResponse)(nil), // 13: livekit.CreateScenarioResponse + (*CreateScenarioFromSessionRequest)(nil), // 14: livekit.CreateScenarioFromSessionRequest + (*CreateScenarioFromSessionResponse)(nil), // 15: livekit.CreateScenarioFromSessionResponse + (*DeleteScenarioRequest)(nil), // 16: livekit.DeleteScenarioRequest + (*DeleteScenarioResponse)(nil), // 17: livekit.DeleteScenarioResponse + (*UpdateScenarioRequest)(nil), // 18: livekit.UpdateScenarioRequest + (*UpdateScenarioResponse)(nil), // 19: livekit.UpdateScenarioResponse + (*CreateScenarioGroupRequest)(nil), // 20: livekit.CreateScenarioGroupRequest + (*CreateScenarioGroupResponse)(nil), // 21: livekit.CreateScenarioGroupResponse + (*DeleteScenarioGroupRequest)(nil), // 22: livekit.DeleteScenarioGroupRequest + (*DeleteScenarioGroupResponse)(nil), // 23: livekit.DeleteScenarioGroupResponse + (*ListScenarioGroupsRequest)(nil), // 24: livekit.ListScenarioGroupsRequest + (*ListScenarioGroupsResponse)(nil), // 25: livekit.ListScenarioGroupsResponse + (*ListScenariosRequest)(nil), // 26: livekit.ListScenariosRequest + (*ListScenariosResponse)(nil), // 27: livekit.ListScenariosResponse + (*SimulationRun_Job)(nil), // 28: livekit.SimulationRun.Job + nil, // 29: livekit.Scenario.MetadataEntry + nil, // 30: livekit.CreateScenarioRequest.MetadataEntry + nil, // 31: livekit.UpdateScenarioRequest.MetadataEntry +} +var file_livekit_agent_simulation_proto_depIdxs = []int32{ + 0, // 0: livekit.SimulationRun.status:type_name -> livekit.SimulationRun.Status + 28, // 1: livekit.SimulationRun.jobs:type_name -> livekit.SimulationRun.Job + 2, // 2: livekit.Scenario.status:type_name -> livekit.Scenario.Status + 29, // 3: livekit.Scenario.metadata:type_name -> livekit.Scenario.MetadataEntry + 4, // 4: livekit.ScenarioGroup.scenarios:type_name -> livekit.Scenario + 3, // 5: livekit.GetSimulationRunResponse.run:type_name -> livekit.SimulationRun + 3, // 6: livekit.ListSimulationRunsResponse.runs:type_name -> livekit.SimulationRun + 30, // 7: livekit.CreateScenarioRequest.metadata:type_name -> livekit.CreateScenarioRequest.MetadataEntry + 4, // 8: livekit.CreateScenarioResponse.scenario:type_name -> livekit.Scenario + 4, // 9: livekit.CreateScenarioFromSessionResponse.scenario:type_name -> livekit.Scenario + 31, // 10: livekit.UpdateScenarioRequest.metadata:type_name -> livekit.UpdateScenarioRequest.MetadataEntry + 4, // 11: livekit.UpdateScenarioResponse.scenario:type_name -> livekit.Scenario + 5, // 12: livekit.CreateScenarioGroupResponse.scenario_group:type_name -> livekit.ScenarioGroup + 5, // 13: livekit.ListScenarioGroupsResponse.scenario_groups:type_name -> livekit.ScenarioGroup + 4, // 14: livekit.ListScenariosResponse.scenarios:type_name -> livekit.Scenario + 1, // 15: livekit.SimulationRun.Job.status:type_name -> livekit.SimulationRun.Job.Status + 6, // 16: livekit.AgentSimulation.CreateSimulationRun:input_type -> livekit.CreateSimulationRunRequest + 8, // 17: livekit.AgentSimulation.GetSimulationRun:input_type -> livekit.GetSimulationRunRequest + 10, // 18: livekit.AgentSimulation.ListSimulationRuns:input_type -> livekit.ListSimulationRunsRequest + 12, // 19: livekit.AgentSimulation.CreateScenario:input_type -> livekit.CreateScenarioRequest + 14, // 20: livekit.AgentSimulation.CreateScenarioFromSession:input_type -> livekit.CreateScenarioFromSessionRequest + 16, // 21: livekit.AgentSimulation.DeleteScenario:input_type -> livekit.DeleteScenarioRequest + 18, // 22: livekit.AgentSimulation.UpdateScenario:input_type -> livekit.UpdateScenarioRequest + 20, // 23: livekit.AgentSimulation.CreateScenarioGroup:input_type -> livekit.CreateScenarioGroupRequest + 22, // 24: livekit.AgentSimulation.DeleteScenarioGroup:input_type -> livekit.DeleteScenarioGroupRequest + 24, // 25: livekit.AgentSimulation.ListScenarioGroups:input_type -> livekit.ListScenarioGroupsRequest + 26, // 26: livekit.AgentSimulation.ListScenarios:input_type -> livekit.ListScenariosRequest + 7, // 27: livekit.AgentSimulation.CreateSimulationRun:output_type -> livekit.CreateSimulationRunResponse + 9, // 28: livekit.AgentSimulation.GetSimulationRun:output_type -> livekit.GetSimulationRunResponse + 11, // 29: livekit.AgentSimulation.ListSimulationRuns:output_type -> livekit.ListSimulationRunsResponse + 13, // 30: livekit.AgentSimulation.CreateScenario:output_type -> livekit.CreateScenarioResponse + 15, // 31: livekit.AgentSimulation.CreateScenarioFromSession:output_type -> livekit.CreateScenarioFromSessionResponse + 17, // 32: livekit.AgentSimulation.DeleteScenario:output_type -> livekit.DeleteScenarioResponse + 19, // 33: livekit.AgentSimulation.UpdateScenario:output_type -> livekit.UpdateScenarioResponse + 21, // 34: livekit.AgentSimulation.CreateScenarioGroup:output_type -> livekit.CreateScenarioGroupResponse + 23, // 35: livekit.AgentSimulation.DeleteScenarioGroup:output_type -> livekit.DeleteScenarioGroupResponse + 25, // 36: livekit.AgentSimulation.ListScenarioGroups:output_type -> livekit.ListScenarioGroupsResponse + 27, // 37: livekit.AgentSimulation.ListScenarios:output_type -> livekit.ListScenariosResponse + 27, // [27:38] is the sub-list for method output_type + 16, // [16:27] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name +} + +func init() { file_livekit_agent_simulation_proto_init() } +func file_livekit_agent_simulation_proto_init() { + if File_livekit_agent_simulation_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_livekit_agent_simulation_proto_rawDesc), len(file_livekit_agent_simulation_proto_rawDesc)), + NumEnums: 3, + NumMessages: 29, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_livekit_agent_simulation_proto_goTypes, + DependencyIndexes: file_livekit_agent_simulation_proto_depIdxs, + EnumInfos: file_livekit_agent_simulation_proto_enumTypes, + MessageInfos: file_livekit_agent_simulation_proto_msgTypes, + }.Build() + File_livekit_agent_simulation_proto = out.File + file_livekit_agent_simulation_proto_goTypes = nil + file_livekit_agent_simulation_proto_depIdxs = nil +} diff --git a/livekit/livekit_agent_simulation.twirp.go b/livekit/livekit_agent_simulation.twirp.go new file mode 100644 index 000000000..cea1cce83 --- /dev/null +++ b/livekit/livekit_agent_simulation.twirp.go @@ -0,0 +1,3391 @@ +// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. +// source: livekit_agent_simulation.proto + +package livekit + +import context "context" +import fmt "fmt" +import http "net/http" +import io "io" +import json "encoding/json" +import strconv "strconv" +import strings "strings" + +import protojson "google.golang.org/protobuf/encoding/protojson" +import proto "google.golang.org/protobuf/proto" +import twirp "github.com/twitchtv/twirp" +import ctxsetters "github.com/twitchtv/twirp/ctxsetters" + +// Version compatibility assertion. +// If the constant is not defined in the package, that likely means +// the package needs to be updated to work with this generated code. +// See https://twitchtv.github.io/twirp/docs/version_matrix.html +const _ = twirp.TwirpPackageMinVersion_8_1_0 + +// ========================= +// AgentSimulation Interface +// ========================= + +type AgentSimulation interface { + CreateSimulationRun(context.Context, *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) + + GetSimulationRun(context.Context, *GetSimulationRunRequest) (*GetSimulationRunResponse, error) + + ListSimulationRuns(context.Context, *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) + + CreateScenario(context.Context, *CreateScenarioRequest) (*CreateScenarioResponse, error) + + CreateScenarioFromSession(context.Context, *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) + + DeleteScenario(context.Context, *DeleteScenarioRequest) (*DeleteScenarioResponse, error) + + UpdateScenario(context.Context, *UpdateScenarioRequest) (*UpdateScenarioResponse, error) + + CreateScenarioGroup(context.Context, *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) + + DeleteScenarioGroup(context.Context, *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) + + ListScenarioGroups(context.Context, *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) + + ListScenarios(context.Context, *ListScenariosRequest) (*ListScenariosResponse, error) +} + +// =============================== +// AgentSimulation Protobuf Client +// =============================== + +type agentSimulationProtobufClient struct { + client HTTPClient + urls [11]string + interceptor twirp.Interceptor + opts twirp.ClientOptions +} + +// NewAgentSimulationProtobufClient creates a Protobuf client that implements the AgentSimulation interface. +// It communicates using Protobuf and can be configured with a custom HTTPClient. +func NewAgentSimulationProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulation { + if c, ok := client.(*http.Client); ok { + client = withoutRedirects(c) + } + + clientOpts := twirp.ClientOptions{} + for _, o := range opts { + o(&clientOpts) + } + + // Using ReadOpt allows backwards and forwards compatibility with new options in the future + literalURLs := false + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) + var pathPrefix string + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + + // Build method URLs: []/./ + serviceURL := sanitizeBaseURL(baseURL) + serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulation") + urls := [11]string{ + serviceURL + "CreateSimulationRun", + serviceURL + "GetSimulationRun", + serviceURL + "ListSimulationRuns", + serviceURL + "CreateScenario", + serviceURL + "CreateScenarioFromSession", + serviceURL + "DeleteScenario", + serviceURL + "UpdateScenario", + serviceURL + "CreateScenarioGroup", + serviceURL + "DeleteScenarioGroup", + serviceURL + "ListScenarioGroups", + serviceURL + "ListScenarios", + } + + return &agentSimulationProtobufClient{ + client: client, + urls: urls, + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), + opts: clientOpts, + } +} + +func (c *agentSimulationProtobufClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + caller := c.callCreateSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return c.callCreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + out := new(CreateSimulationRunResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) GetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + caller := c.callGetSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return c.callGetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callGetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + out := new(GetSimulationRunResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) ListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + caller := c.callListSimulationRuns + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return c.callListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + out := new(ListSimulationRunsResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) CreateScenario(ctx context.Context, in *CreateScenarioRequest) (*CreateScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenario") + caller := c.callCreateScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioRequest) (*CreateScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioRequest) when calling interceptor") + } + return c.callCreateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callCreateScenario(ctx context.Context, in *CreateScenarioRequest) (*CreateScenarioResponse, error) { + out := new(CreateScenarioResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) CreateScenarioFromSession(ctx context.Context, in *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioFromSession") + caller := c.callCreateScenarioFromSession + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioFromSessionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioFromSessionRequest) when calling interceptor") + } + return c.callCreateScenarioFromSession(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioFromSessionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioFromSessionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callCreateScenarioFromSession(ctx context.Context, in *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + out := new(CreateScenarioFromSessionResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) DeleteScenario(ctx context.Context, in *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenario") + caller := c.callDeleteScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioRequest) when calling interceptor") + } + return c.callDeleteScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callDeleteScenario(ctx context.Context, in *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + out := new(DeleteScenarioResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[5], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) UpdateScenario(ctx context.Context, in *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "UpdateScenario") + caller := c.callUpdateScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*UpdateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*UpdateScenarioRequest) when calling interceptor") + } + return c.callUpdateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*UpdateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*UpdateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callUpdateScenario(ctx context.Context, in *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + out := new(UpdateScenarioResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[6], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) CreateScenarioGroup(ctx context.Context, in *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioGroup") + caller := c.callCreateScenarioGroup + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioGroupRequest) when calling interceptor") + } + return c.callCreateScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callCreateScenarioGroup(ctx context.Context, in *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + out := new(CreateScenarioGroupResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[7], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) DeleteScenarioGroup(ctx context.Context, in *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioGroup") + caller := c.callDeleteScenarioGroup + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioGroupRequest) when calling interceptor") + } + return c.callDeleteScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callDeleteScenarioGroup(ctx context.Context, in *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + out := new(DeleteScenarioGroupResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[8], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) ListScenarioGroups(ctx context.Context, in *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioGroups") + caller := c.callListScenarioGroups + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenarioGroupsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioGroupsRequest) when calling interceptor") + } + return c.callListScenarioGroups(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenarioGroupsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioGroupsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callListScenarioGroups(ctx context.Context, in *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + out := new(ListScenarioGroupsResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[9], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) ListScenarios(ctx context.Context, in *ListScenariosRequest) (*ListScenariosResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarios") + caller := c.callListScenarios + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListScenariosRequest) (*ListScenariosResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenariosRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenariosRequest) when calling interceptor") + } + return c.callListScenarios(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenariosResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenariosResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callListScenarios(ctx context.Context, in *ListScenariosRequest) (*ListScenariosResponse, error) { + out := new(ListScenariosResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[10], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +// =========================== +// AgentSimulation JSON Client +// =========================== + +type agentSimulationJSONClient struct { + client HTTPClient + urls [11]string + interceptor twirp.Interceptor + opts twirp.ClientOptions +} + +// NewAgentSimulationJSONClient creates a JSON client that implements the AgentSimulation interface. +// It communicates using JSON and can be configured with a custom HTTPClient. +func NewAgentSimulationJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulation { + if c, ok := client.(*http.Client); ok { + client = withoutRedirects(c) + } + + clientOpts := twirp.ClientOptions{} + for _, o := range opts { + o(&clientOpts) + } + + // Using ReadOpt allows backwards and forwards compatibility with new options in the future + literalURLs := false + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) + var pathPrefix string + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + + // Build method URLs: []/./ + serviceURL := sanitizeBaseURL(baseURL) + serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulation") + urls := [11]string{ + serviceURL + "CreateSimulationRun", + serviceURL + "GetSimulationRun", + serviceURL + "ListSimulationRuns", + serviceURL + "CreateScenario", + serviceURL + "CreateScenarioFromSession", + serviceURL + "DeleteScenario", + serviceURL + "UpdateScenario", + serviceURL + "CreateScenarioGroup", + serviceURL + "DeleteScenarioGroup", + serviceURL + "ListScenarioGroups", + serviceURL + "ListScenarios", + } + + return &agentSimulationJSONClient{ + client: client, + urls: urls, + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), + opts: clientOpts, + } +} + +func (c *agentSimulationJSONClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + caller := c.callCreateSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return c.callCreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + out := new(CreateSimulationRunResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) GetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + caller := c.callGetSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return c.callGetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callGetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + out := new(GetSimulationRunResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) ListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + caller := c.callListSimulationRuns + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return c.callListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + out := new(ListSimulationRunsResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) CreateScenario(ctx context.Context, in *CreateScenarioRequest) (*CreateScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenario") + caller := c.callCreateScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioRequest) (*CreateScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioRequest) when calling interceptor") + } + return c.callCreateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callCreateScenario(ctx context.Context, in *CreateScenarioRequest) (*CreateScenarioResponse, error) { + out := new(CreateScenarioResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) CreateScenarioFromSession(ctx context.Context, in *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioFromSession") + caller := c.callCreateScenarioFromSession + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioFromSessionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioFromSessionRequest) when calling interceptor") + } + return c.callCreateScenarioFromSession(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioFromSessionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioFromSessionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callCreateScenarioFromSession(ctx context.Context, in *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + out := new(CreateScenarioFromSessionResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) DeleteScenario(ctx context.Context, in *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenario") + caller := c.callDeleteScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioRequest) when calling interceptor") + } + return c.callDeleteScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callDeleteScenario(ctx context.Context, in *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + out := new(DeleteScenarioResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[5], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) UpdateScenario(ctx context.Context, in *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "UpdateScenario") + caller := c.callUpdateScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*UpdateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*UpdateScenarioRequest) when calling interceptor") + } + return c.callUpdateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*UpdateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*UpdateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callUpdateScenario(ctx context.Context, in *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + out := new(UpdateScenarioResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[6], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) CreateScenarioGroup(ctx context.Context, in *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioGroup") + caller := c.callCreateScenarioGroup + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioGroupRequest) when calling interceptor") + } + return c.callCreateScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callCreateScenarioGroup(ctx context.Context, in *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + out := new(CreateScenarioGroupResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[7], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) DeleteScenarioGroup(ctx context.Context, in *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioGroup") + caller := c.callDeleteScenarioGroup + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioGroupRequest) when calling interceptor") + } + return c.callDeleteScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callDeleteScenarioGroup(ctx context.Context, in *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + out := new(DeleteScenarioGroupResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[8], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) ListScenarioGroups(ctx context.Context, in *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioGroups") + caller := c.callListScenarioGroups + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenarioGroupsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioGroupsRequest) when calling interceptor") + } + return c.callListScenarioGroups(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenarioGroupsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioGroupsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callListScenarioGroups(ctx context.Context, in *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + out := new(ListScenarioGroupsResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[9], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) ListScenarios(ctx context.Context, in *ListScenariosRequest) (*ListScenariosResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarios") + caller := c.callListScenarios + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListScenariosRequest) (*ListScenariosResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenariosRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenariosRequest) when calling interceptor") + } + return c.callListScenarios(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenariosResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenariosResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callListScenarios(ctx context.Context, in *ListScenariosRequest) (*ListScenariosResponse, error) { + out := new(ListScenariosResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[10], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +// ============================== +// AgentSimulation Server Handler +// ============================== + +type agentSimulationServer struct { + AgentSimulation + interceptor twirp.Interceptor + hooks *twirp.ServerHooks + pathPrefix string // prefix for routing + jsonSkipDefaults bool // do not include unpopulated fields (default values) in the response + jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names +} + +// NewAgentSimulationServer builds a TwirpServer that can be used as an http.Handler to handle +// HTTP requests that are routed to the right method in the provided svc implementation. +// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). +func NewAgentSimulationServer(svc AgentSimulation, opts ...interface{}) TwirpServer { + serverOpts := newServerOpts(opts) + + // Using ReadOpt allows backwards and forwards compatibility with new options in the future + jsonSkipDefaults := false + _ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults) + jsonCamelCase := false + _ = serverOpts.ReadOpt("jsonCamelCase", &jsonCamelCase) + var pathPrefix string + if ok := serverOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + + return &agentSimulationServer{ + AgentSimulation: svc, + hooks: serverOpts.Hooks, + interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), + pathPrefix: pathPrefix, + jsonSkipDefaults: jsonSkipDefaults, + jsonCamelCase: jsonCamelCase, + } +} + +// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks. +// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) +func (s *agentSimulationServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { + writeError(ctx, resp, err, s.hooks) +} + +// handleRequestBodyError is used to handle error when the twirp server cannot read request +func (s *agentSimulationServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { + if context.Canceled == ctx.Err() { + s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) + return + } + if context.DeadlineExceeded == ctx.Err() { + s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded")) + return + } + s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) +} + +// AgentSimulationPathPrefix is a convenience constant that may identify URL paths. +// Should be used with caution, it only matches routes generated by Twirp Go clients, +// with the default "/twirp" prefix and default CamelCase service and method names. +// More info: https://twitchtv.github.io/twirp/docs/routing.html +const AgentSimulationPathPrefix = "/twirp/livekit.AgentSimulation/" + +func (s *agentSimulationServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { + ctx := req.Context() + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithResponseWriter(ctx, resp) + + var err error + ctx, err = callRequestReceived(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + if req.Method != "POST" { + msg := fmt.Sprintf("unsupported method %q (only POST is allowed)", req.Method) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } + + // Verify path format: []/./ + prefix, pkgService, method := parseTwirpPath(req.URL.Path) + if pkgService != "livekit.AgentSimulation" { + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } + if prefix != s.pathPrefix { + msg := fmt.Sprintf("invalid path prefix %q, expected %q, on path %q", prefix, s.pathPrefix, req.URL.Path) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } + + switch method { + case "CreateSimulationRun": + s.serveCreateSimulationRun(ctx, resp, req) + return + case "GetSimulationRun": + s.serveGetSimulationRun(ctx, resp, req) + return + case "ListSimulationRuns": + s.serveListSimulationRuns(ctx, resp, req) + return + case "CreateScenario": + s.serveCreateScenario(ctx, resp, req) + return + case "CreateScenarioFromSession": + s.serveCreateScenarioFromSession(ctx, resp, req) + return + case "DeleteScenario": + s.serveDeleteScenario(ctx, resp, req) + return + case "UpdateScenario": + s.serveUpdateScenario(ctx, resp, req) + return + case "CreateScenarioGroup": + s.serveCreateScenarioGroup(ctx, resp, req) + return + case "DeleteScenarioGroup": + s.serveDeleteScenarioGroup(ctx, resp, req) + return + case "ListScenarioGroups": + s.serveListScenarioGroups(ctx, resp, req) + return + case "ListScenarios": + s.serveListScenarios(ctx, resp, req) + return + default: + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } +} + +func (s *agentSimulationServer) serveCreateSimulationRun(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveCreateSimulationRunJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateSimulationRunProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveCreateSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(CreateSimulationRunRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.CreateSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.CreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateSimulationRunResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateSimulationRunResponse and nil error while calling CreateSimulationRun. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveCreateSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(CreateSimulationRunRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.CreateSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.CreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateSimulationRunResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateSimulationRunResponse and nil error while calling CreateSimulationRun. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveGetSimulationRun(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveGetSimulationRunJSON(ctx, resp, req) + case "application/protobuf": + s.serveGetSimulationRunProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveGetSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(GetSimulationRunRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.GetSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.GetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *GetSimulationRunResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *GetSimulationRunResponse and nil error while calling GetSimulationRun. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveGetSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(GetSimulationRunRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.GetSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.GetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *GetSimulationRunResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *GetSimulationRunResponse and nil error while calling GetSimulationRun. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveListSimulationRuns(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveListSimulationRunsJSON(ctx, resp, req) + case "application/protobuf": + s.serveListSimulationRunsProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveListSimulationRunsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(ListSimulationRunsRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.ListSimulationRuns + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return s.AgentSimulation.ListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSimulationRunsResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSimulationRunsResponse and nil error while calling ListSimulationRuns. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveListSimulationRunsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(ListSimulationRunsRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.ListSimulationRuns + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return s.AgentSimulation.ListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSimulationRunsResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSimulationRunsResponse and nil error while calling ListSimulationRuns. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveCreateScenario(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveCreateScenarioJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateScenarioProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveCreateScenarioJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenario") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(CreateScenarioRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.CreateScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioRequest) (*CreateScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateScenarioResponse and nil error while calling CreateScenario. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveCreateScenarioProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenario") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(CreateScenarioRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.CreateScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioRequest) (*CreateScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateScenarioResponse and nil error while calling CreateScenario. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveCreateScenarioFromSession(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveCreateScenarioFromSessionJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateScenarioFromSessionProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveCreateScenarioFromSessionJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioFromSession") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(CreateScenarioFromSessionRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.CreateScenarioFromSession + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioFromSessionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioFromSessionRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioFromSession(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioFromSessionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioFromSessionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioFromSessionResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateScenarioFromSessionResponse and nil error while calling CreateScenarioFromSession. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveCreateScenarioFromSessionProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioFromSession") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(CreateScenarioFromSessionRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.CreateScenarioFromSession + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioFromSessionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioFromSessionRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioFromSession(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioFromSessionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioFromSessionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioFromSessionResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateScenarioFromSessionResponse and nil error while calling CreateScenarioFromSession. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveDeleteScenario(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveDeleteScenarioJSON(ctx, resp, req) + case "application/protobuf": + s.serveDeleteScenarioProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveDeleteScenarioJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenario") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(DeleteScenarioRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.DeleteScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.DeleteScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteScenarioResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteScenarioResponse and nil error while calling DeleteScenario. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveDeleteScenarioProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenario") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(DeleteScenarioRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.DeleteScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.DeleteScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteScenarioResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteScenarioResponse and nil error while calling DeleteScenario. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveUpdateScenario(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveUpdateScenarioJSON(ctx, resp, req) + case "application/protobuf": + s.serveUpdateScenarioProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveUpdateScenarioJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "UpdateScenario") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(UpdateScenarioRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.UpdateScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*UpdateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*UpdateScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.UpdateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*UpdateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*UpdateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *UpdateScenarioResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *UpdateScenarioResponse and nil error while calling UpdateScenario. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveUpdateScenarioProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "UpdateScenario") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(UpdateScenarioRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.UpdateScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*UpdateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*UpdateScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.UpdateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*UpdateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*UpdateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *UpdateScenarioResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *UpdateScenarioResponse and nil error while calling UpdateScenario. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveCreateScenarioGroup(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveCreateScenarioGroupJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateScenarioGroupProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveCreateScenarioGroupJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioGroup") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(CreateScenarioGroupRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.CreateScenarioGroup + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioGroupRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioGroupResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateScenarioGroupResponse and nil error while calling CreateScenarioGroup. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveCreateScenarioGroupProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioGroup") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(CreateScenarioGroupRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.CreateScenarioGroup + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioGroupRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioGroupResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateScenarioGroupResponse and nil error while calling CreateScenarioGroup. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveDeleteScenarioGroup(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveDeleteScenarioGroupJSON(ctx, resp, req) + case "application/protobuf": + s.serveDeleteScenarioGroupProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveDeleteScenarioGroupJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioGroup") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(DeleteScenarioGroupRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.DeleteScenarioGroup + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioGroupRequest) when calling interceptor") + } + return s.AgentSimulation.DeleteScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteScenarioGroupResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteScenarioGroupResponse and nil error while calling DeleteScenarioGroup. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveDeleteScenarioGroupProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioGroup") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(DeleteScenarioGroupRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.DeleteScenarioGroup + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioGroupRequest) when calling interceptor") + } + return s.AgentSimulation.DeleteScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteScenarioGroupResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteScenarioGroupResponse and nil error while calling DeleteScenarioGroup. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveListScenarioGroups(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveListScenarioGroupsJSON(ctx, resp, req) + case "application/protobuf": + s.serveListScenarioGroupsProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveListScenarioGroupsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioGroups") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(ListScenarioGroupsRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.ListScenarioGroups + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenarioGroupsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioGroupsRequest) when calling interceptor") + } + return s.AgentSimulation.ListScenarioGroups(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenarioGroupsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioGroupsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListScenarioGroupsResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListScenarioGroupsResponse and nil error while calling ListScenarioGroups. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveListScenarioGroupsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioGroups") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(ListScenarioGroupsRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.ListScenarioGroups + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenarioGroupsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioGroupsRequest) when calling interceptor") + } + return s.AgentSimulation.ListScenarioGroups(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenarioGroupsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioGroupsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListScenarioGroupsResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListScenarioGroupsResponse and nil error while calling ListScenarioGroups. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveListScenarios(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveListScenariosJSON(ctx, resp, req) + case "application/protobuf": + s.serveListScenariosProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentSimulationServer) serveListScenariosJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListScenarios") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(ListScenariosRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentSimulation.ListScenarios + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListScenariosRequest) (*ListScenariosResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenariosRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenariosRequest) when calling interceptor") + } + return s.AgentSimulation.ListScenarios(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenariosResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenariosResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListScenariosResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListScenariosResponse and nil error while calling ListScenarios. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) serveListScenariosProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListScenarios") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(ListScenariosRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.ListScenarios + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListScenariosRequest) (*ListScenariosResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenariosRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenariosRequest) when calling interceptor") + } + return s.AgentSimulation.ListScenarios(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenariosResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenariosResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListScenariosResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListScenariosResponse and nil error while calling ListScenarios. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentSimulationServer) ServiceDescriptor() ([]byte, int) { + return twirpFileDescriptor8, 0 +} + +func (s *agentSimulationServer) ProtocGenTwirpVersion() string { + return "v8.1.3" +} + +// PathPrefix returns the base service path, in the form: "//./" +// that is everything in a Twirp route except for the . This can be used for routing, +// for example to identify the requests that are targeted to this service in a mux. +func (s *agentSimulationServer) PathPrefix() string { + return baseServicePath(s.pathPrefix, "livekit", "AgentSimulation") +} + +var twirpFileDescriptor8 = []byte{ + // 1266 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x72, 0xdb, 0x44, + 0x14, 0x46, 0xf2, 0xff, 0x49, 0xed, 0x38, 0xdb, 0x24, 0x55, 0xd4, 0x49, 0xe2, 0x28, 0x9d, 0x21, + 0x14, 0xea, 0x30, 0x61, 0x98, 0x81, 0x74, 0x18, 0xc6, 0xc4, 0x4e, 0xe2, 0x92, 0x9a, 0x54, 0x4e, + 0xe8, 0xc0, 0xb4, 0xe3, 0xca, 0xd6, 0x4e, 0x50, 0x6b, 0x4b, 0x46, 0x3f, 0x19, 0xfa, 0x0a, 0xf0, + 0x18, 0x70, 0xc5, 0x5b, 0xf0, 0x2a, 0xf4, 0x8e, 0x57, 0xe0, 0x86, 0x91, 0xb4, 0x96, 0x76, 0xe5, + 0x95, 0xeb, 0x24, 0x2d, 0x77, 0xd1, 0xd9, 0xb3, 0xe7, 0xf7, 0x3b, 0xdf, 0xd9, 0x18, 0x36, 0x86, + 0xc6, 0x25, 0x7e, 0x65, 0xb8, 0x3d, 0xed, 0x02, 0x9b, 0x6e, 0xcf, 0x31, 0x46, 0xde, 0x50, 0x73, + 0x0d, 0xcb, 0xac, 0x8f, 0x6d, 0xcb, 0xb5, 0x50, 0x81, 0x9c, 0x2b, 0x6f, 0xb2, 0x50, 0xee, 0x46, + 0xa7, 0xaa, 0x67, 0xa2, 0x0a, 0x88, 0x86, 0x2e, 0x09, 0x35, 0x61, 0xa7, 0xa4, 0x8a, 0x86, 0x8e, + 0xd6, 0x01, 0xc6, 0xb6, 0xf5, 0x12, 0x0f, 0xdc, 0x9e, 0xa1, 0x4b, 0x62, 0x20, 0x2f, 0x11, 0x49, + 0x5b, 0x47, 0x9f, 0x43, 0xde, 0x71, 0x35, 0xd7, 0x73, 0xa4, 0x4c, 0x4d, 0xd8, 0xa9, 0xec, 0xad, + 0xd7, 0x89, 0xe9, 0x3a, 0x63, 0xb6, 0xde, 0x0d, 0x94, 0x54, 0xa2, 0x8c, 0x3e, 0x86, 0xa5, 0x30, + 0x34, 0x1d, 0x3b, 0x03, 0xdb, 0x18, 0xfb, 0x6a, 0x52, 0x36, 0x30, 0x5e, 0x0d, 0x0e, 0x9a, 0xb1, + 0x1c, 0x2d, 0x43, 0x0e, 0xdb, 0xb6, 0x65, 0x4b, 0xb9, 0x40, 0x21, 0xfc, 0xf0, 0x03, 0x1b, 0xd8, + 0x58, 0x73, 0xb1, 0xde, 0xd3, 0x5c, 0x29, 0x5f, 0x13, 0x76, 0x32, 0x6a, 0x89, 0x48, 0x1a, 0x2e, + 0xaa, 0x43, 0xf6, 0xa5, 0xd5, 0x77, 0xa4, 0x42, 0x2d, 0xb3, 0xb3, 0xb0, 0x27, 0xa7, 0x84, 0xf5, + 0xc8, 0xea, 0xab, 0x81, 0x9e, 0xfc, 0xaf, 0x00, 0x99, 0x47, 0x56, 0x7f, 0x2a, 0xff, 0x2f, 0xa3, + 0x04, 0xc5, 0x20, 0xc1, 0xad, 0x74, 0x4b, 0xc9, 0x24, 0x15, 0xb8, 0x65, 0x98, 0x8e, 0x6b, 0x7b, + 0x03, 0x5f, 0x29, 0xac, 0x50, 0x49, 0x65, 0x64, 0x71, 0x6e, 0x59, 0x2a, 0x37, 0xc5, 0x82, 0x7c, + 0x68, 0x0b, 0x21, 0xa8, 0x74, 0xcf, 0x1a, 0x67, 0xe7, 0xdd, 0xde, 0x69, 0xab, 0xd3, 0x6c, 0x77, + 0x8e, 0xaa, 0x1f, 0x50, 0x32, 0xf5, 0xbc, 0xd3, 0xf1, 0x65, 0x02, 0x5a, 0x86, 0x2a, 0x91, 0x1d, + 0x7c, 0xf7, 0xf8, 0xf4, 0xa4, 0x75, 0xd6, 0x6a, 0x56, 0x45, 0xb4, 0x04, 0x65, 0x22, 0x3d, 0x6c, + 0xb4, 0x4f, 0x5a, 0xcd, 0x6a, 0x86, 0x56, 0x6c, 0x74, 0x0e, 0x5a, 0x27, 0xbe, 0x34, 0xab, 0x3c, + 0x8b, 0x1c, 0xae, 0xc0, 0x12, 0x39, 0x3f, 0x6a, 0x75, 0x5a, 0x6a, 0xe3, 0xec, 0xe6, 0x3e, 0x95, + 0x5f, 0xb3, 0x50, 0xec, 0x0e, 0xb0, 0xa9, 0xd9, 0x86, 0x75, 0x55, 0x80, 0x2d, 0x43, 0x6e, 0xa8, + 0xf5, 0xf1, 0x90, 0x54, 0x2f, 0xfc, 0x98, 0x2a, 0x6d, 0x96, 0x53, 0xda, 0x07, 0x80, 0x42, 0x8c, + 0xe1, 0x5f, 0xc6, 0x78, 0xe0, 0x6a, 0xa1, 0x66, 0x88, 0xa1, 0x10, 0x7d, 0x2d, 0xea, 0x00, 0xdd, + 0x83, 0x8a, 0x63, 0x79, 0xf6, 0x00, 0xf7, 0x6c, 0xcb, 0x1a, 0xf9, 0xb1, 0xe4, 0x43, 0xa3, 0xa1, + 0x54, 0xb5, 0xac, 0x51, 0x5b, 0x4f, 0xa0, 0xae, 0x90, 0x44, 0xdd, 0xa7, 0x11, 0x5a, 0x8a, 0x01, + 0x5a, 0xa4, 0x18, 0x2d, 0x24, 0xff, 0x24, 0x48, 0x22, 0x00, 0x94, 0x68, 0x70, 0xaf, 0x41, 0xf1, + 0xc2, 0xb6, 0xbc, 0xb1, 0x1f, 0x06, 0x04, 0x07, 0x85, 0xe0, 0xbb, 0xad, 0xa3, 0x87, 0x50, 0x1c, + 0x61, 0x57, 0xd3, 0x35, 0x57, 0x93, 0x16, 0x02, 0x70, 0x6f, 0x4e, 0x3b, 0x79, 0x4c, 0x34, 0x5a, + 0xa6, 0x6b, 0xbf, 0x56, 0xa3, 0x0b, 0xf2, 0x43, 0x28, 0x33, 0x47, 0xa8, 0x0a, 0x99, 0x57, 0xf8, + 0x35, 0x69, 0x87, 0xff, 0xa7, 0x1f, 0xd0, 0xa5, 0x36, 0xf4, 0x30, 0x69, 0x45, 0xf8, 0xb1, 0x2f, + 0x7e, 0x21, 0x28, 0xcd, 0xb7, 0x81, 0xa4, 0x0a, 0xb7, 0x26, 0x20, 0x69, 0x35, 0x9a, 0x3f, 0x54, + 0x85, 0x69, 0x30, 0x88, 0xca, 0x1f, 0x02, 0x94, 0x27, 0x71, 0x1e, 0xf9, 0x39, 0xbd, 0x1b, 0x44, + 0xb0, 0x8d, 0xc9, 0x26, 0x1b, 0xb3, 0x0b, 0x25, 0x87, 0x38, 0xf5, 0x31, 0xe0, 0x97, 0x6d, 0x69, + 0xaa, 0x6c, 0x6a, 0xac, 0xa3, 0xbc, 0x11, 0x40, 0x3e, 0x08, 0xae, 0x33, 0x73, 0xae, 0xe2, 0x9f, + 0x3d, 0xec, 0xb8, 0x89, 0x18, 0x85, 0x64, 0x8c, 0xeb, 0x00, 0x21, 0xf6, 0x4c, 0x6d, 0x34, 0xa9, + 0x64, 0x29, 0x90, 0x74, 0xb4, 0x11, 0xe6, 0xd3, 0x5f, 0x26, 0x85, 0xfe, 0x3e, 0x84, 0x45, 0xd3, + 0x1b, 0x51, 0x24, 0x1e, 0xc2, 0x3d, 0xa7, 0x56, 0x4c, 0x6f, 0x14, 0x07, 0xe7, 0x30, 0xa0, 0xc9, + 0xb1, 0xa0, 0x59, 0x85, 0xbc, 0x8d, 0x2f, 0x7c, 0x2f, 0x21, 0xa8, 0xc9, 0x97, 0xd2, 0x86, 0xbb, + 0xdc, 0x24, 0x9d, 0xb1, 0x65, 0x3a, 0x18, 0xdd, 0x87, 0xa5, 0xd8, 0x6d, 0xcf, 0xf6, 0xcc, 0x38, + 0xd9, 0x45, 0x87, 0xbe, 0xd1, 0xd6, 0x15, 0x1d, 0xee, 0x1c, 0x61, 0xf7, 0x3a, 0xc5, 0xe2, 0x7a, + 0x11, 0xf9, 0x5e, 0x9a, 0x20, 0x4d, 0x7b, 0x21, 0xd1, 0xee, 0x40, 0xc6, 0xf6, 0xcc, 0xc0, 0xfe, + 0xc2, 0xde, 0x2a, 0x9f, 0xa7, 0x55, 0x5f, 0x45, 0xd9, 0x87, 0xb5, 0x13, 0xc3, 0x61, 0xcd, 0x38, + 0xf3, 0x45, 0xab, 0x1c, 0x83, 0xcc, 0xbb, 0x1b, 0x55, 0x2c, 0x6b, 0x7b, 0xa6, 0x23, 0x09, 0x01, + 0xc4, 0xd2, 0x82, 0x08, 0x74, 0x94, 0xbf, 0x44, 0x58, 0x21, 0xd5, 0x9f, 0x00, 0x70, 0xbe, 0x82, + 0x45, 0x13, 0x20, 0xce, 0xe2, 0xc4, 0xcc, 0xdc, 0x9c, 0x98, 0x4d, 0xe3, 0xc4, 0x19, 0x88, 0x3a, + 0xa6, 0x68, 0x28, 0x1f, 0x24, 0xfb, 0x49, 0x94, 0x2c, 0x37, 0xa9, 0xf7, 0xc3, 0x49, 0x47, 0xb0, + 0x9a, 0xf4, 0x46, 0x3a, 0xf1, 0x00, 0x8a, 0x93, 0x69, 0x26, 0x90, 0xe0, 0x0c, 0x7c, 0xa4, 0xa2, + 0xfc, 0x2e, 0x40, 0x8d, 0xb5, 0x74, 0x68, 0x5b, 0xa3, 0x2e, 0x76, 0x1c, 0xbf, 0x67, 0xf3, 0xf5, + 0xe5, 0x0e, 0x14, 0x26, 0xbb, 0x43, 0x24, 0x63, 0x16, 0x6e, 0x0d, 0xba, 0x8e, 0x19, 0xb6, 0x8e, + 0x51, 0x2f, 0xb3, 0x74, 0x2f, 0xe3, 0x79, 0xcd, 0x31, 0xf3, 0xaa, 0xc2, 0xd6, 0x8c, 0x20, 0xaf, + 0x97, 0xf9, 0x53, 0x58, 0x69, 0xe2, 0x21, 0xbe, 0x32, 0x0a, 0x37, 0x61, 0x61, 0x62, 0x23, 0xce, + 0x18, 0x26, 0xa2, 0xb6, 0xae, 0x48, 0xb0, 0x9a, 0x34, 0x1c, 0x46, 0xa8, 0xfc, 0x2d, 0xc2, 0xca, + 0xf9, 0x58, 0xd7, 0xde, 0xb9, 0xcf, 0xff, 0xef, 0xb9, 0x40, 0xb7, 0x34, 0x9f, 0x3e, 0x1a, 0x85, + 0xc4, 0x68, 0x70, 0xb3, 0x7e, 0x6f, 0xa3, 0x91, 0xf4, 0x76, 0x3d, 0x80, 0x3c, 0x89, 0x36, 0x21, + 0xbd, 0xb6, 0x6f, 0xc2, 0x55, 0xca, 0xb3, 0x68, 0xef, 0xb0, 0x26, 0x49, 0x80, 0x5f, 0x41, 0x25, + 0x6a, 0x73, 0x50, 0xd5, 0x69, 0x52, 0x67, 0xee, 0x95, 0x1d, 0xfa, 0x53, 0xf9, 0x1e, 0x64, 0x16, + 0x78, 0x57, 0x09, 0x98, 0x6e, 0xac, 0xc8, 0x34, 0x56, 0x59, 0x87, 0xbb, 0x5c, 0xbb, 0x04, 0xd5, + 0x93, 0xad, 0x42, 0x1f, 0xce, 0xbb, 0x55, 0x9e, 0x93, 0xad, 0x92, 0xb8, 0x4b, 0xea, 0xf1, 0x35, + 0x2c, 0xb2, 0xf5, 0xe0, 0x2c, 0x18, 0x26, 0xa4, 0x0a, 0x53, 0x10, 0x47, 0x39, 0x85, 0x65, 0xda, + 0xbc, 0x73, 0xf3, 0x5a, 0x1c, 0xc3, 0x4a, 0xc2, 0x22, 0x89, 0x95, 0x79, 0x69, 0x09, 0x6f, 0x7f, + 0x69, 0xed, 0xfd, 0x56, 0x84, 0xc5, 0x86, 0x3f, 0x5f, 0xf1, 0x8e, 0x44, 0x2f, 0xe0, 0x36, 0xe7, + 0x5d, 0x82, 0xb6, 0x93, 0x2b, 0x86, 0xf3, 0xda, 0x90, 0xef, 0xcd, 0x56, 0x22, 0x61, 0x3e, 0x85, + 0x6a, 0xf2, 0x21, 0x81, 0x6a, 0xd1, 0xcd, 0x94, 0x97, 0x8c, 0xbc, 0x35, 0x43, 0x83, 0x18, 0x7e, + 0x0e, 0x68, 0xfa, 0x7d, 0x80, 0x94, 0xe8, 0x62, 0xea, 0xc3, 0x43, 0xde, 0x9e, 0xa9, 0x43, 0xcc, + 0x3f, 0x81, 0x0a, 0x3b, 0x39, 0x68, 0x63, 0xf6, 0xde, 0x95, 0x37, 0x53, 0xcf, 0x89, 0x49, 0x1b, + 0xd6, 0x52, 0x97, 0x0a, 0xfa, 0x28, 0xe5, 0xf6, 0xf4, 0x76, 0x94, 0xef, 0xcf, 0xa3, 0x1a, 0xa7, + 0xc1, 0x8e, 0x12, 0x95, 0x06, 0x77, 0x1b, 0x51, 0x69, 0xf0, 0x97, 0x8a, 0x6f, 0x92, 0xe5, 0x3b, + 0xca, 0x24, 0x97, 0x76, 0x29, 0x93, 0x29, 0x44, 0x19, 0xc3, 0x90, 0xf9, 0x87, 0x65, 0x3b, 0x25, + 0x51, 0x9a, 0x66, 0xa6, 0x61, 0xc8, 0x65, 0xba, 0x17, 0x70, 0x9b, 0x43, 0x29, 0x94, 0x87, 0x74, + 0x22, 0xa3, 0x3c, 0xcc, 0x60, 0xa5, 0x08, 0x8f, 0x0c, 0x21, 0x24, 0xf1, 0xc8, 0xa3, 0xac, 0x24, + 0x1e, 0xf9, 0xd4, 0xd4, 0x81, 0x32, 0xc3, 0x03, 0x68, 0x9d, 0x7b, 0x2b, 0x32, 0xba, 0x91, 0x76, + 0x1c, 0xda, 0xfb, 0xe6, 0xf0, 0xc7, 0xed, 0x0b, 0xc3, 0xfd, 0xc9, 0xeb, 0xd7, 0x07, 0xd6, 0x68, + 0x97, 0xe8, 0xee, 0x06, 0x3f, 0x5b, 0x0d, 0xac, 0xe1, 0x44, 0xf0, 0xa7, 0x58, 0x3e, 0x31, 0x2e, + 0xf1, 0xb7, 0x86, 0x5b, 0x3f, 0xf5, 0x8f, 0xfe, 0x11, 0x2b, 0xe4, 0x7b, 0x7f, 0x3f, 0x10, 0xf4, + 0xf3, 0xc1, 0x95, 0xcf, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x22, 0x71, 0x15, 0x0b, 0x13, + 0x00, 0x00, +} diff --git a/magefile.go b/magefile.go index 8679a9d6d..7d42d63c9 100644 --- a/magefile.go +++ b/magefile.go @@ -53,6 +53,7 @@ func Proto() error { "livekit_connector.proto", "livekit_connector_whatsapp.proto", "livekit_connector_twilio.proto", + "livekit_agent_simulation.proto", } agentProtoFiles := []string{ diff --git a/protobufs/livekit_agent_simulation.proto b/protobufs/livekit_agent_simulation.proto new file mode 100644 index 000000000..533f19991 --- /dev/null +++ b/protobufs/livekit_agent_simulation.proto @@ -0,0 +1,196 @@ +// Copyright 2024 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package livekit; +option go_package = "github.com/livekit/protocol/livekit"; +option csharp_namespace = "LiveKit.Proto"; +option ruby_package = "LiveKit::Proto"; + +message SimulationRun { + enum Status { + STATUS_GENERATING = 0; + STATUS_RUNNING = 1; + STATUS_COMPLETED = 2; + STATUS_FAILED = 3; + } + + message Job { + enum Status { + STATUS_PENDING = 0; + STATUS_RUNNING = 1; + STATUS_COMPLETED = 2; + STATUS_FAILED = 3; + STATUS_CANCELLED = 4; + } + string id = 1; + Status status = 2; + string instructions = 3; + string error = 4; + } + + string id = 1; + string project_id = 2; + Status status = 3; + string agent_description = 4; + string error = 5; + int64 created_at = 6; + repeated Job jobs = 7; +} + +message Scenario { + enum Status { + // Scenario is being generated from a session by an LLM. + // instructions and agent_expectations are not yet available. + STATUS_GENERATING = 0; + STATUS_READY = 1; + STATUS_FAILED = 2; + } + string id = 1; + string project_id = 2; + string label = 3; + string instructions = 4; + string agent_expectations = 5; + string source_room_id = 6; + int64 created_at = 7; + Status status = 8; + string error = 9; + string group_id = 10; + // Set as participant attributes on the simulation participant's access token. + map metadata = 11; +} + +message ScenarioGroup { + string id = 1; + string project_id = 2; + string label = 3; + int64 created_at = 4; + repeated Scenario scenarios = 5; +} + +message CreateSimulationRunRequest { + string project_id = 1; + string agent_name = 2; + string agent_description = 3; + int32 num_simulations = 4; + string group_id = 5; + string region = 6; +} +message CreateSimulationRunResponse { + string simulation_run_id = 1; +} + +message GetSimulationRunRequest { + string project_id = 1; + string simulation_run_id = 2; +} +message GetSimulationRunResponse { + SimulationRun run = 1; +} + +message ListSimulationRunsRequest { + string project_id = 1; +} +message ListSimulationRunsResponse { + repeated SimulationRun runs = 1; +} + +message CreateScenarioRequest { + string project_id = 1; + string label = 2; + string instructions = 3; + string agent_expectations = 4; + string group_id = 5; + map metadata = 6; +} +message CreateScenarioResponse { + Scenario scenario = 1; +} + +message CreateScenarioFromSessionRequest { + string project_id = 1; + string room_id = 2; + string group_id = 3; + string label = 4; + string region = 5; +} +message CreateScenarioFromSessionResponse { + Scenario scenario = 1; +} + +message DeleteScenarioRequest { + string project_id = 1; + string scenario_id = 2; +} +message DeleteScenarioResponse {} + +message UpdateScenarioRequest { + string project_id = 1; + string scenario_id = 2; + string label = 3; + string instructions = 4; + string agent_expectations = 5; + string group_id = 6; + map metadata = 7; +} +message UpdateScenarioResponse { + Scenario scenario = 1; +} + +message CreateScenarioGroupRequest { + string project_id = 1; + string label = 2; +} +message CreateScenarioGroupResponse { + ScenarioGroup scenario_group = 1; +} + +message DeleteScenarioGroupRequest { + string project_id = 1; + string group_id = 2; +} +message DeleteScenarioGroupResponse {} + +message ListScenarioGroupsRequest { + string project_id = 1; +} +message ListScenarioGroupsResponse { + repeated ScenarioGroup scenario_groups = 1; +} + +message ListScenariosRequest { + string project_id = 1; + string group_id = 2; +} +message ListScenariosResponse { + repeated Scenario scenarios = 1; +} + +service AgentSimulation { + rpc CreateSimulationRun(CreateSimulationRunRequest) returns (CreateSimulationRunResponse); + rpc GetSimulationRun(GetSimulationRunRequest) returns (GetSimulationRunResponse); + rpc ListSimulationRuns(ListSimulationRunsRequest) returns (ListSimulationRunsResponse); + + rpc CreateScenario(CreateScenarioRequest) returns (CreateScenarioResponse); + rpc CreateScenarioFromSession(CreateScenarioFromSessionRequest) returns (CreateScenarioFromSessionResponse); + rpc DeleteScenario(DeleteScenarioRequest) returns (DeleteScenarioResponse); + rpc UpdateScenario(UpdateScenarioRequest) returns (UpdateScenarioResponse); + + rpc CreateScenarioGroup(CreateScenarioGroupRequest) returns (CreateScenarioGroupResponse); + rpc DeleteScenarioGroup(DeleteScenarioGroupRequest) returns (DeleteScenarioGroupResponse); + rpc ListScenarioGroups(ListScenarioGroupsRequest) returns (ListScenarioGroupsResponse); + + rpc ListScenarios(ListScenariosRequest) returns (ListScenariosResponse); +}