diff --git a/livekit/livekit_agent_simulation.pb.go b/livekit/livekit_agent_simulation.pb.go index fa64f346f..45fcc93b0 100644 --- a/livekit/livekit_agent_simulation.pb.go +++ b/livekit/livekit_agent_simulation.pb.go @@ -35,29 +35,188 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type CreateSimulationRunRequest struct { +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 +) + +// 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", + } + SimulationRun_Job_Status_value = map[string]int32{ + "STATUS_PENDING": 0, + "STATUS_RUNNING": 1, + "STATUS_COMPLETED": 2, + "STATUS_FAILED": 3, + } +) + +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"` - AgentName string `protobuf:"bytes,1,opt,name=agent_name,json=agentName,proto3" json:"agent_name,omitempty"` - AgentDescription string `protobuf:"bytes,2,opt,name=agent_description,json=agentDescription,proto3" json:"agent_description,omitempty"` - NumSimulations int32 `protobuf:"varint,3,opt,name=num_simulations,json=numSimulations,proto3" json:"num_simulations,omitempty"` + 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 *CreateSimulationRunRequest) Reset() { - *x = CreateSimulationRunRequest{} +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 *CreateSimulationRunRequest) String() string { +func (x *SimulationRun) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateSimulationRunRequest) ProtoMessage() {} +func (*SimulationRun) ProtoMessage() {} -func (x *CreateSimulationRunRequest) ProtoReflect() protoreflect.Message { +func (x *SimulationRun) ProtoReflect() protoreflect.Message { mi := &file_livekit_agent_simulation_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -69,53 +228,89 @@ func (x *CreateSimulationRunRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateSimulationRunRequest.ProtoReflect.Descriptor instead. -func (*CreateSimulationRunRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use SimulationRun.ProtoReflect.Descriptor instead. +func (*SimulationRun) Descriptor() ([]byte, []int) { return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0} } -func (x *CreateSimulationRunRequest) GetAgentName() string { +func (x *SimulationRun) GetId() string { if x != nil { - return x.AgentName + return x.Id } return "" } -func (x *CreateSimulationRunRequest) GetAgentDescription() string { +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 *CreateSimulationRunRequest) GetNumSimulations() int32 { +func (x *SimulationRun) GetError() string { if x != nil { - return x.NumSimulations + return x.Error + } + return "" +} + +func (x *SimulationRun) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt } return 0 } -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 *SimulationRun) GetJobs() []*SimulationRun_Job { + if x != nil { + return x.Jobs + } + return nil } -func (x *CreateSimulationRunResponse) Reset() { - *x = CreateSimulationRunResponse{} +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"` + 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 *CreateSimulationRunResponse) String() string { +func (x *Scenario) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateSimulationRunResponse) ProtoMessage() {} +func (*Scenario) ProtoMessage() {} -func (x *CreateSimulationRunResponse) ProtoReflect() protoreflect.Message { +func (x *Scenario) ProtoReflect() protoreflect.Message { mi := &file_livekit_agent_simulation_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -127,32 +322,1567 @@ func (x *CreateSimulationRunResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateSimulationRunResponse.ProtoReflect.Descriptor instead. -func (*CreateSimulationRunResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use Scenario.ProtoReflect.Descriptor instead. +func (*Scenario) Descriptor() ([]byte, []int) { return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{1} } -func (x *CreateSimulationRunResponse) GetSimulationRunId() string { +func (x *Scenario) GetId() string { if x != nil { - return x.SimulationRunId + return x.Id } return "" } -var File_livekit_agent_simulation_proto protoreflect.FileDescriptor +func (x *Scenario) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} -const file_livekit_agent_simulation_proto_rawDesc = "" + - "\n" + - "\x1elivekit_agent_simulation.proto\x12\alivekit\"\x91\x01\n" + - "\x1aCreateSimulationRunRequest\x12\x1d\n" + - "\n" + - "agent_name\x18\x01 \x01(\tR\tagentName\x12+\n" + - "\x11agent_description\x18\x02 \x01(\tR\x10agentDescription\x12'\n" + - "\x0fnum_simulations\x18\x03 \x01(\x05R\x0enumSimulations\"I\n" + - "\x1bCreateSimulationRunResponse\x12*\n" + - "\x11simulation_run_id\x18\x01 \x01(\tR\x0fsimulationRunId2z\n" + - "\x16AgentSimulationService\x12`\n" + - "\x13CreateSimulationRun\x12#.livekit.CreateSimulationRunRequest\x1a$.livekit.CreateSimulationRunResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" +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 "" +} + +type ScenarioCollection 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 *ScenarioCollection) Reset() { + *x = ScenarioCollection{} + mi := &file_livekit_agent_simulation_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScenarioCollection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScenarioCollection) ProtoMessage() {} + +func (x *ScenarioCollection) 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 ScenarioCollection.ProtoReflect.Descriptor instead. +func (*ScenarioCollection) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{2} +} + +func (x *ScenarioCollection) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ScenarioCollection) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *ScenarioCollection) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *ScenarioCollection) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ScenarioCollection) 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"` + ScenarioCollectionId string `protobuf:"bytes,5,opt,name=scenario_collection_id,json=scenarioCollectionId,proto3" json:"scenario_collection_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) GetScenarioCollectionId() string { + if x != nil { + return x.ScenarioCollectionId + } + 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"` + ScenarioCollectionId string `protobuf:"bytes,5,opt,name=scenario_collection_id,json=scenarioCollectionId,proto3" json:"scenario_collection_id,omitempty"` + 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) GetScenarioCollectionId() string { + if x != nil { + return x.ScenarioCollectionId + } + return "" +} + +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"` + ScenarioCollectionId string `protobuf:"bytes,3,opt,name=scenario_collection_id,json=scenarioCollectionId,proto3" json:"scenario_collection_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) GetScenarioCollectionId() string { + if x != nil { + return x.ScenarioCollectionId + } + 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 CreateScenarioCollectionRequest 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 *CreateScenarioCollectionRequest) Reset() { + *x = CreateScenarioCollectionRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioCollectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioCollectionRequest) ProtoMessage() {} + +func (x *CreateScenarioCollectionRequest) 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 CreateScenarioCollectionRequest.ProtoReflect.Descriptor instead. +func (*CreateScenarioCollectionRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{15} +} + +func (x *CreateScenarioCollectionRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *CreateScenarioCollectionRequest) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +type CreateScenarioCollectionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScenarioCollection *ScenarioCollection `protobuf:"bytes,1,opt,name=scenario_collection,json=scenarioCollection,proto3" json:"scenario_collection,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioCollectionResponse) Reset() { + *x = CreateScenarioCollectionResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioCollectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioCollectionResponse) ProtoMessage() {} + +func (x *CreateScenarioCollectionResponse) 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 CreateScenarioCollectionResponse.ProtoReflect.Descriptor instead. +func (*CreateScenarioCollectionResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{16} +} + +func (x *CreateScenarioCollectionResponse) GetScenarioCollection() *ScenarioCollection { + if x != nil { + return x.ScenarioCollection + } + return nil +} + +type DeleteScenarioCollectionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ScenarioCollectionId string `protobuf:"bytes,2,opt,name=scenario_collection_id,json=scenarioCollectionId,proto3" json:"scenario_collection_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioCollectionRequest) Reset() { + *x = DeleteScenarioCollectionRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioCollectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioCollectionRequest) ProtoMessage() {} + +func (x *DeleteScenarioCollectionRequest) 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 DeleteScenarioCollectionRequest.ProtoReflect.Descriptor instead. +func (*DeleteScenarioCollectionRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{17} +} + +func (x *DeleteScenarioCollectionRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *DeleteScenarioCollectionRequest) GetScenarioCollectionId() string { + if x != nil { + return x.ScenarioCollectionId + } + return "" +} + +type DeleteScenarioCollectionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioCollectionResponse) Reset() { + *x = DeleteScenarioCollectionResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioCollectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioCollectionResponse) ProtoMessage() {} + +func (x *DeleteScenarioCollectionResponse) 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 DeleteScenarioCollectionResponse.ProtoReflect.Descriptor instead. +func (*DeleteScenarioCollectionResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{18} +} + +type ListScenarioCollectionsRequest 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 *ListScenarioCollectionsRequest) Reset() { + *x = ListScenarioCollectionsRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenarioCollectionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenarioCollectionsRequest) ProtoMessage() {} + +func (x *ListScenarioCollectionsRequest) 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 ListScenarioCollectionsRequest.ProtoReflect.Descriptor instead. +func (*ListScenarioCollectionsRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{19} +} + +func (x *ListScenarioCollectionsRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +type ListScenarioCollectionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScenarioCollections []*ScenarioCollection `protobuf:"bytes,1,rep,name=scenario_collections,json=scenarioCollections,proto3" json:"scenario_collections,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenarioCollectionsResponse) Reset() { + *x = ListScenarioCollectionsResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenarioCollectionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenarioCollectionsResponse) ProtoMessage() {} + +func (x *ListScenarioCollectionsResponse) 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 ListScenarioCollectionsResponse.ProtoReflect.Descriptor instead. +func (*ListScenarioCollectionsResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{20} +} + +func (x *ListScenarioCollectionsResponse) GetScenarioCollections() []*ScenarioCollection { + if x != nil { + return x.ScenarioCollections + } + 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"` + ScenarioCollectionId string `protobuf:"bytes,2,opt,name=scenario_collection_id,json=scenarioCollectionId,proto3" json:"scenario_collection_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenariosRequest) Reset() { + *x = ListScenariosRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[21] + 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[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 ListScenariosRequest.ProtoReflect.Descriptor instead. +func (*ListScenariosRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{21} +} + +func (x *ListScenariosRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *ListScenariosRequest) GetScenarioCollectionId() string { + if x != nil { + return x.ScenarioCollectionId + } + 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[22] + 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[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 ListScenariosResponse.ProtoReflect.Descriptor instead. +func (*ListScenariosResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{22} +} + +func (x *ListScenariosResponse) GetScenarios() []*Scenario { + if x != nil { + return x.Scenarios + } + return nil +} + +type AddScenarioToCollectionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ScenarioCollectionId string `protobuf:"bytes,2,opt,name=scenario_collection_id,json=scenarioCollectionId,proto3" json:"scenario_collection_id,omitempty"` + ScenarioId string `protobuf:"bytes,3,opt,name=scenario_id,json=scenarioId,proto3" json:"scenario_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddScenarioToCollectionRequest) Reset() { + *x = AddScenarioToCollectionRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddScenarioToCollectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddScenarioToCollectionRequest) ProtoMessage() {} + +func (x *AddScenarioToCollectionRequest) 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 AddScenarioToCollectionRequest.ProtoReflect.Descriptor instead. +func (*AddScenarioToCollectionRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{23} +} + +func (x *AddScenarioToCollectionRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *AddScenarioToCollectionRequest) GetScenarioCollectionId() string { + if x != nil { + return x.ScenarioCollectionId + } + return "" +} + +func (x *AddScenarioToCollectionRequest) GetScenarioId() string { + if x != nil { + return x.ScenarioId + } + return "" +} + +type AddScenarioToCollectionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddScenarioToCollectionResponse) Reset() { + *x = AddScenarioToCollectionResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddScenarioToCollectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddScenarioToCollectionResponse) ProtoMessage() {} + +func (x *AddScenarioToCollectionResponse) 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 AddScenarioToCollectionResponse.ProtoReflect.Descriptor instead. +func (*AddScenarioToCollectionResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{24} +} + +type RemoveScenarioFromCollectionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ScenarioCollectionId string `protobuf:"bytes,2,opt,name=scenario_collection_id,json=scenarioCollectionId,proto3" json:"scenario_collection_id,omitempty"` + ScenarioId string `protobuf:"bytes,3,opt,name=scenario_id,json=scenarioId,proto3" json:"scenario_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveScenarioFromCollectionRequest) Reset() { + *x = RemoveScenarioFromCollectionRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveScenarioFromCollectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveScenarioFromCollectionRequest) ProtoMessage() {} + +func (x *RemoveScenarioFromCollectionRequest) 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 RemoveScenarioFromCollectionRequest.ProtoReflect.Descriptor instead. +func (*RemoveScenarioFromCollectionRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{25} +} + +func (x *RemoveScenarioFromCollectionRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *RemoveScenarioFromCollectionRequest) GetScenarioCollectionId() string { + if x != nil { + return x.ScenarioCollectionId + } + return "" +} + +func (x *RemoveScenarioFromCollectionRequest) GetScenarioId() string { + if x != nil { + return x.ScenarioId + } + return "" +} + +type RemoveScenarioFromCollectionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveScenarioFromCollectionResponse) Reset() { + *x = RemoveScenarioFromCollectionResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveScenarioFromCollectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveScenarioFromCollectionResponse) ProtoMessage() {} + +func (x *RemoveScenarioFromCollectionResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[26] + 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 RemoveScenarioFromCollectionResponse.ProtoReflect.Descriptor instead. +func (*RemoveScenarioFromCollectionResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{26} +} + +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[27] + 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[27] + 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\"\xcd\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\xe5\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\"Y\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\"\\\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\"\xf5\x02\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\"D\n" + + "\x06Status\x12\x15\n" + + "\x11STATUS_GENERATING\x10\x00\x12\x10\n" + + "\fSTATUS_READY\x10\x01\x12\x11\n" + + "\rSTATUS_FAILED\x10\x02\"\xa9\x01\n" + + "\x12ScenarioCollection\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\"\xfe\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\x124\n" + + "\x16scenario_collection_id\x18\x05 \x01(\tR\x14scenarioCollectionId\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\"\xd5\x01\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\x124\n" + + "\x16scenario_collection_id\x18\x05 \x01(\tR\x14scenarioCollectionId\"G\n" + + "\x16CreateScenarioResponse\x12-\n" + + "\bscenario\x18\x01 \x01(\v2\x11.livekit.ScenarioR\bscenario\"\xbe\x01\n" + + " CreateScenarioFromSessionRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x17\n" + + "\aroom_id\x18\x02 \x01(\tR\x06roomId\x124\n" + + "\x16scenario_collection_id\x18\x03 \x01(\tR\x14scenarioCollectionId\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\"V\n" + + "\x1fCreateScenarioCollectionRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x14\n" + + "\x05label\x18\x02 \x01(\tR\x05label\"p\n" + + " CreateScenarioCollectionResponse\x12L\n" + + "\x13scenario_collection\x18\x01 \x01(\v2\x1b.livekit.ScenarioCollectionR\x12scenarioCollection\"v\n" + + "\x1fDeleteScenarioCollectionRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x124\n" + + "\x16scenario_collection_id\x18\x02 \x01(\tR\x14scenarioCollectionId\"\"\n" + + " DeleteScenarioCollectionResponse\"?\n" + + "\x1eListScenarioCollectionsRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\"q\n" + + "\x1fListScenarioCollectionsResponse\x12N\n" + + "\x14scenario_collections\x18\x01 \x03(\v2\x1b.livekit.ScenarioCollectionR\x13scenarioCollections\"k\n" + + "\x14ListScenariosRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x124\n" + + "\x16scenario_collection_id\x18\x02 \x01(\tR\x14scenarioCollectionId\"H\n" + + "\x15ListScenariosResponse\x12/\n" + + "\tscenarios\x18\x01 \x03(\v2\x11.livekit.ScenarioR\tscenarios\"\x96\x01\n" + + "\x1eAddScenarioToCollectionRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x124\n" + + "\x16scenario_collection_id\x18\x02 \x01(\tR\x14scenarioCollectionId\x12\x1f\n" + + "\vscenario_id\x18\x03 \x01(\tR\n" + + "scenarioId\"!\n" + + "\x1fAddScenarioToCollectionResponse\"\x9b\x01\n" + + "#RemoveScenarioFromCollectionRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x124\n" + + "\x16scenario_collection_id\x18\x02 \x01(\tR\x14scenarioCollectionId\x12\x1f\n" + + "\vscenario_id\x18\x03 \x01(\tR\n" + + "scenarioId\"&\n" + + "$RemoveScenarioFromCollectionResponse2\xd0\t\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\x12o\n" + + "\x18CreateScenarioCollection\x12(.livekit.CreateScenarioCollectionRequest\x1a).livekit.CreateScenarioCollectionResponse\x12o\n" + + "\x18DeleteScenarioCollection\x12(.livekit.DeleteScenarioCollectionRequest\x1a).livekit.DeleteScenarioCollectionResponse\x12l\n" + + "\x17ListScenarioCollections\x12'.livekit.ListScenarioCollectionsRequest\x1a(.livekit.ListScenarioCollectionsResponse\x12N\n" + + "\rListScenarios\x12\x1d.livekit.ListScenariosRequest\x1a\x1e.livekit.ListScenariosResponse\x12l\n" + + "\x17AddScenarioToCollection\x12'.livekit.AddScenarioToCollectionRequest\x1a(.livekit.AddScenarioToCollectionResponse\x12{\n" + + "\x1cRemoveScenarioFromCollection\x12,.livekit.RemoveScenarioFromCollectionRequest\x1a-.livekit.RemoveScenarioFromCollectionResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" var ( file_livekit_agent_simulation_proto_rawDescOnce sync.Once @@ -166,19 +1896,83 @@ func file_livekit_agent_simulation_proto_rawDescGZIP() []byte { return file_livekit_agent_simulation_proto_rawDescData } -var file_livekit_agent_simulation_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_livekit_agent_simulation_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_livekit_agent_simulation_proto_msgTypes = make([]protoimpl.MessageInfo, 28) var file_livekit_agent_simulation_proto_goTypes = []any{ - (*CreateSimulationRunRequest)(nil), // 0: livekit.CreateSimulationRunRequest - (*CreateSimulationRunResponse)(nil), // 1: livekit.CreateSimulationRunResponse + (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 + (*ScenarioCollection)(nil), // 5: livekit.ScenarioCollection + (*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 + (*CreateScenarioCollectionRequest)(nil), // 18: livekit.CreateScenarioCollectionRequest + (*CreateScenarioCollectionResponse)(nil), // 19: livekit.CreateScenarioCollectionResponse + (*DeleteScenarioCollectionRequest)(nil), // 20: livekit.DeleteScenarioCollectionRequest + (*DeleteScenarioCollectionResponse)(nil), // 21: livekit.DeleteScenarioCollectionResponse + (*ListScenarioCollectionsRequest)(nil), // 22: livekit.ListScenarioCollectionsRequest + (*ListScenarioCollectionsResponse)(nil), // 23: livekit.ListScenarioCollectionsResponse + (*ListScenariosRequest)(nil), // 24: livekit.ListScenariosRequest + (*ListScenariosResponse)(nil), // 25: livekit.ListScenariosResponse + (*AddScenarioToCollectionRequest)(nil), // 26: livekit.AddScenarioToCollectionRequest + (*AddScenarioToCollectionResponse)(nil), // 27: livekit.AddScenarioToCollectionResponse + (*RemoveScenarioFromCollectionRequest)(nil), // 28: livekit.RemoveScenarioFromCollectionRequest + (*RemoveScenarioFromCollectionResponse)(nil), // 29: livekit.RemoveScenarioFromCollectionResponse + (*SimulationRun_Job)(nil), // 30: livekit.SimulationRun.Job } var file_livekit_agent_simulation_proto_depIdxs = []int32{ - 0, // 0: livekit.AgentSimulationService.CreateSimulationRun:input_type -> livekit.CreateSimulationRunRequest - 1, // 1: livekit.AgentSimulationService.CreateSimulationRun:output_type -> livekit.CreateSimulationRunResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: livekit.SimulationRun.status:type_name -> livekit.SimulationRun.Status + 30, // 1: livekit.SimulationRun.jobs:type_name -> livekit.SimulationRun.Job + 2, // 2: livekit.Scenario.status:type_name -> livekit.Scenario.Status + 4, // 3: livekit.ScenarioCollection.scenarios:type_name -> livekit.Scenario + 3, // 4: livekit.GetSimulationRunResponse.run:type_name -> livekit.SimulationRun + 3, // 5: livekit.ListSimulationRunsResponse.runs:type_name -> livekit.SimulationRun + 4, // 6: livekit.CreateScenarioResponse.scenario:type_name -> livekit.Scenario + 4, // 7: livekit.CreateScenarioFromSessionResponse.scenario:type_name -> livekit.Scenario + 5, // 8: livekit.CreateScenarioCollectionResponse.scenario_collection:type_name -> livekit.ScenarioCollection + 5, // 9: livekit.ListScenarioCollectionsResponse.scenario_collections:type_name -> livekit.ScenarioCollection + 4, // 10: livekit.ListScenariosResponse.scenarios:type_name -> livekit.Scenario + 1, // 11: livekit.SimulationRun.Job.status:type_name -> livekit.SimulationRun.Job.Status + 6, // 12: livekit.AgentSimulation.CreateSimulationRun:input_type -> livekit.CreateSimulationRunRequest + 8, // 13: livekit.AgentSimulation.GetSimulationRun:input_type -> livekit.GetSimulationRunRequest + 10, // 14: livekit.AgentSimulation.ListSimulationRuns:input_type -> livekit.ListSimulationRunsRequest + 12, // 15: livekit.AgentSimulation.CreateScenario:input_type -> livekit.CreateScenarioRequest + 14, // 16: livekit.AgentSimulation.CreateScenarioFromSession:input_type -> livekit.CreateScenarioFromSessionRequest + 16, // 17: livekit.AgentSimulation.DeleteScenario:input_type -> livekit.DeleteScenarioRequest + 18, // 18: livekit.AgentSimulation.CreateScenarioCollection:input_type -> livekit.CreateScenarioCollectionRequest + 20, // 19: livekit.AgentSimulation.DeleteScenarioCollection:input_type -> livekit.DeleteScenarioCollectionRequest + 22, // 20: livekit.AgentSimulation.ListScenarioCollections:input_type -> livekit.ListScenarioCollectionsRequest + 24, // 21: livekit.AgentSimulation.ListScenarios:input_type -> livekit.ListScenariosRequest + 26, // 22: livekit.AgentSimulation.AddScenarioToCollection:input_type -> livekit.AddScenarioToCollectionRequest + 28, // 23: livekit.AgentSimulation.RemoveScenarioFromCollection:input_type -> livekit.RemoveScenarioFromCollectionRequest + 7, // 24: livekit.AgentSimulation.CreateSimulationRun:output_type -> livekit.CreateSimulationRunResponse + 9, // 25: livekit.AgentSimulation.GetSimulationRun:output_type -> livekit.GetSimulationRunResponse + 11, // 26: livekit.AgentSimulation.ListSimulationRuns:output_type -> livekit.ListSimulationRunsResponse + 13, // 27: livekit.AgentSimulation.CreateScenario:output_type -> livekit.CreateScenarioResponse + 15, // 28: livekit.AgentSimulation.CreateScenarioFromSession:output_type -> livekit.CreateScenarioFromSessionResponse + 17, // 29: livekit.AgentSimulation.DeleteScenario:output_type -> livekit.DeleteScenarioResponse + 19, // 30: livekit.AgentSimulation.CreateScenarioCollection:output_type -> livekit.CreateScenarioCollectionResponse + 21, // 31: livekit.AgentSimulation.DeleteScenarioCollection:output_type -> livekit.DeleteScenarioCollectionResponse + 23, // 32: livekit.AgentSimulation.ListScenarioCollections:output_type -> livekit.ListScenarioCollectionsResponse + 25, // 33: livekit.AgentSimulation.ListScenarios:output_type -> livekit.ListScenariosResponse + 27, // 34: livekit.AgentSimulation.AddScenarioToCollection:output_type -> livekit.AddScenarioToCollectionResponse + 29, // 35: livekit.AgentSimulation.RemoveScenarioFromCollection:output_type -> livekit.RemoveScenarioFromCollectionResponse + 24, // [24:36] is the sub-list for method output_type + 12, // [12:24] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_livekit_agent_simulation_proto_init() } @@ -191,13 +1985,14 @@ func file_livekit_agent_simulation_proto_init() { 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: 0, - NumMessages: 2, + NumEnums: 3, + NumMessages: 28, 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 diff --git a/livekit/livekit_agent_simulation.twirp.go b/livekit/livekit_agent_simulation.twirp.go index b9fd4bd85..e8b2d6788 100644 --- a/livekit/livekit_agent_simulation.twirp.go +++ b/livekit/livekit_agent_simulation.twirp.go @@ -22,28 +22,50 @@ import ctxsetters "github.com/twitchtv/twirp/ctxsetters" // See https://twitchtv.github.io/twirp/docs/version_matrix.html const _ = twirp.TwirpPackageMinVersion_8_1_0 -// ================================ -// AgentSimulationService Interface -// ================================ +// ========================= +// AgentSimulation Interface +// ========================= -type AgentSimulationService 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) + + CreateScenarioCollection(context.Context, *CreateScenarioCollectionRequest) (*CreateScenarioCollectionResponse, error) + + DeleteScenarioCollection(context.Context, *DeleteScenarioCollectionRequest) (*DeleteScenarioCollectionResponse, error) + + ListScenarioCollections(context.Context, *ListScenarioCollectionsRequest) (*ListScenarioCollectionsResponse, error) + + ListScenarios(context.Context, *ListScenariosRequest) (*ListScenariosResponse, error) + + AddScenarioToCollection(context.Context, *AddScenarioToCollectionRequest) (*AddScenarioToCollectionResponse, error) + + RemoveScenarioFromCollection(context.Context, *RemoveScenarioFromCollectionRequest) (*RemoveScenarioFromCollectionResponse, error) } -// ====================================== -// AgentSimulationService Protobuf Client -// ====================================== +// =============================== +// AgentSimulation Protobuf Client +// =============================== -type agentSimulationServiceProtobufClient struct { +type agentSimulationProtobufClient struct { client HTTPClient - urls [1]string + urls [12]string interceptor twirp.Interceptor opts twirp.ClientOptions } -// NewAgentSimulationServiceProtobufClient creates a Protobuf client that implements the AgentSimulationService interface. +// NewAgentSimulationProtobufClient creates a Protobuf client that implements the AgentSimulation interface. // It communicates using Protobuf and can be configured with a custom HTTPClient. -func NewAgentSimulationServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulationService { +func NewAgentSimulationProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulation { if c, ok := client.(*http.Client); ok { client = withoutRedirects(c) } @@ -61,267 +83,3314 @@ func NewAgentSimulationServiceProtobufClient(baseURL string, client HTTPClient, pathPrefix = "/twirp" // default prefix } - // Build method URLs: []/./ - serviceURL := sanitizeBaseURL(baseURL) - serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulationService") - urls := [1]string{ - serviceURL + "CreateSimulationRun", + // Build method URLs: []/./ + serviceURL := sanitizeBaseURL(baseURL) + serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulation") + urls := [12]string{ + serviceURL + "CreateSimulationRun", + serviceURL + "GetSimulationRun", + serviceURL + "ListSimulationRuns", + serviceURL + "CreateScenario", + serviceURL + "CreateScenarioFromSession", + serviceURL + "DeleteScenario", + serviceURL + "CreateScenarioCollection", + serviceURL + "DeleteScenarioCollection", + serviceURL + "ListScenarioCollections", + serviceURL + "ListScenarios", + serviceURL + "AddScenarioToCollection", + serviceURL + "RemoveScenarioFromCollection", + } + + 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) CreateScenarioCollection(ctx context.Context, in *CreateScenarioCollectionRequest) (*CreateScenarioCollectionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioCollection") + caller := c.callCreateScenarioCollection + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioCollectionRequest) (*CreateScenarioCollectionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioCollectionRequest) when calling interceptor") + } + return c.callCreateScenarioCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callCreateScenarioCollection(ctx context.Context, in *CreateScenarioCollectionRequest) (*CreateScenarioCollectionResponse, error) { + out := new(CreateScenarioCollectionResponse) + 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) DeleteScenarioCollection(ctx context.Context, in *DeleteScenarioCollectionRequest) (*DeleteScenarioCollectionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioCollection") + caller := c.callDeleteScenarioCollection + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteScenarioCollectionRequest) (*DeleteScenarioCollectionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioCollectionRequest) when calling interceptor") + } + return c.callDeleteScenarioCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callDeleteScenarioCollection(ctx context.Context, in *DeleteScenarioCollectionRequest) (*DeleteScenarioCollectionResponse, error) { + out := new(DeleteScenarioCollectionResponse) + 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) ListScenarioCollections(ctx context.Context, in *ListScenarioCollectionsRequest) (*ListScenarioCollectionsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioCollections") + caller := c.callListScenarioCollections + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListScenarioCollectionsRequest) (*ListScenarioCollectionsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenarioCollectionsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioCollectionsRequest) when calling interceptor") + } + return c.callListScenarioCollections(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenarioCollectionsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioCollectionsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callListScenarioCollections(ctx context.Context, in *ListScenarioCollectionsRequest) (*ListScenarioCollectionsResponse, error) { + out := new(ListScenarioCollectionsResponse) + 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) 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[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) AddScenarioToCollection(ctx context.Context, in *AddScenarioToCollectionRequest) (*AddScenarioToCollectionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "AddScenarioToCollection") + caller := c.callAddScenarioToCollection + if c.interceptor != nil { + caller = func(ctx context.Context, req *AddScenarioToCollectionRequest) (*AddScenarioToCollectionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*AddScenarioToCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*AddScenarioToCollectionRequest) when calling interceptor") + } + return c.callAddScenarioToCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*AddScenarioToCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*AddScenarioToCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callAddScenarioToCollection(ctx context.Context, in *AddScenarioToCollectionRequest) (*AddScenarioToCollectionResponse, error) { + out := new(AddScenarioToCollectionResponse) + 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 +} + +func (c *agentSimulationProtobufClient) RemoveScenarioFromCollection(ctx context.Context, in *RemoveScenarioFromCollectionRequest) (*RemoveScenarioFromCollectionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "RemoveScenarioFromCollection") + caller := c.callRemoveScenarioFromCollection + if c.interceptor != nil { + caller = func(ctx context.Context, req *RemoveScenarioFromCollectionRequest) (*RemoveScenarioFromCollectionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RemoveScenarioFromCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RemoveScenarioFromCollectionRequest) when calling interceptor") + } + return c.callRemoveScenarioFromCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*RemoveScenarioFromCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*RemoveScenarioFromCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callRemoveScenarioFromCollection(ctx context.Context, in *RemoveScenarioFromCollectionRequest) (*RemoveScenarioFromCollectionResponse, error) { + out := new(RemoveScenarioFromCollectionResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[11], 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 [12]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 := [12]string{ + serviceURL + "CreateSimulationRun", + serviceURL + "GetSimulationRun", + serviceURL + "ListSimulationRuns", + serviceURL + "CreateScenario", + serviceURL + "CreateScenarioFromSession", + serviceURL + "DeleteScenario", + serviceURL + "CreateScenarioCollection", + serviceURL + "DeleteScenarioCollection", + serviceURL + "ListScenarioCollections", + serviceURL + "ListScenarios", + serviceURL + "AddScenarioToCollection", + serviceURL + "RemoveScenarioFromCollection", + } + + 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) CreateScenarioCollection(ctx context.Context, in *CreateScenarioCollectionRequest) (*CreateScenarioCollectionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioCollection") + caller := c.callCreateScenarioCollection + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioCollectionRequest) (*CreateScenarioCollectionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioCollectionRequest) when calling interceptor") + } + return c.callCreateScenarioCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callCreateScenarioCollection(ctx context.Context, in *CreateScenarioCollectionRequest) (*CreateScenarioCollectionResponse, error) { + out := new(CreateScenarioCollectionResponse) + 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) DeleteScenarioCollection(ctx context.Context, in *DeleteScenarioCollectionRequest) (*DeleteScenarioCollectionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioCollection") + caller := c.callDeleteScenarioCollection + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteScenarioCollectionRequest) (*DeleteScenarioCollectionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioCollectionRequest) when calling interceptor") + } + return c.callDeleteScenarioCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callDeleteScenarioCollection(ctx context.Context, in *DeleteScenarioCollectionRequest) (*DeleteScenarioCollectionResponse, error) { + out := new(DeleteScenarioCollectionResponse) + 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) ListScenarioCollections(ctx context.Context, in *ListScenarioCollectionsRequest) (*ListScenarioCollectionsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioCollections") + caller := c.callListScenarioCollections + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListScenarioCollectionsRequest) (*ListScenarioCollectionsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenarioCollectionsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioCollectionsRequest) when calling interceptor") + } + return c.callListScenarioCollections(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenarioCollectionsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioCollectionsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callListScenarioCollections(ctx context.Context, in *ListScenarioCollectionsRequest) (*ListScenarioCollectionsResponse, error) { + out := new(ListScenarioCollectionsResponse) + 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) 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[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) AddScenarioToCollection(ctx context.Context, in *AddScenarioToCollectionRequest) (*AddScenarioToCollectionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "AddScenarioToCollection") + caller := c.callAddScenarioToCollection + if c.interceptor != nil { + caller = func(ctx context.Context, req *AddScenarioToCollectionRequest) (*AddScenarioToCollectionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*AddScenarioToCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*AddScenarioToCollectionRequest) when calling interceptor") + } + return c.callAddScenarioToCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*AddScenarioToCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*AddScenarioToCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callAddScenarioToCollection(ctx context.Context, in *AddScenarioToCollectionRequest) (*AddScenarioToCollectionResponse, error) { + out := new(AddScenarioToCollectionResponse) + 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 +} + +func (c *agentSimulationJSONClient) RemoveScenarioFromCollection(ctx context.Context, in *RemoveScenarioFromCollectionRequest) (*RemoveScenarioFromCollectionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "RemoveScenarioFromCollection") + caller := c.callRemoveScenarioFromCollection + if c.interceptor != nil { + caller = func(ctx context.Context, req *RemoveScenarioFromCollectionRequest) (*RemoveScenarioFromCollectionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RemoveScenarioFromCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RemoveScenarioFromCollectionRequest) when calling interceptor") + } + return c.callRemoveScenarioFromCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*RemoveScenarioFromCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*RemoveScenarioFromCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callRemoveScenarioFromCollection(ctx context.Context, in *RemoveScenarioFromCollectionRequest) (*RemoveScenarioFromCollectionResponse, error) { + out := new(RemoveScenarioFromCollectionResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[11], 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 "CreateScenarioCollection": + s.serveCreateScenarioCollection(ctx, resp, req) + return + case "DeleteScenarioCollection": + s.serveDeleteScenarioCollection(ctx, resp, req) + return + case "ListScenarioCollections": + s.serveListScenarioCollections(ctx, resp, req) + return + case "ListScenarios": + s.serveListScenarios(ctx, resp, req) + return + case "AddScenarioToCollection": + s.serveAddScenarioToCollection(ctx, resp, req) + return + case "RemoveScenarioFromCollection": + s.serveRemoveScenarioFromCollection(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) serveCreateScenarioCollection(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.serveCreateScenarioCollectionJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateScenarioCollectionProtobuf(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) serveCreateScenarioCollectionJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioCollection") + 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(CreateScenarioCollectionRequest) + 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.CreateScenarioCollection + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioCollectionRequest) (*CreateScenarioCollectionResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioCollectionRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioCollectionResponse + 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 *CreateScenarioCollectionResponse and nil error while calling CreateScenarioCollection. 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) serveCreateScenarioCollectionProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioCollection") + 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(CreateScenarioCollectionRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.CreateScenarioCollection + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioCollectionRequest) (*CreateScenarioCollectionResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioCollectionRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioCollectionResponse + 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 *CreateScenarioCollectionResponse and nil error while calling CreateScenarioCollection. 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) serveDeleteScenarioCollection(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.serveDeleteScenarioCollectionJSON(ctx, resp, req) + case "application/protobuf": + s.serveDeleteScenarioCollectionProtobuf(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) serveDeleteScenarioCollectionJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioCollection") + 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(DeleteScenarioCollectionRequest) + 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.DeleteScenarioCollection + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteScenarioCollectionRequest) (*DeleteScenarioCollectionResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioCollectionRequest) when calling interceptor") + } + return s.AgentSimulation.DeleteScenarioCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteScenarioCollectionResponse + 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 *DeleteScenarioCollectionResponse and nil error while calling DeleteScenarioCollection. 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) serveDeleteScenarioCollectionProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioCollection") + 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(DeleteScenarioCollectionRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.DeleteScenarioCollection + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteScenarioCollectionRequest) (*DeleteScenarioCollectionResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioCollectionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioCollectionRequest) when calling interceptor") + } + return s.AgentSimulation.DeleteScenarioCollection(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioCollectionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioCollectionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteScenarioCollectionResponse + 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 *DeleteScenarioCollectionResponse and nil error while calling DeleteScenarioCollection. 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) serveListScenarioCollections(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.serveListScenarioCollectionsJSON(ctx, resp, req) + case "application/protobuf": + s.serveListScenarioCollectionsProtobuf(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) serveListScenarioCollectionsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioCollections") + 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(ListScenarioCollectionsRequest) + 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.ListScenarioCollections + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListScenarioCollectionsRequest) (*ListScenarioCollectionsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenarioCollectionsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioCollectionsRequest) when calling interceptor") + } + return s.AgentSimulation.ListScenarioCollections(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenarioCollectionsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioCollectionsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListScenarioCollectionsResponse + 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 *ListScenarioCollectionsResponse and nil error while calling ListScenarioCollections. 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) serveListScenarioCollectionsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioCollections") + 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(ListScenarioCollectionsRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.ListScenarioCollections + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListScenarioCollectionsRequest) (*ListScenarioCollectionsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenarioCollectionsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioCollectionsRequest) when calling interceptor") + } + return s.AgentSimulation.ListScenarioCollections(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenarioCollectionsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioCollectionsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListScenarioCollectionsResponse + 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 *ListScenarioCollectionsResponse and nil error while calling ListScenarioCollections. 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) serveAddScenarioToCollection(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.serveAddScenarioToCollectionJSON(ctx, resp, req) + case "application/protobuf": + s.serveAddScenarioToCollectionProtobuf(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) serveAddScenarioToCollectionJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "AddScenarioToCollection") + 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 } - - return &agentSimulationServiceProtobufClient{ - client: client, - urls: urls, - interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), - opts: clientOpts, + reqContent := new(AddScenarioToCollectionRequest) + 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 } -} -func (c *agentSimulationServiceProtobufClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { - ctx = ctxsetters.WithPackageName(ctx, "livekit") - ctx = ctxsetters.WithServiceName(ctx, "AgentSimulationService") - 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( + handler := s.AgentSimulation.AddScenarioToCollection + if s.interceptor != nil { + handler = func(ctx context.Context, req *AddScenarioToCollectionRequest) (*AddScenarioToCollectionResponse, error) { + resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*CreateSimulationRunRequest) + typedReq, ok := req.(*AddScenarioToCollectionRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*AddScenarioToCollectionRequest) when calling interceptor") } - return c.callCreateSimulationRun(ctx, typedReq) + return s.AgentSimulation.AddScenarioToCollection(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateSimulationRunResponse) + typedResp, ok := resp.(*AddScenarioToCollectionResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*AddScenarioToCollectionResponse) when calling interceptor") } return typedResp, err } return nil, err } } - return caller(ctx, in) -} -func (c *agentSimulationServiceProtobufClient) 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) + // Call service method + var respContent *AddScenarioToCollectionResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + if err != nil { - twerr, ok := err.(twirp.Error) - if !ok { - twerr = twirp.InternalErrorWith(err) - } - callClientError(ctx, c.opts.Hooks, twerr) - return nil, err + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *AddScenarioToCollectionResponse and nil error while calling AddScenarioToCollection. nil responses are not supported")) + return } - callClientResponseReceived(ctx, c.opts.Hooks) - - return out, nil -} - -// ================================== -// AgentSimulationService JSON Client -// ================================== - -type agentSimulationServiceJSONClient struct { - client HTTPClient - urls [1]string - interceptor twirp.Interceptor - opts twirp.ClientOptions -} + ctx = callResponsePrepared(ctx, s.hooks) -// NewAgentSimulationServiceJSONClient creates a JSON client that implements the AgentSimulationService interface. -// It communicates using JSON and can be configured with a custom HTTPClient. -func NewAgentSimulationServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulationService { - if c, ok := client.(*http.Client); ok { - client = withoutRedirects(c) + 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 } - clientOpts := twirp.ClientOptions{} - for _, o := range opts { - o(&clientOpts) - } + 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) - // 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 + 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) +} - // Build method URLs: []/./ - serviceURL := sanitizeBaseURL(baseURL) - serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulationService") - urls := [1]string{ - serviceURL + "CreateSimulationRun", +func (s *agentSimulationServer) serveAddScenarioToCollectionProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "AddScenarioToCollection") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return } - return &agentSimulationServiceJSONClient{ - client: client, - urls: urls, - interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), - opts: clientOpts, + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(AddScenarioToCollectionRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return } -} -func (c *agentSimulationServiceJSONClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { - ctx = ctxsetters.WithPackageName(ctx, "livekit") - ctx = ctxsetters.WithServiceName(ctx, "AgentSimulationService") - 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( + handler := s.AgentSimulation.AddScenarioToCollection + if s.interceptor != nil { + handler = func(ctx context.Context, req *AddScenarioToCollectionRequest) (*AddScenarioToCollectionResponse, error) { + resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*CreateSimulationRunRequest) + typedReq, ok := req.(*AddScenarioToCollectionRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*AddScenarioToCollectionRequest) when calling interceptor") } - return c.callCreateSimulationRun(ctx, typedReq) + return s.AgentSimulation.AddScenarioToCollection(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateSimulationRunResponse) + typedResp, ok := resp.(*AddScenarioToCollectionResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*AddScenarioToCollectionResponse) when calling interceptor") } return typedResp, err } return nil, err } } - return caller(ctx, in) -} - -func (c *agentSimulationServiceJSONClient) 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 -} - -// ===================================== -// AgentSimulationService Server Handler -// ===================================== - -type agentSimulationServiceServer struct { - AgentSimulationService - 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 -} - -// NewAgentSimulationServiceServer 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 NewAgentSimulationServiceServer(svc AgentSimulationService, 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 &agentSimulationServiceServer{ - AgentSimulationService: 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 *agentSimulationServiceServer) 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 *agentSimulationServiceServer) 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)) -} - -// AgentSimulationServicePathPrefix 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 AgentSimulationServicePathPrefix = "/twirp/livekit.AgentSimulationService/" -func (s *agentSimulationServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { - ctx := req.Context() - ctx = ctxsetters.WithPackageName(ctx, "livekit") - ctx = ctxsetters.WithServiceName(ctx, "AgentSimulationService") - ctx = ctxsetters.WithResponseWriter(ctx, resp) + // Call service method + var respContent *AddScenarioToCollectionResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() - 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)) + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *AddScenarioToCollectionResponse and nil error while calling AddScenarioToCollection. nil responses are not supported")) return } - // Verify path format: []/./ - prefix, pkgService, method := parseTwirpPath(req.URL.Path) - if pkgService != "livekit.AgentSimulationService" { - 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)) + 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 } - switch method { - case "CreateSimulationRun": - s.serveCreateSimulationRun(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 + 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 *agentSimulationServiceServer) serveCreateSimulationRun(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveRemoveScenarioFromCollection(ctx context.Context, resp http.ResponseWriter, req *http.Request) { header := req.Header.Get("Content-Type") i := strings.Index(header, ";") if i == -1 { @@ -329,9 +3398,9 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRun(ctx context.Cont } switch strings.TrimSpace(strings.ToLower(header[:i])) { case "application/json": - s.serveCreateSimulationRunJSON(ctx, resp, req) + s.serveRemoveScenarioFromCollectionJSON(ctx, resp, req) case "application/protobuf": - s.serveCreateSimulationRunProtobuf(ctx, resp, req) + s.serveRemoveScenarioFromCollectionProtobuf(ctx, resp, req) default: msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) twerr := badRouteError(msg, req.Method, req.URL.Path) @@ -339,9 +3408,9 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRun(ctx context.Cont } } -func (s *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveRemoveScenarioFromCollectionJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + ctx = ctxsetters.WithMethodName(ctx, "RemoveScenarioFromCollection") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) @@ -354,29 +3423,29 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context. s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } - reqContent := new(CreateSimulationRunRequest) + reqContent := new(RemoveScenarioFromCollectionRequest) 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.AgentSimulationService.CreateSimulationRun + handler := s.AgentSimulation.RemoveScenarioFromCollection if s.interceptor != nil { - handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + handler = func(ctx context.Context, req *RemoveScenarioFromCollectionRequest) (*RemoveScenarioFromCollectionResponse, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*CreateSimulationRunRequest) + typedReq, ok := req.(*RemoveScenarioFromCollectionRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*RemoveScenarioFromCollectionRequest) when calling interceptor") } - return s.AgentSimulationService.CreateSimulationRun(ctx, typedReq) + return s.AgentSimulation.RemoveScenarioFromCollection(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateSimulationRunResponse) + typedResp, ok := resp.(*RemoveScenarioFromCollectionResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RemoveScenarioFromCollectionResponse) when calling interceptor") } return typedResp, err } @@ -385,7 +3454,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context. } // Call service method - var respContent *CreateSimulationRunResponse + var respContent *RemoveScenarioFromCollectionResponse func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -396,7 +3465,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context. 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")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *RemoveScenarioFromCollectionResponse and nil error while calling RemoveScenarioFromCollection. nil responses are not supported")) return } @@ -422,9 +3491,9 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context. callResponseSent(ctx, s.hooks) } -func (s *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveRemoveScenarioFromCollectionProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + ctx = ctxsetters.WithMethodName(ctx, "RemoveScenarioFromCollection") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) @@ -436,28 +3505,28 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx cont s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } - reqContent := new(CreateSimulationRunRequest) + reqContent := new(RemoveScenarioFromCollectionRequest) if err = proto.Unmarshal(buf, reqContent); err != nil { s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) return } - handler := s.AgentSimulationService.CreateSimulationRun + handler := s.AgentSimulation.RemoveScenarioFromCollection if s.interceptor != nil { - handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + handler = func(ctx context.Context, req *RemoveScenarioFromCollectionRequest) (*RemoveScenarioFromCollectionResponse, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*CreateSimulationRunRequest) + typedReq, ok := req.(*RemoveScenarioFromCollectionRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*RemoveScenarioFromCollectionRequest) when calling interceptor") } - return s.AgentSimulationService.CreateSimulationRun(ctx, typedReq) + return s.AgentSimulation.RemoveScenarioFromCollection(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateSimulationRunResponse) + typedResp, ok := resp.(*RemoveScenarioFromCollectionResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RemoveScenarioFromCollectionResponse) when calling interceptor") } return typedResp, err } @@ -466,7 +3535,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx cont } // Call service method - var respContent *CreateSimulationRunResponse + var respContent *RemoveScenarioFromCollectionResponse func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -477,7 +3546,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx cont 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")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *RemoveScenarioFromCollectionResponse and nil error while calling RemoveScenarioFromCollection. nil responses are not supported")) return } @@ -501,39 +3570,98 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx cont callResponseSent(ctx, s.hooks) } -func (s *agentSimulationServiceServer) ServiceDescriptor() ([]byte, int) { +func (s *agentSimulationServer) ServiceDescriptor() ([]byte, int) { return twirpFileDescriptor8, 0 } -func (s *agentSimulationServiceServer) ProtocGenTwirpVersion() string { +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 *agentSimulationServiceServer) PathPrefix() string { - return baseServicePath(s.pathPrefix, "livekit", "AgentSimulationService") +func (s *agentSimulationServer) PathPrefix() string { + return baseServicePath(s.pathPrefix, "livekit", "AgentSimulation") } var twirpFileDescriptor8 = []byte{ - // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x50, 0xcd, 0x4a, 0xc3, 0x40, - 0x10, 0x26, 0x15, 0x95, 0x0e, 0xd8, 0xda, 0x15, 0x24, 0x54, 0x94, 0xd2, 0x0a, 0x16, 0x85, 0x14, - 0xf4, 0xd6, 0x9b, 0x3f, 0x08, 0x45, 0x11, 0x49, 0x6f, 0x5e, 0x62, 0x9a, 0x0c, 0x75, 0x30, 0xbb, - 0x1b, 0xb3, 0xbb, 0x39, 0xf8, 0x16, 0xbe, 0x86, 0x8f, 0xe6, 0x53, 0x48, 0x36, 0xab, 0xe9, 0xa1, - 0x7a, 0x9c, 0xef, 0x6f, 0x3e, 0x3e, 0x38, 0xca, 0xa8, 0xc4, 0x57, 0xd2, 0x51, 0xbc, 0x44, 0xa1, - 0x23, 0x45, 0xdc, 0x64, 0xb1, 0x26, 0x29, 0x82, 0xbc, 0x90, 0x5a, 0xb2, 0x6d, 0xc7, 0x0f, 0x3f, - 0x3c, 0xe8, 0x5f, 0x17, 0x18, 0x6b, 0x9c, 0xff, 0x6a, 0x42, 0x23, 0x42, 0x7c, 0x33, 0xa8, 0x34, - 0x3b, 0x04, 0xa8, 0x13, 0x44, 0xcc, 0xd1, 0xf7, 0x06, 0xde, 0xb8, 0x1d, 0xb6, 0x2d, 0xf2, 0x10, - 0x73, 0x64, 0x67, 0xd0, 0xab, 0xe9, 0x14, 0x55, 0x52, 0x50, 0x5e, 0xb9, 0xfd, 0x96, 0x55, 0xed, - 0x5a, 0xe2, 0xa6, 0xc1, 0xd9, 0x09, 0x74, 0x85, 0xe1, 0x2b, 0x5d, 0x94, 0xbf, 0x31, 0xf0, 0xc6, - 0x9b, 0x61, 0x47, 0x18, 0xde, 0x7c, 0x57, 0xc3, 0x19, 0x1c, 0xac, 0xad, 0xa4, 0x72, 0x29, 0x14, - 0xb2, 0x53, 0xe8, 0x35, 0x19, 0x51, 0x61, 0x44, 0x44, 0xa9, 0xab, 0xd6, 0x55, 0xab, 0x8e, 0x59, - 0x7a, 0xfe, 0x0e, 0xfb, 0x97, 0x55, 0x8f, 0x26, 0x69, 0x8e, 0x45, 0x49, 0x09, 0xb2, 0x67, 0xd8, - 0x5b, 0xf3, 0x84, 0x8d, 0x02, 0xb7, 0x4c, 0xf0, 0xf7, 0x2a, 0xfd, 0xe3, 0xff, 0x45, 0x75, 0xcf, - 0xab, 0xdb, 0xa7, 0xd1, 0x92, 0xf4, 0x8b, 0x59, 0x04, 0x89, 0xe4, 0x13, 0xe7, 0x98, 0xd8, 0xfd, - 0x13, 0x99, 0xfd, 0x00, 0x9f, 0xad, 0x9d, 0x7b, 0x2a, 0xf1, 0x8e, 0x74, 0xf0, 0x58, 0x51, 0x5f, - 0xad, 0x8e, 0xbb, 0xa7, 0x53, 0x0b, 0x2c, 0xb6, 0xac, 0xe5, 0xe2, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0xa5, 0x43, 0x3b, 0x84, 0xd4, 0x01, 0x00, 0x00, + // 1230 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xdd, 0x72, 0xdb, 0x44, + 0x14, 0x46, 0xb2, 0xe3, 0xc4, 0x27, 0x8d, 0xe3, 0x6c, 0x9c, 0x44, 0x55, 0x49, 0xec, 0x28, 0x19, + 0xea, 0x16, 0xe2, 0x30, 0x01, 0x2e, 0xc8, 0x0d, 0x63, 0x62, 0x27, 0x75, 0x09, 0x26, 0xc8, 0x29, + 0x9d, 0x32, 0x30, 0xc6, 0xb6, 0x76, 0x82, 0x5a, 0x5b, 0x72, 0xb5, 0x52, 0x86, 0x19, 0xde, 0x83, + 0x1b, 0x9e, 0x00, 0x1e, 0x82, 0x37, 0x60, 0x86, 0x1b, 0x1e, 0x81, 0x1b, 0xee, 0xb9, 0x65, 0x18, + 0x49, 0xab, 0x7f, 0xad, 0xec, 0x84, 0xc2, 0xf4, 0xd2, 0x67, 0xcf, 0x9e, 0x3d, 0xdf, 0xb7, 0xdf, + 0x7e, 0x47, 0x63, 0xd8, 0x19, 0xab, 0xd7, 0xf8, 0x85, 0x6a, 0xf6, 0x07, 0x57, 0x58, 0x33, 0xfb, + 0x44, 0x9d, 0x58, 0xe3, 0x81, 0xa9, 0xea, 0x5a, 0x63, 0x6a, 0xe8, 0xa6, 0x8e, 0x16, 0xe9, 0xba, + 0xf4, 0x6b, 0x1e, 0x56, 0x7a, 0xfe, 0xaa, 0x6c, 0x69, 0xa8, 0x04, 0xbc, 0xaa, 0x08, 0x5c, 0x8d, + 0xab, 0x17, 0x65, 0x5e, 0x55, 0xd0, 0x36, 0xc0, 0xd4, 0xd0, 0x9f, 0xe3, 0x91, 0xd9, 0x57, 0x15, + 0x81, 0x77, 0xe2, 0x45, 0x1a, 0xe9, 0x28, 0xe8, 0x03, 0x28, 0x10, 0x73, 0x60, 0x5a, 0x44, 0xc8, + 0xd5, 0xb8, 0x7a, 0xe9, 0x68, 0xbb, 0x41, 0x4b, 0x37, 0x22, 0x65, 0x1b, 0x3d, 0x27, 0x49, 0xa6, + 0xc9, 0xe8, 0x6d, 0x58, 0x73, 0x5b, 0x53, 0x30, 0x19, 0x19, 0xea, 0xd4, 0x4e, 0x13, 0xf2, 0x4e, + 0xf1, 0xb2, 0xb3, 0xd0, 0x0a, 0xe2, 0xa8, 0x02, 0x0b, 0xd8, 0x30, 0x74, 0x43, 0x58, 0x70, 0x12, + 0xdc, 0x1f, 0x76, 0x63, 0x23, 0x03, 0x0f, 0x4c, 0xac, 0xf4, 0x07, 0xa6, 0x50, 0xa8, 0x71, 0xf5, + 0x9c, 0x5c, 0xa4, 0x91, 0xa6, 0x89, 0x1a, 0x90, 0x7f, 0xae, 0x0f, 0x89, 0xb0, 0x58, 0xcb, 0xd5, + 0x97, 0x8f, 0x44, 0x46, 0x5b, 0x8f, 0xf5, 0xa1, 0xec, 0xe4, 0x89, 0x7f, 0x70, 0x90, 0x7b, 0xac, + 0x0f, 0x13, 0xf8, 0x3f, 0xf4, 0x01, 0xf2, 0x0e, 0xc0, 0x5d, 0x76, 0xa5, 0x38, 0x48, 0x09, 0xee, + 0xa8, 0x1a, 0x31, 0x0d, 0x6b, 0x64, 0x27, 0xb9, 0x0c, 0x15, 0xe5, 0x48, 0x2c, 0xc0, 0x96, 0x0f, + 0x61, 0x93, 0x9e, 0x41, 0xc1, 0xad, 0x85, 0x10, 0x94, 0x7a, 0x97, 0xcd, 0xcb, 0x27, 0xbd, 0xfe, + 0x45, 0xbb, 0xdb, 0xea, 0x74, 0xcf, 0xca, 0x6f, 0x84, 0x62, 0xf2, 0x93, 0x6e, 0xd7, 0x8e, 0x71, + 0xa8, 0x02, 0x65, 0x1a, 0x3b, 0xf9, 0xec, 0xd3, 0x8b, 0xf3, 0xf6, 0x65, 0xbb, 0x55, 0xe6, 0xd1, + 0x1a, 0xac, 0xd0, 0xe8, 0x69, 0xb3, 0x73, 0xde, 0x6e, 0x95, 0x73, 0xd2, 0x57, 0x7e, 0xe9, 0x0d, + 0x58, 0xa3, 0x8b, 0x67, 0xed, 0x6e, 0x5b, 0x6e, 0x5e, 0xbe, 0x82, 0xea, 0x7f, 0xf1, 0xb0, 0xd4, + 0x1b, 0x61, 0x6d, 0x60, 0xa8, 0xfa, 0x4d, 0xa5, 0x54, 0x81, 0x85, 0xf1, 0x60, 0x88, 0xc7, 0x94, + 0x27, 0xf7, 0x47, 0x82, 0xc4, 0x7c, 0x0a, 0x89, 0x07, 0x80, 0x5c, 0x35, 0xe1, 0xef, 0xa6, 0x78, + 0x64, 0x0e, 0xdc, 0x4c, 0x57, 0x2d, 0xae, 0xce, 0xda, 0xa1, 0x05, 0xb4, 0x0f, 0x25, 0xa2, 0x5b, + 0xc6, 0x08, 0xf7, 0x0d, 0x5d, 0x9f, 0xd8, 0xbd, 0x14, 0xdc, 0xa2, 0x6e, 0x54, 0xd6, 0xf5, 0x49, + 0x47, 0x89, 0xe9, 0x6b, 0x31, 0xae, 0xaf, 0x77, 0x7d, 0x5d, 0x2c, 0x39, 0xba, 0x10, 0x02, 0x5d, + 0x50, 0xfc, 0x71, 0x39, 0xf8, 0x57, 0x5d, 0x0c, 0x5f, 0x75, 0x6b, 0xd6, 0x7d, 0x94, 0xe1, 0x8e, + 0x77, 0x1f, 0xed, 0x66, 0xeb, 0x59, 0x99, 0x4b, 0xf2, 0xce, 0x4b, 0x3f, 0x71, 0x80, 0xbc, 0x73, + 0x4f, 0xf4, 0xf1, 0x18, 0x3b, 0xcc, 0xbc, 0x9a, 0x1b, 0x88, 0x12, 0x91, 0x8f, 0x13, 0x71, 0x08, + 0x45, 0x42, 0x4f, 0xb6, 0x39, 0xb7, 0x5f, 0xdb, 0x5a, 0x82, 0x0b, 0x39, 0xc8, 0x91, 0xfe, 0xe6, + 0x40, 0x3c, 0x71, 0xb6, 0x47, 0x5e, 0x90, 0x8c, 0x5f, 0x5a, 0x98, 0x98, 0xb1, 0x1e, 0xb9, 0x78, + 0x8f, 0xdb, 0x00, 0xee, 0x5d, 0x6b, 0x83, 0x09, 0xf6, 0x20, 0x38, 0x91, 0xee, 0x60, 0x82, 0xd3, + 0x8d, 0x25, 0xc7, 0x30, 0x96, 0xfb, 0xb0, 0xaa, 0x59, 0x93, 0x90, 0x3d, 0xba, 0xf2, 0x5a, 0x90, + 0x4b, 0x9a, 0x35, 0x09, 0x9a, 0x23, 0xe8, 0x7d, 0xd8, 0xf4, 0xfa, 0xef, 0x8f, 0x7c, 0x7a, 0xed, + 0xfe, 0x5c, 0x91, 0x55, 0x48, 0x82, 0xfb, 0x8e, 0x82, 0x36, 0xa1, 0x60, 0xe0, 0x2b, 0xbb, 0x01, + 0x57, 0x5f, 0xf4, 0x97, 0xd4, 0x81, 0x7b, 0xa9, 0xf8, 0xc9, 0x54, 0xd7, 0x08, 0x46, 0x0f, 0x61, + 0x2d, 0xe8, 0xa8, 0x6f, 0x58, 0x5a, 0xc0, 0xc3, 0x2a, 0x09, 0xef, 0xe8, 0x28, 0x92, 0x02, 0x5b, + 0x67, 0xd8, 0xbc, 0x0d, 0x8f, 0xa9, 0xa7, 0xf0, 0xe9, 0xa7, 0xb4, 0x40, 0x48, 0x9e, 0x42, 0xbb, + 0xad, 0x43, 0xce, 0xb0, 0x34, 0xa7, 0xfe, 0xf2, 0xd1, 0x66, 0xba, 0x39, 0xca, 0x76, 0x8a, 0x74, + 0x0c, 0x77, 0xcf, 0x55, 0x12, 0x2d, 0x43, 0xe6, 0xeb, 0x56, 0x7a, 0x04, 0x62, 0xda, 0x5e, 0x9f, + 0xb1, 0xbc, 0x61, 0x69, 0x44, 0xe0, 0x1c, 0xf5, 0xb1, 0x9a, 0x70, 0x72, 0xa4, 0xdf, 0x39, 0xd8, + 0xa0, 0xec, 0x7b, 0xda, 0x9c, 0x8f, 0x30, 0xff, 0x71, 0xf0, 0x59, 0xf6, 0x94, 0x9b, 0xdb, 0x9e, + 0xf2, 0x2c, 0x7b, 0xba, 0x95, 0xd8, 0xa4, 0x33, 0xd8, 0x8c, 0xc3, 0xa2, 0xec, 0x1c, 0xc0, 0x92, + 0xb7, 0x83, 0x5e, 0x53, 0xca, 0xfb, 0xf4, 0x53, 0xa4, 0x5f, 0x38, 0xa8, 0x45, 0x2b, 0x9d, 0x1a, + 0xfa, 0xa4, 0x87, 0x09, 0xb1, 0x79, 0x9c, 0x8f, 0xab, 0x2d, 0x58, 0xf4, 0xac, 0x95, 0xa7, 0xd2, + 0x77, 0x4d, 0x95, 0x8d, 0x2d, 0x97, 0xf1, 0x90, 0x7c, 0xea, 0xf3, 0x61, 0xea, 0x83, 0xe7, 0xb5, + 0x10, 0x79, 0x5e, 0x32, 0xec, 0x66, 0xf4, 0x7f, 0x3b, 0x52, 0x9e, 0xc2, 0x46, 0x0b, 0x8f, 0xf1, + 0x8d, 0x45, 0x53, 0x85, 0x65, 0x1f, 0xaf, 0x4f, 0x06, 0x78, 0xa1, 0x8e, 0x22, 0x09, 0xb0, 0x19, + 0x2f, 0xec, 0x76, 0x28, 0x7d, 0x01, 0xd5, 0x28, 0x8c, 0x80, 0x92, 0x7f, 0xa3, 0x58, 0x69, 0x1a, + 0xbf, 0xde, 0x70, 0x5d, 0xca, 0xce, 0x39, 0xac, 0xa7, 0x5c, 0x13, 0x25, 0xea, 0x5e, 0x82, 0xa8, + 0x50, 0x05, 0x94, 0xbc, 0x40, 0xe9, 0x1a, 0xaa, 0x51, 0x8c, 0x37, 0x46, 0xc2, 0x96, 0x0d, 0x9f, + 0xf1, 0x24, 0x24, 0xa8, 0xb1, 0xcf, 0xa5, 0x2c, 0x7f, 0x04, 0x3b, 0x8e, 0xb1, 0x24, 0x32, 0xe6, + 0x75, 0xa6, 0x97, 0x50, 0x65, 0x16, 0xa0, 0x6c, 0x76, 0xa1, 0x92, 0xd2, 0xbd, 0x67, 0x57, 0x99, + 0x74, 0xae, 0x27, 0x81, 0x11, 0xe9, 0x05, 0x54, 0xc2, 0x47, 0x92, 0xff, 0x94, 0xc4, 0x47, 0xb0, + 0x11, 0x3b, 0x8c, 0xa2, 0x8a, 0xcc, 0x7d, 0x6e, 0x8e, 0xb9, 0xff, 0x03, 0x07, 0x3b, 0x4d, 0x45, + 0xf1, 0x96, 0x2e, 0xff, 0x27, 0x19, 0xc4, 0xdf, 0x60, 0x2e, 0xf1, 0x06, 0x77, 0xa1, 0xca, 0xec, + 0x8b, 0xca, 0xe4, 0x47, 0x0e, 0xf6, 0x64, 0x3c, 0xd1, 0xaf, 0x23, 0xa6, 0xf2, 0xba, 0x00, 0x78, + 0x0b, 0xf6, 0xb3, 0x9b, 0x73, 0x51, 0x1c, 0xfd, 0x56, 0x84, 0xd5, 0xa6, 0x3d, 0x6f, 0x82, 0xc1, + 0x88, 0xbe, 0x81, 0xf5, 0x94, 0x8f, 0x11, 0xb4, 0xe7, 0x5f, 0x25, 0xfb, 0x53, 0x4d, 0xdc, 0xcf, + 0x4e, 0xa2, 0x42, 0x79, 0x0a, 0xe5, 0xf8, 0xd7, 0x03, 0xaa, 0xf9, 0x3b, 0x19, 0x9f, 0x2f, 0xe2, + 0x6e, 0x46, 0x06, 0x2d, 0xfc, 0x35, 0xa0, 0xe4, 0x47, 0x01, 0x92, 0xfc, 0x8d, 0xcc, 0xaf, 0x0d, + 0x71, 0x2f, 0x33, 0x87, 0x96, 0xff, 0x1c, 0x4a, 0x51, 0xa3, 0x44, 0x3b, 0x71, 0xbc, 0xd1, 0x61, + 0x20, 0x56, 0x99, 0xeb, 0xb4, 0xa4, 0x01, 0x77, 0x99, 0xa3, 0x09, 0x3d, 0x60, 0xec, 0x4e, 0x8e, + 0x5f, 0xf1, 0xe1, 0x3c, 0xa9, 0x01, 0x8c, 0xa8, 0x0b, 0x86, 0x60, 0xa4, 0xce, 0xb4, 0x10, 0x8c, + 0xf4, 0xd1, 0x84, 0x74, 0x10, 0x58, 0x23, 0x04, 0xd5, 0x19, 0xad, 0x25, 0xde, 0x8a, 0xf8, 0x60, + 0x8e, 0xcc, 0xe0, 0x40, 0x96, 0x93, 0x87, 0x0e, 0x9c, 0x31, 0x64, 0x42, 0x07, 0xce, 0x1a, 0x0b, + 0x68, 0x0c, 0x5b, 0x0c, 0x57, 0x47, 0xf7, 0xa3, 0xda, 0x61, 0x0e, 0x0e, 0xb1, 0x3e, 0x3b, 0xd1, + 0x1f, 0x10, 0x2b, 0x11, 0x8f, 0x45, 0xdb, 0xa9, 0x5b, 0xfd, 0xca, 0x3b, 0xac, 0xe5, 0xa0, 0x7b, + 0x86, 0xa1, 0x85, 0xba, 0xcf, 0xb6, 0xe2, 0x50, 0xf7, 0x33, 0xbc, 0x11, 0x7d, 0x0f, 0x6f, 0x66, + 0xb9, 0x0f, 0x7a, 0xc7, 0xaf, 0x34, 0x87, 0x83, 0x8a, 0x07, 0x73, 0x66, 0xbb, 0x87, 0x7f, 0x7c, + 0xfa, 0xe5, 0xde, 0x95, 0x6a, 0x7e, 0x6b, 0x0d, 0x1b, 0x23, 0x7d, 0x72, 0x48, 0xb7, 0x1e, 0x3a, + 0xff, 0x72, 0x8d, 0xf4, 0xb1, 0x17, 0xf8, 0x99, 0x5f, 0x39, 0x57, 0xaf, 0xf1, 0x27, 0xaa, 0xd9, + 0xb8, 0xb0, 0x97, 0xfe, 0xe4, 0x4b, 0xf4, 0xf7, 0xf1, 0xb1, 0x13, 0x18, 0x16, 0x9c, 0x2d, 0xef, + 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x9e, 0xef, 0x30, 0xba, 0x3a, 0x13, 0x00, 0x00, } diff --git a/protobufs/livekit_agent_simulation.proto b/protobufs/livekit_agent_simulation.proto index a920563b7..30d487881 100644 --- a/protobufs/livekit_agent_simulation.proto +++ b/protobufs/livekit_agent_simulation.proto @@ -49,10 +49,40 @@ message SimulationRun { 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; +} + +message ScenarioCollection { + string id = 1; + string project_id = 2; + string label = 3; + int64 created_at = 4; + repeated Scenario scenarios = 5; +} + message CreateSimulationRunRequest { - string agent_name = 1; - string agent_description = 2; - int32 num_simulations = 3; + string project_id = 1; + string agent_name = 2; + string agent_description = 3; + int32 num_simulations = 4; + string scenario_collection_id = 5; + string region = 6; } message CreateSimulationRunResponse { string simulation_run_id = 1; @@ -73,8 +103,91 @@ message ListSimulationRunsResponse { repeated SimulationRun runs = 1; } +message CreateScenarioRequest { + string project_id = 1; + string label = 2; + string instructions = 3; + string agent_expectations = 4; + string scenario_collection_id = 5; +} +message CreateScenarioResponse { + Scenario scenario = 1; +} + +message CreateScenarioFromSessionRequest { + string project_id = 1; + string room_id = 2; + string scenario_collection_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 CreateScenarioCollectionRequest { + string project_id = 1; + string label = 2; +} +message CreateScenarioCollectionResponse { + ScenarioCollection scenario_collection = 1; +} + +message DeleteScenarioCollectionRequest { + string project_id = 1; + string scenario_collection_id = 2; +} +message DeleteScenarioCollectionResponse {} + +message ListScenarioCollectionsRequest { + string project_id = 1; +} +message ListScenarioCollectionsResponse { + repeated ScenarioCollection scenario_collections = 1; +} + +message ListScenariosRequest { + string project_id = 1; + string scenario_collection_id = 2; +} +message ListScenariosResponse { + repeated Scenario scenarios = 1; +} + +message AddScenarioToCollectionRequest { + string project_id = 1; + string scenario_collection_id = 2; + string scenario_id = 3; +} +message AddScenarioToCollectionResponse {} + +message RemoveScenarioFromCollectionRequest { + string project_id = 1; + string scenario_collection_id = 2; + string scenario_id = 3; +} +message RemoveScenarioFromCollectionResponse {} + 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 CreateScenarioCollection(CreateScenarioCollectionRequest) returns (CreateScenarioCollectionResponse); + rpc DeleteScenarioCollection(DeleteScenarioCollectionRequest) returns (DeleteScenarioCollectionResponse); + rpc ListScenarioCollections(ListScenarioCollectionsRequest) returns (ListScenarioCollectionsResponse); + + rpc ListScenarios(ListScenariosRequest) returns (ListScenariosResponse); + rpc AddScenarioToCollection(AddScenarioToCollectionRequest) returns (AddScenarioToCollectionResponse); + rpc RemoveScenarioFromCollection(RemoveScenarioFromCollectionRequest) returns (RemoveScenarioFromCollectionResponse); }